@kadaliao/dsh-bots 0.4.0 → 0.6.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/README.md CHANGED
@@ -68,6 +68,10 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
68
68
  `~/.dsh/skills`, …); referenced, not copied, so they stay up to date;
69
69
  - **Import from GitHub**: browse Anthropic's skills in one click, or paste any `owner/repo/path`; the
70
70
  whole skill folder comes along, scripts included;
71
+ - **Add from a folder**: pick a skill folder on this machine (or a folder holding several, e.g.
72
+ `~/.claude/skills`); linked, not copied, so editing the folder is enough;
73
+ - a skill name is used once per bot: adding one that is already there is skipped, and importing again
74
+ from the same GitHub folder updates it in place;
71
75
  - **Let the bot write it**: describe what you need in a sentence; the bot writes it with skill-creator
72
76
  and saves it to itself;
73
77
  - writing one by hand is still possible, as the last resort.
@@ -80,7 +84,7 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
80
84
  | Category | Apps (🔑 = needs a key) |
81
85
  | --- | --- |
82
86
  | Sales & payments | Stripe 🔑, HubSpot CRM 🔑 |
83
- | Team & office | Telegram 🔑 and Discord 🔑 (chat apps, below), Feishu / Lark 🔑, Notion 🔑, Slack 🔑, Memory |
87
+ | Team & office | Feishu / Lark 🔑, Telegram 🔑, Slack 🔑 and Discord 🔑 (chat apps, below), Feishu / Lark Open Platform 🔑, Notion 🔑, Slack workspace 🔑, Memory |
84
88
  | Build & ship | GitHub 🔑, Git, Supabase 🔑, Sentry 🔑, Context7 Docs |
85
89
  | Research & content | Exa, Tavily 🔑, Brave 🔑, Firecrawl 🔑 |
86
90
  | Computer & browser | Open Computer Use (operate macOS apps), Playwright |
@@ -94,9 +98,9 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
94
98
  otherwise the logo from the vendor's site or repository). The logos are their owners' trademarks and
95
99
  only identify each service.
96
100
 
97
- ## Message your team from Telegram or Discord
101
+ ## Message your team from Feishu, Telegram, Slack or Discord
98
102
 
99
- Add **Telegram** or **Discord** to a bot (normally the dispatcher) in its **Apps** tab, and you can hand out
103
+ Add **Feishu / Lark**, **Telegram**, **Slack** or **Discord** to a bot (normally the dispatcher) in its **Apps** tab, and you can hand out
100
104
  work from your phone: what you send the chat bot goes to the team as if you typed it in the panel, and
101
105
  the replies come back to the chat, including the dispatcher's report once its teammates have answered.
102
106
 
@@ -126,6 +130,78 @@ the replies come back to the chat, including the dispatcher's report once its te
126
130
  (any server you are in, a private one is fine): Discord only lets you DM a bot you share a server with.
127
131
  3. DM the bot the pairing code, then DM it your requests, or @mention it in a channel.
128
132
 
133
+ ### Feishu / Lark
134
+
135
+ Feishu uses its long connection: the Harness connects out to Feishu, so your computer needs no public
136
+ address. The same steps work for Lark; the panel finds out which one your app belongs to.
137
+
138
+ 1. Open the developer console at https://open.feishu.cn/app (Lark: https://open.larksuite.com/app) and
139
+ **Create Custom App**.
140
+ 2. **Add Features** → **Bot**.
141
+ 3. **Permissions & Scopes** (**Batch import/export scopes** accepts the JSON below):
142
+ - required: `im:message.p2p_msg:readonly`, `im:message.group_at_msg:readonly`, `im:message:send_as_bot`
143
+ - optional: `contact:contact.base:readonly` + `contact:user.base:readonly` (sender names),
144
+ `im:message.reactions:write_only` (a "Typing" reaction while the team works), `im:chat:readonly` (group names)
145
+ 4. Copy the **App ID** and **App Secret** from **Credentials & Basic Info** into the bot's **Apps** →
146
+ **Feishu / Lark**, and save. The long connection comes up. If the panel asks you to turn on the bot,
147
+ that only means no version is published yet; the connection is already online.
148
+ 5. With the Harness running, go to **Events & Callbacks** → **Event Configuration**, set the subscription
149
+ mode to **Receive events through persistent connection** and save. The console only accepts this while
150
+ a connection is online.
151
+ 6. **Add Events** → `im.message.receive_v1`.
152
+ 7. **Version Management & Release** → create a version whose availability includes the people who will
153
+ use it, and publish (an admin may need to approve).
154
+ 8. In Feishu, open a chat with the bot (search for the app, or use **Open in Feishu** in the panel) and
155
+ send the pairing code. For a group, add the bot to the group and @ it.
156
+
157
+ Use an app made for this team only: when several programs connect with the same App ID, Feishu hands each
158
+ message to just one of them.
159
+
160
+ ```json
161
+ {"scopes":{"tenant":["im:message.p2p_msg:readonly","im:message.group_at_msg:readonly","im:message:send_as_bot","im:message.reactions:write_only","contact:contact.base:readonly","contact:user.base:readonly","im:chat:readonly"],"user":[]}}
162
+ ```
163
+
164
+ ### Slack
165
+
166
+ Slack uses Socket Mode: the Harness connects out to Slack, so your computer needs no public address.
167
+
168
+ 1. Open https://api.slack.com/apps → **Create New App** → **From a manifest**, pick your workspace, choose
169
+ the JSON tab and paste the manifest below (rename "Bot Team" if you like) → **Next** → **Create**.
170
+ 2. **Install App** → **Install to Workspace** → **Allow**. Copy the **Bot User OAuth Token** (`xoxb-…`).
171
+ 3. **Basic Information** → **App-Level Tokens** → **Generate Token and Scopes**: any name, **Add Scope** →
172
+ `connections:write`, **Generate**, and copy the token (`xapp-…`).
173
+ 4. In Bots, open the bot → **Apps** → add **Slack**, paste both tokens and save. Once it shows
174
+ *Connected*, a pairing code appears.
175
+ 5. In Slack, open the app (**Open in Slack** next to the code, or Apps → your app → Messages) and send it
176
+ the code.
177
+ 6. To use it in a channel, invite the app (`/invite @Bot Team`) and @mention it; it answers in the thread.
178
+
179
+ Use one Slack app per bot, and don't run the same app in another program: Slack hands each message to only
180
+ one connection. If you change scopes later, reinstall the app to the workspace and press **Reconnect**.
181
+
182
+ ```json
183
+ {
184
+ "display_information": {
185
+ "name": "Bot Team",
186
+ "description": "Message your bot team from Slack: DM the app, or @mention it in a channel.",
187
+ "background_color": "#4a154b"
188
+ },
189
+ "features": {
190
+ "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false },
191
+ "bot_user": { "display_name": "Bot Team", "always_online": true }
192
+ },
193
+ "oauth_config": {
194
+ "scopes": { "bot": ["app_mentions:read", "channels:read", "chat:write", "groups:read", "im:history", "users:read"] }
195
+ },
196
+ "settings": {
197
+ "event_subscriptions": { "bot_events": ["app_mention", "message.im"] },
198
+ "org_deploy_enabled": false,
199
+ "socket_mode_enabled": true,
200
+ "token_rotation_enabled": false
201
+ }
202
+ }
203
+ ```
204
+
129
205
  ### What else to know
130
206
 
131
207
  - **Who can talk to it**: only people you paired. Anyone else is ignored; in a private chat they get at
@@ -136,7 +212,8 @@ the replies come back to the chat, including the dispatcher's report once its te
136
212
  including whatever their abilities and apps allow on this Mac. Pair only yourself or people you trust,
137
213
  and turn off risky abilities on the bot that owns the channel if others are paired.
138
214
  - **Where replies go**: to the chat your latest request came from. Write in the panel and the conversation
139
- is back in the panel. Telegram gets plain text (Markdown markers removed); Discord keeps its Markdown.
215
+ is back in the panel. Telegram gets plain text (Markdown markers removed); Discord, Slack and Feishu
216
+ show the Markdown. In a Slack channel the answer goes into the thread of your message.
140
217
  - **Scheduled reports**: a scheduled task of the bot that owns the channel reports to the first paired
141
218
  person (switch it off in the panel), so "every weekday at nine Atlas briefs you" lands on your phone.
142
219
  - **One token, one place**: a chat bot token can be connected on one bot of one Harness at a time. If
@@ -156,8 +233,8 @@ the replies come back to the chat, including the dispatcher's report once its te
156
233
  most 16 messages in 10 minutes, so conversations end.
157
234
  - Every conversation gets `bot_list`, `bot_create`, `bot_update`, `bot_delete`, `bot_send_message`
158
235
  and `bot_schedule` to manage bots.
159
- - A chat app is not an MCP server: the Host keeps one connection per Telegram or Discord app (long polling
160
- for Telegram, the gateway for Discord), starts and stops it as you add, change, switch off or remove the
236
+ - A chat app is not an MCP server: the Host keeps one connection per chat app (long polling for Telegram,
237
+ the gateway for Discord, Socket Mode for Slack, the long connection for Feishu), starts and stops it as you add, change, switch off or remove the
161
238
  app, and hands paired people's messages to the bot as user prompts headed `[Telegram · Name]`.
162
239
 
163
240
  ## Open Computer Use
@@ -168,13 +245,14 @@ permission and restart it.
168
245
 
169
246
  ## What it stores and sends
170
247
 
171
- - `~/.dsh/cache/bots/`: `bots.json` (bots, including keys and chat bot tokens entered for apps),
248
+ - `~/.dsh/cache/bots/` (`bots.json` and `channels.json` are readable by your user only): `bots.json` (bots,
249
+ including keys and chat bot tokens entered for apps),
172
250
  `messages.jsonl` (timeline), `channels.json` (paired people per chat app, and the last message handled
173
251
  per chat), `avatars/`, `skills/` (skills imported from GitHub).
174
252
  - Nothing leaves your machine except through the bots' own conversations (your configured model), the
175
253
  apps you connect, the image model when you generate an avatar, GitHub when you import skills, and the
176
- Telegram or Discord API when you connect a chat app (the bots' replies to paired people, typing
177
- indicators, and the one-line note to strangers).
254
+ Feishu / Lark, Telegram, Slack or Discord API when you connect a chat app (the bots' replies to paired
255
+ people, typing indicators, and the one-line note to strangers).
178
256
 
179
257
  ## Install
180
258
 
package/README.zh-CN.md CHANGED
@@ -59,6 +59,8 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
59
59
  - **技能**:
60
60
  - **从 Harness 添加**:直接选你已经装好的技能(`~/.agents/skills`、`~/.dsh/skills` 等),引用而不复制,跟着更新;
61
61
  - **从 GitHub 导入**:一键浏览 Anthropic 官方技能,或粘贴任意 `owner/repo/path`,整个技能文件夹连脚本一起导入;
62
+ - **从本地文件夹添加**:选本机的一个技能文件夹(或装着多个技能的文件夹,如 `~/.claude/skills`),只引用不复制,改了原文件夹就生效;
63
+ - 同一个 bot 里技能不重名:已有的同名技能会跳过;从同一个 GitHub 文件夹再导入一次则原地更新;
62
64
  - **让 Bot 自己写**:一句话描述需求,bot 用 skill-creator 写好并保存到自己身上;
63
65
  - 手写仍然可以,但它是最后的选项;
64
66
  - **应用**:只补 Harness 本身没有的外部系统;
@@ -68,7 +70,7 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
68
70
  | 分类 | 应用(🔑 = 需要 Key) |
69
71
  | --- | --- |
70
72
  | 销售与收款 | Stripe 收款 🔑、HubSpot 客户管理 🔑 |
71
- | 团队与办公 | Telegram 🔑、Discord 🔑(聊天应用,见下文)、飞书 🔑、Notion 🔑、Slack 🔑、长期记忆 |
73
+ | 团队与办公 | 飞书 🔑、Telegram 🔑、Slack 🔑、Discord 🔑(聊天应用,见下文)、飞书开放平台 🔑、Notion 🔑、Slack 工作区 🔑、长期记忆 |
72
74
  | 研发与交付 | GitHub 🔑、Git 仓库、Supabase 🔑、Sentry 🔑、Context7 文档 |
73
75
  | 调研与内容 | Exa、Tavily 🔑、Brave 🔑、Firecrawl 🔑 |
74
76
  | 电脑与浏览器 | Open Computer Use(操控 macOS 应用)、Playwright 浏览器 |
@@ -81,9 +83,9 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
81
83
  - **图标**:应用库里每个应用都用它自己的官方 logo(有 App 的用 App Store 图标,没有的用官网或官方仓库里的 logo)。
82
84
  这些 logo 是各自所有者的商标,只用来标明是哪个服务。
83
85
 
84
- ## 在 Telegram 或 Discord 里给团队发消息
86
+ ## 在飞书、Telegram、Slack 或 Discord 里给团队发消息
85
87
 
86
- 在某个 bot(一般是调度员)的**应用**页加上 **Telegram** 或 **Discord**,就能用手机派活:你发给聊天 Bot 的话,
88
+ 在某个 bot(一般是调度员)的**应用**页加上**飞书**、**Telegram**、**Slack** 或 **Discord**,就能用手机派活:你发给聊天 Bot 的话,
87
89
  会像在面板里输入一样交给团队;回复会回到聊天里,包括队友回复之后调度员的汇总汇报。
88
90
 
89
91
  > **你(在 Telegram 里)**:把下周的发布安排一下。
@@ -111,6 +113,68 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
111
113
  Discord 只允许你私信和你同在一个服务器的 Bot。
112
114
  3. 私信 Bot 发送配对码,之后直接私信它派活,或在频道里 @ 它。
113
115
 
116
+ ### 飞书
117
+
118
+ 飞书走长连接:由 Harness 主动连到飞书,电脑不需要公网地址。国际版 Lark 步骤相同,面板会自己判断应用属于哪一边。
119
+
120
+ 1. 打开开发者后台 https://open.feishu.cn/app (Lark:https://open.larksuite.com/app),创建企业自建应用。
121
+ 2. 「添加应用能力」→ 添加「机器人」。
122
+ 3. 「权限管理」开通权限(可用「批量导入/导出权限」粘贴下方 JSON):
123
+ - 必需:`im:message.p2p_msg:readonly`、`im:message.group_at_msg:readonly`、`im:message:send_as_bot`
124
+ - 可选:`contact:contact.base:readonly` + `contact:user.base:readonly`(显示姓名),
125
+ `im:message.reactions:write_only`(处理中显示表情),`im:chat:readonly`(显示群名)
126
+ 4. 在「凭证与基础信息」复制 App ID 和 App Secret,填到 Bot 的「应用 → 飞书」并保存。长连接会上线;
127
+ 如果提示开启机器人,说明还没发布版本,长连接此时已在线,不影响下一步。
128
+ 5. 保持 Harness 运行,到「事件与回调」→「事件配置」把订阅方式改为「使用长连接接收事件」并保存(必须有长连接在线才能保存)。
129
+ 6. 「添加事件」→ 添加 `im.message.receive_v1`(接收消息)。
130
+ 7. 「版本管理与发布」→ 创建版本,可用范围包含要使用的人 → 发布(可能需要管理员审核)。
131
+ 8. 在飞书里打开和机器人的单聊(搜索应用名,或点面板里的「在飞书中打开」),发送配对码。群聊里先把机器人拉进群,再 @ 它。
132
+
133
+ 请用专门给这个团队新建的应用:同一个 App ID 有多个程序连着时,每条消息只会交给其中一个。
134
+
135
+ ```json
136
+ {"scopes":{"tenant":["im:message.p2p_msg:readonly","im:message.group_at_msg:readonly","im:message:send_as_bot","im:message.reactions:write_only","contact:contact.base:readonly","contact:user.base:readonly","im:chat:readonly"],"user":[]}}
137
+ ```
138
+
139
+ ### Slack
140
+
141
+ Slack 走 Socket Mode:由 Harness 主动连到 Slack,电脑不需要公网地址。
142
+
143
+ 1. 打开 https://api.slack.com/apps → **Create New App** → **From a manifest**,选择工作区,切到 JSON 标签,
144
+ 粘贴下方清单("Bot Team" 可以改名)→ **Next** → **Create**。
145
+ 2. **Install App** → **Install to Workspace** → **Allow**,复制 **Bot User OAuth Token**(`xoxb-…`)。
146
+ 3. **Basic Information** → **App-Level Tokens** → **Generate Token and Scopes**:名字随意,**Add Scope** 选
147
+ `connections:write`,点 **Generate**,复制 Token(`xapp-…`)。
148
+ 4. 在 Bots 里打开这个 Bot → **应用** → 添加 **Slack**,填入两个 Token 并保存。显示「已连接」后会出现配对码。
149
+ 5. 在 Slack 里打开这个应用(点配对码旁的「在 Slack 中打开」,或 Apps → 你的应用 → Messages),把配对码发给它。
150
+ 6. 想在频道里用:先把应用邀请进频道(`/invite @Bot Team`),再 @ 它;它会在那条消息的讨论串里回复。
151
+
152
+ 每个 Bot 用一个单独的 Slack 应用,不要让别的程序同时使用同一个应用(Slack 每条消息只交给其中一个连接)。
153
+ 以后改了权限,要重新安装到工作区,再点「重新连接」。
154
+
155
+ ```json
156
+ {
157
+ "display_information": {
158
+ "name": "Bot Team",
159
+ "description": "Message your bot team from Slack: DM the app, or @mention it in a channel.",
160
+ "background_color": "#4a154b"
161
+ },
162
+ "features": {
163
+ "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false },
164
+ "bot_user": { "display_name": "Bot Team", "always_online": true }
165
+ },
166
+ "oauth_config": {
167
+ "scopes": { "bot": ["app_mentions:read", "channels:read", "chat:write", "groups:read", "im:history", "users:read"] }
168
+ },
169
+ "settings": {
170
+ "event_subscriptions": { "bot_events": ["app_mention", "message.im"] },
171
+ "org_deploy_enabled": false,
172
+ "socket_mode_enabled": true,
173
+ "token_rotation_enabled": false
174
+ }
175
+ }
176
+ ```
177
+
114
178
  ### 其他须知
115
179
 
116
180
  - **谁能和它说话**:只有你配对过的人。其他人一律忽略;在私聊里最多每天收到一句「这是私人 Bot」。
@@ -119,7 +183,7 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
119
183
  - **配对等同于你自己的登录**:配对的人能让 bot 做你能做的任何事,包括它们的能力和应用在这台 Mac 上允许的操作。
120
184
  只配对你自己或你信任的人;如果配对了别人,请在拥有该聊天应用的 bot 上关掉有风险的能力。
121
185
  - **回复发到哪里**:发到你最近一次请求来自的那个聊天。在面板里发消息,对话就回到面板。
122
- Telegram 收到纯文本(去掉 Markdown 标记);Discord 保留 Markdown。
186
+ Telegram 收到纯文本(去掉 Markdown 标记);Discord、Slack 和飞书会显示 Markdown 格式。在 Slack 频道里,回复发在你那条消息的讨论串里。
123
187
  - **定时汇报**:拥有聊天应用的 bot 的定时任务会把结果发给第一个配对的人(可在面板里关闭),
124
188
  于是「工作日早上九点 Atlas 给你做简报」会直接出现在你手机上。
125
189
  - **一个 Token 只能在一处使用**:同一个聊天 Bot Token 同时只能连在一个 Harness 的一个 bot 上。
@@ -134,7 +198,7 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
134
198
  修改即时生效;新增或修改应用在下次会话启动时连接。
135
199
  - `bot_send_message` 把消息放进对方的收件箱并唤醒它;同一对 bot 10 分钟内最多互发 16 条,防止无限对话。
136
200
  - 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot。
137
- - 聊天应用不是 MCP 服务:Host 为每个 Telegram / Discord 应用保持一个连接(Telegram 用长轮询,Discord 用 Gateway),
201
+ - 聊天应用不是 MCP 服务:Host 为每个聊天应用保持一个连接(Telegram 用长轮询,Discord 用 Gateway,Slack 用 Socket Mode,飞书用长连接),
138
202
  随你添加、修改、关闭或删除应用而启动和停止,并把配对者的消息作为用户提示交给 bot,开头标着 `[Telegram · 名字]`。
139
203
 
140
204
  ## Open Computer Use
@@ -144,10 +208,10 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
144
208
 
145
209
  ## 存储与外发
146
210
 
147
- - `~/.dsh/cache/bots/`:`bots.json`(bot,含应用里填的 Key 和聊天 Bot Token)、`messages.jsonl`(时间线)、
211
+ - `~/.dsh/cache/bots/`(`bots.json` 和 `channels.json` 只有你自己的账户能读):`bots.json`(bot,含应用里填的 Key 和聊天 Bot Token)、`messages.jsonl`(时间线)、
148
212
  `channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub 导入的技能)。
149
213
  - 除了 bot 自身会话(你配置的模型)、你连接的应用、生成头像时的图片模型、导入技能时访问 GitHub,
150
- 以及连接聊天应用后访问 Telegram / Discord 的 API(给配对者的回复、正在输入提示、给陌生人的那一句提示),不向外发送任何内容。
214
+ 以及连接聊天应用后访问飞书 / Lark、Telegram、Slack、Discord 的 API(给配对者的回复、正在输入提示、给陌生人的那一句提示),不向外发送任何内容。
151
215
 
152
216
  ## 安装
153
217