OmnyShellService class
A thin facade over the OmnyShell ClientRuntime that the UI talks to.
It owns the connected client, normalizes Hub URLs, and translates raw
OmnyShell exceptions into AppErrors. Business logic (handshake, node
discovery, session lifecycle) stays in ClientRuntime — this layer only
adapts it to the web app.
Constructors
- OmnyShellService({ConnectionFactory? connectionFactory})
-
Creates a service. Provide
connectionFactoryin tests to bypass a real WebSocket.
Properties
- client → ClientRuntime
-
The underlying client (available after connect); used by later
milestones for node/session calls.
no setter
- connectionFactory → ConnectionFactory?
-
Optional transport override. Production leaves this
null(the browser WebSocket default); tests inject a fake hub connection.final - hashCode → int
-
The hash code for this object.
no setterinherited
- hubUri → Uri?
-
The Hub URI of the active connection, or
null.no setter - isConnected → bool
-
Whether a client is connected and authenticated.
no setter
- onConnectionLost ↔ void Function()?
-
Called when the Hub connection drops unexpectedly (not via disconnect).
getter/setter pair
- principal → Principal?
-
The authenticated principal, or
nullwhen signed out.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
{required String hubUri, required String principal, required String token}) → Future< Principal> -
Connects to
hubUriand authenticates asprincipalwithtoken. -
detachSession(
String nodeId, {String sessionRef = ''}) → Future< ActiveSessionDetachResult> -
Detaches the caller's active session
sessionRefonnodeId(emptysessionReftargets the sole active session). -
disconnect(
) → Future< void> - Disconnects and clears all in-memory connection state.
-
fetchHubAiConfig(
) → Future< HubAiConfig> - Fetches the Hub's default AI configuration (provider/model, never a key).
-
killSession(
String nodeId, String sessionRef) → Future< DetachedSessionKillResult> -
Terminates the caller's session
sessionRefonnodeId. -
listNodes(
{Map< String, String> filter = const {}}) → Future<List< NodeDescriptor> > - Lists the nodes visible to the authenticated principal.
-
listSessions(
String nodeId) → Future< List< DetachedSessionInfo> > -
Lists the caller's sessions (active + detached) on
nodeId. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openShell(
{required String nodeId, required int cols, required int rows}) → Future< RemoteSession> -
Opens a fresh interactive shell on
nodeIdsizedcols×rows. -
peekSession(
String nodeId, String sessionRef) → Future< SessionScreenResult> -
Captures the current screen of session
sessionRefonnodeIdwithout attaching to it. -
ping(
) → Future< Duration> - Measures round-trip latency to the Hub.
-
resumeSession(
{required String nodeId, required String sessionRef, required int cols, required int rows}) → Future< RemoteSession> -
Resumes the detached session
sessionRefonnodeIdatcols×rows. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
normalizeHubUri(
String input) → Uri -
Normalizes a user-entered Hub address into a
wss://Uri.