@nextclaw/channel-extension-slack 0.1.1-beta.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NextClaw contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/main.js ADDED
@@ -0,0 +1,12 @@
1
+ import { SlackChannel } from "./services/slack-channel.service.js";
2
+ import { startBusChannelExtension, warnNcpEventError } from "@nextclaw/extension-sdk";
3
+ //#region src/main.ts
4
+ await startBusChannelExtension({
5
+ channelId: "slack",
6
+ createChannel: ({ config, bus }) => new SlackChannel(config, bus),
7
+ onChannelStartError: warnNcpEventError("slack")
8
+ });
9
+ //#endregion
10
+ export {};
11
+
12
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["import type { Config, MessageBus } from \"@nextclaw/core\";\nimport { startBusChannelExtension, warnNcpEventError } from \"@nextclaw/extension-sdk\";\nimport { SlackChannel } from \"./services/slack-channel.service.js\";\n\nawait startBusChannelExtension<Config[\"channels\"][\"slack\"], MessageBus>({\n channelId: \"slack\",\n createChannel: ({ config, bus }) => new SlackChannel(config, bus),\n onChannelStartError: warnNcpEventError(\"slack\"),\n});\n"],"mappings":";;;AAIA,MAAM,yBAAkE;CACtE,WAAW;CACX,gBAAgB,EAAE,QAAQ,UAAU,IAAI,aAAa,QAAQ,IAAI;CACjE,qBAAqB,kBAAkB,QAAQ;CAChD,CAAC"}
@@ -0,0 +1,148 @@
1
+ import { BaseChannel } from "@nextclaw/core";
2
+ import { WebClient } from "@slack/web-api";
3
+ import { SocketModeClient } from "@slack/socket-mode";
4
+ //#region src/services/slack-channel.service.ts
5
+ var SlackChannel = class extends BaseChannel {
6
+ name = "slack";
7
+ webClient = null;
8
+ socketClient = null;
9
+ botUserId = null;
10
+ botId = null;
11
+ constructor(config, bus) {
12
+ super(config, bus);
13
+ }
14
+ start = async () => {
15
+ if (!this.config.botToken || !this.config.appToken) throw new Error("Slack bot/app token not configured");
16
+ if (this.config.mode !== "socket") throw new Error(`Unsupported Slack mode: ${this.config.mode}`);
17
+ this.running = true;
18
+ this.webClient = new WebClient(this.config.botToken);
19
+ this.socketClient = new SocketModeClient({ appToken: this.config.appToken });
20
+ this.socketClient.on("events_api", async ({ body, ack }) => {
21
+ await ack();
22
+ await this.handleEvent(body?.event);
23
+ });
24
+ try {
25
+ const auth = await this.webClient.auth.test();
26
+ this.botUserId = auth.user_id ?? null;
27
+ this.botId = auth.bot_id ?? null;
28
+ } catch {
29
+ this.botUserId = null;
30
+ this.botId = null;
31
+ }
32
+ await this.socketClient.start();
33
+ };
34
+ stop = async () => {
35
+ this.running = false;
36
+ if (this.socketClient) {
37
+ await this.socketClient.disconnect();
38
+ this.socketClient = null;
39
+ }
40
+ this.botUserId = null;
41
+ this.botId = null;
42
+ };
43
+ send = async (msg) => {
44
+ if (!this.webClient) return;
45
+ const slackMeta = msg.metadata?.slack ?? {};
46
+ const threadTs = slackMeta.thread_ts;
47
+ const channelType = slackMeta.channel_type;
48
+ const useThread = Boolean(threadTs && channelType !== "im");
49
+ await this.webClient.chat.postMessage({
50
+ channel: msg.chatId,
51
+ text: msg.content ?? "",
52
+ thread_ts: useThread ? threadTs : void 0
53
+ });
54
+ };
55
+ handleEvent = async (event) => {
56
+ const context = this.resolveEventContext(event);
57
+ if (!context) return;
58
+ const { senderId, chatId, channelType, text, eventTs } = context;
59
+ if (!this.shouldDispatchEvent(context)) return;
60
+ const cleanText = this.stripBotMention(text);
61
+ const threadTs = event?.thread_ts ?? eventTs;
62
+ await this.addAckReaction(chatId, eventTs);
63
+ await this.handleMessage({
64
+ senderId,
65
+ chatId,
66
+ content: cleanText,
67
+ attachments: [],
68
+ metadata: { slack: {
69
+ event,
70
+ thread_ts: threadTs,
71
+ channel_type: channelType
72
+ } }
73
+ });
74
+ };
75
+ resolveEventContext = (event) => {
76
+ if (!event) return null;
77
+ const eventType = event.type;
78
+ if (eventType !== "message" && eventType !== "app_mention") return null;
79
+ const subtype = event.subtype;
80
+ const botId = event.bot_id;
81
+ const isBotMessage = subtype === "bot_message" || Boolean(botId);
82
+ if (subtype && subtype !== "bot_message") return null;
83
+ if (isBotMessage && !this.config.allowBots) return null;
84
+ const senderId = event.user ?? (isBotMessage ? botId : void 0);
85
+ const chatId = event.channel;
86
+ const channelType = event.channel_type ?? "";
87
+ const text = event.text ?? "";
88
+ if (!senderId || !chatId) return null;
89
+ return {
90
+ event,
91
+ eventType,
92
+ subtype,
93
+ botId,
94
+ isBotMessage,
95
+ senderId,
96
+ chatId,
97
+ channelType,
98
+ text,
99
+ eventTs: event.ts
100
+ };
101
+ };
102
+ shouldDispatchEvent = (context) => {
103
+ const { event, eventType, botId, isBotMessage, senderId, chatId, channelType, text } = context;
104
+ if (this.botUserId && event.user === this.botUserId) return false;
105
+ if (this.botId && botId && botId === this.botId) return false;
106
+ if (eventType === "message" && !isBotMessage && this.botUserId && text.includes(`<@${this.botUserId}>`)) return false;
107
+ if (!this.isAllowedInSlack(senderId, chatId, channelType)) return false;
108
+ if (channelType !== "im" && !this.shouldRespondInChannel(eventType, text, chatId)) return false;
109
+ return true;
110
+ };
111
+ addAckReaction = async (chatId, eventTs) => {
112
+ if (!this.webClient || !eventTs) return;
113
+ try {
114
+ await this.webClient.reactions.add({
115
+ channel: chatId,
116
+ name: "eyes",
117
+ timestamp: eventTs
118
+ });
119
+ } catch {}
120
+ };
121
+ isAllowedInSlack = (senderId, chatId, channelType) => {
122
+ if (channelType === "im") {
123
+ if (!this.config.dm.enabled) return false;
124
+ if (this.config.dm.policy === "allowlist") return this.config.dm.allowFrom.includes(senderId);
125
+ return true;
126
+ }
127
+ if (this.config.groupPolicy === "allowlist") return this.config.groupAllowFrom.includes(chatId);
128
+ return true;
129
+ };
130
+ shouldRespondInChannel = (eventType, text, chatId) => {
131
+ if (this.config.groupPolicy === "open") return true;
132
+ if (this.config.groupPolicy === "mention") {
133
+ if (eventType === "app_mention") return true;
134
+ return this.botUserId ? text.includes(`<@${this.botUserId}>`) : false;
135
+ }
136
+ if (this.config.groupPolicy === "allowlist") return this.config.groupAllowFrom.includes(chatId);
137
+ return false;
138
+ };
139
+ stripBotMention = (text) => {
140
+ if (!text || !this.botUserId) return text;
141
+ const pattern = new RegExp(`<@${this.botUserId}>\\s*`, "g");
142
+ return text.replace(pattern, "").trim();
143
+ };
144
+ };
145
+ //#endregion
146
+ export { SlackChannel };
147
+
148
+ //# sourceMappingURL=slack-channel.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack-channel.service.js","names":[],"sources":["../../src/services/slack-channel.service.ts"],"sourcesContent":["import { BaseChannel, type Config, type MessageBus, type OutboundMessage } from \"@nextclaw/core\";\nimport { WebClient } from \"@slack/web-api\";\nimport { SocketModeClient } from \"@slack/socket-mode\";\nexport class SlackChannel extends BaseChannel<Config[\"channels\"][\"slack\"]> {\n name = \"slack\";\n private webClient: WebClient | null = null;\n private socketClient: SocketModeClient | null = null;\n private botUserId: string | null = null;\n private botId: string | null = null;\n constructor(config: Config[\"channels\"][\"slack\"], bus: MessageBus) {\n super(config, bus);\n }\n start = async (): Promise<void> => {\n if (!this.config.botToken || !this.config.appToken) {\n throw new Error(\"Slack bot/app token not configured\");\n }\n if (this.config.mode !== \"socket\") {\n throw new Error(`Unsupported Slack mode: ${this.config.mode}`);\n }\n this.running = true;\n this.webClient = new WebClient(this.config.botToken);\n this.socketClient = new SocketModeClient({\n appToken: this.config.appToken\n });\n this.socketClient.on(\"events_api\", async ({ body, ack }) => {\n await ack();\n await this.handleEvent(body?.event);\n });\n try {\n const auth = await this.webClient.auth.test();\n this.botUserId = auth.user_id ?? null;\n this.botId = (auth as {\n bot_id?: string;\n }).bot_id ?? null;\n }\n catch {\n this.botUserId = null;\n this.botId = null;\n }\n await this.socketClient.start();\n };\n stop = async (): Promise<void> => {\n this.running = false;\n if (this.socketClient) {\n await this.socketClient.disconnect();\n this.socketClient = null;\n }\n this.botUserId = null;\n this.botId = null;\n };\n send = async (msg: OutboundMessage): Promise<void> => {\n if (!this.webClient) {\n return;\n }\n const slackMeta = (msg.metadata?.slack as Record<string, unknown>) ?? {};\n const threadTs = slackMeta.thread_ts as string | undefined;\n const channelType = slackMeta.channel_type as string | undefined;\n const useThread = Boolean(threadTs && channelType !== \"im\");\n await this.webClient.chat.postMessage({\n channel: msg.chatId,\n text: msg.content ?? \"\",\n thread_ts: useThread ? threadTs : undefined\n });\n };\n private handleEvent = async (event: Record<string, unknown> | undefined): Promise<void> => {\n const context = this.resolveEventContext(event);\n if (!context) {\n return;\n }\n const { senderId, chatId, channelType, text, eventTs } = context;\n if (!this.shouldDispatchEvent(context)) {\n return;\n }\n const cleanText = this.stripBotMention(text);\n const threadTs = (event?.thread_ts as string | undefined) ?? eventTs;\n await this.addAckReaction(chatId, eventTs);\n await this.handleMessage({\n senderId,\n chatId,\n content: cleanText,\n attachments: [],\n metadata: {\n slack: {\n event,\n thread_ts: threadTs,\n channel_type: channelType\n }\n }\n });\n };\n private resolveEventContext = (event: Record<string, unknown> | undefined): {\n event: Record<string, unknown>;\n eventType: string;\n subtype?: string;\n botId?: string;\n isBotMessage: boolean;\n senderId: string;\n chatId: string;\n channelType: string;\n text: string;\n eventTs?: string;\n } | null => {\n if (!event) {\n return null;\n }\n const eventType = event.type as string | undefined;\n if (eventType !== \"message\" && eventType !== \"app_mention\") {\n return null;\n }\n const subtype = event.subtype as string | undefined;\n const botId = event.bot_id as string | undefined;\n const isBotMessage = subtype === \"bot_message\" || Boolean(botId);\n if (subtype && subtype !== \"bot_message\") {\n return null;\n }\n if (isBotMessage && !this.config.allowBots) {\n return null;\n }\n const senderId = (event.user as string | undefined) ?? (isBotMessage ? botId : undefined);\n const chatId = event.channel as string | undefined;\n const channelType = (event.channel_type as string | undefined) ?? \"\";\n const text = (event.text as string | undefined) ?? \"\";\n if (!senderId || !chatId) {\n return null;\n }\n return { event, eventType, subtype, botId, isBotMessage, senderId, chatId, channelType, text, eventTs: event.ts as string | undefined };\n };\n private shouldDispatchEvent = (context: {\n event: Record<string, unknown>;\n eventType: string;\n botId?: string;\n isBotMessage: boolean;\n senderId: string;\n chatId: string;\n channelType: string;\n text: string;\n }): boolean => {\n const { event, eventType, botId, isBotMessage, senderId, chatId, channelType, text } = context;\n if (this.botUserId && event.user === this.botUserId) {\n return false;\n }\n if (this.botId && botId && botId === this.botId) {\n return false;\n }\n if (eventType === \"message\" && !isBotMessage && this.botUserId && text.includes(`<@${this.botUserId}>`)) {\n return false;\n }\n if (!this.isAllowedInSlack(senderId, chatId, channelType)) {\n return false;\n }\n if (channelType !== \"im\" && !this.shouldRespondInChannel(eventType, text, chatId)) {\n return false;\n }\n return true;\n };\n private addAckReaction = async (chatId: string, eventTs?: string): Promise<void> => {\n if (!this.webClient || !eventTs) {\n return;\n }\n try {\n await this.webClient.reactions.add({\n channel: chatId,\n name: \"eyes\",\n timestamp: eventTs\n });\n }\n catch {\n // ignore reaction errors\n }\n };\n private isAllowedInSlack = (senderId: string, chatId: string, channelType: string): boolean => {\n if (channelType === \"im\") {\n if (!this.config.dm.enabled) {\n return false;\n }\n if (this.config.dm.policy === \"allowlist\") {\n return this.config.dm.allowFrom.includes(senderId);\n }\n return true;\n }\n if (this.config.groupPolicy === \"allowlist\") {\n return this.config.groupAllowFrom.includes(chatId);\n }\n return true;\n };\n private shouldRespondInChannel = (eventType: string, text: string, chatId: string): boolean => {\n if (this.config.groupPolicy === \"open\") {\n return true;\n }\n if (this.config.groupPolicy === \"mention\") {\n if (eventType === \"app_mention\") {\n return true;\n }\n return this.botUserId ? text.includes(`<@${this.botUserId}>`) : false;\n }\n if (this.config.groupPolicy === \"allowlist\") {\n return this.config.groupAllowFrom.includes(chatId);\n }\n return false;\n };\n private stripBotMention = (text: string): string => {\n if (!text || !this.botUserId) {\n return text;\n }\n const pattern = new RegExp(`<@${this.botUserId}>\\\\s*`, \"g\");\n return text.replace(pattern, \"\").trim();\n };\n}\n"],"mappings":";;;;AAGA,IAAa,eAAb,cAAkC,YAAyC;CACvE,OAAO;CACP,YAAsC;CACtC,eAAgD;CAChD,YAAmC;CACnC,QAA+B;CAC/B,YAAY,QAAqC,KAAiB;AAC9D,QAAM,QAAQ,IAAI;;CAEtB,QAAQ,YAA2B;AAC/B,MAAI,CAAC,KAAK,OAAO,YAAY,CAAC,KAAK,OAAO,SACtC,OAAM,IAAI,MAAM,qCAAqC;AAEzD,MAAI,KAAK,OAAO,SAAS,SACrB,OAAM,IAAI,MAAM,2BAA2B,KAAK,OAAO,OAAO;AAElE,OAAK,UAAU;AACf,OAAK,YAAY,IAAI,UAAU,KAAK,OAAO,SAAS;AACpD,OAAK,eAA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;CAIV,oBAA4B,UAAkB,QAAgB,gBAAiC;AAC3F,MAAI,gBAAgB,MAAM;AACtB,OAAI,CAAC,KAAK,OAAO,GAAG,QAChB,QAAO;AAEX,OAAI,KAAK,OAAO,GAAG,WAAW,YAC1B,QAAO,KAAK,OAAO,GAAG,UAAU,SAAS,SAAS;AAEtD,UAAO;;AAEX,MAAI,KAAK,OAAO,gBAAgB,YAC5B,QAAO,KAAK,OAAO,eAAe,SAAS,OAAO;AAEtD,SAAO;;CAEX,0BAAkC,WAAmB,MAAc,WAA4B;AAC3F,MAAI,KAAK,OAAO,gBAAgB,OAC5B,QAAO;AAEX,MAAI,KAAK,OAAO,gBAAgB,WAAW;AACvC,OAAI,cAAc,cACd,QAAO;AAEX,UAAO,KAAK,YAAY,KAAK,SAAS,KAAK,KAAK,UAAU,GAAG,GAAG;;AAEpE,MAAI,KAAK,OAAO,gBAAgB,YAC5B,QAAO,KAAK,OAAO,eAAe,SAAS,OAAO;AAEtD,SAAO;;CAEX,mBAA2B,SAAyB;AAChD,MAAI,CAAC,QAAQ,CAAC,KAAK,UACf,QAAO;EAEX,MAAM,UAAU,IAAI,OAAO,KAAK,KAAK,UAAU,QAAQ,IAAI;AAC3D,SAAO,KAAK,QAAQ,SAAS,GAAG,CAAC,MAAM"}
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "nextclaw-channel-extension-slack",
3
+ "name": "NextClaw Slack Channel Extension",
4
+ "version": "0.1.0",
5
+ "server": {
6
+ "type": "stdio",
7
+ "command": "node",
8
+ "args": ["dist/main.js"]
9
+ },
10
+ "contributes": {
11
+ "channels": [
12
+ {
13
+ "id": "slack",
14
+ "name": "Slack",
15
+ "description": "Slack Socket Mode channel",
16
+ "configSchema": {
17
+ "type": "object",
18
+ "additionalProperties": true,
19
+ "properties": {
20
+ "enabled": { "type": "boolean" },
21
+ "mode": { "type": "string" },
22
+ "webhookPath": { "type": "string" },
23
+ "botToken": { "type": "string" },
24
+ "appToken": { "type": "string" },
25
+ "userTokenReadOnly": { "type": "boolean" },
26
+ "allowBots": { "type": "boolean" },
27
+ "groupPolicy": { "type": "string" },
28
+ "groupAllowFrom": {
29
+ "type": "array",
30
+ "items": { "type": "string" }
31
+ },
32
+ "dm": {
33
+ "type": "object",
34
+ "additionalProperties": true,
35
+ "properties": {
36
+ "enabled": { "type": "boolean" },
37
+ "policy": { "type": "string" },
38
+ "allowFrom": {
39
+ "type": "array",
40
+ "items": { "type": "string" }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@nextclaw/channel-extension-slack",
3
+ "version": "0.1.1-beta.0",
4
+ "private": false,
5
+ "description": "NextClaw Slack channel extension process.",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "development": "./src/index.ts",
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "nextclaw.extension.json"
18
+ ],
19
+ "dependencies": {
20
+ "@slack/socket-mode": "^1.3.3",
21
+ "@slack/web-api": "^7.6.0",
22
+ "@nextclaw/core": "0.12.25-beta.0",
23
+ "@nextclaw/extension-sdk": "0.1.12-beta.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.17.6",
27
+ "tsx": "^4.19.2",
28
+ "typescript": "^5.6.3"
29
+ },
30
+ "scripts": {
31
+ "build": "tsdown src/index.ts src/main.ts --dts.sourcemap --clean --target es2022 --no-fixedExtension --unbundle",
32
+ "lint": "eslint src --max-warnings=0",
33
+ "tsc": "tsc -p tsconfig.json"
34
+ }
35
+ }