How stephengpope/thepopebot works
thepopebot combines authenticated web and Telegram chat, configurable LLM/coding agents, persistent coding workspaces, and background agent jobs. The central workflow is a user message routed through the event handler to the AI runtime, which streams a response and can work in a repository; a separate job path runs work in Docker and returns results through GitHub/Telegram. The graph also shows code, cluster, and configuration capabilities. Some connections are documented in the README; unsampled implementations are represented conservatively.
Main entry points: ai/index.js AI runtime · api/index.js Event handler API · docker.js Docker execution · create-agent-job.js Agent jobs
Components 26
User interfaces
- Web chat
lib/chat/components/chat.jsx - Chat actions
lib/chat/actions.js - Event handler API
api/index.js - Telegram adapter
lib/channels/telegram.js - Authentication
lib/auth/index.js
Agent runtime
- AI runtime
lib/ai/index.js - Agent adapters
lib/ai/sdk-adapters/claude-code.js - Helper LLM
lib/ai/helper-llm.js - LLM providers
lib/llm-providers.js - Session persistence
lib/ai/session-manager.js
Work execution
- Code workspaces
lib/code/actions.js - Docker execution
lib/tools/docker.js - Agent jobs
lib/tools/create-agent-job.js - GitHub integration
lib/tools/github.js - Cluster runtime
lib/cluster/runtime.js - Triggers and cron
lib/triggers.js
Platform services
- Configuration resolver
lib/config.js - Settings storage
lib/db/config.js - SQLite database
lib/db/index.js - Data schema
lib/db/schema.js
Other components
- Browser user
- Telegram user
- SQLite
- Docker service
- GitHub
- LLM provider
Connections 29
- Browser user → Web chat: uses
- Telegram user → Telegram adapter: messages
- Web chat → Chat actions: initiates
- Chat actions → AI runtime: calls
lib/chat/actions.js - Event handler API → AI runtime: calls
api/index.js - Event handler API → Agent jobs: creates
api/index.js - Event handler API → Telegram adapter: uses
api/index.js - Event handler API → Authentication: authenticates
- Telegram adapter → Event handler API: webhook
- AI runtime → Agent adapters: dispatches
lib/ai/index.js - AI runtime → Helper LLM: calls
lib/ai/index.js - AI runtime → Session persistence: reads/writes
lib/ai/index.js - AI runtime → Docker execution: gets workspace
lib/ai/index.js - AI runtime → LLM providers: uses configuration
- Code workspaces → Docker execution: manages workspace
- Agent jobs → Docker execution: launches container
- Agent jobs → GitHub integration: opens PR
- GitHub integration → GitHub: pushes and merges
- Event handler API → GitHub integration: fetches job logs
api/index.js - Cluster runtime → Docker execution: runs workers
- Triggers and cron → Agent jobs: schedules work
- Configuration resolver → Settings storage: reads settings
lib/config.js - Configuration resolver → LLM providers: resolves models
lib/config.js - Docker execution → Configuration resolver: reads settings
lib/tools/docker.js - Docker execution → Docker service: runs containers
- LLM providers → LLM provider: configures access
- SQLite database → SQLite: opens
lib/db/index.js - SQLite database → Data schema: uses schema
lib/db/index.js - Settings storage → SQLite database: queries
lib/db/config.js