Versions in this module Expand all Collapse all v0 v0.5.0 Jul 22, 2026 v0.4.0 Jul 17, 2026 v0.3.0 Jul 9, 2026 v0.2.0 Jul 6, 2026 v0.1.0 Jul 2, 2026 Changes in this version + const ExitPermanent + const ExitTempfail + const MaxFrameSize + const ProtoVersion + var ErrAlreadyRunning = errors.New("daemon: another instance is already running") + var ErrFrameTooLarge = errors.New("daemon: control frame exceeds size cap") + var ErrPermanent = errors.New("daemon: worker failed permanently") + var ErrPoolDraining = errors.New("daemon: pool is draining") + var ErrSessionExists = errors.New("daemon: session already exists") + var ErrSessionNotFound = errors.New("daemon: session not found") + var ErrUnknownFrameKind = errors.New("daemon: unknown control frame kind") + func BackoffWithJitter(attempt int) time.Duration + func DefaultDir() (string, error) + func NegotiateVersion(clientVersion int) (int, bool) + func WriteControl(w io.Writer, msg Ctrl) error + func WriteFrame(w io.Writer, kind FrameKind, payload []byte) error + type Client struct + func Dial(socketPath string) (*Client, error) + func NewClientConn(conn net.Conn) (*Client, error) + func (c *Client) Attach(session string, onLine func(string)) error + func (c *Client) Close() error + func (c *Client) Run(session, cwd, prompt string, args []string, onLine func(string)) error + func (c *Client) Shutdown() error + func (c *Client) Status() (*StatusReport, error) + type Ctrl struct + Args []string + Cwd string + Line string + Message string + Prompt string + Session string + Status *StatusReport + Type CtrlType + Version int + func ReadControl(r io.Reader) (Ctrl, error) + type CtrlType string + const CtrlAck + const CtrlAttach + const CtrlData + const CtrlEnd + const CtrlError + const CtrlHello + const CtrlHelloOK + const CtrlRun + const CtrlShutdown + const CtrlStatus + const CtrlStatusResult + type ExecLauncherConfig struct + BaseArgs []string + Env []string + Executable string + type FrameKind uint8 + const KindCtrl + const KindData + func ReadFrame(r io.Reader) (FrameKind, []byte, error) + type Launcher func(ctx context.Context, spec WorkerSpec) (WorkerHandle, error) + func NewExecLauncher(cfg ExecLauncherConfig) (Launcher, error) + type Lines interface + Next func() (line string, ok bool, err error) + type Paths struct + Lock string + Socket string + Status string + func DefaultPaths() (Paths, error) + type Pool struct + func NewPool(opts PoolOptions) (*Pool, error) + func (p *Pool) Drain() + func (p *Pool) QueueDepth() int + func (p *Pool) Run(ctx context.Context, spec WorkerSpec, sink Sink) (int, error) + func (p *Pool) Size() int + func (p *Pool) WorkerStats() []WorkerStatus + type PoolOptions struct + Backoff func(attempt int) time.Duration + KillTimeout time.Duration + Launcher Launcher + Log func(string) + MaxAttempts int + Size int + TempfailDelay time.Duration + type Server struct + func NewServer(opts ServerOptions) (*Server, error) + func (s *Server) Serve() error + func (s *Server) ServeConn(conn net.Conn) + func (s *Server) Shutdown() + type ServerOptions struct + Log func(string) + Manager *SessionManager + Now func() time.Time + Paths Paths + Pool *Pool + Version int + type Session struct + func (s *Session) Done() <-chan struct{} + func (s *Session) Err() error + func (s *Session) ID() string + func (s *Session) Line(line string) + func (s *Session) Started() + func (s *Session) State() SessionState + func (s *Session) Subscribe() (buffered []string, live <-chan string, cancel func()) + type SessionManager struct + func NewSessionManager(opts SessionManagerOptions) (*SessionManager, error) + func (m *SessionManager) Attach(id string) (buffered []string, live <-chan string, cancel func(), err error) + func (m *SessionManager) Get(id string) (*Session, bool) + func (m *SessionManager) Start(ctx context.Context, spec WorkerSpec) (*Session, error) + func (m *SessionManager) Statuses() []SessionStatus + type SessionManagerOptions struct + MaxBuffer int + MaxSessions int + Pool *Pool + type SessionState string + const SessionDone + const SessionFailed + const SessionQueued + const SessionRunning + type SessionStatus struct + ID string + Lines int + State string + type Sink interface + Line func(line string) + type StatusFile struct + PID int + Socket string + StartedAt time.Time + Version int + type StatusReport struct + PID int + PoolSize int + QueueDepth int + Sessions []SessionStatus + Socket string + StartedAt time.Time + Version int + Workers []WorkerStatus + type WorkerHandle interface + Kill func() error + Pid func() int + Stdout func() Lines + Wait func() (int, error) + type WorkerSpec struct + Args []string + Cwd string + Session string + type WorkerStatus struct + ConsecutiveCrashes int + ID int + PID int + Restarts int + Session string + State string