feat(media): Jellyfin Playback Agent Blocco A + fix SSL/webhook/queryParams

- Workflow AyrKWvboPldzZPsM: PlaybackStart/Stop → behavioral_context + agent_messages
- Fix: webhookId top-level nel nodo per path statico in n8n queue mode
- Fix: NODE_TLS_REJECT_UNAUTHORIZED=0 su n8n-app/worker per Patroni self-signed cert
- Fix: inline SQL expressions invece di additionalFields.queryParams (n8n v2.5.2 bug)
- Fix: Calendar Agent stesso set di fix (SSL + queryParams)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-21 17:11:20 +00:00
parent 70b668954e
commit 95ac871a71

View File

@@ -4,6 +4,26 @@ Tutte le modifiche significative al progetto ALPHA_PROJECT sono documentate qui.
--- ---
## [2026-03-21] Jellyfin Playback Agent — Blocco A completato
### Nuovo workflow n8n
- **`🎬 Pompeo — Jellyfin Playback [Webhook]`** (`AyrKWvboPldzZPsM`): riceve webhook da Jellyfin (PlaybackStart / PlaybackStop), filtra per utente `martin` (userId whitelist), e scrive su Postgres:
- **PlaybackStart** → INSERT in `behavioral_context` (`event_type=watching_media`, `do_not_disturb=true`, notes con item/device/session_id) + INSERT in `agent_messages` (soggetto `▶️ <titolo> (<device>)`)
- **PlaybackStop** → UPDATE su riga aperta più recente (`end_at=now()`, `do_not_disturb=false`) + INSERT in `agent_messages` (soggetto `⏹️ ...`)
### Bug risolti (infrastruttura n8n)
- **Webhook path n8n v2**: per registrare un webhook con path statico via API, il campo `webhookId` va impostato come attributo top-level del nodo (non dentro `parameters`). Senza di esso n8n genera il path dinamico `{workflowId}/{nodeName}/{path}` che il webhook pod non carica correttamente in queue mode.
- **SSL Postgres / Patroni**: le credential Postgres create via API usavano SSL con `rejectUnauthorized=true` di default, incompatibile con il certificato self-signed di Patroni. Fix: aggiunto `NODE_TLS_REJECT_UNAUTHORIZED=0` ai deployment `n8n-app` e `n8n-app-worker`.
- **queryParams Postgres node**: `additionalFields.queryParams` con espressioni `$json.*` non funziona correttamente in n8n v2.5.2. Fix: valori inline nella SQL via espressioni n8n `{{ $json.field }}`.
### Configurazione Jellyfin
- Webhook plugin Jellyfin configurato su `http://n8n-app-webhook.automation.svc.cluster.local/webhook/jellyfin-playback` (POST, eventi: PlaybackStart + PlaybackStop)
---
## [2026-03-21] Schema DB v2 — contacts, memory_facts_archive, entity_refs ## [2026-03-21] Schema DB v2 — contacts, memory_facts_archive, entity_refs
### Nuove tabelle ### Nuove tabelle