@tedbrain/vlink 0.1.158 → 0.1.160
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/README.md +25 -8
- package/binaries.json +36 -8
- package/install.js +115 -14
- package/package.json +2 -23
package/README.md
CHANGED
|
@@ -9,20 +9,25 @@ npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
|
9
9
|
|
|
10
10
|
npm 包只注册 `vlink-install` 命令;`vlink` 命令由安装后的原生程序提供。
|
|
11
11
|
`npx` 会自动选择包中唯一的命令入口,因此上面的安装命令保持不变。
|
|
12
|
-
全局安装 npm
|
|
12
|
+
全局安装 npm 包会注册 `vlink-install`;Windows 下 npm 会生成
|
|
13
13
|
`vlink-install`、`vlink-install.cmd`、`vlink-install.ps1` 三个入口。
|
|
14
|
-
|
|
14
|
+
升级到原生程序只需一条命令:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install -g @tedbrain/vlink@latest --registry=https://registry.npmmirror.com
|
|
18
|
-
vlink-install install
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
`npm_config_global=true` 时,包内 `postinstall` 除下载二进制外,会像
|
|
21
|
+
`vlink-install install` 一样把它原子安装到用户安装目录、停掉旧 daemon 并
|
|
22
|
+
配置用户 PATH;它不会启动交互式的 `vlink setup tedbrain`。如果 PATH 中已有
|
|
23
|
+
原生 vlink,会优先更新该位置;旧文件或目录不可写时,自动回退到用户安装目录
|
|
24
|
+
(Unix 为 `~/.local/bin`,Windows 为 `%LOCALAPPDATA%\TedBrain\bin`),保留原来
|
|
25
|
+
的共享安装。显式设置 `VLINK_INSTALL_DIR` 时始终使用该目录,写入失败会报错,
|
|
26
|
+
不会再改装到其他位置。
|
|
27
|
+
|
|
28
|
+
需要交互式 setup 或 `--no-setup` / `--web` / `--verbose` 选项时,仍可执行
|
|
29
|
+
`vlink-install install`。在 CI 或不允许 postinstall 触碰用户目录/daemon 的
|
|
30
|
+
环境里,设置 `VLINK_NPM_GLOBAL_INSTALL=0` 让全局 `postinstall` 只下载二进制。
|
|
26
31
|
|
|
27
32
|
安装目录会优先加入当前安装进程的 PATH,补全和 setup 均使用新二进制的绝对路径。
|
|
28
33
|
默认目录还会写入 shell 配置或 Windows 用户 PATH;自定义 Unix 目录需要自行配置
|
|
@@ -202,6 +207,18 @@ V1 的版本查询、安装、自更新和七平台二进制统一由 npm 承载
|
|
|
202
207
|
`vlink update` 从 npm 查询最新正式版并下载对应载荷。`vlink ssh connect` 从 npm 下载与本机同版本的远端平台载荷并通过 SSH 上传。两者都支持 `VLINK_NPM_REGISTRY`,无需安装 Node/npm。
|
|
203
208
|
历史客户端若仍使用旧更新源,需通过 `npx -y @tedbrain/vlink@latest install` 完成一次迁移。
|
|
204
209
|
|
|
210
|
+
### 薄包模式(直链数据包)
|
|
211
|
+
|
|
212
|
+
主包也可以只携带安装器,不发布七平台载荷包:`binaries.json` 的平台条目改为对象
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
"linux-x86_64": {"url": "https://cloud.tsinghua.edu.cn/f/<hash>/?dl=1", "sha256": "<64hex>", "size": 1234}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
时,安装器与 `vlink update` 直接从该 URL 下载二进制,并在落盘前硬校验 SHA-256(及声明的字节数);大小或摘要不符、HTTP 非 200、超时都会明确报错且不留下半成品。npm 主包的版本与 tarball integrity 仍是信任锚,载荷由主包内的 `sha256` 绑定。条目为 `null` 时保持上面的 npm 平台载荷包路径。
|
|
219
|
+
|
|
220
|
+
回退方式:把平台条目改回 SHA-256 字符串(或 `null`)并照常发布七平台 npm 载荷包,即恢复纯 npm 模式;客户端不需要升级代码。
|
|
221
|
+
|
|
205
222
|
## 二进制存放位置
|
|
206
223
|
|
|
207
224
|
安装包可写时缓存于包内 `vendor/`,否则使用 `$XDG_CACHE_HOME/vlink/<version>` 或 `~/.cache/vlink/<version>`。
|
package/binaries.json
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.160",
|
|
3
3
|
"binaries": {
|
|
4
|
-
"linux-x86_64":
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
4
|
+
"linux-x86_64": {
|
|
5
|
+
"url": "https://cloud.tsinghua.edu.cn/f/e0fa60e0b68f4d2f88e3/?dl=1",
|
|
6
|
+
"sha256": "e1f5cb23e28da74a9f9a7962d2e880fd7f57d3171b5cb7c9edef9e5cbbe91eb8",
|
|
7
|
+
"size": 24803709
|
|
8
|
+
},
|
|
9
|
+
"linux-x86_64-glibc2.17": {
|
|
10
|
+
"url": "https://cloud.tsinghua.edu.cn/f/729d55a84fb54d239f2f/?dl=1",
|
|
11
|
+
"sha256": "02d68d969eadd3757e771974c974b533ae571230e10addfcd0409b9a26c3a539",
|
|
12
|
+
"size": 25526985
|
|
13
|
+
},
|
|
14
|
+
"linux-aarch64": {
|
|
15
|
+
"url": "https://cloud.tsinghua.edu.cn/f/f913297b974f475b8535/?dl=1",
|
|
16
|
+
"sha256": "edfb9470a416046b352cc95f062daf40915d0263f18b46767d6eefd85d950ef3",
|
|
17
|
+
"size": 21113765
|
|
18
|
+
},
|
|
19
|
+
"macos-x86_64": {
|
|
20
|
+
"url": "https://cloud.tsinghua.edu.cn/f/1bf74767cf074d24a149/?dl=1",
|
|
21
|
+
"sha256": "2789f0e2f9fdc3884aef92fff9824490e52f75029c7acd04ae0f3cd7be0a7549",
|
|
22
|
+
"size": 22181593
|
|
23
|
+
},
|
|
24
|
+
"macos-aarch64": {
|
|
25
|
+
"url": "https://cloud.tsinghua.edu.cn/f/824b1cf060ff4d548054/?dl=1",
|
|
26
|
+
"sha256": "127e180ba53d4033a7543d97e1e5df81b6c7c2dac6ad123d8f6b777e28fbdd48",
|
|
27
|
+
"size": 17956309
|
|
28
|
+
},
|
|
29
|
+
"windows-x86_64.exe": {
|
|
30
|
+
"url": "https://cloud.tsinghua.edu.cn/f/2ee4076c15ee4af4a1c3/?dl=1",
|
|
31
|
+
"sha256": "529795cb23428b70de94f2256b6c2a620c2d662e8f6e1edcaad043346d699ea9",
|
|
32
|
+
"size": 9742629
|
|
33
|
+
},
|
|
34
|
+
"windows-aarch64.exe": {
|
|
35
|
+
"url": "https://cloud.tsinghua.edu.cn/f/78af63aa46ad4fd69395/?dl=1",
|
|
36
|
+
"sha256": "2915213f17f874cde721f288c8875c2e78b2bd05310c974088ef07e50d72d049",
|
|
37
|
+
"size": 11224361
|
|
38
|
+
}
|
|
11
39
|
}
|
|
12
40
|
}
|
package/install.js
CHANGED
|
@@ -42,6 +42,11 @@ function verboseLog(message, options = {}) {
|
|
|
42
42
|
(options.output || process.stderr).write(`[vlink:verbose] ${message}\n`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function downloadTimeoutMs() {
|
|
46
|
+
const value = Number(process.env.VLINK_DOWNLOAD_TIMEOUT_MS);
|
|
47
|
+
return Number.isFinite(value) && value > 0 ? value : 300000;
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
function displayUrl(value) {
|
|
46
51
|
try {
|
|
47
52
|
const url = new URL(value);
|
|
@@ -335,7 +340,9 @@ async function giteeAttachmentDownloadUrl(spec, suffix = spec.suffix, options =
|
|
|
335
340
|
}
|
|
336
341
|
|
|
337
342
|
function buildDownloadSources(spec, suffix = spec.suffix, options = {}) {
|
|
338
|
-
const
|
|
343
|
+
const direct = directPayload(suffix);
|
|
344
|
+
if (direct) return [directDownloadSource(suffix, direct, options)];
|
|
345
|
+
return [{
|
|
339
346
|
name: 'npm',
|
|
340
347
|
resolve: () => Promise.resolve(`npm:${require('./npm-payload').packageName(suffix)}@${VERSION}`),
|
|
341
348
|
fetchTo: (destination) => require('./npm-payload').installPayload(
|
|
@@ -343,7 +350,6 @@ function buildDownloadSources(spec, suffix = spec.suffix, options = {}) {
|
|
|
343
350
|
{ text: url => httpGetText(url, options), download: (url, dest) => downloadFile(url, dest, options) }
|
|
344
351
|
)
|
|
345
352
|
}];
|
|
346
|
-
return sources;
|
|
347
353
|
}
|
|
348
354
|
|
|
349
355
|
function packageBinaryPath(spec) {
|
|
@@ -398,7 +404,62 @@ function expectedChecksum(spec, suffix = spec.suffix) {
|
|
|
398
404
|
if (VERSION !== PKG.version) return null;
|
|
399
405
|
if (CHECKSUMS.version && CHECKSUMS.version !== VERSION) return null;
|
|
400
406
|
const value = CHECKSUMS.binaries && CHECKSUMS.binaries[suffix];
|
|
401
|
-
|
|
407
|
+
const checksum = value && typeof value === 'object' ? value.sha256 : value;
|
|
408
|
+
return typeof checksum === 'string' && checksum.length === 64
|
|
409
|
+
? checksum.toLowerCase()
|
|
410
|
+
: null;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Thin npm package mode: an entry may be an object that binds the platform
|
|
414
|
+
// binary on a direct (https) URL with its SHA-256 and byte size. `null`
|
|
415
|
+
// entries keep the legacy npm platform-payload path below.
|
|
416
|
+
function directPayload(suffix) {
|
|
417
|
+
const entry = CHECKSUMS.binaries && CHECKSUMS.binaries[suffix];
|
|
418
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return null;
|
|
419
|
+
if (CHECKSUMS.version && CHECKSUMS.version !== VERSION) {
|
|
420
|
+
throw new VlinkInstallError(
|
|
421
|
+
`binaries.json version ${CHECKSUMS.version} does not match ${VERSION}`
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
let url;
|
|
425
|
+
try {
|
|
426
|
+
url = new URL(entry.url);
|
|
427
|
+
} catch {
|
|
428
|
+
throw new VlinkInstallError(`invalid binaries.json URL for ${suffix}`);
|
|
429
|
+
}
|
|
430
|
+
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname) {
|
|
431
|
+
throw new VlinkInstallError(`unsupported binaries.json URL for ${suffix}`);
|
|
432
|
+
}
|
|
433
|
+
const sha256 = typeof entry.sha256 === 'string' ? entry.sha256.toLowerCase() : '';
|
|
434
|
+
if (!/^[0-9a-f]{64}$/.test(sha256)) {
|
|
435
|
+
throw new VlinkInstallError(`invalid binaries.json SHA-256 for ${suffix}`);
|
|
436
|
+
}
|
|
437
|
+
if (entry.size !== undefined && (!Number.isInteger(entry.size) || entry.size < 0)) {
|
|
438
|
+
throw new VlinkInstallError(`invalid binaries.json size for ${suffix}`);
|
|
439
|
+
}
|
|
440
|
+
return { url: entry.url, sha256, size: entry.size };
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function directDownloadSource(suffix, payload, options) {
|
|
444
|
+
return {
|
|
445
|
+
name: 'direct',
|
|
446
|
+
resolve: () => Promise.resolve(payload.url),
|
|
447
|
+
fetchTo: async (destination) => {
|
|
448
|
+
await downloadFile(payload.url, destination, options);
|
|
449
|
+
const size = fs.statSync(destination).size;
|
|
450
|
+
if (payload.size !== undefined && size !== payload.size) {
|
|
451
|
+
throw new VlinkInstallError(
|
|
452
|
+
`size mismatch for ${suffix}: expected ${payload.size}, got ${size}`
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
const actual = await sha256File(destination);
|
|
456
|
+
if (actual !== payload.sha256) {
|
|
457
|
+
throw new VlinkInstallError(
|
|
458
|
+
`checksum mismatch for ${suffix}: expected ${payload.sha256}, got ${actual}`
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
};
|
|
402
463
|
}
|
|
403
464
|
|
|
404
465
|
function sha256File(filePath) {
|
|
@@ -454,7 +515,7 @@ function downloadFile(url, destPath, options = {}) {
|
|
|
454
515
|
);
|
|
455
516
|
|
|
456
517
|
req.on('error', reject);
|
|
457
|
-
req.setTimeout(
|
|
518
|
+
req.setTimeout(downloadTimeoutMs(), () => req.destroy(new VlinkInstallError('download timed out')));
|
|
458
519
|
};
|
|
459
520
|
|
|
460
521
|
fileStream.on('finish', finish);
|
|
@@ -550,6 +611,48 @@ async function ensureBinary(options = {}) {
|
|
|
550
611
|
throw new VlinkInstallError(`all download sources failed: ${lastError.message}`);
|
|
551
612
|
}
|
|
552
613
|
|
|
614
|
+
// `npm i -g @tedbrain/vlink` must be the only step a user needs. npm runs this
|
|
615
|
+
// file as the global postinstall, but the package's own `vlink-install` bin is
|
|
616
|
+
// not on PATH, so download-only would leave no `vlink` command behind. When
|
|
617
|
+
// npm reports a global install, hand over to the installer: it atomically
|
|
618
|
+
// places the binary in the user install directory, stops the previous daemon
|
|
619
|
+
// and updates PATH, exactly like `vlink-install install` does.
|
|
620
|
+
function globalInstallRequested(env = process.env) {
|
|
621
|
+
return ['1', 'true', 'yes', 'on'].includes(
|
|
622
|
+
String(env.npm_config_global || '').toLowerCase()
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function globalInstallDisabled(env = process.env) {
|
|
627
|
+
return ['0', 'false', 'no', 'off'].includes(
|
|
628
|
+
String(env.VLINK_NPM_GLOBAL_INSTALL || '').toLowerCase()
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
async function runPostinstall(options = {}) {
|
|
633
|
+
const env = options.env || process.env;
|
|
634
|
+
const output = options.output || process.stderr;
|
|
635
|
+
const globalInstall =
|
|
636
|
+
options.globalInstall === undefined
|
|
637
|
+
? globalInstallRequested(env) && !globalInstallDisabled(env)
|
|
638
|
+
: options.globalInstall === true;
|
|
639
|
+
if (globalInstall) {
|
|
640
|
+
// Installer setup is interactive; npm postinstall has no terminal. The
|
|
641
|
+
// explicit `vlink-install install` / `vlink setup tedbrain` path still
|
|
642
|
+
// offers the wizard and its --no-setup/--web flags.
|
|
643
|
+
const runInstaller =
|
|
644
|
+
options.runInstaller || require('./installer').runInstaller;
|
|
645
|
+
const result = await runInstaller({ env, output, skipSetup: true });
|
|
646
|
+
output.write(`[vlink] installed ${result.vlinkPath}\n`);
|
|
647
|
+
return { global: true, ...result };
|
|
648
|
+
}
|
|
649
|
+
const ensure = options.ensureBinary || ensureBinary;
|
|
650
|
+
const binaryPath = await ensure();
|
|
651
|
+
cleanupLegacyNpmShims();
|
|
652
|
+
output.write(`[vlink] installed ${binaryPath}\n`);
|
|
653
|
+
return { global: false, binaryPath };
|
|
654
|
+
}
|
|
655
|
+
|
|
553
656
|
module.exports = {
|
|
554
657
|
VlinkInstallError,
|
|
555
658
|
VERSION,
|
|
@@ -570,17 +673,15 @@ module.exports = {
|
|
|
570
673
|
downloadFile,
|
|
571
674
|
resolveBinaryPath,
|
|
572
675
|
ensureBinary,
|
|
573
|
-
verifyBinary
|
|
676
|
+
verifyBinary,
|
|
677
|
+
globalInstallRequested,
|
|
678
|
+
globalInstallDisabled,
|
|
679
|
+
runPostinstall
|
|
574
680
|
};
|
|
575
681
|
|
|
576
682
|
if (require.main === module) {
|
|
577
|
-
|
|
578
|
-
.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
})
|
|
582
|
-
.catch((err) => {
|
|
583
|
-
console.error(`[vlink] install failed: ${err.message}`);
|
|
584
|
-
process.exitCode = 1;
|
|
585
|
-
});
|
|
683
|
+
runPostinstall().catch((err) => {
|
|
684
|
+
console.error(`[vlink] install failed: ${err.message}`);
|
|
685
|
+
process.exitCode = 1;
|
|
686
|
+
});
|
|
586
687
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedbrain/vlink",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.160",
|
|
4
4
|
"description": "vlink Virtuoso bridge CLI installer. Installs the matching platform binary at npm install time, like Claude Code / Codex.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|
|
@@ -32,26 +32,5 @@
|
|
|
32
32
|
"virtuoso",
|
|
33
33
|
"eda",
|
|
34
34
|
"skill"
|
|
35
|
-
]
|
|
36
|
-
"optionalDependencies": {
|
|
37
|
-
"@tedbrain/vlink-linux-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-x86-64.0.1.158.r1",
|
|
38
|
-
"@tedbrain/vlink-linux-x86_64-glibc2.17": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-x86-64-glibc2.17.0.1.158.r1",
|
|
39
|
-
"@tedbrain/vlink-linux-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-aarch64.0.1.158.r1",
|
|
40
|
-
"@tedbrain/vlink-macos-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-x86-64.0.1.158.r1",
|
|
41
|
-
"@tedbrain/vlink-macos-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-aarch64.0.1.158.r1",
|
|
42
|
-
"@tedbrain/vlink-windows-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-x86-64.0.1.158.r1",
|
|
43
|
-
"@tedbrain/vlink-windows-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-aarch64.0.1.158.r1"
|
|
44
|
-
},
|
|
45
|
-
"vlinkBinaries": {
|
|
46
|
-
"version": "0.1.158",
|
|
47
|
-
"binaries": {
|
|
48
|
-
"linux-x86_64": "c7984dd5e5958c5d62e3feaa8cc0ecca264d5698d3f6e3d875b9d0445308ea34",
|
|
49
|
-
"linux-x86_64-glibc2.17": "06c7bade30ba71f664892a26ab94e4554d91f79fbf556672248e99eebfb142b6",
|
|
50
|
-
"linux-aarch64": "6684caf95fe7674e0622e540b2875dd8e592285fe93c893ef9fe1361dea12bad",
|
|
51
|
-
"macos-x86_64": "ed1a8ffd12eb730b69119fc4b907031202a632fcb160964b9c17818ddc1b9dc3",
|
|
52
|
-
"macos-aarch64": "b43aa429a9a18b76fc0a98945af9e5d1db627f4b7fc9960e6ed1f6eeec724434",
|
|
53
|
-
"windows-x86_64.exe": "6ba2c434f326a19fbba91b9570f9c1c52dbf6581100b7076a6dabbdffc7d5eed",
|
|
54
|
-
"windows-aarch64.exe": "3ee87e266b3104398b6dac8a3c82ce84f45f8eb6c4d493003e94822e7ec8c643"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
35
|
+
]
|
|
57
36
|
}
|