Power & console
Control the running state of a server and stream its console.
Power signals
POST /v1/servers/:id/power with a signal of start, stop, restart or kill.
tsawait cloud.servers.power(id, "restart");
Live resource usage
GET /v1/servers/:id/resources returns the panel's live CPU, memory, disk and network counters plus the current power state.
tsconst usage = await cloud.servers.resources(id); // usage.attributes.current_state === "running" | "offline" | ...
Sending commands
POST /v1/servers/:id/command writes a line to the server's console.
tsawait cloud.servers.command(id, "say Server restarting in 5 minutes");
Streaming the console
For a live terminal, fetch short-lived websocket credentials and connect from the browser:
tsconst { websocket } = await cloud.servers.console(id); // { token, socket } — connect with the Wings websocket protocol const ws = new WebSocket(websocket.socket); ws.onopen = () => ws.send(JSON.stringify({ event: "auth", args: [websocket.token] })); ws.onmessage = (e) => console.log(JSON.parse(e.data));
Credentials are short-lived; request fresh ones when a socket closes. This is the same mechanism the dashboard console uses.