ClientRuntime class
An embeddable OmnyShell client: authenticates with the Hub, discovers nodes, and opens exec / interactive sessions.
final client = OmnyShellClient(config);
await client.connect();
final result = await client.execute(nodeId: 'web-01', command: 'uname -a');
Constructors
- ClientRuntime(ClientConfig config)
-
Creates a client runtime from
config.
Properties
- config → ClientConfig
-
The client configuration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Whether the client is connected and authenticated.
no setter
- principal → Principal?
-
The authenticated principal (available after connect).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Disconnects from the Hub and releases resources.
-
connect(
) → Future< void> - Connects to the Hub and authenticates.
-
detachActiveSession(
{required String nodeId, String sessionRef = '', Duration? timeout}) → Future< ActiveSessionDetachResult> -
Detaches one of the caller's active sessions on
nodeIdfrom this connection — used to leave a session whose terminal is busy with a full-screen program.sessionRefis a full id, short handle or prefix; leave it empty to detach the sole active session. The attached client is disconnected by the node. -
execute(
{required String nodeId, required String command, List< String> args = const [], Map<String, String> env = const {}, String? cwd}) → Future<ExecResult> -
Runs
commandto completion onnodeId, capturing its output. -
killDetachedSession(
{required String nodeId, required String sessionRef}) → Future< DetachedSessionKillResult> - Deprecated alias for killSession (which now also terminates running sessions, not just detached ones).
-
killSession(
{required String nodeId, required String sessionRef}) → Future< DetachedSessionKillResult> -
Terminates one of the caller's sessions on
nodeId— running (attached) or detached — named bysessionRef(a full id, short handle, or unambiguous prefix). Killing a running session disconnects its attached client; the node enforces that the caller owns the session. -
listDetachedSessions(
{required String nodeId}) → Future< List< DetachedSessionInfo> > -
Lists only the caller's detached sessions on
nodeId. -
listNodes(
{Map< String, String> filter = const {}}) → Future<List< NodeDescriptor> > -
Lists the nodes visible to this client, with an optional label
filter. -
listSessions(
{required String nodeId}) → Future< List< DetachedSessionInfo> > -
Lists the caller's sessions on
nodeId— both active (attached) and detached. The node filters by owner, so only the authenticated user's sessions are returned. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openSession(
{required String nodeId, SessionMode mode = SessionMode.exec, String? command, List< String> args = const [], Map<String, String> env = const {}, String? cwd, PtySpec? pty, String? resumeSessionId}) → Future<RemoteSession> -
Opens a session on
nodeId. -
peekSession(
{required String nodeId, required String sessionRef}) → Future< SessionScreenResult> -
Fetches the current screen snapshot of one of the caller's sessions on
nodeId— running (attached) or detached — named bysessionRef(a full id, short handle, or unambiguous prefix), without attaching to it. The returned bytes are exactly what a resume would paint; no input is ever delivered to the session. The node enforces that the caller owns it. -
ping(
) → Future< Duration> - Measures round-trip latency to the Hub.
-
resumeSession(
{required String nodeId, required String sessionId, PtySpec? pty}) → Future< RemoteSession> -
Resumes a previously detached interactive session on
nodeId, identified bysessionId(a full id, short handle, or unambiguous prefix). The returned session continues exactly where it was detached; the node enforces that the caller owns it. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited