InteractiveShellController class
Pure Dart (no dart:io, no DOM), so the orchestration is identical and
unit-testable across the CLI, the browser, and any other embedder.
Constructors
-
InteractiveShellController({required ShellSessionPort session, required void onOutput(List<
int> output), required void onPrompt(ShellPromptState state), required void onPassthrough(bool active), void onStderr(List<int> bytes)?, void onExit(int code)?, bool resumedInAltScreen = false, bool interactive = true, CwdMarker? marker}) -
Creates a controller over
session.markerdefaults to one seeded from the session id (so a resumed session reuses the original completion token).
Properties
- ended → bool
-
Whether the session has ended.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- inFlight → bool
-
Whether a command currently owns the terminal (raw passthrough).
no setter
- onExit → void Function(int code)?
-
The session ended with the given exit code (or
-1if it closed uncleanly).final -
onOutput
→ void Function(List<
int> output) -
Marker-stripped remote stdout to render (markers removed). Raw stderr is
also routed here unless onStderr is provided.
final
- onPassthrough → void Function(bool active)
-
Passthrough toggled: while
truea program owns the terminal (the host should stop local line editing and relay raw bytes via sendRaw).final - onPrompt → void Function(ShellPromptState state)
-
The shell returned to its prompt; render a prompt from
state.final -
onStderr
→ void Function(List<
int> bytes)? -
Raw remote stderr, if the host wants it kept separate from onOutput
(e.g. the CLI writes it to its own stderr). When
null, stderr folds into onOutput.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shellFamily → ShellFamily
-
The remote shell family (for completion routing in the host).
no setter
Methods
-
close(
) → Future< void> - Terminates the session and stops driving it.
-
detach(
) → Future< void> - Detaches the session (keeps it alive on the node) and stops driving it.
-
dispose(
) → Future< void> - Stops driving the session without detaching or closing it (host unmount).
-
interrupt(
) → void - Sends an interrupt (Ctrl-C / SIGINT) to the remote process.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resize(
int cols, int rows) → void - Forwards a terminal resize to the remote PTY.
-
runAgentCommand(
String line) → Future< ShellRunResult> -
Runs
linein this (the user's current) interactive session and returns its captured output and exit code — used by the AI agent so its commands run in the real terminal shell (with a PTY, shared cwd/env and sudo credentials), streaming live and letting the user answer prompts. -
sendRaw(
List< int> bytes) → void -
Relays raw
bytesto the session — used by the host for passthrough input (every keystroke while a program owns the terminal). -
start(
) → void - Subscribes to the session and primes the first prompt. Idempotent.
-
submitLine(
String line) → void -
Submits a committed command
line(the host performed the line editing). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited