@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/slack",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.4",
|
|
4
4
|
"description": "OpenClaw Slack channel plugin for channels, DMs, commands, and app events.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"@slack/types": "2.21.1",
|
|
13
13
|
"@slack/web-api": "7.18.0",
|
|
14
14
|
"p-map": "7.0.5",
|
|
15
|
-
"typebox": "1.3.
|
|
16
|
-
"ws": "8.21.
|
|
15
|
+
"typebox": "1.3.6",
|
|
16
|
+
"ws": "8.21.1",
|
|
17
17
|
"zod": "4.4.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"openclaw": ">=2026.7.2-beta.
|
|
20
|
+
"openclaw": ">=2026.7.2-beta.4"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"openclaw": {
|
|
@@ -29,8 +29,23 @@
|
|
|
29
29
|
"./index.ts"
|
|
30
30
|
],
|
|
31
31
|
"setupEntry": "./dist/setup-entry.js",
|
|
32
|
+
"setupFeatures": {
|
|
33
|
+
"configPromotion": true
|
|
34
|
+
},
|
|
32
35
|
"channel": {
|
|
33
36
|
"id": "slack",
|
|
37
|
+
"configuredState": {
|
|
38
|
+
"env": {
|
|
39
|
+
"anyOf": [
|
|
40
|
+
"SLACK_BOT_TOKEN",
|
|
41
|
+
"SLACK_APP_TOKEN",
|
|
42
|
+
"SLACK_USER_TOKEN"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"approvalFlags": [
|
|
47
|
+
"native"
|
|
48
|
+
],
|
|
34
49
|
"label": "Slack",
|
|
35
50
|
"selectionLabel": "Slack (Socket Mode)",
|
|
36
51
|
"detailLabel": "Slack Bot",
|
|
@@ -43,14 +58,77 @@
|
|
|
43
58
|
"nativeCommandsAutoEnabled": false,
|
|
44
59
|
"nativeSkillsAutoEnabled": false
|
|
45
60
|
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
"setup": {
|
|
62
|
+
"fields": [
|
|
63
|
+
{
|
|
64
|
+
"key": "botToken",
|
|
65
|
+
"kind": "string",
|
|
66
|
+
"sensitive": true,
|
|
67
|
+
"cli": {
|
|
68
|
+
"flags": "--bot-token <token>",
|
|
69
|
+
"description": "Slack bot token"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"key": "appToken",
|
|
74
|
+
"kind": "string",
|
|
75
|
+
"sensitive": true,
|
|
76
|
+
"cli": {
|
|
77
|
+
"flags": "--app-token <token>",
|
|
78
|
+
"description": "Slack app token"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"key": "userToken",
|
|
83
|
+
"kind": "string",
|
|
84
|
+
"sensitive": true,
|
|
85
|
+
"cli": {
|
|
86
|
+
"flags": "--user-token <token>",
|
|
87
|
+
"description": "Slack user token"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"key": "signingSecret",
|
|
92
|
+
"kind": "string",
|
|
93
|
+
"sensitive": true,
|
|
94
|
+
"cli": {
|
|
95
|
+
"flags": "--signing-secret <secret>",
|
|
96
|
+
"description": "Slack signing secret"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"key": "identity",
|
|
101
|
+
"kind": "choice",
|
|
102
|
+
"choices": [
|
|
103
|
+
"bot",
|
|
104
|
+
"user"
|
|
105
|
+
],
|
|
106
|
+
"cli": {
|
|
107
|
+
"flags": "--identity <kind>",
|
|
108
|
+
"description": "Slack identity"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"key": "mode",
|
|
113
|
+
"kind": "choice",
|
|
114
|
+
"choices": [
|
|
115
|
+
"socket",
|
|
116
|
+
"http"
|
|
117
|
+
],
|
|
118
|
+
"cli": {
|
|
119
|
+
"flags": "--mode <mode>",
|
|
120
|
+
"description": "Slack connection mode"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"key": "useEnv",
|
|
125
|
+
"kind": "boolean",
|
|
126
|
+
"cli": {
|
|
127
|
+
"flags": "--use-env",
|
|
128
|
+
"description": "Use Slack environment credentials"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
54
132
|
}
|
|
55
133
|
},
|
|
56
134
|
"install": {
|
|
@@ -60,13 +138,13 @@
|
|
|
60
138
|
"allowInvalidConfigRecovery": true
|
|
61
139
|
},
|
|
62
140
|
"compat": {
|
|
63
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
141
|
+
"pluginApi": ">=2026.7.2-beta.4"
|
|
64
142
|
},
|
|
65
143
|
"startup": {
|
|
66
144
|
"deferConfiguredChannelFullLoadUntilAfterListen": true
|
|
67
145
|
},
|
|
68
146
|
"build": {
|
|
69
|
-
"openclawVersion": "2026.7.2-beta.
|
|
147
|
+
"openclawVersion": "2026.7.2-beta.4",
|
|
70
148
|
"bundledDist": false
|
|
71
149
|
},
|
|
72
150
|
"release": {
|
package/dist/client-WIPAS3Yr.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import "./target-parsing-N6lHogYZ.js";
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
3
|
-
import { PAIRING_APPROVED_MESSAGE, projectCredentialSnapshotFields, resolveConfiguredFromRequiredCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import { WebClient } from "@slack/web-api";
|
|
6
|
-
import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
7
|
-
//#region extensions/slack/src/channel-api.ts
|
|
8
|
-
const SLACK_CHANNEL_META = {
|
|
9
|
-
id: "slack",
|
|
10
|
-
label: "Slack",
|
|
11
|
-
selectionLabel: "Slack",
|
|
12
|
-
docsPath: "/channels/slack",
|
|
13
|
-
docsLabel: "slack",
|
|
14
|
-
blurb: "supports bot + app tokens, channels, threads, and interactive replies.",
|
|
15
|
-
systemImage: "number.square",
|
|
16
|
-
markdownCapable: true
|
|
17
|
-
};
|
|
18
|
-
function getChatChannelMeta(id) {
|
|
19
|
-
if (id !== SLACK_CHANNEL_META.id) throw new Error(`Unsupported Slack channel meta lookup: ${id}`);
|
|
20
|
-
return SLACK_CHANNEL_META;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region extensions/slack/src/client-options.ts
|
|
24
|
-
const SLACK_DEFAULT_RETRY_OPTIONS = {
|
|
25
|
-
retries: 2,
|
|
26
|
-
factor: 2,
|
|
27
|
-
minTimeout: 500,
|
|
28
|
-
maxTimeout: 3e3,
|
|
29
|
-
randomize: true
|
|
30
|
-
};
|
|
31
|
-
const SLACK_WRITE_RETRY_OPTIONS = { retries: 0 };
|
|
32
|
-
const SLACK_LOOKUP_TIMEOUT_MS = 3e4;
|
|
33
|
-
const SLACK_LOOKUP_RETRY_OPTIONS = { retries: 0 };
|
|
34
|
-
/**
|
|
35
|
-
* Build an HTTPS proxy agent from env vars (HTTPS_PROXY, HTTP_PROXY, etc.)
|
|
36
|
-
* for use as the `agent` option in Slack WebClient and Socket Mode connections.
|
|
37
|
-
*
|
|
38
|
-
* When set, this agent is forwarded through @slack/bolt -> @slack/socket-mode ->
|
|
39
|
-
* SlackWebSocket as the `httpAgent`, which the `ws` library uses to tunnel the
|
|
40
|
-
* WebSocket upgrade request through the proxy. This fixes Socket Mode in
|
|
41
|
-
* environments where outbound traffic must go through an HTTP CONNECT proxy.
|
|
42
|
-
*
|
|
43
|
-
* Respects `NO_PROXY` / `no_proxy`; if `*.slack.com` (or a matching pattern)
|
|
44
|
-
* appears in the exclusion list, returns `undefined` so the connection is direct.
|
|
45
|
-
*
|
|
46
|
-
* Returns `undefined` when no proxy env var is configured or when Slack hosts
|
|
47
|
-
* are excluded by `NO_PROXY`.
|
|
48
|
-
*/
|
|
49
|
-
function resolveSlackProxyAgent(targetUrl) {
|
|
50
|
-
try {
|
|
51
|
-
return createNodeProxyAgent({
|
|
52
|
-
mode: "env",
|
|
53
|
-
targetUrl
|
|
54
|
-
});
|
|
55
|
-
} catch {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function resolveSlackApiUrlFromEnv() {
|
|
60
|
-
return process.env.SLACK_API_URL?.trim() || void 0;
|
|
61
|
-
}
|
|
62
|
-
function applySlackApiUrlAndProxyOptions(options) {
|
|
63
|
-
const slackApiUrl = options.slackApiUrl ?? resolveSlackApiUrlFromEnv();
|
|
64
|
-
options.agent ??= resolveSlackProxyAgent(slackApiUrl ?? "https://slack.com/");
|
|
65
|
-
if (slackApiUrl !== void 0) options.slackApiUrl = slackApiUrl;
|
|
66
|
-
else delete options.slackApiUrl;
|
|
67
|
-
}
|
|
68
|
-
function resolveSlackWebClientOptions(options = {}) {
|
|
69
|
-
const resolved = Object.assign({}, options);
|
|
70
|
-
applySlackApiUrlAndProxyOptions(resolved);
|
|
71
|
-
resolved.retryConfig ??= SLACK_DEFAULT_RETRY_OPTIONS;
|
|
72
|
-
return resolved;
|
|
73
|
-
}
|
|
74
|
-
function resolveSlackWriteClientOptions(options = {}) {
|
|
75
|
-
const resolved = Object.assign({}, options);
|
|
76
|
-
applySlackApiUrlAndProxyOptions(resolved);
|
|
77
|
-
resolved.retryConfig ??= SLACK_WRITE_RETRY_OPTIONS;
|
|
78
|
-
return resolved;
|
|
79
|
-
}
|
|
80
|
-
function resolveSlackLookupClientOptions(options = {}) {
|
|
81
|
-
const resolved = Object.assign({}, options);
|
|
82
|
-
applySlackApiUrlAndProxyOptions(resolved);
|
|
83
|
-
resolved.rejectRateLimitedCalls = true;
|
|
84
|
-
resolved.retryConfig = SLACK_LOOKUP_RETRY_OPTIONS;
|
|
85
|
-
resolved.timeout ??= SLACK_LOOKUP_TIMEOUT_MS;
|
|
86
|
-
return resolved;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region extensions/slack/src/client.ts
|
|
90
|
-
const SLACK_WRITE_CLIENT_CACHE_MAX = 32;
|
|
91
|
-
const slackWriteClientCache = /* @__PURE__ */ new Map();
|
|
92
|
-
let slackListenerUploadCompletionClientCache = /* @__PURE__ */ new WeakMap();
|
|
93
|
-
function createSlackWebClient(token, options = {}) {
|
|
94
|
-
return new WebClient(token, resolveSlackWebClientOptions(options));
|
|
95
|
-
}
|
|
96
|
-
function createSlackStartupAuthClient(token, options = {}) {
|
|
97
|
-
return createSlackWebClient(token, {
|
|
98
|
-
...options,
|
|
99
|
-
rejectRateLimitedCalls: true,
|
|
100
|
-
retryConfig: { retries: 0 },
|
|
101
|
-
timeout: 1e4
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function createSlackLookupClient(token, options = {}) {
|
|
105
|
-
return new WebClient(token, resolveSlackLookupClientOptions(options));
|
|
106
|
-
}
|
|
107
|
-
function createSlackWriteClient(token, options = {}) {
|
|
108
|
-
return new WebClient(token, resolveSlackWriteClientOptions(options));
|
|
109
|
-
}
|
|
110
|
-
function createSlackTokenCacheKey(token) {
|
|
111
|
-
return `sha256:${createHash("sha256").update(token).digest("base64url")}`;
|
|
112
|
-
}
|
|
113
|
-
function slackWriteClientCacheKey(token, options) {
|
|
114
|
-
const tokenKey = createSlackTokenCacheKey(token);
|
|
115
|
-
return options.slackApiUrl ? `${tokenKey}:api:${options.slackApiUrl}` : tokenKey;
|
|
116
|
-
}
|
|
117
|
-
function getSlackWriteClient(token, options = {}) {
|
|
118
|
-
const resolvedOptions = resolveSlackWriteClientOptions(options);
|
|
119
|
-
const tokenKey = slackWriteClientCacheKey(token, resolvedOptions);
|
|
120
|
-
const cached = slackWriteClientCache.get(tokenKey);
|
|
121
|
-
if (cached) {
|
|
122
|
-
slackWriteClientCache.delete(tokenKey);
|
|
123
|
-
slackWriteClientCache.set(tokenKey, cached);
|
|
124
|
-
return cached;
|
|
125
|
-
}
|
|
126
|
-
const client = new WebClient(token, resolvedOptions);
|
|
127
|
-
if (slackWriteClientCache.size >= SLACK_WRITE_CLIENT_CACHE_MAX) {
|
|
128
|
-
const oldestTokenKey = slackWriteClientCache.keys().next().value;
|
|
129
|
-
if (oldestTokenKey) slackWriteClientCache.delete(oldestTokenKey);
|
|
130
|
-
}
|
|
131
|
-
slackWriteClientCache.set(tokenKey, client);
|
|
132
|
-
return client;
|
|
133
|
-
}
|
|
134
|
-
function getSlackListenerUploadCompletionClient(params) {
|
|
135
|
-
const token = params.listenerClient.token?.trim();
|
|
136
|
-
const teamId = params.teamId.trim().toUpperCase();
|
|
137
|
-
if (!token || !teamId) return;
|
|
138
|
-
const cached = slackListenerUploadCompletionClientCache.get(params.listenerClient);
|
|
139
|
-
if (cached) return cached.teamId === teamId ? cached.client : void 0;
|
|
140
|
-
const headers = Object.fromEntries(Object.entries(params.clientOptions?.headers ?? {}).filter(([name]) => name.toLowerCase() !== "authorization"));
|
|
141
|
-
const client = new WebClient(token, resolveSlackWriteClientOptions({
|
|
142
|
-
...params.clientOptions,
|
|
143
|
-
headers,
|
|
144
|
-
slackApiUrl: params.listenerClient.slackApiUrl,
|
|
145
|
-
teamId,
|
|
146
|
-
retryConfig: SLACK_WRITE_RETRY_OPTIONS,
|
|
147
|
-
timeout: 0
|
|
148
|
-
}));
|
|
149
|
-
slackListenerUploadCompletionClientCache.set(params.listenerClient, {
|
|
150
|
-
teamId,
|
|
151
|
-
client
|
|
152
|
-
});
|
|
153
|
-
return client;
|
|
154
|
-
}
|
|
155
|
-
function clearSlackWriteClientCacheForTest() {
|
|
156
|
-
slackWriteClientCache.clear();
|
|
157
|
-
slackListenerUploadCompletionClientCache = /* @__PURE__ */ new WeakMap();
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
export { resolveConfiguredFromRequiredCredentialStatuses as _, createSlackWebClient as a, getSlackWriteClient as c, resolveSlackWebClientOptions as d, resolveSlackWriteClientOptions as f, projectCredentialSnapshotFields as g, getChatChannelMeta as h, createSlackTokenCacheKey as i, SLACK_DEFAULT_RETRY_OPTIONS as l, PAIRING_APPROVED_MESSAGE as m, createSlackLookupClient as n, createSlackWriteClient as o, DEFAULT_ACCOUNT_ID$1 as p, createSlackStartupAuthClient as r, getSlackListenerUploadCompletionClient as s, clearSlackWriteClientCacheForTest as t, SLACK_WRITE_RETRY_OPTIONS as u };
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { n as resolveSlackNativeStreaming, r as resolveSlackStreamingMode } from "./streaming-compat-3_X-21wW.js";
|
|
2
|
-
import { asObjectRecord, defineChannelAliasMigration } from "openclaw/plugin-sdk/runtime-doctor";
|
|
3
|
-
//#region extensions/slack/src/doctor-contract.ts
|
|
4
|
-
const streamingAliasMigration = defineChannelAliasMigration({
|
|
5
|
-
channelId: "slack",
|
|
6
|
-
streaming: {
|
|
7
|
-
defaultMode: "partial",
|
|
8
|
-
resolveMode: resolveSlackStreamingMode,
|
|
9
|
-
resolveNativeTransport: resolveSlackNativeStreaming
|
|
10
|
-
},
|
|
11
|
-
dm: {
|
|
12
|
-
root: true,
|
|
13
|
-
accounts: true
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
function hasLegacySlackChannelAllowAlias(value) {
|
|
17
|
-
const channels = asObjectRecord(asObjectRecord(value)?.channels);
|
|
18
|
-
if (!channels) return false;
|
|
19
|
-
return Object.values(channels).some((channel) => Object.hasOwn(asObjectRecord(channel) ?? {}, "allow"));
|
|
20
|
-
}
|
|
21
|
-
function normalizeSlackChannelAllowAliases(params) {
|
|
22
|
-
let changed = false;
|
|
23
|
-
const nextChannels = { ...params.channels };
|
|
24
|
-
for (const [channelId, channelValue] of Object.entries(params.channels)) {
|
|
25
|
-
const channel = asObjectRecord(channelValue);
|
|
26
|
-
if (!channel || !Object.hasOwn(channel, "allow")) continue;
|
|
27
|
-
const nextChannel = { ...channel };
|
|
28
|
-
if (nextChannel.enabled === void 0) {
|
|
29
|
-
nextChannel.enabled = channel.allow;
|
|
30
|
-
params.changes.push(`Moved ${params.pathPrefix}.${channelId}.allow → ${params.pathPrefix}.${channelId}.enabled.`);
|
|
31
|
-
} else params.changes.push(`Removed ${params.pathPrefix}.${channelId}.allow (${params.pathPrefix}.${channelId}.enabled already set).`);
|
|
32
|
-
delete nextChannel.allow;
|
|
33
|
-
nextChannels[channelId] = nextChannel;
|
|
34
|
-
changed = true;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
channels: nextChannels,
|
|
38
|
-
changed
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const legacyConfigRules = [
|
|
42
|
-
...streamingAliasMigration.legacyConfigRules,
|
|
43
|
-
{
|
|
44
|
-
path: ["channels", "slack"],
|
|
45
|
-
message: "channels.slack.channels.<id>.allow is legacy; use channels.slack.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
46
|
-
match: hasLegacySlackChannelAllowAlias
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
path: [
|
|
50
|
-
"channels",
|
|
51
|
-
"slack",
|
|
52
|
-
"accounts"
|
|
53
|
-
],
|
|
54
|
-
message: "channels.slack.accounts.<id>.channels.<id>.allow is legacy; use channels.slack.accounts.<id>.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
55
|
-
match: (value) => {
|
|
56
|
-
const accounts = asObjectRecord(value);
|
|
57
|
-
if (!accounts) return false;
|
|
58
|
-
return Object.values(accounts).some((account) => hasLegacySlackChannelAllowAlias(account));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
function normalizeCompatibilityConfig({ cfg }) {
|
|
63
|
-
const changes = [];
|
|
64
|
-
const aliases = streamingAliasMigration.normalizeChannelConfig({
|
|
65
|
-
cfg,
|
|
66
|
-
changes
|
|
67
|
-
});
|
|
68
|
-
const rawEntry = asObjectRecord(aliases.config.channels?.slack);
|
|
69
|
-
if (!rawEntry) return {
|
|
70
|
-
config: cfg,
|
|
71
|
-
changes: []
|
|
72
|
-
};
|
|
73
|
-
let updated = rawEntry;
|
|
74
|
-
let changed = aliases.config !== cfg;
|
|
75
|
-
const channels = asObjectRecord(updated.channels);
|
|
76
|
-
if (channels) {
|
|
77
|
-
const normalized = normalizeSlackChannelAllowAliases({
|
|
78
|
-
channels,
|
|
79
|
-
pathPrefix: "channels.slack.channels",
|
|
80
|
-
changes
|
|
81
|
-
});
|
|
82
|
-
if (normalized.changed) {
|
|
83
|
-
updated = {
|
|
84
|
-
...updated,
|
|
85
|
-
channels: normalized.channels
|
|
86
|
-
};
|
|
87
|
-
changed = true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const accounts = asObjectRecord(updated.accounts);
|
|
91
|
-
if (accounts) {
|
|
92
|
-
let accountsChanged = false;
|
|
93
|
-
const nextAccounts = { ...accounts };
|
|
94
|
-
for (const [accountId, accountValue] of Object.entries(accounts)) {
|
|
95
|
-
const account = asObjectRecord(accountValue);
|
|
96
|
-
const channelEntries = asObjectRecord(account?.channels);
|
|
97
|
-
if (!account || !channelEntries) continue;
|
|
98
|
-
const normalized = normalizeSlackChannelAllowAliases({
|
|
99
|
-
channels: channelEntries,
|
|
100
|
-
pathPrefix: `channels.slack.accounts.${accountId}.channels`,
|
|
101
|
-
changes
|
|
102
|
-
});
|
|
103
|
-
if (!normalized.changed) continue;
|
|
104
|
-
nextAccounts[accountId] = {
|
|
105
|
-
...account,
|
|
106
|
-
channels: normalized.channels
|
|
107
|
-
};
|
|
108
|
-
accountsChanged = true;
|
|
109
|
-
}
|
|
110
|
-
if (accountsChanged) {
|
|
111
|
-
updated = {
|
|
112
|
-
...updated,
|
|
113
|
-
accounts: nextAccounts
|
|
114
|
-
};
|
|
115
|
-
changed = true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (!changed) return {
|
|
119
|
-
config: cfg,
|
|
120
|
-
changes: []
|
|
121
|
-
};
|
|
122
|
-
return {
|
|
123
|
-
config: {
|
|
124
|
-
...aliases.config,
|
|
125
|
-
channels: {
|
|
126
|
-
...aliases.config.channels,
|
|
127
|
-
slack: updated
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
changes
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
//#endregion
|
|
134
|
-
export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
|
package/dist/probe-CN0ssfLN.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { d as formatSlackBotTokenIdentityWarning } from "./accounts-BOJJiHSr.js";
|
|
3
|
-
import { i as formatSlackError } from "./group-policy-85UWiriS.js";
|
|
4
|
-
import { a as createSlackWebClient } from "./client-WIPAS3Yr.js";
|
|
5
|
-
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
|
-
//#region extensions/slack/src/probe.ts
|
|
7
|
-
var probe_exports = /* @__PURE__ */ __exportAll({ probeSlack: () => probeSlack });
|
|
8
|
-
async function probeSlack(token, timeoutMs = 2500, opts) {
|
|
9
|
-
const client = createSlackWebClient(token);
|
|
10
|
-
const start = Date.now();
|
|
11
|
-
try {
|
|
12
|
-
const result = await withTimeout(client.auth.test(), timeoutMs);
|
|
13
|
-
if (!result.ok) return {
|
|
14
|
-
ok: false,
|
|
15
|
-
status: 200,
|
|
16
|
-
error: result.error ?? "unknown",
|
|
17
|
-
elapsedMs: Date.now() - start
|
|
18
|
-
};
|
|
19
|
-
const warning = formatSlackBotTokenIdentityWarning({
|
|
20
|
-
auth: result,
|
|
21
|
-
accountId: opts?.accountId
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
ok: true,
|
|
25
|
-
status: 200,
|
|
26
|
-
elapsedMs: Date.now() - start,
|
|
27
|
-
bot: {
|
|
28
|
-
id: result.user_id,
|
|
29
|
-
name: result.user
|
|
30
|
-
},
|
|
31
|
-
team: {
|
|
32
|
-
id: result.team_id,
|
|
33
|
-
name: result.team
|
|
34
|
-
},
|
|
35
|
-
...warning ? { warning } : {}
|
|
36
|
-
};
|
|
37
|
-
} catch (err) {
|
|
38
|
-
const message = formatSlackError(err);
|
|
39
|
-
return {
|
|
40
|
-
ok: false,
|
|
41
|
-
status: typeof err.statusCode === "number" ? err.statusCode : null,
|
|
42
|
-
error: message,
|
|
43
|
-
elapsedMs: Date.now() - start
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { probe_exports as n, probeSlack as t };
|