Documentation
¶
Overview ¶
Package terminal defines the process-neutral contract implemented by every Relayer terminal backend. It deliberately contains no Bubble Tea, PTY, tmux command or interception code.
Index ¶
Constants ¶
const MaxLineBytes = adapters.MaxLineBytes
MaxLineBytes is the maximum line size before the core appends one carriage return. It aliases the Processor limit so transports cannot drift.
Variables ¶
var ( ErrClosed = errors.New("terminal backend closed") ErrSessionNotFound = errors.New("terminal session not found") ErrNotAttachable = errors.New("terminal session not attachable") ErrUnsupported = errors.New("terminal backend not supported") // These aliases preserve one errors.Is identity from the Processor through // session, backend, router and presentation boundaries. ErrEventPending = adapters.ErrEventPending ErrInvalidLine = adapters.ErrInvalidLine ErrLineUnsupported = adapters.ErrLineUnsupported ErrLineDeliveryUncertain = adapters.ErrLineDeliveryUncertain )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
Name() string
Start(context.Context, agent.Spec, Size) (Info, error)
Send(context.Context, SessionID, []byte) error
Resize(context.Context, SessionID, Size) error
Snapshot(context.Context, SessionID) (Snapshot, error)
AttachCommand(context.Context, SessionID) (*exec.Cmd, error)
Stop(context.Context, SessionID) error
Close(context.Context) error
}
Backend is the authoritative terminal boundary used by the application. Implementations own their processes and resources; all potentially blocking operations accept a context. Send transmits data exactly as supplied.
type EventSender ¶
EventSender atomically delivers a decision for the exact pending event. Implementations acknowledge eventID only after data is written successfully.
type Info ¶
type Info struct {
ID SessionID
Name string
DisplayCommand string
Backend string
Adapter string
Shell bool
}
Info is immutable, display-safe metadata returned after startup. Backend is always concrete (pty or tmux), never the auto selector.
type LineSender ¶
LineSender is the optional, atomic ordinary-input boundary. Implementations must reject input while an actionable event is pending and must append the line terminator in the core rather than accepting pre-encoded raw bytes.
type OperationError ¶
OperationError adds safe context to a backend failure without requiring an implementation to expose command arguments or environment values.
func (*OperationError) Error ¶
func (e *OperationError) Error() string
func (*OperationError) Unwrap ¶
func (e *OperationError) Unwrap() error
type PendingEventProvider ¶
type PendingEventProvider interface {
PendingEvent(context.Context, SessionID) (*adapters.Event, error)
}
PendingEventProvider returns only cached semantic state. Implementations must not query a process or spawn an external command; Bubble Tea uses this path while reducing an already-delivered event.
type Snapshot ¶
type Snapshot struct {
ID SessionID
Status Status
Running bool
Attached bool
ExitCode *int
Output string
Pending *adapters.Event
Revision uint64
}
Snapshot reconciles bounded output, process status and a possible prompt after asynchronous activity such as returning from an attached tmux client.