agent_server

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AGENT_SCHEDULE_INTERVAL       = 1 * time.Minute
	AGENT_LIVENESS_CHECK_INTERVAL = 10 * time.Second
	AGENT_LIVENESS_TIMEOUT        = 30 * time.Second
)
View Source
const (
	AGENT_SESSION_LOG_HISTORY = 1000 // Number of lines of log history to keep
)

Variables

This section is empty.

Functions

func DisconnectSession added in v0.25.0

func DisconnectSession(spaceId string)

func ExpireSession added in v0.25.0

func ExpireSession(spaceId string)

func ListenAndServe

func ListenAndServe(listen string, tlsConfig *tls.Config)

func QueueSpaceReconcile added in v0.25.0

func QueueSpaceReconcile(spaceId string)

func RemoveSession

func RemoveSession(spaceId string)

Types

type Session

type Session struct {
	Id                    string
	Version               string
	HasCodeServer         bool
	SSHPort               int
	VNCHttpPort           int
	HasTerminal           bool
	TcpPorts              map[string]string
	HttpPorts             map[string]string
	HasVSCodeTunnel       bool
	VSCodeTunnelName      string
	CPUPercent            float64
	MemoryUsedBytes       uint64
	MemoryLimitBytes      uint64
	DiskUsedBytes         uint64
	DiskLimitBytes        uint64
	ActivityWriteCount    uint32
	ActivityCreateCount   uint32
	ActivityDeleteCount   uint32
	ActivityRenameCount   uint32
	ActivityDistinctPaths uint32
	LastActivityAtUnix    int64
	LastStateAt           time.Time
	MuxSession            *yamux.Session

	// The log history
	LogHistoryMutex *sync.RWMutex
	LogHistory      []*msg.LogMessage

	// The list of listeners for log messages
	LogListenersMutex *sync.RWMutex
	LogListeners      map[string]chan *msg.LogMessage
	// contains filtered or unexported fields
}

Struct holding the state / registration information of an agent

func GetSession

func GetSession(spaceId string) *Session

GetSession retrieves the agent session associated with the given spaceId. If an agent session is found for the provided spaceId, it returns the session; otherwise, it returns nil.

func NewSession

func NewSession(spaceId string, version string) *Session

creates a new agent session

func (*Session) Ping

func (s *Session) Ping() bool

func (*Session) RegisterLogListener added in v0.11.5

func (s *Session) RegisterLogListener() (string, chan *msg.LogMessage)

func (*Session) SendCopyFile added in v0.19.0

func (s *Session) SendCopyFile(copyCmd *msg.CopyFileMessage) (chan *msg.CopyFileResponse, error)

func (*Session) SendExecuteScript added in v0.23.0

func (s *Session) SendExecuteScript(execMsg *msg.ExecuteScriptMessage) (chan *msg.ExecuteScriptResponse, error)

func (*Session) SendExecuteScriptStream added in v0.23.0

func (s *Session) SendExecuteScriptStream(execMsg *msg.ExecuteScriptStreamMessage) (io.ReadWriteCloser, error)

func (*Session) SendPortForward added in v0.22.2

func (s *Session) SendPortForward(portCmd *msg.PortForwardRequest) (*msg.PortForwardResponse, error)

func (*Session) SendPortList added in v0.22.2

func (s *Session) SendPortList() (*msg.PortListResponse, error)

func (*Session) SendPortStop added in v0.22.2

func (s *Session) SendPortStop(portCmd *msg.PortStopRequest) (*msg.PortStopResponse, error)

func (*Session) SendRunCommand added in v0.19.0

func (s *Session) SendRunCommand(runCmd *msg.RunCommandMessage) (chan *msg.RunCommandResponse, error)

func (*Session) SendUpdateAuthorizedKeys

func (s *Session) SendUpdateAuthorizedKeys(sshKeys []string, sshPrivateKey string, githubUsernames []string) error

func (*Session) SendUpdateShell added in v0.11.5

func (s *Session) SendUpdateShell(shell string) error

func (*Session) UnregisterLogListener added in v0.11.5

func (s *Session) UnregisterLogListener(listenerId string)

Jump to

Keyboard shortcuts

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