ipc

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ipc implements the Unix-socket protocol between the blocking critty client (run by an agent) and the TUI process that owns a review session. It replaces crit's HTTP review-cycle API with newline-delimited JSON messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alive

func Alive(path string) bool

Alive reports whether a review session is accepting connections on path.

func Listen

func Listen(path string) (net.Listener, error)

Listen opens the session's Unix socket, replacing a stale socket file left behind by a dead process.

func Stop

func Stop(path string) error

Stop asks the TUI to exit without approving or deleting the review.

func WaitAlive

func WaitAlive(path string, timeout time.Duration) error

WaitAlive polls until the socket accepts connections or the timeout elapses.

func WriteMessage

func WriteMessage(conn net.Conn, v any) error

WriteMessage sends one newline-delimited JSON message.

Types

type FinishPayload

type FinishPayload struct {
	Round         int                    `json:"round,omitempty"`
	Result        *review.FormResult     `json:"result,omitempty"`
	Type          string                 `json:"type"` // "finish"
	Approved      bool                   `json:"approved"`
	Verdict       review.Verdict         `json:"verdict,omitempty"`
	ReviewComment *review.Comment        `json:"review_comment,omitempty"`
	Prompt        string                 `json:"prompt"`
	Comments      []review.ListedComment `json:"comments"`
	NextCommand   string                 `json:"next_command,omitempty"`
}

FinishPayload is the TUI-to-client message emitted when the human finishes a review round.

func ReviewCycle

func ReviewCycle(path string) (*FinishPayload, error)

ReviewCycle connects to a session socket, requests a review cycle, and blocks until the human finishes the round. A closed connection without a finish payload reports the session as ended.

type Request

type Request struct {
	Type string `json:"type"` // "review-cycle"
}

Request is a client-to-TUI message.

func ReadRequest

func ReadRequest(reader *bufio.Reader) (*Request, error)

ReadRequest reads one client request from a connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL