## Summary - add asynchronous PostgreSQL parity to research commands and engine execution paths - persist Roadmap, Compound Engineering sessions, and WhatsApp state in PostgreSQL - harden cancellation, concurrency, reconnect, replay-claim, and detached-promise behavior - bundle the PostgreSQL-backed integration implementations in the published CLI This is PR 2 of 2 and is intentionally stacked on #2088. It contains 44 changed files; merge #2088 first, then retarget this PR to `main` if GitHub does not do so automatically. ## Verification - `pnpm check:changesets --strict` - `pnpm lint` - `pnpm test:gate`: 463 tests passed - Compound Engineering plugin: 299 tests passed - Roadmap plugin: 144 tests passed - WhatsApp plugin: 27 tests passed - research CLI: 18 tests passed - `pnpm verify:fast`: all scoped typechecks, builds, CLI build, and boot smoke passed ## Post-Deploy Monitoring & Validation - deploy only after #2088 and verify schema migration `0002` is present - monitor research cancellation, automation claims, agent execution, plugin schema initialization, and unhandled rejections - validate Roadmap ownership, Compound Engineering session recovery, and WhatsApp reconnect/replay deduplication - compare per-project plugin and workflow counts after cutover - restore the pre-deploy backup for data rollback; avoid an in-place schema downgrade
WhatsApp Chat Plugin
WhatsApp Web (Baileys) bridge for Fusion. It pairs with your phone (QR or pairing code), keeps a background connection alive, forwards inbound direct text messages to a Fusion AI session, and sends the assistant reply back to WhatsApp.
No Meta Cloud app, webhook URL, verify token, or Graph API credentials are required.
Setup
- Enable/install the plugin in Plugin Manager.
- Configure
allowedSenders(empty means nobody is allowed). - Choose
pairingMode:qr(default): fetch QR from/api/plugins/fusion-plugin-whatsapp-chat/qrand scan in WhatsApp.code: setpairingPhoneNumber(E.164 digits without+) and request code via/pair-code.
- Confirm
/statusreportsconnected.
Settings
pairingMode:qrorcode.pairingPhoneNumber: E.164 digits without+(used forcodemode).allowedSenders: allowed WhatsApp JIDs or E.164 digits.agentSystemPrompt: system prompt for replies.historyTurnLimit: persisted turn window (default40).dedupeRetentionDays: replay-protection retention window for inbound message IDs (default7days). Rows older than this are pruned lazily whenever a new inbound message is processed.
Routes
GET /api/plugins/fusion-plugin-whatsapp-chat/statusGET /api/plugins/fusion-plugin-whatsapp-chat/qrPOST /api/plugins/fusion-plugin-whatsapp-chat/pair-codePOST /api/plugins/fusion-plugin-whatsapp-chat/logout
Storage and lifecycle
- Starts socket on
onLoad, stops ononUnload. - Persists transcript and dedupe state in:
whatsapp_chat_sessionswhatsapp_chat_dedupe
- Persists Baileys auth state in:
whatsapp_auth_credswhatsapp_auth_keys
- After restart, plugin reconnects automatically when auth is valid.
Troubleshooting
- Stuck
awaiting-qr: fetch a fresh QR and scan promptly. loggedOut: call/logout(or wait for clear) and re-pair.- Pair code not generated: ensure
pairingPhoneNumberis E.164 digits without+. - No replies: check
allowedSenders; empty list blocks all inbound messages by design.
Compliance warning
Baileys is an unofficial WhatsApp Web protocol client. Use may violate WhatsApp Terms of Service. This plugin is intended for self-hosted, single-user use at your own risk.