@devness/useai 0.5.48 → 0.6.1
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 +58 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -684,7 +684,7 @@ var VERSION;
|
|
|
684
684
|
var init_version = __esm({
|
|
685
685
|
"../shared/dist/constants/version.js"() {
|
|
686
686
|
"use strict";
|
|
687
|
-
VERSION = "0.
|
|
687
|
+
VERSION = "0.6.1";
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
690
|
|
|
@@ -5652,6 +5652,21 @@ async function fetchDaemonHealth(port) {
|
|
|
5652
5652
|
}
|
|
5653
5653
|
function findPidsByPort(port) {
|
|
5654
5654
|
try {
|
|
5655
|
+
if (process.platform === "win32") {
|
|
5656
|
+
const output2 = execSync2(`netstat -ano | findstr :${port} | findstr LISTENING`, {
|
|
5657
|
+
encoding: "utf-8",
|
|
5658
|
+
timeout: 5e3,
|
|
5659
|
+
shell: "cmd.exe"
|
|
5660
|
+
});
|
|
5661
|
+
const pids = /* @__PURE__ */ new Set();
|
|
5662
|
+
for (const line of output2.trim().split("\n")) {
|
|
5663
|
+
const parts = line.trim().split(/\s+/);
|
|
5664
|
+
const pid = parseInt(parts[parts.length - 1], 10);
|
|
5665
|
+
if (!isNaN(pid) && pid > 0)
|
|
5666
|
+
pids.add(pid);
|
|
5667
|
+
}
|
|
5668
|
+
return [...pids];
|
|
5669
|
+
}
|
|
5655
5670
|
const output = execSync2(`lsof -ti :${port}`, { encoding: "utf-8", timeout: 3e3 });
|
|
5656
5671
|
return output.trim().split("\n").map((s) => parseInt(s, 10)).filter((n) => !isNaN(n) && n > 0);
|
|
5657
5672
|
} catch {
|
|
@@ -5723,11 +5738,16 @@ async function ensureDaemon(options) {
|
|
|
5723
5738
|
}
|
|
5724
5739
|
}
|
|
5725
5740
|
}
|
|
5741
|
+
const isWindows2 = process.platform === "win32";
|
|
5726
5742
|
let npxPath;
|
|
5727
|
-
|
|
5728
|
-
npxPath = resolveNpxPath();
|
|
5729
|
-
} catch {
|
|
5743
|
+
if (isWindows2) {
|
|
5730
5744
|
npxPath = "npx";
|
|
5745
|
+
} else {
|
|
5746
|
+
try {
|
|
5747
|
+
npxPath = resolveNpxPath();
|
|
5748
|
+
} catch {
|
|
5749
|
+
npxPath = "npx";
|
|
5750
|
+
}
|
|
5731
5751
|
}
|
|
5732
5752
|
const usePreferOnline = options?.preferOnline !== false;
|
|
5733
5753
|
const npxArgs = ["-y"];
|
|
@@ -5737,7 +5757,8 @@ async function ensureDaemon(options) {
|
|
|
5737
5757
|
const child = spawn(npxPath, npxArgs, {
|
|
5738
5758
|
detached: true,
|
|
5739
5759
|
stdio: "ignore",
|
|
5740
|
-
shell:
|
|
5760
|
+
shell: isWindows2,
|
|
5761
|
+
windowsHide: true
|
|
5741
5762
|
});
|
|
5742
5763
|
child.unref();
|
|
5743
5764
|
const start = Date.now();
|
|
@@ -15294,18 +15315,36 @@ function showManualHints(installedTools) {
|
|
|
15294
15315
|
}
|
|
15295
15316
|
console.log();
|
|
15296
15317
|
}
|
|
15318
|
+
function startSpinner(message) {
|
|
15319
|
+
let frame = 0;
|
|
15320
|
+
const interval = setInterval(() => {
|
|
15321
|
+
const symbol = source_default.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
|
|
15322
|
+
process.stdout.write(`\r ${symbol} ${source_default.dim(message)}`);
|
|
15323
|
+
frame++;
|
|
15324
|
+
}, 80);
|
|
15325
|
+
return {
|
|
15326
|
+
stop(finalMessage) {
|
|
15327
|
+
clearInterval(interval);
|
|
15328
|
+
process.stdout.write(`\r${" ".repeat(message.length + 10)}\r`);
|
|
15329
|
+
console.log(finalMessage);
|
|
15330
|
+
}
|
|
15331
|
+
};
|
|
15332
|
+
}
|
|
15297
15333
|
async function daemonInstallFlow(tools, autoYes, explicit) {
|
|
15298
|
-
|
|
15334
|
+
const spinner = startSpinner("Starting UseAI daemon...");
|
|
15299
15335
|
const daemonOk = await ensureDaemon();
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
console.log(
|
|
15303
|
-
console.log(source_default.
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
console.log(source_default.
|
|
15307
|
-
|
|
15336
|
+
if (!daemonOk) {
|
|
15337
|
+
spinner.stop(source_default.red(` \u2717 Could not start daemon on port ${DAEMON_PORT}`));
|
|
15338
|
+
console.log();
|
|
15339
|
+
console.log(source_default.bold(" To debug, run the daemon in foreground mode:"));
|
|
15340
|
+
console.log(source_default.cyan(` npx @devness/useai@latest daemon --port ${DAEMON_PORT}`));
|
|
15341
|
+
console.log();
|
|
15342
|
+
console.log(source_default.dim(" If you need stdio mode (e.g. containers/CI), use: npx @devness/useai mcp --stdio"));
|
|
15343
|
+
return;
|
|
15308
15344
|
}
|
|
15345
|
+
const useDaemon = true;
|
|
15346
|
+
spinner.stop(source_default.green(` \u2713 Daemon running on port ${DAEMON_PORT}`));
|
|
15347
|
+
console.log(source_default.dim(` Dashboard: http://127.0.0.1:${DAEMON_PORT}/dashboard`));
|
|
15309
15348
|
if (useDaemon) {
|
|
15310
15349
|
const platform = detectPlatform();
|
|
15311
15350
|
if (platform !== "unsupported") {
|
|
@@ -15591,13 +15630,14 @@ async function runSetup(args) {
|
|
|
15591
15630
|
await daemonInstallFlow(tools, autoYes, explicit);
|
|
15592
15631
|
}
|
|
15593
15632
|
}
|
|
15594
|
-
var _shared;
|
|
15633
|
+
var _shared, SPINNER_FRAMES;
|
|
15595
15634
|
var init_setup = __esm({
|
|
15596
15635
|
"src/setup.ts"() {
|
|
15597
15636
|
"use strict";
|
|
15598
15637
|
init_source();
|
|
15599
15638
|
init_dist();
|
|
15600
15639
|
init_tools2();
|
|
15640
|
+
SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
15601
15641
|
}
|
|
15602
15642
|
});
|
|
15603
15643
|
|
|
@@ -36548,17 +36588,9 @@ if (subcommand === "update") {
|
|
|
36548
36588
|
const daemonOk = await ensureDaemon2({ preferOnline: true });
|
|
36549
36589
|
if (!daemonOk) {
|
|
36550
36590
|
console.log(chalk2.red(" \u2717 Failed to start updated daemon"));
|
|
36551
|
-
|
|
36552
|
-
|
|
36553
|
-
|
|
36554
|
-
try {
|
|
36555
|
-
tool.install();
|
|
36556
|
-
console.log(chalk2.green(` \u2713 ${tool.name} \u2192 ${chalk2.dim("stdio")}`));
|
|
36557
|
-
} catch {
|
|
36558
|
-
console.log(chalk2.red(` \u2717 ${tool.name}`));
|
|
36559
|
-
}
|
|
36560
|
-
}
|
|
36561
|
-
}
|
|
36591
|
+
console.log();
|
|
36592
|
+
console.log(chalk2.bold(" To debug, run the daemon in foreground mode:"));
|
|
36593
|
+
console.log(chalk2.cyan(" npx @devness/useai@latest daemon --port 19200"));
|
|
36562
36594
|
process.exit(1);
|
|
36563
36595
|
}
|
|
36564
36596
|
const healthAfter = await fetchDaemonHealth2();
|