@openclaw/slack 2026.8.1 → 2026.8.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-CN2hBsim.js → account-inspect-C3sePHWa.js} +3 -3
- package/dist/account-inspect-api.js +1 -1
- package/dist/{action-runtime-044ldvNL.js → action-runtime-B0kRJ69h.js} +50 -40
- package/dist/action-runtime.runtime-IuA14rev.js +2 -0
- package/dist/{actions-BI7JkfVm.js → actions-BOxiu2Vy.js} +18 -12
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-DYv0UIZS.js → approval-handler.runtime-l5_2JLqi.js} +7 -6
- package/dist/{channel-1vIJOzPx.js → channel-BguxhhNG.js} +39 -31
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-DlFSKeIZ.js → channel-type-ChkODKBW.js} +2 -2
- package/dist/{channel.setup-ofDi3_Pu.js → channel.setup-BJohRJha.js} +23 -22
- package/dist/{config-schema-BVIMyiDN.js → config-schema-B9GwoRlE.js} +5 -3
- package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
- package/dist/{directory-config-DqfQ42OV.js → directory-config-Bmw4ykSy.js} +4 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BPaNHjmP.js → directory-live-BOILcXPo.js} +1 -1
- package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-BdwszjYn.js → group-policy-BYH74y50.js} +70 -39
- package/dist/{message-tool-api-CJ0kjcg5.js → message-tool-api-BsZbsulu.js} +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Dq5Cmrvp.js → monitor-B72wWXWg.js} +3 -3
- package/dist/{outbound-adapter-DYaI8ThX.js → outbound-adapter-CPgYQ-BM.js} +3 -3
- package/dist/{pipeline.runtime-Bd22U0ga.js → pipeline.runtime-CcdujV99.js} +238 -393
- package/dist/{policy-CtQVbde1.js → policy-CUpBeOt9.js} +7 -5
- package/dist/{probe-0usmAb0i.js → probe-gj5yQgN2.js} +113 -112
- package/dist/{provider-CN_8hFv2.js → provider-DW9YC_no.js} +69 -44
- package/dist/{relay-source-BNGpsdwV.js → relay-source-BLMdBrAw.js} +6 -4
- package/dist/{replies-BSiRQOJ1.js → replies-DLjQ8RYU.js} +13 -8
- package/dist/{resolve-channels-Czheznc8.js → resolve-channels-Bv6IiGZ4.js} +4 -3
- package/dist/{resolve-users-BAOlNimr.js → resolve-users-BXw2pA7y.js} +4 -3
- package/dist/runtime-api.js +10 -10
- package/dist/{scopes-COSlmhnH.js → scopes-B9HRguDe.js} +1 -1
- package/dist/{send-DS9ICrBI.js → send-GUz4_v2E.js} +21 -13
- package/dist/{send.runtime-D_Bb6IuH.js → send.runtime-rScD-UJi.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BGnd2pSe.js → setup-surface-Cc3P-z35.js} +5 -5
- package/dist/{shared-D5B-5hBg.js → shared-CQGVZ_8a.js} +5 -5
- package/dist/{slash-dispatch.runtime-CilDmI0c.js → slash-dispatch.runtime-C2015r6s.js} +1 -1
- package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
- package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +5 -5
- package/dist/action-runtime.runtime-BL3KzX13.js +0 -2
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -35,13 +35,13 @@ function inspectSlackAccount(params) {
|
|
|
35
35
|
const mode = merged.mode ?? "socket";
|
|
36
36
|
const identity = merged.postAs ?? "bot";
|
|
37
37
|
const isHttpMode = mode === "http";
|
|
38
|
-
const
|
|
38
|
+
const isSocketMode = mode === "socket";
|
|
39
39
|
const configBot = inspectSlackToken(merged.botToken);
|
|
40
|
-
const configApp = inspectSlackToken(merged.appToken);
|
|
40
|
+
const configApp = inspectSlackToken(isSocketMode ? merged.appToken : void 0);
|
|
41
41
|
const configSigningSecret = inspectSlackToken(merged.signingSecret);
|
|
42
42
|
const configUser = inspectSlackToken(merged.userToken);
|
|
43
43
|
const envBot = allowEnv ? normalizeSecretInputString(params.envBotToken ?? process.env.SLACK_BOT_TOKEN) : void 0;
|
|
44
|
-
const envApp = allowEnv &&
|
|
44
|
+
const envApp = allowEnv && isSocketMode ? normalizeSecretInputString(params.envAppToken ?? process.env.SLACK_APP_TOKEN) : void 0;
|
|
45
45
|
const envUser = allowEnv ? normalizeSecretInputString(params.envUserToken ?? process.env.SLACK_USER_TOKEN) : void 0;
|
|
46
46
|
const botCredential = resolveInspectedSlackToken(configBot, envBot);
|
|
47
47
|
const appCredential = resolveInspectedSlackToken(configApp, envApp);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
1
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
2
2
|
//#region extensions/slack/account-inspect-api.ts
|
|
3
3
|
function inspectSlackReadOnlyAccount(cfg, accountId) {
|
|
4
4
|
return inspectSlackAccount({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-
|
|
2
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
3
|
-
import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, t as buildSlackChannelIdCandidates, yt as getSlackInstallationKind } from "./group-policy-
|
|
4
|
-
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-
|
|
1
|
+
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-PbxGDbr9.js";
|
|
2
|
+
import { t as slackContextTargetsMatch } from "./targets-7FexXJ62.js";
|
|
3
|
+
import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, t as buildSlackChannelIdCandidates, yt as getSlackInstallationKind } from "./group-policy-BYH74y50.js";
|
|
4
|
+
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-CUpBeOt9.js";
|
|
5
5
|
import { t as mergeSlackSendResults } from "./send-results-eeOu_HYm.js";
|
|
6
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
7
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -27,9 +27,9 @@ const pinActions = /* @__PURE__ */ new Set([
|
|
|
27
27
|
"listPins"
|
|
28
28
|
]);
|
|
29
29
|
const SLACK_REACTION_RESULT_LIMIT = 100;
|
|
30
|
-
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-
|
|
30
|
+
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-BOxiu2Vy.js").then((n) => n.t));
|
|
31
31
|
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts.runtime-DRuEK6mL.js"));
|
|
32
|
-
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-
|
|
32
|
+
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-ChkODKBW.js").then((n) => n.t));
|
|
33
33
|
function createLazySlackAction(key) {
|
|
34
34
|
return (async (...args) => {
|
|
35
35
|
const action = (await loadSlackActionsRuntime())[key];
|
|
@@ -281,7 +281,8 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
281
281
|
accountId
|
|
282
282
|
});
|
|
283
283
|
const resolveChannelTarget = () => resolveSlackActionChannelTarget(account, readStringParam(params, "channelId", { required: true }), context);
|
|
284
|
-
const
|
|
284
|
+
const actionConfig = account.actions ?? cfg.channels?.slack?.actions;
|
|
285
|
+
const isActionEnabled = createActionGate(actionConfig);
|
|
285
286
|
const botToken = account.botToken?.trim();
|
|
286
287
|
const buildActionOpts = (operation, teamId) => {
|
|
287
288
|
const token = resolveSlackOperationToken(account, operation);
|
|
@@ -321,10 +322,13 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
321
322
|
removed: emoji
|
|
322
323
|
});
|
|
323
324
|
}
|
|
324
|
-
if (isEmpty)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
if (isEmpty) {
|
|
326
|
+
const removed = await slackActionRuntime.removeOwnSlackReactions(channelId, messageId, writeOpts);
|
|
327
|
+
return jsonResult({
|
|
328
|
+
ok: true,
|
|
329
|
+
removed
|
|
330
|
+
});
|
|
331
|
+
}
|
|
328
332
|
await slackActionRuntime.reactSlackMessage(channelId, messageId, emoji, writeOpts);
|
|
329
333
|
return jsonResult({
|
|
330
334
|
ok: true,
|
|
@@ -333,9 +337,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
333
337
|
}
|
|
334
338
|
await assertReadTargetAllowed(target);
|
|
335
339
|
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
340
|
+
const reactions = await slackActionRuntime.listSlackReactions(channelId, messageId, readOpts);
|
|
336
341
|
return jsonResult({
|
|
337
342
|
ok: true,
|
|
338
|
-
reactions:
|
|
343
|
+
reactions: reactions?.map((reaction) => reaction.users ? Object.assign({}, reaction, { users: reaction.users.slice(0, limit) }) : reaction)
|
|
339
344
|
});
|
|
340
345
|
}
|
|
341
346
|
if (messagingActions.has(action)) {
|
|
@@ -360,9 +365,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
360
365
|
context
|
|
361
366
|
});
|
|
362
367
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
368
|
+
const result = await slackActionRuntime.openSlackConversation(params.userIds, buildActionOpts("write", teamId));
|
|
363
369
|
return jsonResult({
|
|
364
370
|
ok: true,
|
|
365
|
-
...
|
|
371
|
+
...result
|
|
366
372
|
});
|
|
367
373
|
}
|
|
368
374
|
case "sendMessage": {
|
|
@@ -447,19 +453,20 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
447
453
|
const forceDocument = readBooleanParam(params, "forceDocument") === true;
|
|
448
454
|
if (readBooleanParam(params, "replyBroadcast")) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
|
|
449
455
|
const threadTs = resolveThreadTsFromContext(readStringParam(params, "threadTs"), destination, context, { suppressImplicitThread: params.topLevel === true || params.threadTs === null });
|
|
456
|
+
const result = await sendSlackMessage(destination, initialComment ?? "", {
|
|
457
|
+
...buildActionOpts("write"),
|
|
458
|
+
mediaUrl: filePath,
|
|
459
|
+
mediaAccess: context?.mediaAccess,
|
|
460
|
+
mediaLocalRoots: context?.mediaLocalRoots,
|
|
461
|
+
mediaReadFile: context?.mediaReadFile,
|
|
462
|
+
threadTs: threadTs ?? void 0,
|
|
463
|
+
...forceDocument ? { forceDocument: true } : {},
|
|
464
|
+
...filename ? { uploadFileName: filename } : {},
|
|
465
|
+
...title ? { uploadTitle: title } : {}
|
|
466
|
+
});
|
|
450
467
|
return jsonResult({
|
|
451
468
|
ok: true,
|
|
452
|
-
result
|
|
453
|
-
...buildActionOpts("write"),
|
|
454
|
-
mediaUrl: filePath,
|
|
455
|
-
mediaAccess: context?.mediaAccess,
|
|
456
|
-
mediaLocalRoots: context?.mediaLocalRoots,
|
|
457
|
-
mediaReadFile: context?.mediaReadFile,
|
|
458
|
-
threadTs: threadTs ?? void 0,
|
|
459
|
-
...forceDocument ? { forceDocument: true } : {},
|
|
460
|
-
...filename ? { uploadFileName: filename } : {},
|
|
461
|
-
...title ? { uploadTitle: title } : {}
|
|
462
|
-
})
|
|
469
|
+
result
|
|
463
470
|
});
|
|
464
471
|
}
|
|
465
472
|
case "editMessage": {
|
|
@@ -521,7 +528,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
521
528
|
const { channelId } = target;
|
|
522
529
|
await assertReadTargetAllowed(target);
|
|
523
530
|
const threadId = readStringParam(params, "threadId") ?? readStringParam(params, "replyTo");
|
|
524
|
-
const maxBytes = account.config?.mediaMaxMb ? account.config.mediaMaxMb * 1024 * 1024 :
|
|
531
|
+
const maxBytes = account.config?.mediaMaxMb ? account.config.mediaMaxMb * 1024 * 1024 : 20971520;
|
|
525
532
|
const readToken = resolveSlackOperationToken(account, "read");
|
|
526
533
|
const readOpts = buildActionOpts("read", target.teamId);
|
|
527
534
|
const downloaded = await slackActionRuntime.downloadSlackFile(fileId, {
|
|
@@ -556,10 +563,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
556
563
|
path: downloaded.path,
|
|
557
564
|
...downloaded.contentType ? { contentType: downloaded.contentType } : {},
|
|
558
565
|
media: { outbound: false }
|
|
559
|
-
}
|
|
566
|
+
},
|
|
567
|
+
imageSanitization: { maxDimensionPx: cfg.agents?.defaults?.imageMaxDimensionPx }
|
|
560
568
|
});
|
|
561
569
|
}
|
|
562
|
-
default: break;
|
|
563
570
|
}
|
|
564
571
|
}
|
|
565
572
|
if (pinActions.has(action)) {
|
|
@@ -581,12 +588,13 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
581
588
|
return jsonResult({ ok: true });
|
|
582
589
|
}
|
|
583
590
|
await assertReadTargetAllowed(target);
|
|
591
|
+
const normalizedPins = (await slackActionRuntime.listSlackPins(channelId, readOpts)).map((pin) => {
|
|
592
|
+
const message = pin.message ? withNormalizedTimestamp(pin.message, pin.message.ts) : pin.message;
|
|
593
|
+
return message ? Object.assign({}, pin, { message }) : pin;
|
|
594
|
+
});
|
|
584
595
|
return jsonResult({
|
|
585
596
|
ok: true,
|
|
586
|
-
pins:
|
|
587
|
-
const message = pin.message ? withNormalizedTimestamp(pin.message, pin.message.ts) : pin.message;
|
|
588
|
-
return message ? Object.assign({}, pin, { message }) : pin;
|
|
589
|
-
})
|
|
597
|
+
pins: normalizedPins
|
|
590
598
|
});
|
|
591
599
|
}
|
|
592
600
|
if (action === "memberInfo") {
|
|
@@ -602,9 +610,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
602
610
|
context
|
|
603
611
|
});
|
|
604
612
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
613
|
+
const info = await slackActionRuntime.getSlackMemberInfo(userId, buildActionOpts("read", teamId));
|
|
605
614
|
return jsonResult({
|
|
606
615
|
ok: true,
|
|
607
|
-
info
|
|
616
|
+
info
|
|
608
617
|
});
|
|
609
618
|
}
|
|
610
619
|
if (action === "emojiList") {
|
|
@@ -616,16 +625,17 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
616
625
|
});
|
|
617
626
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
618
627
|
const result = await slackActionRuntime.listSlackEmojis(buildActionOpts("read", teamId));
|
|
628
|
+
const emojis = Object.entries(result.emoji ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).slice(0, limit).map(([name, value]) => value.startsWith("alias:") ? {
|
|
629
|
+
name,
|
|
630
|
+
identifier: name,
|
|
631
|
+
aliasOf: value.slice(6)
|
|
632
|
+
} : {
|
|
633
|
+
name,
|
|
634
|
+
identifier: name
|
|
635
|
+
});
|
|
619
636
|
return jsonResult({
|
|
620
637
|
ok: true,
|
|
621
|
-
emojis
|
|
622
|
-
name,
|
|
623
|
-
identifier: name,
|
|
624
|
-
aliasOf: value.slice(6)
|
|
625
|
-
} : {
|
|
626
|
-
name,
|
|
627
|
-
identifier: name
|
|
628
|
-
})
|
|
638
|
+
emojis
|
|
629
639
|
});
|
|
630
640
|
}
|
|
631
641
|
throw new Error(`Unknown action: ${action}`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as resolveSlackAccount, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { n as formatSlackTarget } from "./target-parsing-
|
|
4
|
-
import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, D as renderSlackBlockFallbackText, E as buildSlackCompleteBlocksFallbackText, I as countSlackTextUtf8Bytes, Q as normalizeSlackOutboundText, R as truncateSlackTextByUtf8Bytes, T as buildSlackBlocksFallbackText, _ as appendSlackNativeDataPlainTextFallback, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, et as escapeSlackMrkdwn, g as appendSlackNativeDataFallbackText, k as SLACK_EDIT_TEXT_MAX_BYTES, st as validateSlackBlocksArray, w as stripSlackNativeDataBlocks, x as isSlackInvalidBlocksError } from "./group-policy-
|
|
5
|
-
import {
|
|
6
|
-
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-
|
|
3
|
+
import { n as formatSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
4
|
+
import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, D as renderSlackBlockFallbackText, E as buildSlackCompleteBlocksFallbackText, I as countSlackTextUtf8Bytes, Q as normalizeSlackOutboundText, R as truncateSlackTextByUtf8Bytes, T as buildSlackBlocksFallbackText, _ as appendSlackNativeDataPlainTextFallback, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, et as escapeSlackMrkdwn, g as appendSlackNativeDataFallbackText, k as SLACK_EDIT_TEXT_MAX_BYTES, st as validateSlackBlocksArray, w as stripSlackNativeDataBlocks, x as isSlackInvalidBlocksError } from "./group-policy-BYH74y50.js";
|
|
5
|
+
import { m as getSlackWriteClient, s as createSlackLookupClient } from "./probe-gj5yQgN2.js";
|
|
6
|
+
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-GUz4_v2E.js";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
8
8
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { createSubsystemLogger, logVerbose, logVerbose as logVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -48,7 +48,8 @@ function buildSlackEditTextPayload(content, blocks) {
|
|
|
48
48
|
if (trimmedContent && !blockText) return trimmedContent;
|
|
49
49
|
if (trimmedContent) {
|
|
50
50
|
const nativePlainText = blocks?.length ? appendSlackNativeDataPlainTextFallback("", blocks).trim() : "";
|
|
51
|
-
|
|
51
|
+
const fallbackText = Boolean(blockText && trimmedContent.includes(blockText)) || Boolean(nativePlainText && trimmedContent.includes(nativePlainText)) ? trimmedContent : blockText && !blockText.includes(trimmedContent) ? `${trimmedContent}\n\n${blockText}` : blockText || trimmedContent;
|
|
52
|
+
return truncateSlackTextByUtf8Bytes(fallbackText, SLACK_EDIT_TEXT_MAX_BYTES);
|
|
52
53
|
}
|
|
53
54
|
if (blockText) return truncateSlackTextByUtf8Bytes(blockText, SLACK_EDIT_TEXT_MAX_BYTES);
|
|
54
55
|
return " ";
|
|
@@ -547,8 +548,9 @@ function resolveToken(explicit, accountId, cfg) {
|
|
|
547
548
|
if (token) return token;
|
|
548
549
|
}
|
|
549
550
|
if (!cfg) throw new Error("Slack actions requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
551
|
+
const resolvedCfg = requireRuntimeConfig(cfg, "Slack actions");
|
|
550
552
|
const account = resolveSlackAccount({
|
|
551
|
-
cfg:
|
|
553
|
+
cfg: resolvedCfg,
|
|
552
554
|
accountId
|
|
553
555
|
});
|
|
554
556
|
const token = resolveSlackBotToken(account.botToken ?? void 0);
|
|
@@ -635,10 +637,11 @@ function hasSlackPlatformError(err, code) {
|
|
|
635
637
|
}
|
|
636
638
|
async function getClient(opts = {}, mode = "read") {
|
|
637
639
|
if (opts.client) return opts.client;
|
|
638
|
-
|
|
640
|
+
const accountId = opts.cfg ? resolveSlackAccount({
|
|
639
641
|
cfg: requireRuntimeConfig(opts.cfg, "Slack actions"),
|
|
640
642
|
accountId: opts.accountId
|
|
641
|
-
}).accountId : normalizeAccountId(opts.accountId)
|
|
643
|
+
}).accountId : normalizeAccountId(opts.accountId);
|
|
644
|
+
assertSlackDetachedTargetAllowed(accountId, opts.teamId);
|
|
642
645
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
643
646
|
if (mode === "write") return getSlackWriteClient(token, { teamId: opts.teamId });
|
|
644
647
|
return createSlackLookupClient(token, { teamId: opts.teamId });
|
|
@@ -724,11 +727,12 @@ async function sendSlackMessage(to, content, opts) {
|
|
|
724
727
|
}
|
|
725
728
|
async function editSlackMessage(channelId, messageId, content, opts = {}) {
|
|
726
729
|
const accountId = opts.accountId ?? (opts.cfg ? resolveDefaultSlackAccountId(opts.cfg) : void 0);
|
|
727
|
-
|
|
730
|
+
const tableMode = resolveMarkdownTableMode({
|
|
728
731
|
cfg: opts.cfg,
|
|
729
732
|
channel: "slack",
|
|
730
733
|
accountId
|
|
731
|
-
})
|
|
734
|
+
});
|
|
735
|
+
await editSlackRenderedMessage(channelId, messageId, normalizeSlackOutboundText(content, { tableMode }), opts);
|
|
732
736
|
}
|
|
733
737
|
async function editSlackRenderedMessage(channelId, messageId, content, opts = {}) {
|
|
734
738
|
const client = await getClient(opts, "write");
|
|
@@ -748,10 +752,12 @@ async function editSlackRenderedMessage(channelId, messageId, content, opts = {}
|
|
|
748
752
|
} catch (error) {
|
|
749
753
|
if (!hasSlackNativeDataBlock(blocks) || !isSlackInvalidBlocksError(error)) throw error;
|
|
750
754
|
logVerbose("slack edit: native data block rejected, retrying with text fallback");
|
|
751
|
-
const
|
|
755
|
+
const survivorBlocks = stripSlackNativeDataBlocks(blocks);
|
|
756
|
+
const survivorText = buildSlackBlocksFallbackText(survivorBlocks) ?? "";
|
|
752
757
|
const authoredEditText = content.trim();
|
|
758
|
+
const baseText = authoredEditText && !survivorText.includes(authoredEditText) ? authoredEditText : "";
|
|
753
759
|
const fallbackPlan = buildSlackNativeDataDeliveryPlan({
|
|
754
|
-
baseText
|
|
760
|
+
baseText,
|
|
755
761
|
blocks: blocks ?? []
|
|
756
762
|
});
|
|
757
763
|
if (fallbackPlan.fallbackMessages.length !== 1) throw new Error("Slack native chart or table edit fallback requires multiple messages. Send a new message instead.", { cause: error });
|
package/dist/api.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath, t as handleSlackHttpRequest } from "./registry-bbjH7IHX.js";
|
|
2
2
|
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { r as resolveSlackReplyToMode } from "./conversation-binding-route-
|
|
4
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
5
|
-
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-
|
|
6
|
-
import "./targets-
|
|
7
|
-
import { N as buildSlackInteractiveBlocks, P as buildSlackPresentationBlocks, at as SLACK_MAX_BLOCKS, i as resolveSlackGroupToolPolicy, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, r as resolveSlackGroupRequireMention, st as validateSlackBlocksArray } from "./group-policy-
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import { n as resolveSlackChannelType } from "./channel-type-
|
|
12
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
13
|
-
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, r as downloadSlackFile, s as listSlackEmojis, u as pinSlackMessage } from "./actions-
|
|
14
|
-
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-
|
|
15
|
-
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-
|
|
3
|
+
import { r as resolveSlackReplyToMode } from "./conversation-binding-route-Vee8Dgbf.js";
|
|
4
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
5
|
+
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-PbxGDbr9.js";
|
|
6
|
+
import "./targets-7FexXJ62.js";
|
|
7
|
+
import { N as buildSlackInteractiveBlocks, P as buildSlackPresentationBlocks, at as SLACK_MAX_BLOCKS, i as resolveSlackGroupToolPolicy, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, r as resolveSlackGroupRequireMention, st as validateSlackBlocksArray } from "./group-policy-BYH74y50.js";
|
|
8
|
+
import { C as normalizeAllowListLower, E as resolveSlackAllowListMatch, O as resolveSlackUserAllowed, S as normalizeAllowList, T as normalizeSlackSlug, b as resolveSlackWriteClientOptions, d as createSlackWebClient, f as createSlackWriteClient, g as SLACK_WRITE_RETRY_OPTIONS, h as SLACK_DEFAULT_RETRY_OPTIONS, m as getSlackWriteClient, t as probeSlack, u as createSlackTokenCacheKey, w as normalizeSlackAllowOwnerEntry, x as allowListMatches, y as resolveSlackWebClientOptions } from "./probe-gj5yQgN2.js";
|
|
9
|
+
import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-BguxhhNG.js";
|
|
10
|
+
import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-BsZbsulu.js";
|
|
11
|
+
import { n as resolveSlackChannelType } from "./channel-type-ChkODKBW.js";
|
|
12
|
+
import { t as slackSetupPlugin } from "./channel.setup-BJohRJha.js";
|
|
13
|
+
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, r as downloadSlackFile, s as listSlackEmojis, u as pinSlackMessage } from "./actions-BOxiu2Vy.js";
|
|
14
|
+
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-GUz4_v2E.js";
|
|
15
|
+
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-Bmw4ykSy.js";
|
|
16
16
|
import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
|
|
17
|
-
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-
|
|
17
|
+
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-DW9YC_no.js";
|
|
18
18
|
export { SLACK_DEFAULT_RETRY_OPTIONS, SLACK_MAX_BLOCKS, SLACK_WRITE_RETRY_OPTIONS, allowListMatches, buildSlackInteractiveBlocks, buildSlackPresentationBlocks, buildSlackThreadingToolContext, clearSlackThreadParticipationCache, collectSlackSecurityAuditFindings, createSlackTokenCacheKey, createSlackWebClient, createSlackWriteClient, deleteSlackMessage, downloadSlackFile, editSlackMessage, extractSlackToolSend, getSlackMemberInfo, getSlackWriteClient, handleSlackHttpRequest, hasSlackThreadParticipation, inspectSlackAccount, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, listSlackEmojis, listSlackMessageActions, listSlackPins, listSlackReactions, looksLikeSlackTargetId, mergeSlackAccountConfig, normalizeAllowList, normalizeAllowListLower, normalizeSlackAllowOwnerEntry, normalizeSlackMessagingTarget, normalizeSlackSlug, normalizeSlackWebhookPath, parseSlackBlocksInput, parseSlackTarget, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, recordSlackThreadParticipation, registerSlackHttpHandler, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAllowListMatch, resolveSlackAutoThreadId, resolveSlackChannelId, resolveSlackChannelType, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackReplyToMode, resolveSlackRuntimeGroupPolicy, resolveSlackUserAllowed, resolveSlackWebClientOptions, resolveSlackWriteClientOptions, sendSlackMessage, slackPlugin, slackSetupPlugin, unpinSlackMessage, validateSlackBlocksArray };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
2
|
-
import { Dt as normalizeSlackApproverId, R as truncateSlackTextByUtf8Bytes, f as resolveSlackReplyBlocks, gt as shouldHandleSlackNativeApprovalRequest, k as SLACK_EDIT_TEXT_MAX_BYTES, lt as isSlackAnyNativeApprovalClientEnabled, tt as SLACK_APPROVAL_HEADER_BLOCK_ID } from "./group-policy-
|
|
3
|
-
import { r as sendMessageSlack } from "./send-
|
|
1
|
+
import { a as parseSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
2
|
+
import { Dt as normalizeSlackApproverId, R as truncateSlackTextByUtf8Bytes, f as resolveSlackReplyBlocks, gt as shouldHandleSlackNativeApprovalRequest, k as SLACK_EDIT_TEXT_MAX_BYTES, lt as isSlackAnyNativeApprovalClientEnabled, tt as SLACK_APPROVAL_HEADER_BLOCK_ID } from "./group-policy-BYH74y50.js";
|
|
3
|
+
import { r as sendMessageSlack } from "./send-GUz4_v2E.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
6
6
|
import { buildApprovalPresentationFromActionDescriptors } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
@@ -46,7 +46,7 @@ function buildSlackMetadataLines(metadata) {
|
|
|
46
46
|
}
|
|
47
47
|
function buildSlackMetadataContextElements(metadata) {
|
|
48
48
|
const lines = buildSlackMetadataLines(metadata);
|
|
49
|
-
const visibleLineCount = lines.length > SLACK_CONTEXT_ELEMENTS_MAX ?
|
|
49
|
+
const visibleLineCount = lines.length > SLACK_CONTEXT_ELEMENTS_MAX ? 9 : lines.length;
|
|
50
50
|
const elements = [];
|
|
51
51
|
for (let index = 0; index < visibleLineCount; index += 1) {
|
|
52
52
|
const line = lines[index];
|
|
@@ -272,10 +272,11 @@ async function resolveApprovalChannel(client, target, teamId) {
|
|
|
272
272
|
const parsed = parseSlackTarget(target, { defaultKind: "channel" });
|
|
273
273
|
if (!parsed) throw new Error("Slack approval delivery target is missing");
|
|
274
274
|
if (parsed.kind === "channel") return `channel:${parsed.id}`;
|
|
275
|
-
const
|
|
275
|
+
const opened = await client.conversations.open({
|
|
276
276
|
users: parsed.id,
|
|
277
277
|
return_im: true
|
|
278
|
-
})
|
|
278
|
+
});
|
|
279
|
+
const channelId = normalizeOptionalString(opened.channel?.id);
|
|
279
280
|
if (!channelId) throw new Error("Slack Enterprise Grid approval DM did not return a channel id");
|
|
280
281
|
return `channel:${channelId}`;
|
|
281
282
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as isSlackPluginAccountConfigured } from "./account-configured-sUohAxZr.js";
|
|
2
2
|
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, l as resolveSlackOperationToken, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { n as resolveSlackConversationBindingRoute, r as resolveSlackReplyToMode, t as normalizeSlackRouteBindingConfig } from "./conversation-binding-route-
|
|
4
|
-
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, n as formatSlackTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId, t as canonicalizeSlackApiTargetId } from "./target-parsing-
|
|
5
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
6
|
-
import { $ as renderSlackMessagePresentationFallbackText, Ct as isSlackApprovalAuthorizedSender, Et as isSlackExecApprovalClientEnabled, F as canRenderSlackPresentation, I as countSlackTextUtf8Bytes, M as SLACK_TEXT_LIMIT, Ot as resolveSlackExecApprovalTarget, P as buildSlackPresentationBlocks, Q as normalizeSlackOutboundText, St as
|
|
3
|
+
import { n as resolveSlackConversationBindingRoute, r as resolveSlackReplyToMode, t as normalizeSlackRouteBindingConfig } from "./conversation-binding-route-Vee8Dgbf.js";
|
|
4
|
+
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, n as formatSlackTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId, t as canonicalizeSlackApiTargetId } from "./target-parsing-PbxGDbr9.js";
|
|
5
|
+
import { t as slackContextTargetsMatch } from "./targets-7FexXJ62.js";
|
|
6
|
+
import { $ as renderSlackMessagePresentationFallbackText, Ct as isSlackApprovalAuthorizedSender, Et as isSlackExecApprovalClientEnabled, F as canRenderSlackPresentation, I as countSlackTextUtf8Bytes, M as SLACK_TEXT_LIMIT, Ot as resolveSlackExecApprovalTarget, P as buildSlackPresentationBlocks, Q as normalizeSlackOutboundText, St as getSlackApprovalApproversForTeam, Tt as isSlackExecApprovalAuthorizedSender, _t as shouldHandleSlackPluginViaForwardingSession, a as qualifySlackConversationId, bt as isSlackWorkspaceInstallation, c as assertSlackDetachedTargetAllowed, ct as hasSlackPluginApprovers, d as resolveSlackReplyBlockResolution, dt as normalizeSlackOriginTarget, f as resolveSlackReplyBlocks, ft as resolveEnterpriseApprovalTeamId, gt as shouldHandleSlackNativeApprovalRequest, ht as resolveTurnSourceSlackOriginTarget, i as resolveSlackGroupToolPolicy, jt as resolveSlackAutoThreadId, k as SLACK_EDIT_TEXT_MAX_BYTES, kt as shouldSuppressLocalSlackExecApprovalPrompt, lt as isSlackAnyNativeApprovalClientEnabled, mt as resolveSlackFallbackOriginTarget, o as qualifySlackRoutePeerId, p as resolveSlackReplyDeliveryMessages, pt as resolveSessionSlackOriginTarget, r as resolveSlackGroupRequireMention, rt as SLACK_PRESENTATION_CAPABILITIES, ut as normalizeSlackForwardTarget, vt as slackTargetsMatch, wt as getSlackExecApprovalApprovers, yt as getSlackInstallationKind } from "./group-policy-BYH74y50.js";
|
|
7
|
+
import { m as getSlackWriteClient, o as formatSlackError } from "./probe-gj5yQgN2.js";
|
|
7
8
|
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 { a as PAIRING_APPROVED_MESSAGE, i as DEFAULT_ACCOUNT_ID$1, n as slackConfigAdapter, o as projectCredentialSnapshotFields, r as slackSecurityAdapter, s as resolveConfiguredFromRequiredCredentialStatuses, t as createSlackPluginBase } from "./shared-
|
|
10
|
-
import {
|
|
11
|
-
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-DlFSKeIZ.js";
|
|
9
|
+
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-BsZbsulu.js";
|
|
10
|
+
import { a as PAIRING_APPROVED_MESSAGE, i as DEFAULT_ACCOUNT_ID$1, n as slackConfigAdapter, o as projectCredentialSnapshotFields, r as slackSecurityAdapter, s as resolveConfiguredFromRequiredCredentialStatuses, t as createSlackPluginBase } from "./shared-CQGVZ_8a.js";
|
|
11
|
+
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-ChkODKBW.js";
|
|
12
12
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
13
|
-
import { a as slackSetupContract, i as createSlackSetupWizardProxy, o as SLACK_CHANNEL } from "./channel.setup-
|
|
13
|
+
import { a as slackSetupContract, i as createSlackSetupWizardProxy, o as SLACK_CHANNEL } from "./channel.setup-BJohRJha.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";
|
|
@@ -62,14 +62,20 @@ function resolveSlackApproverDmTargets(params) {
|
|
|
62
62
|
approvalKind: params.approvalKind,
|
|
63
63
|
request: params.request
|
|
64
64
|
})) return [];
|
|
65
|
-
const approvers = params.approvalKind === "plugin" ? getSlackApprovalApprovers(params) : getSlackExecApprovalApprovers(params);
|
|
66
65
|
const teamId = resolveEnterpriseApprovalTeamId(params.request);
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
return (params.approvalKind === "plugin" ? getSlackApprovalApproversForTeam({
|
|
67
|
+
...params,
|
|
68
|
+
teamId
|
|
69
|
+
}) : getSlackExecApprovalApprovers(params)).map((approver) => {
|
|
70
|
+
const target = parseSlackTarget(approver, { defaultKind: "user" });
|
|
71
|
+
if (!target || target.kind !== "user") throw new Error("Slack approval approver target must be a user");
|
|
72
|
+
return { to: formatSlackTarget({
|
|
73
|
+
kind: "user",
|
|
74
|
+
id: target.id,
|
|
75
|
+
teamId: target.teamId ?? teamId,
|
|
76
|
+
explicitKind: true
|
|
77
|
+
}) };
|
|
78
|
+
});
|
|
73
79
|
}
|
|
74
80
|
const shouldSuppressSlackForwardingFallback = createNativeApprovalForwardingFallbackSuppressor({
|
|
75
81
|
channel: "slack",
|
|
@@ -131,7 +137,7 @@ const baseSlackApprovalCapability = createApproverRestrictedNativeApprovalCapabi
|
|
|
131
137
|
approvalKind,
|
|
132
138
|
request
|
|
133
139
|
}),
|
|
134
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
140
|
+
load: async () => (await import("./approval-handler.runtime-l5_2JLqi.js")).slackApprovalNativeRuntime
|
|
135
141
|
})
|
|
136
142
|
});
|
|
137
143
|
const baseSlackNativeAdapter = baseSlackApprovalCapability.native;
|
|
@@ -173,7 +179,8 @@ const slackApprovalCapability = {
|
|
|
173
179
|
preferredSurface: "origin",
|
|
174
180
|
supportsApproverDmSurface: hasSlackPluginApprovers({
|
|
175
181
|
cfg: params.cfg,
|
|
176
|
-
accountId: params.accountId
|
|
182
|
+
accountId: params.accountId,
|
|
183
|
+
teamId: resolveEnterpriseApprovalTeamId(request)
|
|
177
184
|
})
|
|
178
185
|
} : {}
|
|
179
186
|
};
|
|
@@ -414,7 +421,7 @@ const SLACK_TOOL_DELIVERY_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
414
421
|
"unpinMessage",
|
|
415
422
|
"uploadFile"
|
|
416
423
|
]);
|
|
417
|
-
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
424
|
+
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-IuA14rev.js"));
|
|
418
425
|
function resolveSlackActionContext(ctx, toolContext) {
|
|
419
426
|
if (!toolContext && !ctx.mediaAccess && !ctx.mediaLocalRoots && !ctx.mediaReadFile && !ctx.conversationReadOrigin && !ctx.requesterAccountId && !ctx.requesterSenderId) return;
|
|
420
427
|
return {
|
|
@@ -556,23 +563,23 @@ const EXTENSION_SHARED_MODULE_ID = "openclaw/plugin-sdk/extension-shared";
|
|
|
556
563
|
const TARGET_RESOLVER_RUNTIME_MODULE_ID = "openclaw/plugin-sdk/target-resolver-runtime";
|
|
557
564
|
const loadExtensionSharedSdk = createLazyRuntimeModule(() => import(EXTENSION_SHARED_MODULE_ID));
|
|
558
565
|
const loadTargetResolverRuntimeSdk = createLazyRuntimeModule(() => import(TARGET_RESOLVER_RUNTIME_MODULE_ID));
|
|
559
|
-
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-
|
|
560
|
-
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-
|
|
561
|
-
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-
|
|
566
|
+
const loadSlackSetupSurfaceModule = createLazyRuntimeModule(() => import("./setup-surface-Cc3P-z35.js"));
|
|
567
|
+
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-B9HRguDe.js"));
|
|
568
|
+
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-CPgYQ-BM.js"));
|
|
562
569
|
async function resolveSlackHandleAction() {
|
|
563
570
|
return getOptionalSlackRuntime()?.channel?.slack?.handleSlackAction ?? (await loadSlackActionRuntime()).handleSlackAction;
|
|
564
571
|
}
|
|
565
572
|
function shouldTreatSlackDeliveredTextAsVisible(params) {
|
|
566
573
|
return params.kind === "block" && typeof params.text === "string" && params.text.trim().length > 0;
|
|
567
574
|
}
|
|
568
|
-
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
569
|
-
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-
|
|
570
|
-
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
571
|
-
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
572
|
-
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-
|
|
573
|
-
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
574
|
-
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
575
|
-
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
575
|
+
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-Bmw4ykSy.js").then((n) => n.t));
|
|
576
|
+
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-Bv6IiGZ4.js").then((n) => n.n));
|
|
577
|
+
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-BXw2pA7y.js").then((n) => n.n));
|
|
578
|
+
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-IuA14rev.js"));
|
|
579
|
+
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-rScD-UJi.js"));
|
|
580
|
+
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-gj5yQgN2.js").then((n) => n.n));
|
|
581
|
+
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-B72wWXWg.js").then((n) => n.t));
|
|
582
|
+
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-BOILcXPo.js").then((n) => n.t));
|
|
576
583
|
async function setSlackHeartbeatThreadStatus(params) {
|
|
577
584
|
const threadTs = resolveSlackThreadTsValue({ threadId: params.threadId });
|
|
578
585
|
const target = parseSlackTarget(params.to, { defaultKind: "channel" });
|
|
@@ -614,7 +621,8 @@ function resolveSlackRouteTarget(raw) {
|
|
|
614
621
|
function normalizeSlackAcpConversationId(raw) {
|
|
615
622
|
const trimmed = normalizeOptionalString(raw);
|
|
616
623
|
if (!trimmed) return null;
|
|
617
|
-
const
|
|
624
|
+
const parsed = parseSlackTarget(trimmed, { defaultKind: "channel" });
|
|
625
|
+
const conversationId = normalizeLowercaseStringOrEmpty(parsed?.id ?? trimmed.replace(/^slack:/i, "").replace(/^(?:channel|group|direct|user):/i, ""));
|
|
618
626
|
return conversationId ? { conversationId } : null;
|
|
619
627
|
}
|
|
620
628
|
function matchSlackAcpConversation(params) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SlackChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as SlackChannelConfigSchema } from "./config-schema-B9GwoRlE.js";
|
|
2
2
|
export { SlackChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackPlugin } from "./channel-
|
|
1
|
+
import { t as slackPlugin } from "./channel-BguxhhNG.js";
|
|
2
2
|
export { slackPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { c as assertSlackDetachedTargetAllowed } from "./group-policy-
|
|
4
|
-
import {
|
|
3
|
+
import { c as assertSlackDetachedTargetAllowed } from "./group-policy-BYH74y50.js";
|
|
4
|
+
import { C as normalizeAllowListLower, c as createSlackReadClient, d as createSlackWebClient } from "./probe-gj5yQgN2.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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as isSlackSetupAccountConfigured } from "./account-configured-sUohAxZr.js";
|
|
2
2
|
import { a as resolveSlackAccount, c as resolveSlackConfigAccessorAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
4
|
-
import { t as SlackChannelConfigSchema } from "./config-schema-
|
|
3
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
4
|
+
import { t as SlackChannelConfigSchema } from "./config-schema-B9GwoRlE.js";
|
|
5
5
|
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -260,6 +260,25 @@ const slackSetupAdapterBase = createPatchedAccountSetupAdapter({
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
|
+
const slackSetupAdapter = {
|
|
264
|
+
...slackSetupAdapterBase,
|
|
265
|
+
singleAccountKeysToMove: ["appToken"],
|
|
266
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
267
|
+
const setupInput = input;
|
|
268
|
+
const identity = setupInput.identity ?? inspectSlackAccount({
|
|
269
|
+
cfg,
|
|
270
|
+
accountId
|
|
271
|
+
}).config.postAs;
|
|
272
|
+
return slackSetupAdapterBase.applyAccountConfig({
|
|
273
|
+
cfg,
|
|
274
|
+
accountId,
|
|
275
|
+
input: identity === "user" ? {
|
|
276
|
+
...setupInput,
|
|
277
|
+
identity
|
|
278
|
+
} : setupInput
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
};
|
|
263
282
|
const slackSetupContract = defineChannelSetupContract({
|
|
264
283
|
fields: {
|
|
265
284
|
botToken: {
|
|
@@ -319,25 +338,7 @@ const slackSetupContract = defineChannelSetupContract({
|
|
|
319
338
|
envVars: ["SLACK_BOT_TOKEN"]
|
|
320
339
|
}
|
|
321
340
|
},
|
|
322
|
-
legacyAdapter:
|
|
323
|
-
...slackSetupAdapterBase,
|
|
324
|
-
singleAccountKeysToMove: ["appToken"],
|
|
325
|
-
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
326
|
-
const setupInput = input;
|
|
327
|
-
const identity = setupInput.identity ?? inspectSlackAccount({
|
|
328
|
-
cfg,
|
|
329
|
-
accountId
|
|
330
|
-
}).config.postAs;
|
|
331
|
-
return slackSetupAdapterBase.applyAccountConfig({
|
|
332
|
-
cfg,
|
|
333
|
-
accountId,
|
|
334
|
-
input: identity === "user" ? {
|
|
335
|
-
...setupInput,
|
|
336
|
-
identity
|
|
337
|
-
} : setupInput
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
+
legacyAdapter: slackSetupAdapter
|
|
341
342
|
});
|
|
342
343
|
function createSlackSetupWizardBase(handlers) {
|
|
343
344
|
const slackDmPolicy = createChannelDmPolicy({
|
|
@@ -555,7 +556,7 @@ const slackBaseConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
555
556
|
});
|
|
556
557
|
//#endregion
|
|
557
558
|
//#region extensions/slack/src/channel.setup.ts
|
|
558
|
-
const slackSetupWizard = createSlackSetupWizardProxy(async () => ({ slackSetupWizard: (await import("./setup-surface-
|
|
559
|
+
const slackSetupWizard = createSlackSetupWizardProxy(async () => ({ slackSetupWizard: (await import("./setup-surface-Cc3P-z35.js")).slackSetupWizard }));
|
|
559
560
|
const slackSetupPlugin = {
|
|
560
561
|
id: SLACK_CHANNEL,
|
|
561
562
|
meta: {
|
|
@@ -277,7 +277,8 @@ function validateSlackSigningSecretRequirements(value, ctx) {
|
|
|
277
277
|
for (const [accountId, account] of Object.entries(value.accounts ?? {})) {
|
|
278
278
|
if (!account || account.enabled === false) continue;
|
|
279
279
|
if ((resolveMode(account.mode) ?? baseMode) !== "http") continue;
|
|
280
|
-
|
|
280
|
+
const accountSecret = account.signingSecret ?? value.signingSecret;
|
|
281
|
+
if (!hasConfiguredSecretInput(accountSecret)) ctx.addIssue({
|
|
281
282
|
code: z.ZodIssueCode.custom,
|
|
282
283
|
message: "channels.slack.accounts.*.mode=\"http\" requires channels.slack.signingSecret or channels.slack.accounts.*.signingSecret",
|
|
283
284
|
path: [
|
|
@@ -288,7 +289,7 @@ function validateSlackSigningSecretRequirements(value, ctx) {
|
|
|
288
289
|
});
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
|
-
const
|
|
292
|
+
const SlackConfigSchema = SlackAccountSchema.safeExtend({
|
|
292
293
|
...rootPolicyShape,
|
|
293
294
|
postAs: SlackIdentitySchema.default("bot"),
|
|
294
295
|
userTokenReadOnly: z.boolean().optional().default(true),
|
|
@@ -385,6 +386,7 @@ const SlackChannelConfigSchema = buildChannelConfigSchema(SlackAccountSchema.saf
|
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
388
|
validateSlackSigningSecretRequirements(value, ctx);
|
|
388
|
-
})
|
|
389
|
+
});
|
|
390
|
+
const SlackChannelConfigSchema = buildChannelConfigSchema(SlackConfigSchema, { uiHints: slackChannelConfigUiHints });
|
|
389
391
|
//#endregion
|
|
390
392
|
export { SlackChannelConfigSchema as t };
|