Documentation
¶
Overview ¶
Package control is the local API between the awp daemon and its clients (the CLI, the MCP server, harness hooks): newline-delimited JSON over a Unix socket that only the owning user can open.
A request is one line, {"method": "...", "params": {...}}. A plain call gets one reply line, {"result": ...} or {"error": "..."}. A streaming call gets {"event": ...} lines until either side closes.
Index ¶
Constants ¶
const SocketName = "awp.sock"
SocketName is the control socket's file name inside the awp home.
Variables ¶
var ErrNoDaemon = errors.New("awp daemon is not running")
ErrNoDaemon means nothing is listening on the control socket.
Functions ¶
func SocketPath ¶
SocketPath is where the daemon for home listens. Unix socket paths are limited in length, so a home that is too deep (common in sandboxes) gets its socket in the user's private runtime directory instead, named by a hash of the home path. Daemon and clients compute the same path.
Types ¶
type Client ¶
type Client struct {
Home string
}
Client calls a daemon.
type Handler ¶
type Handler interface {
Call(ctx context.Context, method string, params json.RawMessage) (any, error)
Stream(ctx context.Context, method string, params json.RawMessage, emit func(any) error) (bool, error)
}
Handler serves calls. Stream methods write events with emit until ctx is done or they return.
type Reply ¶
type Reply struct {
Result json.RawMessage `json:"result,omitempty"`
Event json.RawMessage `json:"event,omitempty"`
Error string `json:"error,omitempty"`
}
Reply is a call's answer, or one event of a stream.
type Request ¶
type Request struct {
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request is one call.