open-agents-ai 0.186.21 → 0.186.22
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 +106 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54052,6 +54052,50 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54052
54052
|
items.push({ key: "deps_only", label: "Dependencies Only", detail: "Update subordinate deps (nexus, viem, moondream, etc.)", kind: "action" });
|
|
54053
54053
|
items.push({ key: "rebuild", label: "Rebuild Native Modules", detail: "Rebuild better-sqlite3, node-pty, etc.", kind: "action" });
|
|
54054
54054
|
items.push({ key: "python", label: "Python Packages Only", detail: "Upgrade venv packages (moondream, tesseract, etc.)", kind: "action" });
|
|
54055
|
+
items.push({ key: "hdr_deps", label: selectColors.dim("\u2500\u2500\u2500 Dependencies \u2500\u2500\u2500"), kind: "header" });
|
|
54056
|
+
skipKeys.push("hdr_deps");
|
|
54057
|
+
try {
|
|
54058
|
+
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54059
|
+
const { join: pj2 } = await import("node:path");
|
|
54060
|
+
const { existsSync: fe2, readFileSync: rf2 } = await import("node:fs");
|
|
54061
|
+
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
54062
|
+
const pkgPath2 = pj2(globalModules, "open-agents-ai", "package.json");
|
|
54063
|
+
if (fe2(pkgPath2)) {
|
|
54064
|
+
const pkg2 = JSON.parse(rf2(pkgPath2, "utf8"));
|
|
54065
|
+
const allDeps2 = { ...pkg2.dependencies || {}, ...pkg2.optionalDependencies || {} };
|
|
54066
|
+
const depChecks = await Promise.all(Object.entries(allDeps2).map(async ([name, range]) => {
|
|
54067
|
+
let installed = "";
|
|
54068
|
+
const localPath = pj2(globalModules, "open-agents-ai", "node_modules", name, "package.json");
|
|
54069
|
+
const hoistedPath = pj2(globalModules, name, "package.json");
|
|
54070
|
+
try {
|
|
54071
|
+
if (fe2(localPath))
|
|
54072
|
+
installed = JSON.parse(rf2(localPath, "utf8")).version || "";
|
|
54073
|
+
else if (fe2(hoistedPath))
|
|
54074
|
+
installed = JSON.parse(rf2(hoistedPath, "utf8")).version || "";
|
|
54075
|
+
} catch {
|
|
54076
|
+
}
|
|
54077
|
+
let latest = "";
|
|
54078
|
+
try {
|
|
54079
|
+
latest = await execA(`npm view ${name} version`, { timeout: 5e3 });
|
|
54080
|
+
} catch {
|
|
54081
|
+
}
|
|
54082
|
+
const outdated = installed && latest && latest !== installed;
|
|
54083
|
+
return { name, range: String(range), installed, latest, outdated };
|
|
54084
|
+
}));
|
|
54085
|
+
for (const dep of depChecks) {
|
|
54086
|
+
const verStr = dep.installed || "missing";
|
|
54087
|
+
const updateTag = dep.outdated ? ` ${c2.bold(c2.yellow("\u2192 " + dep.latest))}` : "";
|
|
54088
|
+
const label = ` ${dep.name} ${c2.dim(verStr)}${updateTag}`;
|
|
54089
|
+
if (dep.outdated) {
|
|
54090
|
+
items.push({ key: `dep_${dep.name}`, label, detail: `Update ${dep.name} ${dep.installed} \u2192 ${dep.latest}`, kind: "action" });
|
|
54091
|
+
} else {
|
|
54092
|
+
items.push({ key: `dep_${dep.name}`, label, kind: "info" });
|
|
54093
|
+
skipKeys.push(`dep_${dep.name}`);
|
|
54094
|
+
}
|
|
54095
|
+
}
|
|
54096
|
+
}
|
|
54097
|
+
} catch {
|
|
54098
|
+
}
|
|
54055
54099
|
items.push({ key: "hdr_policy", label: selectColors.dim("\u2500\u2500\u2500 Policy \u2500\u2500\u2500"), kind: "header" });
|
|
54056
54100
|
skipKeys.push("hdr_policy");
|
|
54057
54101
|
items.push({ key: "policy_auto", label: "Auto-update mode", detail: "Install updates automatically after tasks", kind: "action" });
|
|
@@ -54079,6 +54123,24 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54079
54123
|
renderInfo("Update mode: manual \u2014 only installs when you run /update.");
|
|
54080
54124
|
return;
|
|
54081
54125
|
}
|
|
54126
|
+
if (menuResult.key?.startsWith("dep_")) {
|
|
54127
|
+
const depName = menuResult.key.slice(4);
|
|
54128
|
+
renderInfo(`Updating ${depName} to latest...`);
|
|
54129
|
+
try {
|
|
54130
|
+
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54131
|
+
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
54132
|
+
const { join: pj3 } = await import("node:path");
|
|
54133
|
+
const oaPkgDir = pj3(globalModules, "open-agents-ai");
|
|
54134
|
+
const sudoPrefix2 = needsSudo ? "sudo " : "";
|
|
54135
|
+
const cmd = `${sudoPrefix2}npm install ${depName}@latest --prefer-online --save --prefix "${oaPkgDir}" 2>&1`;
|
|
54136
|
+
const result = await execA(cmd, { timeout: 6e4 }).catch((e) => e.message);
|
|
54137
|
+
const newVer = await execA(`npm view ${depName} version`, { timeout: 5e3 }).catch(() => "?");
|
|
54138
|
+
renderInfo(`${depName} updated to ${newVer}`);
|
|
54139
|
+
} catch (e) {
|
|
54140
|
+
renderError(`Failed to update ${depName}: ${e instanceof Error ? e.message : String(e)}`);
|
|
54141
|
+
}
|
|
54142
|
+
return;
|
|
54143
|
+
}
|
|
54082
54144
|
const doPackage = menuResult.key === "quick" || menuResult.key === "full";
|
|
54083
54145
|
const doDeps = menuResult.key === "deps_only" || menuResult.key === "full";
|
|
54084
54146
|
const doRebuild = menuResult.key === "rebuild" || menuResult.key === "full";
|
|
@@ -54170,7 +54232,7 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54170
54232
|
primaryUpdated = true;
|
|
54171
54233
|
}
|
|
54172
54234
|
if (doDeps) {
|
|
54173
|
-
installOverlay.setStatus("
|
|
54235
|
+
installOverlay.setStatus("Checking sub-dependencies...");
|
|
54174
54236
|
try {
|
|
54175
54237
|
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
54176
54238
|
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
@@ -54180,11 +54242,49 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
54180
54242
|
if (fe(pkgPath)) {
|
|
54181
54243
|
const pkg = JSON.parse(rf(pkgPath, "utf8"));
|
|
54182
54244
|
const allDeps = { ...pkg.dependencies || {}, ...pkg.optionalDependencies || {} };
|
|
54183
|
-
|
|
54184
|
-
|
|
54185
|
-
const
|
|
54186
|
-
|
|
54187
|
-
|
|
54245
|
+
const depNames = Object.keys(allDeps);
|
|
54246
|
+
if (depNames.length > 0) {
|
|
54247
|
+
const outdated = [];
|
|
54248
|
+
for (const dep of depNames) {
|
|
54249
|
+
try {
|
|
54250
|
+
const installedPath = pj(globalModules, "open-agents-ai", "node_modules", dep, "package.json");
|
|
54251
|
+
const hoistedPath = pj(globalModules, dep, "package.json");
|
|
54252
|
+
let installedVer = "";
|
|
54253
|
+
if (fe(installedPath)) {
|
|
54254
|
+
installedVer = JSON.parse(rf(installedPath, "utf8")).version || "";
|
|
54255
|
+
} else if (fe(hoistedPath)) {
|
|
54256
|
+
installedVer = JSON.parse(rf(hoistedPath, "utf8")).version || "";
|
|
54257
|
+
}
|
|
54258
|
+
if (!installedVer) {
|
|
54259
|
+
outdated.push(`${dep}@latest`);
|
|
54260
|
+
continue;
|
|
54261
|
+
}
|
|
54262
|
+
const latestVer = await execA(`npm view ${dep} version 2>/dev/null`, { timeout: 8e3 }).catch(() => "");
|
|
54263
|
+
if (latestVer && latestVer !== installedVer) {
|
|
54264
|
+
const range = allDeps[dep] || "";
|
|
54265
|
+
const instParts = installedVer.split(".");
|
|
54266
|
+
const lateParts = latestVer.split(".");
|
|
54267
|
+
if (range.startsWith("^") && instParts[0] === lateParts[0] && latestVer > installedVer) {
|
|
54268
|
+
outdated.push(`${dep}@${latestVer}`);
|
|
54269
|
+
}
|
|
54270
|
+
}
|
|
54271
|
+
} catch {
|
|
54272
|
+
}
|
|
54273
|
+
}
|
|
54274
|
+
if (outdated.length > 0) {
|
|
54275
|
+
installOverlay.setStatus(`Updating ${outdated.length} sub-dep(s)...`);
|
|
54276
|
+
const oaPkgDir = pj(globalModules, "open-agents-ai");
|
|
54277
|
+
const installPkgs = outdated.join(" ");
|
|
54278
|
+
const forceCmd = `${sudoPrefix}npm install ${installPkgs} --prefer-online --save --prefix "${oaPkgDir}" 2>/dev/null || true`;
|
|
54279
|
+
const forceOk = await runInstall2(forceCmd);
|
|
54280
|
+
if (forceOk)
|
|
54281
|
+
depsUpdated = true;
|
|
54282
|
+
} else {
|
|
54283
|
+
const updateCmd = `${sudoPrefix}npm update --prefer-online --prefix "${pj(globalModules, "open-agents-ai")}" 2>/dev/null || true`;
|
|
54284
|
+
const updateOk = await runInstall2(updateCmd);
|
|
54285
|
+
if (updateOk)
|
|
54286
|
+
depsUpdated = true;
|
|
54287
|
+
}
|
|
54188
54288
|
}
|
|
54189
54289
|
}
|
|
54190
54290
|
} catch {
|
package/package.json
CHANGED