@openclaw/slack 2026.7.2-beta.7 → 2026.8.1-beta.3
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-inspect-DEKpg9Ip.js → account-inspect-YJvFBbCR.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CHAeNZOX.js → accounts-BlzxuYle.js} +7 -3
- package/dist/{accounts.runtime-BHD4Ma2R.js → accounts.runtime-CbabBL8x.js} +1 -1
- package/dist/{action-runtime-DfuYoMjG.js → action-runtime-D6jg2CQd.js} +193 -125
- package/dist/action-runtime.runtime-JtoOK9l5.js +2 -0
- package/dist/{actions-D3NuJvva.js → actions-DFk0ANVB.js} +116 -235
- package/dist/actions.runtime-CYLsYRai.js +2 -0
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-BA05P0QT.js → approval-handler.runtime-BNvAoKdK.js} +53 -14
- package/dist/{channel-B9fVdW3s.js → channel-CA5w7qDF.js} +209 -110
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-DXyos1d2.js → channel-type-CZWv55Wu.js} +9 -12
- package/dist/{config-adapter-CxBQH8fq.js → channel.setup-CpyYsEXH.js} +83 -25
- package/dist/{config-schema-SgZT6nXV.js → config-schema-CN3XZRX5.js} +27 -17
- package/dist/conversation-binding-route-DFVLUdYF.js +115 -0
- package/dist/{directory-config-CnCIAktf.js → directory-config-BGYyuzWh.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DKunWh3A.js → directory-live-DjUJQLbq.js} +13 -22
- package/dist/{doctor-contract-CsGH1Dfc.js → doctor-contract-BAy7-EUQ.js} +30 -3
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-NQZti9t-.js → group-policy-DyfB_ZIE.js} +282 -183
- package/dist/index.js +4 -1
- package/dist/{message-tool-api-DkhFpMoy.js → message-tool-api-CqMr5Rmc.js} +14 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CmKz0wtI.js → monitor-Chrecrb9.js} +3 -3
- package/dist/{outbound-adapter-BkuMp2Vs.js → outbound-adapter-DuRqAQXK.js} +35 -23
- package/dist/{pipeline.runtime-DgtmuYCP.js → pipeline.runtime-Bbfd5VFW.js} +1386 -929
- package/dist/{policy-PRysPn23.js → policy-BKXSxrIS.js} +18 -14
- package/dist/{probe-CgDsSops.js → probe-BVA65leh.js} +38 -18
- package/dist/{provider-DmRizMZt.js → provider-CUUiwsg2.js} +3454 -2601
- package/dist/{relay-source-Blxj8xb4.js → relay-source-mhpMMRG-.js} +11 -21
- package/dist/{replies-4s_Vq_z9.js → replies-SnWyXcsL.js} +84 -27
- package/dist/{resolve-channels-yEqmM-3I.js → resolve-channels-BSpqC8jU.js} +39 -12
- package/dist/{resolve-users-BOrt5K-5.js → resolve-users-Dvz9pDe0.js} +28 -5
- package/dist/{runtime-api-QMb-Q5Ko.js → runtime-api-DBi7xc_g.js} +3 -3
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BJSrkAp6.js → scopes-BSk4GZvZ.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DsLeZpST.js → send-CtnOxKCc.js} +249 -163
- package/dist/{send.runtime-gUdK6V3h.js → send.runtime-kYctMHSd.js} +1 -1
- package/dist/setup-entry.js +1 -4
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BeNzrMrJ.js → setup-surface-BPFfp6So.js} +6 -6
- package/dist/{shared-DgIN3Dcr.js → shared-DJBaslN7.js} +45 -45
- package/dist/{block-text-DkHaoGem.js → slack-client-kind-BXyOOICI.js} +17 -2
- package/dist/{slash-dispatch.runtime-zPkyl7dB.js → slash-dispatch.runtime-Cf2FTrnf.js} +2 -2
- package/dist/{streaming-compat-3_X-21wW.js → streaming-compat-B-e0mqM0.js} +3 -8
- package/dist/{target-parsing-N6lHogYZ.js → target-parsing-BnMD2ZqZ.js} +40 -2
- package/dist/{targets-KmjP2E8s.js → targets-Cx5W_n3W.js} +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/undici/lib/cache/memory-cache-store.js +54 -9
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
- package/node_modules/undici/lib/core/request.js +12 -1
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -2
- package/node_modules/undici/lib/handler/cache-handler.js +246 -64
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +3 -3
- package/node_modules/undici/lib/handler/retry-handler.js +24 -0
- package/node_modules/undici/lib/interceptor/cache.js +159 -52
- package/node_modules/undici/lib/util/cache.js +324 -62
- package/node_modules/undici/lib/util/date.js +23 -6
- package/node_modules/undici/lib/web/cookies/util.js +79 -9
- package/node_modules/undici/package.json +1 -1
- package/openclaw.plugin.json +280 -33
- package/package.json +9 -11
- package/skills/slack/SKILL.md +10 -68
- package/dist/account-reply-mode-DrUXogvO.js +0 -14
- package/dist/action-runtime.runtime-DQErZYpz.js +0 -2
- package/dist/actions.runtime-BIRU_G4M.js +0 -2
- package/dist/channel.setup-CLP5oTvh.js +0 -56
- package/dist/preflight-audio.runtime-D5Bgags0.js +0 -3
- package/dist/slash-plugin-commands.runtime-Dosfcx3X.js +0 -2
- 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/dist/{security-audit-DR097212.js → security-audit-B_yKr7MW.js} +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resolveSlackOperationToken, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
5
|
-
import {
|
|
1
|
+
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resolveSlackOperationToken, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom } from "./accounts-BlzxuYle.js";
|
|
2
|
+
import { n as resolveSlackConversationBindingRoute, r as resolveSlackReplyToMode, t as normalizeSlackRouteBindingConfig } from "./conversation-binding-route-DFVLUdYF.js";
|
|
3
|
+
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, n as formatSlackTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId, t as canonicalizeSlackApiTargetId } from "./target-parsing-BnMD2ZqZ.js";
|
|
4
|
+
import { t as slackContextTargetsMatch } from "./targets-Cx5W_n3W.js";
|
|
5
|
+
import { At as isSlackApprovalAuthorizedSender, B as SLACK_EDIT_TEXT_MAX_BYTES, Ct as shouldHandleSlackNativeApprovalRequest, Dt as isSlackWorkspaceInstallation, Et as getSlackInstallationKind, Ft as resolveSlackExecApprovalTarget, G as buildSlackPresentationBlocks, It as shouldSuppressLocalSlackExecApprovalPrompt, K as canRenderSlackPresentation, Mt as isSlackExecApprovalAuthorizedSender, Nt as isSlackExecApprovalClientEnabled, Rt as resolveSlackAutoThreadId, St as resolveTurnSourceSlackOriginTarget, Tt as slackTargetsMatch, U as SLACK_TEXT_LIMIT, _t as normalizeSlackForwardTarget, a as qualifySlackConversationId, b as resolveSlackReplyBlocks, bt as resolveSessionSlackOriginTarget, dt as SLACK_PRESENTATION_CAPABILITIES, g as assertSlackDetachedTargetAllowed, gt as isSlackAnyNativeApprovalClientEnabled, ht as hasSlackPluginApprovers, i as resolveSlackGroupToolPolicy, jt as getSlackExecApprovalApprovers, kt as getSlackApprovalApprovers, o as qualifySlackRoutePeerId, q as countSlackTextUtf8Bytes, r as resolveSlackGroupRequireMention, st as renderSlackMessagePresentationFallbackText, vt as normalizeSlackOriginTarget, wt as shouldHandleSlackPluginViaForwardingSession, x as resolveSlackReplyDeliveryMessages, xt as resolveSlackFallbackOriginTarget, y as resolveSlackReplyBlockResolution, yt as resolveEnterpriseApprovalTeamId } from "./group-policy-DyfB_ZIE.js";
|
|
6
6
|
import { t as isSlackPluginAccountConfigured } from "./account-configured-BwfXBo_F.js";
|
|
7
7
|
import { n as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-DUGhaYKq.js";
|
|
8
|
-
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-
|
|
9
|
-
import { S as resolveConfiguredFromRequiredCredentialStatuses,
|
|
10
|
-
import {
|
|
8
|
+
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-CqMr5Rmc.js";
|
|
9
|
+
import { S as resolveConfiguredFromRequiredCredentialStatuses, d as getSlackWriteClient, r as formatSlackError, v as DEFAULT_ACCOUNT_ID$1, x as projectCredentialSnapshotFields, y as PAIRING_APPROVED_MESSAGE } from "./probe-BVA65leh.js";
|
|
10
|
+
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-CZWv55Wu.js";
|
|
11
11
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
12
|
-
import { n as slackConfigAdapter, r as slackSecurityAdapter, t as createSlackPluginBase } from "./shared-
|
|
13
|
-
import { a as slackSetupContract, i as
|
|
12
|
+
import { n as slackConfigAdapter, r as slackSecurityAdapter, t as createSlackPluginBase } from "./shared-DJBaslN7.js";
|
|
13
|
+
import { a as slackSetupContract, i as createSlackSetupWizardProxy, o as SLACK_CHANNEL } from "./channel.setup-CpyYsEXH.js";
|
|
14
14
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
15
15
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
16
16
|
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
17
|
-
import { buildOutboundBaseSessionKey, normalizeMessageChannel } from "openclaw/plugin-sdk/routing";
|
|
17
|
+
import { buildOutboundBaseSessionKey, normalizeMessageChannel, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
18
18
|
import { buildLegacyDmAccountAllowlistAdapter, createAccountScopedAllowlistNameResolver, createFlatAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
19
19
|
import { buildThreadAwareOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
20
20
|
import { createChannelMessageAdapterFromOutbound, createRuntimeOutboundDelegates, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -24,7 +24,6 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
24
24
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
25
25
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
26
26
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
27
|
-
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
28
27
|
import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
29
28
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
30
29
|
import { createChannelNativeOriginTargetResolver, createNativeApprovalForwardingFallbackSuppressor } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
@@ -32,20 +31,6 @@ import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
|
32
31
|
import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
33
32
|
import { normalizeLegacyInteractiveReply, normalizeMessagePresentation } from "openclaw/plugin-sdk/interactive-runtime";
|
|
34
33
|
import { readPositiveIntegerParam, readStringParam } from "openclaw/plugin-sdk/param-readers";
|
|
35
|
-
//#region extensions/slack/src/action-threading.ts
|
|
36
|
-
function resolveSlackAutoThreadId(params) {
|
|
37
|
-
const context = params.toolContext;
|
|
38
|
-
if (!context?.currentChannelId && !context?.currentMessagingTarget) return;
|
|
39
|
-
if (!slackContextTargetsMatch(params.to, context)) return;
|
|
40
|
-
if (!context.currentThreadTs) {
|
|
41
|
-
if (context.sameChannelThreadRequired) throw new Error("Slack thread context is required for same-channel replies from a threaded Slack turn. Set topLevel=true or threadId=null to post at the channel root.");
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (context.replyToMode !== "all" && !isSingleUseReplyToMode(context.replyToMode ?? "off")) return;
|
|
45
|
-
if (isSingleUseReplyToMode(context.replyToMode ?? "off") && context.hasRepliedRef?.value) return;
|
|
46
|
-
return context.currentThreadTs;
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
34
|
//#region extensions/slack/src/approval-native.ts
|
|
50
35
|
function resolveSlackNativeSuppressionAccountId({ target, request }) {
|
|
51
36
|
return normalizeOptionalString(target.accountId) ?? normalizeOptionalString(request.request.turnSourceAccountId);
|
|
@@ -76,7 +61,14 @@ function resolveSlackApproverDmTargets(params) {
|
|
|
76
61
|
approvalKind: params.approvalKind,
|
|
77
62
|
request: params.request
|
|
78
63
|
})) return [];
|
|
79
|
-
|
|
64
|
+
const approvers = params.approvalKind === "plugin" ? getSlackApprovalApprovers(params) : getSlackExecApprovalApprovers(params);
|
|
65
|
+
const teamId = resolveEnterpriseApprovalTeamId(params.request);
|
|
66
|
+
return approvers.map((approver) => ({ to: formatSlackTarget({
|
|
67
|
+
kind: "user",
|
|
68
|
+
id: approver,
|
|
69
|
+
teamId,
|
|
70
|
+
explicitKind: true
|
|
71
|
+
}) }));
|
|
80
72
|
}
|
|
81
73
|
const shouldSuppressSlackForwardingFallback = createNativeApprovalForwardingFallbackSuppressor({
|
|
82
74
|
channel: "slack",
|
|
@@ -138,7 +130,7 @@ const baseSlackApprovalCapability = createApproverRestrictedNativeApprovalCapabi
|
|
|
138
130
|
approvalKind,
|
|
139
131
|
request
|
|
140
132
|
}),
|
|
141
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
133
|
+
load: async () => (await import("./approval-handler.runtime-BNvAoKdK.js")).slackApprovalNativeRuntime
|
|
142
134
|
})
|
|
143
135
|
});
|
|
144
136
|
const baseSlackNativeAdapter = baseSlackApprovalCapability.native;
|
|
@@ -189,6 +181,9 @@ const slackApprovalCapability = {
|
|
|
189
181
|
};
|
|
190
182
|
//#endregion
|
|
191
183
|
//#region extensions/slack/src/message-action-dispatch.ts
|
|
184
|
+
function readSlackForceDocument(params) {
|
|
185
|
+
return readBooleanParam(params, "forceDocument") ?? readBooleanParam(params, "asDocument") ?? false;
|
|
186
|
+
}
|
|
192
187
|
function resolveSlackPresentationText(content, presentation) {
|
|
193
188
|
return presentation?.blocks.some((block) => block.type === "chart" || block.type === "table") ? renderSlackMessagePresentationFallbackText({
|
|
194
189
|
text: content,
|
|
@@ -249,6 +244,7 @@ async function handleSlackMessageAction(params) {
|
|
|
249
244
|
to,
|
|
250
245
|
content: content ?? "",
|
|
251
246
|
mediaUrl: mediaUrl ?? void 0,
|
|
247
|
+
...readSlackForceDocument(actionParams) ? { forceDocument: true } : {},
|
|
252
248
|
accountId,
|
|
253
249
|
threadTs: threadId ?? replyTo ?? void 0,
|
|
254
250
|
...topLevel ? { topLevel: true } : {},
|
|
@@ -275,21 +271,19 @@ async function handleSlackMessageAction(params) {
|
|
|
275
271
|
}
|
|
276
272
|
if (action === "reactions") {
|
|
277
273
|
const messageId = readStringParam(actionParams, "messageId", { required: true });
|
|
278
|
-
const limit = readPositiveIntegerParam(actionParams, "limit", { message: "limit must be a positive integer." });
|
|
279
274
|
return await invoke({
|
|
280
275
|
action: "reactions",
|
|
281
276
|
channelId: resolveChannelId(),
|
|
282
277
|
messageId,
|
|
283
|
-
limit,
|
|
278
|
+
limit: actionParams.limit,
|
|
284
279
|
accountId
|
|
285
280
|
}, cfg, ctx.toolContext);
|
|
286
281
|
}
|
|
287
282
|
if (action === "read") {
|
|
288
|
-
const limit = readPositiveIntegerParam(actionParams, "limit", { message: "limit must be a positive integer." });
|
|
289
283
|
const readAction = {
|
|
290
284
|
action: "readMessages",
|
|
291
285
|
channelId: resolveChannelId(),
|
|
292
|
-
limit,
|
|
286
|
+
limit: actionParams.limit,
|
|
293
287
|
before: readStringParam(actionParams, "before"),
|
|
294
288
|
after: readStringParam(actionParams, "after"),
|
|
295
289
|
messageId: readStringParam(actionParams, "messageId"),
|
|
@@ -380,10 +374,11 @@ async function handleSlackMessageAction(params) {
|
|
|
380
374
|
action: "uploadFile",
|
|
381
375
|
to,
|
|
382
376
|
filePath,
|
|
383
|
-
initialComment: readStringParam(actionParams, "initialComment", { allowEmpty: true }) ?? readStringParam(actionParams, "message", { allowEmpty: true }) ?? "",
|
|
377
|
+
initialComment: readStringParam(actionParams, "initialComment", { allowEmpty: true }) ?? readStringParam(actionParams, "message", { allowEmpty: true }) ?? readStringParam(actionParams, "caption", { allowEmpty: true }) ?? "",
|
|
384
378
|
filename: readStringParam(actionParams, "filename"),
|
|
385
379
|
title: readStringParam(actionParams, "title"),
|
|
386
380
|
threadTs: threadId ?? void 0,
|
|
381
|
+
...readSlackForceDocument(actionParams) ? { forceDocument: true } : {},
|
|
387
382
|
...topLevel ? { topLevel: true } : {},
|
|
388
383
|
accountId
|
|
389
384
|
}, cfg, ctx.toolContext);
|
|
@@ -401,45 +396,111 @@ const SLACK_TOOL_DELIVERY_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
401
396
|
"unpinMessage",
|
|
402
397
|
"uploadFile"
|
|
403
398
|
]);
|
|
404
|
-
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
405
|
-
function resolveSlackActionContext(
|
|
406
|
-
if (!
|
|
399
|
+
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-JtoOK9l5.js"));
|
|
400
|
+
function resolveSlackActionContext(ctx, toolContext) {
|
|
401
|
+
if (!toolContext && !ctx.mediaAccess && !ctx.mediaLocalRoots && !ctx.mediaReadFile && !ctx.conversationReadOrigin && !ctx.requesterAccountId && !ctx.requesterSenderId) return;
|
|
407
402
|
return {
|
|
408
|
-
...
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
403
|
+
...toolContext,
|
|
404
|
+
mediaAccess: ctx.mediaAccess,
|
|
405
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
406
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
407
|
+
conversationReadOrigin: ctx.conversationReadOrigin,
|
|
408
|
+
requesterAccountId: ctx.requesterAccountId ?? void 0,
|
|
409
|
+
requesterSenderId: ctx.requesterSenderId ?? void 0
|
|
414
410
|
};
|
|
415
411
|
}
|
|
416
412
|
function createSlackActions(providerId, options) {
|
|
417
413
|
return {
|
|
414
|
+
providerOwnedReadGates: true,
|
|
418
415
|
describeMessageTool: describeSlackMessageTool,
|
|
419
416
|
extractToolSend: ({ args }) => extractSlackToolSend(args),
|
|
420
417
|
isToolDeliveryAction: ({ args }) => typeof args.action === "string" && SLACK_TOOL_DELIVERY_ACTIONS.has(args.action),
|
|
421
|
-
prepareSendPayload: ({ ctx, payload }) => ctx.action === "send" ? payload : null,
|
|
418
|
+
prepareSendPayload: ({ ctx, to, payload }) => ctx.action === "send" && !shouldUseWorkspaceAwareSlackActionSend(to, ctx.toolContext) ? payload : null,
|
|
422
419
|
handleAction: async (ctx) => {
|
|
423
420
|
return await handleSlackMessageAction({
|
|
424
421
|
providerId,
|
|
425
422
|
ctx,
|
|
426
|
-
normalizeChannelId:
|
|
423
|
+
normalizeChannelId: normalizeSlackActionChannelTarget,
|
|
427
424
|
includeReadThreadId: true,
|
|
428
425
|
invoke: async (action, cfg, toolContext) => {
|
|
429
|
-
const actionContext = resolveSlackActionContext(
|
|
430
|
-
toolContext,
|
|
431
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
432
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
433
|
-
conversationReadOrigin: ctx.conversationReadOrigin,
|
|
434
|
-
requesterAccountId: ctx.requesterAccountId,
|
|
435
|
-
requesterSenderId: ctx.requesterSenderId
|
|
436
|
-
});
|
|
426
|
+
const actionContext = resolveSlackActionContext(ctx, toolContext);
|
|
437
427
|
return await (options?.invoke ? options.invoke(action, cfg, actionContext) : (await loadSlackActionRuntime$1()).handleSlackAction(action, cfg, actionContext));
|
|
438
428
|
}
|
|
439
429
|
});
|
|
440
430
|
}
|
|
441
431
|
};
|
|
442
432
|
}
|
|
433
|
+
function normalizeSlackActionChannelTarget(raw) {
|
|
434
|
+
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
|
435
|
+
const channelId = resolveSlackChannelId(raw);
|
|
436
|
+
return formatSlackTarget({
|
|
437
|
+
teamId: target?.teamId,
|
|
438
|
+
kind: "channel",
|
|
439
|
+
id: channelId
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function shouldUseWorkspaceAwareSlackActionSend(rawTarget, context) {
|
|
443
|
+
const target = parseSlackTarget(rawTarget, { defaultKind: "channel" });
|
|
444
|
+
if (!target || target.teamId) return false;
|
|
445
|
+
for (const rawCurrentTarget of [context?.currentChannelId, context?.currentMessagingTarget]) {
|
|
446
|
+
if (!rawCurrentTarget) continue;
|
|
447
|
+
const currentTarget = parseSlackTarget(rawCurrentTarget);
|
|
448
|
+
if (currentTarget?.teamId && currentTarget.kind === target.kind && currentTarget.id.toLowerCase() === target.id.toLowerCase()) return true;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region extensions/slack/src/conversation-route-owner.ts
|
|
454
|
+
function inspectSlackConversationRouteOwner(params) {
|
|
455
|
+
const installationKind = getSlackInstallationKind(params.accountId);
|
|
456
|
+
const direct = params.conversation.kind === "direct";
|
|
457
|
+
const target = parseSlackTarget(params.conversation.peerId, { defaultKind: direct ? "user" : "channel" });
|
|
458
|
+
if (!target || target.kind !== (direct ? "user" : "channel")) return null;
|
|
459
|
+
const targetIsEnterprise = Boolean(target.teamId);
|
|
460
|
+
if (!targetIsEnterprise && (installationKind === "degraded" || !installationKind)) return { kind: "unavailable" };
|
|
461
|
+
if (targetIsEnterprise && installationKind === "workspace") return null;
|
|
462
|
+
const contextTeamId = params.conversation.context?.teamId?.trim();
|
|
463
|
+
if (contextTeamId && target.teamId && contextTeamId.toLowerCase() !== target.teamId.toLowerCase()) return null;
|
|
464
|
+
const teamId = contextTeamId ?? target.teamId;
|
|
465
|
+
if (!direct && params.conversation.nativeChannelId && params.conversation.nativeChannelId.toLowerCase() !== target.id.toLowerCase()) return null;
|
|
466
|
+
const enterpriseRoute = installationKind === "enterprise" || targetIsEnterprise;
|
|
467
|
+
if (enterpriseRoute && !teamId) return null;
|
|
468
|
+
const enterpriseScope = enterpriseRoute && teamId ? { teamId } : void 0;
|
|
469
|
+
const route = resolveAgentRoute({
|
|
470
|
+
cfg: normalizeSlackRouteBindingConfig(params.cfg),
|
|
471
|
+
channel: "slack",
|
|
472
|
+
accountId: params.accountId,
|
|
473
|
+
teamId,
|
|
474
|
+
peer: {
|
|
475
|
+
kind: params.conversation.kind,
|
|
476
|
+
id: qualifySlackRoutePeerId({
|
|
477
|
+
id: target.id,
|
|
478
|
+
kind: direct ? "user" : "channel",
|
|
479
|
+
eventScope: enterpriseScope
|
|
480
|
+
})
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
const baseConversationId = qualifySlackConversationId(direct ? `user:${target.id}` : target.id, enterpriseScope);
|
|
484
|
+
const bindingRoute = resolveSlackConversationBindingRoute({
|
|
485
|
+
cfg: params.cfg,
|
|
486
|
+
route,
|
|
487
|
+
accountId: params.accountId,
|
|
488
|
+
baseConversationId,
|
|
489
|
+
runtimeBindingThreadId: params.conversation.threadId,
|
|
490
|
+
bindingsEnabled: !enterpriseRoute,
|
|
491
|
+
touchBinding: false
|
|
492
|
+
});
|
|
493
|
+
if (!bindingRoute.runtimeRoute.bindingOwnerAvailable) return { kind: "unavailable" };
|
|
494
|
+
if (bindingRoute.runtimeRoute.pluginId) return {
|
|
495
|
+
kind: "plugin",
|
|
496
|
+
pluginId: bindingRoute.runtimeRoute.pluginId,
|
|
497
|
+
fallbackAgentId: route.agentId
|
|
498
|
+
};
|
|
499
|
+
return {
|
|
500
|
+
kind: "agent",
|
|
501
|
+
agentId: bindingRoute.runtimeRoute.boundAgentId ?? bindingRoute.configuredRoute?.boundAgentId ?? route.agentId
|
|
502
|
+
};
|
|
503
|
+
}
|
|
443
504
|
//#endregion
|
|
444
505
|
//#region extensions/slack/src/threading-tool-context.ts
|
|
445
506
|
function buildSlackThreadingToolContext(params) {
|
|
@@ -456,8 +517,14 @@ function buildSlackThreadingToolContext(params) {
|
|
|
456
517
|
const hasExplicitThreadTarget = messageThreadTs != null || transportThreadTs != null || replyToThreadTs != null && currentMessageTs != null && replyToThreadTs !== currentMessageTs;
|
|
457
518
|
const effectiveReplyToMode = hasExplicitThreadTarget ? "all" : configuredReplyToMode;
|
|
458
519
|
const currentMessagingTarget = normalizeOptionalString(params.context.To);
|
|
520
|
+
const parsedMessagingTarget = currentMessagingTarget ? parseSlackTarget(currentMessagingTarget) : void 0;
|
|
521
|
+
const nativeChannelId = normalizeOptionalString(params.context.NativeChannelId);
|
|
459
522
|
return {
|
|
460
|
-
currentChannelId:
|
|
523
|
+
currentChannelId: parsedMessagingTarget?.teamId && nativeChannelId ? formatSlackTarget({
|
|
524
|
+
teamId: parsedMessagingTarget.teamId,
|
|
525
|
+
kind: "channel",
|
|
526
|
+
id: nativeChannelId
|
|
527
|
+
}) : parsedMessagingTarget?.teamId ? currentMessagingTarget : parsedMessagingTarget?.kind === "channel" ? parsedMessagingTarget.id : nativeChannelId ?? currentMessagingTarget,
|
|
461
528
|
currentMessagingTarget,
|
|
462
529
|
currentThreadTs,
|
|
463
530
|
replyToMode: effectiveReplyToMode,
|
|
@@ -471,29 +538,30 @@ const EXTENSION_SHARED_MODULE_ID = "openclaw/plugin-sdk/extension-shared";
|
|
|
471
538
|
const TARGET_RESOLVER_RUNTIME_MODULE_ID = "openclaw/plugin-sdk/target-resolver-runtime";
|
|
472
539
|
const loadExtensionSharedSdk = createLazyRuntimeModule(() => import(EXTENSION_SHARED_MODULE_ID));
|
|
473
540
|
const loadTargetResolverRuntimeSdk = createLazyRuntimeModule(() => import(TARGET_RESOLVER_RUNTIME_MODULE_ID));
|
|
474
|
-
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-
|
|
475
|
-
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-
|
|
476
|
-
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-
|
|
541
|
+
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-BPFfp6So.js"));
|
|
542
|
+
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-BSk4GZvZ.js"));
|
|
543
|
+
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-DuRqAQXK.js"));
|
|
477
544
|
async function resolveSlackHandleAction() {
|
|
478
545
|
return getOptionalSlackRuntime()?.channel?.slack?.handleSlackAction ?? (await loadSlackActionRuntime()).handleSlackAction;
|
|
479
546
|
}
|
|
480
547
|
function shouldTreatSlackDeliveredTextAsVisible(params) {
|
|
481
548
|
return params.kind === "block" && typeof params.text === "string" && params.text.trim().length > 0;
|
|
482
549
|
}
|
|
483
|
-
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
484
|
-
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-
|
|
485
|
-
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
486
|
-
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
487
|
-
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-
|
|
488
|
-
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
489
|
-
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
490
|
-
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
550
|
+
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-BGYyuzWh.js").then((n) => n.t));
|
|
551
|
+
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-BSpqC8jU.js").then((n) => n.n));
|
|
552
|
+
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-Dvz9pDe0.js").then((n) => n.n));
|
|
553
|
+
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-JtoOK9l5.js"));
|
|
554
|
+
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-kYctMHSd.js"));
|
|
555
|
+
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-BVA65leh.js").then((n) => n.n));
|
|
556
|
+
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-Chrecrb9.js").then((n) => n.t));
|
|
557
|
+
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-DjUJQLbq.js").then((n) => n.t));
|
|
491
558
|
async function resolveSlackSendContext(params) {
|
|
492
559
|
const account = resolveSlackAccount({
|
|
493
560
|
cfg: params.cfg,
|
|
494
561
|
accountId: params.accountId
|
|
495
562
|
});
|
|
496
|
-
|
|
563
|
+
const target = parseSlackTarget(params.to, { defaultKind: "channel" });
|
|
564
|
+
assertSlackDetachedTargetAllowed(account.accountId, target?.teamId);
|
|
497
565
|
const send = resolveOutboundSendDep(params.deps, "slack") ?? (await loadSlackSendRuntime()).sendMessageSlack;
|
|
498
566
|
const token = resolveSlackOperationToken(account, "write");
|
|
499
567
|
const botToken = account.botToken?.trim();
|
|
@@ -501,7 +569,8 @@ async function resolveSlackSendContext(params) {
|
|
|
501
569
|
return {
|
|
502
570
|
send,
|
|
503
571
|
threadTsValue: resolveSlackThreadTsValue(params),
|
|
504
|
-
tokenOverride
|
|
572
|
+
tokenOverride,
|
|
573
|
+
to: params.to
|
|
505
574
|
};
|
|
506
575
|
}
|
|
507
576
|
async function setSlackHeartbeatThreadStatus(params) {
|
|
@@ -512,11 +581,11 @@ async function setSlackHeartbeatThreadStatus(params) {
|
|
|
512
581
|
cfg: params.cfg,
|
|
513
582
|
accountId: params.accountId
|
|
514
583
|
});
|
|
515
|
-
|
|
584
|
+
assertSlackDetachedTargetAllowed(account.accountId, target.teamId);
|
|
516
585
|
const botToken = normalizeOptionalString(account.botToken);
|
|
517
586
|
if (!botToken) return;
|
|
518
587
|
try {
|
|
519
|
-
const client =
|
|
588
|
+
const client = getSlackWriteClient(botToken, { teamId: target.teamId });
|
|
520
589
|
const apiTargetId = canonicalizeSlackApiTargetId(target.kind, target.id, params.to);
|
|
521
590
|
const channelId = target.kind === "channel" ? apiTargetId : await (await loadSlackSendRuntime()).resolveSlackDmChannelId({
|
|
522
591
|
client,
|
|
@@ -539,9 +608,7 @@ function withSlackSendOverride(params) {
|
|
|
539
608
|
...params.deps,
|
|
540
609
|
slack: async (to, text, opts) => await params.send(to, text, {
|
|
541
610
|
...opts,
|
|
542
|
-
...params.tokenOverride ? { token: params.tokenOverride } : {}
|
|
543
|
-
...params.deliveryQueueId ? { deliveryQueueId: params.deliveryQueueId } : {},
|
|
544
|
-
...params.onPlatformSendDispatch ? { onPlatformSendDispatch: params.onPlatformSendDispatch } : {}
|
|
611
|
+
...params.tokenOverride ? { token: params.tokenOverride } : {}
|
|
545
612
|
})
|
|
546
613
|
};
|
|
547
614
|
}
|
|
@@ -549,7 +616,7 @@ function resolveSlackRouteTarget(raw) {
|
|
|
549
616
|
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
|
550
617
|
if (!target) return null;
|
|
551
618
|
return {
|
|
552
|
-
to: target.id,
|
|
619
|
+
to: target.teamId ? target.normalized : target.id,
|
|
553
620
|
chatType: target.kind === "user" ? "direct" : "channel"
|
|
554
621
|
};
|
|
555
622
|
}
|
|
@@ -590,23 +657,29 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
590
657
|
const apiTargetId = canonicalizeSlackApiTargetId(parsed.kind, parsed.id, params.target);
|
|
591
658
|
const isDm = parsed.kind === "user";
|
|
592
659
|
let peerKind = isDm ? "direct" : "channel";
|
|
593
|
-
let peerId = parsed
|
|
660
|
+
let peerId = formatSlackTarget(parsed);
|
|
594
661
|
let recipientSessionExact = isDm ? /^[UW][A-Z0-9]{8,}$/i.test(parsed.id) : /^C[A-Z0-9]{8,}$/i.test(parsed.id);
|
|
595
662
|
if (!isDm && /^D/i.test(parsed.id)) {
|
|
596
663
|
const conversation = await resolveSlackConversationInfo({
|
|
597
664
|
cfg: params.cfg,
|
|
598
665
|
accountId: params.accountId,
|
|
599
|
-
channelId: apiTargetId
|
|
666
|
+
channelId: apiTargetId,
|
|
667
|
+
teamId: parsed.teamId
|
|
600
668
|
});
|
|
601
669
|
if (conversation.type !== "dm" || !conversation.user) return null;
|
|
602
670
|
peerKind = "direct";
|
|
603
|
-
peerId =
|
|
671
|
+
peerId = formatSlackTarget({
|
|
672
|
+
teamId: parsed.teamId,
|
|
673
|
+
kind: "user",
|
|
674
|
+
id: conversation.user
|
|
675
|
+
});
|
|
604
676
|
recipientSessionExact = true;
|
|
605
677
|
} else if (!isDm && /^G/i.test(parsed.id)) {
|
|
606
678
|
const channelType = await resolveSlackChannelType({
|
|
607
679
|
cfg: params.cfg,
|
|
608
680
|
accountId: params.accountId,
|
|
609
|
-
channelId: apiTargetId
|
|
681
|
+
channelId: apiTargetId,
|
|
682
|
+
teamId: parsed.teamId
|
|
610
683
|
});
|
|
611
684
|
if (channelType === "group") peerKind = "group";
|
|
612
685
|
if (channelType === "dm") peerKind = "direct";
|
|
@@ -616,12 +689,16 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
616
689
|
kind: peerKind,
|
|
617
690
|
id: peerId
|
|
618
691
|
};
|
|
619
|
-
const
|
|
692
|
+
const unpartitionedBaseSessionKey = buildSlackBaseSessionKey({
|
|
620
693
|
cfg: params.cfg,
|
|
621
694
|
agentId: params.agentId,
|
|
622
695
|
accountId: params.accountId,
|
|
623
696
|
peer
|
|
624
697
|
});
|
|
698
|
+
const baseSessionKey = parsed.teamId && peerKind === "direct" && (params.cfg.session?.dmScope ?? "main") === "main" ? `${unpartitionedBaseSessionKey}:account:${encodeURIComponent(resolveSlackAccount({
|
|
699
|
+
cfg: params.cfg,
|
|
700
|
+
accountId: params.accountId
|
|
701
|
+
}).accountId).toLowerCase()}:team:${encodeURIComponent(parsed.teamId).toLowerCase()}` : unpartitionedBaseSessionKey;
|
|
625
702
|
return buildThreadAwareOutboundSessionRoute({
|
|
626
703
|
route: {
|
|
627
704
|
sessionKey: baseSessionKey,
|
|
@@ -630,7 +707,7 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
630
707
|
peer,
|
|
631
708
|
chatType: peerKind === "direct" ? "direct" : "channel",
|
|
632
709
|
from: peerKind === "direct" ? `slack:${peerId}` : peerKind === "group" ? `slack:group:${peerId}` : `slack:channel:${peerId}`,
|
|
633
|
-
to: peerKind === "direct" ? `user:${peerId}` : `channel:${peerId}`
|
|
710
|
+
to: parsed.teamId ? peerId : peerKind === "direct" ? `user:${peerId}` : `channel:${peerId}`
|
|
634
711
|
},
|
|
635
712
|
replyToId: params.replyToId,
|
|
636
713
|
threadId: params.threadId,
|
|
@@ -683,6 +760,10 @@ const slackChannelOutbound = {
|
|
|
683
760
|
accountId,
|
|
684
761
|
payload
|
|
685
762
|
}),
|
|
763
|
+
afterDeliverPayload: async (ctx) => {
|
|
764
|
+
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
765
|
+
await slackOutbound.afterDeliverPayload(ctx);
|
|
766
|
+
},
|
|
686
767
|
presentationCapabilities: SLACK_PRESENTATION_CAPABILITIES,
|
|
687
768
|
...createRuntimeOutboundDelegates({
|
|
688
769
|
getRuntime: loadSlackOutboundAdapterModule,
|
|
@@ -692,9 +773,10 @@ const slackChannelOutbound = {
|
|
|
692
773
|
}
|
|
693
774
|
}),
|
|
694
775
|
sendPayload: async (ctx) => {
|
|
695
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
776
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
696
777
|
cfg: ctx.cfg,
|
|
697
778
|
accountId: ctx.accountId ?? void 0,
|
|
779
|
+
to: ctx.to,
|
|
698
780
|
deps: ctx.deps,
|
|
699
781
|
replyToId: ctx.replyToId,
|
|
700
782
|
threadId: ctx.threadId
|
|
@@ -702,10 +784,10 @@ const slackChannelOutbound = {
|
|
|
702
784
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
703
785
|
return await slackOutbound.sendPayload({
|
|
704
786
|
...ctx,
|
|
787
|
+
to,
|
|
705
788
|
replyToId: threadTsValue,
|
|
706
789
|
threadId: null,
|
|
707
790
|
deliveryQueueId: void 0,
|
|
708
|
-
onPlatformSendDispatch: void 0,
|
|
709
791
|
deps: withSlackSendOverride({
|
|
710
792
|
deps: ctx.deps,
|
|
711
793
|
send,
|
|
@@ -714,9 +796,10 @@ const slackChannelOutbound = {
|
|
|
714
796
|
});
|
|
715
797
|
},
|
|
716
798
|
sendText: async (ctx) => {
|
|
717
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
799
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
718
800
|
cfg: ctx.cfg,
|
|
719
801
|
accountId: ctx.accountId ?? void 0,
|
|
802
|
+
to: ctx.to,
|
|
720
803
|
deps: ctx.deps,
|
|
721
804
|
replyToId: ctx.replyToId,
|
|
722
805
|
threadId: ctx.threadId
|
|
@@ -724,23 +807,21 @@ const slackChannelOutbound = {
|
|
|
724
807
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
725
808
|
return await slackOutbound.sendText({
|
|
726
809
|
...ctx,
|
|
810
|
+
to,
|
|
727
811
|
replyToId: threadTsValue,
|
|
728
812
|
threadId: null,
|
|
729
|
-
deliveryQueueId: void 0,
|
|
730
|
-
onPlatformSendDispatch: void 0,
|
|
731
813
|
deps: withSlackSendOverride({
|
|
732
814
|
deps: ctx.deps,
|
|
733
815
|
send,
|
|
734
|
-
tokenOverride
|
|
735
|
-
deliveryQueueId: ctx.deliveryQueueId,
|
|
736
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
816
|
+
tokenOverride
|
|
737
817
|
})
|
|
738
818
|
});
|
|
739
819
|
},
|
|
740
820
|
sendMedia: async (ctx) => {
|
|
741
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
821
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
742
822
|
cfg: ctx.cfg,
|
|
743
823
|
accountId: ctx.accountId ?? void 0,
|
|
824
|
+
to: ctx.to,
|
|
744
825
|
deps: ctx.deps,
|
|
745
826
|
replyToId: ctx.replyToId,
|
|
746
827
|
threadId: ctx.threadId
|
|
@@ -748,15 +829,14 @@ const slackChannelOutbound = {
|
|
|
748
829
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
749
830
|
return await slackOutbound.sendMedia({
|
|
750
831
|
...ctx,
|
|
832
|
+
to,
|
|
751
833
|
replyToId: threadTsValue,
|
|
752
834
|
threadId: null,
|
|
753
835
|
deliveryQueueId: void 0,
|
|
754
|
-
onPlatformSendDispatch: void 0,
|
|
755
836
|
deps: withSlackSendOverride({
|
|
756
837
|
deps: ctx.deps,
|
|
757
838
|
send,
|
|
758
|
-
tokenOverride
|
|
759
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
839
|
+
tokenOverride
|
|
760
840
|
})
|
|
761
841
|
});
|
|
762
842
|
}
|
|
@@ -785,11 +865,21 @@ const slackMessageAdapter = {
|
|
|
785
865
|
...slackMessageAdapterBase.durableFinal?.capabilities,
|
|
786
866
|
reconcileUnknownSend: true
|
|
787
867
|
},
|
|
788
|
-
admitDeferredDelivery: ({ cfg, accountId }) => {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
868
|
+
admitDeferredDelivery: ({ cfg, accountId, to }) => {
|
|
869
|
+
const account = resolveSlackAccount({
|
|
870
|
+
cfg,
|
|
871
|
+
accountId
|
|
872
|
+
});
|
|
873
|
+
const target = parseSlackTarget(to, { defaultKind: "channel" });
|
|
874
|
+
try {
|
|
875
|
+
assertSlackDetachedTargetAllowed(account.accountId, target?.teamId);
|
|
876
|
+
return { status: "allowed" };
|
|
877
|
+
} catch (error) {
|
|
878
|
+
return {
|
|
879
|
+
status: "permanent_rejection",
|
|
880
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
793
883
|
},
|
|
794
884
|
reconcileUnknownSendKinds: { text: true },
|
|
795
885
|
reconcileUnknownSend: async (ctx) => await (await loadSlackSendRuntime()).reconcileSlackUnknownSend(ctx)
|
|
@@ -799,7 +889,6 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
799
889
|
base: {
|
|
800
890
|
...createSlackPluginBase({
|
|
801
891
|
setupWizard: createSlackSetupWizardProxy(loadSlackSetupSurfaceModule),
|
|
802
|
-
setup: slackSetupAdapter,
|
|
803
892
|
setupContract: slackSetupContract
|
|
804
893
|
}),
|
|
805
894
|
allowlist: {
|
|
@@ -833,11 +922,9 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
833
922
|
parentConversationId
|
|
834
923
|
})
|
|
835
924
|
},
|
|
836
|
-
conversationBindings: { isCurrentConversationBindingSupported: ({ accountId }) =>
|
|
837
|
-
const cfg = getOptionalSlackRuntime()?.config.current();
|
|
838
|
-
return cfg ? mergeSlackAccountConfig(cfg, accountId).enterpriseOrgInstall !== true : false;
|
|
839
|
-
} },
|
|
925
|
+
conversationBindings: { isCurrentConversationBindingSupported: ({ accountId }) => isSlackWorkspaceInstallation(accountId) },
|
|
840
926
|
messaging: {
|
|
927
|
+
resolveConversationRouteOwner: inspectSlackConversationRouteOwner,
|
|
841
928
|
targetPrefixes: ["slack"],
|
|
842
929
|
directTargetStyle: "user-prefixed",
|
|
843
930
|
targetIdComparison: "lowercase",
|
|
@@ -846,9 +933,9 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
846
933
|
const parent = parentConversationId?.trim();
|
|
847
934
|
const child = conversationId.trim();
|
|
848
935
|
return parent && parent !== child ? {
|
|
849
|
-
to: normalizeSlackMessagingTarget(
|
|
936
|
+
to: normalizeSlackMessagingTarget(parent),
|
|
850
937
|
threadId: child
|
|
851
|
-
} : { to: normalizeSlackMessagingTarget(
|
|
938
|
+
} : { to: normalizeSlackMessagingTarget(child) };
|
|
852
939
|
},
|
|
853
940
|
resolveSessionTarget: ({ id }) => {
|
|
854
941
|
return normalizeSlackMessagingTarget(`channel:${id}`);
|
|
@@ -1066,25 +1153,37 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
1066
1153
|
} },
|
|
1067
1154
|
mentions: { stripPatterns: () => ["<@[^>\\s]+>"] }
|
|
1068
1155
|
},
|
|
1069
|
-
pairing: {
|
|
1156
|
+
pairing: {
|
|
1070
1157
|
idLabel: "slackUserId",
|
|
1071
|
-
message: PAIRING_APPROVED_MESSAGE,
|
|
1072
1158
|
normalizeAllowEntry: createPairingPrefixStripper(/^(slack|user):/i),
|
|
1073
|
-
|
|
1159
|
+
resolveApprovalStoreEntry: ({ id, meta }) => {
|
|
1160
|
+
const senderId = meta?.senderId ?? id;
|
|
1161
|
+
return formatSlackTarget({
|
|
1162
|
+
teamId: meta?.teamId,
|
|
1163
|
+
kind: "user",
|
|
1164
|
+
id: senderId
|
|
1165
|
+
});
|
|
1166
|
+
},
|
|
1167
|
+
notifyApproval: async ({ cfg, id, accountId, meta }) => {
|
|
1074
1168
|
const account = resolveSlackAccount({
|
|
1075
1169
|
cfg,
|
|
1076
|
-
accountId: resolveDefaultSlackAccountId(cfg)
|
|
1170
|
+
accountId: accountId ?? resolveDefaultSlackAccountId(cfg)
|
|
1077
1171
|
});
|
|
1078
|
-
assertSlackDirectSendAllowed(account);
|
|
1079
1172
|
const { sendMessageSlack } = await loadSlackSendRuntime();
|
|
1080
1173
|
const token = resolveSlackOperationToken(account, "write");
|
|
1081
|
-
|
|
1174
|
+
const senderId = meta?.senderId ?? id;
|
|
1175
|
+
await sendMessageSlack(formatSlackTarget({
|
|
1176
|
+
teamId: meta?.teamId,
|
|
1177
|
+
kind: "user",
|
|
1178
|
+
id: senderId,
|
|
1179
|
+
explicitKind: true
|
|
1180
|
+
}), PAIRING_APPROVED_MESSAGE, {
|
|
1082
1181
|
cfg,
|
|
1083
1182
|
accountId: account.accountId,
|
|
1084
1183
|
...token ? { token } : {}
|
|
1085
1184
|
});
|
|
1086
1185
|
}
|
|
1087
|
-
}
|
|
1186
|
+
},
|
|
1088
1187
|
security: slackSecurityAdapter,
|
|
1089
1188
|
threading: {
|
|
1090
1189
|
threadAddressing: "message",
|
|
@@ -1115,4 +1214,4 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
1115
1214
|
outbound: slackChannelOutbound
|
|
1116
1215
|
});
|
|
1117
1216
|
//#endregion
|
|
1118
|
-
export { buildSlackThreadingToolContext as n,
|
|
1217
|
+
export { buildSlackThreadingToolContext as n, slackPlugin as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SlackChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as SlackChannelConfigSchema } from "./config-schema-CN3XZRX5.js";
|
|
2
2
|
export { SlackChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackPlugin } from "./channel-
|
|
1
|
+
import { t as slackPlugin } from "./channel-CA5w7qDF.js";
|
|
2
2
|
export { slackPlugin };
|