@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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as normalizeSlackSlug, t as buildSlackChannelPolicyScope } from "./group-policy-CdnQzQBI.js";
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { applyChannelMatchMeta, buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
4
4
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { u as formatSlackBotTokenIdentityWarning } from "./accounts-BSr252c_.js";
|
|
3
|
+
import "./target-parsing-N6lHogYZ.js";
|
|
4
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
5
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
7
|
+
import { PAIRING_APPROVED_MESSAGE, projectCredentialSnapshotFields, resolveConfiguredFromRequiredCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { WebClient } from "@slack/web-api";
|
|
10
|
+
import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
11
|
+
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
12
|
+
//#region extensions/slack/src/channel-api.ts
|
|
13
|
+
const SLACK_CHANNEL_META = {
|
|
14
|
+
id: "slack",
|
|
15
|
+
label: "Slack",
|
|
16
|
+
selectionLabel: "Slack",
|
|
17
|
+
docsPath: "/channels/slack",
|
|
18
|
+
docsLabel: "slack",
|
|
19
|
+
blurb: "supports bot + app tokens, channels, threads, and interactive replies.",
|
|
20
|
+
systemImage: "number.square",
|
|
21
|
+
markdownCapable: true
|
|
22
|
+
};
|
|
23
|
+
function getChatChannelMeta(id) {
|
|
24
|
+
if (id !== SLACK_CHANNEL_META.id) throw new Error(`Unsupported Slack channel meta lookup: ${id}`);
|
|
25
|
+
return SLACK_CHANNEL_META;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region extensions/slack/src/client-options.ts
|
|
29
|
+
const SLACK_DEFAULT_RETRY_OPTIONS = {
|
|
30
|
+
retries: 2,
|
|
31
|
+
factor: 2,
|
|
32
|
+
minTimeout: 500,
|
|
33
|
+
maxTimeout: 3e3,
|
|
34
|
+
randomize: true
|
|
35
|
+
};
|
|
36
|
+
const SLACK_WRITE_RETRY_OPTIONS = { retries: 0 };
|
|
37
|
+
const SLACK_LOOKUP_TIMEOUT_MS = 3e4;
|
|
38
|
+
const SLACK_LOOKUP_RETRY_OPTIONS = { retries: 0 };
|
|
39
|
+
/**
|
|
40
|
+
* Build an HTTPS proxy agent from env vars (HTTPS_PROXY, HTTP_PROXY, etc.)
|
|
41
|
+
* for use as the `agent` option in Slack WebClient and Socket Mode connections.
|
|
42
|
+
*
|
|
43
|
+
* When set, this agent is forwarded through @slack/bolt -> @slack/socket-mode ->
|
|
44
|
+
* SlackWebSocket as the `httpAgent`, which the `ws` library uses to tunnel the
|
|
45
|
+
* WebSocket upgrade request through the proxy. This fixes Socket Mode in
|
|
46
|
+
* environments where outbound traffic must go through an HTTP CONNECT proxy.
|
|
47
|
+
*
|
|
48
|
+
* Respects `NO_PROXY` / `no_proxy`; if `*.slack.com` (or a matching pattern)
|
|
49
|
+
* appears in the exclusion list, returns `undefined` so the connection is direct.
|
|
50
|
+
*
|
|
51
|
+
* Returns `undefined` when no proxy env var is configured or when Slack hosts
|
|
52
|
+
* are excluded by `NO_PROXY`.
|
|
53
|
+
*/
|
|
54
|
+
function resolveSlackProxyAgent(targetUrl) {
|
|
55
|
+
try {
|
|
56
|
+
return createNodeProxyAgent({
|
|
57
|
+
mode: "env",
|
|
58
|
+
targetUrl
|
|
59
|
+
});
|
|
60
|
+
} catch {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function resolveSlackApiUrlFromEnv() {
|
|
65
|
+
return process.env.SLACK_API_URL?.trim() || void 0;
|
|
66
|
+
}
|
|
67
|
+
function applySlackApiUrlAndProxyOptions(options) {
|
|
68
|
+
const slackApiUrl = options.slackApiUrl ?? resolveSlackApiUrlFromEnv();
|
|
69
|
+
options.agent ??= resolveSlackProxyAgent(slackApiUrl ?? "https://slack.com/");
|
|
70
|
+
if (slackApiUrl !== void 0) options.slackApiUrl = slackApiUrl;
|
|
71
|
+
else delete options.slackApiUrl;
|
|
72
|
+
}
|
|
73
|
+
function resolveSlackWebClientOptions(options = {}) {
|
|
74
|
+
const resolved = Object.assign({}, options);
|
|
75
|
+
applySlackApiUrlAndProxyOptions(resolved);
|
|
76
|
+
resolved.retryConfig ??= SLACK_DEFAULT_RETRY_OPTIONS;
|
|
77
|
+
return resolved;
|
|
78
|
+
}
|
|
79
|
+
function resolveSlackWriteClientOptions(options = {}) {
|
|
80
|
+
const resolved = Object.assign({}, options);
|
|
81
|
+
applySlackApiUrlAndProxyOptions(resolved);
|
|
82
|
+
resolved.retryConfig ??= SLACK_WRITE_RETRY_OPTIONS;
|
|
83
|
+
return resolved;
|
|
84
|
+
}
|
|
85
|
+
function resolveSlackLookupClientOptions(options = {}) {
|
|
86
|
+
const resolved = Object.assign({}, options);
|
|
87
|
+
applySlackApiUrlAndProxyOptions(resolved);
|
|
88
|
+
resolved.rejectRateLimitedCalls = true;
|
|
89
|
+
resolved.retryConfig = SLACK_LOOKUP_RETRY_OPTIONS;
|
|
90
|
+
resolved.timeout ??= SLACK_LOOKUP_TIMEOUT_MS;
|
|
91
|
+
return resolved;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region extensions/slack/src/client.ts
|
|
95
|
+
const SLACK_WRITE_CLIENT_CACHE_MAX = 32;
|
|
96
|
+
const slackWriteClientCache = /* @__PURE__ */ new Map();
|
|
97
|
+
let slackListenerUploadCompletionClientCache = /* @__PURE__ */ new WeakMap();
|
|
98
|
+
function createSlackWebClient(token, options = {}) {
|
|
99
|
+
return new WebClient(token, resolveSlackWebClientOptions(options));
|
|
100
|
+
}
|
|
101
|
+
function createSlackStartupAuthClient(token, options = {}) {
|
|
102
|
+
return createSlackWebClient(token, {
|
|
103
|
+
...options,
|
|
104
|
+
rejectRateLimitedCalls: true,
|
|
105
|
+
retryConfig: { retries: 0 },
|
|
106
|
+
timeout: 1e4
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function createSlackLookupClient(token, options = {}) {
|
|
110
|
+
return new WebClient(token, resolveSlackLookupClientOptions(options));
|
|
111
|
+
}
|
|
112
|
+
function createSlackWriteClient(token, options = {}) {
|
|
113
|
+
return new WebClient(token, resolveSlackWriteClientOptions(options));
|
|
114
|
+
}
|
|
115
|
+
function createSlackTokenCacheKey(token) {
|
|
116
|
+
return `sha256:${createHash("sha256").update(token).digest("base64url")}`;
|
|
117
|
+
}
|
|
118
|
+
function slackWriteClientCacheKey(token, options) {
|
|
119
|
+
const tokenKey = createSlackTokenCacheKey(token);
|
|
120
|
+
return options.slackApiUrl ? `${tokenKey}:api:${options.slackApiUrl}` : tokenKey;
|
|
121
|
+
}
|
|
122
|
+
function getSlackWriteClient(token, options = {}) {
|
|
123
|
+
const resolvedOptions = resolveSlackWriteClientOptions(options);
|
|
124
|
+
const tokenKey = slackWriteClientCacheKey(token, resolvedOptions);
|
|
125
|
+
const cached = slackWriteClientCache.get(tokenKey);
|
|
126
|
+
if (cached) {
|
|
127
|
+
slackWriteClientCache.delete(tokenKey);
|
|
128
|
+
slackWriteClientCache.set(tokenKey, cached);
|
|
129
|
+
return cached;
|
|
130
|
+
}
|
|
131
|
+
const client = new WebClient(token, resolvedOptions);
|
|
132
|
+
if (slackWriteClientCache.size >= SLACK_WRITE_CLIENT_CACHE_MAX) {
|
|
133
|
+
const oldestTokenKey = slackWriteClientCache.keys().next().value;
|
|
134
|
+
if (oldestTokenKey) slackWriteClientCache.delete(oldestTokenKey);
|
|
135
|
+
}
|
|
136
|
+
slackWriteClientCache.set(tokenKey, client);
|
|
137
|
+
return client;
|
|
138
|
+
}
|
|
139
|
+
function getSlackListenerUploadCompletionClient(params) {
|
|
140
|
+
const token = params.listenerClient.token?.trim();
|
|
141
|
+
const teamId = params.teamId.trim().toUpperCase();
|
|
142
|
+
if (!token || !teamId) return;
|
|
143
|
+
const cached = slackListenerUploadCompletionClientCache.get(params.listenerClient);
|
|
144
|
+
if (cached) return cached.teamId === teamId ? cached.client : void 0;
|
|
145
|
+
const headers = Object.fromEntries(Object.entries(params.clientOptions?.headers ?? {}).filter(([name]) => name.toLowerCase() !== "authorization"));
|
|
146
|
+
const client = new WebClient(token, resolveSlackWriteClientOptions({
|
|
147
|
+
...params.clientOptions,
|
|
148
|
+
headers,
|
|
149
|
+
slackApiUrl: params.listenerClient.slackApiUrl,
|
|
150
|
+
teamId,
|
|
151
|
+
retryConfig: SLACK_WRITE_RETRY_OPTIONS,
|
|
152
|
+
timeout: 0
|
|
153
|
+
}));
|
|
154
|
+
slackListenerUploadCompletionClientCache.set(params.listenerClient, {
|
|
155
|
+
teamId,
|
|
156
|
+
client
|
|
157
|
+
});
|
|
158
|
+
return client;
|
|
159
|
+
}
|
|
160
|
+
function clearSlackWriteClientCacheForTest() {
|
|
161
|
+
slackWriteClientCache.clear();
|
|
162
|
+
slackListenerUploadCompletionClientCache = /* @__PURE__ */ new WeakMap();
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region extensions/slack/src/errors.ts
|
|
166
|
+
const NO_ERROR_DETAIL = "no error detail";
|
|
167
|
+
function redact(value) {
|
|
168
|
+
return redactSensitiveText(value);
|
|
169
|
+
}
|
|
170
|
+
function addStringDetail(details, label, value) {
|
|
171
|
+
if (typeof value !== "string") return;
|
|
172
|
+
const trimmed = redact(value.trim());
|
|
173
|
+
if (trimmed) details.push(label ? `${label}: ${trimmed}` : trimmed);
|
|
174
|
+
}
|
|
175
|
+
function addScalarDetail(details, label, value) {
|
|
176
|
+
if (typeof value === "string") {
|
|
177
|
+
addStringDetail(details, label, value);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (typeof value === "number" || typeof value === "boolean") details.push(`${label}: ${String(value)}`);
|
|
181
|
+
}
|
|
182
|
+
function addStringListDetail(details, label, value) {
|
|
183
|
+
if (!Array.isArray(value)) return;
|
|
184
|
+
const entries = value.flatMap((entry) => {
|
|
185
|
+
if (typeof entry !== "string") return [];
|
|
186
|
+
const trimmed = redact(entry.trim());
|
|
187
|
+
return trimmed ? [trimmed] : [];
|
|
188
|
+
});
|
|
189
|
+
if (entries.length) details.push(`${label}: ${entries.join(", ")}`);
|
|
190
|
+
}
|
|
191
|
+
function safeStringify(value) {
|
|
192
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
193
|
+
try {
|
|
194
|
+
const result = JSON.stringify(value, (_key, nested) => {
|
|
195
|
+
if (typeof nested !== "object" || nested === null) return nested;
|
|
196
|
+
if (seen.has(nested)) return "[Circular]";
|
|
197
|
+
seen.add(nested);
|
|
198
|
+
return nested;
|
|
199
|
+
});
|
|
200
|
+
return result ? redact(result) : void 0;
|
|
201
|
+
} catch {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function addSlackResponseMetadata(details, value) {
|
|
206
|
+
if (!isRecord(value)) return;
|
|
207
|
+
addStringListDetail(details, "scopes", value.scopes);
|
|
208
|
+
addStringListDetail(details, "accepted", value.acceptedScopes);
|
|
209
|
+
const messages = value.messages;
|
|
210
|
+
if (Array.isArray(messages)) for (const message of messages) addStringDetail(details, "slack message", message);
|
|
211
|
+
const warnings = value.warnings;
|
|
212
|
+
if (Array.isArray(warnings)) for (const warning of warnings) addStringDetail(details, "slack warning", warning);
|
|
213
|
+
}
|
|
214
|
+
function addSlackDataDetails(details, value) {
|
|
215
|
+
if (!isRecord(value)) return;
|
|
216
|
+
addScalarDetail(details, "slack error", value.error);
|
|
217
|
+
addScalarDetail(details, "needed", value.needed);
|
|
218
|
+
addScalarDetail(details, "provided", value.provided);
|
|
219
|
+
addSlackResponseMetadata(details, value.response_metadata);
|
|
220
|
+
}
|
|
221
|
+
function addRecordDetails(details, value) {
|
|
222
|
+
addScalarDetail(details, "code", value.code);
|
|
223
|
+
addScalarDetail(details, "status", value.status);
|
|
224
|
+
addScalarDetail(details, "statusCode", value.statusCode);
|
|
225
|
+
addScalarDetail(details, "statusMessage", value.statusMessage);
|
|
226
|
+
addScalarDetail(details, "retryAfter", value.retryAfter);
|
|
227
|
+
addScalarDetail(details, "errno", value.errno);
|
|
228
|
+
addScalarDetail(details, "syscall", value.syscall);
|
|
229
|
+
addScalarDetail(details, "hostname", value.hostname);
|
|
230
|
+
addScalarDetail(details, "type", value.type);
|
|
231
|
+
addStringDetail(details, "statusText", value.statusText);
|
|
232
|
+
addStringDetail(details, "body", value.body);
|
|
233
|
+
addSlackDataDetails(details, value.data);
|
|
234
|
+
if (isRecord(value.response)) {
|
|
235
|
+
addScalarDetail(details, "response status", value.response.status);
|
|
236
|
+
addStringDetail(details, "response statusText", value.response.statusText);
|
|
237
|
+
addSlackDataDetails(details, value.response.data);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function collectSlackErrorDetails(error) {
|
|
241
|
+
const details = [];
|
|
242
|
+
if (error === void 0 || error === null) return details;
|
|
243
|
+
if (typeof error === "string") {
|
|
244
|
+
addStringDetail(details, "", error);
|
|
245
|
+
return details;
|
|
246
|
+
}
|
|
247
|
+
if (error instanceof Error) {
|
|
248
|
+
addStringDetail(details, "", error.message || error.name);
|
|
249
|
+
if (error.cause !== void 0) {
|
|
250
|
+
const cause = formatSlackError(error.cause, "");
|
|
251
|
+
if (cause) details.push(`cause: ${cause}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (isRecord(error)) {
|
|
255
|
+
addRecordDetails(details, error);
|
|
256
|
+
const fallback = safeStringify(error);
|
|
257
|
+
if (details.length === 0 && fallback && fallback !== "{}") details.push(fallback);
|
|
258
|
+
}
|
|
259
|
+
return details;
|
|
260
|
+
}
|
|
261
|
+
function formatSlackError(error, fallback = NO_ERROR_DETAIL) {
|
|
262
|
+
const details = collectSlackErrorDetails(error);
|
|
263
|
+
if (details.length > 0) return details.join("; ");
|
|
264
|
+
if (error === void 0 || error === null) return fallback;
|
|
265
|
+
if (typeof error === "string" && !error.trim()) return fallback;
|
|
266
|
+
return safeStringify(error) ?? fallback;
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region extensions/slack/src/probe.ts
|
|
270
|
+
var probe_exports = /* @__PURE__ */ __exportAll({ probeSlack: () => probeSlack });
|
|
271
|
+
async function probeSlack(token, timeoutMs = 2500, opts) {
|
|
272
|
+
const client = createSlackWebClient(token);
|
|
273
|
+
const start = Date.now();
|
|
274
|
+
try {
|
|
275
|
+
const result = await withTimeout(client.auth.test(), timeoutMs);
|
|
276
|
+
if (!result.ok) return {
|
|
277
|
+
ok: false,
|
|
278
|
+
status: 200,
|
|
279
|
+
error: result.error ?? "unknown",
|
|
280
|
+
elapsedMs: Date.now() - start
|
|
281
|
+
};
|
|
282
|
+
if (opts?.identity === "user") {
|
|
283
|
+
if (result.bot_id?.trim()) return {
|
|
284
|
+
ok: false,
|
|
285
|
+
status: 200,
|
|
286
|
+
error: "Slack auth.test identified a bot token; user identity requires a user OAuth token",
|
|
287
|
+
elapsedMs: Date.now() - start
|
|
288
|
+
};
|
|
289
|
+
const userId = result.user_id?.trim();
|
|
290
|
+
if (!userId) return {
|
|
291
|
+
ok: false,
|
|
292
|
+
status: 200,
|
|
293
|
+
error: "Slack auth.test returned no human user_id for user identity",
|
|
294
|
+
elapsedMs: Date.now() - start
|
|
295
|
+
};
|
|
296
|
+
return {
|
|
297
|
+
ok: true,
|
|
298
|
+
status: 200,
|
|
299
|
+
elapsedMs: Date.now() - start,
|
|
300
|
+
user: {
|
|
301
|
+
id: userId,
|
|
302
|
+
name: result.user
|
|
303
|
+
},
|
|
304
|
+
team: {
|
|
305
|
+
id: result.team_id,
|
|
306
|
+
name: result.team
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
const warning = formatSlackBotTokenIdentityWarning({
|
|
311
|
+
auth: result,
|
|
312
|
+
accountId: opts?.accountId
|
|
313
|
+
});
|
|
314
|
+
const authIdentity = {
|
|
315
|
+
id: result.user_id,
|
|
316
|
+
name: result.user
|
|
317
|
+
};
|
|
318
|
+
return {
|
|
319
|
+
ok: true,
|
|
320
|
+
status: 200,
|
|
321
|
+
elapsedMs: Date.now() - start,
|
|
322
|
+
bot: authIdentity,
|
|
323
|
+
team: {
|
|
324
|
+
id: result.team_id,
|
|
325
|
+
name: result.team
|
|
326
|
+
},
|
|
327
|
+
...warning ? { warning } : {}
|
|
328
|
+
};
|
|
329
|
+
} catch (err) {
|
|
330
|
+
const message = formatSlackError(err);
|
|
331
|
+
return {
|
|
332
|
+
ok: false,
|
|
333
|
+
status: typeof err.statusCode === "number" ? err.statusCode : null,
|
|
334
|
+
error: message,
|
|
335
|
+
elapsedMs: Date.now() - start
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
340
|
+
export { PAIRING_APPROVED_MESSAGE as _, createSlackLookupClient as a, resolveConfiguredFromRequiredCredentialStatuses as b, createSlackWebClient as c, getSlackWriteClient as d, SLACK_DEFAULT_RETRY_OPTIONS as f, DEFAULT_ACCOUNT_ID$1 as g, resolveSlackWriteClientOptions as h, clearSlackWriteClientCacheForTest as i, createSlackWriteClient as l, resolveSlackWebClientOptions as m, probe_exports as n, createSlackStartupAuthClient as o, SLACK_WRITE_RETRY_OPTIONS as p, formatSlackError as r, createSlackTokenCacheKey as s, probeSlack as t, getSlackListenerUploadCompletionClient as u, getChatChannelMeta as v, projectCredentialSnapshotFields as y };
|