Summary
Add a TCP and/or WebSocket listener to hostd so companion apps can connect over the network, not just via stdin/stdout piping.
Context
Currently hostd outputs NDJSON to stdout and reads commands from stdin. This works for local piping but isn't practical for GUI companion apps or remote monitoring.
Implementation
- Add
--listen <addr:port> CLI flag (e.g., --listen 0.0.0.0:4200)
- TCP listener using
tokio::net::TcpListener
- Each connection gets a clone of the output stream (broadcast channel) and can send commands
- Optional WebSocket upgrade using
tokio-tungstenite for browser-based companions
- Same NDJSON protocol over TCP/WebSocket as over stdio
- Multiple simultaneous clients
Design Decisions
Related
Summary
Add a TCP and/or WebSocket listener to
hostdso companion apps can connect over the network, not just via stdin/stdout piping.Context
Currently hostd outputs NDJSON to stdout and reads commands from stdin. This works for local piping but isn't practical for GUI companion apps or remote monitoring.
Implementation
--listen <addr:port>CLI flag (e.g.,--listen 0.0.0.0:4200)tokio::net::TcpListenertokio-tungstenitefor browser-based companionsDesign Decisions
Related