terminal

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeID_TERMINAL_SESSION_CREATE uint32 = 2001
	TypeID_TERMINAL_SESSION_LIST   uint32 = 2002
	TypeID_TERMINAL_SESSION_ATTACH uint32 = 2003

	TypeID_TERMINAL_OUTPUT  uint32 = 2004 // notify (agent -> client)
	TypeID_TERMINAL_RESIZE  uint32 = 2005 // notify (client -> agent)
	TypeID_TERMINAL_INPUT   uint32 = 2006 // notify (client -> agent)
	TypeID_TERMINAL_HISTORY uint32 = 2007
	TypeID_TERMINAL_CLEAR   uint32 = 2008

	TypeID_TERMINAL_SESSION_DELETE   uint32 = 2009
	TypeID_TERMINAL_NAME_UPDATE      uint32 = 2010 // notify (agent -> client): session name/working dir changed
	TypeID_TERMINAL_SESSION_STATS    uint32 = 2011 // history buffer stats (client -> agent)
	TypeID_TERMINAL_SESSIONS_CHANGED uint32 = 2012 // notify (agent -> client): terminal sessions list changed
)

Variables

View Source
var ErrSessionNotFound = errors.New("terminal session not found")

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(shell string, agentHomeAbs string, log *slog.Logger) *Manager

func (*Manager) AddSessionLifecycleHook

func (m *Manager) AddSessionLifecycleHook(hook SessionLifecycleHook) func()

func (*Manager) Cleanup

func (m *Manager) Cleanup()

Cleanup terminates all running terminal sessions (best-effort).

func (*Manager) CreateSession

func (m *Manager) CreateSession(name string, workingDir string) (*SessionInfo, error)

func (*Manager) DeleteSession

func (m *Manager) DeleteSession(sessionID string) error

func (*Manager) DeleteSessionForWidget

func (m *Manager) DeleteSessionForWidget(sessionID string, widgetID string) error

func (*Manager) DetachSink

func (m *Manager) DetachSink(streamServer *rpc.Server)

DetachSink removes all terminal attachments bound to the given RPC stream.

func (*Manager) Register

func (m *Manager) Register(r *rpc.Router, meta *session.Meta, streamServer *rpc.Server)

func (*Manager) RegisterWithAccessGate

func (m *Manager) RegisterWithAccessGate(r *rpc.Router, meta *session.Meta, streamServer *rpc.Server, gate *accessgate.Gate)

func (*Manager) VisibleSessionIDs

func (m *Manager) VisibleSessionIDs() []string

type SessionInfo

type SessionInfo struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	WorkingDir     string `json:"working_dir"`
	CreatedAtMs    int64  `json:"created_at_ms"`
	LastActiveAtMs int64  `json:"last_active_at_ms"`
	IsActive       bool   `json:"is_active"`
}

type SessionLifecycle

type SessionLifecycle string
const (
	SessionLifecycleOpen              SessionLifecycle = "open"
	SessionLifecycleClosing           SessionLifecycle = "closing"
	SessionLifecycleClosed            SessionLifecycle = "closed"
	SessionLifecycleCloseFailedHidden SessionLifecycle = "close_failed_hidden"
)

type SessionLifecycleEvent

type SessionLifecycleEvent struct {
	Reason        string           `json:"reason"`
	SessionID     string           `json:"session_id"`
	Lifecycle     SessionLifecycle `json:"lifecycle"`
	OwnerWidgetID string           `json:"owner_widget_id,omitempty"`
	Hidden        bool             `json:"hidden,omitempty"`
	TimestampMs   int64            `json:"timestamp_ms"`
}

type SessionLifecycleHook

type SessionLifecycleHook func(SessionLifecycleEvent)

type SessionLifecycleRecord

type SessionLifecycleRecord struct {
	Lifecycle          SessionLifecycle `json:"lifecycle"`
	OwnerWidgetID      string           `json:"owner_widget_id,omitempty"`
	CloseRequestedAtMs int64            `json:"close_requested_at_ms,omitempty"`
	CloseFinishedAtMs  int64            `json:"close_finished_at_ms,omitempty"`
	FailureCode        string           `json:"failure_code,omitempty"`
	FailureMessage     string           `json:"failure_message,omitempty"`
}

Jump to

Keyboard shortcuts

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