mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-11 14:58:39 +03:00
docs(readme): add matrix e2ee implications note
This commit is contained in:
@@ -104,6 +104,7 @@ nanobot onboard
|
|||||||
**2. Configure** (`~/.nanobot/config.json`)
|
**2. Configure** (`~/.nanobot/config.json`)
|
||||||
|
|
||||||
For OpenRouter - recommended for global users:
|
For OpenRouter - recommended for global users:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"providers": {
|
"providers": {
|
||||||
@@ -166,19 +167,21 @@ nanobot agent -m "Hello from my local LLM!"
|
|||||||
|
|
||||||
## 💬 Chat Apps
|
## 💬 Chat Apps
|
||||||
|
|
||||||
Talk to your nanobot through Telegram, Discord, WhatsApp, Feishu or Matrix(Element) — anytime, anywhere.
|
Talk to your nanobot through Telegram, Discord, WhatsApp, Feishu, DingTalk, or Matrix (Element) — anytime, anywhere.
|
||||||
|
|
||||||
| Channel | Setup |
|
| Channel | Setup |
|
||||||
|---------|-------|
|
| -------------------- | ---------------------------------- |
|
||||||
| **Telegram** | Easy (just a token) |
|
| **Telegram** | Easy (just a token) |
|
||||||
| **Discord** | Easy (bot token + intents) |
|
| **Discord** | Easy (bot token + intents) |
|
||||||
| **WhatsApp** | Medium (scan QR) |
|
| **WhatsApp** | Medium (scan QR) |
|
||||||
| **Feishu** | Medium (app credentials) |
|
| **Feishu** | Medium (app credentials) |
|
||||||
|
| **Matrix (Element)** | Medium (homeserver + access token) |
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Telegram</b> (Recommended)</summary>
|
<summary><b>Telegram</b> (Recommended)</summary>
|
||||||
|
|
||||||
**1. Create a bot**
|
**1. Create a bot**
|
||||||
|
|
||||||
- Open Telegram, search `@BotFather`
|
- Open Telegram, search `@BotFather`
|
||||||
- Send `/newbot`, follow prompts
|
- Send `/newbot`, follow prompts
|
||||||
- Copy the token
|
- Copy the token
|
||||||
@@ -211,15 +214,18 @@ nanobot gateway
|
|||||||
<summary><b>Discord</b></summary>
|
<summary><b>Discord</b></summary>
|
||||||
|
|
||||||
**1. Create a bot**
|
**1. Create a bot**
|
||||||
|
|
||||||
- Go to https://discord.com/developers/applications
|
- Go to https://discord.com/developers/applications
|
||||||
- Create an application → Bot → Add Bot
|
- Create an application → Bot → Add Bot
|
||||||
- Copy the bot token
|
- Copy the bot token
|
||||||
|
|
||||||
**2. Enable intents**
|
**2. Enable intents**
|
||||||
|
|
||||||
- In the Bot settings, enable **MESSAGE CONTENT INTENT**
|
- In the Bot settings, enable **MESSAGE CONTENT INTENT**
|
||||||
- (Optional) Enable **SERVER MEMBERS INTENT** if you plan to use allow lists based on member data
|
- (Optional) Enable **SERVER MEMBERS INTENT** if you plan to use allow lists based on member data
|
||||||
|
|
||||||
**3. Get your User ID**
|
**3. Get your User ID**
|
||||||
|
|
||||||
- Discord Settings → Advanced → enable **Developer Mode**
|
- Discord Settings → Advanced → enable **Developer Mode**
|
||||||
- Right-click your avatar → **Copy User ID**
|
- Right-click your avatar → **Copy User ID**
|
||||||
|
|
||||||
@@ -238,6 +244,7 @@ nanobot gateway
|
|||||||
```
|
```
|
||||||
|
|
||||||
**5. Invite the bot**
|
**5. Invite the bot**
|
||||||
|
|
||||||
- OAuth2 → URL Generator
|
- OAuth2 → URL Generator
|
||||||
- Scopes: `bot`
|
- Scopes: `bot`
|
||||||
- Bot Permissions: `Send Messages`, `Read Message History`
|
- Bot Permissions: `Send Messages`, `Read Message History`
|
||||||
@@ -251,6 +258,67 @@ nanobot gateway
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Matrix (Element)</b></summary>
|
||||||
|
|
||||||
|
Uses Matrix sync via `matrix-nio` (including inbound media support).
|
||||||
|
|
||||||
|
**1. Create/choose a Matrix account**
|
||||||
|
|
||||||
|
- Create or reuse a Matrix account on your homeserver (for example `matrix.org`).
|
||||||
|
- Confirm you can log in with Element.
|
||||||
|
|
||||||
|
**2. Get credentials**
|
||||||
|
|
||||||
|
- You need:
|
||||||
|
- `userId` (example: `@nanobot:matrix.org`)
|
||||||
|
- `accessToken`
|
||||||
|
- `deviceId` (recommended so sync tokens can be restored across restarts)
|
||||||
|
- You can obtain these from your homeserver login API (`/_matrix/client/v3/login`) or from your client's advanced session settings.
|
||||||
|
|
||||||
|
**3. Configure**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"channels": {
|
||||||
|
"matrix": {
|
||||||
|
"enabled": true,
|
||||||
|
"homeserver": "https://matrix.org",
|
||||||
|
"userId": "@nanobot:matrix.org",
|
||||||
|
"accessToken": "syt_xxx",
|
||||||
|
"deviceId": "NANOBOT01",
|
||||||
|
"allowFrom": [],
|
||||||
|
"groupPolicy": "open",
|
||||||
|
"groupAllowFrom": [],
|
||||||
|
"allowRoomMentions": false,
|
||||||
|
"maxInboundMediaBytes": 20971520
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> `allowFrom`: Empty allows all senders; set user IDs to restrict access.
|
||||||
|
> `groupPolicy`: `open`, `mention`, or `allowlist`.
|
||||||
|
> `groupAllowFrom`: Room allowlist used when `groupPolicy` is `allowlist`.
|
||||||
|
> `allowRoomMentions`: If `true`, accepts `@room` (`m.mentions.room`) in mention mode.
|
||||||
|
> `maxInboundMediaBytes`: Max inbound attachment size in bytes (default `20MB`).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Matrix E2EE implications:
|
||||||
|
>
|
||||||
|
> - Keep a persistent `matrix-store` and stable `deviceId`; otherwise encrypted session state can be lost after restart.
|
||||||
|
> - In newly joined encrypted rooms, initial messages may fail until Olm/Megolm sessions are established.
|
||||||
|
> - The bot currently sends with `ignore_unverified_devices=true` (more compatible, less strict than verified-only sending).
|
||||||
|
> - Changing `accessToken`/`deviceId` effectively creates a new device and may require session re-establishment.
|
||||||
|
|
||||||
|
**4. Run**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nanobot gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>WhatsApp</b></summary>
|
<summary><b>WhatsApp</b></summary>
|
||||||
|
|
||||||
@@ -294,6 +362,7 @@ nanobot gateway
|
|||||||
Uses **WebSocket** long connection — no public IP required.
|
Uses **WebSocket** long connection — no public IP required.
|
||||||
|
|
||||||
**1. Create a Feishu bot**
|
**1. Create a Feishu bot**
|
||||||
|
|
||||||
- Visit [Feishu Open Platform](https://open.feishu.cn/app)
|
- Visit [Feishu Open Platform](https://open.feishu.cn/app)
|
||||||
- Create a new app → Enable **Bot** capability
|
- Create a new app → Enable **Bot** capability
|
||||||
- **Permissions**: Add `im:message` (send messages)
|
- **Permissions**: Add `im:message` (send messages)
|
||||||
@@ -339,6 +408,7 @@ nanobot gateway
|
|||||||
Uses **Stream Mode** — no public IP required.
|
Uses **Stream Mode** — no public IP required.
|
||||||
|
|
||||||
**1. Create a DingTalk bot**
|
**1. Create a DingTalk bot**
|
||||||
|
|
||||||
- Visit [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
- Visit [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
||||||
- Create a new app -> Add **Robot** capability
|
- Create a new app -> Add **Robot** capability
|
||||||
- **Configuration**:
|
- **Configuration**:
|
||||||
@@ -379,11 +449,12 @@ Config file: `~/.nanobot/config.json`
|
|||||||
### Providers
|
### Providers
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
|
>
|
||||||
> - **Groq** provides free voice transcription via Whisper. If configured, Telegram voice messages will be automatically transcribed.
|
> - **Groq** provides free voice transcription via Whisper. If configured, Telegram voice messages will be automatically transcribed.
|
||||||
> - **Zhipu Coding Plan**: If you're on Zhipu's coding plan, set `"apiBase": "https://open.bigmodel.cn/api/coding/paas/v4"` in your zhipu provider config.
|
> - **Zhipu Coding Plan**: If you're on Zhipu's coding plan, set `"apiBase": "https://open.bigmodel.cn/api/coding/paas/v4"` in your zhipu provider config.
|
||||||
|
|
||||||
| Provider | Purpose | Get API Key |
|
| Provider | Purpose | Get API Key |
|
||||||
|----------|---------|-------------|
|
| ------------ | ----------------------------------------- | -------------------------------------------------------------------- |
|
||||||
| `openrouter` | LLM (recommended, access to all models) | [openrouter.ai](https://openrouter.ai) |
|
| `openrouter` | LLM (recommended, access to all models) | [openrouter.ai](https://openrouter.ai) |
|
||||||
| `anthropic` | LLM (Claude direct) | [console.anthropic.com](https://console.anthropic.com) |
|
| `anthropic` | LLM (Claude direct) | [console.anthropic.com](https://console.anthropic.com) |
|
||||||
| `openai` | LLM (GPT direct) | [platform.openai.com](https://platform.openai.com) |
|
| `openai` | LLM (GPT direct) | [platform.openai.com](https://platform.openai.com) |
|
||||||
@@ -428,7 +499,7 @@ That's it! Environment variables, model prefixing, config matching, and `nanobot
|
|||||||
**Common `ProviderSpec` options:**
|
**Common `ProviderSpec` options:**
|
||||||
|
|
||||||
| Field | Description | Example |
|
| Field | Description | Example |
|
||||||
|-------|-------------|---------|
|
| ------------------------ | ----------------------------------------------- | ---------------------------------------- |
|
||||||
| `litellm_prefix` | Auto-prefix model names for LiteLLM | `"dashscope"` → `dashscope/qwen-max` |
|
| `litellm_prefix` | Auto-prefix model names for LiteLLM | `"dashscope"` → `dashscope/qwen-max` |
|
||||||
| `skip_prefixes` | Don't prefix if model already starts with these | `("dashscope/", "openrouter/")` |
|
| `skip_prefixes` | Don't prefix if model already starts with these | `("dashscope/", "openrouter/")` |
|
||||||
| `env_extras` | Additional env vars to set | `(("ZHIPUAI_API_KEY", "{api_key}"),)` |
|
| `env_extras` | Additional env vars to set | `(("ZHIPUAI_API_KEY", "{api_key}"),)` |
|
||||||
@@ -440,22 +511,20 @@ That's it! Environment variables, model prefixing, config matching, and `nanobot
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> For production deployments, set `"restrictToWorkspace": true` in your config to sandbox the agent.
|
> For production deployments, set `"restrictToWorkspace": true` in your config to sandbox the agent.
|
||||||
|
|
||||||
| Option | Default | Description |
|
| Option | Default | Description |
|
||||||
|--------|---------|-------------|
|
| --------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `tools.restrictToWorkspace` | `false` | When `true`, restricts **all** agent tools (shell, file read/write/edit, list) to the workspace directory. Prevents path traversal and out-of-scope access. |
|
| `tools.restrictToWorkspace` | `false` | When `true`, restricts **all** agent tools (shell, file read/write/edit, list) to the workspace directory. Prevents path traversal and out-of-scope access. |
|
||||||
| `channels.*.allowFrom` | `[]` (allow all) | Whitelist of user IDs. Empty = allow everyone; non-empty = only listed users can interact. |
|
| `channels.*.allowFrom` | `[]` (allow all) | Whitelist of user IDs. Empty = allow everyone; non-empty = only listed users can interact. |
|
||||||
|
|
||||||
|
|
||||||
## CLI Reference
|
## CLI Reference
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|---------|-------------|
|
| ------------------------- | ----------------------------- |
|
||||||
| `nanobot onboard` | Initialize config & workspace |
|
| `nanobot onboard` | Initialize config & workspace |
|
||||||
| `nanobot agent -m "..."` | Chat with the agent |
|
| `nanobot agent -m "..."` | Chat with the agent |
|
||||||
| `nanobot agent` | Interactive chat mode |
|
| `nanobot agent` | Interactive chat mode |
|
||||||
@@ -547,7 +616,6 @@ PRs welcome! The codebase is intentionally small and readable. 🤗
|
|||||||
<img src="https://contrib.rocks/image?repo=HKUDS/nanobot&max=100&columns=12" />
|
<img src="https://contrib.rocks/image?repo=HKUDS/nanobot&max=100&columns=12" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
## ⭐ Star History
|
## ⭐ Star History
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
@@ -565,7 +633,6 @@ PRs welcome! The codebase is intentionally small and readable. 🤗
|
|||||||
<img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.nanobot&style=for-the-badge&color=00d4ff" alt="Views">
|
<img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.nanobot&style=for-the-badge&color=00d4ff" alt="Views">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<sub>nanobot is for educational, research, and technical exchange purposes only</sub>
|
<sub>nanobot is for educational, research, and technical exchange purposes only</sub>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user