herdr-remote-relay 0.3.6 → 0.3.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-remote-relay",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Standalone relay server and web terminal for Herdr Remote",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,6 +27,9 @@ const MAX_DIMENSION = 500;
27
27
  const MIN_SESSION_COLS = 20;
28
28
  const MIN_SESSION_ROWS = 6;
29
29
 
30
+ /** A window asks to start its workstation's Herdr at most this often. */
31
+ const HERDR_START_REPEAT_MS = 3_000;
32
+
30
33
  /** Matches the host's own cap; the relay re-applies it rather than trusting it. */
31
34
  const MAX_AGENT_STATUS_ENTRIES = 16;
32
35
 
@@ -1170,6 +1173,22 @@ class RelayServer {
1170
1173
  });
1171
1174
  }
1172
1175
  }
1176
+ } else if (message.type === 'herdr_start') {
1177
+ // The window's own workstation, and nobody else's: `host` was fixed by
1178
+ // the device token at handshake, and nothing in this message can name
1179
+ // another one. The host starts Herdr as its own user, at its own socket.
1180
+ // Repeats are dropped — one click is enough, and the host shares a
1181
+ // start between windows anyway.
1182
+ if (!client.session) {
1183
+ jsonSend(client.ws, { type: 'error', code: 'no_session', message: 'terminal session is not ready' });
1184
+ return;
1185
+ }
1186
+ const now = Date.now();
1187
+ if (client.herdrStartAt && now - client.herdrStartAt < HERDR_START_REPEAT_MS) return;
1188
+ client.herdrStartAt = now;
1189
+ if (isOpen(host.ws)) {
1190
+ jsonSend(host.ws, { type: 'herdr_start', clientId: client.session.streamId, streamId: client.session.streamId });
1191
+ }
1173
1192
  } else if (message.type === 'claim_control') {
1174
1193
  // Control is no longer a lease. Answering the old request keeps clients
1175
1194
  // built against the previous protocol working.