dsh-plugin-mesh 0.5.1 → 0.5.3
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/AGENTS.md +1 -1
- package/README.md +4 -5
- package/client/client.js +72 -1
- package/lib/_selftest-capabilities.mjs +68 -1
- package/lib/_selftest-diagnostics.mjs +92 -0
- package/lib/_selftest-osinfo.mjs +379 -0
- package/lib/_selftest-tsnet.mjs +26 -1
- package/lib/_selftest-workbench.mjs +53 -0
- package/lib/capabilities.js +197 -29
- package/lib/diagnostics.js +109 -0
- package/lib/discovery.js +27 -3
- package/lib/index.js +120 -29
- package/lib/osinfo.js +352 -0
- package/lib/scan.js +11 -10
- package/lib/tsnet/download.js +5 -1
- package/llms.txt +2 -0
- package/package.json +4 -2
package/lib/osinfo.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设备系统身份(osInfo / systems):平台、展示名、版本、发行版、内核、桌面环境、架构。
|
|
3
|
+
*
|
|
4
|
+
* 三层数据:
|
|
5
|
+
* · osInfo —— 宿主机(老 UI / 老对端只认这一份)
|
|
6
|
+
* · systems[] —— 这台机器上可用的系统列表:宿主机 + WSL 发行版(Windows)
|
|
7
|
+
* · capabilities —— 运行时环境(node/python/...),仍走原来的能力名片
|
|
8
|
+
*
|
|
9
|
+
* 为什么单独一个模块:
|
|
10
|
+
* · 探测有平台分支(sw_vers / /etc/os-release / 注册表 / getprop),散在 discovery 里很难测;
|
|
11
|
+
* · 结果在进程生命周期内不变,探测一次即可 —— 心跳每 5s 一次,不能每条都跑子进程;
|
|
12
|
+
* · 对端名片是网络输入,接收侧必须清洗(sanitizeOsInfo / sanitizeSystems)。
|
|
13
|
+
*
|
|
14
|
+
* WSL 只读注册表,不启动已停止的发行版:要的是"这台机器上有哪些系统",不是把它们
|
|
15
|
+
* 一个个拉起来(那会有几十秒副作用)。运行中的发行版才尝试读 /etc/os-release 补版本。
|
|
16
|
+
*/
|
|
17
|
+
import os from "node:os";
|
|
18
|
+
import { execFileSync } from "node:child_process";
|
|
19
|
+
import { readFileSync } from "node:fs";
|
|
20
|
+
|
|
21
|
+
const FIELD_MAX = {
|
|
22
|
+
name: 48,
|
|
23
|
+
version: 48,
|
|
24
|
+
distro: 32,
|
|
25
|
+
kernel: 64,
|
|
26
|
+
desktop: 32,
|
|
27
|
+
arch: 16,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const PLATFORMS = new Set(["win32", "darwin", "linux", "android"]);
|
|
31
|
+
const KINDS = new Set(["host", "wsl", "vm", "container"]);
|
|
32
|
+
/** 一台机器的名片最多列几个系统(宿主机 + 3 个额外环境),避免名片无限膨胀。 */
|
|
33
|
+
const MAX_SYSTEMS = 4;
|
|
34
|
+
/** Docker/Rancher/Podman 的 WSL 发行版不是用户系统,不列。 */
|
|
35
|
+
const NON_USER_WSL = /^(docker-desktop|rancher-desktop|podman-machine)/i;
|
|
36
|
+
const WSL_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Lxss";
|
|
37
|
+
|
|
38
|
+
/** 去控制字符、折叠空白、按字段截断。 */
|
|
39
|
+
function clean(value, max) {
|
|
40
|
+
return String(value ?? "")
|
|
41
|
+
.replace(/[\u0000-\u001f\u007f]/g, "")
|
|
42
|
+
.replace(/\s+/g, " ")
|
|
43
|
+
.trim()
|
|
44
|
+
.slice(0, max);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** 命令输出只取第一行(getprop / sw_vers 都可能带换行)。 */
|
|
48
|
+
function firstLine(value, max) {
|
|
49
|
+
return clean(String(value ?? "").split("\n")[0], max);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** 解析 /etc/os-release;引号可有可无,值里允许 `=`。 */
|
|
53
|
+
function parseOsRelease(text) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const line of String(text ?? "").split("\n")) {
|
|
56
|
+
const m = /^([A-Z_]+)=(.*)$/.exec(line.trim());
|
|
57
|
+
if (!m) continue;
|
|
58
|
+
let value = m[2].trim();
|
|
59
|
+
if (
|
|
60
|
+
(value.startsWith('"') && value.endsWith('"')) ||
|
|
61
|
+
(value.startsWith("'") && value.endsWith("'"))
|
|
62
|
+
) {
|
|
63
|
+
value = value.slice(1, -1);
|
|
64
|
+
}
|
|
65
|
+
out[m[1]] = value;
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** XDG_CURRENT_DESKTOP 常是 "ubuntu:GNOME",取最后一段。 */
|
|
71
|
+
function desktopEnv(env) {
|
|
72
|
+
const raw = String(env?.XDG_CURRENT_DESKTOP || env?.DESKTOP_SESSION || "").trim();
|
|
73
|
+
if (!raw) return "";
|
|
74
|
+
const parts = raw.split(":").map((s) => s.trim()).filter(Boolean);
|
|
75
|
+
return parts[parts.length - 1] ?? "";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function defaultRun(cmd, args) {
|
|
79
|
+
return execFileSync(cmd, args, {
|
|
80
|
+
encoding: "utf8",
|
|
81
|
+
timeout: 2000,
|
|
82
|
+
windowsHide: true,
|
|
83
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
84
|
+
}).trim();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 探测宿主机系统身份。所有参数都可注入,方便在非目标平台上用 fixture 单测。
|
|
89
|
+
*
|
|
90
|
+
* 失败一律降级为空字段 / 平台通用名,**绝不抛**:名片的缺失不能拖垮启动,
|
|
91
|
+
* 也不能把"没探到"伪装成某个具体结论。
|
|
92
|
+
*/
|
|
93
|
+
export function detectOsInfo(opts = {}) {
|
|
94
|
+
const platformRaw = String(opts.platform ?? process.platform).toLowerCase();
|
|
95
|
+
const platform = PLATFORMS.has(platformRaw) ? platformRaw : "";
|
|
96
|
+
const release = clean(opts.release ?? os.release(), FIELD_MAX.kernel);
|
|
97
|
+
const arch = clean(opts.arch ?? os.arch(), FIELD_MAX.arch);
|
|
98
|
+
const env = opts.env ?? process.env;
|
|
99
|
+
const osVersion =
|
|
100
|
+
opts.osVersion ??
|
|
101
|
+
(() => {
|
|
102
|
+
try {
|
|
103
|
+
return os.version();
|
|
104
|
+
} catch {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const readFile = opts.readFile ?? ((path) => readFileSync(path, "utf8"));
|
|
109
|
+
const run = opts.run ?? defaultRun;
|
|
110
|
+
|
|
111
|
+
let name = "";
|
|
112
|
+
let version = "";
|
|
113
|
+
let distro = "";
|
|
114
|
+
let desktop = "";
|
|
115
|
+
|
|
116
|
+
if (platformRaw === "win32") {
|
|
117
|
+
// Node 13+ 的 os.version() 已经是 "Windows 11 Home China" 这类产品名。
|
|
118
|
+
name = firstLine(osVersion(), FIELD_MAX.name) || "Windows";
|
|
119
|
+
version = release;
|
|
120
|
+
} else if (platformRaw === "darwin") {
|
|
121
|
+
try {
|
|
122
|
+
name = firstLine(run("sw_vers", ["-productName"]), FIELD_MAX.name);
|
|
123
|
+
} catch {
|
|
124
|
+
name = "";
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
version = firstLine(run("sw_vers", ["-productVersion"]), FIELD_MAX.version);
|
|
128
|
+
} catch {
|
|
129
|
+
version = "";
|
|
130
|
+
}
|
|
131
|
+
name = name || "macOS";
|
|
132
|
+
} else if (platformRaw === "linux") {
|
|
133
|
+
try {
|
|
134
|
+
const rel = parseOsRelease(readFile("/etc/os-release"));
|
|
135
|
+
name = clean(rel.NAME || rel.PRETTY_NAME || rel.ID || "Linux", FIELD_MAX.name);
|
|
136
|
+
version = clean(rel.VERSION_ID || "", FIELD_MAX.version);
|
|
137
|
+
distro = clean(rel.ID || "", FIELD_MAX.distro);
|
|
138
|
+
} catch {
|
|
139
|
+
name = "Linux";
|
|
140
|
+
}
|
|
141
|
+
desktop = clean(desktopEnv(env), FIELD_MAX.desktop);
|
|
142
|
+
} else if (platformRaw === "android") {
|
|
143
|
+
name = "Android";
|
|
144
|
+
try {
|
|
145
|
+
version = firstLine(run("getprop", ["ro.build.version.release"]), FIELD_MAX.version);
|
|
146
|
+
} catch {
|
|
147
|
+
version = "";
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
// 未知平台(FreeBSD 等)至少给个可读名字;platform 留空让 UI 用回退徽章。
|
|
151
|
+
name = clean(platformRaw, FIELD_MAX.name);
|
|
152
|
+
version = release;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return sanitizeOsInfo({
|
|
156
|
+
platform,
|
|
157
|
+
name,
|
|
158
|
+
version,
|
|
159
|
+
distro,
|
|
160
|
+
kernel: release,
|
|
161
|
+
desktop,
|
|
162
|
+
arch,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 清洗对端名片里的单个系统。
|
|
168
|
+
*
|
|
169
|
+
* platform 走白名单(UI 的 logo 映射只认这四个);文本字段控制字符剥掉并截断。
|
|
170
|
+
* 返回 null 表示"对端没报 / 报的东西不可用",UI 应回退到老的 os 字符串。
|
|
171
|
+
*/
|
|
172
|
+
export function sanitizeOsInfo(raw) {
|
|
173
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
174
|
+
const platform = PLATFORMS.has(String(raw.platform ?? "").toLowerCase())
|
|
175
|
+
? String(raw.platform).toLowerCase()
|
|
176
|
+
: "";
|
|
177
|
+
const out = {
|
|
178
|
+
platform,
|
|
179
|
+
name: clean(raw.name, FIELD_MAX.name),
|
|
180
|
+
version: clean(raw.version, FIELD_MAX.version),
|
|
181
|
+
distro: clean(raw.distro, FIELD_MAX.distro),
|
|
182
|
+
kernel: clean(raw.kernel, FIELD_MAX.kernel),
|
|
183
|
+
desktop: clean(raw.desktop, FIELD_MAX.desktop),
|
|
184
|
+
arch: clean(raw.arch, FIELD_MAX.arch),
|
|
185
|
+
};
|
|
186
|
+
if (!out.platform && !out.name) return null;
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** 解析 `reg query ...\Lxss /s` 的输出,每个 `{guid}` 块一条记录。 */
|
|
191
|
+
function parseWslRegistry(text) {
|
|
192
|
+
const blocks = [];
|
|
193
|
+
let cur = null;
|
|
194
|
+
for (const raw of String(text ?? "").split(/\r?\n/)) {
|
|
195
|
+
const line = raw.trim();
|
|
196
|
+
if (!line) continue;
|
|
197
|
+
if (/^HKEY_/i.test(line)) {
|
|
198
|
+
if (cur) blocks.push(cur);
|
|
199
|
+
cur = {};
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const m = /^(\w+)\s+REG_(?:SZ|DWORD|EXPAND_SZ)\s+(.+)$/i.exec(line);
|
|
203
|
+
if (m && cur) cur[m[1]] = m[2].trim();
|
|
204
|
+
}
|
|
205
|
+
if (cur) blocks.push(cur);
|
|
206
|
+
return blocks.filter((b) => b && b.DistributionName);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 运行中的 WSL 发行版,尝试从 9p 挂载读 /etc/os-release 补版本。
|
|
211
|
+
* 停着的发行版不碰(不启动它);读不到就只报注册表里的名字。
|
|
212
|
+
*/
|
|
213
|
+
function readWslOsRelease(name, readFile) {
|
|
214
|
+
for (const root of ["\\\\wsl.localhost\\", "\\\\wsl$\\"]) {
|
|
215
|
+
try {
|
|
216
|
+
const rel = parseOsRelease(readFile(`${root}${name}\\etc\\os-release`));
|
|
217
|
+
if (rel.NAME || rel.ID) return rel;
|
|
218
|
+
} catch {
|
|
219
|
+
/* 没运行 / 9p 不可访问 */
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 从注册表列 WSL 发行版(只读,不启动任何发行版)。
|
|
227
|
+
* 运行时探测也用它判断哪些发行版处于 running 状态。
|
|
228
|
+
*/
|
|
229
|
+
export function wslTargets(opts = {}) {
|
|
230
|
+
const run = opts.run ?? defaultRun;
|
|
231
|
+
let text;
|
|
232
|
+
try {
|
|
233
|
+
text = run("reg", ["query", WSL_KEY, "/s"]);
|
|
234
|
+
} catch {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const out = [];
|
|
239
|
+
for (const block of parseWslRegistry(text)) {
|
|
240
|
+
const name = String(block.DistributionName ?? "").trim();
|
|
241
|
+
if (!name || NON_USER_WSL.test(name)) continue;
|
|
242
|
+
out.push({
|
|
243
|
+
name,
|
|
244
|
+
running: parseInt(String(block.State ?? ""), 0) === 1,
|
|
245
|
+
osVersion: String(block.OsVersion ?? "").trim(),
|
|
246
|
+
flavor: String(block.Flavor ?? "").trim().toLowerCase(),
|
|
247
|
+
});
|
|
248
|
+
if (out.length >= MAX_SYSTEMS - 1) break;
|
|
249
|
+
}
|
|
250
|
+
return out;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** 把注册表目标变成 systems[] 里的条目(运行中的才补 os-release 版本)。 */
|
|
254
|
+
function detectWsl(opts = {}) {
|
|
255
|
+
const readFile = opts.readFile ?? ((path) => readFileSync(path, "utf8"));
|
|
256
|
+
const out = [];
|
|
257
|
+
for (const target of wslTargets(opts)) {
|
|
258
|
+
let name = target.name;
|
|
259
|
+
let version = target.osVersion;
|
|
260
|
+
let distro = target.flavor;
|
|
261
|
+
|
|
262
|
+
if ((!version || !distro) && target.running) {
|
|
263
|
+
const rel = readWslOsRelease(target.name, readFile);
|
|
264
|
+
if (rel) {
|
|
265
|
+
name = clean(rel.NAME || name, FIELD_MAX.name);
|
|
266
|
+
version = version || clean(rel.VERSION_ID || "", FIELD_MAX.version);
|
|
267
|
+
distro = distro || clean(rel.ID || "", FIELD_MAX.distro).toLowerCase();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
out.push({
|
|
272
|
+
kind: "wsl",
|
|
273
|
+
platform: "linux",
|
|
274
|
+
name: clean(name, FIELD_MAX.name),
|
|
275
|
+
version: clean(version, FIELD_MAX.version),
|
|
276
|
+
distro: clean(distro, FIELD_MAX.distro),
|
|
277
|
+
// WSL 的 kernel/desktop/arch 不启动发行版拿不到,留空比瞎猜好。
|
|
278
|
+
kernel: "",
|
|
279
|
+
desktop: "",
|
|
280
|
+
arch: "",
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
return out;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** 本机系统列表:宿主机第一,后面是 WSL 等额外环境。 */
|
|
287
|
+
export function detectSystems(opts = {}) {
|
|
288
|
+
const host = detectOsInfo(opts);
|
|
289
|
+
const platform = String(opts.platform ?? process.platform);
|
|
290
|
+
const extra = platform === "win32" ? detectWsl(opts) : [];
|
|
291
|
+
return sanitizeSystems([{ kind: "host", ...host }, ...extra]) ?? [];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 清洗对端名片里的 systems[]:逐项复用 sanitizeOsInfo,kind 走白名单,
|
|
296
|
+
* 去重、最多 MAX_SYSTEMS 项,宿主机排第一。
|
|
297
|
+
*/
|
|
298
|
+
export function sanitizeSystems(raw) {
|
|
299
|
+
if (!Array.isArray(raw)) return null;
|
|
300
|
+
const out = [];
|
|
301
|
+
const seen = new Set();
|
|
302
|
+
for (const item of raw) {
|
|
303
|
+
const info = sanitizeOsInfo(item);
|
|
304
|
+
if (!info) continue;
|
|
305
|
+
const kindRaw = String(item?.kind ?? "").toLowerCase();
|
|
306
|
+
const kind = KINDS.has(kindRaw) ? kindRaw : "";
|
|
307
|
+
const key = `${kind}|${info.platform}|${info.name}|${info.version}`;
|
|
308
|
+
if (seen.has(key)) continue;
|
|
309
|
+
seen.add(key);
|
|
310
|
+
out.push({ kind, ...info });
|
|
311
|
+
if (out.length >= MAX_SYSTEMS * 2) break;
|
|
312
|
+
}
|
|
313
|
+
if (out.length === 0) return null;
|
|
314
|
+
// 宿主机排第一;其余保持到达顺序(stable sort)。
|
|
315
|
+
out.sort((a, b) => (a.kind === "host" ? 0 : 1) - (b.kind === "host" ? 0 : 1));
|
|
316
|
+
return out.slice(0, MAX_SYSTEMS);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
let cached;
|
|
320
|
+
let cachedSystems;
|
|
321
|
+
|
|
322
|
+
/** 宿主机系统身份,进程内只探测一次。 */
|
|
323
|
+
export function osInfo() {
|
|
324
|
+
if (cached === undefined) {
|
|
325
|
+
try {
|
|
326
|
+
cached = detectOsInfo();
|
|
327
|
+
} catch {
|
|
328
|
+
cached = null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return cached;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** 本机系统列表(宿主机 + WSL),进程内只探测一次。 */
|
|
335
|
+
export function systems() {
|
|
336
|
+
if (cachedSystems === undefined) {
|
|
337
|
+
try {
|
|
338
|
+
const host = osInfo();
|
|
339
|
+
const extra = process.platform === "win32" ? detectWsl() : [];
|
|
340
|
+
cachedSystems = sanitizeSystems(host ? [{ kind: "host", ...host }, ...extra] : extra);
|
|
341
|
+
} catch {
|
|
342
|
+
cachedSystems = null;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return cachedSystems;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** 只为自测:清掉缓存,避免 fixture 之间互相污染。 */
|
|
349
|
+
export function __resetOsInfoCache() {
|
|
350
|
+
cached = undefined;
|
|
351
|
+
cachedSystems = undefined;
|
|
352
|
+
}
|
package/lib/scan.js
CHANGED
|
@@ -25,20 +25,21 @@ export function candidateAddresses(extraRanges = [], limit = 1024) {
|
|
|
25
25
|
out.push(ip);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
28
|
+
// 本机所在 /24 **始终**要扫:scanRanges 是"额外"网段,不是替代品。
|
|
29
|
+
//
|
|
30
|
+
// 原来的实现一旦配了 scanRanges 就丢掉本机 /24;更糟的是 CIDR 写错时
|
|
31
|
+
// expandCidr 返回空数组,于是"扫描"变成 0 个地址且没有任何报错 ——
|
|
32
|
+
// 主动发现完全失效,界面却只显示"命中 0 台"。
|
|
33
33
|
//
|
|
34
34
|
// 注意:这里**不排除本机 IP**。因为同机跑多个实例时它们共用一个 IP,
|
|
35
35
|
// 排掉就永远发现不了彼此;而扫到自己也无害 —— discovery.note() 会按
|
|
36
36
|
// 实例 id 把自身拒掉。
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
for (const { address } of lanIPv4Addresses()) {
|
|
38
|
+
const prefix = address.slice(0, address.lastIndexOf("."));
|
|
39
|
+
for (let host = 1; host <= 254; host += 1) push(`${prefix}.${host}`);
|
|
40
|
+
}
|
|
41
|
+
for (const range of extraRanges) {
|
|
42
|
+
for (const ip of expandCidr(range)) push(ip);
|
|
42
43
|
}
|
|
43
44
|
return out;
|
|
44
45
|
}
|
package/lib/tsnet/download.js
CHANGED
|
@@ -66,7 +66,11 @@ export function detectTarget() {
|
|
|
66
66
|
/** 本平台对应的资产名,例如 dsh-mesh-tsnet-darwin-amd64.gz */
|
|
67
67
|
export function assetName() {
|
|
68
68
|
const { os, arch } = detectTarget();
|
|
69
|
-
|
|
69
|
+
// Windows release assets carry .exe before .gz (see build-sidecar.sh and
|
|
70
|
+
// PINNED_CHECKSUMS). Without it every mirror 404s and the checksum lookup
|
|
71
|
+
// silently misses, so the binary is never verified and never refreshed.
|
|
72
|
+
const exe = os === "windows" ? ".exe" : "";
|
|
73
|
+
return `dsh-mesh-tsnet-${os}-${arch}${exe}.gz`;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/** 缓存目录:~/.dsh/mesh/bin/sidecar-v1/ */
|
package/llms.txt
CHANGED
|
@@ -28,6 +28,8 @@ Verify after restart: `GET http://127.0.0.1:45917/mesh/v1/health` returns JSON c
|
|
|
28
28
|
- Serves a small HTTP peer API on TCP port 45917 (configurable via `port`).
|
|
29
29
|
- Optionally starts a bundled Go sidecar running a userspace Tailscale node (tsnet). No TUN device is created, so the host cannot route to `100.x.y.z`; all tailnet traffic is proxied through the sidecar. The binary is downloaded per-platform on first use and verified against checksums pinned in the plugin source.
|
|
30
30
|
- Auto-creates an agent session on the receiving machine when a task arrives, then routes that task to a new or reused session.
|
|
31
|
+
- Reports a structured `osInfo` card entry (host) and a `systems[]` array: host first, then environments such as WSL distros on Windows (`kind: "wsl"`, Linux `platform`, distro name/version). Older peers only send `os`, and the UI falls back to parsing it; purely display data, at most 4 systems.
|
|
32
|
+
- On Windows, probes runtimes inside **running** WSL distros (`wsl.exe -d <name> -e sh -lc …`) and reports them as `capabilities.wsl[]`; stopped distros are never started just to probe. Host and WSL runtimes are displayed separately.
|
|
31
33
|
|
|
32
34
|
## Tools registered (callable by the agent)
|
|
33
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-mesh",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DSH Mesh:局域网自动发现同网段的 DSH 实例、显示每台机器上报的能力,并双向派发任务;可用内置的用户态 Tailscale 节点跨互联网组网。Discovers other DSH instances on the LAN, shows the capabilities each one reports, and dispatches tasks between machines in both directions, with an optional userspace Tailscale node for links across networks.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,9 @@
|
|
|
64
64
|
"selftest:persist": "node lib/_selftest-persist.mjs",
|
|
65
65
|
"selftest:reasoning": "node lib/_selftest-reasoning.mjs",
|
|
66
66
|
"selftest:layout": "node lib/_selftest-layout.mjs",
|
|
67
|
-
"
|
|
67
|
+
"selftest:diagnostics": "node lib/_selftest-diagnostics.mjs",
|
|
68
|
+
"selftest:osinfo": "node lib/_selftest-osinfo.mjs",
|
|
69
|
+
"test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:pairing && npm run selftest:client && npm run selftest:caps && npm run selftest:release && npm run selftest:reply && npm run selftest:reasoning && npm run selftest:resume && npm run selftest:persist && npm run selftest:layout && npm run selftest:diagnostics && npm run selftest:osinfo",
|
|
68
70
|
"check": "node scripts/check-version.mjs && node scripts/check-tdz.mjs && node --check lib/index.js && node --check lib/layout.js && node --check lib/discovery.js && node --check lib/conversation.js && node --check lib/identity.js && node --check lib/capabilities.js && node --check lib/prompt.js && node --check lib/pairing.js && node --check lib/scan.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
|
|
69
71
|
"build:sidecar": "bash scripts/build-sidecar.sh",
|
|
70
72
|
"verify:mirror": "node scripts/verify-lan-mirror.mjs",
|