dsh-slack 0.2.0 → 0.2.1
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/lib/config.d.ts +2 -0
- package/lib/config.js +2 -1
- package/lib/index.js +1 -1
- package/lib/slack-client.d.ts +1 -1
- package/lib/slack-client.js +2 -2
- package/package.json +57 -56
package/lib/config.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface SlackConfig {
|
|
|
10
10
|
defaultChannel: string;
|
|
11
11
|
/** App-Level Token(xapp- 开头),用于 Socket Mode 接收消息。 */
|
|
12
12
|
appToken: string;
|
|
13
|
+
/** Slack Web API 基地址;默认官方 https://slack.com/api/。企业网格(Enterprise Grid)与本地协议级测试可覆盖。 */
|
|
14
|
+
slackApiUrl?: string;
|
|
13
15
|
}
|
|
14
16
|
/** token 的环境变量名。 */
|
|
15
17
|
export declare const ENV_TOKEN = "DSH_SLACK_TOKEN";
|
package/lib/config.js
CHANGED
|
@@ -20,7 +20,8 @@ export function parseConfig(raw) {
|
|
|
20
20
|
const token = typeof obj.token === 'string' ? obj.token.trim() : '';
|
|
21
21
|
const defaultChannel = typeof obj.defaultChannel === 'string' ? obj.defaultChannel.trim() : '';
|
|
22
22
|
const appToken = typeof obj.appToken === 'string' ? obj.appToken.trim() : '';
|
|
23
|
-
|
|
23
|
+
const slackApiUrl = typeof obj.slackApiUrl === 'string' && obj.slackApiUrl.trim() !== '' ? obj.slackApiUrl.trim() : undefined;
|
|
24
|
+
return { token, defaultChannel, appToken, ...(slackApiUrl !== undefined ? { slackApiUrl } : {}) };
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* 解析 token:config.token 优先,其次环境变量 DSH_SLACK_TOKEN。
|
package/lib/index.js
CHANGED
|
@@ -60,7 +60,7 @@ export function apply(ctx, rawConfig) {
|
|
|
60
60
|
// 每次调用时重新解析配置(config.token 优先,环境变量回退),并懒创建客户端。
|
|
61
61
|
const current = parseConfig(rawConfig);
|
|
62
62
|
const token = requireToken(current);
|
|
63
|
-
return createWebSlackClient(token);
|
|
63
|
+
return createWebSlackClient(token, current?.slackApiUrl);
|
|
64
64
|
};
|
|
65
65
|
const inboxProvider = () => inboxQueue;
|
|
66
66
|
const deps = { clientProvider, configProvider, inboxProvider };
|
package/lib/slack-client.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface SlackClient {
|
|
|
23
23
|
listChannels(): Promise<ChannelInfo[]>;
|
|
24
24
|
}
|
|
25
25
|
/** 用官方 WebClient 实现。 */
|
|
26
|
-
export declare function createWebSlackClient(token: string): SlackClient;
|
|
26
|
+
export declare function createWebSlackClient(token: string, slackApiUrl?: string): SlackClient;
|
|
27
27
|
/**
|
|
28
28
|
* 把 Slack API 错误映射为全中文提示。
|
|
29
29
|
*/
|
package/lib/slack-client.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { WebClient } from '@slack/web-api';
|
|
6
6
|
/** 用官方 WebClient 实现。 */
|
|
7
|
-
export function createWebSlackClient(token) {
|
|
8
|
-
const client = new WebClient(token);
|
|
7
|
+
export function createWebSlackClient(token, slackApiUrl) {
|
|
8
|
+
const client = new WebClient(token, { ...(slackApiUrl !== undefined && slackApiUrl !== '' ? { slackApiUrl } : {}) });
|
|
9
9
|
return {
|
|
10
10
|
async postMessage(params) {
|
|
11
11
|
const result = await client.chat.postMessage({
|
package/package.json
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-slack",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "DSH 社区插件:Slack 通知/桥接(v0.2 支持 Socket Mode 双向:收件箱 + 线程回复)",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"types": "./lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/index.d.ts",
|
|
11
|
-
"default": "./lib/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./package.json": "./package.json",
|
|
14
|
-
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"lib",
|
|
18
|
-
"cordis.patch.yml",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"dsh": {
|
|
23
|
-
"bundle": {
|
|
24
|
-
"patch": "./cordis.patch.yml"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc -p tsconfig.json",
|
|
29
|
-
"prepare": "tsc -p tsconfig.json",
|
|
30
|
-
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
31
|
-
"prepublishOnly": "pnpm run build"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"@slack/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-slack",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "DSH 社区插件:Slack 通知/桥接(v0.2 支持 Socket Mode 双向:收件箱 + 线程回复)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"cordis.patch.yml",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dsh": {
|
|
23
|
+
"bundle": {
|
|
24
|
+
"patch": "./cordis.patch.yml"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"prepare": "tsc -p tsconfig.json",
|
|
30
|
+
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
31
|
+
"prepublishOnly": "pnpm run build",
|
|
32
|
+
"test:protocol": "node test/protocol-acceptance.mjs"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@slack/socket-mode": "^3.0.0",
|
|
36
|
+
"@slack/web-api": "^8.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^24.0.0",
|
|
40
|
+
"typescript": "^5.7.3"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"url": "https://github.com/STARDUSTLC666/dsh-slack",
|
|
44
|
+
"type": "git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/STARDUSTLC666/dsh-slack/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/STARDUSTLC666/dsh-slack#readme",
|
|
50
|
+
"author": "stardustlc",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"dsh-plugin",
|
|
53
|
+
"deepseek-harness",
|
|
54
|
+
"dsh"
|
|
55
|
+
],
|
|
56
|
+
"packageManager": "pnpm@11.7.0"
|
|
57
|
+
}
|