@oussema_mili/test-pkg-123 1.1.44 → 1.1.46
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-commands.js +7 -34
- package/containerManager.js +1 -1
- package/daemon/agentRunner.js +0 -2
- package/package.json +1 -1
package/cli-commands.js
CHANGED
|
@@ -493,7 +493,7 @@ function setupCLICommands(program, startServerFunction) {
|
|
|
493
493
|
} else {
|
|
494
494
|
console.log(chalk.yellow("Status: Not Running"));
|
|
495
495
|
console.log(chalk.gray("\nTo start the agent, run:"));
|
|
496
|
-
console.log(chalk.cyan(" fenwave service start"));
|
|
496
|
+
console.log(chalk.cyan(" fenwave service start or fenwave service run"));
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
console.log("");
|
|
@@ -754,7 +754,7 @@ function setupCLICommands(program, startServerFunction) {
|
|
|
754
754
|
|
|
755
755
|
console.log("");
|
|
756
756
|
|
|
757
|
-
// Agent running status -
|
|
757
|
+
// Agent running status - only trust daemon state
|
|
758
758
|
const daemonStatus = getDaemonStatus();
|
|
759
759
|
if (daemonStatus.running) {
|
|
760
760
|
console.log(
|
|
@@ -766,15 +766,10 @@ function setupCLICommands(program, startServerFunction) {
|
|
|
766
766
|
chalk.gray(` Uptime: ${formatDaemonUptime(daemonStatus.uptime)}`),
|
|
767
767
|
);
|
|
768
768
|
} else {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
console.log(chalk.yellow("Agent: Not Running"));
|
|
774
|
-
console.log(
|
|
775
|
-
chalk.gray(' Run "fenwave service start" to start the agent'),
|
|
776
|
-
);
|
|
777
|
-
}
|
|
769
|
+
console.log(chalk.yellow("Agent: Not Running"));
|
|
770
|
+
console.log(
|
|
771
|
+
chalk.gray(' Run "fenwave service start" or "fenwave service run" to start the agent'),
|
|
772
|
+
);
|
|
778
773
|
}
|
|
779
774
|
|
|
780
775
|
console.log("");
|
|
@@ -1887,29 +1882,7 @@ function setupCLICommands(program, startServerFunction) {
|
|
|
1887
1882
|
formatDaemonUptime(daemonStatus.uptime),
|
|
1888
1883
|
);
|
|
1889
1884
|
} else {
|
|
1890
|
-
|
|
1891
|
-
const isAgentRunning = await checkAgentRunning(WS_PORT);
|
|
1892
|
-
if (isAgentRunning) {
|
|
1893
|
-
try {
|
|
1894
|
-
const agentStartTime = await agentStore.loadAgentStartTime();
|
|
1895
|
-
if (agentStartTime) {
|
|
1896
|
-
const currentTime = Date.now();
|
|
1897
|
-
const agentUptimeMs = currentTime - agentStartTime.getTime();
|
|
1898
|
-
console.log(chalk.blue("Uptime:"), formatUptime(agentUptimeMs));
|
|
1899
|
-
} else {
|
|
1900
|
-
console.log(chalk.blue("Uptime:"), "0 seconds");
|
|
1901
|
-
}
|
|
1902
|
-
} catch (error) {
|
|
1903
|
-
console.log(chalk.blue("Uptime:"), "0 seconds");
|
|
1904
|
-
}
|
|
1905
|
-
} else {
|
|
1906
|
-
console.log(chalk.blue("Status:"), chalk.red("Agent Not Running"));
|
|
1907
|
-
try {
|
|
1908
|
-
await agentStore.clearAgentInfo();
|
|
1909
|
-
} catch (error) {
|
|
1910
|
-
// Ignore cleanup errors
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1885
|
+
console.log(chalk.blue("Status:"), chalk.red("Agent Not Running"));
|
|
1913
1886
|
}
|
|
1914
1887
|
process.exit(0);
|
|
1915
1888
|
} catch (error) {
|
package/containerManager.js
CHANGED
|
@@ -187,7 +187,7 @@ class ContainerManager {
|
|
|
187
187
|
if (APP_PORT === WS_PORT || !(await isPortAvailable(APP_PORT))) {
|
|
188
188
|
try {
|
|
189
189
|
const newPort = await findAvailableContainerPort(DEFAULT_CONTAINER_PORT, 100, [WS_PORT]);
|
|
190
|
-
console.log(chalk.yellow(`⚠️
|
|
190
|
+
console.log(chalk.yellow(`⚠️ Port ${APP_PORT} is unavailable. Using ${newPort} instead.`));
|
|
191
191
|
APP_PORT = newPort;
|
|
192
192
|
} catch (err) {
|
|
193
193
|
throw new Error(`Failed to resolve container port conflict: ${err.message}`);
|
package/daemon/agentRunner.js
CHANGED
|
@@ -428,14 +428,12 @@ export async function runAgent(options = {}) {
|
|
|
428
428
|
};
|
|
429
429
|
|
|
430
430
|
// Now that WebSocket is bound, start container (so it cannot take the WS port)
|
|
431
|
-
log('Starting container (after WebSocket bind)...');
|
|
432
431
|
let actualContainerPort = preferredContainerPort;
|
|
433
432
|
try {
|
|
434
433
|
actualContainerPort = await containerManager.startContainer({
|
|
435
434
|
wsPort: actualPort,
|
|
436
435
|
containerPort: preferredContainerPort,
|
|
437
436
|
});
|
|
438
|
-
log(`Container started successfully on port ${actualContainerPort}`);
|
|
439
437
|
} catch (containerError) {
|
|
440
438
|
log(`Failed to start container: ${containerError.message}`, 'warn');
|
|
441
439
|
log('Continuing without container...');
|