How lmaxroutercn/poker-agent works
PokerAgent automates a browser-based LLM tool loop: the userscript captures formatted instructions and submits them to the local Python service; the service queues and executes them, then streams task results back for the userscript to return to the LLM. Major branches include built-in file and memory commands, shell/process execution, permission checks, and the GUI’s runtime controls. The README documents these capabilities and the queue/SSE design; sampled source confirms parts of the implementation, but omitted sections leave some detailed command-to-handler wiring uncertain.
Main entry points: agent_server.py Local HTTP Service · PokerAgent.js Browser Automation · agent_gui.py GUI Console
Components 20
Browser Agent
- Browser Automation
PokerAgent.js - Instruction Capture
PokerAgent.js - Site Configuration
PokerAgent.js
Local Runtime
- Local HTTP Service
agent_server.py - Instruction Parser
agent_server.py - Task Queue
agent_server.py - Serial Worker
agent_server.py - Task Registry
agent_server.py - SSE Events
agent_server.py
Command Execution
- Command Dispatcher
agent_server.py - Permission Checks
agent_server.py - File Commands
agent_server.py - Exec And Run
agent_server.py
Memory And State
- Memory Engine
agent_server.py - Memory Files
- Task Logs
Local Controls
- GUI Console
agent_gui.py
Other components
- User
- Web LLM
- Compiler Extension
Connections 27
- User → GUI Console: starts
- GUI Console → Local HTTP Service: starts service
- User → Web LLM: provides task
- Web LLM → Instruction Capture: outputs instructions
- Instruction Capture → Browser Automation: extracts commands
- Site Configuration → Instruction Capture: configures selectors
- Browser Automation → Local HTTP Service: POSTs commands
- Local HTTP Service → Instruction Parser: parses request
- Instruction Parser → Task Queue: enqueues tasks
- Task Queue → Serial Worker: provides tasks
- Serial Worker → Command Dispatcher: dispatches commands
- Command Dispatcher → Permission Checks: checks access
- Command Dispatcher → File Commands: runs file commands
- Command Dispatcher → Exec And Run: runs processes
- Command Dispatcher → Memory Engine: runs memory commands
- File Commands → Task Logs: writes task data
- Exec And Run → Task Logs: writes output
- Memory Engine → Memory Files: reads and writes
- Serial Worker → Task Registry: updates status
- Serial Worker → SSE Events: emits task events
- SSE Events → Browser Automation: streams updates
- Browser Automation → Web LLM: returns results
- Browser Automation → Local HTTP Service: requests memory injection
- Local HTTP Service → Memory Engine: gets injection content
- Memory Engine → Local HTTP Service: returns memory context
- GUI Console → Serial Worker: controls queue
- Compiler Extension → Local HTTP Service: provides extra information