@a-t-h-i/bot-lobby 0.6.10 → 0.6.11

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": "@a-t-h-i/bot-lobby",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "Structured multi-agent software engineering orchestrator for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { HttpsProxyAgent } from "https-proxy-agent";
15
15
  import { io, type Socket } from "socket.io-client";
16
- import { DEFAULT_SERVER, seal, unseal, type RoomLink } from "./room.ts";
16
+ import { DEFAULT_ORIGIN, DEFAULT_SERVER, seal, unseal, type RoomLink } from "./room.ts";
17
17
  import { describeScene, mergeElements, plainText, planDraw, sceneBounds, visible, type DrawOutcome, type DrawRequest, type Scene, type SceneElement } from "./scene.ts";
18
18
 
19
19
  /** The part of a socket.io client a seat uses; tests and other transports can stand in for it. */
@@ -56,7 +56,16 @@ function defaultConnect(server: string): SocketLike {
56
56
  // Where a network lets plain HTTPS through but not a websocket, the seat falls back to long-polling, as a browser does.
57
57
  // socket.io types `agent` for browsers (string | boolean); in Node it is passed on to the http and ws requests as an http.Agent.
58
58
  const agent = proxy ? { agent: new HttpsProxyAgent(proxy) as unknown as string } : {};
59
- return io(server, { transports: ["websocket", "polling"], tryAllTransports: true, autoUnref: true, timeout: 8000, ...agent });
59
+ // Excalidraw's collaboration server refuses handshakes whose Origin is not on its allowlist, so a seat presents the site a browser would come from.
60
+ let site = DEFAULT_ORIGIN;
61
+ if (server !== DEFAULT_SERVER) {
62
+ try {
63
+ site = new URL(server).origin;
64
+ } catch {
65
+ /* fall back to DEFAULT_ORIGIN */
66
+ }
67
+ }
68
+ return io(server, { transports: ["websocket", "polling"], tryAllTransports: true, autoUnref: true, timeout: 8000, extraHeaders: { Origin: site }, ...agent });
60
69
  }
61
70
 
62
71
  /**