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