@yeaft/webchat-agent 0.0.48 → 0.0.50
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/connection.js +6 -5
- package/package.json +1 -1
package/connection.js
CHANGED
|
@@ -352,7 +352,7 @@ async function handleMessage(msg) {
|
|
|
352
352
|
sendToServer({ type: 'upgrade_agent_ack', success: true, alreadyLatest: true, version: ctx.agentVersion });
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
console.log(`[Agent] Upgrading from ${ctx.agentVersion} to ${latestVersion}...`);
|
|
355
|
+
console.log(`[Agent] Upgrading from ${ctx.agentVersion} to latest (${latestVersion})...`);
|
|
356
356
|
|
|
357
357
|
// 检测安装方式:npm install 的路径包含 node_modules,源码运行则不包含
|
|
358
358
|
const scriptPath = (process.argv[1] || '').replace(/\\/g, '/');
|
|
@@ -383,9 +383,10 @@ async function handleMessage(msg) {
|
|
|
383
383
|
|
|
384
384
|
const isWindows = platform() === 'win32';
|
|
385
385
|
// 全局安装用 npm install -g,局部安装在 installDir 下 npm install
|
|
386
|
+
// 不指定版本号,直接用 @latest 确保安装最新版
|
|
386
387
|
const npmArgs = isGlobalInstall
|
|
387
|
-
? ['install', '-g', `${pkgName}
|
|
388
|
-
: ['install', `${pkgName}
|
|
388
|
+
? ['install', '-g', `${pkgName}@latest`]
|
|
389
|
+
: ['install', `${pkgName}@latest`];
|
|
389
390
|
|
|
390
391
|
if (isWindows) {
|
|
391
392
|
// Windows: 进程持有文件锁,npm install 无法覆盖正在运行的模块文件 (EBUSY)
|
|
@@ -401,7 +402,7 @@ async function handleMessage(msg) {
|
|
|
401
402
|
'@echo off',
|
|
402
403
|
'setlocal',
|
|
403
404
|
`set PID=${pid}`,
|
|
404
|
-
`set PKG=${pkgName}
|
|
405
|
+
`set PKG=${pkgName}@latest`,
|
|
405
406
|
`set INSTALL_DIR=${installDirWin}`,
|
|
406
407
|
`set MAX_WAIT=30`,
|
|
407
408
|
`set COUNT=0`,
|
|
@@ -473,7 +474,7 @@ async function handleMessage(msg) {
|
|
|
473
474
|
const shLines = [
|
|
474
475
|
'#!/bin/bash',
|
|
475
476
|
`PID=${pid}`,
|
|
476
|
-
`PKG="${pkgName}
|
|
477
|
+
`PKG="${pkgName}@latest"`,
|
|
477
478
|
...(cwd ? [`INSTALL_DIR="${cwd}"`] : []),
|
|
478
479
|
'',
|
|
479
480
|
'# Wait for current process to exit',
|