@alfe.ai/remote
v0.2.0
Published
Runtime-agnostic transport for the Alfe interactive remote-control relay — multiplexes browser screencast and terminal PTY surfaces over one outbound WebSocket
Readme
@alfe.ai/remote
Shared transport and frame codec for Alfe's interactive browser and terminal relay. The package provides:
RemoteServiceClient, one outbound authenticated WebSocket per agent;- the five-byte multiplexed binary frame codec and direction helpers;
- bounded runtime decoders for relay control payloads;
SurfaceHandlerandTurnControllercontracts used by the browser and terminal packages.
Client usage
import { RemoteServiceClient } from "@alfe.ai/remote";
const client = new RemoteServiceClient({
wsUrl: "wss://remote.dev.alfe.ai/ws",
apiKey: process.env.ALFE_API_KEY!,
onFrame: (frame) => routeFrame(frame),
});
client.start();The relay URL is an authentication boundary because the API key is sent in the WebSocket upgrade. Production callers must derive or authorize the exact relay host from trusted Alfe configuration. The client requires WSS, permits plain WS only for loopback development, rejects URL userinfo/fragments, and redacts query parameters from logs.
Inbound and outbound frames are capped at 10 MiB. Control JSON is capped at
64 KiB. Use the exported shape-specific decoders instead of casting
decodeJson() results at a surface boundary.
See Alfe and the documentation.
