open-agents-ai 0.186.68 → 0.186.69

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 +188 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -274688,6 +274688,39 @@ var init_personaplex = __esm({
274688
274688
  });
274689
274689
 
274690
274690
  // packages/cli/dist/tui/setup.js
274691
+ var setup_exports = {};
274692
+ __export(setup_exports, {
274693
+ calculateContextWindow: () => calculateContextWindow,
274694
+ checkExpandedVariant: () => checkExpandedVariant,
274695
+ checkOllamaUpdate: () => checkOllamaUpdate,
274696
+ checkPythonVenv: () => checkPythonVenv,
274697
+ checkToolSupport: () => checkToolSupport,
274698
+ computeInferenceScore: () => computeInferenceScore,
274699
+ createExpandedVariant: () => createExpandedVariant,
274700
+ createExpandedVariantAsync: () => createExpandedVariantAsync,
274701
+ detectSystemSpecs: () => detectSystemSpecs,
274702
+ detectSystemSpecsAsync: () => detectSystemSpecsAsync,
274703
+ ensureCloudflaredBackground: () => ensureCloudflaredBackground,
274704
+ ensureExpandedContext: () => ensureExpandedContext,
274705
+ ensureNeovim: () => ensureNeovim,
274706
+ ensureOllamaRunning: () => ensureOllamaRunning,
274707
+ ensurePython3: () => ensurePython3,
274708
+ ensurePythonVenv: () => ensurePythonVenv,
274709
+ ensureVisionDeps: () => ensureVisionDeps,
274710
+ expandedModelName: () => expandedModelName,
274711
+ getLatestOllamaVersion: () => getLatestOllamaVersion,
274712
+ getOllamaVersion: () => getOllamaVersion,
274713
+ hasCmd: () => hasCmd,
274714
+ isCloudflaredReady: () => isCloudflaredReady,
274715
+ isFirstRun: () => isFirstRun,
274716
+ isModelAvailable: () => isModelAvailable,
274717
+ needsTextToolMode: () => needsTextToolMode,
274718
+ pullModelWithAutoUpdate: () => pullModelWithAutoUpdate,
274719
+ recommendModel: () => recommendModel,
274720
+ renderScoreBar: () => renderScoreBar,
274721
+ runSetupWizard: () => runSetupWizard,
274722
+ updateOllama: () => updateOllama
274723
+ });
274691
274724
  import * as readline from "node:readline";
274692
274725
  import { execSync as execSync29, spawn as spawn20, exec as exec2 } from "node:child_process";
274693
274726
  import { promisify as promisify7 } from "node:util";
@@ -274718,6 +274751,10 @@ async function checkToolSupport(modelName, backendUrl = "http://localhost:11434"
274718
274751
  return true;
274719
274752
  }
274720
274753
  }
274754
+ async function needsTextToolMode(modelName, backendUrl) {
274755
+ const hasTools = await checkToolSupport(modelName, backendUrl);
274756
+ return !hasTools;
274757
+ }
274721
274758
  function detectSystemSpecs() {
274722
274759
  let totalRamGB = 0;
274723
274760
  let availableRamGB = 0;
@@ -275131,6 +275168,68 @@ async function ensureOllamaRunning(backendUrl, rl) {
275131
275168
  `);
275132
275169
  return false;
275133
275170
  }
275171
+ function getOllamaVersion() {
275172
+ try {
275173
+ const out = execSync29("ollama --version", { encoding: "utf8", timeout: 5e3 });
275174
+ const match = out.match(/(\d+\.\d+\.\d+)/);
275175
+ return match ? match[1] : null;
275176
+ } catch {
275177
+ return null;
275178
+ }
275179
+ }
275180
+ async function getLatestOllamaVersion() {
275181
+ try {
275182
+ const resp = await fetch("https://api.github.com/repos/ollama/ollama/releases/latest", {
275183
+ signal: AbortSignal.timeout(5e3),
275184
+ headers: { "User-Agent": "open-agents" }
275185
+ });
275186
+ if (!resp.ok)
275187
+ return null;
275188
+ const data = await resp.json();
275189
+ const tag = data.tag_name || "";
275190
+ return tag.replace(/^v/, "") || null;
275191
+ } catch {
275192
+ return null;
275193
+ }
275194
+ }
275195
+ function compareSemver(a2, b) {
275196
+ const pa = a2.split(".").map(Number);
275197
+ const pb = b.split(".").map(Number);
275198
+ for (let i2 = 0; i2 < 3; i2++) {
275199
+ if ((pa[i2] ?? 0) < (pb[i2] ?? 0))
275200
+ return -1;
275201
+ if ((pa[i2] ?? 0) > (pb[i2] ?? 0))
275202
+ return 1;
275203
+ }
275204
+ return 0;
275205
+ }
275206
+ async function checkOllamaUpdate() {
275207
+ const current = getOllamaVersion();
275208
+ if (!current)
275209
+ return null;
275210
+ const latest = await getLatestOllamaVersion();
275211
+ if (!latest)
275212
+ return null;
275213
+ return {
275214
+ needsUpdate: compareSemver(current, latest) < 0,
275215
+ current,
275216
+ latest
275217
+ };
275218
+ }
275219
+ function updateOllama() {
275220
+ if (process.platform !== "linux" && process.platform !== "darwin") {
275221
+ return false;
275222
+ }
275223
+ try {
275224
+ execSync29("curl -fsSL https://ollama.com/install.sh | sh", {
275225
+ stdio: "inherit",
275226
+ timeout: 3e5
275227
+ });
275228
+ return true;
275229
+ } catch {
275230
+ return false;
275231
+ }
275232
+ }
275134
275233
  function pullModelWithAutoUpdate(tag) {
275135
275234
  try {
275136
275235
  execSync29(`ollama pull ${tag}`, {
@@ -276245,6 +276344,13 @@ function ensureCloudflaredBackground(onInfo) {
276245
276344
  return false;
276246
276345
  })();
276247
276346
  }
276347
+ async function isCloudflaredReady() {
276348
+ if (hasCmd("cloudflared"))
276349
+ return true;
276350
+ if (_cloudflaredInstallPromise)
276351
+ return _cloudflaredInstallPromise;
276352
+ return false;
276353
+ }
276248
276354
  function expandedModelName(baseModel) {
276249
276355
  return `open-agents-${baseModel.replace(":", "-").replace(/\./g, "")}`;
276250
276356
  }
@@ -276298,6 +276404,31 @@ async function queryModelKVInfo(backendUrl, modelName) {
276298
276404
  return null;
276299
276405
  }
276300
276406
  }
276407
+ function createExpandedVariant(baseModel, specs, sizeGB, kvBytesPerToken, archMax) {
276408
+ const customName = expandedModelName(baseModel);
276409
+ const ctx3 = calculateContextWindow(specs, sizeGB, kvBytesPerToken, archMax);
276410
+ try {
276411
+ const numPredict = Math.min(16384, Math.max(2048, Math.floor(ctx3.numCtx * 0.25)));
276412
+ const modelfileContent = [
276413
+ `FROM ${baseModel}`,
276414
+ `PARAMETER num_ctx ${ctx3.numCtx}`,
276415
+ `PARAMETER temperature 0`,
276416
+ `PARAMETER num_predict ${numPredict}`,
276417
+ `PARAMETER stop "<|endoftext|>"`
276418
+ ].join("\n");
276419
+ const modelDir2 = join57(homedir15(), ".open-agents", "models");
276420
+ mkdirSync17(modelDir2, { recursive: true });
276421
+ const modelfilePath = join57(modelDir2, `Modelfile.${customName}`);
276422
+ writeFileSync18(modelfilePath, modelfileContent + "\n", "utf8");
276423
+ execSync29(`ollama create ${customName} -f ${modelfilePath}`, {
276424
+ stdio: "pipe",
276425
+ timeout: 12e4
276426
+ });
276427
+ return customName;
276428
+ } catch {
276429
+ return null;
276430
+ }
276431
+ }
276301
276432
  async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerToken, archMax) {
276302
276433
  const customName = expandedModelName(baseModel);
276303
276434
  const ctx3 = calculateContextWindow(specs, sizeGB, kvBytesPerToken, archMax);
@@ -286050,6 +286181,17 @@ async function handleUpdate(subcommand, ctx3) {
286050
286181
  ]);
286051
286182
  const needsSudo = sudoInfo;
286052
286183
  renderInfo(`v${currentVersion} \u2014 ${info ? `update available \u2192 v${info.latestVersion}` : "up to date"}`);
286184
+ let ollamaUpdate = null;
286185
+ try {
286186
+ const { checkOllamaUpdate: checkOllamaUpdate2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
286187
+ ollamaUpdate = await checkOllamaUpdate2();
286188
+ if (ollamaUpdate?.needsUpdate) {
286189
+ renderInfo(`Ollama ${ollamaUpdate.current} \u2192 ${ollamaUpdate.latest} update available`);
286190
+ } else if (ollamaUpdate) {
286191
+ renderInfo(`Ollama ${ollamaUpdate.current} \u2014 up to date`);
286192
+ }
286193
+ } catch {
286194
+ }
286053
286195
  const items = [];
286054
286196
  const skipKeys = [];
286055
286197
  items.push({ key: "hdr_status", label: selectColors.dim(`\u2500\u2500\u2500 v${currentVersion} \u2500\u2500\u2500`), kind: "header" });
@@ -286113,6 +286255,16 @@ async function handleUpdate(subcommand, ctx3) {
286113
286255
  }
286114
286256
  } catch {
286115
286257
  }
286258
+ if (ollamaUpdate?.needsUpdate) {
286259
+ items.push({ key: "hdr_ollama", label: selectColors.dim("\u2500\u2500\u2500 Ollama \u2500\u2500\u2500"), kind: "header" });
286260
+ skipKeys.push("hdr_ollama");
286261
+ items.push({
286262
+ key: "ollama_update",
286263
+ label: `Update Ollama ${ollamaUpdate.current} \u2192 ${ollamaUpdate.latest}`,
286264
+ detail: "Run official install script to update Ollama backend",
286265
+ kind: "action"
286266
+ });
286267
+ }
286116
286268
  items.push({ key: "hdr_policy", label: selectColors.dim("\u2500\u2500\u2500 Policy \u2500\u2500\u2500"), kind: "header" });
286117
286269
  skipKeys.push("hdr_policy");
286118
286270
  items.push({ key: "policy_auto", label: "Auto-update mode", detail: "Install updates automatically after tasks", kind: "action" });
@@ -286158,11 +286310,31 @@ async function handleUpdate(subcommand, ctx3) {
286158
286310
  }
286159
286311
  return;
286160
286312
  }
286313
+ if (menuResult.key === "ollama_update") {
286314
+ renderInfo("Updating Ollama...");
286315
+ try {
286316
+ const { updateOllama: updateOllama2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
286317
+ if (updateOllama2()) {
286318
+ renderInfo(`Ollama updated successfully!`);
286319
+ try {
286320
+ const { execSync: es } = await import("node:child_process");
286321
+ es("sudo systemctl restart ollama 2>/dev/null || true", { timeout: 1e4, stdio: "pipe" });
286322
+ } catch {
286323
+ }
286324
+ } else {
286325
+ renderInfo("Ollama update failed. Try: curl -fsSL https://ollama.com/install.sh | sh");
286326
+ }
286327
+ } catch (e2) {
286328
+ renderInfo(`Ollama update error: ${e2 instanceof Error ? e2.message : String(e2)}`);
286329
+ }
286330
+ return;
286331
+ }
286161
286332
  const doPackage = menuResult.key === "quick" || menuResult.key === "full";
286162
286333
  const doDeps = menuResult.key === "deps_only" || menuResult.key === "full";
286163
286334
  const doRebuild = menuResult.key === "rebuild" || menuResult.key === "full";
286164
286335
  const doPython = menuResult.key === "python" || menuResult.key === "full";
286165
286336
  const doCloudflared = menuResult.key === "full";
286337
+ const doOllama = menuResult.key === "full" && ollamaUpdate?.needsUpdate;
286166
286338
  const targetVersion = info?.latestVersion ?? currentVersion;
286167
286339
  const installOverlay = startInstallOverlay(targetVersion);
286168
286340
  let installError = "";
@@ -286308,7 +286480,22 @@ async function handleUpdate(subcommand, ctx3) {
286308
286480
  }
286309
286481
  installOverlay.setStatus(depsUpdated ? "Dependencies updated" : "Dependencies OK");
286310
286482
  }
286311
- if (!primaryUpdated && !depsUpdated && !doRebuild && !doPython && !doCloudflared) {
286483
+ if (doOllama) {
286484
+ installOverlay.setStatus("Updating Ollama...");
286485
+ try {
286486
+ const { updateOllama: doOllamaUpgrade } = await Promise.resolve().then(() => (init_setup(), setup_exports));
286487
+ if (doOllamaUpgrade()) {
286488
+ installOverlay.setStatus(`Ollama updated to ${ollamaUpdate.latest}`);
286489
+ try {
286490
+ const { execSync: es22 } = await import("node:child_process");
286491
+ es22("sudo systemctl restart ollama 2>/dev/null || true", { timeout: 1e4, stdio: "pipe" });
286492
+ } catch {
286493
+ }
286494
+ }
286495
+ } catch {
286496
+ }
286497
+ }
286498
+ if (!primaryUpdated && !depsUpdated && !doRebuild && !doPython && !doCloudflared && !doOllama) {
286312
286499
  installOverlay.stop("No changes needed");
286313
286500
  await new Promise((r2) => setTimeout(r2, 2e3));
286314
286501
  installOverlay.dismiss();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.186.68",
3
+ "version": "0.186.69",
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",