Skip to content

StreamedReplHost

Generic session-layer host (L5) that is transport-agnostic. The transport provides a TextWriter for output and pushes raw text through EnqueueInput(string). This host handles the session lifecycle including optional VT probing and delegates to RunAsync(string[], IReplHost, ReplRunOptions, CancellationToken).

public sealed class StreamedReplHost : IReplSessionHost, IReplHost, IAsyncDisposable

StreamedReplHost(TextWriter, IWindowSizeProvider?)

Section titled “StreamedReplHost(TextWriter, IWindowSizeProvider?)”

Initializes a new instance of the StreamedReplHost class.

public StreamedReplHost(TextWriter output, IWindowSizeProvider? windowSizeProvider = null)
  • output (TextWriter): Transport-provided output writer.
  • windowSizeProvider (IWindowSizeProvider): Optional window size provider. When null, a DttermWindowSizeProvider is created automatically for DTTERM in-band VT detection.

ApplyControlMessage(TerminalControlMessage)

Section titled “ApplyControlMessage(TerminalControlMessage)”

Applies a parsed terminal control message to the current session metadata.

public void ApplyControlMessage(TerminalControlMessage message)

Signals that no more input will arrive (connection closed).

public void Complete()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

ValueTask - A task that represents the asynchronous dispose operation.

Pushes a raw text chunk from the transport layer into the input reader.

public void EnqueueInput(string text)
  • text (string): Text chunk to enqueue.

RunSessionAsync(ReplApp, ReplRunOptions?, CancellationToken)

Section titled “RunSessionAsync(ReplApp, ReplRunOptions?, CancellationToken)”

Runs a full REPL session including optional VT probe detection.

public ValueTask<int> RunSessionAsync(ReplApp app, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int> - Execution exit code.

Updates the known ANSI support for this session.

public void UpdateAnsiSupport(bool? ansiSupported)
  • ansiSupported (bool?)

UpdateTerminalCapabilities(TerminalCapabilities)

Section titled “UpdateTerminalCapabilities(TerminalCapabilities)”

Updates the known terminal capability flags for this session.

public void UpdateTerminalCapabilities(TerminalCapabilities capabilities)

Updates the known terminal identity for this session.

public void UpdateTerminalIdentity(string? terminalIdentity)

Updates the known terminal window size for this session.

public void UpdateWindowSize(int width, int height)

Gets the host input reader.

public TextReader Input { get; }

TextReader

Gets the host output writer.

public TextWriter Output { get; }

TextWriter

Gets or sets remote peer details for the active connection (for example “203.0.113.7:50124”).

public string? RemotePeer { get; set; }

string

Gets the unique identifier of the host session.

public string SessionId { get; }

string

Gets or sets a deferred resolver for the terminal identity (e.g. “xterm-256color”). Called after the initial detection phase when terminal-type negotiation (e.g. Telnet TERMINAL-TYPE) is expected to have completed.

public Func<string?>? TerminalIdentityResolver { get; set; }

Func<string>

Gets or sets the transport name (e.g. “websocket”, “telnet”, “signalr”). Set this before calling RunSessionAsync(ReplApp, ReplRunOptions, CancellationToken) to make it available via TransportName.

public string? TransportName { get; set; }

string