How galaxypple072-oss/emilia-companion-desktop works
Personal Companion is a multi-channel companion system: users message it through QQ or the desktop pet; Product Core handles conversations and durable outbound work, then routes replies and actions to their destination. The README also documents desktop device capabilities, file/email tools, reminders, encrypted relay workers, and voice synthesis. The excerpts establish selected routing and integration edges; unsampled core internals and feature wiring are represented only where README evidence supports the subsystem, without inferring calls between them.
Main entry points: server.ts Encrypted Relay · runtime.ts Core Runtime · agent.ts Conversation Agent · relay-worker.ts QQ Gateway Worker
Components 26
User Clients
- Desktop Companion
apps/desktop-pet/src/main.js - Desktop Relay Client
apps/desktop-pet/src/relay-client.js
Product Core
- Core Runtime
apps/product-core/src/runtime.ts - Conversation Agent
apps/product-core/src/agent.ts - Turn Assembly
apps/product-core/src/turn-assembly.ts - Persona And Policy
apps/product-core/src/persona.ts - Long-Term Memory
apps/product-core/src/memory.ts - Reply Scheduler
apps/product-core/src/reply-scheduler.ts - Durable Store
apps/product-core/src/store.ts - Companion Bridge
apps/product-core/src/companion-bridge.ts - Device Control API
apps/product-core/src/device-control-api.ts - Device Router
apps/product-core/src/device-control-router.ts
Transport
- Encrypted Relay
apps/companion-relay/src/server.ts - Relay Protocol
packages/companion-relay-protocol/src/index.js
Tools And Services
- Voice Synthesis
apps/voice-service/src/server.ts - File Tools
apps/file-mcp/src/server.ts - Email Tools
apps/email-mcp/src/server.ts - Device Tools
apps/device-mcp/src/server.ts
Runtime Workers
- QQ Gateway Worker
apps/qq-gateway/src/relay-worker.ts - Voice Relay Worker
apps/voice-service/src/relay-worker.ts
Other components
- Owner
- QQ Account
- NapCat OneBot
- Email Inbox
- GPT-SoVITS
- Allowed Local Files
Connections 33
- Owner → Desktop Companion: uses
- Owner → QQ Account: messages
- Desktop Companion → Desktop Relay Client: sends events
- Desktop Relay Client → Relay Protocol: seals payloads
- Desktop Relay Client → Encrypted Relay: authenticates
- Encrypted Relay → Desktop Relay Client: routes frames
- QQ Account → NapCat OneBot: sends messages
- QQ Gateway Worker → NapCat OneBot: uses API
- QQ Gateway Worker → Relay Protocol: seals payloads
- QQ Gateway Worker → Encrypted Relay: connects
- Encrypted Relay → QQ Gateway Worker: routes frames
- Core Runtime → Durable Store: persists work
- Core Runtime → Conversation Agent: processes turns
- Conversation Agent → Turn Assembly: assembles context
- Conversation Agent → Persona And Policy: uses persona
- Conversation Agent → Long-Term Memory: uses memory
- Conversation Agent → Durable Store: reads history
- Core Runtime → Reply Scheduler: schedules delivery
- Core Runtime → Companion Bridge: serves clients
- Companion Bridge → Device Router: dispatches commands
- Device Router → Device Control API: serves control
- Core Runtime → Encrypted Relay: uses transport
- Encrypted Relay → Relay Protocol: routes framed data
- Voice Relay Worker → Relay Protocol: seals payloads
- Voice Relay Worker → Encrypted Relay: connects
- Encrypted Relay → Voice Relay Worker: routes frames
- Voice Relay Worker → Voice Synthesis: requests synthesis
- Voice Synthesis → GPT-SoVITS: synthesizes audio
- File Tools → Allowed Local Files: reads scoped files
- File Tools → Durable Store: drafts actions
- Email Tools → Email Inbox: reads inbox
- Email Tools → Durable Store: drafts actions
- Device Tools → Device Control API: calls API