fix(agent): remote-control input now works (data channel + nut-js API)

Two latent bugs that broke input control on any setup:
- Data channel was created by the viewer (the answerer), so the agent's offer had
  no SCTP m-line and the channel never opened -> no input reached the agent. The
  agent (offerer) now creates the 'input' channel; the viewer receives it.
- inject.js used nut.screen.getResolution() which doesn't exist in this nut-js;
  switched to screen.width()/height() with per-session caching.

Verified end-to-end locally: screen streams + mouse injection moves the remote cursor.
Also commits desktop/ + mobile/ package-lock.json from client installs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 15:47:09 +05:30
parent 73b40a5d9f
commit 7a2ab3fc8d
5 changed files with 9060 additions and 10 deletions
+2 -1
View File
@@ -75,7 +75,8 @@ ws.onmessage = async (e) => {
function setupPeer() {
pc = new RTCPeerConnection({ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] });
inputChannel = pc.createDataChannel('input', { ordered: true });
// The agent (offerer) creates the 'input' channel; we receive it here and send input on it.
pc.ondatachannel = (ev) => { if (ev.channel.label === 'input') inputChannel = ev.channel; };
pc.ontrack = (ev) => {
video.srcObject = ev.streams[0];
setStatus(`Connected to ${machineName} — controlling. Click the screen to send input.`);