Skip to main content

Module daemon

Module daemon 

Source
Expand description

khived daemon server — persistent warm runtime over a Unix socket (ADR-049).

The daemon binds ~/.khive/khived.sock, accepts length-prefixed request frames, dispatches them through a DaemonDispatch implementor, and serves results back. It is transport-agnostic: the MCP crate provides the dispatch impl, but any future client (CLI, HTTP gateway) can reuse this server.

The client side (forwarding, auto-spawn) lives in the transport crate (e.g. khive-mcp), not here.

Structs§

DaemonRequestFrame
Request frame sent from a client to the daemon.
DaemonResponseFrame
Response frame sent from the daemon back to a client.

Constants§

MAX_FRAME_BYTES
Maximum frame size accepted in either direction.

Traits§

DaemonDispatch
Transport-agnostic dispatch interface for the daemon server.

Functions§

env_truthy
Returns true for non-empty env values that are not "0" or "false".
pid_path
PID file path written by the daemon.
read_frame
Read one length-prefixed frame (4-byte BE u32 length + JSON bytes).
run_daemon
Run the daemon: bind the socket, warm in the background, serve request frames until SIGTERM/SIGINT.
socket_path
Unix socket path the daemon binds and clients connect to.
write_frame
Write one length-prefixed frame.