terminal

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package terminal provides WebSocket-based interactive terminal sessions.

Sessions are created via task execution and communicate bidirectionally with clients through a relay endpoint, using PTY for shell interaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// CreateSession creates a new terminal session with the given dimensions.
	CreateSession(ctx context.Context, instanceID string, cols, rows uint16) (*Session, error)
	// GetSession retrieves an active session by ID.
	GetSession(sessionID string) (*Session, error)
	// RemoveSession removes and cleans up a session.
	RemoveSession(sessionID string)
	// CleanupInactiveSessions removes sessions inactive for longer than the given timeout.
	CleanupInactiveSessions(timeout time.Duration)
}

Manager handles terminal session lifecycle.

type Message

type Message struct {
	Action MessageAction `json:"action"`
	Data   string        `json:"data,omitempty"`
	Cols   uint16        `json:"cols,omitempty"`
	Rows   uint16        `json:"rows,omitempty"`
	Error  string        `json:"error,omitempty"`
}

type MessageAction

type MessageAction string
const (
	ActionInit   MessageAction = "init"
	ActionInput  MessageAction = "input"
	ActionResize MessageAction = "resize"
	ActionOutput MessageAction = "output"
	ActionError  MessageAction = "error"
	ActionClose  MessageAction = "close"
)

type Session

type Session struct {
	ID           string
	PTY          *os.File
	Process      *os.Process
	Cols         uint16
	Rows         uint16
	CreatedAt    time.Time
	LastActivity time.Time
	// contains filtered or unexported fields
}

func (*Session) Cleanup

func (s *Session) Cleanup()

func (*Session) Resize

func (s *Session) Resize(cols, rows uint16) error

func (*Session) UpdateActivity

func (s *Session) UpdateActivity()

Jump to

Keyboard shortcuts

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