KetraTerm
API · DevelopmentAll versions

TerminalSession

constructor(terminal: TerminalBuffer, renderPublisher: TerminalRenderPublisher, renderReader: TerminalRenderFrameReader, responseReader: TerminalHostResponseReader, connector: TerminalConnector, parser: TerminalOutputParser, inputEncoderFactory: TerminalInputEncoderFactory? = null, hyperlinkResolver: TerminalHyperlinkResolver = TerminalHyperlinkResolver.NONE, hostCommandAdapter: HostCommandAdapter? = null, inputPolicy: TerminalInputPolicy = TerminalInputPolicy(), workerDispatcher: CoroutineDispatcher = Dispatchers.Default, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, shellIntegration: TerminalShellIntegrationFactory? = null)

Assembles a session around a caller-supplied parser and response reader. The caller owns the parser's host-event wiring, including accepted shell events if its selected producer interprets protocols. Use create for standard parser assembly and automatic dispatch to that producer. Host-owned models supplied through TerminalShellIntegrationFactory.host need no parser callbacks.

terminal, renderReader, responseReader, and parser must operate on the same core state; adapters around that state are permitted. The session owns their exclusive runtime access, finalizes parser EOF, and closes the connector. renderPublisher must have no other writer. inputEncoderFactory creates separate admission and streaming encoders bound to session-owned output. A supplied hostCommandAdapter must be the adapter used by parser; it receives session host-policy, theme-palette, and Backarrow-default changes. Custom parsers supplied without this adapter own their host-policy updates and Backarrow-default mode-report wiring. External image decoding requires both the adapter and a parser implementing TerminalGraphicsOutputParser. Otherwise the supplied sink owns decoding.

Parameters

terminal

exclusively owned mutable terminal state.

renderPublisher

exclusively owned cache publisher for this terminal.

renderReader

render projection of the same terminal state.

responseReader

response channel of the same terminal state.

connector

exclusively owned transport, closed with the session.

parser

exclusively owned parser wired to this terminal's sink.

inputEncoderFactory

independent admission/bulk encoder factory, or the built-in encoder when null.

hyperlinkResolver

resolver for the parser's hyperlink registry.

hostCommandAdapter

parser's adapter, or null for caller-owned policy wiring.

inputPolicy

initial input-encoding policy.

workerDispatcher

non-owned render, metadata and timeout dispatcher.

ioDispatcher

non-owned dispatcher for potentially blocking connector writes and providers.

shellIntegration

optional sole shell metadata producer.


constructor(terminal: TerminalBuffer, renderPublisher: TerminalRenderPublisher, renderReader: TerminalRenderFrameReader, responseReader: TerminalHostResponseReader, connector: TerminalConnector, parser: TerminalOutputParser, inputEncoderFactory: TerminalInputEncoderFactory? = null, hyperlinkResolver: TerminalHyperlinkResolver = TerminalHyperlinkResolver.NONE, hostCommandAdapter: HostCommandAdapter? = null, inputPolicy: TerminalInputPolicy = TerminalInputPolicy(), workerDispatcher: CoroutineDispatcher = Dispatchers.Default, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, shellIntegration: TerminalShellIntegrationFactory? = null, cleanupDispatcher: CoroutineDispatcher)

Assembles a session around a caller-supplied parser and response reader. The caller owns the parser's host-event wiring, including accepted shell events if its selected producer interprets protocols. Use create for standard parser assembly and automatic dispatch to that producer. Host-owned models supplied through TerminalShellIntegrationFactory.host need no parser callbacks.

terminal, renderReader, responseReader, and parser must operate on the same core state; adapters around that state are permitted. The session owns their exclusive runtime access, finalizes parser EOF, and closes the connector. renderPublisher must have no other writer. inputEncoderFactory creates separate admission and streaming encoders bound to session-owned output. A supplied hostCommandAdapter must be the adapter used by parser; it receives session host-policy, theme-palette, and Backarrow-default changes. Custom parsers supplied without this adapter own their host-policy updates and Backarrow-default mode-report wiring. External image decoding requires both the adapter and a parser implementing TerminalGraphicsOutputParser. Otherwise the supplied sink owns decoding.

Parameters

terminal

exclusively owned mutable terminal state.

renderPublisher

exclusively owned cache publisher for this terminal.

renderReader

render projection of the same terminal state.

responseReader

response channel of the same terminal state.

connector

exclusively owned transport, closed with the session.

parser

exclusively owned parser wired to this terminal's sink.

inputEncoderFactory

independent admission/bulk encoder factory, or the built-in encoder when null.

hyperlinkResolver

resolver for the parser's hyperlink registry.

hostCommandAdapter

parser's adapter, or null for caller-owned policy wiring.

inputPolicy

initial input-encoding policy.

workerDispatcher

non-owned render, metadata and timeout dispatcher.

ioDispatcher

non-owned dispatcher for potentially blocking connector writes and providers.

shellIntegration

optional sole shell metadata producer.

cleanupDispatcher

non-owned blocking cleanup dispatcher, independent of connector writes and off UI threads.