open-agents-ai 0.186.21 → 0.186.23
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 +123 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51417,9 +51417,22 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
51417
51417
|
const enabledEps = config.endpoints.filter((e) => e.enabled);
|
|
51418
51418
|
const allModels = enabledEps.flatMap((e) => e.models || []);
|
|
51419
51419
|
const sponsorUrl = tunnelGw?.tunnelUrl || "";
|
|
51420
|
-
|
|
51421
|
-
|
|
51422
|
-
|
|
51420
|
+
const sponsorPeerId = tunnelGw?.peerId || "";
|
|
51421
|
+
if (!sponsorUrl && !sponsorPeerId) {
|
|
51422
|
+
let daemonPeerId = "";
|
|
51423
|
+
try {
|
|
51424
|
+
const nexus = new NexusTool(projectDir);
|
|
51425
|
+
const st = String(await nexus.execute({ action: "status" }) ?? "");
|
|
51426
|
+
const pm = st.match(/Peer ID:\s*(12D3KooW\S+)/i);
|
|
51427
|
+
if (pm)
|
|
51428
|
+
daemonPeerId = pm[1];
|
|
51429
|
+
} catch {
|
|
51430
|
+
}
|
|
51431
|
+
if (!daemonPeerId) {
|
|
51432
|
+
renderWarning("No tunnel URL or P2P peerId available \u2014 sponsor not registered.");
|
|
51433
|
+
return false;
|
|
51434
|
+
}
|
|
51435
|
+
renderInfo(`Registering as P2P-only sponsor (peerId: ${daemonPeerId.slice(0, 20)}...)`);
|
|
51423
51436
|
}
|
|
51424
51437
|
let sponsorName = (config.header.message || "").replace(/^\/+/, "").trim();
|
|
51425
51438
|
if (!sponsorName || sponsorName.length < 2) {
|
|
@@ -51460,8 +51473,7 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
51460
51473
|
message: config.header.message || sponsorName,
|
|
51461
51474
|
linkUrl: config.header.linkUrl,
|
|
51462
51475
|
linkText: config.header.linkText,
|
|
51463
|
-
status: sponsorUrl ? "active" : "inactive"
|
|
51464
|
-
// don't register without a URL
|
|
51476
|
+
status: sponsorUrl || libp2pPeerId ? "active" : "inactive"
|
|
51465
51477
|
};
|
|
51466
51478
|
try {
|
|
51467
51479
|
const kvResp = await fetch("https://openagents.nexus/api/v1/sponsors", {
|
|
@@ -54052,6 +54064,50 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54052
54064
|
items.push({ key: "deps_only", label: "Dependencies Only", detail: "Update subordinate deps (nexus, viem, moondream, etc.)", kind: "action" });
|
|
54053
54065
|
items.push({ key: "rebuild", label: "Rebuild Native Modules", detail: "Rebuild better-sqlite3, node-pty, etc.", kind: "action" });
|
|
54054
54066
|
items.push({ key: "python", label: "Python Packages Only", detail: "Upgrade venv packages (moondream, tesseract, etc.)", kind: "action" });
|
|
54067
|
+
items.push({ key: "hdr_deps", label: selectColors.dim("\u2500\u2500\u2500 Dependencies \u2500\u2500\u2500"), kind: "header" });
|
|
54068
|
+
skipKeys.push("hdr_deps");
|
|
54069
|
+
try {
|
|
54070
|
+
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54071
|
+
const { join: pj2 } = await import("node:path");
|
|
54072
|
+
const { existsSync: fe2, readFileSync: rf2 } = await import("node:fs");
|
|
54073
|
+
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
54074
|
+
const pkgPath2 = pj2(globalModules, "open-agents-ai", "package.json");
|
|
54075
|
+
if (fe2(pkgPath2)) {
|
|
54076
|
+
const pkg2 = JSON.parse(rf2(pkgPath2, "utf8"));
|
|
54077
|
+
const allDeps2 = { ...pkg2.dependencies || {}, ...pkg2.optionalDependencies || {} };
|
|
54078
|
+
const depChecks = await Promise.all(Object.entries(allDeps2).map(async ([name, range]) => {
|
|
54079
|
+
let installed = "";
|
|
54080
|
+
const localPath = pj2(globalModules, "open-agents-ai", "node_modules", name, "package.json");
|
|
54081
|
+
const hoistedPath = pj2(globalModules, name, "package.json");
|
|
54082
|
+
try {
|
|
54083
|
+
if (fe2(localPath))
|
|
54084
|
+
installed = JSON.parse(rf2(localPath, "utf8")).version || "";
|
|
54085
|
+
else if (fe2(hoistedPath))
|
|
54086
|
+
installed = JSON.parse(rf2(hoistedPath, "utf8")).version || "";
|
|
54087
|
+
} catch {
|
|
54088
|
+
}
|
|
54089
|
+
let latest = "";
|
|
54090
|
+
try {
|
|
54091
|
+
latest = await execA(`npm view ${name} version`, { timeout: 5e3 });
|
|
54092
|
+
} catch {
|
|
54093
|
+
}
|
|
54094
|
+
const outdated = installed && latest && latest !== installed;
|
|
54095
|
+
return { name, range: String(range), installed, latest, outdated };
|
|
54096
|
+
}));
|
|
54097
|
+
for (const dep of depChecks) {
|
|
54098
|
+
const verStr = dep.installed || "missing";
|
|
54099
|
+
const updateTag = dep.outdated ? ` ${c2.bold(c2.yellow("\u2192 " + dep.latest))}` : "";
|
|
54100
|
+
const label = ` ${dep.name} ${c2.dim(verStr)}${updateTag}`;
|
|
54101
|
+
if (dep.outdated) {
|
|
54102
|
+
items.push({ key: `dep_${dep.name}`, label, detail: `Update ${dep.name} ${dep.installed} \u2192 ${dep.latest}`, kind: "action" });
|
|
54103
|
+
} else {
|
|
54104
|
+
items.push({ key: `dep_${dep.name}`, label, kind: "info" });
|
|
54105
|
+
skipKeys.push(`dep_${dep.name}`);
|
|
54106
|
+
}
|
|
54107
|
+
}
|
|
54108
|
+
}
|
|
54109
|
+
} catch {
|
|
54110
|
+
}
|
|
54055
54111
|
items.push({ key: "hdr_policy", label: selectColors.dim("\u2500\u2500\u2500 Policy \u2500\u2500\u2500"), kind: "header" });
|
|
54056
54112
|
skipKeys.push("hdr_policy");
|
|
54057
54113
|
items.push({ key: "policy_auto", label: "Auto-update mode", detail: "Install updates automatically after tasks", kind: "action" });
|
|
@@ -54079,6 +54135,24 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54079
54135
|
renderInfo("Update mode: manual \u2014 only installs when you run /update.");
|
|
54080
54136
|
return;
|
|
54081
54137
|
}
|
|
54138
|
+
if (menuResult.key?.startsWith("dep_")) {
|
|
54139
|
+
const depName = menuResult.key.slice(4);
|
|
54140
|
+
renderInfo(`Updating ${depName} to latest...`);
|
|
54141
|
+
try {
|
|
54142
|
+
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54143
|
+
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
54144
|
+
const { join: pj3 } = await import("node:path");
|
|
54145
|
+
const oaPkgDir = pj3(globalModules, "open-agents-ai");
|
|
54146
|
+
const sudoPrefix2 = needsSudo ? "sudo " : "";
|
|
54147
|
+
const cmd = `${sudoPrefix2}npm install ${depName}@latest --prefer-online --save --prefix "${oaPkgDir}" 2>&1`;
|
|
54148
|
+
const result = await execA(cmd, { timeout: 6e4 }).catch((e) => e.message);
|
|
54149
|
+
const newVer = await execA(`npm view ${depName} version`, { timeout: 5e3 }).catch(() => "?");
|
|
54150
|
+
renderInfo(`${depName} updated to ${newVer}`);
|
|
54151
|
+
} catch (e) {
|
|
54152
|
+
renderError(`Failed to update ${depName}: ${e instanceof Error ? e.message : String(e)}`);
|
|
54153
|
+
}
|
|
54154
|
+
return;
|
|
54155
|
+
}
|
|
54082
54156
|
const doPackage = menuResult.key === "quick" || menuResult.key === "full";
|
|
54083
54157
|
const doDeps = menuResult.key === "deps_only" || menuResult.key === "full";
|
|
54084
54158
|
const doRebuild = menuResult.key === "rebuild" || menuResult.key === "full";
|
|
@@ -54170,7 +54244,7 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54170
54244
|
primaryUpdated = true;
|
|
54171
54245
|
}
|
|
54172
54246
|
if (doDeps) {
|
|
54173
|
-
installOverlay.setStatus("
|
|
54247
|
+
installOverlay.setStatus("Checking sub-dependencies...");
|
|
54174
54248
|
try {
|
|
54175
54249
|
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54176
54250
|
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
@@ -54180,11 +54254,49 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54180
54254
|
if (fe(pkgPath)) {
|
|
54181
54255
|
const pkg = JSON.parse(rf(pkgPath, "utf8"));
|
|
54182
54256
|
const allDeps = { ...pkg.dependencies || {}, ...pkg.optionalDependencies || {} };
|
|
54183
|
-
|
|
54184
|
-
|
|
54185
|
-
const
|
|
54186
|
-
|
|
54187
|
-
|
|
54257
|
+
const depNames = Object.keys(allDeps);
|
|
54258
|
+
if (depNames.length > 0) {
|
|
54259
|
+
const outdated = [];
|
|
54260
|
+
for (const dep of depNames) {
|
|
54261
|
+
try {
|
|
54262
|
+
const installedPath = pj(globalModules, "open-agents-ai", "node_modules", dep, "package.json");
|
|
54263
|
+
const hoistedPath = pj(globalModules, dep, "package.json");
|
|
54264
|
+
let installedVer = "";
|
|
54265
|
+
if (fe(installedPath)) {
|
|
54266
|
+
installedVer = JSON.parse(rf(installedPath, "utf8")).version || "";
|
|
54267
|
+
} else if (fe(hoistedPath)) {
|
|
54268
|
+
installedVer = JSON.parse(rf(hoistedPath, "utf8")).version || "";
|
|
54269
|
+
}
|
|
54270
|
+
if (!installedVer) {
|
|
54271
|
+
outdated.push(`${dep}@latest`);
|
|
54272
|
+
continue;
|
|
54273
|
+
}
|
|
54274
|
+
const latestVer = await execA(`npm view ${dep} version 2>/dev/null`, { timeout: 8e3 }).catch(() => "");
|
|
54275
|
+
if (latestVer && latestVer !== installedVer) {
|
|
54276
|
+
const range = allDeps[dep] || "";
|
|
54277
|
+
const instParts = installedVer.split(".");
|
|
54278
|
+
const lateParts = latestVer.split(".");
|
|
54279
|
+
if (range.startsWith("^") && instParts[0] === lateParts[0] && latestVer > installedVer) {
|
|
54280
|
+
outdated.push(`${dep}@${latestVer}`);
|
|
54281
|
+
}
|
|
54282
|
+
}
|
|
54283
|
+
} catch {
|
|
54284
|
+
}
|
|
54285
|
+
}
|
|
54286
|
+
if (outdated.length > 0) {
|
|
54287
|
+
installOverlay.setStatus(`Updating ${outdated.length} sub-dep(s)...`);
|
|
54288
|
+
const oaPkgDir = pj(globalModules, "open-agents-ai");
|
|
54289
|
+
const installPkgs = outdated.join(" ");
|
|
54290
|
+
const forceCmd = `${sudoPrefix}npm install ${installPkgs} --prefer-online --save --prefix "${oaPkgDir}" 2>/dev/null || true`;
|
|
54291
|
+
const forceOk = await runInstall2(forceCmd);
|
|
54292
|
+
if (forceOk)
|
|
54293
|
+
depsUpdated = true;
|
|
54294
|
+
} else {
|
|
54295
|
+
const updateCmd = `${sudoPrefix}npm update --prefer-online --prefix "${pj(globalModules, "open-agents-ai")}" 2>/dev/null || true`;
|
|
54296
|
+
const updateOk = await runInstall2(updateCmd);
|
|
54297
|
+
if (updateOk)
|
|
54298
|
+
depsUpdated = true;
|
|
54299
|
+
}
|
|
54188
54300
|
}
|
|
54189
54301
|
}
|
|
54190
54302
|
} catch {
|
package/package.json
CHANGED