How cosm1cbug/echofox works
EchoFox is a WhatsApp automation bot with a live operations dashboard. Its principal workflow is WhatsApp events entering the worker, being routed to event handlers and command/AI processing, then using services and persistent storage to produce replies or update state. The graph also preserves documented AI, Telegram logging, alerts, metrics, and dashboard capabilities. Edges are limited to cited source references or README statements; uncertain wiring is omitted or marked dashed.
Main entry points: worker.js Bot worker · server.js Dashboard API · alertEngine.js Alert engine · messages.upsert.js Message handler
Components 23
Bot runtime
- Bot worker
src/core/worker.js - Lifecycle manager
src/core/lifecycle.js - Auth backend
src/core/auth.js - Signal caches
src/core/caches.js - Event router
src/events/router.js
Messaging features
- Message handler
src/events/messages.upsert.js - Command registry
src/core/commandRegistry.js - Command runner
src/core/commandRunner.js - Command catalog
src/commands - AI service
src/services/ai/router.js
State and observability
- Pluggable store
src/store/instance.js - Metrics service
src/services/metrics.js - Alert engine
src/services/alertEngine.js - Admin audit
src/services/adminAuditService.js
Operations dashboard
- Dashboard API
src/dashboard/server.js - Dashboard app
dashboard/src/App.tsx - Dashboard client API
dashboard/src/lib/api.ts - Dashboard views
dashboard/src/pages
External integrations
- WhatsApp / Baileys
- LLM providers
src/services/ai/providers - Telegram bridge
src/services/telegram/index.js
Other components
- WhatsApp user
- Bot operator
Connections 26
- WhatsApp user → WhatsApp / Baileys: sends messages
- WhatsApp / Baileys → Bot worker: delivers events
- Bot worker → Lifecycle manager: selects runtime
src/core/worker.js - Bot worker → Auth backend: selects auth
src/core/worker.js - Bot worker → Signal caches: uses caches
src/core/worker.js - Bot worker → Event router: routes events
src/core/worker.js - Event router → Message handler: dispatches messages
src/events/router.js - Message handler → Command runner: runs commands
src/events/messages.upsert.js - Message handler → AI service: invokes AI
src/events/messages.upsert.js - Bot worker → Command registry: loads commands
src/core/worker.js - Command runner → Command catalog: dispatches commands
- AI service → LLM providers: uses providers
- Lifecycle manager → Pluggable store: selects store
src/core/lifecycle.js - Bot worker → Metrics service: initializes metrics
src/core/worker.js - Bot worker → Alert engine: initializes alerts
src/core/worker.js - Alert engine → Telegram bridge: sends alerts
src/services/alertEngine.js - Alert engine → Metrics service: records outcomes
src/services/alertEngine.js - Dashboard API → Metrics service: reads metrics
src/dashboard/server.js - Dashboard API → Alert engine: reads alert rates
src/dashboard/server.js - Dashboard API → Admin audit: uses audit
src/dashboard/server.js - Dashboard API → Pluggable store: queries state
src/dashboard/server.js - Bot operator → Dashboard app: views dashboard
- Dashboard app → Dashboard views: renders views
dashboard/src/App.tsx - Dashboard app → Dashboard client API: sets credentials
dashboard/src/App.tsx - Dashboard client API → Dashboard API: requests API
- Bot worker → Dashboard API: starts dashboard
src/core/worker.js