@cryptiklemur/lattice 1.34.0 → 1.35.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 +1 -1
- package/server/src/handlers/mesh.ts +44 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptiklemur/lattice",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.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>",
|
|
@@ -8,6 +8,8 @@ import { addPeer, removePeer, loadPeers, getPeer } from "../mesh/peers";
|
|
|
8
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
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { execSync } from "node:child_process";
|
|
11
13
|
|
|
12
14
|
function getLocalAddress(): string {
|
|
13
15
|
var all = getAllAddresses();
|
|
@@ -27,6 +29,48 @@ function getAllAddresses(): Array<{ name: string; address: string }> {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
}
|
|
32
|
+
|
|
33
|
+
if (isWSL()) {
|
|
34
|
+
var windowsAddrs = getWindowsHostAddresses();
|
|
35
|
+
for (var w = 0; w < windowsAddrs.length; w++) {
|
|
36
|
+
var exists = results.some(function (r) { return r.address === windowsAddrs[w].address; });
|
|
37
|
+
if (!exists) {
|
|
38
|
+
results.push(windowsAddrs[w]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return results;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isWSL(): boolean {
|
|
47
|
+
try {
|
|
48
|
+
if (existsSync("/proc/version")) {
|
|
49
|
+
var version = readFileSync("/proc/version", "utf-8");
|
|
50
|
+
return version.toLowerCase().includes("microsoft");
|
|
51
|
+
}
|
|
52
|
+
} catch {}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getWindowsHostAddresses(): Array<{ name: string; address: string }> {
|
|
57
|
+
var results: Array<{ name: string; address: string }> = [];
|
|
58
|
+
try {
|
|
59
|
+
var output = execSync(
|
|
60
|
+
"powershell.exe -NoProfile -Command \"Get-NetIPAddress -AddressFamily IPv4 | ForEach-Object { \\$_.IPAddress + '|' + \\$_.InterfaceAlias }\"",
|
|
61
|
+
{ encoding: "utf-8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }
|
|
62
|
+
);
|
|
63
|
+
var lines = output.trim().split(/\r?\n/);
|
|
64
|
+
for (var i = 0; i < lines.length; i++) {
|
|
65
|
+
var parts = lines[i].trim().split("|");
|
|
66
|
+
var ip = parts[0];
|
|
67
|
+
var iface = parts[1] || "windows";
|
|
68
|
+
if (!ip || ip === "127.0.0.1") continue;
|
|
69
|
+
if (ip.startsWith("169.254.")) continue;
|
|
70
|
+
if (iface.includes("WSL")) continue;
|
|
71
|
+
results.push({ name: iface.toLowerCase().replace(/\s+/g, "-"), address: ip });
|
|
72
|
+
}
|
|
73
|
+
} catch {}
|
|
30
74
|
return results;
|
|
31
75
|
}
|
|
32
76
|
|