Skip to content

IHex1bTerminalWorkloadAdapter

Namespace: Hex1b

Assembly: Hex1b.dll

Terminal-side interface: What Hex1bTerminal needs from any workload. Raw byte streams for maximum flexibility.

csharp
public interface IHex1bTerminalWorkloadAdapter : IAsyncDisposable

Methods

ReadOutputAsync(CancellationToken)

Read output FROM the workload (ANSI sequences to display). The terminal calls this to get data to parse and send to presentation. Returns empty when workload has no more output (should be called in a loop).

Parameters:

Returns: ValueTask<Byte>>

csharp
ValueTask<ReadOnlyMemory<byte>> ReadOutputAsync(CancellationToken ct = default)

ResizeAsync(int, int, CancellationToken)

Notify workload of terminal resize.

Parameters:

Returns: ValueTask

csharp
ValueTask ResizeAsync(int width, int height, CancellationToken ct = default)

WriteInputAsync(ReadOnlyMemory<byte>, CancellationToken)

Write input TO the workload (raw bytes from keyboard/mouse). The terminal calls this when it receives input from the presentation layer.

Parameters:

Returns: ValueTask

csharp
ValueTask WriteInputAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

Events

Disconnected

Raised when workload has disconnected/exited.

Returns: Action

csharp
event Action? Disconnected

Remarks

This interface represents the "workload side" of the terminal - the process or application connected to the terminal. It deals with raw bytes only.

Data flow:

  • Terminal reads output FROM the workload (ANSI to display) - Terminal writes input TO the workload (keystrokes, mouse)

Implementations:

  • For Hex1bApp TUI applications - For testing with raw streams - For connecting to a remote terminal over WebSocketProcessWorkloadAdapter (future) - For PTY-connected processes

Released under the MIT License.