@yeaft/webchat-agent 0.0.8 → 0.0.9
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/package.json +1 -1
- package/service.js +6 -4
package/package.json
CHANGED
package/service.js
CHANGED
|
@@ -392,8 +392,10 @@ function winInstall(config) {
|
|
|
392
392
|
if (config.agentSecret) envLines.push(`set "AGENT_SECRET=${config.agentSecret}"`);
|
|
393
393
|
if (config.workDir) envLines.push(`set "WORK_DIR=${config.workDir}"`);
|
|
394
394
|
|
|
395
|
-
// Create a batch file that sets env vars and starts node
|
|
396
|
-
|
|
395
|
+
// Create a batch file that sets env vars and starts node (with log redirection)
|
|
396
|
+
mkdirSync(logDir, { recursive: true });
|
|
397
|
+
const logFile = join(logDir, 'out.log');
|
|
398
|
+
const batContent = `@echo off\r\n${envLines.join('\r\n')}\r\n"${nodePath}" "${cliPath}" >> "${logFile}" 2>&1\r\n`;
|
|
397
399
|
const batPath = getWinBatPath();
|
|
398
400
|
writeFileSync(batPath, batContent);
|
|
399
401
|
|
|
@@ -431,7 +433,7 @@ function winInstall(config) {
|
|
|
431
433
|
|
|
432
434
|
// Also start it now
|
|
433
435
|
if (usedStartupFolder) {
|
|
434
|
-
|
|
436
|
+
execSync(`wscript.exe "${vbsPath}"`, { stdio: 'pipe' });
|
|
435
437
|
} else {
|
|
436
438
|
execSync(`schtasks /run /tn "${WIN_TASK_NAME}"`, { stdio: 'pipe' });
|
|
437
439
|
}
|
|
@@ -466,7 +468,7 @@ function winStart() {
|
|
|
466
468
|
// No schtasks — try direct launch via VBS
|
|
467
469
|
const vbsPath = getWinWrapperPath();
|
|
468
470
|
if (existsSync(vbsPath)) {
|
|
469
|
-
|
|
471
|
+
execSync(`wscript.exe "${vbsPath}"`, { stdio: 'pipe' });
|
|
470
472
|
console.log('Service started.');
|
|
471
473
|
} else {
|
|
472
474
|
console.error('Service not installed. Run "yeaft-agent install" first.');
|