agent-comms 3.25.0 → 3.27.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/dist/bundle.js +12 -12
- package/dist/bridges/user/web/dist/mesh-worker.js +64 -1
- package/dist/bridges/user/web/dist/sw.js +1 -1
- package/dist/bridges/user/web/frontend/dispatch-action.d.ts +10 -0
- package/dist/bridges/user/web/frontend/dispatch-action.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/dispatch-action.js +62 -0
- package/dist/bridges/user/web/frontend/dispatch-action.js.map +1 -0
- package/dist/bridges/user/web/frontend/mesh-client.d.ts +16 -13
- package/dist/bridges/user/web/frontend/mesh-client.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/mesh-client.js +138 -78
- package/dist/bridges/user/web/frontend/mesh-client.js.map +1 -1
- package/dist/bridges/user/web/frontend/mesh-worker.d.ts +59 -43
- package/dist/bridges/user/web/frontend/mesh-worker.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/mesh-worker.js +85 -57
- package/dist/bridges/user/web/frontend/mesh-worker.js.map +1 -1
- package/dist/bridges/user/web/frontend/tab-contract.d.ts +691 -0
- package/dist/bridges/user/web/frontend/tab-contract.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/tab-contract.js +13 -0
- package/dist/bridges/user/web/frontend/tab-contract.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MeshClient — main-thread API for the mesh SharedWorker.
|
|
3
3
|
*
|
|
4
|
-
* Creates a SharedWorker from the built mesh-worker.js bundle and
|
|
5
|
-
* provides a typed interface for the React frontend to:
|
|
4
|
+
* Creates a SharedWorker from the built mesh-worker.js bundle and provides a typed interface for the React frontend to:
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* - Query current mesh state (agents, rooms)
|
|
7
|
+
* - Execute actions (send, join, create room, etc.)
|
|
8
|
+
* - Subscribe to real-time state changes (patches)
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
12
|
-
* server's /ws/mesh endpoint shared across all tabs.
|
|
10
|
+
* The public subscribe()/get()/disconnect()/sendAction()/connect() surface is unchanged from before the oRPC migration -- internally, agents/rooms are now driven by consuming the worker's own tab-contract.ts subscribeEvents() stream over a real oRPC message-port client, rather than parsing raw postMessage frames. The one signal the new stream doesn't yet carry as its own discrete event -- connected/disconnected, which describes the worker's own upstream socket state to the real server, not this class's own message-port channel to the worker -- is read from the legacy protocol's own "connected"/"disconnected" broadcasts, still fully live on the same port (mesh-worker.ts's own PR4 kept both protocols coexisting deliberately for exactly this kind of narrow reuse, rather than re-deriving an equivalent signal via a second, redundant mechanism).
|
|
13
11
|
*/
|
|
14
12
|
import type { Agent, Room } from "./types.js";
|
|
15
13
|
type AgentIdentity = Agent;
|
|
@@ -22,10 +20,11 @@ export interface MeshClientState {
|
|
|
22
20
|
}
|
|
23
21
|
export declare class MeshClient {
|
|
24
22
|
private worker;
|
|
23
|
+
private client;
|
|
25
24
|
private state;
|
|
26
25
|
private readonly listeners;
|
|
27
|
-
private
|
|
28
|
-
|
|
26
|
+
private eventPumpGeneration;
|
|
27
|
+
constructor();
|
|
29
28
|
/** Connect to the mesh SharedWorker. Idempotent. */
|
|
30
29
|
connect(): void;
|
|
31
30
|
/** Get the current mesh state (snapshot). */
|
|
@@ -37,12 +36,16 @@ export declare class MeshClient {
|
|
|
37
36
|
/** Disconnect and clean up. */
|
|
38
37
|
disconnect(): void;
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
* Consumes the worker's own subscribeEvents() stream for as long as this generation is current, mirroring mesh-worker.ts's own pumpEvents: resuming by lastEventId after any transport-level drop is this loop's own job, not something either RetryLinkPlugin or the underlying transport does transparently on its own (confirmed empirically in an earlier stage of this migration).
|
|
40
|
+
*/
|
|
41
|
+
private pumpEvents;
|
|
42
|
+
private applyMeshEvent;
|
|
43
|
+
private applyPatch;
|
|
44
|
+
private postLegacyInit;
|
|
45
|
+
/**
|
|
46
|
+
* Probe localhost ports sequentially for the web server's /ws/mesh endpoint. Matches the server's port discovery: starts at 19877, walks up. Sends an init message to the worker on first successful WS upgrade.
|
|
43
47
|
*/
|
|
44
48
|
private probeLocalMesh;
|
|
45
|
-
private postToWorker;
|
|
46
49
|
private notify;
|
|
47
50
|
}
|
|
48
51
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-client.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mesh-client.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAS9C,KAAK,aAAa,GAAG,KAAK,CAAC;AAC3B,KAAK,QAAQ,GAAG,IAAI,CAAC;AAGrB,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAWD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,KAAK,CAIX;IACF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgC;IAC1D,OAAO,CAAC,mBAAmB,CAAK;;IAWhC,oDAAoD;IACpD,OAAO,IAAI,IAAI;IAyCf,6CAA6C;IAC7C,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC;IAIhC,mEAAmE;IACnE,SAAS,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAOlD,8CAA8C;IAC9C,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMjD,+BAA+B;IAC/B,UAAU,IAAI,IAAI;IAsBlB;;OAEG;YACW,UAAU;IAwBxB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,MAAM;CAMf"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MeshClient — main-thread API for the mesh SharedWorker.
|
|
3
3
|
*
|
|
4
|
-
* Creates a SharedWorker from the built mesh-worker.js bundle and
|
|
5
|
-
* provides a typed interface for the React frontend to:
|
|
4
|
+
* Creates a SharedWorker from the built mesh-worker.js bundle and provides a typed interface for the React frontend to:
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* - Query current mesh state (agents, rooms)
|
|
7
|
+
* - Execute actions (send, join, create room, etc.)
|
|
8
|
+
* - Subscribe to real-time state changes (patches)
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
12
|
-
* server's /ws/mesh endpoint shared across all tabs.
|
|
10
|
+
* The public subscribe()/get()/disconnect()/sendAction()/connect() surface is unchanged from before the oRPC migration -- internally, agents/rooms are now driven by consuming the worker's own tab-contract.ts subscribeEvents() stream over a real oRPC message-port client, rather than parsing raw postMessage frames. The one signal the new stream doesn't yet carry as its own discrete event -- connected/disconnected, which describes the worker's own upstream socket state to the real server, not this class's own message-port channel to the worker -- is read from the legacy protocol's own "connected"/"disconnected" broadcasts, still fully live on the same port (mesh-worker.ts's own PR4 kept both protocols coexisting deliberately for exactly this kind of narrow reuse, rather than re-deriving an equivalent signal via a second, redundant mechanism).
|
|
13
11
|
*/
|
|
12
|
+
import { createORPCClient, getEventMeta } from "@orpc/client";
|
|
13
|
+
import { RPCLink } from "@orpc/client/message-port";
|
|
14
|
+
import { dispatchAction } from "./dispatch-action.js";
|
|
14
15
|
/** The web server's default port when standalone (coordinator default 19876 + 1), the base port `probeLocalMesh` starts walking up from. */
|
|
15
16
|
const DEFAULT_WEB_SERVER_PORT = 19877;
|
|
16
17
|
/** How many ports above `DEFAULT_WEB_SERVER_PORT` to probe before giving up, matching the server's own port-discovery walk-up range. */
|
|
@@ -20,85 +21,57 @@ const MESH_PROBE_MAX_ATTEMPTS = 10;
|
|
|
20
21
|
// ---------------------------------------------------------------------------
|
|
21
22
|
export class MeshClient {
|
|
22
23
|
worker;
|
|
24
|
+
client;
|
|
23
25
|
state = {
|
|
24
26
|
agents: [],
|
|
25
27
|
rooms: [],
|
|
26
28
|
connected: false,
|
|
27
29
|
};
|
|
28
30
|
listeners = new Set();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
eventPumpGeneration = 0;
|
|
32
|
+
constructor() {
|
|
33
|
+
if (typeof window !== "undefined") {
|
|
34
|
+
// A browser MessagePort never fires its own "close" event, so nothing tells the worker a tab is gone unless the tab says so itself. pagehide (never beforeunload, which kills the bfcache and is unreliable on mobile) is the last reliable point at which this can still run.
|
|
35
|
+
window.addEventListener("pagehide", () => {
|
|
36
|
+
this.disconnect();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
/** Connect to the mesh SharedWorker. Idempotent. */
|
|
32
41
|
connect() {
|
|
33
42
|
if (this.worker)
|
|
34
43
|
return;
|
|
35
44
|
const worker = new SharedWorker("./mesh-worker.js");
|
|
36
45
|
this.worker = worker;
|
|
46
|
+
// Legacy protocol: kept alive on this same port specifically for its connected/disconnected broadcasts (see class docstring). "state"/"patch"/"actionResult"/"actionError" frames are ignored here -- the oRPC stream pumped below is the real source for agents/rooms now.
|
|
37
47
|
worker.port.onmessage = (event) => {
|
|
38
48
|
const raw = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
|
|
39
49
|
if (!isOutboundMessage(raw))
|
|
40
50
|
return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
break;
|
|
49
|
-
const state = raw.state;
|
|
50
|
-
// State from mesh SharedWorker is SerialisedState where agents/rooms are Record<string, T>. isAgentLike/isRoomLike validate at the same shallow depth as isOutboundMessage above, matching this file's "no Zod, just interfaces" convention -- filtering with a type predicate narrows Object.values' result to the declared element type without an unsafe assignment.
|
|
51
|
-
const agents = isRecord(state.agents)
|
|
52
|
-
? Object.values(state.agents).filter(isAgentLike)
|
|
53
|
-
: [];
|
|
54
|
-
const rooms = isRecord(state.rooms)
|
|
55
|
-
? Object.values(state.rooms).filter(isRoomLike)
|
|
56
|
-
: [];
|
|
57
|
-
this.state = {
|
|
58
|
-
...this.state,
|
|
59
|
-
agents,
|
|
60
|
-
rooms,
|
|
61
|
-
};
|
|
62
|
-
this.notify();
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case "connected":
|
|
66
|
-
this.state = { ...this.state, connected: true };
|
|
67
|
-
this.notify();
|
|
68
|
-
break;
|
|
69
|
-
case "disconnected":
|
|
70
|
-
this.state = { ...this.state, connected: false };
|
|
71
|
-
this.notify();
|
|
72
|
-
break;
|
|
73
|
-
case "patch":
|
|
74
|
-
// After any patch, refresh from the worker's authoritative state
|
|
75
|
-
this.postToWorker({ type: "getState" });
|
|
76
|
-
break;
|
|
77
|
-
case "actionResult": {
|
|
78
|
-
// For now, action results are broadcast — we don't correlate by ID
|
|
79
|
-
// because the server doesn't echo back an action ID. The main.tsx
|
|
80
|
-
// handles action results through the existing CommsWs.
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case "actionError":
|
|
84
|
-
break;
|
|
51
|
+
if (raw.type === "connected") {
|
|
52
|
+
this.state = { ...this.state, connected: true };
|
|
53
|
+
this.notify();
|
|
54
|
+
}
|
|
55
|
+
else if (raw.type === "disconnected") {
|
|
56
|
+
this.state = { ...this.state, connected: false };
|
|
57
|
+
this.notify();
|
|
85
58
|
}
|
|
86
59
|
};
|
|
87
60
|
worker.port.start();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
61
|
+
const link = new RPCLink({ port: worker.port });
|
|
62
|
+
const client = createORPCClient(link);
|
|
63
|
+
this.client = client;
|
|
64
|
+
void this.pumpEvents(client, ++this.eventPumpGeneration);
|
|
65
|
+
// Discover the web server — walk up from 19877 matching the server's port discovery. If served by the local server (location.host is localhost/127.0.0.1), use that directly. Otherwise probe localhost.
|
|
91
66
|
const localPattern = /^(localhost|127\.\d+\.\d+\.\d+)(:\d+)?$/;
|
|
92
67
|
const isLocal = localPattern.test(location.host);
|
|
93
68
|
if (isLocal) {
|
|
94
69
|
const proto = location.protocol === "https:" ? "wss:" : "ws:";
|
|
95
70
|
const url = `${proto}//${location.host}/ws/mesh`;
|
|
96
|
-
this.
|
|
71
|
+
this.postLegacyInit(url);
|
|
97
72
|
}
|
|
98
73
|
else {
|
|
99
|
-
// Standalone PWA (e.g. GitHub Pages) — probe localhost ports.
|
|
100
|
-
// The web server binds at coordinatorPort + 1, walking up if taken.
|
|
101
|
-
// Coordinator defaults to 19876, so web server starts at 19877.
|
|
74
|
+
// Standalone PWA (e.g. GitHub Pages) — probe localhost ports. The web server binds at coordinatorPort + 1, walking up if taken. Coordinator defaults to 19876, so web server starts at 19877.
|
|
102
75
|
this.probeLocalMesh(DEFAULT_WEB_SERVER_PORT, MESH_PROBE_MAX_ATTEMPTS);
|
|
103
76
|
}
|
|
104
77
|
}
|
|
@@ -115,21 +88,115 @@ export class MeshClient {
|
|
|
115
88
|
}
|
|
116
89
|
/** Send an action through the mesh worker. */
|
|
117
90
|
sendAction(action) {
|
|
118
|
-
const
|
|
119
|
-
|
|
91
|
+
const client = this.client;
|
|
92
|
+
if (!client)
|
|
93
|
+
return;
|
|
94
|
+
void dispatchAction(client, action);
|
|
120
95
|
}
|
|
121
96
|
/** Disconnect and clean up. */
|
|
122
97
|
disconnect() {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
98
|
+
const worker = this.worker;
|
|
99
|
+
const client = this.client;
|
|
100
|
+
this.worker = undefined;
|
|
101
|
+
this.client = undefined;
|
|
102
|
+
this.eventPumpGeneration++;
|
|
103
|
+
if (!worker)
|
|
104
|
+
return;
|
|
105
|
+
if (client) {
|
|
106
|
+
// Tell the worker to evict this port's own peer registration before closing it locally -- confirmed (mesh-worker.ts's own PR) that closing the port synchronously from inside the worker's disconnect handler would hang the call, but that's the worker's own internal sequencing; from this side, firing the call and closing once it settles (success or failure) is sufficient and never blocks the tab from actually going away.
|
|
107
|
+
client
|
|
108
|
+
.disconnect({})
|
|
109
|
+
.catch(() => {
|
|
110
|
+
// Best-effort -- the tab is going away regardless.
|
|
111
|
+
})
|
|
112
|
+
.finally(() => {
|
|
113
|
+
worker.port.close();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
worker.port.close();
|
|
126
118
|
}
|
|
127
|
-
this.pendingActions.clear();
|
|
128
119
|
}
|
|
129
120
|
/**
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
* Consumes the worker's own subscribeEvents() stream for as long as this generation is current, mirroring mesh-worker.ts's own pumpEvents: resuming by lastEventId after any transport-level drop is this loop's own job, not something either RetryLinkPlugin or the underlying transport does transparently on its own (confirmed empirically in an earlier stage of this migration).
|
|
122
|
+
*/
|
|
123
|
+
async pumpEvents(client, generation) {
|
|
124
|
+
let lastEventId;
|
|
125
|
+
while (generation === this.eventPumpGeneration) {
|
|
126
|
+
try {
|
|
127
|
+
const events = await client.subscribeEvents(lastEventId === undefined ? {} : { lastEventId });
|
|
128
|
+
for await (const event of events) {
|
|
129
|
+
if (generation !== this.eventPumpGeneration)
|
|
130
|
+
return;
|
|
131
|
+
const meta = getEventMeta(event);
|
|
132
|
+
if (meta?.id !== undefined)
|
|
133
|
+
lastEventId = meta.id;
|
|
134
|
+
this.applyMeshEvent(event);
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Transport dropped mid-stream. Loop back and resume from lastEventId once subscribeEvents() can succeed again.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
applyMeshEvent(event) {
|
|
144
|
+
switch (event.kind) {
|
|
145
|
+
case "state_sync": {
|
|
146
|
+
const agentsArr = Object.values(event.state.agents).filter(isAgentLike);
|
|
147
|
+
const roomsArr = Object.values(event.state.rooms).filter(isRoomLike);
|
|
148
|
+
this.state = { ...this.state, agents: agentsArr, rooms: roomsArr };
|
|
149
|
+
this.notify();
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case "state_patch":
|
|
153
|
+
this.applyPatch(event.patch);
|
|
154
|
+
break;
|
|
155
|
+
case "delivery":
|
|
156
|
+
// Not yet wired to the UI's message list -- main.tsx's own cutover is what actually consumes delivery events; this class's own state only ever tracked agents/rooms/connected.
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
applyPatch(patch) {
|
|
161
|
+
switch (patch.type) {
|
|
162
|
+
case "agent_upsert": {
|
|
163
|
+
const agents = this.state.agents.filter((a) => a.id !== patch.agent.id);
|
|
164
|
+
agents.push(patch.agent);
|
|
165
|
+
this.state = { ...this.state, agents };
|
|
166
|
+
this.notify();
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "agent_offline": {
|
|
170
|
+
const agents = this.state.agents.map((a) => a.id === patch.agentId ? { ...a, status: "offline" } : a);
|
|
171
|
+
this.state = { ...this.state, agents };
|
|
172
|
+
this.notify();
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case "room_upsert": {
|
|
176
|
+
const rooms = this.state.rooms.filter((r) => r.id !== patch.room.id);
|
|
177
|
+
rooms.push(patch.room);
|
|
178
|
+
this.state = { ...this.state, rooms };
|
|
179
|
+
this.notify();
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
case "room_delete": {
|
|
183
|
+
const rooms = this.state.rooms.filter((r) => r.id !== patch.roomId);
|
|
184
|
+
this.state = { ...this.state, rooms };
|
|
185
|
+
this.notify();
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case "message_add":
|
|
189
|
+
case "dm_add":
|
|
190
|
+
case "delivery":
|
|
191
|
+
// Message/DM history and delivery-via-patch aren't part of this class's own state -- main.tsx's own cutover reads those from elsewhere.
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
postLegacyInit(url) {
|
|
196
|
+
this.worker?.port.postMessage(JSON.stringify({ type: "init", url }));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Probe localhost ports sequentially for the web server's /ws/mesh endpoint. Matches the server's port discovery: starts at 19877, walks up. Sends an init message to the worker on first successful WS upgrade.
|
|
133
200
|
*/
|
|
134
201
|
probeLocalMesh(basePort, maxAttempts) {
|
|
135
202
|
let attempts = 0;
|
|
@@ -138,13 +205,11 @@ export class MeshClient {
|
|
|
138
205
|
return;
|
|
139
206
|
attempts++;
|
|
140
207
|
const url = `ws://127.0.0.1:${String(port)}/ws/mesh`;
|
|
141
|
-
// Quick HTTP fetch to check if anything is listening and speaks our protocol.
|
|
142
|
-
// A WebSocket upgrade would be cleaner but fetch is simpler and avoids
|
|
143
|
-
// a visible WS error in the console.
|
|
208
|
+
// Quick HTTP fetch to check if anything is listening and speaks our protocol. A WebSocket upgrade would be cleaner but fetch is simpler and avoids a visible WS error in the console.
|
|
144
209
|
fetch(`http://127.0.0.1:${String(port)}/`, { mode: "no-cors" })
|
|
145
210
|
.then(() => {
|
|
146
211
|
// Something responded — try connecting via the worker
|
|
147
|
-
this.
|
|
212
|
+
this.postLegacyInit(url);
|
|
148
213
|
})
|
|
149
214
|
.catch(() => {
|
|
150
215
|
tryPort(port + 1);
|
|
@@ -152,11 +217,6 @@ export class MeshClient {
|
|
|
152
217
|
};
|
|
153
218
|
tryPort(basePort);
|
|
154
219
|
}
|
|
155
|
-
postToWorker(msg) {
|
|
156
|
-
if (this.worker) {
|
|
157
|
-
this.worker.port.postMessage(JSON.stringify(msg));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
220
|
notify() {
|
|
161
221
|
const snapshot = this.state;
|
|
162
222
|
for (const listener of this.listeners) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-client.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mesh-client.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAKpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAkBtD,4IAA4I;AAC5I,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,wIAAwI;AACxI,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,MAAM,OAAO,UAAU;IACb,MAAM,CAA2B;IACjC,MAAM,CAAwB;IAC9B,KAAK,GAAoB;QAC/B,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,KAAK;KACjB,CAAC;IACe,SAAS,GAAG,IAAI,GAAG,EAAqB,CAAC;IAClD,mBAAmB,GAAG,CAAC,CAAC;IAEhC;QACE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,+QAA+Q;YAC/Q,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG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KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAC/B,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -5,50 +5,17 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Built as a separate IIFE bundle (mesh-worker.js) so the SharedWorker runs in its own global scope independent of the main app bundle.
|
|
7
7
|
*/
|
|
8
|
+
import { MeshEventPublisher } from "../event-publisher.js";
|
|
9
|
+
import type { AgentIdentity as CoreAgentIdentity, Room as CoreRoom, RoomMessage as CoreRoomMessage, DmMessage as CoreDmMessage } from "../../../../core/types.js";
|
|
8
10
|
interface MessagePortLike {
|
|
9
11
|
postMessage: (message: unknown) => void;
|
|
10
12
|
close: () => void;
|
|
11
13
|
onmessage: ((event: MessageEvent) => void) | null;
|
|
12
14
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cwd: string;
|
|
18
|
-
pid: number;
|
|
19
|
-
startedAt: string;
|
|
20
|
-
visibility: "visible" | "hidden" | "ghost";
|
|
21
|
-
status: "active" | "idle" | "busy" | "offline";
|
|
22
|
-
tags: string[];
|
|
23
|
-
subscribedRooms: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface Room {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
type: "public" | "private" | "secret";
|
|
29
|
-
owner: string;
|
|
30
|
-
createdAt: string;
|
|
31
|
-
description: string;
|
|
32
|
-
members: string[];
|
|
33
|
-
invited: string[];
|
|
34
|
-
}
|
|
35
|
-
interface RoomMessage {
|
|
36
|
-
id: string;
|
|
37
|
-
from: string;
|
|
38
|
-
room: string;
|
|
39
|
-
content: string;
|
|
40
|
-
timestamp: string;
|
|
41
|
-
replyTo?: string | undefined;
|
|
42
|
-
readBy: string[];
|
|
43
|
-
}
|
|
44
|
-
interface DmMessage {
|
|
45
|
-
id: string;
|
|
46
|
-
from: string;
|
|
47
|
-
to: string;
|
|
48
|
-
content: string;
|
|
49
|
-
timestamp: string;
|
|
50
|
-
readBy: string[];
|
|
51
|
-
}
|
|
15
|
+
export type AgentIdentity = CoreAgentIdentity;
|
|
16
|
+
export type Room = CoreRoom;
|
|
17
|
+
type RoomMessage = CoreRoomMessage;
|
|
18
|
+
type DmMessage = CoreDmMessage;
|
|
52
19
|
interface DeliveryEvent {
|
|
53
20
|
type: string;
|
|
54
21
|
[key: string]: unknown;
|
|
@@ -93,17 +60,66 @@ interface StateSnapshot {
|
|
|
93
60
|
agents: AgentIdentity[];
|
|
94
61
|
rooms: Room[];
|
|
95
62
|
}
|
|
96
|
-
export declare const agents: Map<string,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
63
|
+
export declare const agents: Map<string, {
|
|
64
|
+
id: string;
|
|
65
|
+
version: number;
|
|
66
|
+
name: string;
|
|
67
|
+
harness: string;
|
|
68
|
+
cwd: string;
|
|
69
|
+
pid: number;
|
|
70
|
+
startedAt: string;
|
|
71
|
+
visibility: "visible" | "hidden" | "ghost";
|
|
72
|
+
status: "active" | "idle" | "busy" | "offline";
|
|
73
|
+
tags: string[];
|
|
74
|
+
subscribedRooms: string[];
|
|
75
|
+
}>;
|
|
76
|
+
export declare const rooms: Map<string, {
|
|
77
|
+
id: string;
|
|
78
|
+
version: number;
|
|
79
|
+
name: string;
|
|
80
|
+
type: "public" | "private" | "secret";
|
|
81
|
+
owner: string;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
description: string;
|
|
84
|
+
members: string[];
|
|
85
|
+
invited: string[];
|
|
86
|
+
memberJoins: Record<string, number>;
|
|
87
|
+
memberLeaves: Record<string, number>;
|
|
88
|
+
invitedJoins: Record<string, number>;
|
|
89
|
+
invitedLeaves: Record<string, number>;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const messages: Map<string, {
|
|
92
|
+
id: string;
|
|
93
|
+
from: string;
|
|
94
|
+
room: string;
|
|
95
|
+
content: string;
|
|
96
|
+
timestamp: string;
|
|
97
|
+
readBy: string[];
|
|
98
|
+
replyTo?: string | undefined;
|
|
99
|
+
streamingBehavior?: "steer" | "followUp" | "info" | undefined;
|
|
100
|
+
}[]>;
|
|
101
|
+
export declare const dms: Map<string, {
|
|
102
|
+
id: string;
|
|
103
|
+
from: string;
|
|
104
|
+
to: string;
|
|
105
|
+
content: string;
|
|
106
|
+
timestamp: string;
|
|
107
|
+
readBy: string[];
|
|
108
|
+
streamingBehavior?: "steer" | "followUp" | "info" | undefined;
|
|
109
|
+
}[]>;
|
|
100
110
|
export declare function applyStateSync(state: SerialisedState): void;
|
|
101
111
|
/**
|
|
102
112
|
* Applies one server-sent patch to local state. Never merges with the existing local copy -- the worker holds a single WebSocket connection to exactly one server, and the server has already computed the fully-merged, authoritative record (delivery-engine.ts's own version-gated CRDT merge) before ever broadcasting it, so whatever a patch carries IS the correct state, full stop. Merging on top of a possibly-stale local copy (the previous behaviour) can only make things worse -- e.g. resurrecting a room or member the server already removed, since the worker has no version field to know its own copy might already be the older one.
|
|
103
113
|
*/
|
|
104
114
|
export declare function applyPatch(patch: MeshStatePatch): void;
|
|
105
115
|
export declare function getStateSnapshot(): StateSnapshot;
|
|
116
|
+
/** Republishes every event this worker receives from the real server to any tab subscribed via the worker's own oRPC downstream (tab-contract.ts's subscribeEvents). Resumable the same way the server's own publisher is -- a tab's oRPC client can reconnect to this worker (a new MessagePort, or the same one after a drop) and resume from its own lastEventId. */
|
|
117
|
+
export declare const localPublisher: MeshEventPublisher;
|
|
106
118
|
export declare function connect(url: string): void;
|
|
107
119
|
export declare const ports: Set<MessagePortLike>;
|
|
120
|
+
/**
|
|
121
|
+
* Wires the new oRPC tab-contract.ts downstream onto a port -- dark, nothing in mesh-client.ts speaks it yet, but it's real and independently reachable. Exported (read-only: never assigns any of the port's own properties, unlike the legacy protocol's onmessage wiring below) so a test can drive it directly against a real MessagePort pair without simulating a real SharedWorker "connect" event.
|
|
122
|
+
*/
|
|
123
|
+
export declare function upgradeTabRpcPort(port: Readonly<MessagePort>): void;
|
|
108
124
|
export {};
|
|
109
125
|
//# sourceMappingURL=mesh-worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-worker.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"mesh-worker.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/mesh-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,IAAI,IAAI,QAAQ,EAChB,WAAW,IAAI,eAAe,EAC9B,SAAS,IAAI,aAAa,EAC3B,MAAM,2BAA2B,CAAC;AAcnC,UAAU,eAAe;IACvB,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACnD;AAQD,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC;AAC5B,KAAK,WAAW,GAAG,eAAe,CAAC;AACn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