docs: README, COMMUNITY_POST und BUTTON_GUIDE für v2.0 aktualisiert
This commit is contained in:
+80
-83
@@ -21,11 +21,11 @@
|
||||
|
||||
## Was ist das?
|
||||
|
||||
Dieses Plugin verwandelt Hermes Agent in einen **nativen Rocket.Chat-Benutzer** — mit Echtzeit-Nachrichten, Präsenz-Status und interaktiven Buttons.
|
||||
Dieses Plugin verwandelt Hermes Agent in einen **nativen Rocket.Chat-Benutzer** — mit Echtzeit-Nachrichten über das Hermes Gateway, Präsenz-Status und interaktiven Buttons.
|
||||
|
||||
Statt über ein separates Gateway-Binary zu kommunizieren, spricht Hermes Agent direkt mit Rocket.Chat:
|
||||
- **Eingehend**: WebSocket/DDP für sofortige Nachrichten
|
||||
- **Eingehend**: WebSocket/DDP (`stream-room-messages`) für sofortige Nachrichten
|
||||
- **Ausgehend**: REST-API für Antworten, Buttons, Dateien
|
||||
- **Gateway-nativ**: Registriert sich als `rocketchat-platform` im Hermes Gateway — kein Standalone-Daemon mehr
|
||||
|
||||
---
|
||||
|
||||
@@ -37,8 +37,9 @@ Statt über ein separates Gateway-Binary zu kommunizieren, spricht Hermes Agent
|
||||
| 🟢 Präsenz | Grüner Online-Status im Rocket.Chat |
|
||||
| ✍️ Markdown | Fett, kursiv, `Code`, Blöcke, Links |
|
||||
| 🔘 Interaktive Buttons | Ja/Nein, Bestätigen/Abbrechen, Mehrfachauswahl |
|
||||
| 🔌 REST-Tools | `rocketchat_rooms`, `rocketchat_users`, `rocketchat_dm`, `rocketchat_send` |
|
||||
| 📢 Räume | Kanäle, private Gruppen, Direktnachrichten |
|
||||
| 🔒 Allowlist | Nur erlaubte Benutzer dürfen den Bot nutzen |
|
||||
| 🌍 Bilingual | Installer auf Deutsch & Englisch (`--lang de|en`) |
|
||||
| 📦 Zero-Dependency | Nutzt ausschließlich Python-Standardbibliothek |
|
||||
|
||||
---
|
||||
@@ -51,44 +52,84 @@ Statt über ein separates Gateway-Binary zu kommunizieren, spricht Hermes Agent
|
||||
- Laufender Rocket.Chat-Server (v5+ empfohlen)
|
||||
- Bot-Benutzer auf Rocket.Chat mit Login-Daten
|
||||
|
||||
### 2. Plugin herunterladen
|
||||
### 2. Plugin herunterladen & installieren
|
||||
|
||||
```bash
|
||||
git clone https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin.git
|
||||
cd Hermes_rocket.chat_Plugin
|
||||
```
|
||||
|
||||
### 3. Interaktive Installation (empfohlen)
|
||||
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
|
||||
Das Script führt dich durch alle Schritte, fragt deine Zugangsdaten ab, testet die Verbindung und schreibt die komplette Konfiguration in `~/.hermes/config.yaml`. Fertig in unter 2 Minuten.
|
||||
Der Installer führt interaktiv durch:
|
||||
- Rocket.Chat Server URL
|
||||
- **Bot Username** (der Bot-Account auf dem Server)
|
||||
- Bot Passwort
|
||||
- Home Channel (Name oder ID)
|
||||
|
||||
**Nicht sicher?** Probiere erst die Simulation:
|
||||
Bei bestehender Installation werden alle Werte angezeigt und können bestätigt (ENTER) oder geändert werden.
|
||||
|
||||
**Optionen:**
|
||||
|
||||
```bash
|
||||
./install.sh --dry-run
|
||||
./install.sh --help # Alle Optionen anzeigen
|
||||
./install.sh --lang en # Englisch
|
||||
./install.sh --lang de # Deutsch (Standard)
|
||||
./install.sh --non-interactive # Batch-Mode (RC_URL, RC_BOT_USER, RC_BOT_PASS, RC_HOME_CHANNEL)
|
||||
```
|
||||
|
||||
Zeigt alles an, ändert nichts.
|
||||
### 3. Pairing
|
||||
|
||||
### 4. Manuelles Setup (für Experten)
|
||||
Nach der Installation gibt der Gateway einen **Pairing-Code** aus. Diesen im Home-Channel eingeben, um den Bot zu aktivieren. (Identisch zum Telegram-Integrations-Pattern.)
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.hermes/hermes-agent/plugins/platforms/rocketchat
|
||||
cp plugin.yaml __init__.py adapter.py \
|
||||
~/.hermes/hermes-agent/plugins/platforms/rocketchat/
|
||||
---
|
||||
|
||||
## Architektur
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌─────────────────┐
|
||||
│ Hermes Agent│ Hermes Gateway │ Rocket.Chat │
|
||||
│ (Plugin) │◄── DDP/WebSocket ──────►│ Server │
|
||||
│ │◄── REST API ──────►│ (v5+) │
|
||||
└─────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
Dann `~/.hermes/config.yaml` bearbeiten (siehe nächster Abschnitt).
|
||||
**Plugin-Dateien:**
|
||||
|
||||
### 5. Konfigurieren
|
||||
| Datei | Größe | Funktion |
|
||||
|-------|-------|----------|
|
||||
| `plugin/adapter.py` | ~27 KB | DDP-Client, Session-Handling, Nachrichten-Parsing, Reconnect, Button-Rendering |
|
||||
| `plugin/__init__.py` | ~4,5 KB | Plugin-Registrierung, Interaction Templates |
|
||||
| `plugin/tools.py` | ~32 KB | 4 Rocket.Chat REST-Tools für Agent-Kontext |
|
||||
| `plugin/plugin.yaml` | 0,8 KB | Metadaten, Env-Vars |
|
||||
|
||||
Das install.sh schreibt automatisch in `config.yaml`. Hier die manuelle Referenz:
|
||||
---
|
||||
|
||||
## Button-Templates
|
||||
|
||||
| Template | Nutzung |
|
||||
|----------|---------|
|
||||
| `yes_no` | ✅ Ja / ❌ Nein |
|
||||
| `confirm_cancel` | ✅ Bestätigen / 🚫 Abbrechen |
|
||||
| `ok` | 👍 OK |
|
||||
| `multi_choice_3` | 1. Links / 2. Rechts / 3. Zwei Runden |
|
||||
| `custom` | Beliebige Labels via `custom_buttons` |
|
||||
|
||||
**Button-Label-Regeln:**
|
||||
- Desktop-App schneidet bei **~5–7 Zeichen** ab
|
||||
- **NIEMALS Underscores (`_`)** in Button-Texten — zerstört Rendering
|
||||
- Leerzeichen sind erlaubt: `1. Links`
|
||||
- Pattern: Lange Optionen im Text, Buttons mit Kurzreferenz (`1. Links`, `2. Rechts`)
|
||||
|
||||
Details: [docs/BUTTON_GUIDE.md](docs/BUTTON_GUIDE.md)
|
||||
|
||||
---
|
||||
|
||||
## Konfiguration (Referenz)
|
||||
|
||||
`install.sh` schreibt automatisch. Manuelle Referenz:
|
||||
|
||||
```yaml
|
||||
# ~/.hermes/config.yaml
|
||||
plugins:
|
||||
enabled:
|
||||
- rocketchat-platform
|
||||
@@ -101,88 +142,44 @@ gateway:
|
||||
base_url: "https://rocketchat.example.com"
|
||||
home_channel:
|
||||
platform: rocketchat
|
||||
chat_id: "J3jvMyrKTMzKvKHSh"
|
||||
chat_id: "69f4e..."
|
||||
name: "ki-assistent"
|
||||
|
||||
toolsets:
|
||||
- rocketchat
|
||||
```
|
||||
|
||||
### 6. Starten
|
||||
|
||||
```bash
|
||||
hermes gateway restart
|
||||
# ~/.config/hermes/rocketchat.env (chmod 600)
|
||||
ROCKETCHAT_BASE_URL=https://rocketchat.example.com
|
||||
ROCKETCHAT_USER=botuser
|
||||
ROCKETCHAT_PASSWORD=...
|
||||
ROCKETCHAT_ALLOW_ALL_USERS=true
|
||||
GATEWAY_ALLOW_ALL_USERS=true
|
||||
```
|
||||
|
||||
Hermes Agent verbindet sich automatisch mit Rocket.Chat und erscheint als Online-Benutzer (grüner Punkt).
|
||||
|
||||
---
|
||||
|
||||
## Architektur
|
||||
|
||||
```
|
||||
┌─────────────┐ DDP/WebSocket ┌─────────────────┐
|
||||
│ Hermes Agent│ ◄────────────────────► │ Rocket.Chat │
|
||||
│ (Plugin) │ │ Server │
|
||||
│ │ REST API │ │
|
||||
│ │ ─────────────────────► │ (v5+) │
|
||||
└─────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
- **adapter.py** (~26 kB): DDP-Client, Session-Handling, Nachrichten-Parsing, Reconnect-Logik, Button-Rendering
|
||||
- **__init__.py**: Plugin-Registrierung, Template-Definitionen für Buttons
|
||||
- **plugin.yaml**: Metadaten, Env-Vars
|
||||
|
||||
---
|
||||
|
||||
## Button-Templates
|
||||
|
||||
Das Plugin bringt vordefinierte Interaktionen mit:
|
||||
|
||||
| Template | Nutzung |
|
||||
|----------|---------|
|
||||
| `yes_no` | ✅ Ja / ❌ Nein |
|
||||
| `confirm_cancel` | ✅ Bestätigen / 🚫 Abbrechen |
|
||||
| `ok` | 👍 OK |
|
||||
| `multi_choice_3` | 1. Links / 2. Rechts / 3. Zwei Runden |
|
||||
|
||||
**Button-Label-Regeln:**
|
||||
- Desktop-App schneidet bei **~5–7 Zeichen** ab → Labels mit Nummer/Merkmal beginnen (`1. Links`)
|
||||
- **NIEMALS Underscores (`_`)** in Button-Texten — zerstört Rendering komplett
|
||||
- Leerzeichen sind erlaubt
|
||||
- Pattern: Lange Texte in der Nachricht, Buttons mit Kurzreferenz
|
||||
|
||||
---
|
||||
|
||||
## Aktueller Status
|
||||
|
||||
- **Version**: 1.0.0
|
||||
- **Version**: 2.0.0
|
||||
- **Stabilität**: Produktiv im Einsatz (seit Mai 2026)
|
||||
- **Getestet mit**: Rocket.Chat v5.x, Hermes Agent Gateway
|
||||
- **Lizenz**: [Unlicense](LICENSE) — Public Domain
|
||||
|
||||
---
|
||||
|
||||
## Roadmap / Offen
|
||||
## Changelog
|
||||
|
||||
- [ ] OAuth / Token-Auth neben Passwort-Login
|
||||
- [ ] Threading-Unterstützung für Kanäle
|
||||
- [ ] Datei-Upload (Bilder, Dokumente)
|
||||
- [ ] Slash-Command-Integration auf Rocket.Chat-Seite
|
||||
- [ ] Mehrsprachige Button-Templates
|
||||
### v2.0.0 (Mai 2026)
|
||||
- Gateway-natives Plugin (kein Standalone-Daemon mehr)
|
||||
- `tools.py`: 4 Rocket.Chat REST-Tools für Agent-Kontext
|
||||
- Neuer bilingualer `install.sh` (DE/EN, `--help`, `--non-interactive`, Re-Install-Erkennung)
|
||||
- "Bot Username"-Prompt statt "Username"
|
||||
- `BasePlatformAdapter`-Vererbung, DDP `added`-Events, case-insensitive Filter
|
||||
|
||||
---
|
||||
|
||||
## Mitmachen
|
||||
|
||||
Da das Plugin reines Python und nur Standardbibliothek nutzt, ist der Einstieg niedrig:
|
||||
|
||||
1. Repo clonen
|
||||
2. `adapter.py` bearbeiten
|
||||
3. Testen mit `hermes gateway start --debug`
|
||||
4. Pull Request oder Patch schicken
|
||||
|
||||
Kein Build-Step, keine Node-Dependencies, kein Docker nötig.
|
||||
### v1.0.0 (Mai 2026)
|
||||
- Initialer Standalone-Daemon-Release
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,174 +1,104 @@
|
||||
# Hermes_rocket.chat_Plugin
|
||||
# Hermes Rocket.Chat Plugin
|
||||
|
||||
> Nützliches Add-on für [Hermes Agent](https://hermes-agent.nousresearch.com/)
|
||||
> um Rocket.Chat als Messaging-Plattform zu nutzen.
|
||||
> Bidirectional real-time messaging between Hermes Agent and self-hosted Rocket.Chat servers.
|
||||
> Zero external dependencies — uses WebSocket/DDP + REST API.
|
||||
|
||||
Stellt einen nativen Chatclient für das Hermes Agent Gateway bereit — mit Echtzeit-Nachrichten via WebSocket/DDP und REST-API für ausgehende Antworten.
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ HAFTUNGSAUSSCHLUSS
|
||||
|
||||
**DIESES PLUGIN WIRD OHNE JEGLICHE GEWÄHRLEISTUNG BEREITGESTELLT.**
|
||||
|
||||
- Die Nutzung erfolgt **ausschließlich auf eigene Gefahr**.
|
||||
- Der Autor übernimmt **keinerlei Haftung** für Schäden, Datenverluste, Sicherheitsvorfälle, fehlerhafte Konfigurationen oder sonstige Nachteile, die aus der Installation oder Nutzung dieses Plugins entstehen können.
|
||||
- Dieses Plugin ist ein **inoffizielles Community-Projekt**. Es steht in keiner Verbindung zu Rocket.Chat (Rocket.Chat Technologies Corp.) oder Nous Research.
|
||||
- Vor dem Produktiveinsatz sind **eigene Sicherheitsprüfungen und Tests** zwingend erforderlich.
|
||||
- Das Plugin wird unter der [Unlicense](LICENSE) veröffentlicht — es kommt **wie gesehen ("as-is")**, ohne Mängelgewähr und ohne Support-Garantie.
|
||||
|
||||
**Wer dieses Plugin installiert oder einsetzt, erklärt sich mit diesen Bedingungen einverstanden.**
|
||||
|
||||
---
|
||||
|
||||
## Schnellstart (für Neulinge)
|
||||
|
||||
### 1. Voraussetzungen
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt install -y curl git python3 bash
|
||||
```
|
||||
|
||||
### 2. Plugin herunterladen
|
||||
|
||||
```bash
|
||||
cd /tmp
|
||||
git clone https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin.git
|
||||
cd Hermes_rocket.chat_Plugin
|
||||
```
|
||||
|
||||
### 3. Installation starten
|
||||
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
|
||||
Falls du erst testen möchtest, was passieren würde:
|
||||
|
||||
```bash
|
||||
./install.sh --dry-run
|
||||
```
|
||||
|
||||
Das Script führt dich Schritt für Schritt durch:
|
||||
- 🔵 Prüfe Voraussetzungen (curl, git, python3)
|
||||
- 🔵 Erstelle Plugin-Verzeichnis
|
||||
- 🔵 Kopiere alle Dateien
|
||||
- 🔵 Frage deine Rocket.Chat-Daten ab
|
||||
- 🔵 Teste die Verbindung
|
||||
- 🔵 Schreibe ALLE Einstellungen in `~/.hermes/config.yaml`
|
||||
- 🔵 Ergänzt `.env` für API-Keys
|
||||
|
||||
Am Ende ist das Plugin einsatzbereit — einfach `hermes gateway restart`.
|
||||
|
||||
---
|
||||
|
||||
## Manuelle Installation (Experten)
|
||||
|
||||
Wer das Setup lieber von Hand macht:
|
||||
|
||||
```bash
|
||||
# Plugin-Verzeichnis anlegen
|
||||
mkdir -p ~/.hermes/hermes-agent/plugins/platforms/rocketchat
|
||||
|
||||
# Dateien hineinkopieren
|
||||
cp plugin.yaml ~/.hermes/hermes-agent/plugins/platforms/rocketchat/
|
||||
cp __init__.py ~/.hermes/hermes-agent/plugins/platforms/rocketchat/
|
||||
cp adapter.py ~/.hermes/hermes-agent/plugins/platforms/rocketchat/
|
||||
```
|
||||
|
||||
### Konfiguration über `config.yaml` (empfohlen)
|
||||
|
||||
```yaml
|
||||
plugins:
|
||||
enabled:
|
||||
- rocketchat-platform
|
||||
|
||||
gateway:
|
||||
platforms:
|
||||
rocketchat:
|
||||
enabled: true
|
||||
extra:
|
||||
base_url: "https://rocketchat.example.com"
|
||||
home_channel:
|
||||
platform: rocketchat
|
||||
chat_id: "J3jvMyrKTMzKvKHSh"
|
||||
name: "ki-assistent"
|
||||
|
||||
toolsets:
|
||||
- rocketchat
|
||||
```
|
||||
|
||||
### Konfiguration über Umgebungsvariablen
|
||||
|
||||
```bash
|
||||
export ROCKETCHAT_BASE_URL="https://rocketchat.example.com"
|
||||
export ROCKETCHAT_USER="bernd"
|
||||
export ROCKETCHAT_PASSWORD="dein-passwort"
|
||||
```
|
||||
|
||||
---
|
||||
**⚠️ Community Add-on — not an official Nous Research product.**
|
||||
This plugin is maintained independently. Use at your own risk. See [LICENSE](LICENSE).
|
||||
|
||||
## Features
|
||||
|
||||
| Feature | Beschreibung |
|
||||
|---------|-------------|
|
||||
| 🚀 Echtzeit-Streaming | DDP/WebSocket für sofortige eingehende Nachrichten |
|
||||
| 🟢 Präsenz | Grüner Online-Status im Rocket.Chat |
|
||||
| ✍️ Markdown | Fett, kursiv, `Code`, Blöcke, Links |
|
||||
| 🔘 Interaktive Buttons | Ja/Nein, Bestätigen/Abbrechen, Mehrfachauswahl |
|
||||
| 📢 Räume | Kanäle, private Gruppen, Direktnachrichten |
|
||||
| 🔒 Allowlist | Steuerung, wer den Bot nutzen darf |
|
||||
| 📦 Zero-Dependency | Nur Python-Standardbibliothek |
|
||||
- 🟢 **Real-time messaging** via DDP/WebSocket (`stream-room-messages`)
|
||||
- 💬 **Interactive buttons** — Native Rocket.Chat attachments with `question_id::choice` correlation
|
||||
- 🔌 **4 REST tools** — `rocketchat_rooms`, `rocketchat_users`, `rocketchat_dm`, `rocketchat_send`
|
||||
- 🟢 **Online presence** — Green dot via DDP `UserPresence`
|
||||
- ♻️ **Auto-reconnect** with exponential backoff
|
||||
- 🌍 **Bilingual installer** — German & English (`--lang de|en`)
|
||||
|
||||
---
|
||||
## Quick Install
|
||||
|
||||
## Button-Labels — Wichtige Regeln
|
||||
|
||||
Rocket.Chat verhält sich je nach Plattform unterschiedlich:
|
||||
|
||||
| Plattform | Verhalten |
|
||||
|-----------|-----------|
|
||||
| **Desktop-App** | Schneidet bei **~5–7 Zeichen** ab (`1234567…`) |
|
||||
| **Mobile App** | Vollständiger Text sichtbar |
|
||||
|
||||
**Kritische Regeln:**
|
||||
- ❌ **NIEMALS Underscores (`_`) in Button-Texten** — zerstört das Button-Rendering komplett (nur grauer Container ohne Buttons)
|
||||
- ✅ **Leerzeichen sind erlaubt** — `1. Links`, `2. Rechts`
|
||||
- ✅ **Emojis helfen** — `✅Ja`, `❌Nein`
|
||||
- ✅ **Text + Nummer an den Anfang** — `1. Links`, `2. Rechts`
|
||||
|
||||
**Empfohlenes Pattern:** Lange Optionen im Text nummeriert, Buttons mit Kurzreferenz:
|
||||
```
|
||||
Text: "1. Links um den Code kopieren\n2. Rechts um den Code fliegen"
|
||||
Buttons: ["1. Links", "2. Rechts"]
|
||||
```bash
|
||||
git clone https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin.git
|
||||
cd Hermes_rocket.chat_Plugin
|
||||
./install.sh
|
||||
```
|
||||
|
||||
---
|
||||
The installer will ask for:
|
||||
- Rocket.Chat server URL
|
||||
- Bot username (the bot account on your Rocket.Chat server)
|
||||
- Bot password
|
||||
- Home channel (name or room ID)
|
||||
|
||||
## Was ist im Paket?
|
||||
**After installation:** The gateway will output a pairing code — enter it in your home channel to activate the bot.
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
Hermes_rocket.chat_Plugin/
|
||||
├── install.sh ← Interaktives Setup (schreibt config.yaml)
|
||||
├── _merge_config.py ← Python-Script für config.yaml-Management
|
||||
├── README.md ← Diese Datei
|
||||
├── COMMUNITY_POST.md ← Fertige Vorlage für Foren/Reddit
|
||||
├── plugin.yaml ← Plugin-Metadaten
|
||||
├── __init__.py ← Plugin-Einstieg, Button-Templates
|
||||
├── adapter.py ← DDP/WebSocket + REST Adapter
|
||||
└── LICENSE ← Unlicense (Public Domain)
|
||||
./install.sh --help # Show all options
|
||||
./install.sh --lang en # English
|
||||
./install.sh --lang de # German (default)
|
||||
./install.sh --non-interactive # Batch mode (reads from env vars)
|
||||
```
|
||||
|
||||
---
|
||||
## Architecture
|
||||
|
||||
## Hilfe & Support
|
||||
```
|
||||
Rocket.Chat Server
|
||||
↕ WebSocket/DDP + REST
|
||||
Hermes Gateway (plugin)
|
||||
↕
|
||||
Hermes Agent ← → LLM inference
|
||||
```
|
||||
|
||||
- **Hermes Agent Docs**: https://hermes-agent.nousresearch.com/
|
||||
- **Rocket.Chat**: https://www.rocket.chat/
|
||||
- **Dieses Repo**: https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin
|
||||
The plugin registers as `rocketchat-platform` in Hermes' bundled plugin path (`hermes-agent/plugins/platforms/rocketchat/`).
|
||||
|
||||
---
|
||||
## Interactive Buttons
|
||||
|
||||
## Lizenz
|
||||
The plugin supports native Rocket.Chat buttons. The agent sends them via `send_message` with metadata:
|
||||
|
||||
[Unlicense](LICENSE) — Public Domain
|
||||
```python
|
||||
send_message(
|
||||
target="rocketchat:protonbridge",
|
||||
text="Proceed?",
|
||||
metadata={
|
||||
"template": "custom",
|
||||
"question_id": "confirm_42",
|
||||
"button_title": "Choose:",
|
||||
"custom_buttons": ["✅ Yes", "❌ No"]
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
User click returns: `confirm_42::✅ Yes`
|
||||
|
||||
**Button label rules:**
|
||||
- Max ~7 visible characters on desktop (mobile shows full text)
|
||||
- **NO underscores** — breaks Rocket.Chat rendering
|
||||
- Spaces allowed: `1. Left`, `2. Right`
|
||||
- Prefix with number/keyword for distinguishability
|
||||
|
||||
See [docs/BUTTON_GUIDE.md](docs/BUTTON_GUIDE.md) for full details.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Set in `~/.config/hermes/rocketchat.env` (generated by install.sh):
|
||||
|
||||
```bash
|
||||
ROCKETCHAT_BASE_URL=https://rocketchat.example.com
|
||||
ROCKETCHAT_USER=botuser
|
||||
ROCKETCHAT_PASSWORD=...
|
||||
ROCKETCHAT_ROOM_NAME=ki-assistent
|
||||
ROCKETCHAT_ALLOW_ALL_USERS=true
|
||||
GATEWAY_ALLOW_ALL_USERS=true
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Hermes Agent installed
|
||||
- Self-hosted Rocket.Chat server (V5+)
|
||||
- Bot user account on the Rocket.Chat server
|
||||
- Python 3.10+ (hermes-agent venv)
|
||||
|
||||
## License
|
||||
|
||||
[Unlicense](LICENSE) — Public Domain. See [LICENSE](LICENSE).
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# Button Guide — Hermes Rocket.Chat Plugin
|
||||
|
||||
## How to Send Buttons
|
||||
|
||||
The agent uses `send_message` with a `metadata` dict. The adapter converts this to native Rocket.Chat attachments.
|
||||
|
||||
### Built-in Templates
|
||||
|
||||
| Template | Buttons | Label Length |
|
||||
|----------|---------|-------------|
|
||||
| `yes_no` | ✅Ja / ❌Nein | 4-5 chars |
|
||||
| `confirm_cancel` | ✅Bestätigen / 🚫Abbrechen | 11-12 chars* |
|
||||
| `ok` | 👍OK | 3 chars |
|
||||
| `multi_choice_3` | 1. Links / 2. Rechts / 3. Zwei Runden | 8-13 chars |
|
||||
|
||||
*Desktop truncation at ~7 chars — `Bestätigen` shows as `Bestäti…` but full value transmitted on click.
|
||||
|
||||
### Custom Buttons
|
||||
|
||||
```python
|
||||
send_message(
|
||||
target="rocketchat:protonbridge",
|
||||
text="Should I proceed?",
|
||||
metadata={
|
||||
"template": "custom",
|
||||
"question_id": "confirm_42",
|
||||
"button_title": "Choice:",
|
||||
"custom_buttons": ["✅Ja", "❌Nein", "🟡Später"]
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
## How to Receive Button Clicks
|
||||
|
||||
Button clicks arrive as plain text:
|
||||
|
||||
```
|
||||
confirm_42::✅Ja
|
||||
```
|
||||
|
||||
The `question_id` is the prefix, the chosen label follows after `::`.
|
||||
|
||||
## Button Label Rules
|
||||
|
||||
### Critical Rules
|
||||
|
||||
1. **NO underscores (`_`)** — destroys button rendering completely (grey container, no buttons)
|
||||
2. **Desktop truncation at ~7 chars** — first 7 characters must be distinguishable across all buttons in a group
|
||||
3. **Mobile shows full text** — but design for desktop-first
|
||||
4. **Spaces ARE allowed** — `1. Links` works; `1._Links` breaks
|
||||
|
||||
### Platform Behavior
|
||||
|
||||
| Platform | Behavior |
|
||||
|----------|----------|
|
||||
| Desktop App | Truncates at ~5-7 chars → `1234567…` |
|
||||
| Mobile App | Full text visible |
|
||||
| Clipboard | Always full text |
|
||||
|
||||
### Best Practice: Numbered References
|
||||
|
||||
Put full descriptions in the message body, use short numbered references as button labels:
|
||||
|
||||
```python
|
||||
text = (
|
||||
"**Options:**\n"
|
||||
"1. Copy program code to the left\n"
|
||||
"2. Fly around the program code\n"
|
||||
"3. Spin twice around own axis"
|
||||
)
|
||||
buttons = ["1. Links", "2. Rechts", "3. Zwei Runden"]
|
||||
```
|
||||
|
||||
### Emoji+Text Pattern (Preferred by Operator)
|
||||
|
||||
```python
|
||||
buttons = ["✅Ja", "❌Nein", "🟡Später"]
|
||||
```
|
||||
|
||||
Short, distinguishable, visually distinct.
|
||||
|
||||
## Why `question_id` Is Mandatory
|
||||
|
||||
Without it, a late click on an old button creates silent context errors. Always assign descriptive, domain-prefixed IDs:
|
||||
|
||||
- `confirm_42`, `export_format_001`, `direction_left_right`
|
||||
|
||||
## Full Multi-Step Example
|
||||
|
||||
```python
|
||||
# Step 1: Choose format
|
||||
send_message(
|
||||
target="rocketchat:protonbridge",
|
||||
text="Which export format?",
|
||||
metadata={
|
||||
"template": "custom",
|
||||
"button_title": "Format:",
|
||||
"question_id": "export_format_001",
|
||||
"custom_buttons": ["CSV", "JSON", "Excel"]
|
||||
}
|
||||
)
|
||||
# User clicks → "export_format_001::CSV"
|
||||
|
||||
# Step 2: Choose destination
|
||||
send_message(
|
||||
target="rocketchat:protonbridge",
|
||||
text="Where to send the CSV?",
|
||||
metadata={
|
||||
"template": "custom",
|
||||
"button_title": "Destination:",
|
||||
"question_id": "export_dest_001",
|
||||
"custom_buttons": ["📧Mail", "💾Download", "☁️Cloud"]
|
||||
}
|
||||
)
|
||||
# User clicks → "export_dest_001::💾Download"
|
||||
```
|
||||
Reference in New Issue
Block a user