libvt.recorder¶
Terminal input/resize recorder protocol and bounded diagnostic ring buffer.
-
class libvt.recorder.CompositeRecorder¶class libvt.recorder.CompositeRecorder¶
Bases:
objectFan-out
TerminalRecorderdispatching to multiple child recorders.Flattens nested
CompositeRecorderinstances at construction so hot-path dispatch remains a single flat tuple loop andfind_flight_recorder()inspects every member inO(k).
-
class libvt.recorder.FlightRecorder¶class libvt.recorder.FlightRecorder¶
Bases:
objectBounded raw-byte ring buffer capturing recent VT traffic for diagnostics.
Implements
TerminalRecorderso it can be attached directly toTerminalviarecorder=FlightRecorder().Examples
>>> from libvt.recorder import FlightRecorder >>> from libvt.terminal import Terminal >>> rec = FlightRecorder(max_bytes=128) >>> term = Terminal(rows=2, cols=10, recorder=rec) >>> term.feed(b"\x1b[1;32mREADY\x1b[0m") >>> rec.total_bytes, rec.tail() (16, b'\x1b[1;32mREADY\x1b[0m')
-
class libvt.recorder.TerminalRecorder¶class libvt.recorder.TerminalRecorder¶
Bases:
ProtocolStructural recorder hook receiving normalized bytes and host resizes.
Implementations receive every non-empty byte span fed into
feed()orfeed_until()as a contiguous 1-D unsigned bytememoryview, plus every explicit host-initiatedresize()(excluding internalDECCOLMcolumn switches already present in the recorded VT stream).Recorders that retain input beyond
on_feed()must copy bytes (for examplebytes(data)) before returning because callers may reuse or mutate the underlying buffer afterfeed()completes.
-
libvt.recorder.find_flight_recorder(recorder)¶libvt.recorder.find_flight_recorder(recorder)¶
Return the first
FlightRecorderin recorder, unwrapping composites.- Parameters:
recorder (
TerminalRecorder|None)- Return type: