@cryptiklemur/lattice 1.31.0 → 1.31.1
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.31.
|
|
3
|
+
"version": "1.31.1",
|
|
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 } from "../mesh/peers";
|
|
8
|
-
import { getConnectedPeerIds } from "../mesh/connector";
|
|
8
|
+
import { getConnectedPeerIds, connectToPeer } from "../mesh/connector";
|
|
9
9
|
import type { PeerInfo } from "@lattice/shared";
|
|
10
10
|
import { networkInterfaces } from "node:os";
|
|
11
11
|
|
|
@@ -106,11 +106,14 @@ registerHandler("mesh", function (clientId: string, message: ClientMessage) {
|
|
|
106
106
|
|
|
107
107
|
pairWs.addEventListener("open", function () {
|
|
108
108
|
var identity = loadOrCreateIdentity();
|
|
109
|
+
var pairConfig = loadConfig();
|
|
109
110
|
pairWs.send(JSON.stringify({
|
|
110
111
|
type: "mesh:hello",
|
|
111
112
|
nodeId: identity.id,
|
|
112
|
-
name:
|
|
113
|
+
name: pairConfig.name,
|
|
113
114
|
token: parsed!.token,
|
|
115
|
+
port: pairConfig.port,
|
|
116
|
+
addresses: getAllAddresses().map(function (a) { return a.address + ":" + pairConfig.port; }),
|
|
114
117
|
projects: [],
|
|
115
118
|
}));
|
|
116
119
|
});
|
|
@@ -128,21 +131,24 @@ registerHandler("mesh", function (clientId: string, message: ClientMessage) {
|
|
|
128
131
|
|
|
129
132
|
if (data.type === "mesh:hello" && data.nodeId && data.name) {
|
|
130
133
|
clearTimeout(pairTimeout);
|
|
134
|
+
var peerAddr = parsed!.address + ":" + parsed!.port;
|
|
131
135
|
var peer: PeerInfo = {
|
|
132
136
|
id: data.nodeId,
|
|
133
137
|
name: data.name,
|
|
134
|
-
addresses: [
|
|
138
|
+
addresses: [peerAddr],
|
|
135
139
|
publicKey: "",
|
|
136
140
|
pairedAt: Date.now(),
|
|
137
141
|
};
|
|
138
142
|
addPeer(peer);
|
|
139
143
|
pairWs.close();
|
|
140
144
|
|
|
145
|
+
connectToPeer(peer.id, peerAddr);
|
|
146
|
+
|
|
141
147
|
var nodeInfo: NodeInfo = {
|
|
142
148
|
id: peer.id,
|
|
143
149
|
name: peer.name,
|
|
144
|
-
address:
|
|
145
|
-
addresses: [
|
|
150
|
+
address: peerAddr,
|
|
151
|
+
addresses: [peerAddr],
|
|
146
152
|
port: parsed!.port,
|
|
147
153
|
online: true,
|
|
148
154
|
isLocal: false,
|
|
@@ -164,7 +170,7 @@ registerHandler("mesh", function (clientId: string, message: ClientMessage) {
|
|
|
164
170
|
}
|
|
165
171
|
|
|
166
172
|
if ((message as any).type === "mesh:hello") {
|
|
167
|
-
var hello = message as any as { type: "mesh:hello"; nodeId: string; name: string; token?: string; projects: Array<{ slug: string; title: string }> };
|
|
173
|
+
var hello = message as any as { type: "mesh:hello"; nodeId: string; name: string; token?: string; port?: number; addresses?: string[]; projects: Array<{ slug: string; title: string }> };
|
|
168
174
|
|
|
169
175
|
if (!hello.token || !validatePairingToken(hello.token)) {
|
|
170
176
|
sendTo(clientId, { type: "mesh:hello_rejected" as any, error: "Invalid or expired invite code" });
|
|
@@ -172,15 +178,21 @@ registerHandler("mesh", function (clientId: string, message: ClientMessage) {
|
|
|
172
178
|
}
|
|
173
179
|
consumePairingToken(hello.token);
|
|
174
180
|
|
|
181
|
+
var peerAddresses = hello.addresses ?? [];
|
|
182
|
+
|
|
175
183
|
var peer: PeerInfo = {
|
|
176
184
|
id: hello.nodeId,
|
|
177
185
|
name: hello.name,
|
|
178
|
-
addresses:
|
|
186
|
+
addresses: peerAddresses,
|
|
179
187
|
publicKey: "",
|
|
180
188
|
pairedAt: Date.now(),
|
|
181
189
|
};
|
|
182
190
|
addPeer(peer);
|
|
183
191
|
|
|
192
|
+
if (peerAddresses.length > 0) {
|
|
193
|
+
connectToPeer(peer.id, peerAddresses[0]);
|
|
194
|
+
}
|
|
195
|
+
|
|
184
196
|
var identity = loadOrCreateIdentity();
|
|
185
197
|
sendTo(clientId, {
|
|
186
198
|
type: "mesh:hello" as any,
|
|
@@ -66,9 +66,10 @@ export function connectToPeer(nodeId: string, address: string): void {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
var config = loadConfig();
|
|
69
|
-
var port = config.port;
|
|
70
69
|
var protocol = config.tls ? "wss" : "ws";
|
|
71
|
-
var url =
|
|
70
|
+
var url = address.includes(":")
|
|
71
|
+
? protocol + "://" + address + "/ws"
|
|
72
|
+
: protocol + "://" + address + ":" + config.port + "/ws";
|
|
72
73
|
|
|
73
74
|
var conn: PeerConnection = {
|
|
74
75
|
nodeId: nodeId,
|