dsh-selfupdater 0.4.26 → 0.4.27

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.
@@ -107,8 +107,9 @@ function patchCode(code, filePath) {
107
107
  * 任何关键补丁未命中都抛错——调用方(updater.mjs)在换装前中止升级,
108
108
  * 旧版保持原样,天然安全。
109
109
  * @param {string} appRoot - 含 node_modules 的应用根目录(staging 与其同构)
110
+ * @param {(msg: string) => void} [log] - 可选日志函数(升级脚本传入后写入 selfupdate.log)
110
111
  */
111
- export function applyFnosPatches(appRoot) {
112
+ export function applyFnosPatches(appRoot, log = () => {}) {
112
113
  const at = join(appRoot, 'node_modules', '@deepseek-ai');
113
114
  if (!existsSync(at)) throw new Error('找不到 node_modules/@deepseek-ai,staging 结构异常');
114
115
 
@@ -139,5 +140,5 @@ export function applyFnosPatches(appRoot) {
139
140
  if (missed.length > 0) {
140
141
  throw new Error(`关键补丁未命中: ${missed.join('、')}(上游代码可能已变更,需同步更新 fnos-patches.mjs 与 patch.py)`);
141
142
  }
142
- console.log(`[fnos-patches] 补丁应用完成: ${patched} 个文件, 关键标记全部命中`);
143
+ log(`[fnos-patches] 补丁应用完成: ${patched} 个文件, 关键标记全部命中`);
143
144
  }
package/lib/updater.mjs CHANGED
@@ -529,7 +529,7 @@ async function main() {
529
529
  // staging 补齐。任何关键补丁未命中都在此抛错中止——此时还没换装,旧版
530
530
  // 原样保留,天然安全。
531
531
  setState('downloading', '正在应用飞牛运行时补丁 …');
532
- applyFnosPatches(stagingDir);
532
+ applyFnosPatches(stagingDir, (msg) => log(msg));
533
533
 
534
534
  swapNodeModules();
535
535
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-selfupdater",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
4
4
  "description": "Self-update plugin for DeepSeek Harness: DSH core upgrades via detached swap script; plugin self-update installs in-place without killing the host and prompts for restart. DSH 主程序与已装插件的一站式在线更新插件。",
5
5
  "license": "MIT",
6
6
  "type": "module",