@tedbrain/vlink 0.1.150 → 0.1.155
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 +38 -183
- package/binaries.json +8 -8
- package/install.js +19 -17
- package/npm-payload.js +102 -0
- package/package.json +25 -3
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @tedbrain/vlink
|
|
2
2
|
|
|
3
|
-
跨平台 vlink npm
|
|
4
|
-
Codex 一样按当前平台下载对应的 vlink 二进制。推荐统一使用 npx 完成持久化安装
|
|
3
|
+
跨平台 vlink npm 安装包。主包通过同版本 npm 平台包提供 Rust 二进制,安装时只从 npm 获取对应平台载荷。推荐统一使用 npx 完成持久化安装
|
|
5
4
|
和 TedBrain 初始化:
|
|
6
5
|
|
|
7
6
|
```bash
|
|
@@ -182,204 +181,60 @@ vlink channel web start
|
|
|
182
181
|
服务已运行时沿用 `channel web start` 的幂等复用行为,不强制重启现有终端。
|
|
183
182
|
该选项启动当前服务并注册 `vlink://` 唤起入口,不配置开机自启动。
|
|
184
183
|
|
|
185
|
-
##
|
|
184
|
+
## npm 平台载荷
|
|
186
185
|
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
V1 的版本查询、安装、自更新和七平台二进制统一由 npm 承载,不依赖 Gitee 附件或 d01 下载镜像。
|
|
187
|
+
`@tedbrain/vlink` 精确引用同版本的平台包,安装器校验 npm tarball integrity、二进制 SHA256 和实际版本后才安装。
|
|
188
|
+
平台内容缺失或损坏时安装失败。沿用 DPV2 同包多内容范式,以下名称仅为本地 npm alias,实际发布包统一为 `@tedbrain/vlink`,内容版本为 `0.0.0-dpv1.vlink.<platform>.<version>.r1`;平台去 `.exe` 并将 `_` 改为 `-`。DPV2 的版本和标签保持独立。
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
优先: https://gitee.com/ted-team/tedbrain 的 release attachment
|
|
192
|
-
回退: http://49.232.144.199/downloads/oss/vlink/<version>/vlink-<platform>
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
下载器遵循标准代理环境变量,同时支持大写和小写形式:
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
HTTP_PROXY=http://proxy.example:8080
|
|
199
|
-
HTTPS_PROXY=http://proxy.example:8080
|
|
200
|
-
NO_PROXY=localhost,127.0.0.1,.internal.example
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
也支持 `http_proxy`、`https_proxy`、`no_proxy`、`ALL_PROXY`,以及 npm 注入的
|
|
204
|
-
`npm_config_proxy`、`npm_config_https_proxy` 和 `npm_config_noproxy`。小写变量与
|
|
205
|
-
大写变量同时存在时优先使用小写。HTTPS 请求通过代理的 CONNECT 隧道传输;每次
|
|
206
|
-
重定向都会根据目标地址重新应用代理和 `NO_PROXY`。verbose 日志仅显示脱敏后的
|
|
207
|
-
代理主机,不显示代理用户名、密码或下载 URL 查询参数。
|
|
208
|
-
|
|
209
|
-
可用环境变量覆盖:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
# 跳过 Gitee,直接使用 d01/自定义下载源
|
|
213
|
-
VLINK_SKIP_GITEE=1 npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
214
|
-
|
|
215
|
-
# d01 回退源改用开发通道
|
|
216
|
-
VLINK_DOWNLOAD_CHANNEL=oss-dev npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
217
|
-
|
|
218
|
-
# 自定义回退下载根路径(会自动拼接 <channel>/vlink/<version>/vlink-<platform>)
|
|
219
|
-
VLINK_DOWNLOAD_BASE=https://internal.example/downloads npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
220
|
-
|
|
221
|
-
# 自定义回退下载目录(会自动拼接 vlink-<platform>)
|
|
222
|
-
VLINK_DOWNLOAD_URL=https://internal.example/vlink npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
223
|
-
|
|
224
|
-
# 指定不同版本(同时影响 Gitee release tag 与 d01 回退路径)
|
|
225
|
-
VLINK_VERSION=0.1.21 npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## 平台映射
|
|
229
|
-
|
|
230
|
-
| npm platform/arch | 下载文件 |
|
|
190
|
+
| 平台 | npm 载荷包 |
|
|
231
191
|
| --- | --- |
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
|
|
|
236
|
-
|
|
|
237
|
-
|
|
|
238
|
-
|
|
|
192
|
+
| Linux x64 | `@tedbrain/vlink-linux-x86_64` |
|
|
193
|
+
| Linux x64 glibc 2.17+ | `@tedbrain/vlink-linux-x86_64-glibc2.17` |
|
|
194
|
+
| Linux arm64 | `@tedbrain/vlink-linux-aarch64` |
|
|
195
|
+
| macOS x64 | `@tedbrain/vlink-macos-x86_64` |
|
|
196
|
+
| macOS arm64 | `@tedbrain/vlink-macos-aarch64` |
|
|
197
|
+
| Windows x64 | `@tedbrain/vlink-windows-x86_64` |
|
|
198
|
+
| Windows arm64 | `@tedbrain/vlink-windows-aarch64` |
|
|
199
|
+
|
|
200
|
+
安装器使用 npm 已安装的平台包,缺失时从 registry 获取精确版本。Linux x64 依现有 glibc 检测选择兼容载荷。
|
|
201
|
+
默认 registry 为 `https://registry.npmjs.org`,可用 `VLINK_NPM_REGISTRY` 指定内部 npm registry;下载器沿用 HTTP(S)_PROXY / NO_PROXY 配置。
|
|
202
|
+
现有原生客户端的 `vlink update` 也从 npm 获取版本及载荷,不要求安装 Node/npm。
|
|
203
|
+
历史客户端若仍使用旧更新源,需通过 `npx -y @tedbrain/vlink@latest install` 完成一次迁移。
|
|
239
204
|
|
|
240
205
|
## 二进制存放位置
|
|
241
206
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
安装脚本会校验 SHA-256(与 `dist/*.manifest` 一致),并执行一次
|
|
247
|
-
`vlink -V` 验证可运行。
|
|
207
|
+
安装包可写时缓存于包内 `vendor/`,否则使用 `$XDG_CACHE_HOME/vlink/<version>` 或 `~/.cache/vlink/<version>`。
|
|
208
|
+
`VLINK_BINARY_DIR` 可改变缓存根目录;`VLINK_BINARY_PATH` 是使用者显式指定原生程序的覆盖项。
|
|
209
|
+
持久化安装继续使用原安装目录及 `VLINK_INSTALL_DIR`,保留原生命令入口和 Windows helper 替换机制。
|
|
248
210
|
|
|
249
211
|
## 发布
|
|
250
212
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
日常发布使用 `tedbrain release vlink --branch tedbrain --jobs 4 --cargo-jobs 8`。
|
|
254
|
-
容器会合入 `tedbrain` 基线、升级版本,并原子推送源分支和稳定分支。完整开发与
|
|
255
|
-
发布工作流见仓库的 `.agents/skills/tedbrain-mcp-fix/SKILL.md`。
|
|
256
|
-
|
|
257
|
-
以下旧 SSH 脚本作为维护入口保留:在干净的 `luyukai` 工作区完成推送、自动升级版本、容器构建和
|
|
258
|
-
发布,不需要常驻 CI。其他分支可以通过 `--repo` 指向现有 `luyukai` worktree。
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
./scripts/publish_vlink_s02.sh --dry-run
|
|
262
|
-
./scripts/publish_vlink_s02.sh
|
|
263
|
-
./scripts/publish_vlink_s02.sh --resume
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
默认构建机为 `s02`,远端状态目录为 `~/.local/state/vlink-release-s02`,可用
|
|
267
|
-
`--host`、`--branch`、`--state-dir` 覆盖。`--bump minor|major`、`--version`、
|
|
268
|
-
`--jobs` 和 `--cargo-jobs` 控制版本与并发。远端使用独立 checkout,保留已有
|
|
269
|
-
开发目录及其未提交修改;先提交并正常推回 Cargo 版本,再构建七个平台。
|
|
270
|
-
分支发生并发更新时停止,不强制推送。成功后,本地工作区仍干净且 HEAD 未被
|
|
271
|
-
用户改变时自动快进到远端版本提交。
|
|
272
|
-
|
|
273
|
-
任务在 s02 后台执行,SSH 断开后仍可运行。`active.json` 指向最近一次任务,
|
|
274
|
-
日志位于 `runs/<任务ID>/build.log`,状态和源码/版本提交 SHA 位于同目录的
|
|
275
|
-
`status.json`。失败后用 `--resume` 跟随或恢复原任务,避免重新选择版本。
|
|
276
|
-
并发调用不能重复启动构建,已完成的步骤和已校验产物会复用。
|
|
277
|
-
上传前和恢复时还会检查 Gitee release 的源码 SHA;若同版本属于其他构建,
|
|
278
|
-
立即停止,不替换该 release 的附件。
|
|
279
|
-
|
|
280
|
-
`--dry-run` 不推送 Git、不写持久状态、不构建或发布。`--build-only` 会推送
|
|
281
|
-
已提交源码到 Codeup,在远端生成版本提交并构建,但不推回该版本提交,也不发布
|
|
282
|
-
Gitee/d01/npm;之后可用 `--resume` 发布同一批签名产物。
|
|
283
|
-
|
|
284
|
-
本机和远端均加载 `~/.proxy`。远端先加载已有的
|
|
285
|
-
`~/ted/servers/tedmind/docker/tedbrain-ci-env/vlink-release.env`,再加载
|
|
286
|
-
`~/.config/tedmind/vlink-release.env` 覆盖同名配置、保留其他变量;也可用
|
|
287
|
-
`--env-file <远端绝对路径>` 只加载指定文件。所需凭据与下方本机构建入口相同,值不会传到
|
|
288
|
-
本机或写入任务请求。s02 需具备 Codeup 拉取/推送和 d01 下载目录写入权限。
|
|
289
|
-
|
|
290
|
-
npm 默认使用 s02 的 `~/.npmrc`,不会被旧的 `NPM_TOKEN` 环境变量覆盖。
|
|
291
|
-
`--npm-config <远端路径>` 可选择其他文件;`--npm-config ''` 改用 token
|
|
292
|
-
环境变量。原 npmrc 不修改,认证配置临时复制为 `0600` 文件。正式发布前先运行
|
|
293
|
-
`npm whoami`,认证失败立即停止,不升级版本或开始编译。
|
|
294
|
-
|
|
295
|
-
Gitee 默认以其已有的 `master` 作为 release tag 目标;Codeup 源码提交并未
|
|
296
|
-
镜像到 Gitee,真实源码 SHA 保存在构建记录和二进制中。若 Gitee 已包含所需引用,
|
|
297
|
-
可通过 `--gitee-target <引用>` 指定。
|
|
298
|
-
|
|
299
|
-
可调用仓库内的 [vlink-release-s02 Skill](../../../../../.agents/skills/vlink-release-s02/SKILL.md)
|
|
300
|
-
执行这套流程。
|
|
301
|
-
|
|
302
|
-
### 在构建机直接运行
|
|
303
|
-
|
|
304
|
-
CI 停止时,在仓库根目录使用手动发布入口:
|
|
305
|
-
构建宿主机使用 Linux x86_64,需要 Python 3.9+、GNU tar、Git、curl、Node/npm
|
|
306
|
-
以及可用的容器引擎和 Virtuoso 许可证。
|
|
307
|
-
s02 已缓存完整工具链镜像和 ic618 镜像,可同步本仓库当前版本后在 s02 的
|
|
308
|
-
checkout 中运行以下 Docker 示例。镜像存在时直接复用;只有缺少 Rust 工具链
|
|
309
|
-
镜像时才构建镜像。ic618 缺失时加载共享归档,不重新构建它。
|
|
213
|
+
日常发布仍使用官方入口:
|
|
310
214
|
|
|
311
215
|
```bash
|
|
312
|
-
|
|
313
|
-
./scripts/publish_vlink_npm.sh --engine docker --dry-run
|
|
314
|
-
|
|
315
|
-
# 编译并正式发布;默认自动递增 patch 版本
|
|
316
|
-
./scripts/publish_vlink_npm.sh --engine docker
|
|
317
|
-
|
|
318
|
-
# 发布中断后,使用原版本及原始构建产物继续
|
|
319
|
-
./scripts/publish_vlink_npm.sh --resume
|
|
216
|
+
tedbrain release vlink --branch tedbrain --jobs 4 --cargo-jobs 8
|
|
320
217
|
```
|
|
321
218
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
Rust 编译镜像;需要访问 Docker Hub、GHCR 和 Rust/crates 镜像源。
|
|
326
|
-
Virtuoso context 使用现有 `cadence-virtuoso:ic618-centos7` 镜像编译,缺失时
|
|
327
|
-
沿用 `VLINK_CXT_IMAGE_ARCHIVE` 加载流程。
|
|
328
|
-
旧版 OpenAccess 无法识别新内核时,使用镜像提供的 `linux_rhel60` 平台;
|
|
329
|
-
自定义 Virtuoso 镜像可通过 `VLINK_CXT_OA_PLATFORM` 覆盖。
|
|
330
|
-
|
|
331
|
-
版本基线取本地 Cargo、npm 已发布稳定版本和 Gitee 最新稳定 release 中的
|
|
332
|
-
最高值,再递增并避开已有 release。支持 `--bump minor`、`--bump major`,
|
|
333
|
-
或 `--version 0.1.121` 指定尚未发布且不低于本地/线上基线的版本。
|
|
334
|
-
脚本更新 `Cargo.toml`、`Cargo.lock` 及 npm 元数据,使用默认完整功能编译七个
|
|
335
|
-
平台,并校验每个 cxt manifest 和 SHA-256。发布顺序是 Gitee 二进制、d01
|
|
336
|
-
正式下载镜像、npm;任一步失败立即停止。Git 提交和推送由调用者管理;正式
|
|
337
|
-
发布会使用当前 HEAD 作为 Gitee 的 `target_commitish`,因此该提交需已在
|
|
338
|
-
Gitee 上可用。
|
|
339
|
-
|
|
340
|
-
正式发布需要环境变量:
|
|
341
|
-
|
|
342
|
-
- `NPM_TOKEN`,兼容 `NODE_AUTH_TOKEN` 和原 CI 的 `TEDBRAIN_CI_NPM_TOEKN`;
|
|
343
|
-
或使用 `--npm-config <npmrc路径>`(也可设置 `VLINK_NPM_CONFIG`)指定现有认证文件。
|
|
344
|
-
- `GITEE_TOKEN`,兼容 `TEDBRAIN_CI_GITEE_TOKEN` 和现有
|
|
345
|
-
`~/.config/tedmind/gitee_token` 文件。
|
|
346
|
-
- `VLINK_LOG_RELEASE_KEY`,用于在宿主机签署二进制,至少 32 UTF-8 字节。
|
|
347
|
-
可从本机已有、Git 忽略的 `docker/tedbrain-ci-env/vlink-release.env` 导出。
|
|
348
|
-
- SSH 需能以 `D01_USER`(默认 `luyukai`)访问 `D01_HOST`(默认 `d01`)的
|
|
349
|
-
`/var/www/download_files` 目录,沿用现有发布脚本的权限要求。
|
|
350
|
-
|
|
351
|
-
凭据不会写入源码或构建镜像。临时 npm 配置权限为 `0600`,退出时删除。
|
|
352
|
-
发布进度和构建校验信息保存在
|
|
353
|
-
`${TED_DATA:-<仓库>/.tedbrain}/vlink-publish/manual-<version>.json`,与 CI 共用
|
|
354
|
-
发布锁。`--resume` 复用校验通过的原始二进制;Gitee/d01 已完成时直接补发
|
|
355
|
-
npm,部分上传失败时用相同文件恢复。原始产物或校验信息丢失时会拒绝重建
|
|
356
|
-
已发布版本。
|
|
357
|
-
|
|
358
|
-
启动入口会先 `source ~/.proxy`(文件存在时),其导出的代理配置由 Python、
|
|
359
|
-
npm 和 Podman/Docker 子进程继承;文件不存在时沿用终端环境。
|
|
360
|
-
连接失败时尝试直连,并明确打印回退信息。也可显式覆盖连接方式:
|
|
361
|
-
|
|
362
|
-
```bash
|
|
363
|
-
./scripts/publish_vlink_npm.sh --proxy direct --dry-run
|
|
364
|
-
./scripts/publish_vlink_npm.sh --proxy http://proxy.example:7990 --dry-run
|
|
365
|
-
```
|
|
219
|
+
发布器锁定源码并合入稳定基线,版本基线取 Cargo 与 npm 已发布稳定版本。
|
|
220
|
+
保持七平台构建、cxt 编译、签名、manifest 和能力标记检查;先逐个发布七平台 npm 载荷,
|
|
221
|
+
校验公开 tarball 的实际字节,再发布主包并推进 latest。平台内容版本用 `v1-payload` 标签,不提前推进主包 latest。
|
|
366
222
|
|
|
367
|
-
|
|
368
|
-
|
|
223
|
+
失败后使用原任务 `--resume`:先对账已有平台包,只发布缺失项,同版本不同字节直接拒绝。
|
|
224
|
+
公开分发尚未收敛时保留 pending 状态,再次恢复只复验已发布内容。
|
|
225
|
+
原 Gitee/d01 历史版本不删除;新发布不需要其凭据或配额。
|
|
369
226
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
未签名的构建仅用于本地验证,可对尚未发布的版本用 `--version` 重新构建。
|
|
373
|
-
默认并发为 2 个平台,每个平台 8 个 Cargo 编译任务,可用 `--jobs`、
|
|
374
|
-
`--cargo-jobs` 或现有 `VLINK_BUILD_JOBS`、`CARGO_BUILD_JOBS` 调整。
|
|
227
|
+
发布凭据仅需 npm 认证配置和至少 32 UTF-8 字节的 `VLINK_LOG_RELEASE_KEY`,沿用共享 publisher 镜像私有层。
|
|
228
|
+
凭据不输出到日志。源码推送仍需既有 Codeup 权限。
|
|
375
229
|
|
|
376
|
-
|
|
230
|
+
维护入口与预演:
|
|
377
231
|
|
|
378
232
|
```bash
|
|
379
|
-
|
|
380
|
-
./scripts/
|
|
381
|
-
./scripts/
|
|
233
|
+
./scripts/publish_vlink_s02.sh --dry-run
|
|
234
|
+
./scripts/publish_vlink_s02.sh --resume
|
|
235
|
+
./scripts/publish_vlink_npm.sh --dry-run
|
|
236
|
+
./scripts/publish_vlink_npm.sh --build-only
|
|
382
237
|
```
|
|
383
238
|
|
|
384
|
-
|
|
385
|
-
|
|
239
|
+
`--build-only` 仅构建、校验、打包,不对外发布。签名构建可由原任务 `--resume` 发布。
|
|
240
|
+
`--proxy direct` 或 `--proxy http://host:port` 可显式选择发布连接方式。
|
package/binaries.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.155",
|
|
3
3
|
"binaries": {
|
|
4
|
-
"linux-x86_64": "
|
|
5
|
-
"linux-x86_64-glibc2.17": "
|
|
6
|
-
"linux-aarch64": "
|
|
7
|
-
"macos-x86_64": "
|
|
8
|
-
"macos-aarch64": "
|
|
9
|
-
"windows-x86_64.exe": "
|
|
10
|
-
"windows-aarch64.exe": "
|
|
4
|
+
"linux-x86_64": "b50725cd5475cee518094677b830d52dbff1cd2af3bd547d32e482158c017c7d",
|
|
5
|
+
"linux-x86_64-glibc2.17": "961336911e23df1bb4de38a3734a3dfa6982024d096c59258387e53b362859fc",
|
|
6
|
+
"linux-aarch64": "abf20a5a8d2a6f2c7bb82b1e347446c369e965d1da5c77434d3d4cf9b13b2822",
|
|
7
|
+
"macos-x86_64": "73eb3b02267f7c7d71568b4f017fa2b250740c35027957945e9581dcaf663795",
|
|
8
|
+
"macos-aarch64": "746abb712c3d6c753e840ac22aadb6ae2b9243bee847c446f6fc6ab014dfc9a2",
|
|
9
|
+
"windows-x86_64.exe": "cb738bc6fcb36ad3adddc3f79ff97f16182b664e053ba36092c61f8e6f894a6f",
|
|
10
|
+
"windows-aarch64.exe": "abe34358c54cdbdf8e5b036243d41cee16ab21e73b89ed86802b9f0ac1f218a4"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/install.js
CHANGED
|
@@ -335,17 +335,14 @@ async function giteeAttachmentDownloadUrl(spec, suffix = spec.suffix, options =
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
function buildDownloadSources(spec, suffix = spec.suffix, options = {}) {
|
|
338
|
-
const sources = [
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
name: process.env.VLINK_DOWNLOAD_URL ? 'custom' : 'd01',
|
|
347
|
-
resolve: () => Promise.resolve(fallbackDownloadUrl(spec, suffix))
|
|
348
|
-
});
|
|
338
|
+
const sources = [{
|
|
339
|
+
name: 'npm',
|
|
340
|
+
resolve: () => Promise.resolve(`npm:${require('./npm-payload').packageName(suffix)}@${VERSION}`),
|
|
341
|
+
fetchTo: (destination) => require('./npm-payload').installPayload(
|
|
342
|
+
suffix, VERSION, expectedChecksum(spec, suffix), destination,
|
|
343
|
+
{ text: url => httpGetText(url, options), download: (url, dest) => downloadFile(url, dest, options) }
|
|
344
|
+
)
|
|
345
|
+
}];
|
|
349
346
|
return sources;
|
|
350
347
|
}
|
|
351
348
|
|
|
@@ -468,14 +465,14 @@ function downloadFile(url, destPath, options = {}) {
|
|
|
468
465
|
|
|
469
466
|
function verifyBinary(binaryPath) {
|
|
470
467
|
const result = spawnSync(binaryPath, ['-V'], {
|
|
471
|
-
stdio: ['ignore', '
|
|
468
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
472
469
|
encoding: 'utf8',
|
|
473
470
|
timeout: 30000
|
|
474
471
|
});
|
|
475
472
|
if (result.error) {
|
|
476
473
|
throw new VlinkInstallError(`downloaded binary is not executable: ${result.error.message}`);
|
|
477
474
|
}
|
|
478
|
-
if (result.status !== 0) {
|
|
475
|
+
if (result.status !== 0 || !(result.stdout || '').split(/\s+/).includes(VERSION)) {
|
|
479
476
|
throw new VlinkInstallError(`downloaded binary failed its version check (exit ${result.status})`);
|
|
480
477
|
}
|
|
481
478
|
}
|
|
@@ -491,6 +488,12 @@ async function ensureBinary(options = {}) {
|
|
|
491
488
|
);
|
|
492
489
|
verboseLog(`binary resolver: selected path=${binaryPath} force=${force}`, options);
|
|
493
490
|
if (!force && isExecutable(binaryPath)) {
|
|
491
|
+
if (!process.env.VLINK_BINARY_PATH) {
|
|
492
|
+
const actual = await sha256File(binaryPath);
|
|
493
|
+
const expected = spec.suffixes.map(suffix => expectedChecksum(spec, suffix));
|
|
494
|
+
if (!expected.includes(actual)) throw new VlinkInstallError('cached binary checksum mismatch');
|
|
495
|
+
verifyBinary(binaryPath);
|
|
496
|
+
}
|
|
494
497
|
verboseLog('binary resolver: using existing executable', options);
|
|
495
498
|
return binaryPath;
|
|
496
499
|
}
|
|
@@ -514,7 +517,8 @@ async function ensureBinary(options = {}) {
|
|
|
514
517
|
const url = await source.resolve();
|
|
515
518
|
console.error(`[vlink] downloading ${displayUrl(url)} [${source.name}]`);
|
|
516
519
|
fs.rmSync(tempPath, { force: true });
|
|
517
|
-
await
|
|
520
|
+
if (source.fetchTo) await source.fetchTo(tempPath);
|
|
521
|
+
else await downloadFile(url, tempPath, options);
|
|
518
522
|
verboseLog(`download stage: received ${source.name} payload`, options);
|
|
519
523
|
|
|
520
524
|
const checksum = expectedChecksum(spec, suffix);
|
|
@@ -531,10 +535,8 @@ async function ensureBinary(options = {}) {
|
|
|
531
535
|
if (process.platform !== 'win32') {
|
|
532
536
|
fs.chmodSync(tempPath, 0o755);
|
|
533
537
|
}
|
|
534
|
-
|
|
538
|
+
verifyBinary(tempPath);
|
|
535
539
|
fs.renameSync(tempPath, binaryPath);
|
|
536
|
-
verboseLog(`verification stage: executing ${binaryPath} -V`, options);
|
|
537
|
-
verifyBinary(binaryPath);
|
|
538
540
|
verboseLog('verification stage: binary is ready', options);
|
|
539
541
|
return binaryPath;
|
|
540
542
|
} catch (err) {
|
package/npm-payload.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Shared npm-only payload contract. Never extract archive paths to disk.
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const crypto = require('crypto');
|
|
7
|
+
const zlib = require('zlib');
|
|
8
|
+
|
|
9
|
+
const SUFFIXES = [
|
|
10
|
+
'linux-x86_64', 'linux-x86_64-glibc2.17', 'linux-aarch64',
|
|
11
|
+
'macos-x86_64', 'macos-aarch64', 'windows-x86_64.exe', 'windows-aarch64.exe'
|
|
12
|
+
];
|
|
13
|
+
const MAX_PAYLOAD = 128 * 1024 * 1024;
|
|
14
|
+
|
|
15
|
+
function packageName(suffix) {
|
|
16
|
+
if (!SUFFIXES.includes(suffix)) throw new Error(`unsupported platform: ${suffix}`);
|
|
17
|
+
return '@tedbrain/vlink';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Same package, separate reserved content versions, as used by DPV2.
|
|
21
|
+
function packageVersion(suffix, version) {
|
|
22
|
+
packageName(suffix);
|
|
23
|
+
if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(version)) throw new Error('invalid vlink version');
|
|
24
|
+
return `0.0.0-dpv1.vlink.${suffix.replace(/\.exe$/, '').replace(/_/g, '-')}.${version}.r1`;
|
|
25
|
+
}
|
|
26
|
+
function aliasName(suffix) {
|
|
27
|
+
packageName(suffix);
|
|
28
|
+
return `@tedbrain/vlink-${suffix.replace(/\.exe$/, '')}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function archiveBinary(data, suffix) {
|
|
32
|
+
const tar = zlib.gunzipSync(data, { maxOutputLength: MAX_PAYLOAD });
|
|
33
|
+
const wanted = `package/bin/${suffix.endsWith('.exe') ? 'vlink.exe' : 'vlink'}`;
|
|
34
|
+
let binary = null;
|
|
35
|
+
for (let offset = 0; offset + 512 <= tar.length;) {
|
|
36
|
+
const header = tar.subarray(offset, offset + 512);
|
|
37
|
+
if (header.every((value) => value === 0)) break;
|
|
38
|
+
const field = (start, length) => header.subarray(start, start + length)
|
|
39
|
+
.toString('utf8').replace(/\0.*$/s, '');
|
|
40
|
+
const name = field(0, 100);
|
|
41
|
+
const prefix = field(345, 155);
|
|
42
|
+
const fullName = prefix ? `${prefix}/${name}` : name;
|
|
43
|
+
const sizeField = field(124, 12).trim();
|
|
44
|
+
if (!/^[0-7]+$/.test(sizeField)) throw new Error('invalid tar entry size');
|
|
45
|
+
const size = parseInt(sizeField, 8);
|
|
46
|
+
const start = offset + 512;
|
|
47
|
+
if (size > MAX_PAYLOAD || start + size > tar.length) throw new Error('truncated tar entry');
|
|
48
|
+
if (fullName.split('/').includes('..') || fullName.startsWith('/') || fullName.includes('\\')) {
|
|
49
|
+
throw new Error('unsafe tar entry path');
|
|
50
|
+
}
|
|
51
|
+
if (fullName === wanted) {
|
|
52
|
+
if (binary || (header[156] !== 0 && header[156] !== 48)) {
|
|
53
|
+
throw new Error('duplicate or non-regular platform binary');
|
|
54
|
+
}
|
|
55
|
+
binary = tar.subarray(start, start + size);
|
|
56
|
+
}
|
|
57
|
+
offset = start + Math.ceil(size / 512) * 512;
|
|
58
|
+
}
|
|
59
|
+
if (!binary || !binary.length) throw new Error('platform package has no binary');
|
|
60
|
+
return binary;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function verify(data, expected, algorithm) {
|
|
64
|
+
const actual = crypto.createHash(algorithm).update(data).digest(algorithm === 'sha256' ? 'hex' : 'base64');
|
|
65
|
+
if (!expected || actual !== expected) throw new Error(`${algorithm} integrity mismatch`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function installPayload(suffix, version, checksum, destination, transport) {
|
|
69
|
+
const name = packageName(suffix);
|
|
70
|
+
const contentVersion = packageVersion(suffix, version);
|
|
71
|
+
const binaryName = suffix.endsWith('.exe') ? 'vlink.exe' : 'vlink';
|
|
72
|
+
let installed;
|
|
73
|
+
try { installed = require.resolve(`${aliasName(suffix)}/package.json`); } catch { /* fetch exact npm version */ }
|
|
74
|
+
if (installed) {
|
|
75
|
+
const manifest = JSON.parse(fs.readFileSync(installed, 'utf8'));
|
|
76
|
+
if (manifest.name !== name || manifest.version !== contentVersion) throw new Error('installed platform package version mismatch');
|
|
77
|
+
const data = fs.readFileSync(path.join(path.dirname(installed), 'bin', binaryName));
|
|
78
|
+
verify(data, checksum, 'sha256');
|
|
79
|
+
fs.writeFileSync(destination, data, { mode: 0o755 });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const registry = (process.env.VLINK_NPM_REGISTRY || 'https://registry.npmjs.org').replace(/\/+$/, '');
|
|
83
|
+
const metadata = JSON.parse(await transport.text(`${registry}/${encodeURIComponent(name)}/${contentVersion}`));
|
|
84
|
+
if (metadata.name !== name || metadata.version !== contentVersion || !metadata.dist ||
|
|
85
|
+
!/^sha512-[A-Za-z0-9+/]+={0,2}$/.test(metadata.dist.integrity || '')) {
|
|
86
|
+
throw new Error('invalid npm platform metadata');
|
|
87
|
+
}
|
|
88
|
+
const tarball = `${destination}.tgz`;
|
|
89
|
+
try {
|
|
90
|
+
await transport.download(metadata.dist.tarball, tarball);
|
|
91
|
+
if (fs.statSync(tarball).size > MAX_PAYLOAD) throw new Error('platform package too large');
|
|
92
|
+
const data = fs.readFileSync(tarball);
|
|
93
|
+
verify(data, metadata.dist.integrity.slice(7), 'sha512');
|
|
94
|
+
const binary = archiveBinary(data, suffix);
|
|
95
|
+
verify(binary, checksum, 'sha256');
|
|
96
|
+
fs.writeFileSync(destination, binary, { mode: 0o755 });
|
|
97
|
+
} finally {
|
|
98
|
+
fs.rmSync(tarball, { force: true });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = { SUFFIXES, packageName, packageVersion, aliasName, archiveBinary, installPayload };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedbrain/vlink",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.155",
|
|
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": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"mcp-installer.js",
|
|
14
14
|
"npm-shims.js",
|
|
15
15
|
"binaries.json",
|
|
16
|
-
"README.md"
|
|
16
|
+
"README.md",
|
|
17
|
+
"npm-payload.js"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"postinstall": "node install.js",
|
|
@@ -31,5 +32,26 @@
|
|
|
31
32
|
"virtuoso",
|
|
32
33
|
"eda",
|
|
33
34
|
"skill"
|
|
34
|
-
]
|
|
35
|
+
],
|
|
36
|
+
"optionalDependencies": {
|
|
37
|
+
"@tedbrain/vlink-linux-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-x86-64.0.1.155.r1",
|
|
38
|
+
"@tedbrain/vlink-linux-x86_64-glibc2.17": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-x86-64-glibc2.17.0.1.155.r1",
|
|
39
|
+
"@tedbrain/vlink-linux-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.linux-aarch64.0.1.155.r1",
|
|
40
|
+
"@tedbrain/vlink-macos-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-x86-64.0.1.155.r1",
|
|
41
|
+
"@tedbrain/vlink-macos-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.macos-aarch64.0.1.155.r1",
|
|
42
|
+
"@tedbrain/vlink-windows-x86_64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-x86-64.0.1.155.r1",
|
|
43
|
+
"@tedbrain/vlink-windows-aarch64": "npm:@tedbrain/vlink@0.0.0-dpv1.vlink.windows-aarch64.0.1.155.r1"
|
|
44
|
+
},
|
|
45
|
+
"vlinkBinaries": {
|
|
46
|
+
"version": "0.1.155",
|
|
47
|
+
"binaries": {
|
|
48
|
+
"linux-x86_64": "b50725cd5475cee518094677b830d52dbff1cd2af3bd547d32e482158c017c7d",
|
|
49
|
+
"linux-x86_64-glibc2.17": "961336911e23df1bb4de38a3734a3dfa6982024d096c59258387e53b362859fc",
|
|
50
|
+
"linux-aarch64": "abf20a5a8d2a6f2c7bb82b1e347446c369e965d1da5c77434d3d4cf9b13b2822",
|
|
51
|
+
"macos-x86_64": "73eb3b02267f7c7d71568b4f017fa2b250740c35027957945e9581dcaf663795",
|
|
52
|
+
"macos-aarch64": "746abb712c3d6c753e840ac22aadb6ae2b9243bee847c446f6fc6ab014dfc9a2",
|
|
53
|
+
"windows-x86_64.exe": "cb738bc6fcb36ad3adddc3f79ff97f16182b664e053ba36092c61f8e6f894a6f",
|
|
54
|
+
"windows-aarch64.exe": "abe34358c54cdbdf8e5b036243d41cee16ab21e73b89ed86802b9f0ac1f218a4"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
35
57
|
}
|