Documentation
¶
Overview ¶
Package agent contains the logic that runs inside the cliwrap-agent subprocess. It owns the child CLI process and the IPC connection back to the host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
IPCFD int
AgentID string
RuntimeDir string
OutboxCapacity int
WALBytes int64
MaxRecvPayload uint32
}
Config is the runtime configuration passed from the host via env vars and argv. For v1, the fd index is fixed at 3.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults, reading host-supplied env vars CLIWRAP_AGENT_ID and CLIWRAP_AGENT_RUNTIME when present.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher routes inbound IPC messages and coordinates child lifecycles.
func NewDispatcher ¶
func NewDispatcher(conn *ipc.Conn) *Dispatcher
NewDispatcher constructs a Dispatcher bound to conn.
func (*Dispatcher) Handle ¶
func (d *Dispatcher) Handle(msg ipc.OutboxMessage)
Handle processes an inbound message from the host.
func (*Dispatcher) SendControl ¶
SendControl serializes payload and enqueues it as an outbound frame.
type RunSpec ¶
type RunSpec struct {
Command string
Args []string
Env map[string]string
WorkDir string
StopTimeout time.Duration
OnStarted func(pid int) // called after cmd.Start() succeeds, before Wait()
}
RunSpec describes the child process to fork/exec.
type Runner ¶
type Runner struct {
// StdoutSink, if non-nil, is used to tee the child's stdout bytes.
StdoutSink io.Writer
// StderrSink, if non-nil, is used to tee the child's stderr bytes.
StderrSink io.Writer
}
Runner starts a single child process and blocks until it exits.