server

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSocketPath = "/tmp/savvy-socket"

Variables

View Source
var ErrAbortRecording = errors.New("abort recording")
View Source
var ErrStartingRecordingSession = errors.New("failed to start recording session")

Functions

This section is empty.

Types

type Client added in v0.7.3

type Client interface {
	// SendFileInfo tells the server to read the file at the given path
	SendFileInfo(filePath string) error
	ShutdownSender
}

func NewClient added in v0.11.4

func NewClient(ctx context.Context, socketPath string) (Client, error)

func NewDefaultClient added in v0.7.3

func NewDefaultClient(ctx context.Context) (Client, error)

type ErrConcurrentRecordingSession added in v0.10.1

type ErrConcurrentRecordingSession struct {
	SocketPath string
}

func (*ErrConcurrentRecordingSession) Error added in v0.10.1

type FileInfo added in v0.10.0

type FileInfo struct {
	Path    string      `json:"path,omitempty"`
	Mode    fs.FileMode `json:"mode,omitempty"`
	Content []byte      `json:"content,omitempty"`
}

type Option added in v0.7.6

type Option func(*UnixSocketServer)

func WithCommandRecordedHook added in v0.7.6

func WithCommandRecordedHook(hook func(string)) Option

func WithIgnoreErrors added in v0.8.0

func WithIgnoreErrors(ignoreErrors bool) Option

func WithLogger added in v0.8.0

func WithLogger(logger *slog.Logger) Option

type RecordedCommand added in v0.8.2

type RecordedCommand struct {
	Command  string    `json:"command"`
	Prompt   string    `json:"prompt,omitempty"`
	FileInfo *FileInfo `json:"file_info,omitempty"`
}

type RecordedData added in v0.8.0

type RecordedData struct {
	Command  string      `json:"command"`
	StepID   string      `json:"step_id"`
	ExitCode int         `json:"exit_code"`
	Prompt   string      `json:"prompt,omitempty"`
	Filepath string      `json:"filepath,omitempty"`
	FileData []byte      `json:"file_data,omitempty"`
	FileMode fs.FileMode `json:"file_mode,omitempty"`
}

func (*RecordedData) HasFileData added in v0.10.0

func (rd *RecordedData) HasFileData() bool

func (*RecordedData) IsShutdown added in v0.10.1

func (rd *RecordedData) IsShutdown() bool

type ShutdownSender added in v0.11.4

type ShutdownSender interface {
	// Shutdown tells the server to shutdown.
	SendShutdown() error
}

type UnixSocketServer

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

func NewUnixSocketServer

func NewUnixSocketServer(socketPath string, opts ...Option) (*UnixSocketServer, error)

func NewUnixSocketServerWithDefaultPath added in v0.7.3

func NewUnixSocketServerWithDefaultPath(opts ...Option) (*UnixSocketServer, error)

func (*UnixSocketServer) Close

func (s *UnixSocketServer) Close() error

func (*UnixSocketServer) Commands

func (s *UnixSocketServer) Commands() []*RecordedCommand

func (*UnixSocketServer) ListenAndServe

func (s *UnixSocketServer) ListenAndServe()

func (*UnixSocketServer) SocketPath added in v0.7.3

func (s *UnixSocketServer) SocketPath() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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