open-agents-ai 0.138.60 → 0.138.61
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 +94 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43418,7 +43418,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
43418
43418
|
}
|
|
43419
43419
|
}
|
|
43420
43420
|
async function handleParallel(arg, ctx) {
|
|
43421
|
-
const { execSync:
|
|
43421
|
+
const { execSync: execSync30 } = await import("node:child_process");
|
|
43422
43422
|
const baseUrl = ctx.config.backendUrl || "http://localhost:11434";
|
|
43423
43423
|
const isRemote = ctx.config.backendType === "nexus";
|
|
43424
43424
|
if (isRemote) {
|
|
@@ -43442,7 +43442,7 @@ async function handleParallel(arg, ctx) {
|
|
|
43442
43442
|
}
|
|
43443
43443
|
let systemdVal = "";
|
|
43444
43444
|
try {
|
|
43445
|
-
const out =
|
|
43445
|
+
const out = execSync30("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
|
|
43446
43446
|
const match = out.match(/OLLAMA_NUM_PARALLEL=(\d+)/);
|
|
43447
43447
|
if (match)
|
|
43448
43448
|
systemdVal = match[1];
|
|
@@ -43471,7 +43471,7 @@ async function handleParallel(arg, ctx) {
|
|
|
43471
43471
|
}
|
|
43472
43472
|
const isSystemd = (() => {
|
|
43473
43473
|
try {
|
|
43474
|
-
const out =
|
|
43474
|
+
const out = execSync30("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
|
|
43475
43475
|
return out === "active" || out === "inactive";
|
|
43476
43476
|
} catch {
|
|
43477
43477
|
return false;
|
|
@@ -43485,10 +43485,10 @@ async function handleParallel(arg, ctx) {
|
|
|
43485
43485
|
const overrideContent = `[Service]
|
|
43486
43486
|
Environment="OLLAMA_NUM_PARALLEL=${n}"
|
|
43487
43487
|
`;
|
|
43488
|
-
|
|
43489
|
-
|
|
43490
|
-
|
|
43491
|
-
|
|
43488
|
+
execSync30(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
|
|
43489
|
+
execSync30(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
|
|
43490
|
+
execSync30("sudo systemctl daemon-reload", { stdio: "pipe" });
|
|
43491
|
+
execSync30("sudo systemctl restart ollama.service", { stdio: "pipe" });
|
|
43492
43492
|
let ready = false;
|
|
43493
43493
|
for (let i = 0; i < 30 && !ready; i++) {
|
|
43494
43494
|
await new Promise((r) => setTimeout(r, 500));
|
|
@@ -43515,7 +43515,7 @@ Environment="OLLAMA_NUM_PARALLEL=${n}"
|
|
|
43515
43515
|
renderInfo(`Setting OLLAMA_NUM_PARALLEL=${n}...`);
|
|
43516
43516
|
try {
|
|
43517
43517
|
try {
|
|
43518
|
-
|
|
43518
|
+
execSync30("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
|
|
43519
43519
|
} catch {
|
|
43520
43520
|
}
|
|
43521
43521
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
@@ -53513,6 +53513,7 @@ import { createRequire as createRequire2 } from "node:module";
|
|
|
53513
53513
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
53514
53514
|
import { readFileSync as readFileSync32, writeFileSync as writeFileSync18, appendFileSync as appendFileSync4, rmSync as rmSync2, readdirSync as readdirSync16, mkdirSync as mkdirSync19 } from "node:fs";
|
|
53515
53515
|
import { existsSync as existsSync43 } from "node:fs";
|
|
53516
|
+
import { execSync as execSync29 } from "node:child_process";
|
|
53516
53517
|
import { homedir as homedir13 } from "node:os";
|
|
53517
53518
|
function formatTimeAgo(date) {
|
|
53518
53519
|
const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
|
|
@@ -56600,13 +56601,94 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
56600
56601
|
}
|
|
56601
56602
|
},
|
|
56602
56603
|
destroyProject() {
|
|
56604
|
+
const bgKilled = taskManager.stopAll();
|
|
56605
|
+
if (bgKilled > 0) {
|
|
56606
|
+
writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
56607
|
+
}
|
|
56608
|
+
try {
|
|
56609
|
+
const nexusDir = join59(repoRoot, OA_DIR, "nexus");
|
|
56610
|
+
const pidFile = join59(nexusDir, "daemon.pid");
|
|
56611
|
+
if (existsSync43(pidFile)) {
|
|
56612
|
+
const pid = parseInt(readFileSync32(pidFile, "utf8").trim(), 10);
|
|
56613
|
+
if (pid > 0) {
|
|
56614
|
+
try {
|
|
56615
|
+
if (process.platform === "win32") {
|
|
56616
|
+
try {
|
|
56617
|
+
execSync29(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
|
|
56618
|
+
} catch {
|
|
56619
|
+
}
|
|
56620
|
+
} else {
|
|
56621
|
+
try {
|
|
56622
|
+
process.kill(pid, "SIGTERM");
|
|
56623
|
+
} catch {
|
|
56624
|
+
}
|
|
56625
|
+
}
|
|
56626
|
+
writeContent(() => renderInfo(`Killed nexus daemon (PID ${pid}).`));
|
|
56627
|
+
} catch {
|
|
56628
|
+
}
|
|
56629
|
+
}
|
|
56630
|
+
}
|
|
56631
|
+
} catch {
|
|
56632
|
+
}
|
|
56633
|
+
try {
|
|
56634
|
+
const voiceDir2 = join59(homedir13(), ".open-agents", "voice");
|
|
56635
|
+
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
56636
|
+
for (const pf of voicePidFiles) {
|
|
56637
|
+
const pidPath = join59(voiceDir2, pf);
|
|
56638
|
+
if (existsSync43(pidPath)) {
|
|
56639
|
+
try {
|
|
56640
|
+
const pid = parseInt(readFileSync32(pidPath, "utf8").trim(), 10);
|
|
56641
|
+
if (pid > 0) {
|
|
56642
|
+
if (process.platform === "win32") {
|
|
56643
|
+
try {
|
|
56644
|
+
execSync29(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
|
|
56645
|
+
} catch {
|
|
56646
|
+
}
|
|
56647
|
+
} else {
|
|
56648
|
+
try {
|
|
56649
|
+
process.kill(pid, "SIGTERM");
|
|
56650
|
+
} catch {
|
|
56651
|
+
}
|
|
56652
|
+
}
|
|
56653
|
+
}
|
|
56654
|
+
} catch {
|
|
56655
|
+
}
|
|
56656
|
+
}
|
|
56657
|
+
}
|
|
56658
|
+
} catch {
|
|
56659
|
+
}
|
|
56660
|
+
try {
|
|
56661
|
+
execSync29(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
|
|
56662
|
+
} catch {
|
|
56663
|
+
}
|
|
56603
56664
|
const oaPath = join59(repoRoot, OA_DIR);
|
|
56604
56665
|
if (existsSync43(oaPath)) {
|
|
56605
|
-
|
|
56606
|
-
|
|
56666
|
+
let deleted = false;
|
|
56667
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
56668
|
+
try {
|
|
56669
|
+
rmSync2(oaPath, { recursive: true, force: true });
|
|
56670
|
+
deleted = true;
|
|
56671
|
+
break;
|
|
56672
|
+
} catch (err) {
|
|
56673
|
+
if (attempt < 2) {
|
|
56674
|
+
try {
|
|
56675
|
+
execSync29(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
|
|
56676
|
+
} catch {
|
|
56677
|
+
}
|
|
56678
|
+
} else {
|
|
56679
|
+
writeContent(() => renderWarning(`Could not fully remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
|
|
56680
|
+
if (process.platform === "win32") {
|
|
56681
|
+
try {
|
|
56682
|
+
execSync29(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
|
|
56683
|
+
deleted = true;
|
|
56684
|
+
} catch {
|
|
56685
|
+
}
|
|
56686
|
+
}
|
|
56687
|
+
}
|
|
56688
|
+
}
|
|
56689
|
+
}
|
|
56690
|
+
if (deleted) {
|
|
56607
56691
|
writeContent(() => renderInfo(`Removed ${OA_DIR}/ directory.`));
|
|
56608
|
-
} catch (err) {
|
|
56609
|
-
writeContent(() => renderWarning(`Could not remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
|
|
56610
56692
|
}
|
|
56611
56693
|
} else {
|
|
56612
56694
|
writeContent(() => renderInfo(`No ${OA_DIR}/ directory found.`));
|
package/package.json
CHANGED