fix: provider startup order and enable flags

This commit is contained in:
Peter Steinberger
2025-12-26 16:54:53 +00:00
parent 17d9ba256b
commit ed2e738ea4
8 changed files with 127 additions and 26 deletions

View File

@@ -105,6 +105,48 @@ Controls how inbound messages behave when an agent run is already active.
}
```
### `web` (WhatsApp web provider)
WhatsApp runs through the gateways web provider. It starts automatically when a linked session exists.
Set `web.enabled: false` to keep it off by default.
```json5
{
web: {
enabled: true,
heartbeatSeconds: 60,
reconnect: {
initialMs: 2000,
maxMs: 120000,
factor: 1.4,
jitter: 0.2,
maxAttempts: 0
}
}
}
```
### `telegram` (bot transport)
Clawdis reads `TELEGRAM_BOT_TOKEN` or `telegram.botToken` to start the provider.
Set `telegram.enabled: false` to disable automatic startup.
```json5
{
telegram: {
enabled: true,
botToken: "your-bot-token",
requireMention: true,
allowFrom: ["123456789"],
mediaMaxMb: 5,
proxy: "socks5://localhost:9050",
webhookUrl: "https://example.com/telegram-webhook",
webhookSecret: "secret",
webhookPath: "/telegram-webhook"
}
}
```
### `discord` (bot transport)
Configure the Discord bot by setting the bot token and optional gating:
@@ -112,6 +154,7 @@ Configure the Discord bot by setting the bot token and optional gating:
```json5
{
discord: {
enabled: true,
token: "your-bot-token",
allowFrom: ["discord:1234567890", "*"], // optional DM allowlist (user ids)
guildAllowFrom: {
@@ -124,7 +167,7 @@ Configure the Discord bot by setting the bot token and optional gating:
}
```
Clawdis reads `DISCORD_BOT_TOKEN` or `discord.token` to start the provider. Use `user:<id>` (DM) or `channel:<id>` (guild channel) when specifying delivery targets for cron/CLI commands.
Clawdis reads `DISCORD_BOT_TOKEN` or `discord.token` to start the provider (unless `discord.enabled` is `false`). Use `user:<id>` (DM) or `channel:<id>` (guild channel) when specifying delivery targets for cron/CLI commands.
### `agent.workspace`

View File

@@ -18,7 +18,7 @@ Status: ready for DM and guild text channels via the official Discord bot gatewa
1. Create a Discord application → Bot, enable the intents you need (DMs + guild messages + message content), and grab the bot token.
2. Invite the bot to your server with the permissions required to read/send messages where you want to use it.
3. Configure Clawdis with `DISCORD_BOT_TOKEN` (or `discord.token` in `~/.clawdis/clawdis.json`).
4. Run the gateway; it auto-starts the Discord provider when the token is set.
4. Run the gateway; it auto-starts the Discord provider when the token is set (unless `discord.enabled = false`).
5. Direct chats: use `user:<id>` (or a `<@id>` mention) when delivering; all turns land in the shared `main` session.
6. Guild channels: use `channel:<channelId>` for delivery. Mentions are required by default; disable with `discord.requireMention = false`.
7. Optional DM allowlist: reuse `discord.allowFrom` with user ids (`1234567890` or `discord:1234567890`). Use `"*"` to allow all DMs.
@@ -37,6 +37,7 @@ Note: Discord does not provide a simple username → id lookup without extra gui
```json5
{
discord: {
enabled: true,
token: "abc.123",
allowFrom: ["123456789012345678"],
guildAllowFrom: {

View File

@@ -17,7 +17,7 @@ Status: ready for bot-mode use with grammY (long-polling by default; webhook sup
## How it will work (Bot API)
1) Create a bot with @BotFather and grab the token.
2) Configure Clawdis with `TELEGRAM_BOT_TOKEN` (or `telegram.botToken` in `~/.clawdis/clawdis.json`).
3) Run the gateway; it auto-starts Telegram when the bot token is set.
3) Run the gateway; it auto-starts Telegram when the bot token is set (unless `telegram.enabled = false`).
- **Long-polling** is the default.
- **Webhook mode** is enabled by setting `telegram.webhookUrl` (optionally `telegram.webhookSecret` / `telegram.webhookPath`).
- The webhook listener currently binds to `0.0.0.0:8787` and serves `POST /telegram-webhook` by default.
@@ -42,6 +42,7 @@ Example config:
```json5
{
telegram: {
enabled: true,
botToken: "123:abc",
requireMention: true,
allowFrom: ["123456789"], // direct chat ids allowed (or "*")

View File

@@ -109,6 +109,7 @@ Status: WhatsApp Web via Baileys only. Gateway owns the single session.
- `agent.heartbeat.target`
- `agent.heartbeat.to`
- `session.*` (scope, idle, store, mainKey)
- `web.enabled` (disable provider startup when false)
- `web.heartbeatSeconds`
- `web.reconnect.*`