ptybackend

package
v0.8.19 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package ptybackend adapts Relayer's established PTY session manager to the context-aware terminal.Backend contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsClosed

func IsClosed(err error) bool

Types

type Manager

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

func New

func New(
	parent context.Context,
	events chan<- session.Event,
	patterns []intercept.Pattern,
	ringCapacity int,
) (*Manager, error)

func NewWithRegistry

func NewWithRegistry(
	parent context.Context,
	events chan<- session.Event,
	registry *adapters.Registry,
	ringCapacity int,
) (*Manager, error)

NewWithRegistry constructs a PTY backend using the application adapter registry. New remains the source-compatible legacy-pattern wrapper.

func (*Manager) AnsiOutput

func (m *Manager) AnsiOutput(id string) (string, error)

AnsiOutput returns the processor's in-memory ring retaining ANSI escape codes.

func (*Manager) AttachCommand

func (m *Manager) AttachCommand(context.Context, terminal.SessionID) (*exec.Cmd, error)

func (*Manager) BeginShutdown

func (m *Manager) BeginShutdown()

BeginShutdown is intentionally non-blocking so Bubble Tea can quit before Close joins process and reader goroutines.

func (*Manager) Close

func (m *Manager) Close(ctx context.Context) error

func (*Manager) Context

func (m *Manager) Context() context.Context

Context exposes the owner cancellation to the narrow Bubble Tea adapter.

func (*Manager) Name

func (m *Manager) Name() string

func (*Manager) Output

func (m *Manager) Output(id string) (string, error)

Output returns the processor's in-memory ring without any process query.

func (*Manager) PendingEvent

func (m *Manager) PendingEvent(ctx context.Context, id terminal.SessionID) (*adapters.Event, error)

PendingEvent returns cached adapter state without performing terminal I/O.

func (*Manager) Remove added in v0.4.0

func (m *Manager) Remove(ctx context.Context, id terminal.SessionID) error

Remove releases one fully stopped session identity so Start can register it again. The inner manager proves the process was reaped before forgetting it; a live process keeps the identity locked with terminal.ErrSessionRunning.

func (*Manager) Resize

func (m *Manager) Resize(ctx context.Context, id terminal.SessionID, size terminal.Size) error

func (*Manager) Send

func (m *Manager) Send(ctx context.Context, id terminal.SessionID, data []byte) error

func (*Manager) SendEvent

func (m *Manager) SendEvent(ctx context.Context, id terminal.SessionID, eventID string, data []byte) error

SendEvent resolves one pending adapter event and transmits data exactly as supplied. An empty eventID preserves the historical Send behavior.

func (*Manager) SendLine

func (m *Manager) SendLine(ctx context.Context, id terminal.SessionID, line string) error

SendLine uses the Processor's ordinary-input CAS. It never falls back to SendDataForEvent and therefore cannot resolve or acknowledge a prompt.

func (*Manager) SendRaw added in v0.6.0

func (m *Manager) SendRaw(ctx context.Context, id terminal.SessionID, data []byte) error

SendRaw writes raw terminal input bytes directly to the PTY device for interactive streaming.

func (*Manager) SetRecorder added in v0.7.0

func (m *Manager) SetRecorder(recorder terminal.Recorder)

SetRecorder forwards the transcript recorder to the owned session manager, which is where the PTY bytes actually pass.

func (*Manager) Snapshot

func (m *Manager) Snapshot(ctx context.Context, id terminal.SessionID) (terminal.Snapshot, error)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, spec agent.Spec, size terminal.Size) (terminal.Info, error)

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context, id terminal.SessionID) error

Jump to

Keyboard shortcuts

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