pty

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Type      AgentType
	Terminal  *Terminal
	Workspace *data.Workspace
	Config    config.AssistantConfig
}

Agent represents a running AI agent instance

type AgentManager

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

AgentManager manages agent instances

func NewAgentManager

func NewAgentManager(cfg *config.Config) *AgentManager

NewAgentManager creates a new agent manager

func (*AgentManager) CloseAgent

func (m *AgentManager) CloseAgent(agent *Agent) error

CloseAgent closes an agent

func (*AgentManager) CloseAll

func (m *AgentManager) CloseAll()

CloseAll closes all agents

func (*AgentManager) CloseWorkspaceAgents added in v0.0.5

func (m *AgentManager) CloseWorkspaceAgents(ws *data.Workspace)

CloseWorkspaceAgents closes and removes all agents for a specific workspace

func (*AgentManager) CreateAgent

func (m *AgentManager) CreateAgent(ws *data.Workspace, agentType AgentType, rows, cols uint16) (*Agent, error)

CreateAgent creates a new agent for the given workspace.

func (*AgentManager) CreateViewer

func (m *AgentManager) CreateViewer(ws *data.Workspace, command string, rows, cols uint16) (*Agent, error)

CreateViewer creates a new agent (viewer) for the given workspace and command.

func (*AgentManager) SendInterrupt

func (m *AgentManager) SendInterrupt(agent *Agent) error

SendInterrupt sends an interrupt to an agent

type AgentType

type AgentType string

AgentType represents the type of AI agent

const (
	AgentClaude   AgentType = "claude"
	AgentCodex    AgentType = "codex"
	AgentGemini   AgentType = "gemini"
	AgentAmp      AgentType = "amp"
	AgentOpencode AgentType = "opencode"
	AgentDroid    AgentType = "droid"
	AgentCursor   AgentType = "cursor"
)

type Terminal

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

Terminal wraps a PTY with an associated command

func New

func New(command string, dir string, env []string) (*Terminal, error)

New creates a new terminal with the given command.

func NewWithSize

func NewWithSize(command string, dir string, env []string, rows, cols uint16) (*Terminal, error)

NewWithSize creates a new terminal with an initial size, if provided.

func (*Terminal) Close

func (t *Terminal) Close() error

Close closes the terminal

func (*Terminal) File

func (t *Terminal) File() *os.File

File returns the underlying PTY file

func (*Terminal) IsClosed

func (t *Terminal) IsClosed() bool

IsClosed returns whether the terminal has been closed

func (*Terminal) Read

func (t *Terminal) Read(p []byte) (int, error)

Read reads output from the terminal Note: This does NOT hold the mutex during the blocking read to avoid deadlock

func (*Terminal) Running

func (t *Terminal) Running() bool

Running returns whether the terminal is still running

func (*Terminal) SendInterrupt

func (t *Terminal) SendInterrupt() error

SendInterrupt sends Ctrl+C to the terminal

func (*Terminal) SendString

func (t *Terminal) SendString(s string) error

SendString sends a string to the terminal

func (*Terminal) SetSize

func (t *Terminal) SetSize(rows, cols uint16) error

SetSize sets the terminal size

func (*Terminal) Write

func (t *Terminal) Write(p []byte) (int, error)

Write sends input to the terminal

Jump to

Keyboard shortcuts

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