@yeaft/webchat-agent 1.0.167 → 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 +7 -3
- package/index.js +1 -1
- package/package.json +1 -1
- package/upgrade-command.js +11 -0
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(
|
|
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(
|
|
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
|
-
|
|
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/index.js
CHANGED
|
@@ -117,7 +117,7 @@ async function detectCapabilities() {
|
|
|
117
117
|
// agent build can speak plaintext WS frames. New servers see this and
|
|
118
118
|
// flip `agent.encryptOutbound = false`, stopping outbound encryption
|
|
119
119
|
// to this peer. Old servers ignore the unknown capability token.
|
|
120
|
-
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok'];
|
|
120
|
+
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok', 'work_center'];
|
|
121
121
|
if (process.platform === 'linux') capabilities.push('work_item_attachments');
|
|
122
122
|
const pty = await loadNodePty();
|
|
123
123
|
if (pty) capabilities.push('terminal');
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|