Everything a command may need that is not its argument.
Two things here are easy to confuse and worth separating. repl is the TERMINAL: the prompt, its
colours, the directory it resolves paths against, what it can write. repl.session is the PAGE:
a live Chrome tab this process drives over CDP, which is where values actually live and where a
debugger statement actually stops. A command reads the terminal from repl and asks the page
through repl.session; neither reaches into the other.
One object rather than a parameter list because commands need wildly different subsets of it,
and a positional list would make every one of them declare the parts it ignores. buffered and
scratch are mutable ON PURPOSE — they are the session's own state, and the commands that move
them (.break, .open) are the reason it has to outlive a single call.
server: REPLServer
The node:repl server, for the few commands that need readline itself.
The live page — where values are, and where a debugger stops.
The resolved run config this session was opened on.
cwd: string
The directory relative paths are resolved against.
interactive: boolean
False on a pipe — no terminal to hand to an editor, and nothing to redraw.
width: number
How wide the terminal is, for anything laid out in columns. 80 where nothing says.
The cached front of ReplSession.completions — what TAB and the ghost suggestion read.
Named for its type rather than for what it feeds, because repl.completions beside
repl.session.completions() put two different things one word apart: this one answers from a
cache and never blocks, that one asks the page.
lines: readonly string[]
Every line this session has evaluated, oldest first — what .save writes out.
buffered: string
The unfinished input so far, '' when the line is whole. .break abandons it.
scratch: string
The scratch buffer .open keeps for the life of the session.
The HTTP client's state: headers saved for the next request, and every request made.
Session-lived for the same reason ReplContext.scratch is — .header accept=… and the
.get three lines later are different commands, and the second one remembering the first is
the entire point of saving it.