@cryptiklemur/lattice 1.33.0 → 1.34.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptiklemur/lattice",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aaron Scherer <me@aaronscherer.me>",
|
|
@@ -5,7 +5,7 @@ import { loadConfig } from "../config";
|
|
|
5
5
|
import { loadOrCreateIdentity } from "../identity";
|
|
6
6
|
import { generateInviteCode, parseInviteCode, validatePairingToken, consumePairingToken } from "../mesh/pairing";
|
|
7
7
|
import { addPeer, removePeer, loadPeers, getPeer } from "../mesh/peers";
|
|
8
|
-
import { getConnectedPeerIds, connectToPeer, reconnectPeer } from "../mesh/connector";
|
|
8
|
+
import { getConnectedPeerIds, connectToPeer, reconnectPeer, getPeerConnection, disconnectPeer } from "../mesh/connector";
|
|
9
9
|
import type { PeerInfo } from "@lattice/shared";
|
|
10
10
|
import { networkInterfaces } from "node:os";
|
|
11
11
|
|
|
@@ -237,10 +237,26 @@ registerHandler("mesh", function (clientId: string, message: ClientMessage) {
|
|
|
237
237
|
|
|
238
238
|
if (message.type === "mesh:unpair") {
|
|
239
239
|
var unpairMsg = message as MeshUnpairMessage;
|
|
240
|
+
var identity = loadOrCreateIdentity();
|
|
241
|
+
var peerWs = getPeerConnection(unpairMsg.nodeId);
|
|
242
|
+
if (peerWs) {
|
|
243
|
+
peerWs.send(JSON.stringify({ type: "mesh:unpaired", nodeId: identity.id }));
|
|
244
|
+
}
|
|
245
|
+
disconnectPeer(unpairMsg.nodeId);
|
|
240
246
|
var removed = removePeer(unpairMsg.nodeId);
|
|
241
247
|
if (removed) {
|
|
242
248
|
broadcast({ type: "mesh:nodes", nodes: buildNodesMessage() });
|
|
243
249
|
}
|
|
244
250
|
return;
|
|
245
251
|
}
|
|
252
|
+
|
|
253
|
+
if ((message as any).type === "mesh:unpaired") {
|
|
254
|
+
var unpaired = message as any as { type: "mesh:unpaired"; nodeId: string };
|
|
255
|
+
disconnectPeer(unpaired.nodeId);
|
|
256
|
+
var wasRemoved = removePeer(unpaired.nodeId);
|
|
257
|
+
if (wasRemoved) {
|
|
258
|
+
broadcast({ type: "mesh:nodes", nodes: buildNodesMessage() });
|
|
259
|
+
}
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
246
262
|
});
|
|
@@ -239,6 +239,20 @@ export function getPeerConnection(nodeId: string): WebSocket | undefined {
|
|
|
239
239
|
return conn.ws;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
export function disconnectPeer(nodeId: string): void {
|
|
243
|
+
var existing = connections.get(nodeId);
|
|
244
|
+
if (existing) {
|
|
245
|
+
existing.dead = true;
|
|
246
|
+
if (existing.retryTimer !== null) {
|
|
247
|
+
clearTimeout(existing.retryTimer);
|
|
248
|
+
existing.retryTimer = null;
|
|
249
|
+
}
|
|
250
|
+
existing.ws.close();
|
|
251
|
+
connections.delete(nodeId);
|
|
252
|
+
}
|
|
253
|
+
circuitBreakers.delete(nodeId);
|
|
254
|
+
}
|
|
255
|
+
|
|
242
256
|
export function reconnectPeer(nodeId: string): void {
|
|
243
257
|
var existing = connections.get(nodeId);
|
|
244
258
|
if (existing) {
|