X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/d28e3b2858db322899a81b59a30400c1acad2b42..f4509310b5abe5012cb83bed3960404e8fa92217:/socket.go diff --git a/socket.go b/socket.go index 0dffeb0..dc78d94 100644 --- a/socket.go +++ b/socket.go @@ -20,6 +20,22 @@ const ( terminalSource = "terminal" ) +// SocketRequest is one line from a client: "send" with the text of a user +// message, "interrupt", "stop" with the name of a subagent in Text, or +// "whatsapp" with the text after /whatsapp of a WhatsApp command, or "backup" +// with the absolute output path in Text. The backup answer is a "backup" event +// with the path and size, or an "error" event. An "image" request has an +// absolute Path and the caption in Text. A "notify" request has external data +// in Notify. Its optional agent_id selects a permanent identity, not a name. +// Its private "notify" answer has a queue ID and an accepted or duplicate +// Status, not a processing result. +type SocketRequest struct { + Type string `json:"type"` + Text string `json:"text,omitempty"` + Path string `json:"path,omitempty"` + Notify *NotifyInput `json:"notify,omitempty"` +} + // checkSocketPath makes sure that path fits in the address of a Unix socket. func checkSocketPath(path string) error { if len(path) > socketPathBytes { @@ -28,15 +44,3 @@ func checkSocketPath(path string) error { return nil } - -// SocketRequest is one line from a client: "send" with the text of a user -// message, "interrupt", "stop" with the name of a subagent in Text, or -// "whatsapp" with the text after /whatsapp of a WhatsApp command, or "backup" -// with the absolute output path in Text. The backup answer is a "backup" event -// with the path and size, or an "error" event. An "image" request has an -// absolute Path and the caption in Text. -type SocketRequest struct { - Type string `json:"type"` - Text string `json:"text,omitempty"` - Path string `json:"path,omitempty"` -}