open-agents-ai 0.105.0 → 0.105.2

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.
Files changed (2) hide show
  1. package/dist/index.js +153 -98
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12682,8 +12682,7 @@ async function handleCmd(cmd) {
12682
12682
  if (riEvt.event === 'token' && riEvt.data) {
12683
12683
  var tkn = typeof riEvt.data === 'string' ? riEvt.data : String(riEvt.data);
12684
12684
  riTokenContent += tkn;
12685
- appendFileSync(riStreamFile, JSON.stringify({ type: 'token', content: tkn }) + '
12686
- ');
12685
+ appendFileSync(riStreamFile, JSON.stringify({ type: 'token', content: tkn }) + '\\n');
12687
12686
  } else if (riEvt.event === 'result' && riEvt.data) {
12688
12687
  // Final metadata event \u2014 parse for usage/tool_calls
12689
12688
  try {
@@ -12714,8 +12713,7 @@ async function handleCmd(cmd) {
12714
12713
  }],
12715
12714
  usage: { input_tokens: riInputTokens, output_tokens: riOutputTokens },
12716
12715
  };
12717
- appendFileSync(riStreamFile, JSON.stringify({ type: 'done', result: JSON.stringify(riFinalPayload) }) + '
12718
- ');
12716
+ appendFileSync(riStreamFile, JSON.stringify({ type: 'done', result: JSON.stringify(riFinalPayload) }) + '\\n');
12719
12717
  dlog('remote_infer: stream complete, tokens=' + riTokenContent.length + ' in=' + riInputTokens + ' out=' + riOutputTokens);
12720
12718
  break;
12721
12719
  }
@@ -13206,8 +13204,7 @@ async function handleCmd(cmd) {
13206
13204
  var sseChunk = await sseReader.read();
13207
13205
  if (sseChunk.done) break;
13208
13206
  sseBuf += sseDecoder.decode(sseChunk.value, { stream: true });
13209
- var sseLines = sseBuf.split('
13210
- ');
13207
+ var sseLines = sseBuf.split('\\n');
13211
13208
  sseBuf = sseLines.pop();
13212
13209
 
13213
13210
  for (var sli = 0; sli < sseLines.length; sli++) {
@@ -40187,13 +40184,6 @@ async function handleUpdate(subcommand, ctx) {
40187
40184
  }
40188
40185
  };
40189
40186
  }
40190
- process.stdout.write("\x1B[?1049h\x1B[H\x1B[2J");
40191
- process.stdout.write(`
40192
- ${c2.bold("Open Agents Update")}
40193
- ${c2.dim("\u2500".repeat(40))}
40194
-
40195
- `);
40196
- const checkSpinner = startInlineSpinner(`Checking for updates ${c2.dim(`(current: v${currentVersion})`)}`);
40197
40187
  const info = await checkForUpdate(currentVersion, true);
40198
40188
  const { exec: exec4, execSync: es2 } = await import("node:child_process");
40199
40189
  let needsSudo = false;
@@ -40207,6 +40197,65 @@ async function handleUpdate(subcommand, ctx) {
40207
40197
  }
40208
40198
  } catch {
40209
40199
  }
40200
+ const items = [];
40201
+ const skipKeys = [];
40202
+ items.push({ key: "hdr_status", label: selectColors.dim(`\u2500\u2500\u2500 v${currentVersion} \u2500\u2500\u2500`), kind: "header" });
40203
+ skipKeys.push("hdr_status");
40204
+ if (info) {
40205
+ items.push({ key: "info_avail", label: `Update available: v${currentVersion} \u2192 ${c2.bold(c2.green("v" + info.latestVersion))}`, kind: "info" });
40206
+ } else {
40207
+ items.push({ key: "info_avail", label: c2.dim("Primary package is up to date"), kind: "info" });
40208
+ }
40209
+ skipKeys.push("info_avail");
40210
+ items.push({ key: "hdr_options", label: selectColors.dim("\u2500\u2500\u2500 Update Options \u2500\u2500\u2500"), kind: "header" });
40211
+ skipKeys.push("hdr_options");
40212
+ if (info) {
40213
+ items.push({ key: "quick", label: "Quick Update", detail: "Install latest package only (fast)", kind: "action" });
40214
+ }
40215
+ items.push({ key: "full", label: "Full Update", detail: "Package + dependencies + native modules + Python + cloudflared", kind: "action" });
40216
+ items.push({ key: "deps_only", label: "Dependencies Only", detail: "Update subordinate deps (nexus, viem, moondream, etc.)", kind: "action" });
40217
+ items.push({ key: "rebuild", label: "Rebuild Native Modules", detail: "Rebuild better-sqlite3, node-pty, etc.", kind: "action" });
40218
+ items.push({ key: "python", label: "Python Packages Only", detail: "Upgrade venv packages (moondream, tesseract, etc.)", kind: "action" });
40219
+ items.push({ key: "hdr_policy", label: selectColors.dim("\u2500\u2500\u2500 Policy \u2500\u2500\u2500"), kind: "header" });
40220
+ skipKeys.push("hdr_policy");
40221
+ items.push({ key: "policy_auto", label: "Auto-update mode", detail: "Install updates automatically after tasks", kind: "action" });
40222
+ items.push({ key: "policy_manual", label: "Manual-update mode", detail: "Only update when you run /update", kind: "action" });
40223
+ const menuResult = await tuiSelect({
40224
+ items,
40225
+ title: "Update Manager",
40226
+ rl: ctx.rl,
40227
+ skipKeys,
40228
+ availableRows: ctx.availableContentRows?.()
40229
+ });
40230
+ if (!menuResult.confirmed || !menuResult.key) {
40231
+ renderInfo("Update cancelled.");
40232
+ return;
40233
+ }
40234
+ if (menuResult.key === "policy_auto") {
40235
+ const settings = { updateMode: "auto" };
40236
+ saveProjectSettings(repoRoot, settings);
40237
+ saveGlobalSettings(settings);
40238
+ renderInfo("Update mode: auto \u2014 updates install automatically after task completion.");
40239
+ return;
40240
+ }
40241
+ if (menuResult.key === "policy_manual") {
40242
+ const settings = { updateMode: "manual" };
40243
+ saveProjectSettings(repoRoot, settings);
40244
+ saveGlobalSettings(settings);
40245
+ renderInfo("Update mode: manual \u2014 only installs when you run /update.");
40246
+ return;
40247
+ }
40248
+ const doPackage = menuResult.key === "quick" || menuResult.key === "full";
40249
+ const doDeps = menuResult.key === "deps_only" || menuResult.key === "full";
40250
+ const doRebuild = menuResult.key === "rebuild" || menuResult.key === "full";
40251
+ const doPython = menuResult.key === "python" || menuResult.key === "full";
40252
+ const doCloudflared = menuResult.key === "full";
40253
+ process.stdout.write("\x1B[?1049h\x1B[H\x1B[2J");
40254
+ process.stdout.write(`
40255
+ ${c2.bold("Open Agents Update")}
40256
+ ${c2.dim("\u2500".repeat(40))}
40257
+
40258
+ `);
40210
40259
  let installError = "";
40211
40260
  const runInstall2 = (cmd) => new Promise((resolve32) => {
40212
40261
  const child = exec4(cmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
@@ -40219,7 +40268,6 @@ async function handleUpdate(subcommand, ctx) {
40219
40268
  if (needsSudo) {
40220
40269
  process.stdout.write("\x1B[?1049l");
40221
40270
  renderInfo("Global npm directory requires elevated permissions.");
40222
- renderInfo("You'll be asked for your password once \u2014 it covers all update steps.");
40223
40271
  safeWrite("\n");
40224
40272
  try {
40225
40273
  es2("sudo -v", { stdio: "inherit", timeout: 6e4 });
@@ -40236,14 +40284,11 @@ async function handleUpdate(subcommand, ctx) {
40236
40284
  }
40237
40285
  const sudoPrefix = needsSudo ? "sudo " : "";
40238
40286
  let primaryUpdated = false;
40239
- if (!info) {
40240
- checkSpinner.stop(`Primary package up to date (v${currentVersion}).`);
40241
- } else {
40242
- checkSpinner.stop(`Update available: v${info.currentVersion} \u2192 v${c2.bold(c2.green(info.latestVersion))}`);
40287
+ let depsUpdated = false;
40288
+ if (doPackage && info) {
40243
40289
  const installSpinner = startInlineSpinner("Installing update");
40244
40290
  const installCmd = `${sudoPrefix}npm install -g open-agents-ai@latest --prefer-online`;
40245
- let installOk = false;
40246
- installOk = await runInstall2(installCmd);
40291
+ let installOk = await runInstall2(installCmd);
40247
40292
  if (!installOk && /ENOTEMPTY|errno -39/i.test(installError)) {
40248
40293
  installSpinner.stop("Cleaning stale npm temp files...");
40249
40294
  try {
@@ -40264,10 +40309,6 @@ async function handleUpdate(subcommand, ctx) {
40264
40309
  }
40265
40310
  if (!installOk) {
40266
40311
  installSpinner.stop("Update install failed.");
40267
- const errPreview = installError.split("\n").filter((l) => l.trim()).slice(-3).join("\n ");
40268
- if (errPreview)
40269
- renderWarning(`Error:
40270
- ${errPreview}`);
40271
40312
  renderWarning(`Try manually: ${sudoPrefix}npm i -g open-agents-ai`);
40272
40313
  process.stdout.write("\x1B[?1049l");
40273
40314
  return;
@@ -40275,99 +40316,113 @@ async function handleUpdate(subcommand, ctx) {
40275
40316
  installSpinner.stop(`Update installed (v${info.latestVersion}).`);
40276
40317
  primaryUpdated = true;
40277
40318
  }
40278
- const depsSpinner = startInlineSpinner("Checking subordinate dependencies");
40279
- let depsUpdated = false;
40280
- try {
40281
- const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
40282
- const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
40283
- const { existsSync: fe, readFileSync: rf } = await import("node:fs");
40284
- const { join: pj } = await import("node:path");
40285
- const pkgPath = pj(globalModules, "open-agents-ai", "package.json");
40286
- if (fe(pkgPath)) {
40287
- const pkg = JSON.parse(rf(pkgPath, "utf8"));
40288
- const allDeps = { ...pkg.dependencies || {}, ...pkg.optionalDependencies || {} };
40289
- const depNames = Object.keys(allDeps);
40290
- if (depNames.length > 0) {
40291
- const updateCmd = `${sudoPrefix}npm update --prefer-online --prefix "${pj(globalModules, "open-agents-ai")}" 2>/dev/null || true`;
40292
- const updateOk = await runInstall2(updateCmd);
40293
- if (updateOk)
40294
- depsUpdated = true;
40319
+ if (doDeps) {
40320
+ const depsSpinner = startInlineSpinner("Updating subordinate dependencies");
40321
+ try {
40322
+ const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
40323
+ const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
40324
+ const { existsSync: fe, readFileSync: rf } = await import("node:fs");
40325
+ const { join: pj } = await import("node:path");
40326
+ const pkgPath = pj(globalModules, "open-agents-ai", "package.json");
40327
+ if (fe(pkgPath)) {
40328
+ const pkg = JSON.parse(rf(pkgPath, "utf8"));
40329
+ const allDeps = { ...pkg.dependencies || {}, ...pkg.optionalDependencies || {} };
40330
+ if (Object.keys(allDeps).length > 0) {
40331
+ const updateCmd = `${sudoPrefix}npm update --prefer-online --prefix "${pj(globalModules, "open-agents-ai")}" 2>/dev/null || true`;
40332
+ const updateOk = await runInstall2(updateCmd);
40333
+ if (updateOk)
40334
+ depsUpdated = true;
40335
+ }
40295
40336
  }
40337
+ } catch {
40296
40338
  }
40297
- } catch {
40339
+ depsSpinner.stop(depsUpdated ? "Dependencies updated." : "Dependencies checked.");
40298
40340
  }
40299
- depsSpinner.stop(depsUpdated ? "Dependencies updated to latest." : "Dependencies checked.");
40300
- if (!primaryUpdated && !depsUpdated) {
40301
- renderInfo("Everything is up to date \u2014 no changes needed.");
40341
+ if (!primaryUpdated && !depsUpdated && !doRebuild && !doPython && !doCloudflared) {
40342
+ renderInfo("No changes needed.");
40302
40343
  safeWrite("\n");
40303
40344
  await new Promise((r) => setTimeout(r, 1e3));
40304
40345
  process.stdout.write("\x1B[?1049l");
40305
40346
  return;
40306
40347
  }
40307
- const rebuildSpinner = startInlineSpinner("Rebuilding native modules");
40308
- const rebuildOk = await new Promise((resolve32) => {
40309
- const child = exec4(`${sudoPrefix}npm rebuild -g open-agents-ai 2>/dev/null || true`, { timeout: 12e4 }, () => resolve32(true));
40310
- child.stdout?.resume();
40311
- child.stderr?.resume();
40312
- });
40313
- rebuildSpinner.stop(rebuildOk ? "Native modules rebuilt." : "Native rebuild skipped.");
40348
+ if (doRebuild) {
40349
+ const rebuildSpinner = startInlineSpinner("Rebuilding native modules");
40350
+ const rebuildOk = await new Promise((resolve32) => {
40351
+ const child = exec4(`${sudoPrefix}npm rebuild -g open-agents-ai 2>/dev/null || true`, { timeout: 12e4 }, () => resolve32(true));
40352
+ child.stdout?.resume();
40353
+ child.stderr?.resume();
40354
+ });
40355
+ rebuildSpinner.stop(rebuildOk ? "Native modules rebuilt." : "Native rebuild skipped.");
40356
+ }
40314
40357
  const { existsSync: fsExists } = await import("node:fs");
40315
40358
  const { join: pathJoin } = await import("node:path");
40316
40359
  const { homedir: getHome } = await import("node:os");
40317
- let hasPython = hasCmd("python3") || hasCmd("python");
40318
- if (!hasPython) {
40319
- const pyInstallSpinner = startInlineSpinner("Installing Python3");
40320
- try {
40321
- ensurePython3();
40322
- hasPython = hasCmd("python3") || hasCmd("python");
40323
- pyInstallSpinner.stop(hasPython ? "Python3 installed." : "Python3 install failed.");
40324
- } catch {
40325
- pyInstallSpinner.stop("Python3 install failed.");
40360
+ if (doPython) {
40361
+ let hasPython = hasCmd("python3") || hasCmd("python");
40362
+ if (!hasPython) {
40363
+ const pyInstallSpinner = startInlineSpinner("Installing Python3");
40364
+ try {
40365
+ ensurePython3();
40366
+ hasPython = hasCmd("python3") || hasCmd("python");
40367
+ pyInstallSpinner.stop(hasPython ? "Python3 installed." : "Python3 install failed.");
40368
+ } catch {
40369
+ pyInstallSpinner.stop("Python3 install failed.");
40370
+ }
40371
+ }
40372
+ if (hasPython && !checkPythonVenv()) {
40373
+ const venvInstallSpinner = startInlineSpinner("Installing python3-venv");
40374
+ try {
40375
+ ensurePythonVenv();
40376
+ venvInstallSpinner.stop(checkPythonVenv() ? "python3-venv installed." : "python3-venv install failed.");
40377
+ } catch {
40378
+ venvInstallSpinner.stop("python3-venv install failed.");
40379
+ }
40380
+ }
40381
+ const venvDir = pathJoin(getHome(), ".open-agents", "venv");
40382
+ const venvPip = pathJoin(venvDir, "bin", "pip");
40383
+ if (fsExists(venvPip)) {
40384
+ const pySpinner = startInlineSpinner("Upgrading Python venv packages");
40385
+ const pyOk = await new Promise((resolve32) => {
40386
+ const child = exec4(`"${venvPip}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve32(!err));
40387
+ child.stdout?.resume();
40388
+ child.stderr?.resume();
40389
+ });
40390
+ pySpinner.stop(pyOk ? "Python packages upgraded." : "Python upgrade skipped.");
40391
+ } else {
40392
+ const pySpinner = startInlineSpinner("Setting up Python venv & deps");
40393
+ await ensureVisionDeps((msg) => {
40394
+ pySpinner.stop(msg);
40395
+ }).catch(() => {
40396
+ });
40397
+ pySpinner.stop("Python deps bootstrapped.");
40326
40398
  }
40327
40399
  }
40328
- if (hasPython && !checkPythonVenv()) {
40329
- const venvInstallSpinner = startInlineSpinner("Installing python3-venv");
40400
+ let hasCf = false;
40401
+ if (doCloudflared) {
40402
+ const cfSpinner = startInlineSpinner("Checking cloudflared");
40330
40403
  try {
40331
- ensurePythonVenv();
40332
- venvInstallSpinner.stop(checkPythonVenv() ? "python3-venv installed." : "python3-venv install failed.");
40404
+ const { execSync: es } = await import("node:child_process");
40405
+ es("which cloudflared", { stdio: "pipe", timeout: 3e3 });
40406
+ hasCf = true;
40333
40407
  } catch {
40334
- venvInstallSpinner.stop("python3-venv install failed.");
40335
40408
  }
40409
+ if (!hasCf) {
40410
+ cfSpinner.stop("Installing cloudflared...");
40411
+ ensureCloudflaredBackground((msg) => renderInfo(msg));
40412
+ await new Promise((r) => setTimeout(r, 1e3));
40413
+ } else {
40414
+ cfSpinner.stop("cloudflared ready.");
40415
+ }
40416
+ ensureTranscribeCliBackground();
40336
40417
  }
40337
- const venvDir = pathJoin(getHome(), ".open-agents", "venv");
40338
- const venvPip = pathJoin(venvDir, "bin", "pip");
40339
- if (fsExists(venvPip)) {
40340
- const pySpinner = startInlineSpinner("Upgrading Python venv packages");
40341
- const pyOk = await new Promise((resolve32) => {
40342
- const child = exec4(`"${venvPip}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve32(!err));
40343
- child.stdout?.resume();
40344
- child.stderr?.resume();
40345
- });
40346
- pySpinner.stop(pyOk ? "Python packages upgraded." : "Python upgrade skipped.");
40347
- } else {
40348
- const pySpinner = startInlineSpinner("Setting up Python venv & deps");
40349
- await ensureVisionDeps((msg) => {
40350
- pySpinner.stop(msg);
40351
- }).catch(() => {
40352
- });
40353
- pySpinner.stop("Python deps bootstrapped.");
40354
- }
40355
- const cfSpinner = startInlineSpinner("Checking cloudflared");
40356
- let hasCf = false;
40357
- try {
40358
- const { execSync: es } = await import("node:child_process");
40359
- es("which cloudflared", { stdio: "pipe", timeout: 3e3 });
40360
- hasCf = true;
40361
- } catch {
40362
- }
40363
- if (!hasCf) {
40364
- cfSpinner.stop("Installing cloudflared...");
40365
- ensureCloudflaredBackground((msg) => renderInfo(msg));
40418
+ if (!primaryUpdated) {
40419
+ safeWrite(`
40420
+ ${c2.green("\u2714")} Done.
40421
+ `);
40366
40422
  await new Promise((r) => setTimeout(r, 1e3));
40367
- } else {
40368
- cfSpinner.stop("cloudflared ready.");
40423
+ process.stdout.write("\x1B[?1049l");
40424
+ return;
40369
40425
  }
40370
- ensureTranscribeCliBackground();
40371
40426
  const reloadSpinner = startInlineSpinner("Loading");
40372
40427
  await new Promise((r) => setTimeout(r, 400));
40373
40428
  ctx.contextSave?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.105.0",
3
+ "version": "0.105.2",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",