@openclaw/slack 2026.7.2-beta.2 → 2026.7.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-configured-DzC407uv.js → account-configured-BwfXBo_F.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{account-inspect-Di7ditqZ.js → account-inspect-jn1xLaVi.js} +9 -2
- package/dist/account-reply-mode-DrUXogvO.js +14 -0
- package/dist/{accounts-BOJJiHSr.js → accounts-BSr252c_.js} +13 -25
- package/dist/accounts.runtime-CjULMLTa.js +2 -0
- package/dist/{action-runtime-Cee2ih0s.js → action-runtime-CFU52n4W.js} +11 -17
- package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
- package/dist/{actions-BZiuSTIq.js → actions-D51foiwR.js} +5 -5
- package/dist/{actions.runtime-DoD0-gxw.js → actions.runtime-BMJwtf5C.js} +1 -1
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-CUPtIM4k.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
- package/dist/{channel-DaIiGUOp.js → channel-Ds8NKvfr.js} +75 -41
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-Cfm6_6n1.js → channel-type-DXkUajFP.js} +3 -3
- package/dist/{channel.setup-C-mLz50O.js → channel.setup-DOSTEDfA.js} +8 -5
- package/dist/{config-schema-xPSnK2VK.js → config-schema-B4j4tCOI.js} +236 -30
- package/dist/{directory-config-DRkFujwG.js → directory-config-B08pm5ZT.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-D_yZhjgp.js → directory-live-DpPKzPrn.js} +2 -2
- package/dist/doctor-contract-U6oVntbM.js +173 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-85UWiriS.js → group-policy-CdnQzQBI.js} +98 -125
- package/dist/{interactive-replies-BilWUdcI.js → interactive-replies-C3ffk6oN.js} +1 -1
- package/dist/interactive-replies-api.js +1 -1
- package/dist/{message-tool-api-CA9jZrCY.js → message-tool-api-ByVyIVOh.js} +3 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CalGciTs.js → monitor-CnB_WKvF.js} +3 -3
- package/dist/{outbound-adapter-BiLKcnyH.js → outbound-adapter-DuPz2HHt.js} +49 -5
- package/dist/{pipeline.runtime-DofAvTtb.js → pipeline.runtime-5rRYZuX5.js} +490 -345
- package/dist/{policy-BVs4LiSa.js → policy-C31RYSuT.js} +1 -1
- package/dist/probe-CVRuArHA.js +340 -0
- package/dist/{provider-CmeoUiIM.js → provider-htuIJGFD.js} +791 -359
- package/dist/{relay-source-DMmgtvg4.js → relay-source-Df9EaiTF.js} +6 -11
- package/dist/{replies-CJJCp6qz.js → replies-Cgr2Gli4.js} +3 -3
- package/dist/{resolve-channels-Rfts6POK.js → resolve-channels-DodP2TFx.js} +1 -1
- package/dist/{resolve-users-y6wAxR8E.js → resolve-users-M9eF8891.js} +1 -1
- package/dist/{runtime-api-BGDyOt1D.js → runtime-api-D5XYMMsf.js} +3 -2
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-CuxNQZ6v.js → scopes-CJRpHkDC.js} +1 -2
- package/dist/{secret-contract-CMohXFWS.js → secret-contract-DxmvbxBF.js} +1 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DYp8ca-l.js → send-BZ1tPv7-.js} +28 -11
- package/dist/send.runtime-a2pilFor.js +2 -0
- package/dist/setup-core-tPxMuFez.js +600 -0
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-oSd3NX9J.js → setup-surface-wV-S1dE_.js} +58 -32
- package/dist/{shared-D9yz5Otg.js → shared-BfMskaMx.js} +57 -10
- package/dist/{slash-dispatch.runtime-CSja9VuD.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +197 -1
- package/node_modules/axios/README.md +424 -256
- package/node_modules/axios/dist/axios.js +589 -204
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +630 -185
- package/node_modules/axios/dist/esm/axios.js +630 -185
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +949 -301
- package/node_modules/axios/index.d.cts +28 -5
- package/node_modules/axios/index.d.ts +24 -3
- package/node_modules/axios/lib/adapters/adapters.js +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +223 -49
- package/node_modules/axios/lib/adapters/http.js +408 -193
- package/node_modules/axios/lib/adapters/xhr.js +3 -1
- package/node_modules/axios/lib/core/Axios.js +4 -2
- package/node_modules/axios/lib/core/AxiosError.js +13 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
- package/node_modules/axios/lib/core/buildFullPath.js +29 -1
- package/node_modules/axios/lib/core/mergeConfig.js +35 -0
- package/node_modules/axios/lib/defaults/transitional.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/node_modules/axios/lib/helpers/buildURL.js +7 -4
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/cookies.js +5 -1
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
- package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
- package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
- package/node_modules/axios/lib/helpers/toFormData.js +48 -12
- package/node_modules/axios/lib/helpers/validator.js +1 -1
- package/node_modules/axios/lib/utils.js +105 -19
- package/node_modules/axios/package.json +31 -13
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.js +135 -158
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/npm-shrinkwrap.json +54 -27
- package/openclaw.plugin.json +1331 -1424
- package/package.json +92 -14
- package/dist/accounts.runtime-KvftRRek.js +0 -2
- package/dist/action-runtime.runtime-DZfd7IFr.js +0 -2
- package/dist/client-WIPAS3Yr.js +0 -160
- package/dist/config-api-Df9a1B8C.js +0 -3
- package/dist/doctor-contract-DddfkMlF.js +0 -134
- package/dist/probe-CN0ssfLN.js +0 -48
- package/dist/send.runtime-CJLxAt26.js +0 -2
- package/dist/setup-core-CkwVLzFO.js +0 -337
- package/node_modules/axios/dist/axios.js.map +0 -1
- package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
- package/node_modules/axios/dist/esm/axios.js.map +0 -1
- package/node_modules/axios/dist/node/axios.cjs.map +0 -1
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { a as resolveSlackAccount } from "./accounts-BOJJiHSr.js";
|
|
2
|
-
import { t as inspectSlackAccount } from "./account-inspect-Di7ditqZ.js";
|
|
3
|
-
import { t as isSlackPluginAccountConfigured } from "./account-configured-DzC407uv.js";
|
|
4
|
-
import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import { DEFAULT_ACCOUNT_ID, createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createAllowlistSetupWizardProxy, createEnvPatchedAccountSetupAdapter, createLegacyCompatChannelDmPolicy, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, parseMentionOrPrefixedId, patchChannelConfigForAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup-runtime";
|
|
7
|
-
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
8
|
-
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
9
|
-
//#region extensions/slack/src/setup-shared.ts
|
|
10
|
-
const SLACK_CHANNEL = "slack";
|
|
11
|
-
function buildSlackManifest(botName = "OpenClaw") {
|
|
12
|
-
const safeName = botName.trim() || "OpenClaw";
|
|
13
|
-
const manifest = {
|
|
14
|
-
display_information: {
|
|
15
|
-
name: safeName,
|
|
16
|
-
description: `${safeName} connector for OpenClaw`
|
|
17
|
-
},
|
|
18
|
-
features: {
|
|
19
|
-
bot_user: {
|
|
20
|
-
display_name: safeName,
|
|
21
|
-
always_online: true
|
|
22
|
-
},
|
|
23
|
-
app_home: {
|
|
24
|
-
home_tab_enabled: true,
|
|
25
|
-
messages_tab_enabled: true,
|
|
26
|
-
messages_tab_read_only_enabled: false
|
|
27
|
-
},
|
|
28
|
-
assistant_view: {
|
|
29
|
-
assistant_description: `${safeName} connects Slack assistant threads to OpenClaw agents.`,
|
|
30
|
-
suggested_prompts: [
|
|
31
|
-
{
|
|
32
|
-
title: "What can you do?",
|
|
33
|
-
message: "What can you help me with?"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: "Summarize this channel",
|
|
37
|
-
message: "Summarize the recent activity in this channel."
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: "Draft a reply",
|
|
41
|
-
message: "Help me draft a reply."
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
slash_commands: [{
|
|
46
|
-
command: "/openclaw",
|
|
47
|
-
description: "Send a message to OpenClaw",
|
|
48
|
-
should_escape: false
|
|
49
|
-
}]
|
|
50
|
-
},
|
|
51
|
-
oauth_config: { scopes: { bot: [
|
|
52
|
-
"app_mentions:read",
|
|
53
|
-
"assistant:write",
|
|
54
|
-
"channels:history",
|
|
55
|
-
"channels:read",
|
|
56
|
-
"chat:write",
|
|
57
|
-
"commands",
|
|
58
|
-
"emoji:read",
|
|
59
|
-
"files:read",
|
|
60
|
-
"files:write",
|
|
61
|
-
"groups:history",
|
|
62
|
-
"groups:read",
|
|
63
|
-
"im:history",
|
|
64
|
-
"im:read",
|
|
65
|
-
"im:write",
|
|
66
|
-
"mpim:history",
|
|
67
|
-
"mpim:read",
|
|
68
|
-
"mpim:write",
|
|
69
|
-
"pins:read",
|
|
70
|
-
"pins:write",
|
|
71
|
-
"reactions:read",
|
|
72
|
-
"reactions:write",
|
|
73
|
-
"usergroups:read",
|
|
74
|
-
"users:read"
|
|
75
|
-
] } },
|
|
76
|
-
settings: {
|
|
77
|
-
socket_mode_enabled: true,
|
|
78
|
-
event_subscriptions: { bot_events: [
|
|
79
|
-
"app_home_opened",
|
|
80
|
-
"app_mention",
|
|
81
|
-
"assistant_thread_context_changed",
|
|
82
|
-
"assistant_thread_started",
|
|
83
|
-
"channel_rename",
|
|
84
|
-
"member_joined_channel",
|
|
85
|
-
"member_left_channel",
|
|
86
|
-
"message.channels",
|
|
87
|
-
"message.groups",
|
|
88
|
-
"message.im",
|
|
89
|
-
"message.mpim",
|
|
90
|
-
"pin_added",
|
|
91
|
-
"pin_removed",
|
|
92
|
-
"reaction_added",
|
|
93
|
-
"reaction_removed"
|
|
94
|
-
] }
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
return JSON.stringify(manifest, null, 2);
|
|
98
|
-
}
|
|
99
|
-
function buildSlackSetupLines() {
|
|
100
|
-
return [
|
|
101
|
-
"1) Slack API -> Create App -> From scratch or From manifest (with the JSON below)",
|
|
102
|
-
"2) Add Socket Mode + enable it to get the app-level token (xapp-...)",
|
|
103
|
-
"3) Install App to workspace to get the xoxb- bot token",
|
|
104
|
-
"4) Enable Event Subscriptions (socket) for message, App Home, and assistant events",
|
|
105
|
-
"5) App Home -> enable the Home tab, Messages tab for DMs, and AI assistant view",
|
|
106
|
-
"Manifest JSON follows as plain text for copy/paste.",
|
|
107
|
-
"Tip: set SLACK_BOT_TOKEN + SLACK_APP_TOKEN in your env.",
|
|
108
|
-
`Docs: ${formatDocsLink("/slack", "slack")}`
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
|
-
function setSlackChannelAllowlist(cfg, accountId, channelKeys) {
|
|
112
|
-
const channels = Object.fromEntries(channelKeys.map((key) => [key, { enabled: true }]));
|
|
113
|
-
return patchChannelConfigForAccount({
|
|
114
|
-
cfg,
|
|
115
|
-
channel: SLACK_CHANNEL,
|
|
116
|
-
accountId,
|
|
117
|
-
patch: { channels }
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function isSlackSetupAccountConfigured(account) {
|
|
121
|
-
if (account.config.mode === "relay") return isSlackPluginAccountConfigured(account);
|
|
122
|
-
const hasConfiguredBotToken = Boolean(account.botToken?.trim()) || hasConfiguredSecretInput(account.config.botToken);
|
|
123
|
-
const hasConfiguredAppToken = Boolean(account.appToken?.trim()) || hasConfiguredSecretInput(account.config.appToken);
|
|
124
|
-
return hasConfiguredBotToken && hasConfiguredAppToken;
|
|
125
|
-
}
|
|
126
|
-
function describeSlackSetupAccount(account) {
|
|
127
|
-
return describeAccountSnapshot({
|
|
128
|
-
account,
|
|
129
|
-
configured: isSlackSetupAccountConfigured(account),
|
|
130
|
-
extra: {
|
|
131
|
-
botTokenSource: account.botTokenSource,
|
|
132
|
-
appTokenSource: account.appTokenSource
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region extensions/slack/src/setup-core.ts
|
|
138
|
-
const t = createSetupTranslator();
|
|
139
|
-
function enableSlackAccount(cfg, accountId) {
|
|
140
|
-
return patchChannelConfigForAccount({
|
|
141
|
-
cfg,
|
|
142
|
-
channel: SLACK_CHANNEL,
|
|
143
|
-
accountId,
|
|
144
|
-
patch: { enabled: true }
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function hasSlackInteractiveRepliesConfig(cfg, accountId) {
|
|
148
|
-
const capabilities = resolveSlackAccount({
|
|
149
|
-
cfg,
|
|
150
|
-
accountId
|
|
151
|
-
}).config.capabilities;
|
|
152
|
-
if (Array.isArray(capabilities)) return capabilities.some((entry) => normalizeLowercaseStringOrEmpty(entry) === "interactivereplies");
|
|
153
|
-
if (!capabilities || typeof capabilities !== "object") return false;
|
|
154
|
-
return "interactiveReplies" in capabilities;
|
|
155
|
-
}
|
|
156
|
-
function setSlackInteractiveReplies(cfg, accountId, interactiveReplies) {
|
|
157
|
-
const capabilities = resolveSlackAccount({
|
|
158
|
-
cfg,
|
|
159
|
-
accountId
|
|
160
|
-
}).config.capabilities;
|
|
161
|
-
return patchChannelConfigForAccount({
|
|
162
|
-
cfg,
|
|
163
|
-
channel: SLACK_CHANNEL,
|
|
164
|
-
accountId,
|
|
165
|
-
patch: { capabilities: Array.isArray(capabilities) ? interactiveReplies ? uniqueStrings([...capabilities, "interactiveReplies"]) : capabilities.filter((entry) => normalizeLowercaseStringOrEmpty(entry) !== "interactivereplies") : {
|
|
166
|
-
...capabilities && typeof capabilities === "object" ? capabilities : {},
|
|
167
|
-
interactiveReplies
|
|
168
|
-
} }
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
function createSlackTokenCredential(params) {
|
|
172
|
-
return defineTokenCredential({
|
|
173
|
-
inputKey: params.inputKey,
|
|
174
|
-
configKey: params.inputKey,
|
|
175
|
-
providerHint: params.providerHint,
|
|
176
|
-
credentialLabel: params.credentialLabel,
|
|
177
|
-
preferredEnvVar: params.preferredEnvVar,
|
|
178
|
-
envPrompt: `${params.preferredEnvVar} detected. Use env var?`,
|
|
179
|
-
keepPrompt: params.keepPrompt,
|
|
180
|
-
inputPrompt: params.inputPrompt,
|
|
181
|
-
allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID,
|
|
182
|
-
resolveAccount: ({ cfg, accountId }) => resolveSlackAccount({
|
|
183
|
-
cfg,
|
|
184
|
-
accountId
|
|
185
|
-
}),
|
|
186
|
-
resolvedValue: (account) => normalizeOptionalString(params.inputKey === "botToken" ? account.botToken : account.appToken),
|
|
187
|
-
envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env[params.preferredEnvVar]) : void 0,
|
|
188
|
-
patchAccount: ({ cfg, accountId, mode, patch }) => mode === "env" ? enableSlackAccount(cfg, accountId) : patchChannelConfigForAccount({
|
|
189
|
-
cfg,
|
|
190
|
-
channel: SLACK_CHANNEL,
|
|
191
|
-
accountId,
|
|
192
|
-
patch: {
|
|
193
|
-
enabled: true,
|
|
194
|
-
...patch
|
|
195
|
-
}
|
|
196
|
-
}),
|
|
197
|
-
useEnv: { clearFields: [] },
|
|
198
|
-
set: {}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const slackSetupAdapter = createEnvPatchedAccountSetupAdapter({
|
|
202
|
-
channelKey: SLACK_CHANNEL,
|
|
203
|
-
defaultAccountOnlyEnvError: "Slack env tokens can only be used for the default account.",
|
|
204
|
-
missingCredentialError: "Slack requires --bot-token and --app-token (or --use-env).",
|
|
205
|
-
hasCredentials: (input) => Boolean(input.botToken && input.appToken),
|
|
206
|
-
buildPatch: (input) => ({
|
|
207
|
-
...input.botToken ? { botToken: input.botToken } : {},
|
|
208
|
-
...input.appToken ? { appToken: input.appToken } : {}
|
|
209
|
-
})
|
|
210
|
-
});
|
|
211
|
-
function createSlackSetupWizardBase(handlers) {
|
|
212
|
-
const slackDmPolicy = createLegacyCompatChannelDmPolicy({
|
|
213
|
-
label: "Slack",
|
|
214
|
-
channel: SLACK_CHANNEL,
|
|
215
|
-
promptAllowFrom: handlers.promptAllowFrom
|
|
216
|
-
});
|
|
217
|
-
return {
|
|
218
|
-
channel: SLACK_CHANNEL,
|
|
219
|
-
status: createStandardChannelSetupStatus({
|
|
220
|
-
channelLabel: "Slack",
|
|
221
|
-
configuredLabel: t("wizard.channels.statusConfigured"),
|
|
222
|
-
unconfiguredLabel: t("wizard.channels.statusNeedsTokens"),
|
|
223
|
-
configuredHint: t("wizard.channels.statusConfigured"),
|
|
224
|
-
unconfiguredHint: t("wizard.channels.statusNeedsTokens"),
|
|
225
|
-
configuredScore: 2,
|
|
226
|
-
unconfiguredScore: 1,
|
|
227
|
-
resolveConfigured: ({ cfg, accountId }) => inspectSlackAccount({
|
|
228
|
-
cfg,
|
|
229
|
-
accountId
|
|
230
|
-
}).configured
|
|
231
|
-
}),
|
|
232
|
-
introNote: {
|
|
233
|
-
title: t("wizard.slack.socketModeTokensTitle"),
|
|
234
|
-
lines: buildSlackSetupLines(),
|
|
235
|
-
shouldShow: ({ cfg, accountId }) => !isSlackSetupAccountConfigured(resolveSlackAccount({
|
|
236
|
-
cfg,
|
|
237
|
-
accountId
|
|
238
|
-
}))
|
|
239
|
-
},
|
|
240
|
-
prepare: async ({ cfg, accountId, prompter }) => {
|
|
241
|
-
if (isSlackSetupAccountConfigured(resolveSlackAccount({
|
|
242
|
-
cfg,
|
|
243
|
-
accountId
|
|
244
|
-
}))) return;
|
|
245
|
-
const manifest = buildSlackManifest();
|
|
246
|
-
if (prompter.plain) await prompter.plain(manifest);
|
|
247
|
-
else await prompter.note(manifest, "Slack manifest JSON");
|
|
248
|
-
},
|
|
249
|
-
envShortcut: {
|
|
250
|
-
prompt: t("wizard.slack.envPrompt"),
|
|
251
|
-
preferredEnvVar: "SLACK_BOT_TOKEN",
|
|
252
|
-
isAvailable: ({ cfg, accountId }) => accountId === DEFAULT_ACCOUNT_ID && Boolean(process.env.SLACK_BOT_TOKEN?.trim()) && Boolean(process.env.SLACK_APP_TOKEN?.trim()) && !isSlackSetupAccountConfigured(resolveSlackAccount({
|
|
253
|
-
cfg,
|
|
254
|
-
accountId
|
|
255
|
-
})),
|
|
256
|
-
apply: ({ cfg, accountId }) => enableSlackAccount(cfg, accountId)
|
|
257
|
-
},
|
|
258
|
-
credentials: [createSlackTokenCredential({
|
|
259
|
-
inputKey: "botToken",
|
|
260
|
-
providerHint: "slack-bot",
|
|
261
|
-
credentialLabel: t("wizard.slack.botToken"),
|
|
262
|
-
preferredEnvVar: "SLACK_BOT_TOKEN",
|
|
263
|
-
keepPrompt: t("wizard.slack.botTokenKeep"),
|
|
264
|
-
inputPrompt: t("wizard.slack.botTokenInput")
|
|
265
|
-
}), createSlackTokenCredential({
|
|
266
|
-
inputKey: "appToken",
|
|
267
|
-
providerHint: "slack-app",
|
|
268
|
-
credentialLabel: t("wizard.slack.appToken"),
|
|
269
|
-
preferredEnvVar: "SLACK_APP_TOKEN",
|
|
270
|
-
keepPrompt: t("wizard.slack.appTokenKeep"),
|
|
271
|
-
inputPrompt: t("wizard.slack.appTokenInput")
|
|
272
|
-
})],
|
|
273
|
-
dmPolicy: slackDmPolicy,
|
|
274
|
-
allowFrom: createAccountScopedAllowFromSection({
|
|
275
|
-
channel: SLACK_CHANNEL,
|
|
276
|
-
credentialInputKey: "botToken",
|
|
277
|
-
helpTitle: t("wizard.slack.allowlistTitle"),
|
|
278
|
-
helpLines: [
|
|
279
|
-
t("wizard.slack.allowlistIntro"),
|
|
280
|
-
t("wizard.slack.examples"),
|
|
281
|
-
"- U12345678",
|
|
282
|
-
"- @alice",
|
|
283
|
-
t("wizard.slack.multipleEntries"),
|
|
284
|
-
t("wizard.channels.docs", { link: formatDocsLink("/slack", "slack") })
|
|
285
|
-
],
|
|
286
|
-
message: t("wizard.slack.allowFromPrompt"),
|
|
287
|
-
placeholder: "@alice, U12345678",
|
|
288
|
-
invalidWithoutCredentialNote: t("wizard.slack.allowFromInvalidWithoutToken"),
|
|
289
|
-
parseId: (value) => parseMentionOrPrefixedId({
|
|
290
|
-
value,
|
|
291
|
-
mentionPattern: /^<@([A-Z0-9]+)>$/i,
|
|
292
|
-
prefixPattern: /^(slack:|user:)/i,
|
|
293
|
-
idPattern: /^[A-Z][A-Z0-9]+$/i,
|
|
294
|
-
normalizeId: (id) => id.toUpperCase()
|
|
295
|
-
}),
|
|
296
|
-
resolveEntries: handlers.resolveAllowFromEntries
|
|
297
|
-
}),
|
|
298
|
-
groupAccess: createAccountScopedGroupAccessSection({
|
|
299
|
-
channel: SLACK_CHANNEL,
|
|
300
|
-
label: t("wizard.slack.channelsLabel"),
|
|
301
|
-
placeholder: "#general, #private, C123",
|
|
302
|
-
currentPolicy: ({ cfg, accountId }) => resolveSlackAccount({
|
|
303
|
-
cfg,
|
|
304
|
-
accountId
|
|
305
|
-
}).config.groupPolicy ?? "allowlist",
|
|
306
|
-
currentEntries: ({ cfg, accountId }) => Object.entries(resolveSlackAccount({
|
|
307
|
-
cfg,
|
|
308
|
-
accountId
|
|
309
|
-
}).config.channels ?? {}).filter(([, value]) => value?.enabled !== false).map(([key]) => key),
|
|
310
|
-
updatePrompt: ({ cfg, accountId }) => Boolean(resolveSlackAccount({
|
|
311
|
-
cfg,
|
|
312
|
-
accountId
|
|
313
|
-
}).config.channels),
|
|
314
|
-
resolveAllowlist: handlers.resolveGroupAllowlist,
|
|
315
|
-
fallbackResolved: (entries) => entries,
|
|
316
|
-
applyAllowlist: ({ cfg, accountId, resolved }) => setSlackChannelAllowlist(cfg, accountId, resolved)
|
|
317
|
-
}),
|
|
318
|
-
finalize: async ({ cfg, accountId, options, prompter }) => {
|
|
319
|
-
if (hasSlackInteractiveRepliesConfig(cfg, accountId)) return;
|
|
320
|
-
if (options?.quickstartDefaults) return { cfg: setSlackInteractiveReplies(cfg, accountId, true) };
|
|
321
|
-
return { cfg: setSlackInteractiveReplies(cfg, accountId, await prompter.confirm({
|
|
322
|
-
message: t("wizard.slack.interactiveRepliesPrompt"),
|
|
323
|
-
initialValue: true
|
|
324
|
-
})) };
|
|
325
|
-
},
|
|
326
|
-
disable: (cfg) => setSetupChannelEnabled(cfg, SLACK_CHANNEL, false)
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function createSlackSetupWizardProxy(loadWizard) {
|
|
330
|
-
return createAllowlistSetupWizardProxy({
|
|
331
|
-
loadWizard: async () => (await loadWizard()).slackSetupWizard,
|
|
332
|
-
createBase: createSlackSetupWizardBase,
|
|
333
|
-
fallbackResolvedGroupAllowlist: (entries) => entries
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
//#endregion
|
|
337
|
-
export { describeSlackSetupAccount as a, SLACK_CHANNEL as i, createSlackSetupWizardProxy as n, isSlackSetupAccountConfigured as o, slackSetupAdapter as r, createSlackSetupWizardBase as t };
|