@yeaft/webchat-agent 1.0.168 → 1.0.169

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/cli.js CHANGED
@@ -30,6 +30,10 @@ import {
30
30
  GITHUB_COPILOT_PROVIDER,
31
31
  } from './llm-model-discovery.js';
32
32
  import { applyAgentIdentityToEnv, warnDeprecatedInstanceArg } from './service/config.js';
33
+ import {
34
+ buildUpgradeInstallCommand,
35
+ buildUpgradeVersionCommand,
36
+ } from './upgrade-command.js';
33
37
 
34
38
  const __dirname = dirname(fileURLToPath(import.meta.url));
35
39
  const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf-8'));
@@ -466,7 +470,7 @@ function upgrade() {
466
470
  console.log('Checking for updates...');
467
471
 
468
472
  try {
469
- const latest = execSync(`npm view ${pkg.name} version`, { encoding: 'utf-8' }).trim();
473
+ const latest = execSync(buildUpgradeVersionCommand(pkg.name), { encoding: 'utf-8' }).trim();
470
474
  if (latest === pkg.version) {
471
475
  console.log('Already up to date.');
472
476
  return;
@@ -479,7 +483,7 @@ function upgrade() {
479
483
  // for us to exit, then runs npm install, then optionally restarts the service.
480
484
  upgradeWindows(latest);
481
485
  } else {
482
- execSync(`npm install -g ${pkg.name}@latest`, { stdio: 'inherit' });
486
+ execSync(buildUpgradeInstallCommand(`${pkg.name}@latest`), { stdio: 'inherit' });
483
487
  console.log(`Successfully upgraded to ${latest}`);
484
488
 
485
489
  // If PM2 is managing yeaft-agent, restart it so the new version takes effect
@@ -561,7 +565,7 @@ function upgradeWindows(latestVersion) {
561
565
  'ping -n 5 127.0.0.1 >NUL',
562
566
  '',
563
567
  'echo [Upgrade] Running npm install -g %PKG%... >> "%LOGFILE%"',
564
- 'call npm install -g %PKG% >> "%LOGFILE%" 2>&1',
568
+ `call ${buildUpgradeInstallCommand('%PKG%')} >> "%LOGFILE%" 2>&1`,
565
569
  'if not "%errorlevel%"=="0" (',
566
570
  ' echo [Upgrade] npm install failed with exit code %errorlevel% at %time% >> "%LOGFILE%"',
567
571
  ' goto PM2_RESTART',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.168",
3
+ "version": "1.0.169",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,11 @@
1
+ export const DEFAULT_UPGRADE_REGISTRY = 'https://pkg.yeaft.com/';
2
+
3
+ /** Build the npm metadata command used by `yeaft-agent upgrade`. */
4
+ export function buildUpgradeVersionCommand(packageName) {
5
+ return `npm view ${packageName} version --registry=${DEFAULT_UPGRADE_REGISTRY}`;
6
+ }
7
+
8
+ /** Build the npm install command used by `yeaft-agent upgrade`. */
9
+ export function buildUpgradeInstallCommand(packageSpec) {
10
+ return `npm install -g ${packageSpec} --registry=${DEFAULT_UPGRADE_REGISTRY}`;
11
+ }