@kadaliao/dsh-bots 0.3.3 → 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 +142 -4
- package/README.zh-CN.md +119 -3
- package/client.js +564 -43
- package/index.js +186 -25
- package/lib/apps.mjs +150 -5
- package/lib/channels/discord.mjs +590 -0
- package/lib/channels/feishu.mjs +1249 -0
- package/lib/channels/slack.mjs +906 -0
- package/lib/channels/telegram.mjs +300 -0
- package/lib/channels.mjs +893 -0
- package/lib/logos.mjs +54 -0
- package/lib/prompt.mjs +9 -1
- package/lib/skills.mjs +199 -6
- package/lib/store.mjs +22 -3
- package/logos/amap.png +0 -0
- package/logos/anthropic.png +0 -0
- package/logos/baidu-map.png +0 -0
- package/logos/brave.png +0 -0
- package/logos/context7.png +0 -0
- package/logos/discord.png +0 -0
- package/logos/exa.png +0 -0
- package/logos/feishu.png +0 -0
- package/logos/firecrawl.png +0 -0
- package/logos/git.png +0 -0
- package/logos/github.png +0 -0
- package/logos/hubspot.png +0 -0
- package/logos/mcp.png +0 -0
- package/logos/notion.png +0 -0
- package/logos/playwright.png +0 -0
- package/logos/postgres.png +0 -0
- package/logos/sentry.png +0 -0
- package/logos/slack.png +0 -0
- package/logos/sqlite.png +0 -0
- package/logos/stripe.png +0 -0
- package/logos/supabase.png +0 -0
- package/logos/tavily.png +0 -0
- package/logos/telegram.png +0 -0
- package/package.json +3 -1
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 | 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 |
|
|
@@ -90,6 +94,133 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
|
|
|
90
94
|
|
|
91
95
|
- **Schedules** are ordinary Harness scheduled tasks, also on the Automation page.
|
|
92
96
|
- **AI avatars**: with the [Images plugin](../images), draw a bot's avatar from its persona.
|
|
97
|
+
- **Logos**: each app in the gallery shows its vendor's own logo (the App Store icon where there is an app,
|
|
98
|
+
otherwise the logo from the vendor's site or repository). The logos are their owners' trademarks and
|
|
99
|
+
only identify each service.
|
|
100
|
+
|
|
101
|
+
## Message your team from Feishu, Telegram, Slack or Discord
|
|
102
|
+
|
|
103
|
+
Add **Feishu / Lark**, **Telegram**, **Slack** or **Discord** to a bot (normally the dispatcher) in its **Apps** tab, and you can hand out
|
|
104
|
+
work from your phone: what you send the chat bot goes to the team as if you typed it in the panel, and
|
|
105
|
+
the replies come back to the chat, including the dispatcher's report once its teammates have answered.
|
|
106
|
+
|
|
107
|
+
> **You, in Telegram**: Get the release organised for next week.
|
|
108
|
+
>
|
|
109
|
+
> **Atlas**: On it: Forge takes the three P1 bugs, Echo drafts the launch post.
|
|
110
|
+
>
|
|
111
|
+
> **Atlas** (later): Bugs fixed and merged; the launch draft is ready for your review.
|
|
112
|
+
|
|
113
|
+
### Telegram
|
|
114
|
+
|
|
115
|
+
1. In Telegram, open [@BotFather](https://t.me/BotFather), send `/newbot`, pick a name and a username
|
|
116
|
+
ending in `bot`. Make a new bot just for this team.
|
|
117
|
+
2. In Bots, open the dispatcher → **Apps** → **Telegram** → paste the token BotFather gave you → **Add**.
|
|
118
|
+
It connects at once and shows **Connected as @yourbot**.
|
|
119
|
+
3. Pair yourself: the panel shows a one-time code (it works once, for 10 minutes). Click **Open in
|
|
120
|
+
Telegram** and press **Start**, or send the code to your bot. The bot answers "Paired".
|
|
121
|
+
4. Message the bot. Start a message with `@handle` to reach another bot directly (`@forge fix the login bug`).
|
|
122
|
+
In a group, add the bot and @mention it (or reply to it); it ignores the rest of the conversation.
|
|
123
|
+
|
|
124
|
+
### Discord
|
|
125
|
+
|
|
126
|
+
1. In the [Developer Portal](https://discord.com/developers/applications): **New Application** → **Bot** →
|
|
127
|
+
**Reset Token** and copy it. On the same page turn on **Message Content Intent** (without it the bot
|
|
128
|
+
cannot read messages, and the panel says so).
|
|
129
|
+
2. Add **Discord** to the dispatcher with that token. Once connected, use **Invite the bot to a server**
|
|
130
|
+
(any server you are in, a private one is fine): Discord only lets you DM a bot you share a server with.
|
|
131
|
+
3. DM the bot the pairing code, then DM it your requests, or @mention it in a channel.
|
|
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
|
+
|
|
205
|
+
### What else to know
|
|
206
|
+
|
|
207
|
+
- **Who can talk to it**: only people you paired. Anyone else is ignored; in a private chat they get at
|
|
208
|
+
most one "this bot is private" line a day. Pairing happens only in a private chat, with the current
|
|
209
|
+
code, and a few wrong guesses lock a person out until the next code. You can pair more people (each
|
|
210
|
+
needs a new code) and remove anyone from the panel; the panel also counts ignored messages.
|
|
211
|
+
- **Treat a pairing like your own login**: a paired person can ask the bots for anything you could,
|
|
212
|
+
including whatever their abilities and apps allow on this Mac. Pair only yourself or people you trust,
|
|
213
|
+
and turn off risky abilities on the bot that owns the channel if others are paired.
|
|
214
|
+
- **Where replies go**: to the chat your latest request came from. Write in the panel and the conversation
|
|
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.
|
|
217
|
+
- **Scheduled reports**: a scheduled task of the bot that owns the channel reports to the first paired
|
|
218
|
+
person (switch it off in the panel), so "every weekday at nine Atlas briefs you" lands on your phone.
|
|
219
|
+
- **One token, one place**: a chat bot token can be connected on one bot of one Harness at a time. If
|
|
220
|
+
another program uses the same Telegram token, the panel says so.
|
|
221
|
+
- The token is stored with the bot like other app keys, never shown back in the panel, and kept out of
|
|
222
|
+
logs and error messages. Harness must be running for the bot to answer; Telegram holds messages for up
|
|
223
|
+
to 24 hours, and a message is never run twice after a restart.
|
|
93
224
|
|
|
94
225
|
## How it works
|
|
95
226
|
|
|
@@ -102,6 +233,9 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
|
|
|
102
233
|
most 16 messages in 10 minutes, so conversations end.
|
|
103
234
|
- Every conversation gets `bot_list`, `bot_create`, `bot_update`, `bot_delete`, `bot_send_message`
|
|
104
235
|
and `bot_schedule` to manage bots.
|
|
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
|
|
238
|
+
app, and hands paired people's messages to the bot as user prompts headed `[Telegram · Name]`.
|
|
105
239
|
|
|
106
240
|
## Open Computer Use
|
|
107
241
|
|
|
@@ -111,10 +245,14 @@ permission and restart it.
|
|
|
111
245
|
|
|
112
246
|
## What it stores and sends
|
|
113
247
|
|
|
114
|
-
- `~/.dsh/cache/bots
|
|
115
|
-
|
|
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),
|
|
250
|
+
`messages.jsonl` (timeline), `channels.json` (paired people per chat app, and the last message handled
|
|
251
|
+
per chat), `avatars/`, `skills/` (skills imported from GitHub).
|
|
116
252
|
- Nothing leaves your machine except through the bots' own conversations (your configured model), the
|
|
117
|
-
apps you connect, the image model when you generate an avatar,
|
|
253
|
+
apps you connect, the image model when you generate an avatar, GitHub when you import skills, and the
|
|
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).
|
|
118
256
|
|
|
119
257
|
## Install
|
|
120
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
|
-
| 团队与办公 | 飞书 🔑、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 浏览器 |
|
|
@@ -78,6 +80,116 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
78
80
|
|
|
79
81
|
- **定时任务**:就是 Harness 的定时任务,也出现在「自动化」页面;
|
|
80
82
|
- **AI 头像**:装了 [图片插件](../images) 就能按 bot 的人设生成头像。
|
|
83
|
+
- **图标**:应用库里每个应用都用它自己的官方 logo(有 App 的用 App Store 图标,没有的用官网或官方仓库里的 logo)。
|
|
84
|
+
这些 logo 是各自所有者的商标,只用来标明是哪个服务。
|
|
85
|
+
|
|
86
|
+
## 在飞书、Telegram、Slack 或 Discord 里给团队发消息
|
|
87
|
+
|
|
88
|
+
在某个 bot(一般是调度员)的**应用**页加上**飞书**、**Telegram**、**Slack** 或 **Discord**,就能用手机派活:你发给聊天 Bot 的话,
|
|
89
|
+
会像在面板里输入一样交给团队;回复会回到聊天里,包括队友回复之后调度员的汇总汇报。
|
|
90
|
+
|
|
91
|
+
> **你(在 Telegram 里)**:把下周的发布安排一下。
|
|
92
|
+
>
|
|
93
|
+
> **Atlas**:收到:Forge 处理三个 P1 bug,Echo 起草发布文案。
|
|
94
|
+
>
|
|
95
|
+
> **Atlas**(稍后):bug 已修好并合并;发布文案已备好,等你过目。
|
|
96
|
+
|
|
97
|
+
### Telegram
|
|
98
|
+
|
|
99
|
+
1. 在 Telegram 里打开 [@BotFather](https://t.me/BotFather),发送 `/newbot`,起一个名字和以 `bot` 结尾的用户名。
|
|
100
|
+
请专门给这个团队新建一个 Bot。
|
|
101
|
+
2. 在 Bots 里打开调度员 → **应用** → **Telegram** → 粘贴 BotFather 给你的 Token → **添加**。
|
|
102
|
+
它会立刻连接,显示**已连接:@你的bot**。
|
|
103
|
+
3. 配对你自己:面板上会显示一个一次性配对码(10 分钟内有效,只能用一次)。点**在 Telegram 中打开**再点
|
|
104
|
+
**Start**,或者直接把配对码发给你的 Bot。Bot 回复「配对成功」。
|
|
105
|
+
4. 给 Bot 发消息即可。消息以 `@handle` 开头可以直接找其他 bot(例如 `@forge 修一下登录 bug`)。
|
|
106
|
+
在群里,把 Bot 拉进群并 @ 它(或回复它);群里的其他对话它一概不理。
|
|
107
|
+
|
|
108
|
+
### Discord
|
|
109
|
+
|
|
110
|
+
1. 在 [开发者后台](https://discord.com/developers/applications):**New Application** → **Bot** → **Reset Token**,复制 Token。
|
|
111
|
+
在同一页打开 **Message Content Intent**(不开就读不到消息,面板也会提示)。
|
|
112
|
+
2. 用这个 Token 给调度员添加 **Discord**。连上后点**把 Bot 邀请进你所在的服务器**(任何你在的服务器都行,私人服务器也可以):
|
|
113
|
+
Discord 只允许你私信和你同在一个服务器的 Bot。
|
|
114
|
+
3. 私信 Bot 发送配对码,之后直接私信它派活,或在频道里 @ 它。
|
|
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
|
+
|
|
178
|
+
### 其他须知
|
|
179
|
+
|
|
180
|
+
- **谁能和它说话**:只有你配对过的人。其他人一律忽略;在私聊里最多每天收到一句「这是私人 Bot」。
|
|
181
|
+
配对只能在私聊里用当前配对码完成,猜错几次就会被锁定,直到生成新码。可以配对多个人(每人需要一个新码),
|
|
182
|
+
也可以在面板里移除任何人;面板还会统计被忽略的消息数。
|
|
183
|
+
- **配对等同于你自己的登录**:配对的人能让 bot 做你能做的任何事,包括它们的能力和应用在这台 Mac 上允许的操作。
|
|
184
|
+
只配对你自己或你信任的人;如果配对了别人,请在拥有该聊天应用的 bot 上关掉有风险的能力。
|
|
185
|
+
- **回复发到哪里**:发到你最近一次请求来自的那个聊天。在面板里发消息,对话就回到面板。
|
|
186
|
+
Telegram 收到纯文本(去掉 Markdown 标记);Discord、Slack 和飞书会显示 Markdown 格式。在 Slack 频道里,回复发在你那条消息的讨论串里。
|
|
187
|
+
- **定时汇报**:拥有聊天应用的 bot 的定时任务会把结果发给第一个配对的人(可在面板里关闭),
|
|
188
|
+
于是「工作日早上九点 Atlas 给你做简报」会直接出现在你手机上。
|
|
189
|
+
- **一个 Token 只能在一处使用**:同一个聊天 Bot Token 同时只能连在一个 Harness 的一个 bot 上。
|
|
190
|
+
如果有别的程序在用同一个 Telegram Token,面板会提示。
|
|
191
|
+
- Token 和其他应用的 Key 一样保存在 bot 里,面板里不会再显示出来,也不会出现在日志和错误信息里。
|
|
192
|
+
Harness 运行时 Bot 才会回复;Telegram 最多替你保存 24 小时内的消息,重启后同一条消息不会被执行两次。
|
|
81
193
|
|
|
82
194
|
## 原理
|
|
83
195
|
|
|
@@ -86,6 +198,8 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
86
198
|
修改即时生效;新增或修改应用在下次会话启动时连接。
|
|
87
199
|
- `bot_send_message` 把消息放进对方的收件箱并唤醒它;同一对 bot 10 分钟内最多互发 16 条,防止无限对话。
|
|
88
200
|
- 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot。
|
|
201
|
+
- 聊天应用不是 MCP 服务:Host 为每个聊天应用保持一个连接(Telegram 用长轮询,Discord 用 Gateway,Slack 用 Socket Mode,飞书用长连接),
|
|
202
|
+
随你添加、修改、关闭或删除应用而启动和停止,并把配对者的消息作为用户提示交给 bot,开头标着 `[Telegram · 名字]`。
|
|
89
203
|
|
|
90
204
|
## Open Computer Use
|
|
91
205
|
|
|
@@ -94,8 +208,10 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
94
208
|
|
|
95
209
|
## 存储与外发
|
|
96
210
|
|
|
97
|
-
- `~/.dsh/cache/bots
|
|
98
|
-
|
|
211
|
+
- `~/.dsh/cache/bots/`(`bots.json` 和 `channels.json` 只有你自己的账户能读):`bots.json`(bot,含应用里填的 Key 和聊天 Bot Token)、`messages.jsonl`(时间线)、
|
|
212
|
+
`channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub 导入的技能)。
|
|
213
|
+
- 除了 bot 自身会话(你配置的模型)、你连接的应用、生成头像时的图片模型、导入技能时访问 GitHub,
|
|
214
|
+
以及连接聊天应用后访问飞书 / Lark、Telegram、Slack、Discord 的 API(给配对者的回复、正在输入提示、给陌生人的那一句提示),不向外发送任何内容。
|
|
99
215
|
|
|
100
216
|
## 安装
|
|
101
217
|
|