How abblot229/light-panda-browser works
Lightpanda is a headless browser for automation and AI agents. Its principal workflow accepts a URL or browser-control request, loads and parses a page, executes scripts and browser behaviors, then exposes page state or emits a dump; clients can use CDP or WebDriver BiDi, while the native agent can control the same browser and save replayable scripts. The README documents these product capabilities, and the tree identifies their likely modules. Source excerpts confirm the Rust HTML parser and renderer boundaries; several implementation links below are therefore dashed where their callers were not shown.
Main entry points: Browser.zig Browser engine · frame Frames and loading · Page.zig Page lifecycle · lib.rs HTML parsing
Components 24
Interfaces and control
- Command interface
src/App.zig - Protocol servers
src/server
Browser runtime
- Browser engine
src/browser/Browser.zig - Browser sessions
src/browser/Session.zig - Page lifecycle
src/browser/Page.zig - Frames and loading
src/browser/frame - Network requests
src/network
Page processing
- HTML parsing
src/rust/html5ever/lib.rs - DOM tree callbacks
src/rust/html5ever/sink.rs - Resource prescan
src/rust/html5ever/prescan.rs - JavaScript runtime
src/browser/js - CSS and styles
src/browser/StyleManager.zig - Text rendering
src/rust/render/lib.rs - Page exports
src/browser/dump.zig
Agent experience
- Native agent
src/agent/Agent.zig - Agent conversation
src/agent/Conversation.zig - Model providers
src/agent/ModelCall.zig - PandaScript runner
src/browser/Runner.zig
Native support
- Browser storage
src/storage - Telemetry
src/telemetry - Rust FFI archive
src/rust/ffi/lib.rs - URL processing
src/rust/html5ever/url.rs
Other components
- Automation client
- Agent user
Connections 27
- Automation client → Protocol servers: connects via
README.md - Protocol servers → Browser engine: controls
- Agent user → Command interface: starts task
README.md - Command interface → Native agent: starts agent
- Command interface → Page lifecycle: fetches URL
- Browser engine → Browser sessions: manages sessions
- Browser sessions → Page lifecycle: creates pages
- Page lifecycle → Frames and loading: loads frames
- Frames and loading → Network requests: requests resources
- Frames and loading → Resource prescan: scans resources
- Frames and loading → HTML parsing: parses markup
- HTML parsing → DOM tree callbacks: builds DOM via
src/rust/html5ever/lib.rs - HTML parsing → Resource prescan: uses tokenizer
src/rust/html5ever/lib.rs - Rust FFI archive → HTML parsing: links crate
src/rust/ffi/lib.rs - Frames and loading → JavaScript runtime: runs scripts
- Page lifecycle → CSS and styles: applies styles
- Page lifecycle → Page exports: exports page
- Page exports → Text rendering: renders output
- Native agent → Browser engine: drives browser
README.md - Native agent → Agent conversation: manages conversation
- Agent conversation → Model providers: requests completions
- Model providers → Automation client: uses provider APIs
- Native agent → PandaScript runner: saves replay script
README.md - PandaScript runner → Browser engine: replays actions
- Browser engine → Browser storage: uses storage
- Browser engine → Telemetry: reports metrics
- HTML parsing → URL processing: uses URL parsing
src/rust/html5ever/lib.rs