dsh-plugin-mesh 0.5.20 → 0.5.21
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 +9 -0
- package/README.md +32 -1
- package/lib/_selftest-ssh-dep.mjs +93 -0
- package/lib/index.js +1 -1
- package/lib/ssh-host.js +21 -6
- package/llms.txt +27 -2
- package/package.json +6 -7
- package/scripts/check-install-safe.mjs +85 -0
package/AGENTS.md
CHANGED
|
@@ -88,6 +88,14 @@ unless the request carries the renderer token).
|
|
|
88
88
|
"wired but not actually connected" changes (a gate that was only mentioned in a
|
|
89
89
|
comment, `install.sh` not copying `scripts/`, a placeholder that hid a missing
|
|
90
90
|
file). When you add a gate, prove it has teeth: break the input and watch it fail.
|
|
91
|
+
8. **No runtime dependencies that need build scripts.** Installing must be plain
|
|
92
|
+
unpacking. 0.5.6–0.5.20 pulled `ssh2` into `dependencies`; its `install: node
|
|
93
|
+
install.js` script made the **whole install fail on iPad** (DSH Go):
|
|
94
|
+
`[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: cpu-features, ssh2`, while
|
|
95
|
+
0.5.5 (zero deps) installed clean in the same installer. `optionalDependencies`
|
|
96
|
+
does **not** help — same error. Optional features (SSH/`ssh2`) must be lazily
|
|
97
|
+
`require()`d with an actionable message when absent. `scripts/check-install-safe.mjs`
|
|
98
|
+
enforces this in `npm run check`.
|
|
91
99
|
|
|
92
100
|
## 4. Architecture map
|
|
93
101
|
|
|
@@ -130,6 +138,7 @@ inject the prompt → the peer's agent replies by calling `mesh_run`.
|
|
|
130
138
|
| Kill switch | `npm run selftest:switch` | shutdown merge rules: `off` defaults to true, `all` closes both scopes, strict booleans only (15) |
|
|
131
139
|
| Update check | `npm run selftest:update` | version compare/prerelease, registry fallback, "failure is not up-to-date" (22) |
|
|
132
140
|
| One-click upgrade | `npm run selftest:upgrade` | integrity, tar paths, change classification, atomic swap/rollback (26) |
|
|
141
|
+
| Missing `ssh2` | `npm run selftest:sshdep` | SSH must say "ssh2 not installed" (with a fix command), never "peer rejected our key" |
|
|
133
142
|
|
|
134
143
|
`lib/_selftest-newsession.mjs` is a manual end-to-end check that needs a dev host
|
|
135
144
|
running; it is deliberately not part of `npm test` because it creates real agent
|
package/README.md
CHANGED
|
@@ -58,7 +58,10 @@ dsh plugin add dsh-plugin-mesh
|
|
|
58
58
|
|
|
59
59
|
- `desktop` profile 要在 **DSH Desktop 自带的终端**里跑(普通终端会被 dsh 拒绝);
|
|
60
60
|
- 其它 profile 用普通终端即可;
|
|
61
|
-
- 装完**必须重启一次 DSH** ——
|
|
61
|
+
- 装完**必须重启一次 DSH** —— 插件在启动时加载;
|
|
62
|
+
- 插件**零运行时依赖**:安装只解包,不跑构建脚本 —— 所以 iPad(DSH Go)这类不允许
|
|
63
|
+
依赖跑构建脚本的宿主也装得上。只有「SSH 终端」要一个可选模块 `ssh2`(默认不装,
|
|
64
|
+
缺了只影响 SSH),要用时在 profile 目录 `pnpm add ssh2`。
|
|
62
65
|
|
|
63
66
|
**第 2 步 · 起个名字**
|
|
64
67
|
|
|
@@ -114,13 +117,41 @@ macOS(Intel / Apple Silicon)· Windows · Linux · Android(Termux)· WSL
|
|
|
114
117
|
|
|
115
118
|
---
|
|
116
119
|
|
|
120
|
+
## 路线图:往哪走(每个方向都会演化)
|
|
121
|
+
|
|
122
|
+
七个方向各自迭代 v1/v2/v3,**版本号是能力增量,不是时间,也不跨方向对齐**。
|
|
123
|
+
方向之间没有全局顺序,只有**闸门** —— 多数方向的下一版都等 R-v1(事件层)先到位,其余可以并行。
|
|
124
|
+
|
|
125
|
+
| 方向 | 现在 | 下一版 | 子路线图 |
|
|
126
|
+
|---|---|---|---|
|
|
127
|
+
| **会话事件智能路由** | 派出即止,无终态 | 调用事件流模型重构 + 任务流水账(journal) + 结果信封 + 取消 | [route](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/route.md) |
|
|
128
|
+
| **接入** | DSH + MCP 手接 | MCP · Skills<br>CC / Codex / WorkBuddy / opencode / VS Code / Copilot 等适配<br>dshInWeb 适配 | [adapter](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/adapter.md) |
|
|
129
|
+
| **trace** | 无 | 状态时间线(等 R-v1) | [trace](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/trace.md) |
|
|
130
|
+
| **玩法** | 一对一派发 | 组群 | [play](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/play.md) |
|
|
131
|
+
| **界面** | 面板 + 任务列表 | 结果卡 + 通知 + `mesh demo` | [ui](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/ui.md) |
|
|
132
|
+
| **协议** | 两份实现(`lib/` + `mcp-mesh`) | 收编成一份 + 名片区 v3 | [protocol](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/protocol.md) |
|
|
133
|
+
| **安全** | 同网段默认可派 | 幽灵对端校验 + 高危动作确认 | [security](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/roadmap/security.md) |
|
|
134
|
+
|
|
135
|
+
每个子路线图里都有:**现状证据 → 版本史(v0 已发布 / v1 计划 / v2、v3 条件)→ 各版验收判据 → 闸门 → 不做什么**。
|
|
136
|
+
版本细则发版时追加,不覆盖历史。
|
|
137
|
+
|
|
138
|
+
**今天就缺的那一件**:派出去的任务没有终态 —— 返回 `200` 只说明对端**收下了**,
|
|
139
|
+
不代表跑完了,也不能取消。它闸住了 trace / 结果卡 / 扇出三条方向。
|
|
140
|
+
|
|
141
|
+
完整矩阵(v2/v3、闸门表、验收判据、指标、风险、明确不做什么)见
|
|
142
|
+
[`ROADMAP.md`](https://github.com/peng456/dsh-plugin-mesh/blob/main/ROADMAP.md)。
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
117
146
|
## 深入阅读
|
|
118
147
|
|
|
119
148
|
| 想要什么 | 去哪 |
|
|
120
149
|
|---|---|
|
|
150
|
+
| 路线图、决策记录、指标与不做什么 | [`ROADMAP.md`](https://github.com/peng456/dsh-plugin-mesh/blob/main/ROADMAP.md) |
|
|
121
151
|
| 给 agent 的机器可读事实(工具、配置项、端口) | [`llms.txt`](llms.txt) |
|
|
122
152
|
| 英文快速上手 | [`README.en.md`](README.en.md) |
|
|
123
153
|
| 设计取舍、组播/防火墙/tsnet 细节、配置项全表、排障 | [`docs/DESIGN-NOTES.md`](https://github.com/peng456/dsh-plugin-mesh/blob/main/docs/DESIGN-NOTES.md) |
|
|
154
|
+
| 设计与实施记录(任务追踪 / 同机多 agent / 身份与通道 / 放置) | [`docs/design/`](https://github.com/peng456/dsh-plugin-mesh/tree/main/docs/design) |
|
|
124
155
|
| 改这个仓库前的硬约束与坑 | [`AGENTS.md`](AGENTS.md) |
|
|
125
156
|
| 参与开发、发版流程 | [`CONTRIBUTING.md`](CONTRIBUTING.md) |
|
|
126
157
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「ssh2 没装」这句话的自测。
|
|
3
|
+
*
|
|
4
|
+
* 守的是一个用户可见的误导:ssh2 不再是插件的依赖(原因见 `lib/ssh-host.js`
|
|
5
|
+
* 文件头和 `scripts/check-install-safe.mjs`),所以**大部分机器上它都没装**。
|
|
6
|
+
* 而 `open()` 会先拿密钥试一次,模块缺失会让那一步失败 —— 如果不管,最后会被包成
|
|
7
|
+
*
|
|
8
|
+
* 对端拒绝了本机保存的密钥(…)。改用密码登录一次即可…
|
|
9
|
+
*
|
|
10
|
+
* 用户照着这句话去重新部署密钥,永远修不好一个"没装模块"的问题(2026-11-23 实测
|
|
11
|
+
* 就是这个错法)。所以这里把两条都钉住:
|
|
12
|
+
* · 缺 ssh2 → 说"没装",并给出能动手的命令;
|
|
13
|
+
* · 这条错误不许出现"对端拒绝了本机保存的密钥"。
|
|
14
|
+
*
|
|
15
|
+
* 做法是把 `ssh-host.js`(只依赖 node 内置模块)复制到一个没有 node_modules 的
|
|
16
|
+
* 临时目录里 import —— 那个位置一定解析不到 ssh2,等于真实缺依赖的机器。
|
|
17
|
+
*
|
|
18
|
+
* node lib/_selftest-ssh-dep.mjs
|
|
19
|
+
*/
|
|
20
|
+
import { strict as assert } from "node:assert";
|
|
21
|
+
import { execFileSync } from "node:child_process";
|
|
22
|
+
import { copyFileSync, mkdtempSync, rmSync } from "node:fs";
|
|
23
|
+
import { tmpdir } from "node:os";
|
|
24
|
+
import { dirname, join } from "node:path";
|
|
25
|
+
import { fileURLToPath } from "node:url";
|
|
26
|
+
|
|
27
|
+
let passed = 0;
|
|
28
|
+
let failed = 0;
|
|
29
|
+
function test(name, fn) {
|
|
30
|
+
try {
|
|
31
|
+
fn();
|
|
32
|
+
passed += 1;
|
|
33
|
+
console.log(` ✓ ${name}`);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
failed += 1;
|
|
36
|
+
console.log(` ✗ ${name}`);
|
|
37
|
+
console.log(` ${err?.message ?? err}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
const sandbox = mkdtempSync(join(tmpdir(), "mesh-ssh-dep-"));
|
|
43
|
+
|
|
44
|
+
/** 在沙箱里跑一次 open(),把真实错误消息捞回来。 */
|
|
45
|
+
function openWithoutSsh2() {
|
|
46
|
+
copyFileSync(join(here, "ssh-host.js"), join(sandbox, "ssh-host.js"));
|
|
47
|
+
const code = `
|
|
48
|
+
const { createSshManager } = await import(${JSON.stringify(join(sandbox, "ssh-host.js"))});
|
|
49
|
+
const stateDir = ${JSON.stringify(join(sandbox, "state"))};
|
|
50
|
+
const ssh = createSshManager({ stateDir, credentialsPath: stateDir + "/creds.json" });
|
|
51
|
+
try {
|
|
52
|
+
await ssh.open({ machine: "peer", host: "127.0.0.1", port: 1, username: "nobody" });
|
|
53
|
+
console.log("NO_ERROR");
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.log(String(err && err.message ? err.message : err));
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
return execFileSync(process.execPath, ["--input-type=module", "-e", code], {
|
|
59
|
+
encoding: "utf8",
|
|
60
|
+
timeout: 20000,
|
|
61
|
+
cwd: sandbox,
|
|
62
|
+
}).trim();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log("\n── 缺 ssh2 时的说法 ──");
|
|
66
|
+
|
|
67
|
+
let message = "";
|
|
68
|
+
test("能拿到一条错误消息(不是静默成功)", () => {
|
|
69
|
+
message = openWithoutSsh2();
|
|
70
|
+
assert.ok(message && message !== "NO_ERROR", `期望报错,实际:${message}`);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("说清是「没装 ssh2」,而不是其它原因", () => {
|
|
74
|
+
assert.match(message, /ssh2/);
|
|
75
|
+
assert.match(message, /没装/);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("给出能动手的命令", () => {
|
|
79
|
+
assert.match(message, /pnpm add ssh2/);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("不把「没装模块」伪装成「对端拒绝了密钥」", () => {
|
|
83
|
+
assert.doesNotMatch(message, /对端拒绝了本机保存的密钥/);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("是单行消息(原始 Require stack 不糊进面板)", () => {
|
|
87
|
+
assert.equal(message.split("\n").length, 1, `实际:${JSON.stringify(message)}`);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
rmSync(sandbox, { recursive: true, force: true });
|
|
91
|
+
|
|
92
|
+
console.log(`\n${failed === 0 ? "全部通过" : "有失败"}:${passed} 通过 / ${failed} 失败\n`);
|
|
93
|
+
process.exit(failed === 0 ? 0 : 1);
|
package/lib/index.js
CHANGED
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
export const name = "dsh-plugin-mesh";
|
|
131
131
|
export const inject = ["tools", "webServer"];
|
|
132
132
|
|
|
133
|
-
const VERSION = "0.5.
|
|
133
|
+
const VERSION = "0.5.21";
|
|
134
134
|
// 诊断用:进程启动时间 + 入口真实路径。磁盘上的版本**不在这里缓存** ——
|
|
135
135
|
// 升级之后进程还跑旧代码,版本号必须现读磁盘才能立刻反映出来(真踩过:
|
|
136
136
|
// 磁盘升到 0.5.1,进程还在 0.5.0,界面显示 0.5.0)。
|
package/lib/ssh-host.js
CHANGED
|
@@ -19,13 +19,20 @@ import { dirname, join } from "node:path";
|
|
|
19
19
|
const RING_LIMIT = 200 * 1024;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* ssh2 必须**懒加载**,不能在模块顶层静态 import
|
|
22
|
+
* ssh2 必须**懒加载**,不能在模块顶层静态 import,也**不能写进 package.json 的依赖**。
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* 懒加载的理由:CI 里跑 `npm test` 的机器不装依赖(这个项目零运行时依赖,测试
|
|
25
25
|
* 也不需要 node_modules);静态 import 会让 `lib/index.js` 一被加载就
|
|
26
26
|
* ERR_MODULE_NOT_FOUND,连不碰 SSH 的整套自测都红(实测 2026-10-29,ci 三条
|
|
27
|
-
* job
|
|
28
|
-
*
|
|
27
|
+
* job 全红)。
|
|
28
|
+
*
|
|
29
|
+
* 不写进依赖的理由(真实事故,2026-11-23):ssh2 带一个安装脚本
|
|
30
|
+
* `install: node install.js`(编译可选的原生加速模块 cpu-features)。宿主不允许
|
|
31
|
+
* 依赖跑构建脚本时,pnpm 会整次安装失败 —— iPad 上的 DSH Go 就抛
|
|
32
|
+
* `[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: cpu-features, ssh2`,
|
|
33
|
+
* 0.5.6–0.5.20 因此根本装不上 iPad(0.5.5 零依赖,同一个安装器干净通过)。
|
|
34
|
+
* 所以 SSH 变成"要用的人自己装":`package.json` 里没有它,缺了只影响 SSH 面板,
|
|
35
|
+
* 其余 mesh 功能照常。
|
|
29
36
|
*/
|
|
30
37
|
let ssh2Module;
|
|
31
38
|
function loadSsh2() {
|
|
@@ -37,9 +44,13 @@ function loadSsh2() {
|
|
|
37
44
|
if (!ssh2Module?.Client) throw new Error("模块里没有 Client");
|
|
38
45
|
return ssh2Module;
|
|
39
46
|
} catch (err) {
|
|
47
|
+
// 原始的 ERR_MODULE_NOT_FOUND 带多行 "Require stack:",塞进面板会糊成一片;
|
|
48
|
+
// 只要第一行的"找不到哪个模块"就够了。
|
|
49
|
+
const reason = String(err?.message ?? err).split("\n")[0].trim();
|
|
40
50
|
throw new Error(
|
|
41
|
-
`SSH
|
|
42
|
-
"
|
|
51
|
+
`SSH 终端需要额外的 ssh2 模块,这台机器上没装(${reason})。` +
|
|
52
|
+
"SSH 是可选项,其余 mesh 功能不受影响;要用就在 profile 目录执行 " +
|
|
53
|
+
"`pnpm add ssh2`(没有 pnpm 用 `npm i ssh2`),然后重开面板。",
|
|
43
54
|
);
|
|
44
55
|
}
|
|
45
56
|
}
|
|
@@ -348,6 +359,10 @@ export function createSshManager({ stateDir, credentialsPath, log = () => {}, wa
|
|
|
348
359
|
* @returns {Promise<string>} 会话 id
|
|
349
360
|
*/
|
|
350
361
|
const open = async ({ host, port = 22, username, password = "", cols = 80, rows = 24, machine = "" }) => {
|
|
362
|
+
// ssh2 不是依赖(见文件头),缺了要在**尝试连接之前**就说清楚。否则它会先
|
|
363
|
+
// 在密钥那一步被当成一次认证失败,最后被包成"对端拒绝了本机保存的密钥" ——
|
|
364
|
+
// 用户按那句话去重新部署密钥,永远修不好一个"没装模块"的问题(实测 2026-11-23)。
|
|
365
|
+
loadSsh2();
|
|
351
366
|
const key = ensureKey();
|
|
352
367
|
const saved = known(machine) ?? {};
|
|
353
368
|
// 这里的 port 是**实际连接用的端口**:直连时是用户的端口,走 tailnet 出站流时
|
package/llms.txt
CHANGED
|
@@ -20,6 +20,15 @@ From source instead: `git clone https://github.com/peng456/dsh-plugin-mesh && cd
|
|
|
20
20
|
|
|
21
21
|
**A restart of the dsh host is required after install** — the plugin loads at startup.
|
|
22
22
|
|
|
23
|
+
**No runtime dependencies: install is plain unpacking, and no dependency build
|
|
24
|
+
script runs.** That is a hard constraint — a host that refuses dependency build
|
|
25
|
+
scripts (iPad's DSH Go aborts pnpm with `ERR_PNPM_IGNORED_BUILDS`) fails the whole
|
|
26
|
+
install otherwise. 0.5.6–0.5.20 pulled `ssh2` into `dependencies` and hit exactly
|
|
27
|
+
that; 0.5.5 (zero deps) installed clean in the same installer.
|
|
28
|
+
`scripts/check-install-safe.mjs` keeps it that way. `ssh2` is needed only by the
|
|
29
|
+
SSH terminal and is deliberately **not** a dependency — install it yourself
|
|
30
|
+
(`pnpm add ssh2` in the profile) if you want that panel.
|
|
31
|
+
|
|
23
32
|
Verify after restart: `GET http://127.0.0.1:45917/mesh/v1/health` returns JSON containing `{"app":"dsh-mesh","machine":"<name>",...}`.
|
|
24
33
|
|
|
25
34
|
## What it does at runtime
|
|
@@ -121,6 +130,9 @@ the home board, enabled while the peer is online):
|
|
|
121
130
|
plugin generates an RSA key (PKCS#1 PEM — ssh2 cannot read Node's ed25519 export),
|
|
122
131
|
appends the public key to the peer's `authorized_keys` idempotently, then proves it
|
|
123
132
|
with a fresh private-key-only connection. A different username falls back to password.
|
|
133
|
+
- The SSH panel needs the optional `ssh2` module, which is **not** installed by the
|
|
134
|
+
plugin (see Install). Missing it is reported as "SSH 终端需要额外的 ssh2 模块…" and
|
|
135
|
+
nothing else degrades; `ssh-host.js` loads it lazily so the plugin always mounts.
|
|
124
136
|
- The private key and credentials live under the profile's mesh directory (mode 0600);
|
|
125
137
|
they are never broadcast and never included in the peer card.
|
|
126
138
|
|
|
@@ -227,6 +239,9 @@ Outbound dispatch tries LAN first, then each tailnet channel in order.
|
|
|
227
239
|
- A dsh host that can load cordis plugins with a client half (DSH Desktop, or `dsh web` + a profile).
|
|
228
240
|
- Node >= 20 for development. Peer `@deepseek-ai/*` packages are provided by the host and are not bundled.
|
|
229
241
|
- No Go toolchain and no Tailscale client are required by end users.
|
|
242
|
+
- No build toolchain or compiler is required to install: the package has no runtime
|
|
243
|
+
dependencies and runs no install scripts. The SSH terminal additionally wants the
|
|
244
|
+
optional `ssh2` module (user-installed; see Install).
|
|
230
245
|
|
|
231
246
|
## Development
|
|
232
247
|
|
|
@@ -248,8 +263,18 @@ npm run build:sidecar # rebuild the Go tsnet sidecar (cross-platform)
|
|
|
248
263
|
- `README.md` — user-facing entry (Chinese): what it gives you, 5-minute start, safety, FAQ
|
|
249
264
|
- `docs/DESIGN-NOTES.md` — the old long-form README: multicast/scan/firewall details, tsnet, identity, full config table, security model, limits, development
|
|
250
265
|
- `DESIGN.md` — design rationale, trade-offs and post-mortems (Chinese)
|
|
251
|
-
- `
|
|
252
|
-
-
|
|
266
|
+
- `ROADMAP.md` — the single roadmap: seven directions x versions, gates, metrics, risks (Chinese)
|
|
267
|
+
- `docs/roadmap/` — per-direction sub-roadmaps: `route.md` `security.md` `protocol.md` `adapter.md` `trace.md` `ui.md` `play.md` (Chinese)
|
|
268
|
+
- `docs/GROWTH.md` — positioning, competition, community and release cadence (Chinese)
|
|
269
|
+
- `docs/EVIDENCE.md` — where every number in the roadmap comes from (Chinese)
|
|
270
|
+
- `docs/DECISIONS.md` — historical decision log (Chinese)
|
|
271
|
+
- `PROTOCOL-COMPARISON.md` — comparison against A2A / MCP / ACP and peers (Chinese)
|
|
272
|
+
- `docs/PLUGIN-SPEC.md` — external spec: requirements, ports, host capability levels
|
|
273
|
+
- `docs/design/` — design and implementation records:
|
|
274
|
+
- `Placement设计.md` — placement design and implementation record (Chinese)
|
|
275
|
+
- `设备身份与多通道设计.md` — identity and multi-channel design (Chinese)
|
|
276
|
+
- `同机多Agent设计.md` — one node per machine, multiple agents attached (Chinese)
|
|
277
|
+
- `任务追踪设计.md` — layered task accounting design (Chinese)
|
|
253
278
|
- `docs/index.html` — user-facing showcase, Chinese (GitHub Pages)
|
|
254
279
|
- `docs/demo.html` — 60-second animated walkthrough (schematic; connects to nothing)
|
|
255
280
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-mesh",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "把跑不完的活交给另一台电脑;跑完,结果回到你面前。两台装了 DSH 的电脑各装一次,自动互相发现,任务派过去由对端的 agent 执行,结果派回来。Hand a long task to another machine: your DSH instances find each other, the peer runs it, and the result comes back. No pairing codes, no IPs, no Tailscale client.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,13 +69,14 @@
|
|
|
69
69
|
"selftest:update": "node lib/_selftest-update.mjs",
|
|
70
70
|
"selftest:upgrade": "node lib/_selftest-upgrade.mjs",
|
|
71
71
|
"selftest:approval": "node lib/_selftest-approval.mjs",
|
|
72
|
-
"test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:at && npm run selftest:at:host && npm run selftest:pairing && npm run selftest:approval && npm run selftest:switch && 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 && npm run selftest:peerweb && npm run selftest:webtarget && npm run selftest:webfence && npm run selftest:webhost && npm run selftest:sshtarget && npm run selftest:update && npm run selftest:upgrade",
|
|
73
|
-
"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/at-mention.js && node --check lib/pairing.js && node --check lib/switch.js && node --check lib/scan.js && node --check lib/update.js && node --check lib/upgrade.js && node --check lib/peer-web.js && node --check lib/web-target.js && node --check lib/web-fence.js && node --check lib/ssh-target.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check lib/tsnet/channels.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
|
|
72
|
+
"test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:at && npm run selftest:at:host && npm run selftest:pairing && npm run selftest:approval && npm run selftest:switch && 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 && npm run selftest:peerweb && npm run selftest:webtarget && npm run selftest:webfence && npm run selftest:webhost && npm run selftest:sshtarget && npm run selftest:update && npm run selftest:upgrade && npm run selftest:sshdep",
|
|
73
|
+
"check": "node scripts/check-version.mjs && npm run check:install && 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/at-mention.js && node --check lib/pairing.js && node --check lib/switch.js && node --check lib/scan.js && node --check lib/update.js && node --check lib/upgrade.js && node --check lib/peer-web.js && node --check lib/web-target.js && node --check lib/web-fence.js && node --check lib/ssh-target.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check lib/tsnet/channels.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
|
|
74
74
|
"build:sidecar": "bash scripts/build-sidecar.sh",
|
|
75
75
|
"verify:mirror": "node scripts/verify-lan-mirror.mjs",
|
|
76
76
|
"release:plan": "node scripts/release-plan.mjs",
|
|
77
77
|
"release-plugin": "bash scripts/release-plugin.sh",
|
|
78
78
|
"check:loadable": "node scripts/check-loadable.mjs --allow-missing-runtime-dep",
|
|
79
|
+
"check:install": "node scripts/check-install-safe.mjs",
|
|
79
80
|
"check:deploy": "node scripts/check-loadable.mjs",
|
|
80
81
|
"check:scope": "python3 tools/scopecheck.py lib/index.js",
|
|
81
82
|
"prepublishOnly": "npm test && node scripts/check-tarball.mjs",
|
|
@@ -88,7 +89,8 @@
|
|
|
88
89
|
"selftest:webtarget": "node lib/_selftest-web-target.mjs",
|
|
89
90
|
"selftest:webfence": "node lib/_selftest-web-fence.mjs",
|
|
90
91
|
"selftest:webhost": "node lib/_selftest-webhost.mjs",
|
|
91
|
-
"selftest:sshtarget": "node lib/_selftest-ssh-target.mjs"
|
|
92
|
+
"selftest:sshtarget": "node lib/_selftest-ssh-target.mjs",
|
|
93
|
+
"selftest:sshdep": "node lib/_selftest-ssh-dep.mjs"
|
|
92
94
|
},
|
|
93
95
|
"publishConfig": {
|
|
94
96
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -142,8 +144,5 @@
|
|
|
142
144
|
},
|
|
143
145
|
"engines": {
|
|
144
146
|
"node": ">=20"
|
|
145
|
-
},
|
|
146
|
-
"dependencies": {
|
|
147
|
-
"ssh2": "^1.16.0"
|
|
148
147
|
}
|
|
149
148
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 校验「这个包能装进跑不了构建脚本的宿主」。
|
|
3
|
+
*
|
|
4
|
+
* ── 为什么要有这道闸(真实事故,2026-11-23)─────────────────────────
|
|
5
|
+
* 0.5.6 起把 `ssh2` 写进了 `dependencies`。ssh2 自带一个安装脚本
|
|
6
|
+
* `install: node install.js`(去编译可选的原生加速模块 cpu-features),于是
|
|
7
|
+
* 每个装这个插件的宿主都会被要求跑一次构建:
|
|
8
|
+
*
|
|
9
|
+
* · macOS / Linux / Android(termux) 上有 node 和编译器,装得上,所以没人发现;
|
|
10
|
+
* · iPad 上的 DSH Go 装不上 —— 宿主不允许依赖跑构建脚本,pnpm 直接抛
|
|
11
|
+
*
|
|
12
|
+
* [ERR_PNPM_IGNORED_BUILDS] Ignored build scripts:
|
|
13
|
+
* cpu-features@0.0.10, ssh2@1.17.0
|
|
14
|
+
*
|
|
15
|
+
* 整次安装失败,插件根本装不上去。对照实验:同为 iPad 的 0.5.5 零依赖,
|
|
16
|
+
* 同一个安装器里 `Done in 2.6s`,干净通过。
|
|
17
|
+
*
|
|
18
|
+
* 结论写进规则:**运行时依赖必须为空**,或者只能是已核实「没有 preinstall /
|
|
19
|
+
* install / postinstall 脚本、纯 JS」的包 —— 后者要显式进下面的 ALLOW,
|
|
20
|
+
* 并写清核实方式,别靠"看起来没问题"。
|
|
21
|
+
*
|
|
22
|
+
* 需要可选能力(比如 SSH 用的 ssh2)时:不要放依赖里。按需 `import()` / `require()`
|
|
23
|
+
* 并在缺失时给一句能动手的话(见 `lib/ssh-host.js`),装不装由用户决定。
|
|
24
|
+
*
|
|
25
|
+
* 跑法:node scripts/check-install-safe.mjs (已挂在 npm run check 里)
|
|
26
|
+
*/
|
|
27
|
+
import { readFileSync } from "node:fs";
|
|
28
|
+
import { dirname, join } from "node:path";
|
|
29
|
+
import { fileURLToPath } from "node:url";
|
|
30
|
+
|
|
31
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
32
|
+
const pkg = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8"));
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 允许出现在 dependencies / optionalDependencies 里的包。
|
|
36
|
+
*
|
|
37
|
+
* **当前必须为空**:加任何一项之前,先确认它没有 preinstall/install/postinstall
|
|
38
|
+
* 脚本(`npm view <包>@<版本> scripts`),并把核实结论写在下面。
|
|
39
|
+
* optionalDependencies 也一样会触发构建脚本,别指望"可选"能绕过 —— 实测
|
|
40
|
+
* `optionalDependencies: { ssh2 }` 在同一个受限安装器里仍然抛
|
|
41
|
+
* ERR_PNPM_IGNORED_BUILDS。
|
|
42
|
+
*/
|
|
43
|
+
const ALLOW = /** @type {Record<string, string>} */ ({});
|
|
44
|
+
|
|
45
|
+
/** 包自己的安装脚本同样会在用户机器上跑,一律不要。 */
|
|
46
|
+
const FORBIDDEN_SELF_SCRIPTS = ["preinstall", "install", "postinstall", "prepare"];
|
|
47
|
+
|
|
48
|
+
const failures = [];
|
|
49
|
+
|
|
50
|
+
for (const name of FORBIDDEN_SELF_SCRIPTS) {
|
|
51
|
+
if (pkg.scripts?.[name]) {
|
|
52
|
+
failures.push(
|
|
53
|
+
`package.json 的 scripts.${name} 会在用户安装时执行;这个包必须"装即用、不跑脚本"。`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const declared = {
|
|
59
|
+
...(pkg.dependencies ?? {}),
|
|
60
|
+
...(pkg.optionalDependencies ?? {}),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
for (const name of Object.keys(declared)) {
|
|
64
|
+
if (ALLOW[name]) continue;
|
|
65
|
+
failures.push(
|
|
66
|
+
`运行时依赖 ${name}@${declared[name]} 未核实「无构建脚本」。\n` +
|
|
67
|
+
` 依赖的安装脚本在 iPad 这类宿主上跑不了,会让整次安装失败(0.5.6–0.5.20 真踩过)。\n` +
|
|
68
|
+
` 要保留它:先 npm view ${name}@<版本> scripts 确认没有 preinstall/install/postinstall,\n` +
|
|
69
|
+
` 再加进 scripts/check-install-safe.mjs 的 ALLOW 并写明核实结论。\n` +
|
|
70
|
+
` 只是"要用的时候才需要"的能力(如 ssh2):从依赖里去掉,按需 import() 即可。`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (failures.length > 0) {
|
|
75
|
+
console.error("✗ 安装安全性检查未通过:");
|
|
76
|
+
for (const line of failures) console.error(` - ${line}`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const deps = Object.keys(declared);
|
|
81
|
+
console.log(
|
|
82
|
+
deps.length === 0
|
|
83
|
+
? "✓ 零运行时依赖(安装不需要构建脚本)"
|
|
84
|
+
: `✓ 运行时依赖均已核实无构建脚本:${deps.join(", ")}`,
|
|
85
|
+
);
|