@devness/useai-cli 0.4.19 → 0.4.20
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/dist/index.js +17 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var SYSTEMD_SERVICE_PATH = join(homedir(), ".config", "systemd", "user", "useai-
|
|
|
30
30
|
var WINDOWS_STARTUP_SCRIPT_PATH = join(process.env["APPDATA"] ?? join(homedir(), "AppData", "Roaming"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "useai-daemon.vbs");
|
|
31
31
|
|
|
32
32
|
// ../shared/dist/constants/version.js
|
|
33
|
-
var VERSION = "0.4.
|
|
33
|
+
var VERSION = "0.4.20";
|
|
34
34
|
|
|
35
35
|
// ../shared/dist/constants/defaults.js
|
|
36
36
|
var DEFAULT_CONFIG = {
|
|
@@ -4661,15 +4661,21 @@ async function killDaemon() {
|
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
4663
|
async function ensureDaemon() {
|
|
4664
|
-
|
|
4664
|
+
const health = await fetchDaemonHealth();
|
|
4665
|
+
if (health && health.version === VERSION)
|
|
4665
4666
|
return true;
|
|
4666
|
-
|
|
4667
|
-
if (pid && isProcessRunning(pid.pid)) {
|
|
4667
|
+
if (health) {
|
|
4668
4668
|
await killDaemon();
|
|
4669
|
-
}
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4669
|
+
}
|
|
4670
|
+
if (!health) {
|
|
4671
|
+
const pid = readPidFile();
|
|
4672
|
+
if (pid && isProcessRunning(pid.pid)) {
|
|
4673
|
+
await killDaemon();
|
|
4674
|
+
} else if (pid) {
|
|
4675
|
+
try {
|
|
4676
|
+
unlinkSync(DAEMON_PID_FILE);
|
|
4677
|
+
} catch {
|
|
4678
|
+
}
|
|
4673
4679
|
}
|
|
4674
4680
|
}
|
|
4675
4681
|
let npxPath;
|
|
@@ -4719,7 +4725,7 @@ function buildPlist(npxPath, nodePath) {
|
|
|
4719
4725
|
<array>
|
|
4720
4726
|
<string>${npxPath}</string>
|
|
4721
4727
|
<string>-y</string>
|
|
4722
|
-
<string>@devness/useai</string>
|
|
4728
|
+
<string>@devness/useai@latest</string>
|
|
4723
4729
|
<string>daemon</string>
|
|
4724
4730
|
<string>--port</string>
|
|
4725
4731
|
<string>${DAEMON_PORT}</string>
|
|
@@ -4778,7 +4784,7 @@ After=network.target
|
|
|
4778
4784
|
|
|
4779
4785
|
[Service]
|
|
4780
4786
|
Type=simple
|
|
4781
|
-
ExecStart=${npxPath} -y @devness/useai daemon --port ${DAEMON_PORT}
|
|
4787
|
+
ExecStart=${npxPath} -y @devness/useai@latest daemon --port ${DAEMON_PORT}
|
|
4782
4788
|
Restart=on-failure
|
|
4783
4789
|
RestartSec=10
|
|
4784
4790
|
Environment=PATH=${nodePath}
|
|
@@ -4815,7 +4821,7 @@ function isLinuxInstalled() {
|
|
|
4815
4821
|
}
|
|
4816
4822
|
function buildVbsScript(npxPath) {
|
|
4817
4823
|
return `Set WshShell = CreateObject("WScript.Shell")
|
|
4818
|
-
WshShell.Run """${npxPath}"" -y @devness/useai daemon --port ${DAEMON_PORT}", 0, False
|
|
4824
|
+
WshShell.Run """${npxPath}"" -y @devness/useai@latest daemon --port ${DAEMON_PORT}", 0, False
|
|
4819
4825
|
`;
|
|
4820
4826
|
}
|
|
4821
4827
|
function installWindows() {
|