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).
- Kind:
Class - Namespace: Repl
- Assembly:
Repl.Defaults - Source: src/Repl.Defaults/StreamedReplHost.cs
Signature
Section titled “Signature”public sealed class StreamedReplHost : IReplSessionHost, IReplHost, IAsyncDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Constructors
Section titled “Constructors”StreamedReplHost(TextWriter, IWindowSizeProvider?)
Section titled “StreamedReplHost(TextWriter, IWindowSizeProvider?)”Initializes a new instance of the StreamedReplHost class.
public StreamedReplHost(TextWriter output, IWindowSizeProvider? windowSizeProvider = null)Parameters
Section titled “Parameters”output(TextWriter): Transport-provided output writer.windowSizeProvider(IWindowSizeProvider): Optional window size provider. Whennull, aDttermWindowSizeProvideris created automatically for DTTERM in-band VT detection.
Methods
Section titled “Methods”ApplyControlMessage(TerminalControlMessage)
Section titled “ApplyControlMessage(TerminalControlMessage)”Applies a parsed terminal control message to the current session metadata.
public void ApplyControlMessage(TerminalControlMessage message)Parameters
Section titled “Parameters”message(TerminalControlMessage)
Complete()
Section titled “Complete()”Signals that no more input will arrive (connection closed).
public void Complete()DisposeAsync()
Section titled “DisposeAsync()”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()Returns
Section titled “Returns”ValueTask - A task that represents the asynchronous dispose operation.
EnqueueInput(string)
Section titled “EnqueueInput(string)”Pushes a raw text chunk from the transport layer into the input reader.
public void EnqueueInput(string text)Parameters
Section titled “Parameters”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)Parameters
Section titled “Parameters”app(ReplApp): Configured REPL application.options(ReplRunOptions): Optional run options.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<int> - Execution exit code.
UpdateAnsiSupport(bool?)
Section titled “UpdateAnsiSupport(bool?)”Updates the known ANSI support for this session.
public void UpdateAnsiSupport(bool? ansiSupported)Parameters
Section titled “Parameters”ansiSupported(bool?)
UpdateTerminalCapabilities(TerminalCapabilities)
Section titled “UpdateTerminalCapabilities(TerminalCapabilities)”Updates the known terminal capability flags for this session.
public void UpdateTerminalCapabilities(TerminalCapabilities capabilities)Parameters
Section titled “Parameters”capabilities(TerminalCapabilities)
UpdateTerminalIdentity(string?)
Section titled “UpdateTerminalIdentity(string?)”Updates the known terminal identity for this session.
public void UpdateTerminalIdentity(string? terminalIdentity)Parameters
Section titled “Parameters”terminalIdentity(string)
UpdateWindowSize(int, int)
Section titled “UpdateWindowSize(int, int)”Updates the known terminal window size for this session.
public void UpdateWindowSize(int width, int height)Parameters
Section titled “Parameters”Properties
Section titled “Properties”Gets the host input reader.
public TextReader Input { get; }Returns
Section titled “Returns”Output
Section titled “Output”Gets the host output writer.
public TextWriter Output { get; }Returns
Section titled “Returns”RemotePeer
Section titled “RemotePeer”Gets or sets remote peer details for the active connection (for example “203.0.113.7:50124”).
public string? RemotePeer { get; set; }Returns
Section titled “Returns”SessionId
Section titled “SessionId”Gets the unique identifier of the host session.
public string SessionId { get; }Returns
Section titled “Returns”TerminalIdentityResolver
Section titled “TerminalIdentityResolver”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; }Returns
Section titled “Returns”Func<string>
TransportName
Section titled “TransportName”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; }