Fast-Path-Plugin raus, offizielle quick_commands rein (funktioniert auch in der TUI)
Root Cause fuers "geht trotzdem ans LLM": unser fast-paths-Plugin war auf pre_gateway_dispatch registriert -- der Hook feuert laut Sourcecode nur fuer die Gateway-Plattformen (Telegram/Discord/...), nicht fuer die TUI (tui_gateway/server.py), die komplett am Gateway-Dispatcher vorbei direkt in den Agent-Loop laeuft. Ein Patch an tui_gateway/server.py waere noetig gewesen, aber Concurrency-kritischer Kern-Code -- zu riskant. Hermes hat dafuer schon einen eigenen Mechanismus: quick_commands (type: exec) bypassen den Agent-Loop nachweislich auf JEDER Plattform inkl. TUI, kein LLM-Call, keine Tokens, offiziell dokumentiert. Trade-off: fester Slash-Befehl statt Freitext (/next statt "naechstes Lied") -- gleiches Prinzip wie Alexas Intent-Slots, ohne Slot-Fuellung. scripts/spotify_quick.py buendelt next/previous/pause/play/volume_up/ volume_down/current in einem Skript (ein Argument pro Aktion), nutzt denselben SpotifyClient wie der echte Tool-Dispatch. docker-compose.yml mountet scripts/ jetzt read-only nach /opt/data/scripts statt fast-paths/ nach /opt/data/plugins/fast-paths. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -320,31 +320,79 @@ oben), nicht an Spotify selbst — dann `docker logs hermes-proxy` waehrend
|
||||
der Reproduktion pruefen. Gleiches Nutzungsmuster wie
|
||||
`scripts/spotify_manual_auth.py` (Login-Skript weiter oben).
|
||||
|
||||
## Fast-Paths (Steuerbefehle ohne LLM-Roundtrip)
|
||||
## Fast-Path ohne LLM (quick_commands)
|
||||
|
||||
Selbst mit allen Fixes oben braucht jede Nachricht mindestens einen vollen
|
||||
LLM-Turn (mehrere Sekunden) — fuer "pause" oder "naechstes Lied" unnoetig
|
||||
langsam. `fast-paths/` ist ein eigenes, universelles Plugin (ein File pro
|
||||
Skill, siehe `fast-paths/README.md`), das einfache Steuerbefehle per Regex
|
||||
VOR dem LLM-Aufruf abfaengt und direkt ausfuehrt — analog zu ARIAs eigenen
|
||||
`fast_patterns`. Aktuell drin: `patterns/spotify.py`
|
||||
(pause/weiter/next/previous/lauter/leiser/Lautstaerke/aktueller Titel, plus
|
||||
"spiel Playlist X auf Geraet Y ab" per Fuzzy-Match ohne LLM).
|
||||
langsam.
|
||||
|
||||
Einmalig aktivieren (Plugins sind bei Hermes Opt-in) — in
|
||||
`hermes-data/agent-home/config.yaml`:
|
||||
**Erster Anlauf war ein eigenes Plugin** (`fast-paths/`, Regex-Hook auf
|
||||
`pre_gateway_dispatch`) — das ist wieder raus. Root Cause (im echten
|
||||
Hermes-Sourcecode verifiziert, nicht geraten): `pre_gateway_dispatch` feuert
|
||||
NUR fuer die Gateway-Plattformen (Telegram/Discord/Slack/...), NICHT fuer die
|
||||
TUI (`tui_gateway/server.py`) — die laeuft komplett am Gateway-Dispatcher
|
||||
vorbei direkt in den Agent-Loop. Da wir hier fast ausschliesslich die TUI
|
||||
nutzen, griff das Plugin praktisch nie; die vier `Spotify Playback`-Calls in
|
||||
Folge, die Claude bei "nächstes" gemacht hat, kamen weil's doch beim LLM
|
||||
landete. Ein Patch direkt in `tui_gateway/server.py` waere der einzige Weg
|
||||
gewesen — aber Concurrency-kritischer Kern-Code (~700 Zeilen, History-Lock,
|
||||
Busy-Queue), zu riskant fuer einen Sed-Patch.
|
||||
|
||||
**Stattdessen: Hermes' eigener, offizieller Mechanismus — `quick_commands`.**
|
||||
Laut Sourcecode (`cli.py::process_command`, `tui_gateway/server.py`,
|
||||
`gateway/run.py`) bypassen `type: exec`-Quick-Commands den kompletten
|
||||
Agent-Loop — kein LLM-Call, keine Tokens — und funktionieren offiziell
|
||||
dokumentiert auf JEDER Plattform (CLI/TUI, Telegram, Discord, Slack,
|
||||
WhatsApp, Signal, Email, Home Assistant). Kein Patch an Hermes-Core-Dateien
|
||||
noetig, nur Config + ein Skript.
|
||||
|
||||
**Der Trade-off (ehrlich):** quick_commands sind Slash-Befehle mit festem
|
||||
Namen — kein Freitext, keine Argumente werden durchgereicht. `/next` statt
|
||||
"naechstes Lied". Fuer feste Steuerbefehle reicht das genauso wie Alexas
|
||||
Intent-Slots (siehe Chat-Verlauf), nur ohne Slot-Fuellung. Freitext-Faelle
|
||||
wie "spiel Playlist Fliegen auf dem Handy ab" bleiben bewusst beim LLM (das
|
||||
braucht ohnehin ein Modell, um den Playlist-Namen aus dem Satz zu holen).
|
||||
|
||||
Skript: `scripts/spotify_quick.py <next|previous|pause|play|volume_up|volume_down|current>`
|
||||
— nutzt denselben `SpotifyClient` wie der echte Tool-Dispatch, gleiche
|
||||
OAuth-Session, kein doppelter Token-Code. Wird read-only nach
|
||||
`/opt/data/scripts/` gemountet (siehe `docker-compose.yml`).
|
||||
|
||||
**Einmalig einrichten** — in `hermes-data/agent-home/config.yaml` ergaenzen
|
||||
(und falls noch vorhanden: den alten `plugins: enabled: [fast-paths]`-Block
|
||||
entfernen):
|
||||
```yaml
|
||||
plugins:
|
||||
enabled:
|
||||
- fast-paths
|
||||
quick_commands:
|
||||
next:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py next
|
||||
prev:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py previous
|
||||
pause:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py pause
|
||||
play:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py play
|
||||
louder:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py volume_up
|
||||
quieter:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py volume_down
|
||||
nowplaying:
|
||||
type: exec
|
||||
command: python3 /opt/data/scripts/spotify_quick.py current
|
||||
```
|
||||
Dann:
|
||||
```bash
|
||||
git pull
|
||||
docker-compose up -d --build hermes-agent
|
||||
```
|
||||
Volle Details, Sicherheitsmodell (Autorisierungspruefung VOR jedem
|
||||
Fast-Path-Treffer!) und Anleitung fuer neue Skills: `fast-paths/README.md`.
|
||||
Danach in der TUI `/next`, `/pause`, `/louder`, `/nowplaying` etc. testen —
|
||||
sollte in Millisekunden reagieren, kein Modell-Aufruf, keine Tool-Call-Schleife
|
||||
mehr moeglich (es gibt schlicht keinen LLM-Turn dafuer).
|
||||
|
||||
## Mobiler Client (Android)?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user