@tedbrain/vlink 0.1.157 → 0.1.159

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 CHANGED
@@ -202,6 +202,18 @@ V1 的版本查询、安装、自更新和七平台二进制统一由 npm 承载
202
202
  `vlink update` 从 npm 查询最新正式版并下载对应载荷。`vlink ssh connect` 从 npm 下载与本机同版本的远端平台载荷并通过 SSH 上传。两者都支持 `VLINK_NPM_REGISTRY`,无需安装 Node/npm。
203
203
  历史客户端若仍使用旧更新源,需通过 `npx -y @tedbrain/vlink@latest install` 完成一次迁移。
204
204
 
205
+ ### 薄包模式(直链数据包)
206
+
207
+ 主包也可以只携带安装器,不发布七平台载荷包:`binaries.json` 的平台条目改为对象
208
+
209
+ ```json
210
+ "linux-x86_64": {"url": "https://cloud.tsinghua.edu.cn/f/<hash>/?dl=1", "sha256": "<64hex>", "size": 1234}
211
+ ```
212
+
213
+ 时,安装器与 `vlink update` 直接从该 URL 下载二进制,并在落盘前硬校验 SHA-256(及声明的字节数);大小或摘要不符、HTTP 非 200、超时都会明确报错且不留下半成品。npm 主包的版本与 tarball integrity 仍是信任锚,载荷由主包内的 `sha256` 绑定。条目为 `null` 时保持上面的 npm 平台载荷包路径。
214
+
215
+ 回退方式:把平台条目改回 SHA-256 字符串(或 `null`)并照常发布七平台 npm 载荷包,即恢复纯 npm 模式;客户端不需要升级代码。
216
+
205
217
  ## 二进制存放位置
206
218
 
207
219
  安装包可写时缓存于包内 `vendor/`,否则使用 `$XDG_CACHE_HOME/vlink/<version>` 或 `~/.cache/vlink/<version>`。
package/binaries.json CHANGED
@@ -1,12 +1,40 @@
1
1
  {
2
- "version": "0.1.157",
2
+ "version": "0.1.159",
3
3
  "binaries": {
4
- "linux-x86_64": "23dd66d64954a88e78601d1e4ce42e52eaa68788e8047dd0eb5637896c7b8eec",
5
- "linux-x86_64-glibc2.17": "efc3b28a88a704bfe5ac520c59673a1542ec6530b8eb76e5f2ac5a77cb3cdf79",
6
- "linux-aarch64": "418b2e16d4f42814c2cb9a61f27517f8909a8c6464647d580b4d90219b6dde2c",
7
- "macos-x86_64": "0cf3afa2ca3f6f6f286da5921e96c875c72644cc2d36e3b75ebfd6fa05080d42",
8
- "macos-aarch64": "6b6b2373fb68153e870370c81896f8e82865f36aa377a93d714367926c25027f",
9
- "windows-x86_64.exe": "4047fafaea6a150ce89835d927b33467fe5e9905a5efa2303a244cdd79a02187",
10
- "windows-aarch64.exe": "91247828d5cae3930362db01973d394327d2b40f413001b62652d19d3dd2527a"
4
+ "linux-x86_64": {
5
+ "url": "https://cloud.tsinghua.edu.cn/f/16e5a8f3c8b74048b537/?dl=1",
6
+ "sha256": "c3e32724ce1af7dedf93f9290043ebcd9d3a18903c7e402bd6f7e607c3cd6208",
7
+ "size": 24807805
8
+ },
9
+ "linux-x86_64-glibc2.17": {
10
+ "url": "https://cloud.tsinghua.edu.cn/f/ac7c1329616746eba8fd/?dl=1",
11
+ "sha256": "dc654f8ca507bcc9b96a59bfb7d88973b98d980d1c920a911483933152c65d3d",
12
+ "size": 25530233
13
+ },
14
+ "linux-aarch64": {
15
+ "url": "https://cloud.tsinghua.edu.cn/f/3c23abe92a4f47b29655/?dl=1",
16
+ "sha256": "51eca4ee6eeb6523ed3faa2368c0ecb4deb75120967429048716ffef510d2d71",
17
+ "size": 21113765
18
+ },
19
+ "macos-x86_64": {
20
+ "url": "https://cloud.tsinghua.edu.cn/f/c16b789421bb43158c31/?dl=1",
21
+ "sha256": "5ace58e9ece6fcfa516b707f42148dadf374aeab2c91895163039fd55f98df31",
22
+ "size": 22185681
23
+ },
24
+ "macos-aarch64": {
25
+ "url": "https://cloud.tsinghua.edu.cn/f/19684ff1be334669b9d2/?dl=1",
26
+ "sha256": "6edc731e483665bdbfc5ba37895602545438ce091377e8889c90cbcdeae1d532",
27
+ "size": 17972805
28
+ },
29
+ "windows-x86_64.exe": {
30
+ "url": "https://cloud.tsinghua.edu.cn/f/d96c4e4c15274312ab31/?dl=1",
31
+ "sha256": "757af31917c2759262cc3b8ff9ce9024c0ecf1dc33092fed7eb888499d76166d",
32
+ "size": 9745701
33
+ },
34
+ "windows-aarch64.exe": {
35
+ "url": "https://cloud.tsinghua.edu.cn/f/29c9276c37e149349044/?dl=1",
36
+ "sha256": "7b2504ef6e7e699e03f085f57977398e0637682be13633bf5a72564d7ef8cc69",
37
+ "size": 11226409
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 sources = [{
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
- return typeof value === 'string' && value.length === 64 ? value.toLowerCase() : null;
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(300000, () => req.destroy(new VlinkInstallError('download timed out')));
518
+ req.setTimeout(downloadTimeoutMs(), () => req.destroy(new VlinkInstallError('download timed out')));
458
519
  };
459
520
 
460
521
  fileStream.on('finish', finish);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedbrain/vlink",
3
- "version": "0.1.157",
3
+ "version": "0.1.159",
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.157.r1",
38
- "@tedbrain/vlink-linux-x86_64-glibc2.17": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-x86-64-glibc2.17.0.1.157.r1",
39
- "@tedbrain/vlink-linux-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-aarch64.0.1.157.r1",
40
- "@tedbrain/vlink-macos-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-x86-64.0.1.157.r1",
41
- "@tedbrain/vlink-macos-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-aarch64.0.1.157.r1",
42
- "@tedbrain/vlink-windows-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-x86-64.0.1.157.r1",
43
- "@tedbrain/vlink-windows-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-aarch64.0.1.157.r1"
44
- },
45
- "vlinkBinaries": {
46
- "version": "0.1.157",
47
- "binaries": {
48
- "linux-x86_64": "23dd66d64954a88e78601d1e4ce42e52eaa68788e8047dd0eb5637896c7b8eec",
49
- "linux-x86_64-glibc2.17": "efc3b28a88a704bfe5ac520c59673a1542ec6530b8eb76e5f2ac5a77cb3cdf79",
50
- "linux-aarch64": "418b2e16d4f42814c2cb9a61f27517f8909a8c6464647d580b4d90219b6dde2c",
51
- "macos-x86_64": "0cf3afa2ca3f6f6f286da5921e96c875c72644cc2d36e3b75ebfd6fa05080d42",
52
- "macos-aarch64": "6b6b2373fb68153e870370c81896f8e82865f36aa377a93d714367926c25027f",
53
- "windows-x86_64.exe": "4047fafaea6a150ce89835d927b33467fe5e9905a5efa2303a244cdd79a02187",
54
- "windows-aarch64.exe": "91247828d5cae3930362db01973d394327d2b40f413001b62652d19d3dd2527a"
55
- }
56
- }
35
+ ]
57
36
  }