Documentation
¶
Index ¶
- func ContainsText(snap ScreenSnapshot, needle string) bool
- func IsTerminalResponse(data []byte) bool
- func JoinTailText(lines []TailLine) string
- func StripANSI(s string) string
- func TailFingerprint(snap ScreenSnapshot, maxLines int) string
- func VisibleText(snap ScreenSnapshot) string
- type CellSnapshot
- type Emulator
- func (e *Emulator) AltBufferActive() bool
- func (e *Emulator) Close()
- func (e *Emulator) Cols() int
- func (e *Emulator) Cursor() (x, y int)
- func (e *Emulator) Line(y int) string
- func (e *Emulator) ReplayANSI() []byte
- func (e *Emulator) Resize(cols, rows int)
- func (e *Emulator) Rows() int
- func (e *Emulator) SetOnData(fn func(string))
- func (e *Emulator) Snapshot() ScreenSnapshot
- func (e *Emulator) SnapshotWith(opts SnapshotOptions) ScreenSnapshot
- func (e *Emulator) String() string
- func (e *Emulator) Write(p []byte) (int, error)
- type LineChange
- type ParseError
- type RowSnapshot
- type ScreenDiff
- type ScreenSnapshot
- type ScrollRegion
- type SnapshotOptions
- type TailLine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsText ¶
func ContainsText(snap ScreenSnapshot, needle string) bool
ContainsText reports whether needle appears in any visible line.
func IsTerminalResponse ¶ added in v0.2.0
IsTerminalResponse reports whether data is an auto-generated terminal reply (OSC/CSI/DCS), not interactive user input.
func JoinTailText ¶
JoinTailText joins tail lines into a single newline-delimited string.
func TailFingerprint ¶
func TailFingerprint(snap ScreenSnapshot, maxLines int) string
TailFingerprint fingerprints the last maxLines non-empty rows for activity detection.
func VisibleText ¶
func VisibleText(snap ScreenSnapshot) string
VisibleText returns non-empty lines trimmed and joined (full viewport).
Types ¶
type CellSnapshot ¶
type CellSnapshot struct {
Ch string `json:"ch"`
Fg string `json:"fg,omitempty"`
Bg string `json:"bg,omitempty"`
Attr []string `json:"attr,omitempty"`
}
CellSnapshot is one grid cell for the headless API.
type Emulator ¶
type Emulator struct {
// contains filtered or unexported fields
}
Emulator wraps xterm-go for Tuile's shared PTY parsing layer.
func (*Emulator) AltBufferActive ¶
AltBufferActive reports whether the alternate screen is active.
func (*Emulator) Line ¶
Line returns visible text for row y (without trailing spaces trimmed by caller).
func (*Emulator) ReplayANSI ¶
ReplayANSI serializes the buffer as escape sequences for browser replay (U6).
func (*Emulator) SetOnData ¶ added in v0.2.0
SetOnData registers a callback for terminal-generated replies (OSC/CSI/DCS).
func (*Emulator) Snapshot ¶
func (e *Emulator) Snapshot() ScreenSnapshot
Snapshot captures structured screen state for agent reads.
func (*Emulator) SnapshotWith ¶
func (e *Emulator) SnapshotWith(opts SnapshotOptions) ScreenSnapshot
SnapshotWith captures structured screen state with optional per-cell detail.
type LineChange ¶
LineChange is one row update in an incremental screen diff.
type ParseError ¶
type ParseError struct {
Detail string
}
ParseError wraps invalid emulator input for callers.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type RowSnapshot ¶
type RowSnapshot struct {
Y int `json:"y"`
Text string `json:"text"`
Cells []CellSnapshot `json:"cells,omitempty"`
}
RowSnapshot is one viewport row with optional per-cell detail.
type ScreenDiff ¶
type ScreenDiff struct {
Cursor *struct {
X int `json:"x"`
Y int `json:"y"`
} `json:"cursor,omitempty"`
Scroll *ScrollRegion `json:"scroll,omitempty"`
ChangedLines []LineChange `json:"changed_lines,omitempty"`
}
ScreenDiff captures incremental updates between two screen versions.
func DiffSnapshots ¶
func DiffSnapshots(before, after ScreenSnapshot) ScreenDiff
DiffSnapshots returns line-level changes between two line snapshots.
type ScreenSnapshot ¶
type ScreenSnapshot struct {
Cols int `json:"cols"`
Rows int `json:"rows"`
Cursor struct {
X int `json:"x"`
Y int `json:"y"`
} `json:"cursor"`
Lines []string `json:"lines"`
Alt bool `json:"alt_buffer"`
Scroll *ScrollRegion `json:"scroll,omitempty"`
Grid []RowSnapshot `json:"grid,omitempty"`
}
ScreenSnapshot is a JSON-serializable grid for the headless API (U3).
type ScrollRegion ¶
ScrollRegion describes the active terminal scroll margins.
type SnapshotOptions ¶
type SnapshotOptions struct {
IncludeCells bool
}
SnapshotOptions controls structured screen capture.
type TailLine ¶
TailLine is one non-empty row in tail output.
func RegionLines ¶
func RegionLines(snap ScreenSnapshot, y1, y2 int) []TailLine
RegionLines returns rows in [y1, y2] inclusive, clamped to the viewport.
func TailLines ¶
func TailLines(snap ScreenSnapshot, maxLines int) []TailLine
TailLines returns the last maxLines non-empty rows (bottom-up), preserving order.