Documentation
¶
Overview ¶
Package supervisor provides a lightweight process wrapper that runs a command in the foreground while accepting restart/stop signals over a Unix socket. The user sees all output in their terminal; external callers (agents, MCP) control the lifecycle via the socket.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PidPath ¶ added in v0.43.14
PidPath returns the supervisor PID file path corresponding to a socket path.
func Send ¶
Send connects to a supervisor socket and sends a command. Returns the response string. Uses a 30-second deadline.
func SendWithTimeout ¶
SendWithTimeout is like Send but with a caller-specified deadline. Used by --await which may need to wait longer than the default 30s.
func SocketPath ¶
SocketPath returns a short, deterministic socket path under /tmp to avoid the ~104 byte macOS limit on Unix socket paths. The hash ensures uniqueness per worktree without depending on path length.
Types ¶
type Supervisor ¶
type Supervisor struct {
Command string
Dir string
SocketPath string
Port int
Env map[string]string // extra env vars injected into the child process
Log func(format string, args ...any)
// ConnWriteDeadline caps how long handleConn waits to write a response.
// Defaults to 15s. Override in tests to avoid slow-test hangs.
ConnWriteDeadline time.Duration
// contains filtered or unexported fields
}
func New ¶
func New(command, dir, socketPath string) *Supervisor
func (*Supervisor) Run ¶
func (s *Supervisor) Run() error