agent-comms 2.0.1 → 2.1.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/bridges/user/web/build.js +0 -11
- package/dist/bridges/user/web/build.js.map +1 -1
- package/dist/bridges/user/web/dist/bundle.js +2 -2
- package/dist/bridges/user/web/frontend/components/App.d.ts +0 -4
- package/dist/bridges/user/web/frontend/components/App.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/components/App.js +1 -1
- package/dist/bridges/user/web/frontend/components/App.js.map +1 -1
- package/dist/bridges/user/web/frontend/components/Sidebar.d.ts +1 -5
- package/dist/bridges/user/web/frontend/components/Sidebar.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/components/Sidebar.js +2 -3
- package/dist/bridges/user/web/frontend/components/Sidebar.js.map +1 -1
- package/dist/bridges/user/web/frontend/main.js +2 -16
- package/dist/bridges/user/web/frontend/main.js.map +1 -1
- package/dist/core/bridge.d.ts +3 -3
- package/dist/core/bridge.d.ts.map +1 -1
- package/dist/core/bridge.js +11 -9
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +9 -4
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/room-path.d.ts +20 -0
- package/dist/core/room-path.d.ts.map +1 -0
- package/dist/core/room-path.js +60 -0
- package/dist/core/room-path.js.map +1 -0
- package/dist/core/wire-protocol.d.ts +2 -10
- package/dist/core/wire-protocol.d.ts.map +1 -1
- package/dist/core/wire-protocol.js +1 -12
- package/dist/core/wire-protocol.js.map +1 -1
- package/dist/test/create-room-name-sanitisation.test.d.ts +5 -0
- package/dist/test/create-room-name-sanitisation.test.d.ts.map +1 -0
- package/dist/test/create-room-name-sanitisation.test.js +52 -0
- package/dist/test/create-room-name-sanitisation.test.js.map +1 -0
- package/dist/test/downtime-replay.integration.test.js +6 -4
- package/dist/test/downtime-replay.integration.test.js.map +1 -1
- package/dist/test/downtime-replay.test.js +10 -6
- package/dist/test/downtime-replay.test.js.map +1 -1
- package/dist/test/federation.integration.test.js +4 -1
- package/dist/test/federation.integration.test.js.map +1 -1
- package/dist/test/identity-restart.integration.test.js +3 -2
- package/dist/test/identity-restart.integration.test.js.map +1 -1
- package/dist/test/room-path.test.d.ts +2 -0
- package/dist/test/room-path.test.d.ts.map +1 -0
- package/dist/test/room-path.test.js +54 -0
- package/dist/test/room-path.test.js.map +1 -0
- package/dist/test/state-sync-convergence.test.js +30 -29
- package/dist/test/state-sync-convergence.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/bridges/user/web/dist/relay-worker.js +0 -1
- package/dist/bridges/user/web/frontend/components/RelayPanel.d.ts +0 -15
- package/dist/bridges/user/web/frontend/components/RelayPanel.d.ts.map +0 -1
- package/dist/bridges/user/web/frontend/components/RelayPanel.js +0 -46
- package/dist/bridges/user/web/frontend/components/RelayPanel.js.map +0 -1
- package/dist/bridges/user/web/frontend/relay-client.d.ts +0 -40
- package/dist/bridges/user/web/frontend/relay-client.d.ts.map +0 -1
- package/dist/bridges/user/web/frontend/relay-client.js +0 -97
- package/dist/bridges/user/web/frontend/relay-client.js.map +0 -1
- package/dist/bridges/user/web/frontend/relay-worker.d.ts +0 -15
- package/dist/bridges/user/web/frontend/relay-worker.d.ts.map +0 -1
- package/dist/bridges/user/web/frontend/relay-worker.js +0 -379
- package/dist/bridges/user/web/frontend/relay-worker.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelayPanel — UI for configuring the PWA mesh relay.
|
|
3
|
-
*
|
|
4
|
-
* Provides input fields for two mesh WebSocket URLs, connect/disconnect
|
|
5
|
-
* controls, and a live status display showing connection state and
|
|
6
|
-
* forwarding statistics.
|
|
7
|
-
*/
|
|
8
|
-
import type { RelayStatus } from "../relay-client.js";
|
|
9
|
-
export interface RelayPanelProps {
|
|
10
|
-
status: RelayStatus;
|
|
11
|
-
onConnect: (urlA: string, urlB: string) => void;
|
|
12
|
-
onDisconnect: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function RelayPanel({ status, onConnect, onDisconnect, }: RelayPanelProps): import("preact").JSX.Element;
|
|
15
|
-
//# sourceMappingURL=RelayPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RelayPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/RelayPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,SAAS,EACT,YAAY,GACb,EAAE,eAAe,gCAiJjB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* RelayPanel — UI for configuring the PWA mesh relay.
|
|
4
|
-
*
|
|
5
|
-
* Provides input fields for two mesh WebSocket URLs, connect/disconnect
|
|
6
|
-
* controls, and a live status display showing connection state and
|
|
7
|
-
* forwarding statistics.
|
|
8
|
-
*/
|
|
9
|
-
import { useState, useEffect } from "preact/hooks";
|
|
10
|
-
export function RelayPanel({ status, onConnect, onDisconnect, }) {
|
|
11
|
-
const [urlA, setUrlA] = useState(status.urlA ?? "ws://localhost:8080/ws/mesh");
|
|
12
|
-
const [urlB, setUrlB] = useState(status.urlB ?? "ws://localhost:8081/ws/mesh");
|
|
13
|
-
const [expanded, setExpanded] = useState(false);
|
|
14
|
-
const bothConnected = status.connectedA && status.connectedB;
|
|
15
|
-
const eitherConnected = status.connectedA || status.connectedB;
|
|
16
|
-
// Sync URL fields when the relay reports new URLs (e.g. after reconnect)
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (status.urlA)
|
|
19
|
-
setUrlA(status.urlA);
|
|
20
|
-
if (status.urlB)
|
|
21
|
-
setUrlB(status.urlB);
|
|
22
|
-
}, [status.urlA, status.urlB]);
|
|
23
|
-
if (!expanded) {
|
|
24
|
-
return (_jsx("div", { class: "relay-panel relay-collapsed", children: _jsxs("button", { class: "relay-toggle-btn", onClick: () => {
|
|
25
|
-
setExpanded(true);
|
|
26
|
-
}, children: ["\u293A Relay", bothConnected && (_jsx("span", { class: "relay-badge relay-badge-green", children: "\u25CF" })), eitherConnected && !bothConnected && (_jsx("span", { class: "relay-badge relay-badge-yellow", children: "\u25CF" })), status.forwardedCount > 0 && (_jsx("span", { class: "relay-count", children: status.forwardedCount }))] }) }));
|
|
27
|
-
}
|
|
28
|
-
const handleConnect = (e) => {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
if (urlA.trim() && urlB.trim()) {
|
|
31
|
-
onConnect(urlA.trim(), urlB.trim());
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return (_jsxs("div", { class: "relay-panel", children: [_jsxs("div", { class: "relay-header", children: [_jsx("span", { class: "relay-title", children: "Mesh Relay" }), _jsx("button", { class: "relay-collapse-btn", onClick: () => {
|
|
35
|
-
setExpanded(false);
|
|
36
|
-
}, title: "Collapse relay panel", children: "\u2715" })] }), _jsxs("form", { class: "relay-form", onSubmit: handleConnect, children: [_jsxs("label", { class: "relay-label", children: ["Mesh A", _jsx("input", { type: "url", class: "relay-input", placeholder: "ws://machine-a:8080/ws/mesh", value: urlA, onInput: (e) => {
|
|
37
|
-
const target = e.target;
|
|
38
|
-
if (target instanceof HTMLInputElement)
|
|
39
|
-
setUrlA(target.value);
|
|
40
|
-
}, disabled: eitherConnected }), _jsx("span", { class: `relay-status-dot ${status.connectedA ? "active" : ""}` })] }), _jsxs("label", { class: "relay-label", children: ["Mesh B", _jsx("input", { type: "url", class: "relay-input", placeholder: "ws://machine-b:8080/ws/mesh", value: urlB, onInput: (e) => {
|
|
41
|
-
const target = e.target;
|
|
42
|
-
if (target instanceof HTMLInputElement)
|
|
43
|
-
setUrlB(target.value);
|
|
44
|
-
}, disabled: eitherConnected }), _jsx("span", { class: `relay-status-dot ${status.connectedB ? "active" : ""}` })] }), _jsx("div", { class: "relay-actions", children: !eitherConnected ? (_jsx("button", { type: "submit", class: "relay-connect-btn", disabled: !urlA.trim() || !urlB.trim(), children: "Connect" })) : (_jsx("button", { type: "button", class: "relay-disconnect-btn", onClick: onDisconnect, children: "Disconnect" })) })] }), eitherConnected && (_jsxs("div", { class: "relay-stats", children: [_jsxs("span", { class: "relay-stat", children: ["Forwarded: ", status.forwardedCount] }), _jsxs("span", { class: "relay-stat", children: ["A: ", status.connectedA ? "connected" : "disconnected"] }), _jsxs("span", { class: "relay-stat", children: ["B: ", status.connectedB ? "connected" : "disconnected"] })] })), status.errors.length > 0 && (_jsx("div", { class: "relay-errors", children: status.errors.slice(-3).map((err, i) => (_jsx("div", { class: "relay-error", children: err }, i))) }))] }));
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=RelayPanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RelayPanel.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/RelayPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AASnD,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EACN,SAAS,EACT,YAAY,GACI;IAChB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAC9B,MAAM,CAAC,IAAI,IAAI,6BAA6B,CAC7C,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAA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|
|
4
|
-
* Creates a SharedWorker from the built relay-worker.js bundle and
|
|
5
|
-
* provides a typed interface for the React frontend to:
|
|
6
|
-
*
|
|
7
|
-
* - Connect to two mesh endpoints simultaneously
|
|
8
|
-
* - Disconnect from both
|
|
9
|
-
* - Query relay status (connection state, forwarding stats)
|
|
10
|
-
* - Subscribe to real-time status updates
|
|
11
|
-
*/
|
|
12
|
-
export interface RelayStatus {
|
|
13
|
-
connectedA: boolean;
|
|
14
|
-
connectedB: boolean;
|
|
15
|
-
urlA: string | undefined;
|
|
16
|
-
urlB: string | undefined;
|
|
17
|
-
forwardedCount: number;
|
|
18
|
-
errors: string[];
|
|
19
|
-
}
|
|
20
|
-
export type RelayStatusListener = (status: RelayStatus) => void;
|
|
21
|
-
export declare class RelayClient {
|
|
22
|
-
private worker;
|
|
23
|
-
private status;
|
|
24
|
-
private readonly listeners;
|
|
25
|
-
/** Connect to the relay SharedWorker. Idempotent. */
|
|
26
|
-
connect(): void;
|
|
27
|
-
/** Connect the relay to two mesh WebSocket endpoints. */
|
|
28
|
-
connectRelay(urlA: string, urlB: string): void;
|
|
29
|
-
/** Disconnect the relay from both mesh endpoints. */
|
|
30
|
-
disconnect(): void;
|
|
31
|
-
/** Get the current relay status (snapshot). */
|
|
32
|
-
get(): Readonly<RelayStatus>;
|
|
33
|
-
/** Subscribe to status changes. Returns an unsubscribe function. */
|
|
34
|
-
subscribe(listener: RelayStatusListener): () => void;
|
|
35
|
-
/** Destroy the client and release the SharedWorker port. */
|
|
36
|
-
destroy(): void;
|
|
37
|
-
private postToWorker;
|
|
38
|
-
private notify;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=relay-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/relay-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AAMhE,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,CAOZ;IACF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkC;IAE5D,qDAAqD;IACrD,OAAO,IAAI,IAAI;IAqBf,yDAAyD;IACzD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9C,qDAAqD;IACrD,UAAU,IAAI,IAAI;IAIlB,+CAA+C;IAC/C,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC;IAI5B,oEAAoE;IACpE,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAOpD,4DAA4D;IAC5D,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;CAMf"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelayClient — main-thread API for the relay SharedWorker.
|
|
3
|
-
*
|
|
4
|
-
* Creates a SharedWorker from the built relay-worker.js bundle and
|
|
5
|
-
* provides a typed interface for the React frontend to:
|
|
6
|
-
*
|
|
7
|
-
* - Connect to two mesh endpoints simultaneously
|
|
8
|
-
* - Disconnect from both
|
|
9
|
-
* - Query relay status (connection state, forwarding stats)
|
|
10
|
-
* - Subscribe to real-time status updates
|
|
11
|
-
*/
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// RelayClient
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
export class RelayClient {
|
|
16
|
-
worker;
|
|
17
|
-
status = {
|
|
18
|
-
connectedA: false,
|
|
19
|
-
connectedB: false,
|
|
20
|
-
urlA: undefined,
|
|
21
|
-
urlB: undefined,
|
|
22
|
-
forwardedCount: 0,
|
|
23
|
-
errors: [],
|
|
24
|
-
};
|
|
25
|
-
listeners = new Set();
|
|
26
|
-
/** Connect to the relay SharedWorker. Idempotent. */
|
|
27
|
-
connect() {
|
|
28
|
-
if (this.worker)
|
|
29
|
-
return;
|
|
30
|
-
const worker = new SharedWorker("./relay-worker.js");
|
|
31
|
-
this.worker = worker;
|
|
32
|
-
worker.port.onmessage = (event) => {
|
|
33
|
-
const raw = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
|
|
34
|
-
if (isStatusMessage(raw)) {
|
|
35
|
-
this.status = raw.status;
|
|
36
|
-
this.notify();
|
|
37
|
-
}
|
|
38
|
-
else if (isErrorMessage(raw)) {
|
|
39
|
-
console.error("[RelayClient]", raw.message);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
worker.port.start();
|
|
43
|
-
}
|
|
44
|
-
/** Connect the relay to two mesh WebSocket endpoints. */
|
|
45
|
-
connectRelay(urlA, urlB) {
|
|
46
|
-
this.postToWorker({ type: "connect", urlA, urlB });
|
|
47
|
-
}
|
|
48
|
-
/** Disconnect the relay from both mesh endpoints. */
|
|
49
|
-
disconnect() {
|
|
50
|
-
this.postToWorker({ type: "disconnect" });
|
|
51
|
-
}
|
|
52
|
-
/** Get the current relay status (snapshot). */
|
|
53
|
-
get() {
|
|
54
|
-
return this.status;
|
|
55
|
-
}
|
|
56
|
-
/** Subscribe to status changes. Returns an unsubscribe function. */
|
|
57
|
-
subscribe(listener) {
|
|
58
|
-
this.listeners.add(listener);
|
|
59
|
-
return () => {
|
|
60
|
-
this.listeners.delete(listener);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/** Destroy the client and release the SharedWorker port. */
|
|
64
|
-
destroy() {
|
|
65
|
-
if (this.worker) {
|
|
66
|
-
this.worker.port.close();
|
|
67
|
-
this.worker = undefined;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
postToWorker(msg) {
|
|
71
|
-
if (this.worker) {
|
|
72
|
-
this.worker.port.postMessage(JSON.stringify(msg));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
notify() {
|
|
76
|
-
const snapshot = this.status;
|
|
77
|
-
for (const listener of this.listeners) {
|
|
78
|
-
listener(snapshot);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function isStatusMessage(value) {
|
|
83
|
-
return (typeof value === "object" &&
|
|
84
|
-
value !== null &&
|
|
85
|
-
"type" in value &&
|
|
86
|
-
typeof value.type === "string" &&
|
|
87
|
-
value.type === "status" &&
|
|
88
|
-
"status" in value);
|
|
89
|
-
}
|
|
90
|
-
function isErrorMessage(value) {
|
|
91
|
-
return (typeof value === "object" &&
|
|
92
|
-
value !== null &&
|
|
93
|
-
"type" in value &&
|
|
94
|
-
typeof value.type === "string" &&
|
|
95
|
-
value.type === "error");
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=relay-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/relay-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAM,OAAO,WAAW;IACd,MAAM,CAA2B;IACjC,MAAM,GAAgB;QAC5B,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,cAAc,EAAE,CAAC;QACjB,MAAM,EAAE,EAAE;KACX,CAAC;IACe,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE5D,qDAAqD;IACrD,OAAO;QACL,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QAEx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AAQ,CAAC,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;IAED,4DAA4D;IAC5D,OAAO;QACL,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,GAAY;QAC/B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAEO,MAAM;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;QAC7B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AAgBD,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,KAAK,QAAQ;QACvB,QAAQ,IAAI,KAAK,CAClB,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,KAAK,OAAO,CACvB,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelayWorker — SharedWorker that connects two mesh WebSocket endpoints
|
|
3
|
-
* and forwards wire messages between them with filtering and peer ID
|
|
4
|
-
* translation.
|
|
5
|
-
*
|
|
6
|
-
* Two isolated meshes can communicate through the browser without direct
|
|
7
|
-
* network connectivity between them. Peer IDs are prefixed with a mesh
|
|
8
|
-
* label ("a:" or "b:") to avoid collisions between the two meshes.
|
|
9
|
-
*
|
|
10
|
-
* Built as a separate IIFE bundle (relay-worker.js) so the SharedWorker
|
|
11
|
-
* runs in its own global scope independent of the main app and mesh-worker
|
|
12
|
-
* bundles.
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=relay-worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay-worker.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/relay-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelayWorker — SharedWorker that connects two mesh WebSocket endpoints
|
|
3
|
-
* and forwards wire messages between them with filtering and peer ID
|
|
4
|
-
* translation.
|
|
5
|
-
*
|
|
6
|
-
* Two isolated meshes can communicate through the browser without direct
|
|
7
|
-
* network connectivity between them. Peer IDs are prefixed with a mesh
|
|
8
|
-
* label ("a:" or "b:") to avoid collisions between the two meshes.
|
|
9
|
-
*
|
|
10
|
-
* Built as a separate IIFE bundle (relay-worker.js) so the SharedWorker
|
|
11
|
-
* runs in its own global scope independent of the main app and mesh-worker
|
|
12
|
-
* bundles.
|
|
13
|
-
*/
|
|
14
|
-
const PATCH_TYPES = new Set([
|
|
15
|
-
"agent_upsert",
|
|
16
|
-
"agent_offline",
|
|
17
|
-
"room_upsert",
|
|
18
|
-
"room_delete",
|
|
19
|
-
"message_add",
|
|
20
|
-
"dm_add",
|
|
21
|
-
"delivery",
|
|
22
|
-
"message_read",
|
|
23
|
-
]);
|
|
24
|
-
function isMeshStatePatch(value) {
|
|
25
|
-
if (typeof value !== "object" || value === null)
|
|
26
|
-
return false;
|
|
27
|
-
if (!("type" in value))
|
|
28
|
-
return false;
|
|
29
|
-
if (typeof value.type !== "string")
|
|
30
|
-
return false;
|
|
31
|
-
return PATCH_TYPES.has(value.type);
|
|
32
|
-
}
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// Relay state
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
/** Methods that should be forwarded between meshes. */
|
|
37
|
-
const FORWARDABLE_METHODS = new Set([
|
|
38
|
-
"state_update",
|
|
39
|
-
"peer_joined",
|
|
40
|
-
"peer_left",
|
|
41
|
-
]);
|
|
42
|
-
/** Methods that must never be forwarded (cause loops or are side-specific). */
|
|
43
|
-
const BLOCKED_METHODS = new Set([
|
|
44
|
-
"state_sync",
|
|
45
|
-
"introduce",
|
|
46
|
-
"connect_request",
|
|
47
|
-
"connect_accepted",
|
|
48
|
-
"connect_rejected",
|
|
49
|
-
"peer_list",
|
|
50
|
-
"become_coordinator",
|
|
51
|
-
"pong",
|
|
52
|
-
"fed_handshake",
|
|
53
|
-
"fed_ack",
|
|
54
|
-
"fed_agent_visible",
|
|
55
|
-
"fed_agent_gone",
|
|
56
|
-
"fed_room_message",
|
|
57
|
-
"fed_room_join",
|
|
58
|
-
"fed_room_leave",
|
|
59
|
-
"fed_ping",
|
|
60
|
-
"fed_pong",
|
|
61
|
-
]);
|
|
62
|
-
const meshA = {
|
|
63
|
-
label: "a",
|
|
64
|
-
url: "",
|
|
65
|
-
ws: undefined,
|
|
66
|
-
connected: false,
|
|
67
|
-
reconnectTimer: undefined,
|
|
68
|
-
};
|
|
69
|
-
const meshB = {
|
|
70
|
-
label: "b",
|
|
71
|
-
url: "",
|
|
72
|
-
ws: undefined,
|
|
73
|
-
connected: false,
|
|
74
|
-
reconnectTimer: undefined,
|
|
75
|
-
};
|
|
76
|
-
let forwardedCount = 0;
|
|
77
|
-
const errors = [];
|
|
78
|
-
const MAX_ERRORS = 50;
|
|
79
|
-
const ports = new Set();
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
// Peer ID translation
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
function prefixId(label, id) {
|
|
84
|
-
return `${label}:${id}`;
|
|
85
|
-
}
|
|
86
|
-
function translateAgent(label, agent) {
|
|
87
|
-
return {
|
|
88
|
-
...agent,
|
|
89
|
-
id: prefixId(label, agent.id),
|
|
90
|
-
name: `${agent.name} (via ${label.toUpperCase()})`,
|
|
91
|
-
subscribedRooms: agent.subscribedRooms.map((r) => prefixId(label, r)),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function translateRoom(label, room) {
|
|
95
|
-
return {
|
|
96
|
-
...room,
|
|
97
|
-
id: prefixId(label, room.id),
|
|
98
|
-
owner: prefixId(label, room.owner),
|
|
99
|
-
members: room.members.map((m) => prefixId(label, m)),
|
|
100
|
-
invited: room.invited.map((m) => prefixId(label, m)),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function translateMessage(label, msg) {
|
|
104
|
-
const result = {
|
|
105
|
-
...msg,
|
|
106
|
-
from: prefixId(label, msg.from),
|
|
107
|
-
room: prefixId(label, msg.room),
|
|
108
|
-
readBy: msg.readBy.map((r) => prefixId(label, r)),
|
|
109
|
-
};
|
|
110
|
-
if (msg.replyTo !== undefined)
|
|
111
|
-
result.replyTo = prefixId(label, msg.replyTo);
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
function translateDm(label, msg) {
|
|
115
|
-
return {
|
|
116
|
-
...msg,
|
|
117
|
-
from: prefixId(label, msg.from),
|
|
118
|
-
to: prefixId(label, msg.to),
|
|
119
|
-
readBy: msg.readBy.map((r) => prefixId(label, r)),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function translateDmKey(label, key) {
|
|
123
|
-
// DM keys are "idA--idB" (sorted). Prefix both IDs.
|
|
124
|
-
const parts = key.split("--");
|
|
125
|
-
return parts.map((p) => prefixId(label, p)).join("--");
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Translate a state_update patch, prefixing all peer/room IDs with the
|
|
129
|
-
* mesh label so they don't collide with IDs from the other mesh.
|
|
130
|
-
*/
|
|
131
|
-
function translatePatch(label, patch) {
|
|
132
|
-
switch (patch.type) {
|
|
133
|
-
case "agent_upsert":
|
|
134
|
-
return { ...patch, agent: translateAgent(label, patch.agent) };
|
|
135
|
-
case "agent_offline":
|
|
136
|
-
return { ...patch, agentId: prefixId(label, patch.agentId) };
|
|
137
|
-
case "room_upsert":
|
|
138
|
-
return { ...patch, room: translateRoom(label, patch.room) };
|
|
139
|
-
case "room_delete":
|
|
140
|
-
return { ...patch, roomId: prefixId(label, patch.roomId) };
|
|
141
|
-
case "message_add":
|
|
142
|
-
return {
|
|
143
|
-
...patch,
|
|
144
|
-
roomId: prefixId(label, patch.roomId),
|
|
145
|
-
message: translateMessage(label, patch.message),
|
|
146
|
-
};
|
|
147
|
-
case "dm_add":
|
|
148
|
-
return {
|
|
149
|
-
...patch,
|
|
150
|
-
key: translateDmKey(label, patch.key),
|
|
151
|
-
message: translateDm(label, patch.message),
|
|
152
|
-
};
|
|
153
|
-
case "delivery":
|
|
154
|
-
return { ...patch, agentId: prefixId(label, patch.agentId) };
|
|
155
|
-
case "message_read":
|
|
156
|
-
return {
|
|
157
|
-
...patch,
|
|
158
|
-
readBy: prefixId(label, patch.readBy),
|
|
159
|
-
...(patch.room ? { room: prefixId(label, patch.room) } : {}),
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// ---------------------------------------------------------------------------
|
|
164
|
-
// Wire message parsing
|
|
165
|
-
// ---------------------------------------------------------------------------
|
|
166
|
-
function parseWireMessage(raw) {
|
|
167
|
-
if (typeof raw !== "object" || raw === null)
|
|
168
|
-
return undefined;
|
|
169
|
-
if (!("method" in raw))
|
|
170
|
-
return undefined;
|
|
171
|
-
if (typeof raw.method !== "string")
|
|
172
|
-
return undefined;
|
|
173
|
-
// Spread into a new object to satisfy WireMessage — raw is narrowed to
|
|
174
|
-
// object & { method: string } but not to the WireMessage union
|
|
175
|
-
const msg = { ...raw, method: raw.method };
|
|
176
|
-
return msg;
|
|
177
|
-
}
|
|
178
|
-
// ---------------------------------------------------------------------------
|
|
179
|
-
// Message forwarding
|
|
180
|
-
// ---------------------------------------------------------------------------
|
|
181
|
-
function shouldForward(msg) {
|
|
182
|
-
if (BLOCKED_METHODS.has(msg.method))
|
|
183
|
-
return false;
|
|
184
|
-
if (FORWARDABLE_METHODS.has(msg.method))
|
|
185
|
-
return true;
|
|
186
|
-
// Unknown methods are blocked by default
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
function translateWireMessage(label, msg) {
|
|
190
|
-
if (msg.method === "state_update" &&
|
|
191
|
-
"patch" in msg &&
|
|
192
|
-
isMeshStatePatch(msg.patch)) {
|
|
193
|
-
return { ...msg, patch: translatePatch(label, msg.patch) };
|
|
194
|
-
}
|
|
195
|
-
if (msg.method === "peer_joined" &&
|
|
196
|
-
"peer" in msg &&
|
|
197
|
-
typeof msg.peer === "object" &&
|
|
198
|
-
msg.peer !== null &&
|
|
199
|
-
"id" in msg.peer &&
|
|
200
|
-
typeof msg.peer.id === "string" &&
|
|
201
|
-
"port" in msg.peer &&
|
|
202
|
-
typeof msg.peer.port === "number" &&
|
|
203
|
-
"startedAt" in msg.peer &&
|
|
204
|
-
typeof msg.peer.startedAt === "string") {
|
|
205
|
-
return {
|
|
206
|
-
...msg,
|
|
207
|
-
peer: { ...msg.peer, id: prefixId(label, msg.peer.id) },
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
if (msg.method === "peer_left" &&
|
|
211
|
-
"peerId" in msg &&
|
|
212
|
-
typeof msg.peerId === "string") {
|
|
213
|
-
return { ...msg, peerId: prefixId(label, msg.peerId) };
|
|
214
|
-
}
|
|
215
|
-
return msg;
|
|
216
|
-
}
|
|
217
|
-
function forwardToTarget(source, target, raw) {
|
|
218
|
-
const msg = parseWireMessage(raw);
|
|
219
|
-
if (msg === undefined)
|
|
220
|
-
return;
|
|
221
|
-
if (!shouldForward(msg))
|
|
222
|
-
return;
|
|
223
|
-
const translated = translateWireMessage(source.label, msg);
|
|
224
|
-
const targetWs = target.ws;
|
|
225
|
-
if (targetWs?.readyState === WebSocket.OPEN) {
|
|
226
|
-
targetWs.send(JSON.stringify(translated));
|
|
227
|
-
forwardedCount++;
|
|
228
|
-
broadcastStatus();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// ---------------------------------------------------------------------------
|
|
232
|
-
// WebSocket connection management
|
|
233
|
-
// ---------------------------------------------------------------------------
|
|
234
|
-
function connectMesh(conn, other) {
|
|
235
|
-
if (conn.reconnectTimer !== undefined) {
|
|
236
|
-
clearTimeout(conn.reconnectTimer);
|
|
237
|
-
conn.reconnectTimer = undefined;
|
|
238
|
-
}
|
|
239
|
-
const socket = new WebSocket(conn.url);
|
|
240
|
-
conn.ws = socket;
|
|
241
|
-
socket.onopen = () => {
|
|
242
|
-
conn.connected = true;
|
|
243
|
-
broadcastStatus();
|
|
244
|
-
};
|
|
245
|
-
socket.onclose = () => {
|
|
246
|
-
conn.ws = undefined;
|
|
247
|
-
conn.connected = false;
|
|
248
|
-
broadcastStatus();
|
|
249
|
-
scheduleReconnect(conn, other);
|
|
250
|
-
};
|
|
251
|
-
socket.onerror = () => {
|
|
252
|
-
// onclose fires after this
|
|
253
|
-
};
|
|
254
|
-
socket.onmessage = (event) => {
|
|
255
|
-
const raw = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
|
|
256
|
-
forwardToTarget(conn, other, raw);
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
function scheduleReconnect(conn, other) {
|
|
260
|
-
if (!conn.url)
|
|
261
|
-
return;
|
|
262
|
-
conn.reconnectTimer = setTimeout(() => {
|
|
263
|
-
if (conn.url)
|
|
264
|
-
connectMesh(conn, other);
|
|
265
|
-
}, 3000);
|
|
266
|
-
}
|
|
267
|
-
function disconnectMesh(conn) {
|
|
268
|
-
if (conn.reconnectTimer !== undefined) {
|
|
269
|
-
clearTimeout(conn.reconnectTimer);
|
|
270
|
-
conn.reconnectTimer = undefined;
|
|
271
|
-
}
|
|
272
|
-
conn.ws?.close();
|
|
273
|
-
conn.ws = undefined;
|
|
274
|
-
conn.connected = false;
|
|
275
|
-
conn.url = "";
|
|
276
|
-
}
|
|
277
|
-
// ---------------------------------------------------------------------------
|
|
278
|
-
// Port management — fan-out to all connected main-thread tabs
|
|
279
|
-
// ---------------------------------------------------------------------------
|
|
280
|
-
function broadcastToPorts(msg) {
|
|
281
|
-
const data = JSON.stringify(msg);
|
|
282
|
-
for (const port of ports) {
|
|
283
|
-
try {
|
|
284
|
-
port.postMessage(data);
|
|
285
|
-
}
|
|
286
|
-
catch {
|
|
287
|
-
// Port closed
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
function broadcastStatus() {
|
|
292
|
-
broadcastToPorts({
|
|
293
|
-
type: "status",
|
|
294
|
-
status: getStatus(),
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
function getStatus() {
|
|
298
|
-
return {
|
|
299
|
-
connectedA: meshA.connected,
|
|
300
|
-
connectedB: meshB.connected,
|
|
301
|
-
urlA: meshA.url || undefined,
|
|
302
|
-
urlB: meshB.url || undefined,
|
|
303
|
-
forwardedCount,
|
|
304
|
-
errors: [...errors],
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
function addError(message) {
|
|
308
|
-
errors.push(message);
|
|
309
|
-
if (errors.length > MAX_ERRORS) {
|
|
310
|
-
errors.shift();
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
function handlePortMessage(msg) {
|
|
314
|
-
switch (msg.type) {
|
|
315
|
-
case "connect": {
|
|
316
|
-
// Disconnect existing connections
|
|
317
|
-
disconnectMesh(meshA);
|
|
318
|
-
disconnectMesh(meshB);
|
|
319
|
-
forwardedCount = 0;
|
|
320
|
-
errors.length = 0;
|
|
321
|
-
meshA.url = msg.urlA;
|
|
322
|
-
meshB.url = msg.urlB;
|
|
323
|
-
try {
|
|
324
|
-
connectMesh(meshA, meshB);
|
|
325
|
-
connectMesh(meshB, meshA);
|
|
326
|
-
}
|
|
327
|
-
catch (err) {
|
|
328
|
-
addError(err instanceof Error ? err.message : String(err));
|
|
329
|
-
}
|
|
330
|
-
broadcastStatus();
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
case "disconnect": {
|
|
334
|
-
disconnectMesh(meshA);
|
|
335
|
-
disconnectMesh(meshB);
|
|
336
|
-
broadcastStatus();
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
case "status":
|
|
340
|
-
broadcastStatus();
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function isRelayInbound(value) {
|
|
345
|
-
if (typeof value !== "object" || value === null)
|
|
346
|
-
return false;
|
|
347
|
-
if (!("type" in value))
|
|
348
|
-
return false;
|
|
349
|
-
const t = value.type;
|
|
350
|
-
return (typeof t === "string" &&
|
|
351
|
-
(t === "connect" || t === "disconnect" || t === "status"));
|
|
352
|
-
}
|
|
353
|
-
// ---------------------------------------------------------------------------
|
|
354
|
-
// Entry point — listen for SharedWorker connections
|
|
355
|
-
// ---------------------------------------------------------------------------
|
|
356
|
-
self.addEventListener("connect", (event) => {
|
|
357
|
-
const rawPort = event.ports[0];
|
|
358
|
-
if (rawPort === undefined)
|
|
359
|
-
return;
|
|
360
|
-
ports.add(rawPort);
|
|
361
|
-
// Send current status to the new port
|
|
362
|
-
try {
|
|
363
|
-
rawPort.postMessage(JSON.stringify({
|
|
364
|
-
type: "status",
|
|
365
|
-
status: getStatus(),
|
|
366
|
-
}));
|
|
367
|
-
}
|
|
368
|
-
catch {
|
|
369
|
-
// Port not ready yet
|
|
370
|
-
}
|
|
371
|
-
rawPort.onmessage = (e) => {
|
|
372
|
-
const parsed = JSON.parse(typeof e.data === "string" ? e.data : String(e.data));
|
|
373
|
-
if (isRelayInbound(parsed)) {
|
|
374
|
-
handlePortMessage(parsed);
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
});
|
|
378
|
-
export {};
|
|
379
|
-
//# sourceMappingURL=relay-worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay-worker.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/relay-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmFH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,cAAc;IACd,eAAe;IACf,aAAa;IACb,aAAa;IACb,aAAa;IACb,QAAQ;IACR,UAAU;IACV,cAAc;CACf,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACjD,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAgCD,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,uDAAuD;AACvD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,cAAc;IACd,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,YAAY;IACZ,WAAW;IACX,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,WAAW;IACX,oBAAoB;IACpB,MAAM;IACN,eAAe;IACf,SAAS;IACT,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAUH,MAAM,KAAK,GAAmB;IAC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