@jsvision/core / HostOptions
Interface: HostOptions
Defined in: host/types.ts:28
Options for createHost. Only caps is required; every OS-touching input is injectable, so the same host can be driven against real streams or fakes in tests.
Properties
adaptAmbiguousWidth?
readonlyoptionaladaptAmbiguousWidth?:boolean
Defined in: host/types.ts:74
Automatically switch to ASCII-safe chrome when the startup width probe finds that box/scroll glyphs render two cells wide: wide arrows turn on the ambiguousWide glyph flag, wide box/shade glyphs turn boxDrawing/halfBlocks off — so every frame stays aligned instead of shearing. Downgrade-only; the original caps are still used for input decoding, mode setup, and restore. Real TTY only, and it shares the single probe run with warnAmbiguousWidth. Default false (the higher-level app runner turns this on).
caps
readonlycaps:CapabilityProfile
Defined in: host/types.ts:30
The detected capability profile; gates every terminal mode the host enables.
env?
readonlyoptionalenv?:ProcessEnv
Defined in: host/types.ts:81
Environment to read the JSVISION_ASCII force switch from (NO_COLOR-style: its mere presence, with any value, turns it on). When set, the host renders fully ASCII-safe chrome and skips the width probe entirely. Default process.env. Presence-checked only — the value is never parsed or logged.
exitOnSignal?
readonlyoptionalexitOnSignal?:boolean
Defined in: host/types.ts:48
When false, terminating signals restore the terminal but do not call process.exit. Default true.
focus?
readonlyoptionalfocus?:boolean
Defined in: host/types.ts:54
Enable focus reporting (the terminal reports when it gains/loses focus). No capability models this, so it is a host policy rather than caps-gated. Default true.
input?
readonlyoptionalinput?:ReadStream
Defined in: host/types.ts:32
Input stream to read from. Default: process.stdin (or /dev/tty when stdout is piped).
onBeforeExit?
readonlyoptionalonBeforeExit?: (code) =>void
Defined in: host/types.ts:46
Runs just before the host calls process.exit on a signal or crash path (receives the exit code).
Parameters
code
number
Returns
void
onInput?
readonlyoptionalonInput?: (event) =>void
Defined in: host/types.ts:38
Called with each decoded input event. Terminal query replies are handled internally and never delivered here.
Parameters
event
Returns
void
onResize?
readonlyoptionalonResize?: (event) =>void
Defined in: host/types.ts:40
Called with a terminal resize, coalesced so a burst of SIGWINCH yields a single event.
Parameters
event
Returns
void
onResume?
readonlyoptionalonResume?: () =>void
Defined in: host/types.ts:44
POSIX resume (SIGCONT): fired after modes are re-asserted and the last frame is repainted.
Returns
void
onSuspend?
readonlyoptionalonSuspend?: () =>void
Defined in: host/types.ts:42
POSIX Ctrl+Z (SIGTSTP): fired just before the terminal is restored and the process suspends.
Returns
void
onWidthWarning?
readonlyoptionalonWidthWarning?: (message) =>void
Defined in: host/types.ts:87
Where the startup width warning goes (see warnAmbiguousWidth). Default: one line to process.stderr (never the terminal's output stream). Provide your own to route it into a logger or custom reporting.
Parameters
message
string
Returns
void
output?
readonlyoptionaloutput?:WriteStream
Defined in: host/types.ts:34
Output stream to render to. Default: process.stdout (or /dev/tty when piped).
preferDevTty?
readonlyoptionalpreferDevTty?:boolean
Defined in: host/types.ts:36
When true (default) and stdout is piped but a controlling terminal exists, bind to /dev/tty.
runtime?
readonlyoptionalruntime?:RuntimeAdapter
Defined in: host/types.ts:89
The OS boundary the host runs against. Defaults to the real Node runtime; inject a fake to test headlessly.
warnAmbiguousWidth?
readonlyoptionalwarnAmbiguousWidth?:boolean
Defined in: host/types.ts:64
Probe the terminal at startup for double-width chrome glyphs — East-Asian Ambiguous code points (e.g. ▲◄■▒) that a font fallback or CJK locale renders two cells wide, shifting box/scroll chrome — and warn via onWidthWarning when found. Real TTY only; runs after raw mode and before the alternate screen, so the probe and its erase stay off your UI. Default false (the higher-level app runner turns this on). Detection is best-effort — a silent or non-TTY terminal never warns.