@openclaw/slack 2026.10.2 → 2026.10.5-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/.setup/account-configured-zcR9TJJN.mjs +35 -0
- package/dist/.setup/{account-inspect-Cs-7DXXW.mjs → account-inspect-D58VVDjk.mjs} +15 -35
- package/dist/.setup/{accounts-CDgkV7Cm.mjs → accounts-BMg9YLIv.mjs} +44 -53
- package/dist/.setup/{action-runtime-DJ1daRAZ.mjs → action-runtime-BiRZNsIG.mjs} +20 -22
- package/dist/.setup/action-runtime.runtime-C5xceJoS.mjs +2 -0
- package/dist/.setup/{actions-DDoAJnrH.mjs → actions-KGKwTAKO.mjs} +34 -43
- package/dist/.setup/{approval-handler.runtime-BcE_shWc.mjs → approval-handler.runtime-DYrsG2Ox.mjs} +44 -70
- package/dist/.setup/{approval-message-updates-EgKGmFXx.mjs → approval-message-updates-CwdDew9i.mjs} +1 -1
- package/dist/.setup/{channel-DgKSu8Iv.mjs → channel-C7MY-Hhg.mjs} +138 -97
- package/dist/.setup/{channel-type-B9zYYzBU.mjs → channel-type-NjX2SwvS.mjs} +3 -3
- package/dist/.setup/{channel.setup-BYIlwbQ7.mjs → channel.setup-BFpQowO3.mjs} +7 -14
- package/dist/.setup/{directory-config-B_by7zrc.mjs → directory-config-BEDZPfDn.mjs} +1 -1
- package/dist/.setup/{directory-live-C48wazJt.mjs → directory-live-FipfeCwt.mjs} +33 -36
- package/dist/.setup/{message-tool-api-CcjLPN3v.mjs → message-tool-api-C7im5ETh.mjs} +2 -2
- package/dist/.setup/{monitor-BuYBDmm7.mjs → monitor-BnN2px0N.mjs} +609 -801
- package/dist/.setup/{outbound-adapter-BZFkK-mw.mjs → outbound-adapter-4HdGq-8r.mjs} +4 -4
- package/dist/.setup/{pipeline.runtime-CIepKmZt.mjs → pipeline.runtime-ByPbC6MN.mjs} +287 -365
- package/dist/.setup/{policy-KKTqEiDv.mjs → policy-BaY9_eh1.mjs} +2 -2
- package/dist/.setup/{probe-BVlJ3dp0.mjs → probe-CyX52GtD.mjs} +54 -61
- package/dist/.setup/{relay-source-CC3h6M7y.mjs → relay-source-CVfH-fBO.mjs} +28 -45
- package/dist/.setup/{replies-DHbuthIR.mjs → replies-WmfwvQxc.mjs} +38 -49
- package/dist/.setup/{reply-blocks-CKnO4BSG.mjs → reply-blocks-rqHQ_3pr.mjs} +87 -138
- package/dist/.setup/{resolve-channels-HR0TgArR.mjs → resolve-channels-B96cgprw.mjs} +17 -41
- package/dist/.setup/{resolve-users-BNYBhF0q.mjs → resolve-users-Xz9aPdns.mjs} +22 -58
- package/dist/.setup/{scopes-DrDbyUH2.mjs → scopes-aMcMHhXk.mjs} +1 -1
- package/dist/.setup/{send-CgPI3Zj8.mjs → send-CLmsR42r.mjs} +157 -284
- package/dist/.setup/{session-status-D46GHwOV.mjs → session-status-CcXe10zN.mjs} +181 -238
- package/dist/.setup/{setup-plugin-api-ZrHs0N4U.mjs → setup-plugin-api-D92P5p51.mjs} +1 -1
- package/dist/.setup/{setup-surface-83lxvE2y.mjs → setup-surface-368jx6Uc.mjs} +6 -6
- package/dist/.setup/{shared-VtmYNj-v.mjs → shared-CtprVh_G.mjs} +5 -5
- package/dist/.setup/{slash-dispatch.runtime-gBj_uaLM.mjs → slash-dispatch.runtime-Dzwj6TPI.mjs} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +12 -12
- package/dist/channel-plugin-api.js +1 -1
- package/dist/configured-state.js +6 -13
- package/dist/directory-contract-api.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +10 -10
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/package.json +4 -4
- package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +1 -1
- package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +9 -17
- package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/package.json +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -17
- package/node_modules/@slack/bolt/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts +1 -1
- package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/block-kit/blocks.d.ts +79 -4
- package/node_modules/@slack/types/dist/block-kit/blocks.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/block-kit/composition-objects.d.ts +17 -0
- package/node_modules/@slack/types/dist/block-kit/composition-objects.d.ts.map +1 -1
- package/node_modules/@slack/types/package.json +1 -1
- package/node_modules/@slack/web-api/dist/methods.d.ts +49 -2
- package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/methods.js +47 -0
- package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/agents.d.ts +186 -0
- package/node_modules/@slack/web-api/dist/types/request/agents.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/index.d.ts +1 -1
- package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.d.ts +9 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.d.ts +10 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.d.ts +29 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.d.ts +18 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.d.ts +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.d.ts +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.d.ts +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.d.ts +10 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.d.ts +15 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/ConversationsInfoResponse.d.ts +31 -0
- package/node_modules/@slack/web-api/dist/types/response/ConversationsInfoResponse.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/response/index.d.ts +9 -0
- package/node_modules/@slack/web-api/dist/types/response/index.d.ts.map +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -17
- package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@slack/web-api/package.json +2 -2
- package/openclaw.plugin.json +0 -3
- package/package.json +6 -14
- package/dist/.setup/account-configured-sUohAxZr.mjs +0 -33
- package/dist/.setup/action-runtime.runtime-CdWL2mLC.mjs +0 -2
- package/dist/control-ui/2f4b1e827be6b68ced2ea0d8b7da8529a4eafbe72be27ee37e1064bdd530ec10/index.js +0 -1
package/dist/.setup/{approval-handler.runtime-BcE_shWc.mjs → approval-handler.runtime-DYrsG2Ox.mjs}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { a as parseSlackTarget } from "./target-parsing-FFE26kOV.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { g as getSlackListenerWriteClient } from "./probe-
|
|
4
|
-
import { s as resolveSlackReplyBlocks } from "./reply-blocks-
|
|
5
|
-
import { t as sendMessageSlack } from "./send-
|
|
6
|
-
import { n as runSlackApprovalMessageUpdate } from "./approval-message-updates-
|
|
2
|
+
import { Ct as shouldHandleSlackNativeApprovalRequest, D as SLACK_EDIT_TEXT_MAX_BYTES, Ft as normalizeSlackApproverId, M as truncateSlackText, N as truncateSlackTextByUtf8Bytes, ht as isSlackAnyNativeApprovalClientEnabled, n as setSlackSessionStatus, ot as SLACK_APPROVAL_HEADER_BLOCK_ID } from "./session-status-CcXe10zN.mjs";
|
|
3
|
+
import { g as getSlackListenerWriteClient } from "./probe-CyX52GtD.mjs";
|
|
4
|
+
import { s as resolveSlackReplyBlocks } from "./reply-blocks-rqHQ_3pr.mjs";
|
|
5
|
+
import { t as sendMessageSlack } from "./send-CLmsR42r.mjs";
|
|
6
|
+
import { n as runSlackApprovalMessageUpdate } from "./approval-message-updates-CwdDew9i.mjs";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
8
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
10
9
|
import { buildApprovalPresentationFromActionDescriptors } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
11
10
|
import { logError } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -24,10 +23,7 @@ function resolveHandlerContext(params) {
|
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
function truncateSlackMrkdwn(text, maxChars) {
|
|
27
|
-
|
|
28
|
-
if (text.length <= limit) return text;
|
|
29
|
-
if (limit <= 1) return truncateUtf16Safe(text, limit);
|
|
30
|
-
return `${truncateUtf16Safe(text, limit - 1)}…`;
|
|
26
|
+
return truncateSlackText(text, Math.max(0, Math.floor(maxChars)), "preserve");
|
|
31
27
|
}
|
|
32
28
|
function buildSlackCodeBlock(text) {
|
|
33
29
|
let fence = "```";
|
|
@@ -40,11 +36,7 @@ function formatSlackApprover(resolvedBy) {
|
|
|
40
36
|
const trimmed = normalizeOptionalString(resolvedBy);
|
|
41
37
|
return trimmed ? trimmed : null;
|
|
42
38
|
}
|
|
43
|
-
function
|
|
44
|
-
return metadata.map(({ label, value }) => `*${label}:* ${value}`);
|
|
45
|
-
}
|
|
46
|
-
function buildSlackMetadataContextElements(metadata) {
|
|
47
|
-
const lines = buildSlackMetadataLines(metadata);
|
|
39
|
+
function buildSlackMetadataContextBlock(lines) {
|
|
48
40
|
const visibleLineCount = lines.length > SLACK_CONTEXT_ELEMENTS_MAX ? 9 : lines.length;
|
|
49
41
|
const elements = lines.slice(0, visibleLineCount).map((line) => ({
|
|
50
42
|
type: "mrkdwn",
|
|
@@ -54,23 +46,20 @@ function buildSlackMetadataContextElements(metadata) {
|
|
|
54
46
|
type: "mrkdwn",
|
|
55
47
|
text: `…+${lines.length - visibleLineCount} more`
|
|
56
48
|
});
|
|
57
|
-
return elements
|
|
58
|
-
}
|
|
59
|
-
function buildSlackMetadataContextBlocks(metadata) {
|
|
60
|
-
const metadataElements = buildSlackMetadataContextElements(metadata);
|
|
61
|
-
return metadataElements.length > 0 ? [{
|
|
49
|
+
return elements.length > 0 ? {
|
|
62
50
|
type: "context",
|
|
63
|
-
elements
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function buildSlackPluginMetadata(view) {
|
|
67
|
-
return [{
|
|
68
|
-
label: "Approval ID",
|
|
69
|
-
value: view.approvalId
|
|
70
|
-
}, ...view.metadata];
|
|
51
|
+
elements
|
|
52
|
+
} : void 0;
|
|
71
53
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
54
|
+
function buildSlackApprovalSection(text, blockId) {
|
|
55
|
+
return {
|
|
56
|
+
type: "section",
|
|
57
|
+
...blockId ? { block_id: blockId } : {},
|
|
58
|
+
text: {
|
|
59
|
+
type: "mrkdwn",
|
|
60
|
+
text
|
|
61
|
+
}
|
|
62
|
+
};
|
|
74
63
|
}
|
|
75
64
|
function buildSlackApprovalPayload(input) {
|
|
76
65
|
const { phase, view } = input;
|
|
@@ -81,7 +70,7 @@ function buildSlackApprovalPayload(input) {
|
|
|
81
70
|
let description;
|
|
82
71
|
if (phase === "pending") {
|
|
83
72
|
heading = `*${approvalName} approval required*`;
|
|
84
|
-
description = view.approvalKind === "plugin" ?
|
|
73
|
+
description = view.approvalKind === "plugin" ? normalizeOptionalString(view.description) ?? "A plugin action needs your approval." : isSystemAgent ? "An OpenClaw change needs your approval." : "A command needs your approval.";
|
|
85
74
|
} else if (phase === "resolved") {
|
|
86
75
|
heading = `*${approvalName} approval: ${formatChannelApprovalResolvedLabel(view)}*`;
|
|
87
76
|
const resolvedBy = formatSlackApprover(view.resolvedBy);
|
|
@@ -90,37 +79,26 @@ function buildSlackApprovalPayload(input) {
|
|
|
90
79
|
heading = `*${approvalName} approval expired*`;
|
|
91
80
|
description = "This approval request expired before it was resolved.";
|
|
92
81
|
}
|
|
93
|
-
const metadata = isPlugin ?
|
|
82
|
+
const metadata = isPlugin ? [{
|
|
83
|
+
label: "Approval ID",
|
|
84
|
+
value: view.approvalId
|
|
85
|
+
}, ...view.metadata] : view.metadata;
|
|
94
86
|
const bodyLabel = isPlugin ? "*Request*" : isSystemAgent ? "*Change*" : "*Command*";
|
|
95
|
-
const bodyText = isPlugin ? view.title :
|
|
96
|
-
const
|
|
87
|
+
const bodyText = isPlugin ? view.title : view.commandText;
|
|
88
|
+
const renderBody = (text) => isPlugin ? text : buildSlackCodeBlock(text);
|
|
89
|
+
const metadataLines = isPlugin || phase === "pending" ? metadata.map(({ label, value }) => `*${label}:* ${value}`) : [];
|
|
97
90
|
const text = [
|
|
98
91
|
heading,
|
|
99
92
|
description,
|
|
100
93
|
"",
|
|
101
94
|
bodyLabel,
|
|
102
|
-
bodyText,
|
|
103
|
-
...
|
|
95
|
+
renderBody(bodyText),
|
|
96
|
+
...metadataLines
|
|
104
97
|
].join("\n");
|
|
105
98
|
const headerDescription = isPlugin && phase === "pending" ? truncateSlackMrkdwn(description, 2600) : description;
|
|
106
|
-
const blocks = [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
...phase === "pending" ? { block_id: SLACK_APPROVAL_HEADER_BLOCK_ID } : {},
|
|
110
|
-
text: {
|
|
111
|
-
type: "mrkdwn",
|
|
112
|
-
text: `${heading}\n${headerDescription}`
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: "section",
|
|
117
|
-
text: {
|
|
118
|
-
type: "mrkdwn",
|
|
119
|
-
text: `${bodyLabel}\n${isPlugin ? truncateSlackMrkdwn(view.title, 2600) : buildSlackCodeBlock(truncateSlackMrkdwn(view.commandText, 2600))}`
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
...includeMetadata ? buildSlackMetadataContextBlocks(metadata) : []
|
|
123
|
-
];
|
|
99
|
+
const blocks = [buildSlackApprovalSection(`${heading}\n${headerDescription}`, phase === "pending" ? SLACK_APPROVAL_HEADER_BLOCK_ID : void 0), buildSlackApprovalSection(`${bodyLabel}\n${renderBody(truncateSlackMrkdwn(bodyText, 2600))}`)];
|
|
100
|
+
const metadataBlock = buildSlackMetadataContextBlock(metadataLines);
|
|
101
|
+
if (metadataBlock) blocks.push(metadataBlock);
|
|
124
102
|
if (phase === "pending") blocks.push(...resolveSlackReplyBlocks({
|
|
125
103
|
text: "",
|
|
126
104
|
presentation: buildApprovalPresentationFromActionDescriptors(view.actions)
|
|
@@ -130,13 +108,17 @@ function buildSlackApprovalPayload(input) {
|
|
|
130
108
|
blocks
|
|
131
109
|
};
|
|
132
110
|
}
|
|
133
|
-
async function updateMessage(
|
|
111
|
+
async function updateMessage(client, accountId, { channelId, messageTs }, { text, blocks }) {
|
|
134
112
|
try {
|
|
135
|
-
await runSlackApprovalMessageUpdate(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
113
|
+
await runSlackApprovalMessageUpdate({
|
|
114
|
+
accountId,
|
|
115
|
+
channelId,
|
|
116
|
+
messageTs
|
|
117
|
+
}, () => client.chat.update({
|
|
118
|
+
channel: channelId,
|
|
119
|
+
ts: messageTs,
|
|
120
|
+
text: truncateSlackTextByUtf8Bytes(text, SLACK_EDIT_TEXT_MAX_BYTES),
|
|
121
|
+
blocks
|
|
140
122
|
}));
|
|
141
123
|
} catch (err) {
|
|
142
124
|
logError(`slack approvals: failed to update message: ${String(err)}`);
|
|
@@ -247,14 +229,7 @@ const slackApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
|
|
|
247
229
|
});
|
|
248
230
|
if (!resolved) return;
|
|
249
231
|
const client = resolveApprovalClient(resolved.context, entry.teamId);
|
|
250
|
-
await updateMessage(
|
|
251
|
-
client,
|
|
252
|
-
accountId: resolved.accountId,
|
|
253
|
-
channelId: entry.channelId,
|
|
254
|
-
messageTs: entry.messageTs,
|
|
255
|
-
text: payload.text,
|
|
256
|
-
blocks: payload.blocks
|
|
257
|
-
});
|
|
232
|
+
await updateMessage(client, resolved.accountId, entry, payload);
|
|
258
233
|
await setSlackSessionStatus({
|
|
259
234
|
client,
|
|
260
235
|
channelId: entry.channelId,
|
|
@@ -273,8 +248,7 @@ function resolveApprovalClient(context, teamId) {
|
|
|
273
248
|
if (!context.workspaceTeamId || context.workspaceTeamId.toUpperCase() !== teamId.toUpperCase()) throw new Error("Slack approval workspace does not match the authenticated installation");
|
|
274
249
|
return context.app.client;
|
|
275
250
|
}
|
|
276
|
-
|
|
277
|
-
const client = context.resolveClient(teamId);
|
|
251
|
+
const client = context.resolveClient?.(teamId);
|
|
278
252
|
if (!client) throw new Error("Slack Enterprise Grid approval client is unavailable");
|
|
279
253
|
return client;
|
|
280
254
|
}
|
package/dist/.setup/{approval-message-updates-EgKGmFXx.mjs → approval-message-updates-CwdDew9i.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as isSlackApprovalActionId, st as decodeSlackApprovalAction } from "./session-status-CcXe10zN.mjs";
|
|
2
2
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
4
4
|
//#region extensions/slack/src/approval-message-updates.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as resolveSlackAccountAllowFrom, d as resolveSlackOperationToken, f as resolveSlackReplyToMode, i as listSlackAccountIds, n as hasImplicitDefaultSlackAccount, o as resolveDefaultSlackAccountId, s as resolveSlackAccount } from "./accounts-
|
|
1
|
+
import { r as isSlackPluginAccountConfigured } from "./account-configured-zcR9TJJN.mjs";
|
|
2
|
+
import { c as resolveSlackAccountAllowFrom, d as resolveSlackOperationToken, f as resolveSlackReplyToMode, i as listSlackAccountIds, n as hasImplicitDefaultSlackAccount, o as resolveDefaultSlackAccountId, s as resolveSlackAccount } from "./accounts-BMg9YLIv.mjs";
|
|
3
3
|
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, n as formatSlackTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId, t as canonicalizeSlackApiTargetId } from "./target-parsing-FFE26kOV.mjs";
|
|
4
4
|
import { t as slackContextTargetsMatch } from "./targets-C6LZQL1Q.mjs";
|
|
5
|
-
import { A as
|
|
6
|
-
import { _ as getSlackWriteClient, c as collectSlackCursorPages, o as formatSlackError, u as createSlackLookupClient } from "./probe-
|
|
7
|
-
import { c as resolveSlackReplyDeliveryMessages,
|
|
5
|
+
import { A as SLACK_TEXT_LIMIT, At as isSlackWorkspaceInstallation, Bt as resolveSlackAutoThreadId, Ct as shouldHandleSlackNativeApprovalRequest, D as SLACK_EDIT_TEXT_MAX_BYTES, Dt as isSlackPluginApprovalAuthorizedSender, Et as getSlackApprovalApproversForTeam, It as resolveSlackExecApprovalTarget, Lt as shouldSuppressLocalSlackExecApprovalPrompt, Mt as getSlackExecApprovalApprovers, Nt as isSlackExecApprovalAuthorizedSender, Ot as resolveSlackApprovalTeamId, Pt as isSlackExecApprovalClientEnabled, Rt as resolvePluginApprovalSlackApprovers, St as resolveTurnSourceSlackOriginTarget, Tt as slackTargetsMatch, X as normalizeSlackOutboundText, _t as normalizeSlackForwardTarget, a as resolveSlackGroupRequireMention, bt as resolveSlackApproverDmTargets, c as qualifySlackRoutePeerId, d as resolveSlackConversationBindingRoute, f as assertSlackDetachedTargetAllowed, gt as isSlackPluginApprovalRequest, ht as isSlackAnyNativeApprovalClientEnabled, it as renderSlackMessagePresentationFallbackText, j as countSlackTextUtf8Bytes, kt as getSlackInstallationKind, n as setSlackSessionStatus, o as resolveSlackGroupToolPolicy, s as qualifySlackConversationId, u as normalizeSlackRouteBindingConfig, ut as SLACK_PRESENTATION_CAPABILITIES, vt as normalizeSlackOriginTarget, wt as shouldHandleSlackPluginViaForwardingSession, xt as resolveSlackFallbackOriginTarget, yt as resolveSessionSlackOriginTarget } from "./session-status-CcXe10zN.mjs";
|
|
6
|
+
import { _ as getSlackWriteClient, c as collectSlackCursorPages, o as formatSlackError, u as createSlackLookupClient } from "./probe-CyX52GtD.mjs";
|
|
7
|
+
import { c as resolveSlackReplyDeliveryMessages, o as resolveSlackReplyBlockResolution, p as buildSlackPresentationBlocksIfComplete, r as normalizeSlackReplyPayload, s as resolveSlackReplyBlocks } from "./reply-blocks-rqHQ_3pr.mjs";
|
|
8
8
|
import { n as resolveSlackReplyThreadTs, r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-Cvt7WD6B.mjs";
|
|
9
|
-
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-
|
|
10
|
-
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-
|
|
9
|
+
import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-C7im5ETh.mjs";
|
|
10
|
+
import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-NjX2SwvS.mjs";
|
|
11
11
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.mjs";
|
|
12
|
-
import { n as slackPluginBase, r as slackSecurityAdapter, t as slackConfigAdapter } from "./shared-
|
|
13
|
-
import { i as SLACK_CHANNEL } from "./channel.setup-
|
|
12
|
+
import { n as slackPluginBase, r as slackSecurityAdapter, t as slackConfigAdapter } from "./shared-CtprVh_G.mjs";
|
|
13
|
+
import { i as SLACK_CHANNEL } from "./channel.setup-BFpQowO3.mjs";
|
|
14
14
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
15
|
import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-resolution";
|
|
16
16
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -99,7 +99,7 @@ const baseSlackApprovalCapability = createApproverRestrictedNativeApprovalCapabi
|
|
|
99
99
|
],
|
|
100
100
|
isConfigured: isSlackAnyNativeApprovalClientEnabled,
|
|
101
101
|
shouldHandle: shouldHandleSlackNativeApprovalRequest,
|
|
102
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
102
|
+
load: async () => (await import("./approval-handler.runtime-DYrsG2Ox.mjs")).slackApprovalNativeRuntime
|
|
103
103
|
})
|
|
104
104
|
});
|
|
105
105
|
const baseSlackNativeAdapter = baseSlackApprovalCapability.native;
|
|
@@ -143,16 +143,10 @@ const slackApprovalCapability = {
|
|
|
143
143
|
...baseSlackNativeAdapter,
|
|
144
144
|
describeDeliveryCapabilities: (params) => {
|
|
145
145
|
const capabilities = baseSlackNativeAdapter.describeDeliveryCapabilities(params);
|
|
146
|
-
const request = params
|
|
147
|
-
const approvalKind = params.approvalKind;
|
|
146
|
+
const { request, approvalKind } = params;
|
|
148
147
|
const described = {
|
|
149
148
|
...capabilities,
|
|
150
|
-
enabled: shouldHandleSlackNativeApprovalRequest(
|
|
151
|
-
cfg: params.cfg,
|
|
152
|
-
accountId: params.accountId,
|
|
153
|
-
approvalKind,
|
|
154
|
-
request
|
|
155
|
-
})
|
|
149
|
+
enabled: shouldHandleSlackNativeApprovalRequest(params)
|
|
156
150
|
};
|
|
157
151
|
if (approvalKind !== "plugin" || !isSlackPluginApprovalRequest(request)) return described;
|
|
158
152
|
if (resolvePluginApprovalSlackApprovers(params.cfg, request) !== void 0) return {
|
|
@@ -160,22 +154,13 @@ const slackApprovalCapability = {
|
|
|
160
154
|
preferredSurface: "approver-dm",
|
|
161
155
|
supportsApproverDmSurface: true
|
|
162
156
|
};
|
|
163
|
-
if (!shouldHandleSlackPluginViaForwardingSession(
|
|
164
|
-
cfg: params.cfg,
|
|
165
|
-
accountId: params.accountId,
|
|
166
|
-
request
|
|
167
|
-
})) return described;
|
|
157
|
+
if (!shouldHandleSlackPluginViaForwardingSession(params)) return described;
|
|
168
158
|
return {
|
|
169
159
|
...described,
|
|
170
160
|
preferredSurface: "origin",
|
|
171
161
|
supportsApproverDmSurface: getSlackApprovalApproversForTeam({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
teamId: resolveSlackApprovalTeamId({
|
|
175
|
-
cfg: params.cfg,
|
|
176
|
-
accountId: params.accountId,
|
|
177
|
-
request
|
|
178
|
-
}),
|
|
162
|
+
...params,
|
|
163
|
+
teamId: resolveSlackApprovalTeamId(params),
|
|
179
164
|
request
|
|
180
165
|
}).length > 0
|
|
181
166
|
};
|
|
@@ -194,23 +179,23 @@ const SLACK_MESSAGE_ACTIONS = /* @__PURE__ */ new Map([
|
|
|
194
179
|
function readSlackForceDocument(params) {
|
|
195
180
|
return readBooleanParam(params, "forceDocument") ?? readBooleanParam(params, "asDocument") ?? false;
|
|
196
181
|
}
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
text: content,
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function renderSlackActionPresentation(presentation) {
|
|
204
|
-
if (!presentation) return { usesPresentationTextFallback: false };
|
|
205
|
-
const renderedBlocks = !presentation.blocks.some((block) => (block.type === "text" || block.type === "context") && block.text.trim().length > 3e3) && canRenderSlackPresentation(presentation) ? buildSlackPresentationBlocks(presentation) : void 0;
|
|
182
|
+
function renderSlackActionPresentation(content, presentation) {
|
|
183
|
+
if (!presentation) return {
|
|
184
|
+
text: content ?? "",
|
|
185
|
+
usesPresentationTextFallback: false
|
|
186
|
+
};
|
|
187
|
+
const renderedBlocks = presentation.blocks.some((block) => (block.type === "text" || block.type === "context") && block.text.trim().length > 3e3) ? void 0 : buildSlackPresentationBlocksIfComplete(presentation);
|
|
206
188
|
const usesPresentationTextFallback = !renderedBlocks || renderedBlocks.length > 50;
|
|
207
189
|
const blocks = usesPresentationTextFallback ? void 0 : renderedBlocks;
|
|
208
190
|
return {
|
|
209
191
|
...blocks?.length ? { blocks } : {},
|
|
192
|
+
text: usesPresentationTextFallback || presentation.blocks.some((block) => block.type === "chart" || block.type === "table") ? renderSlackMessagePresentationFallbackText({
|
|
193
|
+
text: content,
|
|
194
|
+
presentation
|
|
195
|
+
}) : content ?? "",
|
|
210
196
|
usesPresentationTextFallback
|
|
211
197
|
};
|
|
212
198
|
}
|
|
213
|
-
/** Translate generic channel action requests into Slack-specific tool invocations and payload shapes. */
|
|
214
199
|
async function handleSlackMessageAction(params) {
|
|
215
200
|
const { providerId, ctx, invoke } = params;
|
|
216
201
|
const { action, cfg, params: actionParams } = ctx;
|
|
@@ -316,23 +301,13 @@ async function handleSlackMessageAction(params) {
|
|
|
316
301
|
});
|
|
317
302
|
if (action === "edit") {
|
|
318
303
|
const messageId = readStringParam$1(actionParams, "messageId", { required: true });
|
|
319
|
-
const
|
|
320
|
-
const presentation = normalizeMessagePresentation(actionParams.presentation);
|
|
321
|
-
const renderedPresentation = renderSlackActionPresentation(presentation);
|
|
322
|
-
const blocks = renderedPresentation.blocks;
|
|
323
|
-
const accessibleContent = renderedPresentation.usesPresentationTextFallback ? renderSlackMessagePresentationFallbackText({
|
|
324
|
-
text: content,
|
|
325
|
-
presentation
|
|
326
|
-
}) : resolveSlackPresentationText(content, presentation);
|
|
304
|
+
const { blocks, text: accessibleContent, usesPresentationTextFallback } = renderSlackActionPresentation(readStringParam$1(actionParams, "message", { allowEmpty: true }), normalizeMessagePresentation(actionParams.presentation));
|
|
327
305
|
const tableMode = resolveMarkdownTableMode({
|
|
328
306
|
cfg,
|
|
329
307
|
channel: "slack",
|
|
330
308
|
accountId: accountId ?? resolveDefaultSlackAccountId(cfg)
|
|
331
309
|
});
|
|
332
|
-
if (!blocks && countSlackTextUtf8Bytes(normalizeSlackOutboundText(accessibleContent, { tableMode })) > 4e3) {
|
|
333
|
-
const editSubject = renderedPresentation.usesPresentationTextFallback ? "Slack presentation fallback" : "Slack edit";
|
|
334
|
-
throw new Error(`${editSubject} exceeds the ${String(SLACK_EDIT_TEXT_MAX_BYTES)}-byte edit limit. Send a new message instead.`);
|
|
335
|
-
}
|
|
310
|
+
if (!blocks && countSlackTextUtf8Bytes(normalizeSlackOutboundText(accessibleContent, { tableMode })) > 4e3) throw new Error(`${usesPresentationTextFallback ? "Slack presentation fallback" : "Slack edit"} exceeds the ${String(SLACK_EDIT_TEXT_MAX_BYTES)}-byte edit limit. Send a new message instead.`);
|
|
336
311
|
if (!accessibleContent && !blocks) throw new Error("Slack edit requires message or blocks.");
|
|
337
312
|
return await invokeSlackAction({
|
|
338
313
|
action: "editMessage",
|
|
@@ -403,7 +378,7 @@ const SLACK_TOOL_DELIVERY_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
403
378
|
"unpinMessage",
|
|
404
379
|
"uploadFile"
|
|
405
380
|
]);
|
|
406
|
-
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
381
|
+
const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-C5xceJoS.mjs"));
|
|
407
382
|
function resolveSlackActionContext(ctx, toolContext) {
|
|
408
383
|
if (!toolContext && !ctx.mediaAccess && !ctx.mediaLocalRoots && !ctx.mediaReadFile && !ctx.conversationReadOrigin && !ctx.requesterAccountId && !ctx.requesterSenderId && !ctx.assertDirectAdapterHandoff) return;
|
|
409
384
|
return {
|
|
@@ -457,24 +432,49 @@ function shouldUseWorkspaceAwareSlackActionSend(rawTarget, context) {
|
|
|
457
432
|
//#endregion
|
|
458
433
|
//#region extensions/slack/src/conversation-route-owner.ts
|
|
459
434
|
function inspectSlackConversationRouteOwner(params) {
|
|
435
|
+
const prepared = prepareSlackConversationRouteOwner(params);
|
|
436
|
+
return prepared.kind === "prepared" ? prepared.resolve() : prepared.owner;
|
|
437
|
+
}
|
|
438
|
+
function prepareSlackConversationRouteOwner(params) {
|
|
460
439
|
const accountId = normalizeAccountId(params.accountId);
|
|
461
440
|
const accountConfig = resolveAccountEntry(params.cfg.channels?.slack?.accounts, accountId);
|
|
462
|
-
if (params.cfg.channels?.slack?.enabled === false || accountConfig?.enabled === false || !accountConfig && (accountId !== DEFAULT_ACCOUNT_ID || !hasImplicitDefaultSlackAccount(params.cfg))) return
|
|
441
|
+
if (params.cfg.channels?.slack?.enabled === false || accountConfig?.enabled === false || !accountConfig && (accountId !== DEFAULT_ACCOUNT_ID || !hasImplicitDefaultSlackAccount(params.cfg))) return {
|
|
442
|
+
kind: "terminal",
|
|
443
|
+
owner: null
|
|
444
|
+
};
|
|
463
445
|
const installationKind = getSlackInstallationKind(accountId);
|
|
464
446
|
const direct = params.conversation.kind === "direct";
|
|
465
447
|
const target = parseSlackTarget(params.conversation.peerId, { defaultKind: direct ? "user" : "channel" });
|
|
466
|
-
if (!target || target.kind !== (direct ? "user" : "channel")) return
|
|
448
|
+
if (!target || target.kind !== (direct ? "user" : "channel")) return {
|
|
449
|
+
kind: "terminal",
|
|
450
|
+
owner: null
|
|
451
|
+
};
|
|
467
452
|
const targetIsEnterprise = Boolean(target.teamId);
|
|
468
|
-
if (!targetIsEnterprise && (installationKind === "degraded" || !installationKind)) return {
|
|
469
|
-
|
|
453
|
+
if (!targetIsEnterprise && (installationKind === "degraded" || !installationKind)) return {
|
|
454
|
+
kind: "terminal",
|
|
455
|
+
owner: { kind: "unavailable" }
|
|
456
|
+
};
|
|
457
|
+
if (targetIsEnterprise && installationKind === "workspace") return {
|
|
458
|
+
kind: "terminal",
|
|
459
|
+
owner: null
|
|
460
|
+
};
|
|
470
461
|
const contextTeamId = params.conversation.context?.teamId?.trim();
|
|
471
|
-
if (contextTeamId && target.teamId && contextTeamId.toLowerCase() !== target.teamId.toLowerCase()) return
|
|
462
|
+
if (contextTeamId && target.teamId && contextTeamId.toLowerCase() !== target.teamId.toLowerCase()) return {
|
|
463
|
+
kind: "terminal",
|
|
464
|
+
owner: null
|
|
465
|
+
};
|
|
472
466
|
const teamId = contextTeamId ?? target.teamId;
|
|
473
|
-
if (!direct && params.conversation.nativeChannelId && params.conversation.nativeChannelId.toLowerCase() !== target.id.toLowerCase()) return
|
|
467
|
+
if (!direct && params.conversation.nativeChannelId && params.conversation.nativeChannelId.toLowerCase() !== target.id.toLowerCase()) return {
|
|
468
|
+
kind: "terminal",
|
|
469
|
+
owner: null
|
|
470
|
+
};
|
|
474
471
|
const enterpriseRoute = installationKind === "enterprise" || targetIsEnterprise;
|
|
475
|
-
if (enterpriseRoute && !teamId) return
|
|
472
|
+
if (enterpriseRoute && !teamId) return {
|
|
473
|
+
kind: "terminal",
|
|
474
|
+
owner: null
|
|
475
|
+
};
|
|
476
476
|
const enterpriseScope = enterpriseRoute && teamId ? { teamId } : void 0;
|
|
477
|
-
const
|
|
477
|
+
const resolveRoute = ({ boundAgentId, bindingOwnerAvailable }) => resolveAgentRoute({
|
|
478
478
|
cfg: boundAgentId || !bindingOwnerAvailable ? { session: params.cfg.session } : normalizeSlackRouteBindingConfig(params.cfg),
|
|
479
479
|
defaultAgentId: boundAgentId,
|
|
480
480
|
channel: "slack",
|
|
@@ -490,26 +490,71 @@ function inspectSlackConversationRouteOwner(params) {
|
|
|
490
490
|
}
|
|
491
491
|
});
|
|
492
492
|
const baseConversationId = qualifySlackConversationId(direct ? `user:${target.id}` : target.id, enterpriseScope);
|
|
493
|
-
const
|
|
493
|
+
const route = {
|
|
494
494
|
cfg: params.cfg,
|
|
495
|
-
resolveRoute
|
|
495
|
+
resolveRoute,
|
|
496
496
|
accountId,
|
|
497
497
|
baseConversationId,
|
|
498
498
|
runtimeBindingThreadId: params.conversation.threadId,
|
|
499
499
|
bindingsEnabled: !enterpriseRoute,
|
|
500
500
|
touchBinding: false
|
|
501
|
-
});
|
|
502
|
-
if (!bindingRoute.runtimeRoute.bindingOwnerAvailable) return { kind: "unavailable" };
|
|
503
|
-
if (bindingRoute.runtimeRoute.pluginId) return {
|
|
504
|
-
kind: "plugin",
|
|
505
|
-
pluginId: bindingRoute.runtimeRoute.pluginId,
|
|
506
|
-
fallbackAgentId: bindingRoute.route.agentId
|
|
507
501
|
};
|
|
508
502
|
return {
|
|
509
|
-
kind: "
|
|
510
|
-
|
|
503
|
+
kind: "prepared",
|
|
504
|
+
route,
|
|
505
|
+
resolve(inspections) {
|
|
506
|
+
const bindingRoute = resolveSlackConversationBindingRoute({
|
|
507
|
+
...route,
|
|
508
|
+
inspections
|
|
509
|
+
});
|
|
510
|
+
if (!bindingRoute.runtimeRoute.bindingOwnerAvailable) return { kind: "unavailable" };
|
|
511
|
+
if (bindingRoute.runtimeRoute.pluginId) return {
|
|
512
|
+
kind: "plugin",
|
|
513
|
+
pluginId: bindingRoute.runtimeRoute.pluginId,
|
|
514
|
+
fallbackAgentId: bindingRoute.route.agentId
|
|
515
|
+
};
|
|
516
|
+
return {
|
|
517
|
+
kind: "agent",
|
|
518
|
+
agentId: bindingRoute.runtimeRoute.boundAgentId ?? bindingRoute.configuredRoute?.boundAgentId ?? bindingRoute.route.agentId
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function prepareSlackConversationRouteOwners(inputs, inspectBindings) {
|
|
524
|
+
const prepared = inputs.map(prepareSlackConversationRouteOwner);
|
|
525
|
+
const inspections = inspectBindings(prepared.flatMap((item) => item.kind === "prepared" && item.route.bindingsEnabled ? [{
|
|
526
|
+
channel: "slack",
|
|
527
|
+
accountId: item.route.accountId,
|
|
528
|
+
conversationId: item.route.baseConversationId
|
|
529
|
+
}, ...item.route.runtimeBindingThreadId ? [{
|
|
530
|
+
channel: "slack",
|
|
531
|
+
accountId: item.route.accountId,
|
|
532
|
+
conversationId: item.route.runtimeBindingThreadId,
|
|
533
|
+
parentConversationId: item.route.baseConversationId
|
|
534
|
+
}] : []] : []));
|
|
535
|
+
let index = 0;
|
|
536
|
+
const nextInspection = () => {
|
|
537
|
+
const inspection = inspections[index++];
|
|
538
|
+
if (!inspection) throw new Error("Slack binding owner returned an incomplete selection");
|
|
539
|
+
return inspection;
|
|
511
540
|
};
|
|
541
|
+
return prepared.map((item) => {
|
|
542
|
+
if (item.kind === "terminal") return () => item.owner;
|
|
543
|
+
const base = item.route.bindingsEnabled ? nextInspection() : {
|
|
544
|
+
status: "available",
|
|
545
|
+
binding: null
|
|
546
|
+
};
|
|
547
|
+
const thread = item.route.bindingsEnabled && item.route.runtimeBindingThreadId ? nextInspection() : base;
|
|
548
|
+
return () => item.resolve({
|
|
549
|
+
base,
|
|
550
|
+
thread
|
|
551
|
+
});
|
|
552
|
+
});
|
|
512
553
|
}
|
|
554
|
+
const slackConversationRouteOwners = {
|
|
555
|
+
resolveConversationRouteOwner: inspectSlackConversationRouteOwner,
|
|
556
|
+
prepareConversationRouteOwners: prepareSlackConversationRouteOwners
|
|
557
|
+
};
|
|
513
558
|
//#endregion
|
|
514
559
|
//#region extensions/slack/src/enterprise-user-route.ts
|
|
515
560
|
/** Resolve a workspace for a detached Enterprise DM without opening a conversation. */
|
|
@@ -571,20 +616,20 @@ function buildSlackThreadingToolContext(params) {
|
|
|
571
616
|
//#region extensions/slack/src/channel.ts
|
|
572
617
|
const loadExtensionSharedSdk = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/extension-shared"));
|
|
573
618
|
const loadTargetResolverRuntimeSdk = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/target-resolver-runtime"));
|
|
574
|
-
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-
|
|
575
|
-
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-
|
|
619
|
+
const loadSlackScopesModule = createLazyRuntimeModule(() => import("./scopes-aMcMHhXk.mjs"));
|
|
620
|
+
const loadSlackOutboundAdapterModule = createLazyRuntimeModule(() => import("./outbound-adapter-4HdGq-8r.mjs"));
|
|
576
621
|
const bindSlackOutbound = createLazyRuntimeMethodBinder(loadSlackOutboundAdapterModule);
|
|
577
622
|
async function resolveSlackHandleAction() {
|
|
578
623
|
return getOptionalSlackRuntime()?.channel?.slack?.handleSlackAction ?? (await loadSlackActionRuntime()).handleSlackAction;
|
|
579
624
|
}
|
|
580
|
-
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
581
|
-
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-
|
|
582
|
-
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
583
|
-
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-
|
|
584
|
-
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
585
|
-
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
586
|
-
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
587
|
-
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
625
|
+
const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-BEDZPfDn.mjs").then((n) => n.t));
|
|
626
|
+
const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-B96cgprw.mjs").then((n) => n.n));
|
|
627
|
+
const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-Xz9aPdns.mjs").then((n) => n.n));
|
|
628
|
+
const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-C5xceJoS.mjs"));
|
|
629
|
+
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send-CLmsR42r.mjs").then((n) => n.n));
|
|
630
|
+
const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-CyX52GtD.mjs").then((n) => n.n));
|
|
631
|
+
const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-BnN2px0N.mjs").then((n) => n.t));
|
|
632
|
+
const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-FipfeCwt.mjs").then((n) => n.t));
|
|
588
633
|
async function setSlackHeartbeatThreadStatus(params) {
|
|
589
634
|
const threadTs = resolveSlackThreadTsValue({ threadId: params.threadId });
|
|
590
635
|
const target = parseSlackTarget(params.to, { defaultKind: "channel" });
|
|
@@ -854,7 +899,7 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
854
899
|
},
|
|
855
900
|
conversationBindings: { isCurrentConversationBindingSupported: ({ accountId }) => isSlackWorkspaceInstallation(accountId) },
|
|
856
901
|
messaging: {
|
|
857
|
-
|
|
902
|
+
...slackConversationRouteOwners,
|
|
858
903
|
targetPrefixes: ["slack"],
|
|
859
904
|
directTargetStyle: "user-prefixed",
|
|
860
905
|
targetIdComparison: "lowercase",
|
|
@@ -916,25 +961,21 @@ const slackPlugin = createChatChannelPlugin({
|
|
|
916
961
|
accountId
|
|
917
962
|
});
|
|
918
963
|
const { resolveTargetsWithOptionalToken } = await loadTargetResolverRuntimeSdk();
|
|
919
|
-
if (kind === "group") return resolveTargetsWithOptionalToken({
|
|
920
|
-
token: normalizeOptionalString(account.userToken) ?? normalizeOptionalString(account.botToken),
|
|
921
|
-
inputs,
|
|
922
|
-
missingTokenNote: "missing Slack token",
|
|
923
|
-
resolveWithToken: async ({ token, inputs: inputsValue }) => (await loadSlackResolveChannelsModule()).resolveSlackChannelAllowlist({
|
|
924
|
-
token,
|
|
925
|
-
entries: inputsValue
|
|
926
|
-
}),
|
|
927
|
-
mapResolved: (entry) => toResolvedTarget(entry, entry.archived ? "archived" : void 0)
|
|
928
|
-
});
|
|
929
964
|
return resolveTargetsWithOptionalToken({
|
|
930
965
|
token: normalizeOptionalString(account.userToken) ?? normalizeOptionalString(account.botToken),
|
|
931
966
|
inputs,
|
|
932
967
|
missingTokenNote: "missing Slack token",
|
|
933
|
-
resolveWithToken: async ({ token, inputs:
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
968
|
+
resolveWithToken: async ({ token, inputs: entries }) => {
|
|
969
|
+
if (kind === "group") return (await (await loadSlackResolveChannelsModule()).resolveSlackChannelAllowlist({
|
|
970
|
+
token,
|
|
971
|
+
entries
|
|
972
|
+
})).map((entry) => toResolvedTarget(entry, entry.archived ? "archived" : void 0));
|
|
973
|
+
return (await (await loadSlackResolveUsersModule()).resolveSlackUserAllowlist({
|
|
974
|
+
token,
|
|
975
|
+
entries
|
|
976
|
+
})).map((entry) => toResolvedTarget(entry, entry.note));
|
|
977
|
+
},
|
|
978
|
+
mapResolved: (entry) => entry
|
|
938
979
|
});
|
|
939
980
|
} },
|
|
940
981
|
actions: createSlackActions(SLACK_CHANNEL, { invoke: async (action, cfg, toolContext) => await (await resolveSlackHandleAction())(action, cfg, toolContext) }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-
|
|
3
|
-
import { f as assertSlackDetachedTargetAllowed } from "./session-status-
|
|
4
|
-
import { d as createSlackReadClient, m as createSlackWebClient,
|
|
2
|
+
import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-BMg9YLIv.mjs";
|
|
3
|
+
import { f as assertSlackDetachedTargetAllowed } from "./session-status-CcXe10zN.mjs";
|
|
4
|
+
import { d as createSlackReadClient, m as createSlackWebClient, y as readLruMapEntry } from "./probe-CyX52GtD.mjs";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
7
7
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as listSlackAccountIds, o as resolveDefaultSlackAccountId, s as resolveSlackAccount, u as resolveSlackConfigAccessorAccount } from "./accounts-
|
|
3
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
1
|
+
import { i as isSlackSetupAccountConfigured } from "./account-configured-zcR9TJJN.mjs";
|
|
2
|
+
import { i as listSlackAccountIds, o as resolveDefaultSlackAccountId, s as resolveSlackAccount, u as resolveSlackConfigAccessorAccount } from "./accounts-BMg9YLIv.mjs";
|
|
3
|
+
import { t as inspectSlackAccount } from "./account-inspect-D58VVDjk.mjs";
|
|
4
4
|
import { t as DEFAULT_SLACK_SUGGESTED_PROMPTS } from "./channel-meta-C443t-lI.mjs";
|
|
5
5
|
import { t as SlackChannelConfigSchema } from "./config-schema-BH0K9-Um.mjs";
|
|
6
6
|
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
@@ -241,11 +241,6 @@ function createSlackTokenCredential(params) {
|
|
|
241
241
|
shouldPrompt: params.shouldPrompt
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
function hasSlackSetupCredentials(params) {
|
|
245
|
-
const identityToken = params.identity === "user" ? params.input.userToken : params.input.botToken;
|
|
246
|
-
const transportCredential = params.mode === "http" ? params.input.signingSecret : params.input.appToken;
|
|
247
|
-
return Boolean(identityToken && transportCredential);
|
|
248
|
-
}
|
|
249
244
|
const slackSetupAdapterBase = createPatchedAccountSetupAdapter({
|
|
250
245
|
channelKey: SLACK_CHANNEL,
|
|
251
246
|
validateInput: ({ cfg, accountId, input }) => {
|
|
@@ -264,11 +259,9 @@ const slackSetupAdapterBase = createPatchedAccountSetupAdapter({
|
|
|
264
259
|
if (mode === "http" && !normalizeOptionalString(setupInput.signingSecret) && account.signingSecretStatus === "missing") return "Slack HTTP mode requires a configured signing secret when using --use-env.";
|
|
265
260
|
return null;
|
|
266
261
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
mode
|
|
271
|
-
})) return null;
|
|
262
|
+
const identityToken = identity === "user" ? setupInput.userToken : setupInput.botToken;
|
|
263
|
+
const transportCredential = mode === "http" ? setupInput.signingSecret : setupInput.appToken;
|
|
264
|
+
if (identityToken && transportCredential) return null;
|
|
272
265
|
if (identity === "user") return mode === "http" ? "Slack user identity requires --user-token and --signing-secret." : "Slack user identity requires --user-token and --app-token.";
|
|
273
266
|
return mode === "http" ? "Slack HTTP mode requires --bot-token and --signing-secret (or --use-env)." : "Slack requires --bot-token and --app-token (or --use-env).";
|
|
274
267
|
},
|
|
@@ -557,7 +550,7 @@ const slackSetupPlugin = {
|
|
|
557
550
|
markdownCapable: true,
|
|
558
551
|
preferSessionLookupForAnnounceTarget: true
|
|
559
552
|
},
|
|
560
|
-
setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface-
|
|
553
|
+
setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface-368jx6Uc.mjs")),
|
|
561
554
|
capabilities: {
|
|
562
555
|
chatTypes: [
|
|
563
556
|
"direct",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, o as resolveDefaultSlackAccountId } from "./accounts-
|
|
2
|
+
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, o as resolveDefaultSlackAccountId } from "./accounts-BMg9YLIv.mjs";
|
|
3
3
|
import { a as parseSlackTarget } from "./target-parsing-FFE26kOV.mjs";
|
|
4
4
|
import "./targets-C6LZQL1Q.mjs";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|