dsh-plugin-update-doctor 0.5.3 → 0.5.4

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.
@@ -1,78 +1,82 @@
1
- # Windows支持扩展与公共API边界
2
-
3
- ## 当前0.5.3与本机状态
4
-
5
- - 本机更新器0.5.3已安装激活;用户在真实面板完成WSL0.26.2→0.29.0,日志applied、包和代际核验通过,当前16/16Host行active。
6
- - WSL新候选按公开原包/现代声明契约和实际身份检查,不再仅限固定版本名单;旧根/全部保留原包证明、schema4及未知结果保护见[WSL结构准入](<WSL_STRUCTURAL_0_5_3.md>)。
7
- - Union常规npm/HMR限制不变;**自0.5.2起另有已审查0.10.24→0.10.25完整依赖本地代际路线**,不是仅靠风险拦截,也不是修改宿主。来源转本地、额外确认、fresh恢复及未知/未审查目标拒绝见[Union代际](<UNION_GENERATION_0_5_2.md>)。
8
- - Windows x64、Node≥24、宿主服务和.NET Framework4.x检测助手等条件见[运行要求](<WINDOWS_REQUIREMENTS.md>);没有写死本机路径,不代表第二台设备已验证。
9
- - 本页下方保留的是0.5.1阶段的普通来源/镜像/WSL0.28实验和常规Union故障事实,**不是当前0.5.3全部行为清单**,没有重新执行所有历史实验。
10
-
11
- ## 0.5.1阶段已实现的路径(历史)
12
-
13
- - 普通 registry 更新使用公开 `pluginManager.updateBundle`,保留精确 npm 安装规格和官方后续 Versions 资格。
14
- - 更新器支持固定 npm 官方源及固定公共镜像 `https://registry.npmmirror.com`。镜像旧/新归档必须与官方同版本归档摘要及运行声明一致;需额外用户确认,绑定来源和已披露宿主计划,不修改 profile 配置。官方原有严格无 fallback 路径仍独立保留。
15
- - 旧普通 Doctor 归档可在无待处理结果、身份与已装字节核验通过后,独立确认**同版本来源迁移**。不接受任意 file/git、自身或 WSL迁移;失败尝试恢复原记录归档,未知不重发。
16
- - 不再仅因普通插件声明 dependencies 就拒绝。支持不变、可解析、无原生/安装生命周期脚本的 JS 依赖集合;对实际安装依赖包版本、边关系与全文件摘要在准备、替换前及替换后核验。只实现严格 semver 子集,不能解析的范围拒绝。
17
- - WSL精确增加已审查 `0.28.0` 及原归档SHA256。已有部署归档、实际安装的全文件、根旧资源、保留代际、exports/patch分别核验,并重建已知原包组合;不接受未知代际。查询与预检不执行包代码。
18
- - 官方插件详情通过公开 `plugins.detail.section` 提供**由更新器提供的独立归档版本检查**和打开更新面板入口。不会改宿主 `update` 字段或伪造内置 Versions。
19
-
20
- ## 0.5.1阶段实际隔离验证(历史)
21
-
22
- 均使用已安装 DSH Desktop **0.2.2-rc.5** 的 AppBoot/Cordis/Loader/HMR/PluginManager,自有临时profile/store/cache,禁止模型、用户发行版和真实用户任务;原始结果含本地路径,仅留在忽略目录。
23
-
24
- ### 普通 npm 与纯 ESM 依赖
25
-
26
- - 无依赖正常更新和故意激活失败自动恢复,各自同进程通过;新旧来源保持 npm,官方 Versions查询仍可用。
27
- - 一项纯 ESM依赖、声明不变:新旧实际依赖版本/边关系/文件摘要一致,更新 Host active、代码标记有效、来源 registry。故意目标加载失败由 Host恢复旧版,升级仍为失败。
28
- - 旧 file来源同版本迁移通过,npm来源和官方 Versions资格恢复;一次测试安装拒绝为明确fixture、没有包命令执行,迁移恢复原归档 applied,原代码及身份恢复。不是声称真实npm网络故障。
29
-
30
- - 最后冻结核心后复跑上述四组,六项 production源码摘要与当前源码全部一致;各mode自有环境清理,成功/失败不靠重写结果。新旧图与来源的证据只限定这组纯ESMfixture和来源迁移,不扩大为所有社区依赖。
31
-
32
- 入口脚本(仓库开发材料,不随插件安装):`experiments/registry-preservation-proof-runner.mjs`、`experiments/migration-deps-proof-runner.mjs`。
33
-
34
- ### 公共镜像自身交接
35
-
36
- 复制当前production代码的旧/新fixture、固定镜像/官方逻辑元数据及owned loopback传输映射。Host公共操作和真实包管理/卸载/激活/恢复不替换。好组单次交接到新版本、包/来源/YAML2.9.1/Host核验;坏组故意目标apply抛错,Host恢复旧版,失败保留。缺 `confirmPublicMirror`拒绝。每组保持同PID;旧disposer约1ms且不等待自身替换;临时根清理。
37
-
38
- 该证明不是已经发布的真实旧 `0.5.0` 含镜像功能,也不是现场公共镜像网络安装。并行编辑造成部分client/service/staging摘要不同,原始结果有productionFilesSha256;不能把未匹配文件算作同一快照已验证。
39
-
40
- 入口脚本(仓库开发材料,不随插件安装):`experiments/mirror-self-proof-runner.mjs`。
41
-
42
- ### 新版 WSL 与历史根资源
43
-
44
- - 原public归档 `0.28.0` SHA256:`c137376aba2b3973690ecef93baed9e4de79a22825ab5a50e92ae9ad2881e694`;版本清单、peer键和值、无依赖、客户端声明已审查,新增 `wsl-plugin-update` 是第16个Host条目。
45
- - 冷0.26.2基线15active→0.28.0 16active→恢复0.26.2 15active,同PID。
46
- - 复刻原0.24-root部署形态:准备、更新及恢复保留0.24根和24/26/28各自资源;每次749项文件字节核验。
47
- - 最终实际 production RegistryStager+HTTP prepare-batch票据+commit/runBatch 完整路径通过,同PID,旧/新资源及Host逐项核验;另坏新条目衍生fixture触发实际恢复分支,目标失败、恢复applied分开。
48
- - 两次前置fixture准备尝试失败保留,未算通过;最终新cold归档基线通过。首轮故意改bareanchor未触发失败,不将其原因写成已确定Host故障。
49
-
50
- - 冻结核心后再次完整复验:同PID28448,116.418秒,service/staging/wsl-policy/generation前后摘要不变并与最终源码一致;缓存优化仅需4次元数据/3次归档fixture读取,仍严格核验。更新16active、回退15active及两次749项检查通过,临时根清理。不是现场网络可用性证明。
51
-
52
- 入口脚本(仓库开发材料,不随插件安装):`experiments/wsl-modern-proof-runner.mjs`。传输提供工作区已核验public归档副本,而非现场网络持续可用性;没有真实WSL模型或发行版任务连续性、浏览器交互证明。
53
-
54
- ## 常规Union npm/HMR故障记录(历史,故障不因新路线而消失)
55
-
56
- 公开 `0.10.24 → 0.10.25`:
57
-
58
- - 新进程冷安装 `0.10.25` applied,Host 1/1 active;包16文件与公开归档一致。
59
- - HMR官方更新:pnpm exit0,但加载 `TypeError: Cannot read properties of undefined (reading 'Element')`;自动恢复旧版也出现同导入错误。
60
- - 前后29依赖包、2289文件、约14.55MB完全一致;这不是发现依赖版本被替换的证据。circular dependency警告与冷热差异支持运行时重载问题,但没有证明私有缓存内部精确根因。
61
- - 无HMR、先冷旧基线:更新正确返回 `restart-required/no-hmr`,磁盘新包/来源/依赖字节一致;旧运行行不是新版代码证据。独立cold新版本证明包可加载。
62
-
63
- DSH公开管理器在HMR下拒绝重复安装已知registry包;关闭bundle不解除它,官方更新仍先移除再安装。未发现合法公共原位npm覆盖入口,不用别名、未知tarball、私有cache或底层profile写操作绕过。因此当时0.5.1的HMR配置中Union更新/来源迁移/恢复被具体标为 `dependency-runtime-reload-unverified`,而不是对所有JS依赖一概拒绝。非HMR真实重启路径保留,但不会自动改用户HMR或强制重启。
64
-
65
- 入口脚本(仓库开发材料,不随插件安装):`experiments/union-dependency-proof-runner.mjs`。
66
-
67
- ### 0.5.1对此问题的处理(历史)
68
-
69
- 当时0.5.1在原版DSH HMR环境中拒绝Union更新、来源迁移和恢复;版本扫描不因拒绝替换而假称没有新版。**拒绝是风险拦截,不是修复。仅安装本更新器无法完整解决该问题。**
70
-
71
- 此前对Union自身或Node/Electron的独立研究,涉及修改第三方插件或底层运行时,不属于本插件发布功能,也不是原版DSH下的插件验收。本更新器不部署这些补丁、不注入debugger、不强清缓存、不自动重启。需要单独冷启动/重启处理时由用户另行确认和验收;没有保证所有旧版均能热恢复。
72
-
73
- ## 历史实验保留边界
74
-
75
- - WSL保存来源仍为代际本地归档;公开详情扩展解决可发现性与操作衔接,**不等于宿主内置Versions认可registry身份**。关闭或卸载更新器后该扩展不在,未来需宿主来源扩展接口。
76
- - 已装依赖图摘要证明当时已声明dependencies的文件/解析关系,不覆盖完整peer解析身份、不证明全部依赖都来自公共npm或运行模块缓存已换代;root peer声明另行比较,Host再次下载也可能重新解析,所以后验失败不能冒充成功。
77
- - 独立检查与重复状态重验不是原子CAS,外部管理/CLI仍可并发;不保证恢复成功。
78
- - 上述历史开发实验未修改用户profile/安装/缓存,不自动批准脚本或豁免;没有扩展Mac。其当时的UI未验收状态不覆盖用户后来提供的0.5.3中文深色截图和实际WSL升级,其他未验证范围见上方当前状态。
1
+ # Windows支持扩展与公共API边界
2
+
3
+ ## 0.5.4来源修复
4
+
5
+ 用户已完成原npm0.5.0→0.5.3自身升级,临时来源已恢复。0.5.4修复官方首选+默认公共镜像fallback的准入缺口,不更改全局源;可能使用的镜像原包比对、完整计划绑定和额外同意,schema3保存新路线。原版rc.5owned-profile正常自身交接、目标激活失败后恢复通过;逻辑公开来源使用adapter,非真实网络fallback、浏览器新确认框或第二设备证明。真实网络fallback切换、该修复的未来自身升级及第二设备尚未验证;GitHub限流优化另行处理。
6
+
7
+ ## 已核验的本机结果与限定范围
8
+
9
+ - 本机更新器0.5.3已安装激活;用户在真实面板完成WSL0.26.2→0.29.0,日志applied、包和代际核验通过,当前16/16Host行active。
10
+ - WSL新候选按公开原包/现代声明契约和实际身份检查,不再仅限固定版本名单;旧根/全部保留原包证明、schema4及未知结果保护见[WSL结构准入](<WSL_STRUCTURAL_0_5_3.md>)。
11
+ - Union常规npm/HMR限制不变;**自0.5.2起另有已审查0.10.24→0.10.25完整依赖本地代际路线**,不是仅靠风险拦截,也不是修改宿主。来源转本地、额外确认、fresh恢复及未知/未审查目标拒绝见[Union代际](<UNION_GENERATION_0_5_2.md>)。
12
+ - Windows x64、Node≥24、宿主服务和.NET Framework4.x检测助手等条件见[运行要求](<WINDOWS_REQUIREMENTS.md>);没有写死本机路径,不代表第二台设备已验证。
13
+ - 本页下方保留的是0.5.1阶段的普通来源/镜像/WSL0.28实验和常规Union故障事实,**不是当前版本全部行为清单**,没有重新执行所有历史实验。
14
+
15
+ ## 0.5.1阶段已实现的路径(历史)
16
+
17
+ - 普通 registry 更新使用公开 `pluginManager.updateBundle`,保留精确 npm 安装规格和官方后续 Versions 资格。
18
+ - 更新器支持固定 npm 官方源及固定公共镜像 `https://registry.npmmirror.com`。镜像旧/新归档必须与官方同版本归档摘要及运行声明一致;需额外用户确认,绑定来源和已披露宿主计划,不修改 profile 配置。官方原有严格无 fallback 路径仍独立保留。
19
+ - 旧普通 Doctor 归档可在无待处理结果、身份与已装字节核验通过后,独立确认**同版本来源迁移**。不接受任意 file/git、自身或 WSL迁移;失败尝试恢复原记录归档,未知不重发。
20
+ - 不再仅因普通插件声明 dependencies 就拒绝。支持不变、可解析、无原生/安装生命周期脚本的 JS 依赖集合;对实际安装依赖包版本、边关系与全文件摘要在准备、替换前及替换后核验。只实现严格 semver 子集,不能解析的范围拒绝。
21
+ - WSL精确增加已审查 `0.28.0` 及原归档SHA256。已有部署归档、实际安装的全文件、根旧资源、保留代际、exports/patch分别核验,并重建已知原包组合;不接受未知代际。查询与预检不执行包代码。
22
+ - 官方插件详情通过公开 `plugins.detail.section` 提供**由更新器提供的独立归档版本检查**和打开更新面板入口。不会改宿主 `update` 字段或伪造内置 Versions。
23
+
24
+ ## 0.5.1阶段实际隔离验证(历史)
25
+
26
+ 均使用已安装 DSH Desktop **0.2.2-rc.5** 的 AppBoot/Cordis/Loader/HMR/PluginManager,自有临时profile/store/cache,禁止模型、用户发行版和真实用户任务;原始结果含本地路径,仅留在忽略目录。
27
+
28
+ ### 普通 npm 与纯 ESM 依赖
29
+
30
+ - 无依赖正常更新和故意激活失败自动恢复,各自同进程通过;新旧来源保持 npm,官方 Versions查询仍可用。
31
+ - 一项纯 ESM依赖、声明不变:新旧实际依赖版本/边关系/文件摘要一致,更新 Host active、代码标记有效、来源 registry。故意目标加载失败由 Host恢复旧版,升级仍为失败。
32
+ - 旧 file来源同版本迁移通过,npm来源和官方 Versions资格恢复;一次测试安装拒绝为明确fixture、没有包命令执行,迁移恢复原归档 applied,原代码及身份恢复。不是声称真实npm网络故障。
33
+
34
+ - 最后冻结核心后复跑上述四组,六项 production源码摘要与当前源码全部一致;各mode自有环境清理,成功/失败不靠重写结果。新旧图与来源的证据只限定这组纯ESMfixture和来源迁移,不扩大为所有社区依赖。
35
+
36
+ 入口脚本(仓库开发材料,不随插件安装):`experiments/registry-preservation-proof-runner.mjs`、`experiments/migration-deps-proof-runner.mjs`。
37
+
38
+ ### 公共镜像自身交接
39
+
40
+ 复制当前production代码的旧/新fixture、固定镜像/官方逻辑元数据及owned loopback传输映射。Host公共操作和真实包管理/卸载/激活/恢复不替换。好组单次交接到新版本、包/来源/YAML2.9.1/Host核验;坏组故意目标apply抛错,Host恢复旧版,失败保留。缺 `confirmPublicMirror`拒绝。每组保持同PID;旧disposer约1ms且不等待自身替换;临时根清理。
41
+
42
+ 该证明不是已经发布的真实旧 `0.5.0` 含镜像功能,也不是现场公共镜像网络安装。并行编辑造成部分client/service/staging摘要不同,原始结果有productionFilesSha256;不能把未匹配文件算作同一快照已验证。
43
+
44
+ 入口脚本(仓库开发材料,不随插件安装):`experiments/mirror-self-proof-runner.mjs`。
45
+
46
+ ### 新版 WSL 与历史根资源
47
+
48
+ - 原public归档 `0.28.0` SHA256:`c137376aba2b3973690ecef93baed9e4de79a22825ab5a50e92ae9ad2881e694`;版本清单、peer键和值、无依赖、客户端声明已审查,新增 `wsl-plugin-update` 是第16个Host条目。
49
+ - 冷0.26.2基线15active→0.28.0 16active→恢复0.26.2 15active,同PID。
50
+ - 复刻原0.24-root部署形态:准备、更新及恢复保留0.24根和24/26/28各自资源;每次749项文件字节核验。
51
+ - 最终实际 production RegistryStager+HTTP prepare-batch票据+commit/runBatch 完整路径通过,同PID,旧/新资源及Host逐项核验;另坏新条目衍生fixture触发实际恢复分支,目标失败、恢复applied分开。
52
+ - 两次前置fixture准备尝试失败保留,未算通过;最终新cold归档基线通过。首轮故意改bareanchor未触发失败,不将其原因写成已确定Host故障。
53
+
54
+ - 冻结核心后再次完整复验:同PID28448,116.418秒,service/staging/wsl-policy/generation前后摘要不变并与最终源码一致;缓存优化仅需4次元数据/3次归档fixture读取,仍严格核验。更新16active、回退15active及两次749项检查通过,临时根清理。不是现场网络可用性证明。
55
+
56
+ 入口脚本(仓库开发材料,不随插件安装):`experiments/wsl-modern-proof-runner.mjs`。传输提供工作区已核验public归档副本,而非现场网络持续可用性;没有真实WSL模型或发行版任务连续性、浏览器交互证明。
57
+
58
+ ## 常规Union npm/HMR故障记录(历史,故障不因新路线而消失)
59
+
60
+ 公开 `0.10.24 → 0.10.25`:
61
+
62
+ - 新进程冷安装 `0.10.25` applied,Host 1/1 active;包16文件与公开归档一致。
63
+ - HMR官方更新:pnpm exit0,但加载 `TypeError: Cannot read properties of undefined (reading 'Element')`;自动恢复旧版也出现同导入错误。
64
+ - 前后29依赖包、2289文件、约14.55MB完全一致;这不是发现依赖版本被替换的证据。circular dependency警告与冷热差异支持运行时重载问题,但没有证明私有缓存内部精确根因。
65
+ - 无HMR、先冷旧基线:更新正确返回 `restart-required/no-hmr`,磁盘新包/来源/依赖字节一致;旧运行行不是新版代码证据。独立cold新版本证明包可加载。
66
+
67
+ DSH公开管理器在HMR下拒绝重复安装已知registry包;关闭bundle不解除它,官方更新仍先移除再安装。未发现合法公共原位npm覆盖入口,不用别名、未知tarball、私有cache或底层profile写操作绕过。因此当时0.5.1的HMR配置中Union更新/来源迁移/恢复被具体标为 `dependency-runtime-reload-unverified`,而不是对所有JS依赖一概拒绝。非HMR真实重启路径保留,但不会自动改用户HMR或强制重启。
68
+
69
+ 入口脚本(仓库开发材料,不随插件安装):`experiments/union-dependency-proof-runner.mjs`。
70
+
71
+ ### 0.5.1对此问题的处理(历史)
72
+
73
+ 当时0.5.1在原版DSH HMR环境中拒绝Union更新、来源迁移和恢复;版本扫描不因拒绝替换而假称没有新版。**拒绝是风险拦截,不是修复。仅安装本更新器无法完整解决该问题。**
74
+
75
+ 此前对Union自身或Node/Electron的独立研究,涉及修改第三方插件或底层运行时,不属于本插件发布功能,也不是原版DSH下的插件验收。本更新器不部署这些补丁、不注入debugger、不强清缓存、不自动重启。需要单独冷启动/重启处理时由用户另行确认和验收;没有保证所有旧版均能热恢复。
76
+
77
+ ## 历史实验保留边界
78
+
79
+ - WSL保存来源仍为代际本地归档;公开详情扩展解决可发现性与操作衔接,**不等于宿主内置Versions认可registry身份**。关闭或卸载更新器后该扩展不在,未来需宿主来源扩展接口。
80
+ - 已装依赖图摘要证明当时已声明dependencies的文件/解析关系,不覆盖完整peer解析身份、不证明全部依赖都来自公共npm或运行模块缓存已换代;root peer声明另行比较,Host再次下载也可能重新解析,所以后验失败不能冒充成功。
81
+ - 独立检查与重复状态重验不是原子CAS,外部管理/CLI仍可并发;不保证恢复成功。
82
+ - 上述历史开发实验未修改用户profile/安装/缓存,不自动批准脚本或豁免;没有扩展Mac。其当时的UI未验收状态不覆盖用户后来提供的0.5.3中文深色截图和实际WSL升级,其他未验证范围见上方当前状态。
@@ -131,26 +131,29 @@ export function inspectSelfFiles(files, { version, role = 'next', resolvedYamlVe
131
131
  return { manifest, files };
132
132
  }
133
133
 
134
- /** The official path retains its strict no-fallback policy. The fixed mirror path
135
- * is separate and allows only already-configured, known public npm/mirror sources.
136
- * Returning normalized public facts permits confirmation to bind the entire plan.
134
+ /** Only the two fixed public origins are admitted. The legacy official-only path
135
+ * remains narrow; public fallback plans are independently disclosed and bound.
136
+ * No registry configuration is written and no private source is promoted.
137
137
  */
138
138
  export function verifySelfRegistryPlan(registries, queryRegistry) {
139
139
  const query = registryOrigin(queryRegistry);
140
140
  required(approvedPublicRegistry(query), 'self-query-origin-unverified');
141
- if (query !== PUBLIC_MIRROR) {
142
- required(plain(registries) && Array.isArray(registries.fallbackRegistries) && registries.fallbackRegistries.length === 0
143
- && (registries.registry === null ? publicRegistry(registries.resolved) : publicRegistry(registries.registry))
144
- && (registries.resolved == null || publicRegistry(registries.resolved)), 'self-host-registry-plan-unsupported');
145
- return { queryRegistry: PUBLIC_REGISTRY, registry: registries.registry === null ? null : PUBLIC_REGISTRY,
146
- resolved: registries.resolved == null ? null : PUBLIC_REGISTRY, fallbackRegistries: [] };
147
- }
148
- required(plain(registries) && Array.isArray(registries.fallbackRegistries) && registries.fallbackRegistries.length <= 8
149
- && approvedPublicRegistry(registries.resolved)
141
+ required(plain(registries) && Array.isArray(registries.fallbackRegistries) && registries.fallbackRegistries.length <= 8,
142
+ 'self-host-registry-plan-unsupported');
143
+ const legacyOfficial = query === PUBLIC_REGISTRY && registries.fallbackRegistries.length === 0
144
+ && (registries.registry === null ? publicRegistry(registries.resolved) : publicRegistry(registries.registry))
145
+ && (registries.resolved == null || publicRegistry(registries.resolved));
146
+ if (!legacyOfficial) required(approvedPublicRegistry(registries.resolved)
150
147
  && (registries.registry === null || approvedPublicRegistry(registries.registry))
151
148
  && registries.fallbackRegistries.every(approvedPublicRegistry), 'self-host-registry-plan-unsupported');
152
- return { queryRegistry: PUBLIC_MIRROR, registry: registries.registry === null ? null : registryOrigin(registries.registry),
153
- resolved: registryOrigin(registries.resolved), fallbackRegistries: registries.fallbackRegistries.map(registryOrigin) };
149
+ return { queryRegistry: query, registry: registries.registry === null ? null : registryOrigin(registries.registry),
150
+ resolved: registries.resolved == null ? null : registryOrigin(registries.resolved),
151
+ fallbackRegistries: registries.fallbackRegistries.map(registryOrigin) };
152
+ }
153
+ export function selfRegistrySourceMode(plan) {
154
+ if (plan.queryRegistry === PUBLIC_MIRROR) return 'public-mirror';
155
+ return plan.fallbackRegistries.length || plan.registry === PUBLIC_MIRROR || plan.resolved === PUBLIC_MIRROR
156
+ ? 'public-fallback' : 'official';
154
157
  }
155
158
  function metadataIdentity(metadata, version, inspected) {
156
159
  required(metadata.name === SELF_UPDATE_PACKAGE && metadata.version === version, 'self-registry-identity-mismatch');
@@ -223,6 +226,28 @@ export class SelfUpdatePreflight {
223
226
  constructor({ fetcher = fetch, compatibility, helperSha256 = SELF_UPDATE_HELPER_SHA256 } = {}) {
224
227
  Object.assign(this, { fetcher, compatibility, helperSha256 });
225
228
  }
229
+ async downloadArchive(url, options, version) {
230
+ // npmmirror's public tarball route uses one redirect to its fixed CDN.
231
+ // Follow only this exact package/version path, never automatic redirects.
232
+ const mirror = url.origin === PUBLIC_MIRROR;
233
+ let response = await this.fetcher(url, mirror ? { ...options, redirect: 'manual' } : options);
234
+ required(!response.url || response.url === url.href, 'self-tarball-origin-unsupported');
235
+ if (mirror && [301,302,303,307,308].includes(response.status)) {
236
+ const location = response.headers.get('location');
237
+ await response.body?.cancel();
238
+ const expected = `https://cdn.npmmirror.com/packages/${SELF_UPDATE_PACKAGE}/${version}/${SELF_UPDATE_PACKAGE}-${version}.tgz`;
239
+ required(location === expected, 'self-tarball-origin-unsupported');
240
+ options.signal.throwIfAborted();
241
+ response = await this.fetcher(expected, { ...options, redirect: 'manual' });
242
+ required(!response.url || response.url === expected, 'self-tarball-origin-unsupported');
243
+ if ([301,302,303,307,308].includes(response.status)) {
244
+ await response.body?.cancel();
245
+ refuse('self-tarball-origin-unsupported');
246
+ }
247
+ }
248
+ required(response.ok, 'self-archive-unavailable');
249
+ return response;
250
+ }
226
251
  async fetchArchive(version, role, resolvedYamlVersion, signal, registry = PUBLIC_REGISTRY) {
227
252
  const source = registryOrigin(registry);
228
253
  required(approvedPublicRegistry(source) && VERSION.test(version ?? ''), 'self-query-origin-unverified');
@@ -240,8 +265,7 @@ export class SelfUpdatePreflight {
240
265
  required(url.protocol === 'https:' && (url.origin === origin || origin === PUBLIC_MIRROR && url.origin === PUBLIC_REGISTRY)
241
266
  && !url.username && !url.password && !url.search && !url.hash
242
267
  && url.pathname === `/${SELF_UPDATE_PACKAGE}/-/${SELF_UPDATE_PACKAGE}-${version}.tgz`, 'self-tarball-origin-unsupported');
243
- const response = await this.fetcher(url, options); required(response.ok, 'self-archive-unavailable');
244
- required(!response.url || response.url === url.href, 'self-tarball-origin-unsupported');
268
+ const response = await this.downloadArchive(url, options, version);
245
269
  const bytes = await body(response, MAX_ARCHIVE); verifyIntegrity(bytes, metadata.dist?.integrity);
246
270
  const inspected = inspectSelfArchive(bytes, { version, role, resolvedYamlVersion, compatibility: this.compatibility, helperSha256: this.helperSha256 });
247
271
  metadataIdentity(metadata, version, inspected);
@@ -261,19 +285,26 @@ export class SelfUpdatePreflight {
261
285
  required(bundle?.name === SELF_UPDATE_PACKAGE && bundle.update === 'registry' && bundle.installed === true && bundle.enabled === true
262
286
  && bundle.removable === true && bundle.availability === 'profile' && !bundle.readOnlyReason && !bundle.error, 'self-installed-source-unsupported');
263
287
  required(stableNewer(targetVersion, bundle.version), 'self-target-version-unsupported');
264
- const registry = registryOrigin(queryRegistry), publicMirror = registry === PUBLIC_MIRROR;
288
+ const registry = registryOrigin(queryRegistry);
265
289
  const hostRegistryPlan = verifySelfRegistryPlan(registries, queryRegistry);
290
+ const sourceMode = selfRegistrySourceMode(hostRegistryPlan), publicMirror = sourceMode === 'public-mirror', publicFallback = sourceMode === 'public-fallback';
266
291
  signal?.throwIfAborted();
267
292
  const previous = await this.fetchArchive(bundle.version, 'previous', resolvedYamlVersion, signal, registry);
268
293
  await verifyCurrentFiles(currentDirectory, previous.files);
269
294
  const next = await this.fetchArchive(targetVersion, 'next', resolvedYamlVersion, signal, registry);
295
+ if (publicFallback && [hostRegistryPlan.registry, hostRegistryPlan.resolved, ...hostRegistryPlan.fallbackRegistries].includes(PUBLIC_MIRROR)) {
296
+ const mirrorPrevious = await this.fetchArchive(bundle.version, 'previous', resolvedYamlVersion, signal, PUBLIC_MIRROR);
297
+ const mirrorNext = await this.fetchArchive(targetVersion, 'next', resolvedYamlVersion, signal, PUBLIC_MIRROR);
298
+ required(mirrorPrevious.sha256 === previous.sha256 && mirrorNext.sha256 === next.sha256, 'self-public-mirror-archive-mismatch');
299
+ }
270
300
  for (const key of ['exports', 'peerDependencies', 'engines']) required(equal(previous.manifest[key], next.manifest[key]), 'self-runtime-graph-changed');
271
301
  required(equal(previous.manifest.dsh.client, next.manifest.dsh.client), 'self-runtime-graph-changed');
272
302
  const publicArchive = value => ({ sha256: value.sha256, integrity: value.integrity, manifest: value.manifest,
273
303
  files: Object.fromEntries([...value.files].map(([path, bytes]) => [path, digest(bytes)])) });
274
304
  signal?.throwIfAborted();
275
305
  return { name: SELF_UPDATE_PACKAGE, from: bundle.version, to: targetVersion, registry, currentManifest: previous.manifest,
276
- ...(publicMirror ? { sourceMode: 'public-mirror', publicMirror: true, hostRegistryPlan } : {}),
306
+ ...(publicMirror ? { sourceMode: 'public-mirror', publicMirror: true, hostRegistryPlan }
307
+ : publicFallback ? { sourceMode: 'public-fallback', publicFallback: true, hostRegistryPlan } : {}),
277
308
  previous: publicArchive(previous), next: publicArchive(next) };
278
309
  }
279
310
  /** Verify the recorded original resource hashes locally, independently of version labels and registry queries. */
@@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
4
4
  import { boundedFile } from './file-read.js';
5
5
  import { PUBLIC_REGISTRY, PUBLIC_MIRROR, approvedPublicRegistry, registryOrigin } from './source.js';
6
6
  import { parseSelfGithubSource, SELF_UPDATE_GITHUB_REPOSITORY } from './self-update-github.js';
7
- import { verifySelfRegistryPlan } from './self-update-policy.js';
7
+ import { verifySelfRegistryPlan, selfRegistrySourceMode } from './self-update-policy.js';
8
8
 
9
9
  const SELF = 'dsh-plugin-update-doctor';
10
10
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
@@ -13,7 +13,7 @@ const SHA = /^[a-f0-9]{64}$/;
13
13
  const APPLICATION = new Set(['applied', 'failed', 'cancelled', 'restart-required', 'overridden']);
14
14
  const STAGES = new Set(['install', 'enable', 'remove']);
15
15
  const RESTART = new Set(['no-hmr', 'package-moved', 'host-module', 'unmanaged-plugin', 'module-comparison']);
16
- const ATTEMPT_KEYS = new Set(['schemaVersion', 'id', 'name', 'from', 'to', 'registry', 'sourceKind', 'sourceMode', 'publicMirror', 'confirmPublicMirror', 'hostRegistryPlan', 'repository', 'fromCommit', 'toCommit', 'pid', 'startedAt', 'taskPolicy', 'confirmCancel', 'previousSha256', 'nextSha256', 'previousFiles', 'nextFiles']);
16
+ const ATTEMPT_KEYS = new Set(['schemaVersion', 'id', 'name', 'from', 'to', 'registry', 'sourceKind', 'sourceMode', 'publicMirror', 'publicFallback', 'confirmPublicMirror', 'hostRegistryPlan', 'repository', 'fromCommit', 'toCommit', 'pid', 'startedAt', 'taskPolicy', 'confirmCancel', 'previousSha256', 'nextSha256', 'previousFiles', 'nextFiles']);
17
17
  const RESULT_KEYS = new Set(['schemaVersion', 'id', 'finishedAt', 'official', 'outcome', 'error', 'truncated']);
18
18
  const HANDOFF_KEYS = new Set(['schemaVersion', 'id', 'handedOffAt']);
19
19
  const object = value => !!value && typeof value === 'object' && !Array.isArray(value);
@@ -35,30 +35,34 @@ export class SelfUpdateStore {
35
35
  if (!object(value)) fail('self-update-attempt-invalid');
36
36
  if (reading) {
37
37
  exactKeys(value, ATTEMPT_KEYS);
38
- if (![1,2].includes(value.schemaVersion) || value.name !== SELF || ['id', 'from', 'to', 'pid', 'startedAt', 'taskPolicy', 'confirmCancel'].some(key => !Object.hasOwn(value, key))) fail('self-update-record-format');
38
+ if (![1,2,3].includes(value.schemaVersion) || value.name !== SELF || ['id', 'from', 'to', 'pid', 'startedAt', 'taskPolicy', 'confirmCancel'].some(key => !Object.hasOwn(value, key))) fail('self-update-record-format');
39
39
  if (!Number.isSafeInteger(value.pid) || value.pid < 1 || typeof value.confirmCancel !== 'boolean' || !['wait-for-idle', 'cancel-active'].includes(value.taskPolicy)) fail('self-update-record-format');
40
40
  timestamp(value.startedAt);
41
41
  }
42
42
  const id = identifier(value.id ?? randomUUID());
43
43
  if (!VERSION.test(value.from ?? '') || !VERSION.test(value.to ?? '') || value.from === value.to) fail('self-update-attempt-target');
44
- const git = value.sourceKind === 'git', publicMirror = registryOrigin(value.registry) === PUBLIC_MIRROR;
44
+ const git = value.sourceKind === 'git', publicMirror = registryOrigin(value.registry) === PUBLIC_MIRROR, publicFallback = value.sourceMode === 'public-fallback';
45
45
  let source;
46
46
  if (git) {
47
- if (value.registry !== undefined || ['sourceMode','publicMirror','confirmPublicMirror','hostRegistryPlan'].some(key=>value[key]!==undefined) || value.repository !== SELF_UPDATE_GITHUB_REPOSITORY || value.fromCommit === value.toCommit) fail('self-update-attempt-target');
47
+ if (value.registry !== undefined || ['sourceMode','publicMirror','publicFallback','confirmPublicMirror','hostRegistryPlan'].some(key=>value[key]!==undefined) || value.repository !== SELF_UPDATE_GITHUB_REPOSITORY || value.fromCommit === value.toCommit) fail('self-update-attempt-target');
48
48
  const previous = parseSelfGithubSource('github:' + value.repository + '#' + value.fromCommit), next = parseSelfGithubSource('github:' + value.repository + '#' + value.toCommit);
49
49
  source = { sourceKind: 'git', repository: SELF_UPDATE_GITHUB_REPOSITORY, fromCommit: previous.commit, toCommit: next.commit };
50
50
  } else {
51
51
  if (value.sourceKind !== undefined && value.sourceKind !== 'registry' || !approvedPublicRegistry(value.registry)
52
52
  || ['repository', 'fromCommit', 'toCommit'].some(key => value[key] !== undefined)) fail('self-update-attempt-target');
53
- if (publicMirror) {
54
- if (value.sourceMode !== 'public-mirror' || value.publicMirror !== true || value.confirmPublicMirror !== true
55
- || reading && value.schemaVersion !== 2) fail('self-update-attempt-target');
53
+ if (publicMirror || publicFallback) {
54
+ const mode = publicMirror ? 'public-mirror' : 'public-fallback';
55
+ if (value.sourceMode !== mode || value.confirmPublicMirror !== true
56
+ || publicMirror && (value.publicMirror !== true || value.publicFallback !== undefined)
57
+ || publicFallback && (registryOrigin(value.registry) !== PUBLIC_REGISTRY || value.publicFallback !== true || value.publicMirror !== undefined)
58
+ || reading && value.schemaVersion !== (publicFallback ? 3 : 2)) fail('self-update-attempt-target');
56
59
  exactKeys(value.hostRegistryPlan,new Set(['queryRegistry','registry','resolved','fallbackRegistries']));
57
- const plan=verifySelfRegistryPlan(value.hostRegistryPlan,PUBLIC_MIRROR);
58
- if(value.hostRegistryPlan.queryRegistry!==PUBLIC_MIRROR)fail('self-update-attempt-target');
59
- source = { registry: PUBLIC_MIRROR, sourceMode:'public-mirror', publicMirror:true, confirmPublicMirror:true, hostRegistryPlan:plan };
60
+ const registry = publicMirror ? PUBLIC_MIRROR : PUBLIC_REGISTRY;
61
+ const plan=verifySelfRegistryPlan(value.hostRegistryPlan,registry);
62
+ if(value.hostRegistryPlan.queryRegistry!==registry || selfRegistrySourceMode(plan)!==mode)fail('self-update-attempt-target');
63
+ source = { registry, sourceMode:mode, ...(publicMirror ? {publicMirror:true} : {publicFallback:true}), confirmPublicMirror:true, hostRegistryPlan:plan };
60
64
  } else {
61
- if (['sourceMode','publicMirror','confirmPublicMirror','hostRegistryPlan'].some(key=>value[key]!==undefined) || reading && value.schemaVersion !== 1) fail('self-update-attempt-target');
65
+ if (['sourceMode','publicMirror','publicFallback','confirmPublicMirror','hostRegistryPlan'].some(key=>value[key]!==undefined) || reading && value.schemaVersion !== 1) fail('self-update-attempt-target');
62
66
  source = { registry: PUBLIC_REGISTRY };
63
67
  }
64
68
  }
@@ -67,7 +71,7 @@ export class SelfUpdateStore {
67
71
  const taskPolicy = value.taskPolicy ?? 'wait-for-idle', confirmCancel = value.confirmCancel ?? false;
68
72
  if (!['wait-for-idle', 'cancel-active'].includes(taskPolicy) || typeof confirmCancel !== 'boolean' || taskPolicy === 'cancel-active' && !confirmCancel || taskPolicy === 'wait-for-idle' && confirmCancel) fail('self-update-task-policy');
69
73
  if (git && reading && value.schemaVersion !== 1) fail('self-update-attempt-target');
70
- const result = { schemaVersion: publicMirror ? 2 : 1, id, name: SELF, from: value.from, to: value.to, ...source, pid, startedAt: timestamp(value.startedAt ?? this.time()), taskPolicy, confirmCancel };
74
+ const result = { schemaVersion: publicFallback ? 3 : publicMirror ? 2 : 1, id, name: SELF, from: value.from, to: value.to, ...source, pid, startedAt: timestamp(value.startedAt ?? this.time()), taskPolicy, confirmCancel };
71
75
  for (const key of ['previousSha256', 'nextSha256']) if (value[key] !== undefined) { if (!SHA.test(value[key])) fail('self-update-digest-invalid'); result[key] = value[key]; }
72
76
  for (const key of ['previousFiles', 'nextFiles']) if (value[key] !== undefined) {
73
77
  if (!object(value[key]) || Object.keys(value[key]).length === 0 || Object.keys(value[key]).length > 128) fail('self-update-files-invalid');
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { PUBLIC_MIRROR, approvedPublicRegistry, registryOrigin, readRegistryVersions } from './source.js';
3
3
  import { versionDiscovery } from './online.js';
4
- import { verifySelfRegistryPlan } from './self-update-policy.js';
4
+ import { verifySelfRegistryPlan, selfRegistrySourceMode } from './self-update-policy.js';
5
5
  import { SelfUpdateStore } from './self-update-store.js';
6
6
  import { parseSelfGithubSource } from './self-update-github.js';
7
7
 
@@ -61,11 +61,16 @@ export class SelfUpdateCoordinator {
61
61
  async checkOffer(bundle, offer, query, signal) {
62
62
  const common = { bundle, currentDirectory: await this.resolvePackage(SELF_UPDATE_PACKAGE), targetVersion: offer.version, resolvedYamlVersion: await this.resolveYamlVersion(), signal };
63
63
  if (bundle.update === 'git') return this.githubPreflight.check({ ...common, targetCommit: offer.commit });
64
- const checked = await this.preflight.check({ ...common, registries: await this.manager.registries(), queryRegistry: query.registry });
65
64
  const selectedRegistry = registryOrigin(query.registry);
66
- if (selectedRegistry === PUBLIC_MIRROR && (checked.registry !== selectedRegistry || checked.sourceMode !== 'public-mirror' || checked.publicMirror !== true || !checked.hostRegistryPlan)) throw failure('self-public-mirror-preflight-unverified', 'Mirror canonical archive verification and its bound public registry plan were not provided.');
67
- await this.checkRegistryPlan(selectedRegistry, signal, checked.hostRegistryPlan);
68
- return { ...checked, registry: selectedRegistry };
65
+ const expectedPlan = verifySelfRegistryPlan(await this.manager.registries(), selectedRegistry);
66
+ const checked = await this.preflight.check({ ...common, registries: await this.manager.registries(), queryRegistry: query.registry });
67
+ const expectedMode = selfRegistrySourceMode(expectedPlan);
68
+ if (expectedMode !== 'official' && (checked.registry !== selectedRegistry || checked.sourceMode !== expectedMode
69
+ || expectedMode === 'public-mirror' && checked.publicMirror !== true || expectedMode === 'public-fallback' && checked.publicFallback !== true
70
+ || !checked.hostRegistryPlan)) throw failure('self-public-mirror-preflight-unverified', 'Canonical public archive verification and the bound registry/fallback plan were not provided.');
71
+ if (checked.hostRegistryPlan && JSON.stringify(checked.hostRegistryPlan) !== JSON.stringify(expectedPlan)) throw failure('self-registry-plan-changed', 'The registry/fallback plan changed during archive inspection.');
72
+ await this.checkRegistryPlan(selectedRegistry, signal, expectedPlan);
73
+ return { ...checked, registry: selectedRegistry, hostRegistryPlan: expectedPlan };
69
74
  }
70
75
  async checkRegistryPlan(registry, signal, expectedPlan) {
71
76
  const actual = verifySelfRegistryPlan(await this.manager.registries(), registry);
@@ -81,12 +86,12 @@ export class SelfUpdateCoordinator {
81
86
  assertPrepared(actual, prepared) {
82
87
  if (actual.previous.sha256 !== prepared.previous.sha256 || actual.next.sha256 !== prepared.next.sha256
83
88
  || actual.sourceKind !== prepared.sourceKind || actual.fromCommit !== prepared.fromCommit || actual.toCommit !== prepared.toCommit
84
- || actual.registry !== prepared.registry || actual.sourceMode !== prepared.sourceMode || actual.publicMirror !== prepared.publicMirror
89
+ || actual.registry !== prepared.registry || actual.sourceMode !== prepared.sourceMode || actual.publicMirror !== prepared.publicMirror || actual.publicFallback !== prepared.publicFallback
85
90
  || JSON.stringify(actual.hostRegistryPlan) !== JSON.stringify(prepared.hostRegistryPlan)
86
91
  || actual.nextSpec !== prepared.nextSpec) throw failure('self-update-archive-changed', 'Prepared source identities or package bytes changed; prepare a new confirmation.');
87
92
  }
88
93
  async scan(signal) {
89
- let discovery = { versionStatus:'not-checked', latestVersion:null, latestPublishedVersion:null }, registry = null;
94
+ let discovery = { versionStatus:'not-checked', latestVersion:null, latestPublishedVersion:null }, registry = null, sourceMode = null;
90
95
  try {
91
96
  const { bundle, rows } = await this.current(); this.assertBundle(bundle, rows);
92
97
  const query = await this.discoverVersions(bundle, signal);
@@ -97,7 +102,7 @@ export class SelfUpdateCoordinator {
97
102
  if (bundle.update !== 'git') {
98
103
  if (!approvedPublicRegistry(registry)) reasons.push(registry ? 'self-update-public-origin-required' : 'self-query-origin-unverified');
99
104
  else {
100
- try { verifySelfRegistryPlan(await this.manager.registries(), registry); }
105
+ try { sourceMode = selfRegistrySourceMode(verifySelfRegistryPlan(await this.manager.registries(), registry)); }
101
106
  catch (error) { if (signal?.aborted) throw error; reasons.push(error.code ?? 'self-query-origin-unverified'); }
102
107
  }
103
108
  }
@@ -111,7 +116,8 @@ export class SelfUpdateCoordinator {
111
116
  const updateStatus = canUpdate ? 'available' : reasons.length ? 'blocked' : 'no-update';
112
117
  return { name:SELF_UPDATE_PACKAGE, version:bundle.version, ...discovery, versionChecked:discovery.versionStatus !== 'error',
113
118
  ...(bundle.update === 'git' ? { sourceKind:'git', repository:query.repository, branch:'main', sourceLabel:'GitHub main HEAD (not a release)', latestCommit:offered?.commit ?? null, currentCommit:parseSelfGithubSource(bundle.source).commit } : { sourceKind:'registry', registry,
114
- ...(registry === PUBLIC_MIRROR ? { sourceMode:'public-mirror', publicMirror:true, mirrorRiskRequiresAcknowledgement:true, infoWarnings:['public-mirror-may-lag'] } : {}) }),
119
+ ...(sourceMode === 'public-mirror' ? { sourceMode, publicMirror:true, mirrorRiskRequiresAcknowledgement:true, infoWarnings:['public-mirror-may-lag'] }
120
+ : sourceMode === 'public-fallback' ? { sourceMode, publicFallback:true, mirrorRiskRequiresAcknowledgement:true, infoWarnings:['public-fallback-may-use-mirror'] } : {}) }),
115
121
  canUpdate, updateStatus, status:updateStatus === 'blocked' ? 'blocked' : discovery.versionStatus, mode:'host-self-update', reasons:[...new Set(reasons)] };
116
122
  } catch (error) {
117
123
  if (signal?.aborted) throw error;
@@ -131,8 +137,9 @@ export class SelfUpdateCoordinator {
131
137
  async prepare(version, signal, { issueTicket = true, targetCommit } = {}) {
132
138
  if (!stable(version)) throw failure('invalid-version', 'An exact stable version is required.');
133
139
  const { bundle, checked, fingerprint } = await this.validateTarget(version, signal, targetCommit);
134
- const git = bundle.update === 'git', publicMirror = !git && checked.registry === PUBLIC_MIRROR;
135
- const mirrorFields = publicMirror ? { registry: checked.registry, sourceMode:'public-mirror', publicMirror:true, mirrorRiskRequiresAcknowledgement:true, hostRegistryPlan:checked.hostRegistryPlan } : {};
140
+ const git = bundle.update === 'git', publicMirror = !git && checked.sourceMode === 'public-mirror', publicFallback = !git && checked.sourceMode === 'public-fallback';
141
+ const mirrorFields = publicMirror || publicFallback ? { registry: checked.registry, sourceMode:checked.sourceMode,
142
+ ...(publicMirror ? { publicMirror:true } : { publicFallback:true }), mirrorRiskRequiresAcknowledgement:true, hostRegistryPlan:checked.hostRegistryPlan } : {};
136
143
  const plan = { id: randomUUID(), operation: 'host-self-update', profile: this.profile.name, ...mirrorFields,
137
144
  items: [{ name: SELF_UPDATE_PACKAGE, from: bundle.version, to: version, version, mode: 'host-self-update', highImpact: true,
138
145
  ...(git ? { sourceKind: 'git', repository: checked.repository, fromCommit: checked.fromCommit, toCommit: checked.toCommit } : { sourceKind: 'registry', registry: checked.registry, ...mirrorFields }) }],
@@ -142,6 +149,7 @@ export class SelfUpdateCoordinator {
142
149
  git ? 'GitHub main HEAD is discovery, not a signed release. The confirmed full commit pins the target. The Host fetches it again; preflight is not an atomic byte replacement.' : 'Downloaded old/new archives are preflight evidence only. The Host downloads registry packages again; it has no exact-archive replacement or atomic compare-and-swap API.',
143
150
  ...(git ? ['GitHub package dependencies use the existing Host registry configuration. No registry migration or build-script approval is granted; Host restoration uses the old saved commit and is verified separately.'] : []),
144
151
  ...(publicMirror ? ['The fixed public mirror may lag. Its prepared updater bytes must match canonical official npm archives, but the Host downloads again and may use existing known-public fallback/dependency sources. This is not a public-only atomic archive replacement or a guarantee of successful installation/recovery. Confirm this mirror risk separately; no source configuration is changed.'] : []),
152
+ ...(publicFallback ? ['Official npm is the query source, while the displayed existing public plan permits fallback. Potential mirror updater archives are compared with canonical npm before confirmation. The Host refetches and may use those public fallbacks; no global source is changed, no exact-byte transaction is promised, and fallback risk requires separate consent.'] : []),
145
153
  'The panel may disappear and reload. Missing final evidence remains unknown and is never automatically retried. If both installation and Host recovery fail, use the official manager.'] };
146
154
  if (!issueTicket) return this.redact(plan);
147
155
  const ticket = randomUUID(); this.tickets.clear(); this.tickets.set(ticket, { plan, checked, fingerprint });
@@ -152,7 +160,7 @@ export class SelfUpdateCoordinator {
152
160
  const prepared = this.tickets.get(ticket); this.tickets.delete(ticket);
153
161
  if (!prepared || this.now() >= Date.parse(prepared.plan.expiresAt)) throw failure('stale-confirmation', 'Self-update confirmation expired; prepare again.');
154
162
  if (!['wait-for-idle', 'cancel-active'].includes(taskPolicy) || taskPolicy === 'cancel-active' && confirmCancel !== true) throw failure('task-confirmation-required', 'Stopping tasks requires separate explicit consent.');
155
- if (prepared.checked.sourceMode === 'public-mirror' && confirmPublicMirror !== true) throw failure('self-public-mirror-confirmation-required', 'The fixed public mirror risk requires separate explicit consent.');
163
+ if (['public-mirror','public-fallback'].includes(prepared.checked.sourceMode) && confirmPublicMirror !== true) throw failure('self-public-mirror-confirmation-required', 'The public mirror/fallback risk requires separate explicit consent.');
156
164
  await this.assertAvailable();
157
165
  const { bundle, rows } = await this.current(); this.assertBundle(bundle, rows);
158
166
  if (this.fingerprint(bundle) !== prepared.fingerprint) throw failure('state-changed', 'The updater changed since confirmation preparation.');
@@ -163,7 +171,10 @@ export class SelfUpdateCoordinator {
163
171
  try {
164
172
  const source = prepared.checked.sourceKind === 'git'
165
173
  ? { sourceKind: 'git', repository: prepared.checked.repository, fromCommit: prepared.checked.fromCommit, toCommit: prepared.checked.toCommit }
166
- : { registry: prepared.checked.registry, ...(prepared.checked.sourceMode === 'public-mirror' ? { sourceMode:'public-mirror', publicMirror:true, confirmPublicMirror:true, hostRegistryPlan:prepared.checked.hostRegistryPlan } : {}) };
174
+ : { registry: prepared.checked.registry, ...(prepared.checked.sourceMode === 'public-mirror'
175
+ ? { sourceMode:'public-mirror', publicMirror:true, confirmPublicMirror:true, hostRegistryPlan:prepared.checked.hostRegistryPlan }
176
+ : prepared.checked.sourceMode === 'public-fallback'
177
+ ? { sourceMode:'public-fallback', publicFallback:true, confirmPublicMirror:true, hostRegistryPlan:prepared.checked.hostRegistryPlan } : {}) };
167
178
  await this.store.start({ id, name: SELF_UPDATE_PACKAGE, from: bundle.version, to: prepared.plan.items[0].to, ...source, startedAt: new Date(this.now()).toISOString(), taskPolicy, confirmCancel: taskPolicy === 'cancel-active', previousSha256: prepared.checked.previous.sha256, nextSha256: prepared.checked.next.sha256,
168
179
  ...(prepared.checked.previous.files ? { previousFiles: prepared.checked.previous.files } : {}), ...(prepared.checked.next.files ? { nextFiles: prepared.checked.next.files } : {}) });
169
180
  } catch (error) { this.job = null; throw error; }
@@ -174,7 +185,7 @@ export class SelfUpdateCoordinator {
174
185
  async run(job, policy) {
175
186
  try {
176
187
  // Recheck source, bytes and state before task cancellation and before any mutation.
177
- if (job.prepared.checked.sourceMode === 'public-mirror' && policy.confirmPublicMirror !== true) throw failure('self-public-mirror-confirmation-required', 'The confirmed mirror risk consent is missing.');
188
+ if (['public-mirror','public-fallback'].includes(job.prepared.checked.sourceMode) && policy.confirmPublicMirror !== true) throw failure('self-public-mirror-confirmation-required', 'The confirmed public mirror/fallback risk consent is missing.');
178
189
  const target = job.prepared.plan.items[0].to;
179
190
  const { bundle, rows } = await this.current(); this.assertBundle(bundle, rows);
180
191
  if (this.fingerprint(bundle) !== job.prepared.fingerprint || this.unavailable()) throw failure('state-changed', 'Updater state changed before handoff.');
@@ -224,7 +235,7 @@ export class SelfUpdateCoordinator {
224
235
  const entry = id ? await this.store.read(id) : await this.store.latest();
225
236
  if (!entry?.attempt) return entry;
226
237
  const current = await this.current();
227
- const git = entry.attempt.sourceKind === 'git', publicMirror = entry.attempt.sourceMode === 'public-mirror';
238
+ const git = entry.attempt.sourceKind === 'git', publicMirror = ['public-mirror','public-fallback'].includes(entry.attempt.sourceMode);
228
239
  const verify = async (version, files, expectedCommit) => {
229
240
  let packageStatus = 'unknown', sourceStatus = git || publicMirror ? 'unknown' : undefined;
230
241
  if (git) {
@@ -243,7 +254,8 @@ export class SelfUpdateCoordinator {
243
254
  const hostStatus = current.bundle?.version === version && expectedRows && current.rows.every(row => row.enabled && row.fiberPhase === 'active') ? 'active' : 'unknown';
244
255
  return { package: { status: packageStatus, version: current.bundle?.version ?? null, expectedVersion: version }, host: { status: hostStatus, activeRows: current.rows.filter(row => row.enabled && row.fiberPhase === 'active').length, totalRows: current.rows.length },
245
256
  ...(git ? { source: { status: sourceStatus, repository: entry.attempt.repository, expectedCommit } } : publicMirror ?
246
- { source:{status:sourceStatus,expectedKind:'registry',kind:current.bundle?.update??'unknown',confirmedRegistry:entry.attempt.registry,sourceMode:'public-mirror',publicMirror:true,transportVerified:false} } : {}) };
257
+ { source:{status:sourceStatus,expectedKind:'registry',kind:current.bundle?.update??'unknown',confirmedRegistry:entry.attempt.registry,sourceMode:entry.attempt.sourceMode,
258
+ ...(entry.attempt.sourceMode === 'public-mirror' ? {publicMirror:true} : {publicFallback:true}),transportVerified:false} } : {}) };
247
259
  };
248
260
  const verification = await verify(entry.attempt.to, entry.attempt.nextFiles, entry.attempt.toCommit);
249
261
  const restoreVerification = entry.result?.restore ? await verify(entry.attempt.from, entry.attempt.previousFiles, entry.attempt.fromCommit) : undefined;
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Plugin online updates",
4
- "description": "Local-test v0.5.3 is not published to public npm. Public npm remains v0.5.0; local archives require separate installation through the official manager. Final archive and local-install results are recorded in the delivered acceptance report; new-dialog browser checks and live UI acceptance remain pending. Open Plugin online updates in the sidebar, check all updates, select eligible compatible stable releases, then review Update selected. At most 20 targets per batch; initial opening does not query or select updates. Version discovery and replacement admission are separate and source-scoped; a failed or incomplete check does not mean up to date. Wait for current tasks to finish naturally by default. Stopping current Agent activities requires additional consent, clears queued input and cannot undo completed operations. External terminals and independent Workers are never killed; DSH is not automatically closed or restarted. Normal npm updates use the official exact-version Host path, preserve npm identity and verify files and activation. The Host refetches using existing fallback settings; prepared bytes are not an atomic exact-byte installation guarantee. Only identified, byte-verified older ordinary Doctor archives can migrate back to npm at the same version after independent confirmation. Self, WSL, arbitrary local, Git and linked installations are not automatically migrated. JS dependencies are limited to reviewed unchanged declarations and verified installed graphs and files without native dependencies or install lifecycle scripts. Fixed public-mirror paths require canonical archive comparison and additional consent without silently changing registry configuration. WSL candidates are checked against canonical public archives and the modern declaration contract instead of a fixed version allowlist. Production 0.26.2 to 0.29.0 updates and preprepared old-package restoration passed in an owned isolated Host. Schema4 retains all original-archive proofs; unknown install/reapply/recovery outcomes are not resent and retained generations are never silently deleted; old resources remain, the source remains a local archive, and existing sessions may retain old presets. The detail-page extension is a separate read-only Doctor check and navigation entry, not built-in Versions or an installer. Self-update is confirmed separately under its npm, fixed public-mirror or fixed full-commit GitHub policy; GitHub main HEAD is not a signed Release. Target failure and recovery are recorded separately; unknown outcomes are not resent. Stock Union Search npm/HMR remains unsafe for hot updates. v0.5.1 only blocked that risk, which is not a fix. v0.5.2 adds the reviewed 0.10.24 to 0.10.25 complete-dependency local generation route: original JavaScript and dependency bytes remain unchanged, target and distinct fresh recovery archives are prepared before replacement, and actual Loader generation identity is verified for enabled plugins. The installation becomes a Doctor-owned local archive, not npm; built-in Versions eligibility is not preserved and extra source acknowledgement is required. Unreviewed versions, unknown outcomes and unverifiable current generations remain blocked; retained-generation exhaustion refuses before mutation without silently deleting old resources. Installing the updater does not automatically update Union or WSL. No DSH, Node or Electron patching, debugger injection, forced cache clearing, process termination, unlocking, elevation, script approval or version exemptions. Local diagnostics are not uploaded. Windows x64 only; real-plugin upgrade and browser acceptance remain pending."
4
+ "description": "Check and update eligible plugins while stock DeepSeek Harness stays running. Open Plugin online updates, check all updates, review versions, query sources and replacement conditions, then select and confirm. At most 20 targets per batch; initial opening does not query or select. Wait for tasks to finish naturally by default. Stopping current Agent activities needs separate consent, can clear queued input and cannot undo completed work. External terminals and independent Workers are never killed; DSH is not automatically closed or restarted. Normal npm updates use the official exact-version Host path and retain npm identity. Prepared archives are preflight evidence: the Host downloads again, and installation or recovery is not an atomic exact-byte transaction. Self-update is separate and supports official npm, the fixed public mirror/fallback plan and this repository pinned to a full GitHub commit; sources are not silently migrated. Default registry values are resolved through Host observations. Mirror/fallback archives require canonical npm comparison and extra consent without changing global source settings. npmmirror downloads permit only one exact package/version redirect to its fixed CDN; private, unknown or unverifiable origins remain blocked. JS dependency support is limited to unchanged declarations and verified installed graphs/files without native dependencies or install lifecycle scripts. WSL candidates use public archives and the modern Host declaration contract rather than a fixed version allowlist; original proofs and old resources remain, existing sessions may retain old presets, and generated packages remain local archives. The stock Union Search npm/HMR path does not support safe hot updates: older 0.5.1 only blocked the risk, which is not a fix. A separate reviewed 0.10.24 to 0.10.25 complete-dependency generation requires acknowledgement of the local source, temporary unload and recovery risk; built-in Versions eligibility is not retained. Target updates, restoration, installed files, Host activation and page synchronization are independent observations. Unknown outcomes are not automatically resent; missing proofs or exhausted retention bounds refuse before mutation. The detail extension only checks and navigates, not installs. This plugin does not patch DSH/Node/Electron, elevate, force unlock, terminate user processes or approve scripts/version exemptions. Bounded local diagnostics are not uploaded. Windows x64 only with plugin Node >=24; the read-only file-use helper requires .NET Framework 4.x and execution permission. Verified user npm 0.5.0 to 0.5.3 self-update, WSL 0.26.2 to 0.29.0 and isolated source tests do not prove every device or future release. Second-device, complete real mirror-upgrade, distro task-continuity and full browser interaction coverage remain incomplete."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "插件在线更新",
4
- "description": "v0.5.3 本地修复版尚未发布到公共 npm,公共 npm 仍为 v0.5.0;本地包由官方管理器另行安装,最终归档和本机安装结果以交付验收记录为准,浏览器交互尚未验收。从左侧“插件在线更新”进入,点击“检查全部更新”,勾选符合条件的兼容正式版后确认“一键更新所选”。每批最多20项,初次打开不自动查询或勾选。版本发现与在线替换条件分开,并显示查询源;发现新版不等于可安全更新,查询失败或信息不完整不称“已是最新”。更新前默认等待当前任务自然结束;停止当前智能体活动需额外明确同意,排队输入会清除,已完成操作不能撤销。外部终端和独立 Worker 不会被杀掉,DSH 不自动退出或重启。普通 npm 更新走官方精确版本路径,保留 npm 来源并核验实际文件和 Host 激活;Host 会沿用现有 fallback 重新下载,准备归档不是原子或精确字节替换保证。只对已核验的旧普通 Doctor 归档,单独确认同版本迁回 npm;自身、WSL、任意本地、Git 和开发链接不自动迁移。JS 依赖支持限声明不变、实际图与文件可核验、无原生或安装生命周期脚本的受审查路径,不代表所有依赖都能热更新。固定公共镜像路径与官方归档比对并额外确认,不偷偷修改源配置。WSL新版不再单凭固定版本名单拒绝,按公开原包/现代声明契约核验;0.26.2→0.29.0生产更新及预准备旧版恢复已隔离验证。schema4保存全部保留原包证明,未知install/reapply/restore结果禁止重发,达到保留上限不静默删旧代;来源仍为本地归档,不伪装内置 Versions,已有会话可能保留旧预设。详情页独立检查由更新器提供,只读检查和导航,不直接安装。更新器自身升级单独确认,不与普通批次混合;npm、固定公共镜像、固定 GitHub 完整提交各有独立准入,GitHub 主分支不是签名 Release。目标失败和恢复结果分别记录,未知结果不自动重发。常规Union Search npm/HMR路径仍不支持安全热更新,旧0.5.1风险拦截不算修复。本版0.5.2新增仅已审查0.10.24→0.10.25完整依赖本地代际:原始JS及依赖字节不改、提前准备fresh恢复、真实Loader运行代际核验;来源变本地归档、内置Versions资格不保留,须额外确认。未知结果/未审查版本及不可核验当前代际继续拒绝,不复用旧token、不静默删除保留旧代。本插件不改DSH/Node/Electron、不注入调试补丁或强清缓存。文件使用检测仅作辅助,不强制解锁、提权或批准脚本/版本豁免。本机诊断不上传。仅Windows x64;最终归档与本机更新器安装状态见交付验收记录,真实插件升级与新界面浏览器交互尚未验收。"
4
+ "description": "在原版 DeepSeek Harness 保持运行时检查并更新符合条件的插件。从左侧“插件在线更新”点击“检查全部更新”,核对版本、查询源和在线更新条件,勾选后确认;每批最多20项,初次打开不自动查询或选择。默认等待任务自然结束,停止当前智能体活动须额外同意,可能清除排队输入且不能撤销已完成操作;外部终端和独立 Worker 不会被杀掉,DSH不自动退出或重启。普通npm更新使用官方精确版本路径并保留npm身份;准备归档只作预检,宿主会重新下载,安装与恢复不是原子字节替换。自身升级独立确认,支持官方npm、固定公共镜像/备用源及此仓库的固定GitHub完整提交,不静默迁移来源。默认源按宿主实际配置核验,公共镜像/备用源原包与官方比对并额外确认,不要求修改全局源;npmmirror仅允许精确同包同版本路径单跳固定CDN,私有/未知来源或校验失败仍拒绝。JS依赖仅支持声明不变、解析图和实际文件可核验、无原生依赖或安装生命周期脚本的受审查路径。WSL候选按公开原包和现代宿主声明契约检查,不再单凭固定版本名单;保留旧资源与原包证明,已有会话可能保留旧预设,代际来源仍是本地归档。Union Search常规npm/HMR仍不支持安全热更新,旧0.5.1风险拦截不算修复;另有已审查0.10.24→0.10.25完整依赖本地代际,须接受本地来源、临时卸载和恢复风险,内置Versions资格不保留。目标更新、恢复、包文件、Host与页面同步分别记录,未知结果不自动重发,缺原包证明或超出旧代保留上限拒绝而不静默删资源。官方详情扩展仅只读检查和导航,不直接安装。本插件不修改DSH/Node/Electron,不提权、强解锁、杀用户进程或批准脚本/版本豁免;本机有界诊断不上传。仅Windows x64,插件运行Node≥24;只读文件使用助手需要.NET Framework 4.x与执行许可。已核验的真实npm0.5.0→0.5.3自身升级、WSL0.26.2→0.29.0及隔离来源修复测试不代表所有设备或未来版本都通过;第二台设备、真实镜像升级全过程、发行版任务连续性和全部界面交互尚未全面验收。"
5
5
  }
6
6
  }