pty

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCols is the default terminal width when not configured.
	DefaultCols = 120
	// DefaultRows is the default terminal height when not configured.
	DefaultRows = 40
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements terminal.Backend using built-in PTY management. Each agent session runs in its own pseudo-terminal with a vt10x emulator.

func NewClient

func NewClient(cols, rows int) *Client

NewClient creates a new PTY backend client with the given terminal dimensions.

func (*Client) Available

func (c *Client) Available() error

Available always returns nil since the PTY backend has no external dependencies.

func (*Client) Close

func (c *Client) Close()

Close cleans up all sessions (both live and exited).

func (*Client) FocusSession

func (c *Client) FocusSession(sessionID string) error

FocusSession is a no-op for the PTY backend. The TUI handles display by switching to the embedded terminal view.

func (*Client) GetVar

func (c *Client) GetVar(sessionID, varName string) (string, error)

GetVar reads session variables. Supported: "pid", "path".

func (*Client) ListSessions

func (c *Client) ListSessions() ([]terminal.Session, error)

ListSessions returns all active (non-exited) sessions. Exited sessions are cleaned up (fd closed, process reaped) but kept in the map so they remain addressable for ReadScreen until Close().

func (*Client) MonitorOutput

func (c *Client) MonitorOutput(sessionID, logPath, patterns string) (int, error)

MonitorOutput is not supported by the PTY backend. Screen reads every 3s are the primary status detection mechanism.

func (*Client) NewSession

func (c *Client) NewSession() (string, error)

NewSession spawns a new shell in a PTY and returns its session ID.

func (*Client) ReadScreen

func (c *Client) ReadScreen(sessionID string, lines int) (string, error)

ReadScreen returns the last N lines from the session's vt10x screen buffer.

func (*Client) Resize

func (c *Client) Resize(cols, rows int)

Resize updates the terminal dimensions for all active sessions.

func (*Client) RunCommand

func (c *Client) RunCommand(sessionID, cmd string) error

RunCommand sends a command string followed by a newline to the session's PTY.

func (*Client) SendText

func (c *Client) SendText(sessionID, text string) error

SendText writes raw text to the session's PTY.

Jump to

Keyboard shortcuts

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