@addai/node 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,10 @@ let idleTimer = null;
68
68
  let liveTimer = null;
69
69
  /** Set on every pong; cleared when a ping goes out. Two misses = dead. */
70
70
  let missedPongs = 0;
71
- /** desktopId -> the local TCP socket to that desktop's published RFB port. */
71
+ /** viewerId -> that viewer's OWN TCP socket to the desktop's RFB port.
72
+ * Keyed per viewer, not per desktop: RFB is a stateful 1:1 protocol, so two
73
+ * people watching the same screen each need their own connection and their
74
+ * own handshake. x11vnc runs with -shared precisely so it will serve them. */
72
75
  const bridges = new Map();
73
76
  function dropBridges() {
74
77
  for (const s of bridges.values()) {
@@ -155,24 +158,24 @@ async function connect() {
155
158
  tcp.on('data', chunk => {
156
159
  if (sock.readyState === ws_1.default.OPEN) {
157
160
  sock.send(JSON.stringify({
158
- type: 'data', desktopId: msg.desktopId, b64: chunk.toString('base64'),
161
+ type: 'data', viewerId: msg.viewerId, b64: chunk.toString('base64'),
159
162
  }));
160
163
  }
161
164
  });
162
- const forget = () => { bridges.delete(msg.desktopId); };
165
+ const forget = () => { bridges.delete(msg.viewerId); };
163
166
  tcp.on('close', forget);
164
167
  tcp.on('error', forget);
165
- bridges.get(msg.desktopId)?.destroy();
166
- bridges.set(msg.desktopId, tcp);
168
+ bridges.get(msg.viewerId)?.destroy();
169
+ bridges.set(msg.viewerId, tcp);
167
170
  return;
168
171
  }
169
172
  if (msg.type === 'data' && msg.b64) {
170
- bridges.get(msg.desktopId)?.write(Buffer.from(msg.b64, 'base64'));
173
+ bridges.get(msg.viewerId)?.write(Buffer.from(msg.b64, 'base64'));
171
174
  return;
172
175
  }
173
176
  if (msg.type === 'detach') {
174
- bridges.get(msg.desktopId)?.destroy();
175
- bridges.delete(msg.desktopId);
177
+ bridges.get(msg.viewerId)?.destroy();
178
+ bridges.delete(msg.viewerId);
176
179
  }
177
180
  });
178
181
  const retry = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addai/node",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
5
5
  "license": "MIT",
6
6
  "keywords": [