|
@@ -2,38 +2,19 @@
|
|
|
|
|
|
|
|
A [Chatto](https://github.com/chattocorp/chatto) platform adapter plugin for [Hermes Agent](https://github.com/NousResearch/hermes-agent). Connects your self-hosted Chatto server to Hermes so you can interact with the agent through chat rooms and DMs.
|
|
A [Chatto](https://github.com/chattocorp/chatto) platform adapter plugin for [Hermes Agent](https://github.com/NousResearch/hermes-agent). Connects your self-hosted Chatto server to Hermes so you can interact with the agent through chat rooms and DMs.
|
|
|
|
|
|
|
|
-## Features
|
|
|
|
|
-
|
|
|
|
|
-- **WebSocket realtime** — binary protobuf codec for Chatto's realtime protocol (no protobuf library needed — pure stdlib)
|
|
|
|
|
-- **ConnectRPC REST API** — JSON over HTTP for outbound messages, room discovery, user lookup
|
|
|
|
|
-- **Thread support** — `GetThreadEvents` for thread replies, auto-thread creation, proper `threadRootEventId` handling
|
|
|
|
|
-- **DM support** — DMs always get a response, no threading in DM rooms
|
|
|
|
|
-- **Mention filtering** — `require_mention` (default true) with `free_response_channels` for no-tag rooms
|
|
|
|
|
-- **Dynamic room discovery** — auto-joins new rooms without gateway restart
|
|
|
|
|
-- **Event handling** — `message_posted`, `mention_notification`, `new_dm_notification`, `session_terminated` (force reconnect), `message_retracted`, `user_left_room`, `room_created`, `user_joined_room`
|
|
|
|
|
-- **Presence broadcasting** — periodic presence refresh
|
|
|
|
|
-- **Notification dismissal** — marks notifications as read after processing
|
|
|
|
|
-- **Standalone cron delivery** — works outside the gateway process
|
|
|
|
|
-
|
|
|
|
|
-## Installation
|
|
|
|
|
|
|
+## Install
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
-# Clone into your Hermes plugins directory
|
|
|
|
|
-git clone https://github.com/jrimmer/hermes-chatto-plugin.git /tmp/chatto-plugin
|
|
|
|
|
-
|
|
|
|
|
-# Copy the plugin into place
|
|
|
|
|
-cp -r /tmp/chatto-plugin/plugins/platforms/chatto ~/.hermes/plugins/platforms/chatto
|
|
|
|
|
|
|
+hermes plugins install jrimmer/hermes-chatto-plugin
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Or if you're using a profile:
|
|
|
|
|
|
|
+Or with the full URL:
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
-cp -r /tmp/chatto-plugin/plugins/platforms/chatto ~/.hermes/profiles/<profile>/plugins/platforms/chatto
|
|
|
|
|
|
|
+hermes plugins install https://github.com/jrimmer/hermes-chatto-plugin.git
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Configuration
|
|
|
|
|
-
|
|
|
|
|
-Add your Chatto credentials to `~/.hermes/.env`:
|
|
|
|
|
|
|
+Then add your Chatto credentials to `~/.hermes/.env`:
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
CHATTO_URL=https://chat.example.com
|
|
CHATTO_URL=https://chat.example.com
|
|
@@ -42,22 +23,10 @@ CHATTO_PASSWORD=your-password
|
|
|
CHATTO_HOME_CHANNEL=REljMv5Pgolo6Y9
|
|
CHATTO_HOME_CHANNEL=REljMv5Pgolo6Y9
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Then enable the plugin in `~/.hermes/config.yaml`:
|
|
|
|
|
|
|
+Enable the plugin (if not auto-enabled during install):
|
|
|
|
|
|
|
|
-```yaml
|
|
|
|
|
-plugins:
|
|
|
|
|
- enabled:
|
|
|
|
|
- - platforms/chatto
|
|
|
|
|
-
|
|
|
|
|
-gateway:
|
|
|
|
|
- platforms:
|
|
|
|
|
- chatto:
|
|
|
|
|
- enabled: true
|
|
|
|
|
- extra:
|
|
|
|
|
- url: https://chat.example.com
|
|
|
|
|
- require_mention: true
|
|
|
|
|
- home_channel: REljMv5Pgolo6Y9
|
|
|
|
|
- free_response_channels: []
|
|
|
|
|
|
|
+```bash
|
|
|
|
|
+hermes plugins enable chatto-platform
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Restart the gateway:
|
|
Restart the gateway:
|
|
@@ -66,7 +35,7 @@ Restart the gateway:
|
|
|
hermes gateway restart
|
|
hermes gateway restart
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Configuration Options
|
|
|
|
|
|
|
+## Configuration
|
|
|
|
|
|
|
|
### Environment Variables
|
|
### Environment Variables
|
|
|
|
|
|
|
@@ -83,28 +52,42 @@ hermes gateway restart
|
|
|
| `CHATTO_ALLOWED_USERS` | No | Comma-separated Chatto logins allowed to talk to the bot |
|
|
| `CHATTO_ALLOWED_USERS` | No | Comma-separated Chatto logins allowed to talk to the bot |
|
|
|
| `CHATTO_ALLOW_ALL_USERS` | No | Allow any Chatto user to talk to the bot (true/false) |
|
|
| `CHATTO_ALLOW_ALL_USERS` | No | Allow any Chatto user to talk to the bot (true/false) |
|
|
|
|
|
|
|
|
-### YAML Config
|
|
|
|
|
|
|
+### YAML Config (optional)
|
|
|
|
|
+
|
|
|
|
|
+You can also configure via `~/.hermes/config.yaml` instead of env vars:
|
|
|
|
|
|
|
|
-| Key | Default | Description |
|
|
|
|
|
-|-----|---------|-------------|
|
|
|
|
|
-| `url` | — | Chatto server URL |
|
|
|
|
|
-| `require_mention` | `true` | Only respond to @mentions in public rooms |
|
|
|
|
|
-| `home_channel` | first room | Room ID for cron delivery |
|
|
|
|
|
-| `free_response_channels` | `[]` | Rooms where the bot responds without being tagged |
|
|
|
|
|
-| `channels` | all joined | List of room IDs to watch |
|
|
|
|
|
|
|
+```yaml
|
|
|
|
|
+gateway:
|
|
|
|
|
+ platforms:
|
|
|
|
|
+ chatto:
|
|
|
|
|
+ enabled: true
|
|
|
|
|
+ extra:
|
|
|
|
|
+ url: https://chat.example.com
|
|
|
|
|
+ require_mention: true
|
|
|
|
|
+ home_channel: REljMv5Pgolo6Y9
|
|
|
|
|
+ free_response_channels: []
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+## Features
|
|
|
|
|
+
|
|
|
|
|
+- **WebSocket realtime** — binary protobuf codec for Chatto's realtime protocol (no protobuf library needed)
|
|
|
|
|
+- **ConnectRPC REST API** — JSON over HTTP for outbound messages, room discovery, user lookup
|
|
|
|
|
+- **Thread support** — `GetThreadEvents` for thread replies, auto-thread creation, proper `threadRootEventId` handling
|
|
|
|
|
+- **DM support** — DMs always get a response, no threading in DM rooms
|
|
|
|
|
+- **Mention filtering** — `require_mention` (default true) with `free_response_channels` for no-tag rooms
|
|
|
|
|
+- **Dynamic room discovery** — auto-joins new rooms without gateway restart (watches `room_created` / `user_joined_room` events)
|
|
|
|
|
+- **Event handling** — `message_posted`, `mention_notification`, `new_dm_notification`, `session_terminated` (force reconnect), `message_retracted`, `user_left_room`
|
|
|
|
|
+- **Presence broadcasting** — periodic presence refresh
|
|
|
|
|
+- **Standalone cron delivery** — works outside the gateway process
|
|
|
|
|
|
|
|
## How It Works
|
|
## How It Works
|
|
|
|
|
|
|
|
The adapter connects to Chatto via two channels:
|
|
The adapter connects to Chatto via two channels:
|
|
|
|
|
|
|
|
-1. **WebSocket** (`/api/realtime`) — receives realtime events (messages, mentions, DMs, room changes) as binary protobuf frames
|
|
|
|
|
|
|
+1. **WebSocket** (`/api/realtime`) — receives realtime events as binary protobuf frames
|
|
|
2. **ConnectRPC REST** (`/api/connect/`) — sends messages, fetches room events, joins rooms, manages presence
|
|
2. **ConnectRPC REST** (`/api/connect/`) — sends messages, fetches room events, joins rooms, manages presence
|
|
|
|
|
|
|
|
-When a message is received:
|
|
|
|
|
-1. The WebSocket frame is decoded as a protobuf envelope
|
|
|
|
|
-2. If it's a `message_posted` event, the message body is fetched via REST (`GetRoomEvents` or `GetThreadEvents` for thread replies)
|
|
|
|
|
-3. The message is dispatched to the Hermes agent
|
|
|
|
|
-4. The agent's response is sent back via `CreateMessage` with proper threading
|
|
|
|
|
|
|
+When a message is received, the WebSocket frame is decoded, the message body is fetched via REST, dispatched to the Hermes agent, and the response is sent back via `CreateMessage` with proper threading.
|
|
|
|
|
|
|
|
## Tested Against
|
|
## Tested Against
|
|
|
|
|
|