Documentation
¶
Overview ¶
Package handoff hands the gateway's listening socket from the magpie restarting to update to the version it started, so the port is never closed between them: the new one serves on the same socket, and the old one stops accepting and finishes what it has.
The magpie handing over opens an Offer: a unix socket in a folder only its user can enter, named in a pointer file in magpie's config folder. The new magpie Takes it: it connects, says hello, and is sent the listening socket (SCM_RIGHTS) with a Meta; once its gateway serves on it, it Acks, and the one before lets go. Only Unix has this (darwin and linux); elsewhere Open says ErrUnsupported (Take finds nothing), and a restart waits for the gateway to be idle as before.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("handing the gateway over isn't supported here")
ErrUnsupported is Open's error where a socket can't be handed to another process (Windows).
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
Hello Hello
// contains filtered or unexported fields
}
Conn is the new magpie, connected to an Offer.
func (*Conn) AwaitAck ¶
AwaitAck waits, timeout at most, for the new magpie to say its gateway serves on the socket given. An error is the new one gone or not ready in time: the socket is then still this one's to serve.
type Meta ¶
type Meta struct {
// Addr is where the socket listens.
Addr string `json:"addr"`
// Callbacks is the unix socket where the magpie handing over answers
// its own Claude Code runs' tool calls until it ends.
Callbacks string `json:"callbacks,omitempty"`
// PID is the magpie handing over.
PID int `json:"pid"`
}
Meta comes with the socket handed over.
type Offer ¶
type Offer struct {
// contains filtered or unexported fields
}
Offer is a socket waiting to be handed to the new magpie.
func Open ¶
Open offers the gateway's socket to the next magpie to run exe on the config folder dir.
func (*Offer) Close ¶
func (o *Offer) Close()
Close takes the Offer back: its pointer and sockets are removed.