LiveShell speaks newline-delimited JSON over a local transport. Each request and response is one JSON object plus \n. The same request/response protocol is served over two interchangeable transports (see Transports): the stdio pipes of a launched daemon, or a loopback TCP socket.
Current protocol version: 1.0
Request:
{"id":"req_1","method":"capability.discover","params":{}}Success response:
{"id":"req_1","ok":true,"result":{}}Error response:
{"id":"req_1","ok":false,"error":{"type":"ValueError","code":"invalid_params","message":"..."}}Stable error codes:
invalid_requestinvalid_paramsnot_foundconflictunknown_methodinternal_error
capability.discoverdaemon.statusdaemon.shutdownsession.createsession.listsession.snapshotsession.closecommand.startcommand.pollcommand.eventscommand.cancelcommand.result
capability.discover returns protocol_version and a capability list.
command.start validates params before creating a command record. Commands for the same session execute FIFO: new commands are queued until the session worker starts them, then move to starting and running.
command.events returns events with stable per-command sequence numbers greater than since_seq.
daemon.shutdown is reliable over a live channel (stdio or socket). The liveshell daemon shutdown/stop CLI paths also write a state-dir marker for operators when no live channel is held; the marker is not a network control plane.
The protocol is transport-agnostic. Two transports are supported, both local-only:
- stdio —
liveshell daemon stdioserves the protocol over the process's stdin/stdout. The daemon's lifetime is bound to the launching process's pipes. This is the default, used byLiveShellClient.stdio(...)andliveshell run. - socket —
liveshell daemon serve/daemon startserves the protocol over a loopback IPv4 TCP socket (default127.0.0.1, an ephemeral port unless one is given). The bound address is published todaemon.jsonin the state dir so a fresh client can attach withLiveShellClient.connect(state_dir). Unlike stdio, a socket daemon keeps running — and its commands keep executing — after any client disconnects. The host is validated as loopback-only: non-loopback and non-IPv4 hosts are rejected. There is no remote transport and no auto-started network listener; the socket daemon is opt-in.
The protocol is local-only. LiveShell does not install URL handlers, expose a remote network server, or execute commands from links. The optional socket transport binds to loopback (127.0.0.1) only and is never started implicitly.