moo.shell.server.MooPromptToolkitSSHSession

class moo.shell.server.MooPromptToolkitSSHSession(*args, **kwargs)

SSH session that selects a shell mode from the client’s TERM and speaks the IAC subnegotiation channel on top of SSH for MUD clients.

For MUD clients (TERM = xterm-256-basic or a known MUD-client name), the channel switches its UTF-8 error policy to surrogateescape so 0xFF IAC bytes round-trip as \udcff surrogate code points: outbound IAC frames go out by decoding raw bytes through surrogateescape (the channel’s UTF-8 encoder re-emits them as the original bytes), and inbound 0xFF arrives as surrogate chars in data_received() which we re-encode for the IAC parser. The channel stays in str mode the whole time, so prompt_toolkit’s renderer, CPR detection, and Stdout pipeline work unchanged. Vanilla SSH terminals leave the channel in strict UTF-8 and never see an IAC byte.

See Inside the Shell Client § “The Three Modes” for the full mapping.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

break_received(msec)

The client has sent a break

connection_lost(exc)

Called when a channel is closed

connection_made(chan)

Called when a channel is opened successfully

data_received(data, datatype)

Called when data is received on the channel

eof_received()

Called when EOF is received on the channel

exec_requested(command)

The client has requested to execute a command

pause_writing()

Called when the write buffer becomes full

pty_requested(term_type, term_size, term_modes)

A pseudo-terminal has been requested

resume_writing()

Called when the write buffer has sufficiently drained

session_started()

Called when the session is started

shell_requested()

The client has requested a shell

signal_received(signal)

The client has sent a signal

soft_eof_received()

The client has sent a soft EOF

subsystem_requested(subsystem)

The client has requested to start a subsystem

terminal_size_changed(width, height, ...)

The terminal size has changed

Attributes

iac_enabled

mode

site

user