@devness/useai-cli 0.4.18 → 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 +23 -17
- 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() {
|
|
@@ -4899,13 +4905,13 @@ process.stdin.on('end', () => {
|
|
|
4899
4905
|
if (!hook.transcript_path) process.exit(0);
|
|
4900
4906
|
let transcript;
|
|
4901
4907
|
try { transcript = readFileSync(hook.transcript_path, 'utf-8'); } catch { process.exit(0); }
|
|
4902
|
-
var starts = (transcript.match(/
|
|
4908
|
+
var starts = (transcript.match(/useai_start/g) || []).length;
|
|
4903
4909
|
if (starts === 0) process.exit(0);
|
|
4904
|
-
var ends = (transcript.match(/
|
|
4910
|
+
var ends = (transcript.match(/useai_end/g) || []).length;
|
|
4905
4911
|
if (ends >= starts) process.exit(0);
|
|
4906
4912
|
process.stdout.write(JSON.stringify({
|
|
4907
4913
|
decision: 'block',
|
|
4908
|
-
reason: 'Before ending, call
|
|
4914
|
+
reason: 'Before ending, call useai_end with milestones (generic descriptions of accomplishments), languages used, and files_touched_count.'
|
|
4909
4915
|
}));
|
|
4910
4916
|
} catch { process.exit(0); }
|
|
4911
4917
|
});
|
|
@@ -4922,13 +4928,13 @@ process.stdin.on('end', () => {
|
|
|
4922
4928
|
if (!hook.transcript_path) process.exit(0);
|
|
4923
4929
|
let transcript;
|
|
4924
4930
|
try { transcript = readFileSync(hook.transcript_path, 'utf-8'); } catch { process.exit(0); }
|
|
4925
|
-
var starts = (transcript.match(/
|
|
4926
|
-
var ends = (transcript.match(/
|
|
4931
|
+
var starts = (transcript.match(/useai_start/g) || []).length;
|
|
4932
|
+
var ends = (transcript.match(/useai_end/g) || []).length;
|
|
4927
4933
|
if (starts > ends) process.exit(0);
|
|
4928
4934
|
process.stdout.write(JSON.stringify({
|
|
4929
4935
|
hookSpecificOutput: {
|
|
4930
4936
|
hookEventName: 'UserPromptSubmit',
|
|
4931
|
-
additionalContext: 'UseAI: Call
|
|
4937
|
+
additionalContext: 'UseAI: Call useai_start with the appropriate task_type before doing any work.'
|
|
4932
4938
|
}
|
|
4933
4939
|
}));
|
|
4934
4940
|
} catch { process.exit(0); }
|