Architecture#
tabby-aws-ssm-ssh is an Angular-based Tabby plugin, written in
TypeScript. It uses @aws-sdk/client-ssm to start SSM sessions and a raw
WebSocket (ws) to speak the SSM Agent’s binary data-channel protocol,
optionally wrapping that channel with an ssh2 client for the
SSH-over-SSM mode.
The source tree has six files under src/, each centered on one core
symbol:
File |
Responsibility |
|---|---|
|
Plugin entry point — an Angular |
|
Defines the |
|
The connection settings UI (region, instance ID, credential options, etc. — see Usage). |
|
The terminal tab UI; creates and owns a |
|
Session orchestration — calls the AWS SSM |
|
Implements the SSM Agent’s binary WebSocket data-channel protocol as
a Node.js |
Component relationships#
TunnelSshModule (index.ts)
|
+-- registers --> AwsSsmSshProfileProvider (profiles.ts)
| |-- settingsComponent --> AwsSsmSshSettingsComponent
| `-- getNewTabParameters() --> TunnelSshTabComponent
|
+-- declares --> TunnelSshTabComponent (tunnelSshTab.component.ts)
| `-- initializeSession() --> new TunnelSshSession(...)
| (session/tunnelSsh.session.ts)
|
`-- declares --> AwsSsmSshSettingsComponent
TunnelSshSession
`-- createAwsSsmTunnel() --> new AwsSsmTunnelStream(...) (tunnel/awsSsm.tunnel.ts)
`-- Duplex stream <--> ssh2 client (SSH-over-SSM mode)
Key classes#
AwsSsmSshProfileProvider(src/profiles.ts)Extends Tabby’s
ProfileProvider<AwsSsmSshProfile>. Registers the profile type under idaws-ssm-ssh/ display nameAWS SSM SSH, supplies built-in profile templates viagetBuiltinProfiles(), points new tabs atTunnelSshTabComponentviagetNewTabParameters(), and formats the profile’s short description ("instanceId (region)") viagetDescription().TunnelSshTabComponent(src/components/tunnelSshTab.component.ts)Extends Tabby’s
ConnectableTerminalTabComponent<AwsSsmSshProfile>. On initialization it builds aTunnelSshSessionfor the active profile and attaches it to the tab viasetSession().TunnelSshSession(src/session/tunnelSsh.session.ts)The core orchestrator.
start()kicks off the session; internally,createAwsSsmTunnel()calls the AWS SSMStartSessionCommandand feeds the resulting stream URL/token into a newAwsSsmTunnelStream. For SSH-over-SSM profiles, that tunnel stream is piped into anssh2client instead of being treated as a raw shell. Exposes the usual terminal-tab lifecycle methods:write(),resize(),kill(),gracefullyKillProcess(),destroy().AwsSsmTunnelStream(src/tunnel/awsSsm.tunnel.ts)A Node.js
Duplexstream wrapping a WebSocket connection to the SSM data channel. Implements the SSM Agent’s binary framing directly:encodeMessage()/decodeMessage()handle theAgentMessageframe format (message type, message ID, sequence number, flags, payload type, payload),generateUuidBytes()/parseUuid()handle the per-message UUIDs, andsendAck()emits the ACK frames the protocol requires._read()/_write()/_destroy()implement the Duplex stream contract so the rest of the plugin can treat the tunnel like any other Node stream.
End-to-end flow#
AwsSsmSshProfileProviderregisters the profile type and its settings UI with Tabby.The user opens a tab for a saved profile;
TunnelSshTabComponentcreates aTunnelSshSession.TunnelSshSessioncalls the AWS SSMStartSessionAPI, obtaining a WebSocket stream URL and token.Those are handed to
AwsSsmTunnelStream, which opens the WebSocket and speaks the SSM binary protocol, exposing itself as a NodeDuplexstream.In AWS SSM Session mode, that Duplex stream is the terminal session. In SSH over SSM mode, the Duplex stream is instead piped into an
ssh2client, which performs the SSH handshake and authentication over the tunnel, and the resulting SSH channel becomes the terminal session.