sessiond

package
v0.3.0-alpha.55 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion = 2

Variables

This section is empty.

Functions

func BinaryHash

func BinaryHash(path string) (string, error)

func DefaultRecordDir

func DefaultRecordDir() (string, error)

func DefaultSocketPath

func DefaultSocketPath() (string, error)

func DefaultStateDir

func DefaultStateDir() (string, error)

func DefaultTranscriptDir

func DefaultTranscriptDir() (string, error)

func FindSessiondBinary

func FindSessiondBinary() (string, error)

func WaitForShutdown

func WaitForShutdown(ctx context.Context, socketPath string) error

Types

type AckRequest

type AckRequest struct {
	SessionID string `json:"sessionId"`
	StreamID  string `json:"streamId"`
	Bytes     int64  `json:"bytes"`
}

type AttachRequest

type AttachRequest struct {
	ProtocolVersion int    `json:"protocolVersion"`
	Type            string `json:"type"`
	SessionID       string `json:"sessionId"`
	StreamID        string `json:"streamId,omitempty"`
	Since           int64  `json:"since"`
	WithBuffer      bool   `json:"withBuffer"`
}

type BacklogRequest

type BacklogRequest struct {
	SessionID string `json:"sessionId"`
	Since     int64  `json:"since"`
}

type BacklogResponse

type BacklogResponse struct {
	SessionID  string `json:"sessionId"`
	Data       string `json:"data"`
	NextOffset int64  `json:"nextOffset"`
	Truncated  bool   `json:"truncated"`
	Source     string `json:"source,omitempty"`
}

type BootstrapRequest

type BootstrapRequest struct {
	SessionID string `json:"sessionId"`
}

type BootstrapResponse

type BootstrapResponse struct {
	SessionID        string          `json:"sessionId"`
	Snapshot         string          `json:"snapshot"`
	SnapshotSource   string          `json:"snapshotSource,omitempty"`
	Kitty            *kitty.Snapshot `json:"kitty,omitempty"`
	Backlog          string          `json:"backlog,omitempty"`
	NextOffset       int64           `json:"nextOffset,omitempty"`
	BacklogTruncated bool            `json:"backlogTruncated,omitempty"`
	BacklogSource    string          `json:"backlogSource,omitempty"`
	AltScreen        bool            `json:"altScreen,omitempty"`
	MouseMask        uint8           `json:"mouseMask,omitempty"`
	Mouse            bool            `json:"mouse,omitempty"`
	MouseSGR         bool            `json:"mouseSGR,omitempty"`
	MouseEncoding    string          `json:"mouseEncoding,omitempty"`
	SafeToReplay     bool            `json:"safeToReplay,omitempty"`
	InitialCredit    int64           `json:"initialCredit,omitempty"`
}

type Client

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

func EnsureRunning

func EnsureRunning(ctx context.Context) (*Client, error)

func EnsureRunningWithOptions

func EnsureRunningWithOptions(ctx context.Context, opts StartOptions) (*Client, error)

func NewClient

func NewClient(socketPath string) *Client

func (*Client) Ack

func (c *Client) Ack(ctx context.Context, sessionID, streamID string, bytes int64) error

func (*Client) Attach

func (c *Client) Attach(ctx context.Context, sessionID string, since int64, withBuffer bool, streamID string) (*Stream, StreamMessage, error)

func (*Client) Backlog

func (c *Client) Backlog(ctx context.Context, sessionID string, since int64) (BacklogResponse, error)

func (*Client) Bootstrap

func (c *Client) Bootstrap(ctx context.Context, sessionID string) (BootstrapResponse, error)

func (*Client) Create

func (c *Client) Create(ctx context.Context, sessionID, cwd string) (CreateResponse, error)

func (*Client) Info

func (c *Client) Info(ctx context.Context) (InfoResponse, error)

func (*Client) List

func (c *Client) List(ctx context.Context) (ListResponse, error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) Resize

func (c *Client) Resize(ctx context.Context, sessionID string, cols, rows int) error

func (*Client) Send

func (c *Client) Send(ctx context.Context, sessionID, data string) error

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) error

func (*Client) ShutdownWithReason

func (c *Client) ShutdownWithReason(ctx context.Context, source, reason string) error

func (*Client) Snapshot

func (c *Client) Snapshot(ctx context.Context, sessionID string) (SnapshotResponse, error)

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, sessionID string) error

type ControlRequest

type ControlRequest struct {
	ProtocolVersion int             `json:"protocolVersion"`
	Method          string          `json:"method"`
	Params          json.RawMessage `json:"params,omitempty"`
}

type ControlResponse

type ControlResponse struct {
	OK     bool   `json:"ok"`
	Result any    `json:"result,omitempty"`
	Error  string `json:"error,omitempty"`
}

type CreateRequest

type CreateRequest struct {
	SessionID string `json:"sessionId"`
	Cwd       string `json:"cwd"`
}

type CreateResponse

type CreateResponse struct {
	SessionID string `json:"sessionId"`
	Existing  bool   `json:"existing"`
}

type InfoResponse

type InfoResponse struct {
	Executable string `json:"executable"`
	BinaryHash string `json:"binaryHash"`
}

type ListResponse

type ListResponse struct {
	Sessions []SessionInfo `json:"sessions"`
}

type Options

type Options struct {
	SocketPath              string
	TranscriptDir           string
	RecordDir               string
	StateDir                string
	IdleTimeout             time.Duration
	BufferBytes             int
	TranscriptMaxBytes      int64
	TranscriptTrimThreshold int64
	TranscriptTailBytes     int64
	SnapshotInterval        time.Duration
	HistoryLines            int
	RecordPty               bool
	StreamCreditTimeout     time.Duration
	StreamInitialCredit     int64
	Logger                  *log.Logger
	ProtocolLogEnabled      bool
	ProtocolLogDir          string
	ProtocolLogger          *unifiedlog.Logger
}

func DefaultOptions

func DefaultOptions() Options

type ResizeRequest

type ResizeRequest struct {
	SessionID string `json:"sessionId"`
	Cols      int    `json:"cols"`
	Rows      int    `json:"rows"`
}

type SendRequest

type SendRequest struct {
	SessionID string `json:"sessionId"`
	Data      string `json:"data"`
}

type Server

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

func NewServer

func NewServer(opts Options) *Server

func (*Server) Listen

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

func (*Server) SetShutdown

func (s *Server) SetShutdown(fn func())

type Session

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

type SessionInfo

type SessionInfo struct {
	SessionID  string `json:"sessionId"`
	Cwd        string `json:"cwd"`
	StartedAt  string `json:"startedAt"`
	LastActive string `json:"lastActive"`
	Running    bool   `json:"running"`
}

type ShutdownRequest

type ShutdownRequest struct {
	Source     string `json:"source,omitempty"`
	Reason     string `json:"reason,omitempty"`
	PID        int    `json:"pid,omitempty"`
	Executable string `json:"executable,omitempty"`
}

type SnapshotRequest

type SnapshotRequest struct {
	SessionID string `json:"sessionId"`
}

type SnapshotResponse

type SnapshotResponse struct {
	SessionID     string          `json:"sessionId"`
	Data          string          `json:"data"`
	Source        string          `json:"source,omitempty"`
	Kitty         *kitty.Snapshot `json:"kitty,omitempty"`
	AltScreen     bool            `json:"altScreen,omitempty"`
	MouseMask     uint8           `json:"mouseMask,omitempty"`
	Mouse         bool            `json:"mouse,omitempty"`
	MouseSGR      bool            `json:"mouseSGR,omitempty"`
	MouseEncoding string          `json:"mouseEncoding,omitempty"`
	SafeToReplay  bool            `json:"safeToReplay,omitempty"`
}

type StartOptions

type StartOptions struct {
	ProtocolLogEnabled bool
	ProtocolLogDir     string
}

type StopRequest

type StopRequest struct {
	SessionID string `json:"sessionId"`
}

type Stream

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

func (*Stream) Close

func (s *Stream) Close() error

func (*Stream) ID

func (s *Stream) ID() string

func (*Stream) Next

func (s *Stream) Next(msg *StreamMessage) error

type StreamMessage

type StreamMessage struct {
	Type             string       `json:"type"`
	SessionID        string       `json:"sessionId,omitempty"`
	StreamID         string       `json:"streamId,omitempty"`
	Data             string       `json:"data,omitempty"`
	Len              int          `json:"len,omitempty"`
	NextOffset       int64        `json:"nextOffset,omitempty"`
	Truncated        bool         `json:"truncated,omitempty"`
	Source           string       `json:"source,omitempty"`
	SnapshotSource   string       `json:"snapshotSource,omitempty"`
	BacklogSource    string       `json:"backlogSource,omitempty"`
	BacklogTruncated bool         `json:"backlogTruncated,omitempty"`
	AltScreen        bool         `json:"altScreen,omitempty"`
	MouseMask        uint8        `json:"mouseMask,omitempty"`
	Mouse            bool         `json:"mouse,omitempty"`
	MouseSGR         bool         `json:"mouseSGR,omitempty"`
	MouseEncoding    string       `json:"mouseEncoding,omitempty"`
	SafeToReplay     bool         `json:"safeToReplay,omitempty"`
	InitialCredit    int64        `json:"initialCredit,omitempty"`
	Kitty            *kitty.Event `json:"kitty,omitempty"`
	Error            string       `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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