sidecar

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sidecar implements the local session server. Hook handlers connect over a Unix socket. The sidecar relays events to the Kontext backend via ConnectRPC and keeps the session alive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadMessage

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

ReadMessage reads a length-prefixed JSON message from a connection.

func WriteMessage

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

WriteMessage writes a length-prefixed JSON message to a connection. Wire format: 4-byte big-endian length + JSON payload.

Types

type EvaluateRequest

type EvaluateRequest struct {
	Type         string          `json:"type"` // "evaluate"
	Agent        string          `json:"agent"`
	HookEvent    string          `json:"hook_event"`
	ToolName     string          `json:"tool_name"`
	ToolInput    json.RawMessage `json:"tool_input,omitempty"`
	ToolResponse json.RawMessage `json:"tool_response,omitempty"`
	ToolUseID    string          `json:"tool_use_id"`
	CWD          string          `json:"cwd"`
}

EvaluateRequest is sent from kontext hook → sidecar over Unix socket.

type EvaluateResult

type EvaluateResult struct {
	Type    string `json:"type"` // "result"
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason"`
}

EvaluateResult is sent from sidecar → kontext hook.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the local sidecar that hook handlers communicate with.

func New

func New(sessionDir string, client *backend.Client, sessionID, agentName string) (*Server, error)

New creates a new sidecar server.

func (*Server) SocketPath

func (s *Server) SocketPath() string

SocketPath returns the Unix socket path.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start begins listening and processing hook events.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the sidecar.

Jump to

Keyboard shortcuts

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