Documentation
¶
Overview ¶
Package agentctl provides a unix-socket control channel between the wick MCP stdio process and the wick HTTP daemon. The daemon owns the agent pool; stdio processes send commands (switch_provider, kill) and receive a JSON response.
Socket path: ~/.<app>/agents/agentctl.sock (same dir as gate.sock)
Index ¶
Constants ¶
const ( OpSwitchProvider = "switch_provider" OpKill = "kill" // OpRefreshSession tells the daemon to reload one session from disk // into its in-memory registry and re-broadcast its meta. Used after // a stdio process mutates session meta on disk (e.g. wick_set_title) // so the daemon's cache + the live UI stay in sync instead of going // stale until the next page load. OpRefreshSession = "refresh_session" )
Op values for Cmd.Op.
Variables ¶
This section is empty.
Functions ¶
func SignalRefresh ¶ added in v0.17.0
SignalRefresh asks the daemon to reload sessionID and re-broadcast its meta. Best-effort: a dial error (no daemon running) is returned but callers typically log-and-ignore — the on-disk write already landed, so the worst case is the UI lags until the next page load.
func SocketPath ¶
func SocketPath() string
SocketPath returns the platform path for the agentctl unix socket.
Types ¶
type Cmd ¶
type Cmd struct {
Op string `json:"op"` // see Op* constants
SessionID string `json:"session_id,omitempty"` // empty = auto-resolve from active pool
AgentName string `json:"agent_name,omitempty"` // empty = "main"
ProviderType string `json:"provider_type,omitempty"` // for switch_provider
ProviderName string `json:"provider_name,omitempty"` // for switch_provider
}
Cmd is the command sent from stdio → daemon.
type Reply ¶
type Reply struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
// Fields echoed on success.
SessionID string `json:"session_id,omitempty"`
AgentName string `json:"agent_name,omitempty"`
ProviderType string `json:"provider_type,omitempty"`
ProviderName string `json:"provider_name,omitempty"`
}
Reply is the daemon's response.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on the agentctl unix socket and dispatches commands to the agent pool. Start it in a goroutine after the pool is ready.
func (*Server) WithRefresh ¶ added in v0.17.0
WithRefresh wires the OpRefreshSession handler. Pass a closure that reloads the session into the in-memory registry and broadcasts its meta over SSE.