@openclaw/slack 2026.7.2-beta.7 → 2026.8.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-DEKpg9Ip.js → account-inspect-Drw2gAiN.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CHAeNZOX.js → accounts-CK4AVI2_.js} +2 -2
- package/dist/{accounts.runtime-BHD4Ma2R.js → accounts.runtime-Cb7QwWBz.js} +1 -1
- package/dist/{action-runtime-DfuYoMjG.js → action-runtime-BkGe7ny_.js} +148 -76
- package/dist/action-runtime.runtime-D9I6uc0Q.js +2 -0
- package/dist/{actions-D3NuJvva.js → actions-BTDXwwE3.js} +85 -44
- package/dist/actions.runtime-DLFyUkvg.js +2 -0
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-BA05P0QT.js → approval-handler.runtime-CJaNzAq2.js} +51 -14
- package/dist/{block-text-DkHaoGem.js → block-text-YtiNkqmx.js} +1 -1
- package/dist/{channel-B9fVdW3s.js → channel-D_tovcUL.js} +151 -91
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-DXyos1d2.js → channel-type-B9MSdoGN.js} +9 -8
- package/dist/{config-adapter-CxBQH8fq.js → channel.setup-Bch9dYmA.js} +83 -25
- package/dist/{config-schema-SgZT6nXV.js → config-schema-xto5jFIx.js} +5 -11
- package/dist/{directory-config-CnCIAktf.js → directory-config-CNBz8lJa.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DKunWh3A.js → directory-live-CFKUtW9E.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-c4RP9bjc.js} +248 -163
- package/dist/index.js +4 -1
- package/dist/{message-tool-api-DkhFpMoy.js → message-tool-api-BykQB4AU.js} +14 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CmKz0wtI.js → monitor-1nF1NtqT.js} +3 -3
- package/dist/{outbound-adapter-BkuMp2Vs.js → outbound-adapter-S81tsswN.js} +19 -17
- package/dist/{pipeline.runtime-DgtmuYCP.js → pipeline.runtime-BvYsM5JO.js} +1087 -682
- package/dist/{policy-PRysPn23.js → policy-TapwbeaT.js} +18 -14
- package/dist/{probe-CgDsSops.js → probe-HoEg_WxB.js} +38 -18
- package/dist/{provider-DmRizMZt.js → provider-CDNvBXUi.js} +3422 -2590
- package/dist/{relay-source-Blxj8xb4.js → relay-source-C9leF11u.js} +11 -21
- package/dist/{replies-4s_Vq_z9.js → replies-CeOfv82I.js} +52 -6
- package/dist/{resolve-channels-yEqmM-3I.js → resolve-channels-CNPrxaXY.js} +39 -12
- package/dist/{resolve-users-BOrt5K-5.js → resolve-users-Dzomuwnr.js} +28 -5
- package/dist/{runtime-api-QMb-Q5Ko.js → runtime-api-Cj9nxBNv.js} +3 -3
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BJSrkAp6.js → scopes-cYXKkrRD.js} +1 -1
- package/dist/{send-DsLeZpST.js → send-Nor0iBwY.js} +211 -105
- package/dist/{send.runtime-gUdK6V3h.js → send.runtime-BmgNe6S9.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-CbX1-Knh.js} +6 -6
- package/dist/{shared-DgIN3Dcr.js → shared-zdT5AMp-.js} +36 -42
- package/dist/{slash-dispatch.runtime-zPkyl7dB.js → slash-dispatch.runtime-Bnr9GR1S.js} +1 -1
- 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 +239 -34
- package/package.json +9 -9
- package/skills/slack/SKILL.md +10 -68
- 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
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resolveSlackOperationToken, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom
|
|
1
|
+
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resolveSlackOperationToken, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom } from "./accounts-CK4AVI2_.js";
|
|
2
2
|
import { t as resolveSlackReplyToMode } from "./account-reply-mode-DrUXogvO.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
5
|
-
import { B as
|
|
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 { B as SLACK_TEXT_LIMIT, Ct as isSlackWorkspaceInstallation, Dt as getSlackExecApprovalApprovers, Et as isSlackApprovalAuthorizedSender, H as buildSlackPresentationBlocks, L as SLACK_EDIT_TEXT_MAX_BYTES, Mt as shouldSuppressLocalSlackExecApprovalPrompt, Ot as isSlackExecApprovalAuthorizedSender, Tt as getSlackApprovalApprovers, U as canRenderSlackPresentation, W as countSlackTextUtf8Bytes, _ as resolveSlackReplyBlocks, _t as resolveSlackFallbackOriginTarget, bt as shouldHandleSlackPluginViaForwardingSession, dt as hasSlackPluginApprovers, ft as isSlackAnyNativeApprovalClientEnabled, g as resolveSlackReplyBlockResolution, gt as resolveSessionSlackOriginTarget, ht as resolveEnterpriseApprovalTeamId, i as resolveSlackGroupToolPolicy, it as renderSlackMessagePresentationFallbackText, jt as resolveSlackExecApprovalTarget, kt as isSlackExecApprovalClientEnabled, mt as normalizeSlackOriginTarget, p as assertSlackDetachedTargetAllowed, pt as normalizeSlackForwardTarget, r as resolveSlackGroupRequireMention, st as SLACK_PRESENTATION_CAPABILITIES, v as resolveSlackReplyDeliveryMessages, vt as resolveTurnSourceSlackOriginTarget, xt as slackTargetsMatch, yt as shouldHandleSlackNativeApprovalRequest } from "./group-policy-c4RP9bjc.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-BykQB4AU.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-HoEg_WxB.js";
|
|
10
|
+
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-B9MSdoGN.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-zdT5AMp-.js";
|
|
13
|
+
import { a as slackSetupContract, i as createSlackSetupWizardProxy, o as SLACK_CHANNEL } from "./channel.setup-Bch9dYmA.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";
|
|
@@ -76,7 +76,14 @@ function resolveSlackApproverDmTargets(params) {
|
|
|
76
76
|
approvalKind: params.approvalKind,
|
|
77
77
|
request: params.request
|
|
78
78
|
})) return [];
|
|
79
|
-
|
|
79
|
+
const approvers = params.approvalKind === "plugin" ? getSlackApprovalApprovers(params) : getSlackExecApprovalApprovers(params);
|
|
80
|
+
const teamId = resolveEnterpriseApprovalTeamId(params.request);
|
|
81
|
+
return approvers.map((approver) => ({ to: formatSlackTarget({
|
|
82
|
+
kind: "user",
|
|
83
|
+
id: approver,
|
|
84
|
+
teamId,
|
|
85
|
+
explicitKind: true
|
|
86
|
+
}) }));
|
|
80
87
|
}
|
|
81
88
|
const shouldSuppressSlackForwardingFallback = createNativeApprovalForwardingFallbackSuppressor({
|
|
82
89
|
channel: "slack",
|
|
@@ -138,7 +145,7 @@ const baseSlackApprovalCapability = createApproverRestrictedNativeApprovalCapabi
|
|
|
138
145
|
approvalKind,
|
|
139
146
|
request
|
|
140
147
|
}),
|
|
141
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
148
|
+
load: async () => (await import("./approval-handler.runtime-CJaNzAq2.js")).slackApprovalNativeRuntime
|
|
142
149
|
})
|
|
143
150
|
});
|
|
144
151
|
const baseSlackNativeAdapter = baseSlackApprovalCapability.native;
|
|
@@ -189,6 +196,9 @@ const slackApprovalCapability = {
|
|
|
189
196
|
};
|
|
190
197
|
//#endregion
|
|
191
198
|
//#region extensions/slack/src/message-action-dispatch.ts
|
|
199
|
+
function readSlackForceDocument(params) {
|
|
200
|
+
return readBooleanParam(params, "forceDocument") ?? readBooleanParam(params, "asDocument") ?? false;
|
|
201
|
+
}
|
|
192
202
|
function resolveSlackPresentationText(content, presentation) {
|
|
193
203
|
return presentation?.blocks.some((block) => block.type === "chart" || block.type === "table") ? renderSlackMessagePresentationFallbackText({
|
|
194
204
|
text: content,
|
|
@@ -249,6 +259,7 @@ async function handleSlackMessageAction(params) {
|
|
|
249
259
|
to,
|
|
250
260
|
content: content ?? "",
|
|
251
261
|
mediaUrl: mediaUrl ?? void 0,
|
|
262
|
+
...readSlackForceDocument(actionParams) ? { forceDocument: true } : {},
|
|
252
263
|
accountId,
|
|
253
264
|
threadTs: threadId ?? replyTo ?? void 0,
|
|
254
265
|
...topLevel ? { topLevel: true } : {},
|
|
@@ -275,21 +286,19 @@ async function handleSlackMessageAction(params) {
|
|
|
275
286
|
}
|
|
276
287
|
if (action === "reactions") {
|
|
277
288
|
const messageId = readStringParam(actionParams, "messageId", { required: true });
|
|
278
|
-
const limit = readPositiveIntegerParam(actionParams, "limit", { message: "limit must be a positive integer." });
|
|
279
289
|
return await invoke({
|
|
280
290
|
action: "reactions",
|
|
281
291
|
channelId: resolveChannelId(),
|
|
282
292
|
messageId,
|
|
283
|
-
limit,
|
|
293
|
+
limit: actionParams.limit,
|
|
284
294
|
accountId
|
|
285
295
|
}, cfg, ctx.toolContext);
|
|
286
296
|
}
|
|
287
297
|
if (action === "read") {
|
|
288
|
-
const limit = readPositiveIntegerParam(actionParams, "limit", { message: "limit must be a positive integer." });
|
|
289
298
|
const readAction = {
|
|
290
299
|
action: "readMessages",
|
|
291
300
|
channelId: resolveChannelId(),
|
|
292
|
-
limit,
|
|
301
|
+
limit: actionParams.limit,
|
|
293
302
|
before: readStringParam(actionParams, "before"),
|
|
294
303
|
after: readStringParam(actionParams, "after"),
|
|
295
304
|
messageId: readStringParam(actionParams, "messageId"),
|
|
@@ -384,6 +393,7 @@ async function handleSlackMessageAction(params) {
|
|
|
384
393
|
filename: readStringParam(actionParams, "filename"),
|
|
385
394
|
title: readStringParam(actionParams, "title"),
|
|
386
395
|
threadTs: threadId ?? void 0,
|
|
396
|
+
...readSlackForceDocument(actionParams) ? { forceDocument: true } : {},
|
|
387
397
|
...topLevel ? { topLevel: true } : {},
|
|
388
398
|
accountId
|
|
389
399
|
}, cfg, ctx.toolContext);
|
|
@@ -401,16 +411,17 @@ const SLACK_TOOL_DELIVERY_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
401
411
|
"unpinMessage",
|
|
402
412
|
"uploadFile"
|
|
403
413
|
]);
|
|
404
|
-
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
405
|
-
function resolveSlackActionContext(
|
|
406
|
-
if (!
|
|
414
|
+
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-D9I6uc0Q.js"));
|
|
415
|
+
function resolveSlackActionContext(ctx, toolContext) {
|
|
416
|
+
if (!toolContext && !ctx.mediaAccess && !ctx.mediaLocalRoots && !ctx.mediaReadFile && !ctx.conversationReadOrigin && !ctx.requesterAccountId && !ctx.requesterSenderId) return;
|
|
407
417
|
return {
|
|
408
|
-
...
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
...toolContext,
|
|
419
|
+
mediaAccess: ctx.mediaAccess,
|
|
420
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
421
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
422
|
+
conversationReadOrigin: ctx.conversationReadOrigin,
|
|
423
|
+
requesterAccountId: ctx.requesterAccountId ?? void 0,
|
|
424
|
+
requesterSenderId: ctx.requesterSenderId ?? void 0
|
|
414
425
|
};
|
|
415
426
|
}
|
|
416
427
|
function createSlackActions(providerId, options) {
|
|
@@ -418,28 +429,40 @@ function createSlackActions(providerId, options) {
|
|
|
418
429
|
describeMessageTool: describeSlackMessageTool,
|
|
419
430
|
extractToolSend: ({ args }) => extractSlackToolSend(args),
|
|
420
431
|
isToolDeliveryAction: ({ args }) => typeof args.action === "string" && SLACK_TOOL_DELIVERY_ACTIONS.has(args.action),
|
|
421
|
-
prepareSendPayload: ({ ctx, payload }) => ctx.action === "send" ? payload : null,
|
|
432
|
+
prepareSendPayload: ({ ctx, to, payload }) => ctx.action === "send" && !shouldUseWorkspaceAwareSlackActionSend(to, ctx.toolContext) ? payload : null,
|
|
422
433
|
handleAction: async (ctx) => {
|
|
423
434
|
return await handleSlackMessageAction({
|
|
424
435
|
providerId,
|
|
425
436
|
ctx,
|
|
426
|
-
normalizeChannelId:
|
|
437
|
+
normalizeChannelId: normalizeSlackActionChannelTarget,
|
|
427
438
|
includeReadThreadId: true,
|
|
428
439
|
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
|
-
});
|
|
440
|
+
const actionContext = resolveSlackActionContext(ctx, toolContext);
|
|
437
441
|
return await (options?.invoke ? options.invoke(action, cfg, actionContext) : (await loadSlackActionRuntime$1()).handleSlackAction(action, cfg, actionContext));
|
|
438
442
|
}
|
|
439
443
|
});
|
|
440
444
|
}
|
|
441
445
|
};
|
|
442
446
|
}
|
|
447
|
+
function normalizeSlackActionChannelTarget(raw) {
|
|
448
|
+
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
|
449
|
+
const channelId = resolveSlackChannelId(raw);
|
|
450
|
+
return formatSlackTarget({
|
|
451
|
+
teamId: target?.teamId,
|
|
452
|
+
kind: "channel",
|
|
453
|
+
id: channelId
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function shouldUseWorkspaceAwareSlackActionSend(rawTarget, context) {
|
|
457
|
+
const target = parseSlackTarget(rawTarget, { defaultKind: "channel" });
|
|
458
|
+
if (!target || target.teamId) return false;
|
|
459
|
+
for (const rawCurrentTarget of [context?.currentChannelId, context?.currentMessagingTarget]) {
|
|
460
|
+
if (!rawCurrentTarget) continue;
|
|
461
|
+
const currentTarget = parseSlackTarget(rawCurrentTarget);
|
|
462
|
+
if (currentTarget?.teamId && currentTarget.kind === target.kind && currentTarget.id.toLowerCase() === target.id.toLowerCase()) return true;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
443
466
|
//#endregion
|
|
444
467
|
//#region extensions/slack/src/threading-tool-context.ts
|
|
445
468
|
function buildSlackThreadingToolContext(params) {
|
|
@@ -456,8 +479,14 @@ function buildSlackThreadingToolContext(params) {
|
|
|
456
479
|
const hasExplicitThreadTarget = messageThreadTs != null || transportThreadTs != null || replyToThreadTs != null && currentMessageTs != null && replyToThreadTs !== currentMessageTs;
|
|
457
480
|
const effectiveReplyToMode = hasExplicitThreadTarget ? "all" : configuredReplyToMode;
|
|
458
481
|
const currentMessagingTarget = normalizeOptionalString(params.context.To);
|
|
482
|
+
const parsedMessagingTarget = currentMessagingTarget ? parseSlackTarget(currentMessagingTarget) : void 0;
|
|
483
|
+
const nativeChannelId = normalizeOptionalString(params.context.NativeChannelId);
|
|
459
484
|
return {
|
|
460
|
-
currentChannelId:
|
|
485
|
+
currentChannelId: parsedMessagingTarget?.teamId && nativeChannelId ? formatSlackTarget({
|
|
486
|
+
teamId: parsedMessagingTarget.teamId,
|
|
487
|
+
kind: "channel",
|
|
488
|
+
id: nativeChannelId
|
|
489
|
+
}) : parsedMessagingTarget?.teamId ? currentMessagingTarget : parsedMessagingTarget?.kind === "channel" ? parsedMessagingTarget.id : nativeChannelId ?? currentMessagingTarget,
|
|
461
490
|
currentMessagingTarget,
|
|
462
491
|
currentThreadTs,
|
|
463
492
|
replyToMode: effectiveReplyToMode,
|
|
@@ -471,29 +500,30 @@ const EXTENSION_SHARED_MODULE_ID = "openclaw/plugin-sdk/extension-shared";
|
|
|
471
500
|
const TARGET_RESOLVER_RUNTIME_MODULE_ID = "openclaw/plugin-sdk/target-resolver-runtime";
|
|
472
501
|
const loadExtensionSharedSdk = createLazyRuntimeModule(() => import(EXTENSION_SHARED_MODULE_ID));
|
|
473
502
|
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-
|
|
503
|
+
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-CbX1-Knh.js"));
|
|
504
|
+
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-cYXKkrRD.js"));
|
|
505
|
+
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-S81tsswN.js"));
|
|
477
506
|
async function resolveSlackHandleAction() {
|
|
478
507
|
return getOptionalSlackRuntime()?.channel?.slack?.handleSlackAction ?? (await loadSlackActionRuntime()).handleSlackAction;
|
|
479
508
|
}
|
|
480
509
|
function shouldTreatSlackDeliveredTextAsVisible(params) {
|
|
481
510
|
return params.kind === "block" && typeof params.text === "string" && params.text.trim().length > 0;
|
|
482
511
|
}
|
|
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-
|
|
512
|
+
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-CNBz8lJa.js").then((n) => n.t));
|
|
513
|
+
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-CNPrxaXY.js").then((n) => n.n));
|
|
514
|
+
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-Dzomuwnr.js").then((n) => n.n));
|
|
515
|
+
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-D9I6uc0Q.js"));
|
|
516
|
+
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-BmgNe6S9.js"));
|
|
517
|
+
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-HoEg_WxB.js").then((n) => n.n));
|
|
518
|
+
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-1nF1NtqT.js").then((n) => n.t));
|
|
519
|
+
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-CFKUtW9E.js").then((n) => n.t));
|
|
491
520
|
async function resolveSlackSendContext(params) {
|
|
492
521
|
const account = resolveSlackAccount({
|
|
493
522
|
cfg: params.cfg,
|
|
494
523
|
accountId: params.accountId
|
|
495
524
|
});
|
|
496
|
-
|
|
525
|
+
const target = parseSlackTarget(params.to, { defaultKind: "channel" });
|
|
526
|
+
assertSlackDetachedTargetAllowed(account.accountId, target?.teamId);
|
|
497
527
|
const send = resolveOutboundSendDep(params.deps, "slack") ?? (await loadSlackSendRuntime()).sendMessageSlack;
|
|
498
528
|
const token = resolveSlackOperationToken(account, "write");
|
|
499
529
|
const botToken = account.botToken?.trim();
|
|
@@ -501,7 +531,8 @@ async function resolveSlackSendContext(params) {
|
|
|
501
531
|
return {
|
|
502
532
|
send,
|
|
503
533
|
threadTsValue: resolveSlackThreadTsValue(params),
|
|
504
|
-
tokenOverride
|
|
534
|
+
tokenOverride,
|
|
535
|
+
to: params.to
|
|
505
536
|
};
|
|
506
537
|
}
|
|
507
538
|
async function setSlackHeartbeatThreadStatus(params) {
|
|
@@ -512,11 +543,11 @@ async function setSlackHeartbeatThreadStatus(params) {
|
|
|
512
543
|
cfg: params.cfg,
|
|
513
544
|
accountId: params.accountId
|
|
514
545
|
});
|
|
515
|
-
|
|
546
|
+
assertSlackDetachedTargetAllowed(account.accountId, target.teamId);
|
|
516
547
|
const botToken = normalizeOptionalString(account.botToken);
|
|
517
548
|
if (!botToken) return;
|
|
518
549
|
try {
|
|
519
|
-
const client =
|
|
550
|
+
const client = getSlackWriteClient(botToken, { teamId: target.teamId });
|
|
520
551
|
const apiTargetId = canonicalizeSlackApiTargetId(target.kind, target.id, params.to);
|
|
521
552
|
const channelId = target.kind === "channel" ? apiTargetId : await (await loadSlackSendRuntime()).resolveSlackDmChannelId({
|
|
522
553
|
client,
|
|
@@ -539,9 +570,7 @@ function withSlackSendOverride(params) {
|
|
|
539
570
|
...params.deps,
|
|
540
571
|
slack: async (to, text, opts) => await params.send(to, text, {
|
|
541
572
|
...opts,
|
|
542
|
-
...params.tokenOverride ? { token: params.tokenOverride } : {}
|
|
543
|
-
...params.deliveryQueueId ? { deliveryQueueId: params.deliveryQueueId } : {},
|
|
544
|
-
...params.onPlatformSendDispatch ? { onPlatformSendDispatch: params.onPlatformSendDispatch } : {}
|
|
573
|
+
...params.tokenOverride ? { token: params.tokenOverride } : {}
|
|
545
574
|
})
|
|
546
575
|
};
|
|
547
576
|
}
|
|
@@ -549,7 +578,7 @@ function resolveSlackRouteTarget(raw) {
|
|
|
549
578
|
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
|
550
579
|
if (!target) return null;
|
|
551
580
|
return {
|
|
552
|
-
to: target.id,
|
|
581
|
+
to: target.teamId ? target.normalized : target.id,
|
|
553
582
|
chatType: target.kind === "user" ? "direct" : "channel"
|
|
554
583
|
};
|
|
555
584
|
}
|
|
@@ -590,23 +619,29 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
590
619
|
const apiTargetId = canonicalizeSlackApiTargetId(parsed.kind, parsed.id, params.target);
|
|
591
620
|
const isDm = parsed.kind === "user";
|
|
592
621
|
let peerKind = isDm ? "direct" : "channel";
|
|
593
|
-
let peerId = parsed
|
|
622
|
+
let peerId = formatSlackTarget(parsed);
|
|
594
623
|
let recipientSessionExact = isDm ? /^[UW][A-Z0-9]{8,}$/i.test(parsed.id) : /^C[A-Z0-9]{8,}$/i.test(parsed.id);
|
|
595
624
|
if (!isDm && /^D/i.test(parsed.id)) {
|
|
596
625
|
const conversation = await resolveSlackConversationInfo({
|
|
597
626
|
cfg: params.cfg,
|
|
598
627
|
accountId: params.accountId,
|
|
599
|
-
channelId: apiTargetId
|
|
628
|
+
channelId: apiTargetId,
|
|
629
|
+
teamId: parsed.teamId
|
|
600
630
|
});
|
|
601
631
|
if (conversation.type !== "dm" || !conversation.user) return null;
|
|
602
632
|
peerKind = "direct";
|
|
603
|
-
peerId =
|
|
633
|
+
peerId = formatSlackTarget({
|
|
634
|
+
teamId: parsed.teamId,
|
|
635
|
+
kind: "user",
|
|
636
|
+
id: conversation.user
|
|
637
|
+
});
|
|
604
638
|
recipientSessionExact = true;
|
|
605
639
|
} else if (!isDm && /^G/i.test(parsed.id)) {
|
|
606
640
|
const channelType = await resolveSlackChannelType({
|
|
607
641
|
cfg: params.cfg,
|
|
608
642
|
accountId: params.accountId,
|
|
609
|
-
channelId: apiTargetId
|
|
643
|
+
channelId: apiTargetId,
|
|
644
|
+
teamId: parsed.teamId
|
|
610
645
|
});
|
|
611
646
|
if (channelType === "group") peerKind = "group";
|
|
612
647
|
if (channelType === "dm") peerKind = "direct";
|
|
@@ -616,12 +651,16 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
616
651
|
kind: peerKind,
|
|
617
652
|
id: peerId
|
|
618
653
|
};
|
|
619
|
-
const
|
|
654
|
+
const unpartitionedBaseSessionKey = buildSlackBaseSessionKey({
|
|
620
655
|
cfg: params.cfg,
|
|
621
656
|
agentId: params.agentId,
|
|
622
657
|
accountId: params.accountId,
|
|
623
658
|
peer
|
|
624
659
|
});
|
|
660
|
+
const baseSessionKey = parsed.teamId && peerKind === "direct" && (params.cfg.session?.dmScope ?? "main") === "main" ? `${unpartitionedBaseSessionKey}:account:${encodeURIComponent(resolveSlackAccount({
|
|
661
|
+
cfg: params.cfg,
|
|
662
|
+
accountId: params.accountId
|
|
663
|
+
}).accountId).toLowerCase()}:team:${encodeURIComponent(parsed.teamId).toLowerCase()}` : unpartitionedBaseSessionKey;
|
|
625
664
|
return buildThreadAwareOutboundSessionRoute({
|
|
626
665
|
route: {
|
|
627
666
|
sessionKey: baseSessionKey,
|
|
@@ -630,7 +669,7 @@ async function resolveSlackOutboundSessionRoute(params) {
|
|
|
630
669
|
peer,
|
|
631
670
|
chatType: peerKind === "direct" ? "direct" : "channel",
|
|
632
671
|
from: peerKind === "direct" ? `slack:${peerId}` : peerKind === "group" ? `slack:group:${peerId}` : `slack:channel:${peerId}`,
|
|
633
|
-
to: peerKind === "direct" ? `user:${peerId}` : `channel:${peerId}`
|
|
672
|
+
to: parsed.teamId ? peerId : peerKind === "direct" ? `user:${peerId}` : `channel:${peerId}`
|
|
634
673
|
},
|
|
635
674
|
replyToId: params.replyToId,
|
|
636
675
|
threadId: params.threadId,
|
|
@@ -683,6 +722,10 @@ const slackChannelOutbound = {
|
|
|
683
722
|
accountId,
|
|
684
723
|
payload
|
|
685
724
|
}),
|
|
725
|
+
afterDeliverPayload: async (ctx) => {
|
|
726
|
+
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
727
|
+
await slackOutbound.afterDeliverPayload(ctx);
|
|
728
|
+
},
|
|
686
729
|
presentationCapabilities: SLACK_PRESENTATION_CAPABILITIES,
|
|
687
730
|
...createRuntimeOutboundDelegates({
|
|
688
731
|
getRuntime: loadSlackOutboundAdapterModule,
|
|
@@ -692,9 +735,10 @@ const slackChannelOutbound = {
|
|
|
692
735
|
}
|
|
693
736
|
}),
|
|
694
737
|
sendPayload: async (ctx) => {
|
|
695
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
738
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
696
739
|
cfg: ctx.cfg,
|
|
697
740
|
accountId: ctx.accountId ?? void 0,
|
|
741
|
+
to: ctx.to,
|
|
698
742
|
deps: ctx.deps,
|
|
699
743
|
replyToId: ctx.replyToId,
|
|
700
744
|
threadId: ctx.threadId
|
|
@@ -702,10 +746,10 @@ const slackChannelOutbound = {
|
|
|
702
746
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
703
747
|
return await slackOutbound.sendPayload({
|
|
704
748
|
...ctx,
|
|
749
|
+
to,
|
|
705
750
|
replyToId: threadTsValue,
|
|
706
751
|
threadId: null,
|
|
707
752
|
deliveryQueueId: void 0,
|
|
708
|
-
onPlatformSendDispatch: void 0,
|
|
709
753
|
deps: withSlackSendOverride({
|
|
710
754
|
deps: ctx.deps,
|
|
711
755
|
send,
|
|
@@ -714,9 +758,10 @@ const slackChannelOutbound = {
|
|
|
714
758
|
});
|
|
715
759
|
},
|
|
716
760
|
sendText: async (ctx) => {
|
|
717
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
761
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
718
762
|
cfg: ctx.cfg,
|
|
719
763
|
accountId: ctx.accountId ?? void 0,
|
|
764
|
+
to: ctx.to,
|
|
720
765
|
deps: ctx.deps,
|
|
721
766
|
replyToId: ctx.replyToId,
|
|
722
767
|
threadId: ctx.threadId
|
|
@@ -724,23 +769,21 @@ const slackChannelOutbound = {
|
|
|
724
769
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
725
770
|
return await slackOutbound.sendText({
|
|
726
771
|
...ctx,
|
|
772
|
+
to,
|
|
727
773
|
replyToId: threadTsValue,
|
|
728
774
|
threadId: null,
|
|
729
|
-
deliveryQueueId: void 0,
|
|
730
|
-
onPlatformSendDispatch: void 0,
|
|
731
775
|
deps: withSlackSendOverride({
|
|
732
776
|
deps: ctx.deps,
|
|
733
777
|
send,
|
|
734
|
-
tokenOverride
|
|
735
|
-
deliveryQueueId: ctx.deliveryQueueId,
|
|
736
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
778
|
+
tokenOverride
|
|
737
779
|
})
|
|
738
780
|
});
|
|
739
781
|
},
|
|
740
782
|
sendMedia: async (ctx) => {
|
|
741
|
-
const { send, threadTsValue, tokenOverride } = await resolveSlackSendContext({
|
|
783
|
+
const { send, threadTsValue, tokenOverride, to } = await resolveSlackSendContext({
|
|
742
784
|
cfg: ctx.cfg,
|
|
743
785
|
accountId: ctx.accountId ?? void 0,
|
|
786
|
+
to: ctx.to,
|
|
744
787
|
deps: ctx.deps,
|
|
745
788
|
replyToId: ctx.replyToId,
|
|
746
789
|
threadId: ctx.threadId
|
|
@@ -748,15 +791,14 @@ const slackChannelOutbound = {
|
|
|
748
791
|
const { slackOutbound } = await loadSlackOutboundAdapterModule();
|
|
749
792
|
return await slackOutbound.sendMedia({
|
|
750
793
|
...ctx,
|
|
794
|
+
to,
|
|
751
795
|
replyToId: threadTsValue,
|
|
752
796
|
threadId: null,
|
|
753
797
|
deliveryQueueId: void 0,
|
|
754
|
-
onPlatformSendDispatch: void 0,
|
|
755
798
|
deps: withSlackSendOverride({
|
|
756
799
|
deps: ctx.deps,
|
|
757
800
|
send,
|
|
758
|
-
tokenOverride
|
|
759
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
801
|
+
tokenOverride
|
|
760
802
|
})
|
|
761
803
|
});
|
|
762
804
|
}
|
|
@@ -785,11 +827,21 @@ const slackMessageAdapter = {
|
|
|
785
827
|
...slackMessageAdapterBase.durableFinal?.capabilities,
|
|
786
828
|
reconcileUnknownSend: true
|
|
787
829
|
},
|
|
788
|
-
admitDeferredDelivery: ({ cfg, accountId }) => {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
830
|
+
admitDeferredDelivery: ({ cfg, accountId, to }) => {
|
|
831
|
+
const account = resolveSlackAccount({
|
|
832
|
+
cfg,
|
|
833
|
+
accountId
|
|
834
|
+
});
|
|
835
|
+
const target = parseSlackTarget(to, { defaultKind: "channel" });
|
|
836
|
+
try {
|
|
837
|
+
assertSlackDetachedTargetAllowed(account.accountId, target?.teamId);
|
|
838
|
+
return { status: "allowed" };
|
|
839
|
+
} catch (error) {
|
|
840
|
+
return {
|
|
841
|
+
status: "permanent_rejection",
|
|
842
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
843
|
+
};
|
|
844
|
+
}
|
|
793
845
|
},
|
|
794
846
|
reconcileUnknownSendKinds: { text: true },
|
|
795
847
|
reconcileUnknownSend: async (ctx) => await (await loadSlackSendRuntime()).reconcileSlackUnknownSend(ctx)
|
|
@@ -799,7 +851,6 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
799
851
|
base: {
|
|
800
852
|
...createSlackPluginBase({
|
|
801
853
|
setupWizard: createSlackSetupWizardProxy(loadSlackSetupSurfaceModule),
|
|
802
|
-
setup: slackSetupAdapter,
|
|
803
854
|
setupContract: slackSetupContract
|
|
804
855
|
}),
|
|
805
856
|
allowlist: {
|
|
@@ -833,10 +884,7 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
833
884
|
parentConversationId
|
|
834
885
|
})
|
|
835
886
|
},
|
|
836
|
-
conversationBindings: { isCurrentConversationBindingSupported: ({ accountId }) =>
|
|
837
|
-
const cfg = getOptionalSlackRuntime()?.config.current();
|
|
838
|
-
return cfg ? mergeSlackAccountConfig(cfg, accountId).enterpriseOrgInstall !== true : false;
|
|
839
|
-
} },
|
|
887
|
+
conversationBindings: { isCurrentConversationBindingSupported: ({ accountId }) => isSlackWorkspaceInstallation(accountId) },
|
|
840
888
|
messaging: {
|
|
841
889
|
targetPrefixes: ["slack"],
|
|
842
890
|
directTargetStyle: "user-prefixed",
|
|
@@ -846,9 +894,9 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
846
894
|
const parent = parentConversationId?.trim();
|
|
847
895
|
const child = conversationId.trim();
|
|
848
896
|
return parent && parent !== child ? {
|
|
849
|
-
to: normalizeSlackMessagingTarget(
|
|
897
|
+
to: normalizeSlackMessagingTarget(parent),
|
|
850
898
|
threadId: child
|
|
851
|
-
} : { to: normalizeSlackMessagingTarget(
|
|
899
|
+
} : { to: normalizeSlackMessagingTarget(child) };
|
|
852
900
|
},
|
|
853
901
|
resolveSessionTarget: ({ id }) => {
|
|
854
902
|
return normalizeSlackMessagingTarget(`channel:${id}`);
|
|
@@ -1066,25 +1114,37 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
1066
1114
|
} },
|
|
1067
1115
|
mentions: { stripPatterns: () => ["<@[^>\\s]+>"] }
|
|
1068
1116
|
},
|
|
1069
|
-
pairing: {
|
|
1117
|
+
pairing: {
|
|
1070
1118
|
idLabel: "slackUserId",
|
|
1071
|
-
message: PAIRING_APPROVED_MESSAGE,
|
|
1072
1119
|
normalizeAllowEntry: createPairingPrefixStripper(/^(slack|user):/i),
|
|
1073
|
-
|
|
1120
|
+
resolveApprovalStoreEntry: ({ id, meta }) => {
|
|
1121
|
+
const senderId = meta?.senderId ?? id;
|
|
1122
|
+
return formatSlackTarget({
|
|
1123
|
+
teamId: meta?.teamId,
|
|
1124
|
+
kind: "user",
|
|
1125
|
+
id: senderId
|
|
1126
|
+
});
|
|
1127
|
+
},
|
|
1128
|
+
notifyApproval: async ({ cfg, id, accountId, meta }) => {
|
|
1074
1129
|
const account = resolveSlackAccount({
|
|
1075
1130
|
cfg,
|
|
1076
|
-
accountId: resolveDefaultSlackAccountId(cfg)
|
|
1131
|
+
accountId: accountId ?? resolveDefaultSlackAccountId(cfg)
|
|
1077
1132
|
});
|
|
1078
|
-
assertSlackDirectSendAllowed(account);
|
|
1079
1133
|
const { sendMessageSlack } = await loadSlackSendRuntime();
|
|
1080
1134
|
const token = resolveSlackOperationToken(account, "write");
|
|
1081
|
-
|
|
1135
|
+
const senderId = meta?.senderId ?? id;
|
|
1136
|
+
await sendMessageSlack(formatSlackTarget({
|
|
1137
|
+
teamId: meta?.teamId,
|
|
1138
|
+
kind: "user",
|
|
1139
|
+
id: senderId,
|
|
1140
|
+
explicitKind: true
|
|
1141
|
+
}), PAIRING_APPROVED_MESSAGE, {
|
|
1082
1142
|
cfg,
|
|
1083
1143
|
accountId: account.accountId,
|
|
1084
1144
|
...token ? { token } : {}
|
|
1085
1145
|
});
|
|
1086
1146
|
}
|
|
1087
|
-
}
|
|
1147
|
+
},
|
|
1088
1148
|
security: slackSecurityAdapter,
|
|
1089
1149
|
threading: {
|
|
1090
1150
|
threadAddressing: "message",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SlackChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as SlackChannelConfigSchema } from "./config-schema-xto5jFIx.js";
|
|
2
2
|
export { SlackChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackPlugin } from "./channel-
|
|
1
|
+
import { t as slackPlugin } from "./channel-D_tovcUL.js";
|
|
2
2
|
export { slackPlugin };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-
|
|
3
|
-
import { s as normalizeAllowListLower } from "./group-policy-
|
|
4
|
-
import {
|
|
2
|
+
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-CK4AVI2_.js";
|
|
3
|
+
import { p as assertSlackDetachedTargetAllowed, s as normalizeAllowListLower } from "./group-policy-c4RP9bjc.js";
|
|
4
|
+
import { a as createSlackReadClient, c as createSlackWebClient } from "./probe-HoEg_WxB.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
8
8
|
//#region extensions/slack/src/channel-type.ts
|
|
9
9
|
var channel_type_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
__resetSlackChannelTypeCacheForTest: () => resetSlackChannelTypeCacheForTest,
|
|
11
10
|
resetSlackChannelTypeCacheForTest: () => resetSlackChannelTypeCacheForTest,
|
|
12
11
|
resolveSlackChannelType: () => resolveSlackChannelType,
|
|
13
12
|
resolveSlackConversationInfo: () => resolveSlackConversationInfo
|
|
@@ -47,12 +46,14 @@ async function resolveSlackConversationInfo(params) {
|
|
|
47
46
|
cfg: params.cfg,
|
|
48
47
|
accountId: params.accountId
|
|
49
48
|
});
|
|
49
|
+
assertSlackDetachedTargetAllowed(account.accountId, params.teamId);
|
|
50
50
|
const operation = params.operation ?? "read";
|
|
51
51
|
const token = resolveSlackOperationToken(account, operation);
|
|
52
52
|
const userToken = normalizeOptionalString(account.userToken);
|
|
53
53
|
const credentialRole = token ? token === userToken ? "user" : "bot" : "none";
|
|
54
54
|
const credentialFingerprint = token ? fingerprintSlackCredential(token) : "none";
|
|
55
|
-
const
|
|
55
|
+
const teamId = normalizeLowercaseStringOrEmpty(params.teamId) || "no-team-id";
|
|
56
|
+
const cacheKey = `${account.accountId}:${teamId}:${operation}:${credentialRole}:${credentialFingerprint}:${channelId}`;
|
|
56
57
|
if (!params.requireFreshName) {
|
|
57
58
|
const cached = getCachedSlackConversationInfo(cacheKey);
|
|
58
59
|
if (cached) return cached;
|
|
@@ -64,7 +65,7 @@ async function resolveSlackConversationInfo(params) {
|
|
|
64
65
|
});
|
|
65
66
|
if (token) try {
|
|
66
67
|
if (isNativeImChannel && operation === "write") {
|
|
67
|
-
const opened = await createSlackWebClient(token).conversations.open({
|
|
68
|
+
const opened = await createSlackWebClient(token, { teamId: params.teamId }).conversations.open({
|
|
68
69
|
channel: channelId,
|
|
69
70
|
prevent_creation: true,
|
|
70
71
|
return_im: true
|
|
@@ -77,7 +78,7 @@ async function resolveSlackConversationInfo(params) {
|
|
|
77
78
|
if (user) setCachedSlackConversationInfo(cacheKey, result);
|
|
78
79
|
return result;
|
|
79
80
|
}
|
|
80
|
-
const channel = (await createSlackReadClient(token).conversations.info({ channel: channelId })).channel;
|
|
81
|
+
const channel = (await createSlackReadClient(token, { teamId: params.teamId }).conversations.info({ channel: channelId })).channel;
|
|
81
82
|
const type = channel?.is_im ? "dm" : channel?.is_mpim ? "group" : "channel";
|
|
82
83
|
const name = normalizeOptionalString(channel?.name);
|
|
83
84
|
const user = normalizeOptionalString(channel?.user);
|
|
@@ -105,4 +106,4 @@ function resetSlackChannelTypeCacheForTest() {
|
|
|
105
106
|
SLACK_CONVERSATION_INFO_CACHE.clear();
|
|
106
107
|
}
|
|
107
108
|
//#endregion
|
|
108
|
-
export {
|
|
109
|
+
export { resolveSlackChannelType as n, resolveSlackConversationInfo as r, channel_type_exports as t };
|