Documentation
¶
Overview ¶
Package serve keeps one vaultmind process warm and answers the CLI's commands from it. A recall `ask` spent about 0.7 s of its 1.6 s loading the embedding model in every new process; a resident process loads it once. The server runs the real command for each request (see cmd's serve), so this package is only the transport: a private Unix socket, one request at a time, an idle timeout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoServer means nothing answers on the socket; the caller runs the // command itself. ErrNoServer = errors.New("no vaultmind server is running") // ErrAlreadyServing means another server already answers on the socket. ErrAlreadyServing = errors.New("a vaultmind server is already running on this socket") // ErrUnsafeDir means the socket's directory could be reached by another // user; neither side uses a socket there. ErrUnsafeDir = errors.New("unsafe socket directory") )
Functions ¶
func Serve ¶
Serve answers requests on sock until ctx ends or no request arrives for idle, then removes the socket. Requests run one at a time.
func SocketPath ¶
SocketPath is where the server for this version listens. The version is in the name, so two installed versions each get their own server and an upgrade never answers from old code. A state dir too deep for a socket path falls back to a short per-user name under the temp dir. Either way the socket's directory must be private to the user (see checkPrivateDir).
Types ¶
type Request ¶
type Request struct {
Args []string `json:"args"`
Dir string `json:"dir"`
Env map[string]string `json:"env"`
}
Request is one CLI invocation: its arguments, working directory and environment.