open-agents-ai 0.103.23 → 0.103.24

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 +116 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28178,7 +28178,7 @@ ${this.formatConnectionInfo()}`);
28178
28178
  if (!connectResult.success) {
28179
28179
  throw new Error(`Nexus daemon connect failed: ${connectResult.error}`);
28180
28180
  }
28181
- await new Promise((r) => setTimeout(r, 2e3));
28181
+ await new Promise((r) => setTimeout(r, 500));
28182
28182
  this._onInfo?.("Registering inference capabilities...");
28183
28183
  let exposeResult = await this._nexusTool.execute({
28184
28184
  action: "expose",
@@ -28187,7 +28187,7 @@ ${this.formatConnectionInfo()}`);
28187
28187
  auth_key: this._authKey
28188
28188
  });
28189
28189
  if (!exposeResult.success && exposeResult.error?.includes("not running")) {
28190
- await new Promise((r) => setTimeout(r, 3e3));
28190
+ await new Promise((r) => setTimeout(r, 1500));
28191
28191
  exposeResult = await this._nexusTool.execute({
28192
28192
  action: "expose",
28193
28193
  ollama_url: this._targetUrl,
@@ -28200,7 +28200,7 @@ ${this.formatConnectionInfo()}`);
28200
28200
  }
28201
28201
  const nexusDir = this._nexusTool.getNexusDir();
28202
28202
  const statusPath = join35(nexusDir, "status.json");
28203
- for (let i = 0; i < 60; i++) {
28203
+ for (let i = 0; i < 80; i++) {
28204
28204
  try {
28205
28205
  const raw = readFileSync19(statusPath, "utf8");
28206
28206
  if (raw.length > 10) {
@@ -28214,7 +28214,7 @@ ${this.formatConnectionInfo()}`);
28214
28214
  }
28215
28215
  } catch {
28216
28216
  }
28217
- await new Promise((r) => setTimeout(r, 500));
28217
+ await new Promise((r) => setTimeout(r, i < 20 ? 100 : 250));
28218
28218
  }
28219
28219
  this._stats.status = "active";
28220
28220
  this._stats.startedAt = Date.now();
@@ -29756,8 +29756,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
29756
29756
  async function fetchPeerModels(peerId) {
29757
29757
  try {
29758
29758
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
29759
+ const { existsSync: existsSync42, readFileSync: readFileSync31 } = await import("node:fs");
29760
+ const { join: join55 } = await import("node:path");
29759
29761
  const cwd4 = process.cwd();
29760
29762
  const nexusTool = new NexusTool2(cwd4);
29763
+ const pricingPath = join55(nexusTool.getNexusDir(), "pricing.json");
29764
+ if (existsSync42(pricingPath)) {
29765
+ try {
29766
+ const pricing = JSON.parse(readFileSync31(pricingPath, "utf8"));
29767
+ const localModels = (pricing.models || []).map((m) => ({
29768
+ name: m.model || "unknown",
29769
+ size: m.parameterSize || "",
29770
+ modified: "",
29771
+ sizeBytes: 0,
29772
+ parameterSize: m.parameterSize || "remote"
29773
+ }));
29774
+ if (localModels.length > 0)
29775
+ return localModels;
29776
+ } catch {
29777
+ }
29778
+ }
29761
29779
  const result = await nexusTool.execute({
29762
29780
  action: "find_agent",
29763
29781
  peer_id: peerId
@@ -29779,19 +29797,6 @@ async function fetchPeerModels(peerId) {
29779
29797
  if (models.length > 0)
29780
29798
  return models;
29781
29799
  }
29782
- const { existsSync: existsSync42, readFileSync: readFileSync31 } = await import("node:fs");
29783
- const { join: join55 } = await import("node:path");
29784
- const pricingPath = join55(nexusTool.getNexusDir(), "pricing.json");
29785
- if (existsSync42(pricingPath)) {
29786
- const pricing = JSON.parse(readFileSync31(pricingPath, "utf8"));
29787
- return (pricing.models || []).map((m) => ({
29788
- name: m.model || "unknown",
29789
- size: m.parameterSize || "",
29790
- modified: "",
29791
- sizeBytes: 0,
29792
- parameterSize: m.parameterSize || "remote"
29793
- }));
29794
- }
29795
29800
  return [];
29796
29801
  } catch {
29797
29802
  return [];
@@ -30600,6 +30605,20 @@ function loadUsageHistory(kind, repoRoot) {
30600
30605
  }
30601
30606
  return Array.from(map.values()).sort((a, b) => new Date(b.lastUsed).getTime() - new Date(a.lastUsed).getTime());
30602
30607
  }
30608
+ function deleteUsageRecord(kind, value, repoRoot) {
30609
+ const remove = (filePath) => {
30610
+ const data = loadUsageFile(filePath);
30611
+ const before = data.records.length;
30612
+ data.records = data.records.filter((r) => !(r.kind === kind && r.value === value));
30613
+ if (data.records.length < before) {
30614
+ saveUsageFile(filePath, data);
30615
+ }
30616
+ };
30617
+ remove(join39(homedir9(), ".open-agents", USAGE_HISTORY_FILE));
30618
+ if (repoRoot) {
30619
+ remove(join39(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
30620
+ }
30621
+ }
30603
30622
  var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
30604
30623
  var init_oa_directory = __esm({
30605
30624
  "packages/cli/dist/tui/oa-directory.js"() {
@@ -32243,6 +32262,8 @@ function tuiSelect(opts) {
32243
32262
  const isSkippable = (idx) => skipSet.has(items[idx].key);
32244
32263
  let filter = "";
32245
32264
  let matchSet = /* @__PURE__ */ new Set();
32265
+ let deleteConfirmIdx = -1;
32266
+ let deleteConfirmSel = false;
32246
32267
  function updateFilter() {
32247
32268
  if (!filter) {
32248
32269
  matchSet = new Set(items.map((_, i) => i));
@@ -32367,7 +32388,11 @@ function tuiSelect(opts) {
32367
32388
  }
32368
32389
  const focused = idx === cursor;
32369
32390
  const isActive = item.key === activeKey;
32370
- if (filter) {
32391
+ if (deleteConfirmIdx === idx) {
32392
+ const yesLabel = deleteConfirmSel ? selectColors.bold(selectColors.green("[Yes]")) : selectColors.dim("[Yes]");
32393
+ const noLabel = !deleteConfirmSel ? selectColors.bold(selectColors.orange("[No]")) : selectColors.dim("[No]");
32394
+ lines.push(` ${ansi3("31", "\u2715")} ${ansi3("31", stripAnsi(item.label))} Delete? ${yesLabel} ${noLabel}`);
32395
+ } else if (filter) {
32371
32396
  lines.push(matchRow(item, focused, isActive));
32372
32397
  } else {
32373
32398
  lines.push(renderRow(item, focused, isActive));
@@ -32378,8 +32403,13 @@ function tuiSelect(opts) {
32378
32403
  lines.push(` ${selectColors.dim(` \u25BC ${remaining} more`)}`);
32379
32404
  }
32380
32405
  lines.push("");
32381
- const actionHint = opts.onAction ? " \u2190/\u2192/Space toggle" : "";
32382
- lines.push(` ${selectColors.dim("\u2191/\u2193 navigate Enter select" + actionHint + " Esc " + (filter ? "clear filter" : "cancel") + " Type to filter")}`);
32406
+ if (deleteConfirmIdx >= 0) {
32407
+ lines.push(` ${selectColors.dim("\u2190/\u2192 select Enter confirm Esc cancel")}`);
32408
+ } else {
32409
+ const actionHint = opts.onAction ? " \u2190/\u2192/Space toggle" : "";
32410
+ const deleteHint = opts.onDelete ? " Del remove" : "";
32411
+ lines.push(` ${selectColors.dim("\u2191/\u2193 navigate Enter select" + actionHint + deleteHint + " Esc " + (filter ? "clear filter" : "cancel") + " Type to filter")}`);
32412
+ }
32383
32413
  lines.push("");
32384
32414
  const output = lines.join("\n");
32385
32415
  process.stdout.write(output);
@@ -32409,6 +32439,48 @@ function tuiSelect(opts) {
32409
32439
  }
32410
32440
  function onData(chunk) {
32411
32441
  const seq = chunk.toString("utf8");
32442
+ if (deleteConfirmIdx >= 0) {
32443
+ if (seq === "\x1B[D") {
32444
+ deleteConfirmSel = true;
32445
+ render();
32446
+ } else if (seq === "\x1B[C") {
32447
+ deleteConfirmSel = false;
32448
+ render();
32449
+ } else if (seq === "\r" || seq === "\n") {
32450
+ if (deleteConfirmSel && opts.onDelete) {
32451
+ const deletedIdx = deleteConfirmIdx;
32452
+ deleteConfirmIdx = -1;
32453
+ deleteConfirmSel = false;
32454
+ opts.onDelete(items[deletedIdx], (removed) => {
32455
+ if (removed) {
32456
+ items.splice(deletedIdx, 1);
32457
+ if (items.length === 0) {
32458
+ cleanup();
32459
+ resolve31({ confirmed: false, key: null, index: -1 });
32460
+ return;
32461
+ }
32462
+ updateFilter();
32463
+ if (cursor >= items.length)
32464
+ cursor = items.length - 1;
32465
+ const valid = findSelectable(cursor, 1) ?? findSelectable(cursor, -1);
32466
+ if (valid >= 0)
32467
+ cursor = valid;
32468
+ scrollOffset = 0;
32469
+ }
32470
+ render();
32471
+ });
32472
+ } else {
32473
+ deleteConfirmIdx = -1;
32474
+ deleteConfirmSel = false;
32475
+ render();
32476
+ }
32477
+ } else if (seq === "\x1B" || seq === "\x1B\x1B" || seq === "") {
32478
+ deleteConfirmIdx = -1;
32479
+ deleteConfirmSel = false;
32480
+ render();
32481
+ }
32482
+ return;
32483
+ }
32412
32484
  if (seq === "\x1B[A") {
32413
32485
  const next = findSelectable(cursor - 1, -1);
32414
32486
  if (next >= 0 && next !== cursor) {
@@ -32449,6 +32521,12 @@ function tuiSelect(opts) {
32449
32521
  cursor = last;
32450
32522
  render();
32451
32523
  }
32524
+ } else if (seq === "\x1B[3~" && opts.onDelete) {
32525
+ if (!isSkippable(cursor) && matchSet.has(cursor) && items[cursor].key !== activeKey) {
32526
+ deleteConfirmIdx = cursor;
32527
+ deleteConfirmSel = false;
32528
+ render();
32529
+ }
32452
32530
  } else if (seq === "\x1B[D" && opts.onAction) {
32453
32531
  if (!isSkippable(cursor) && matchSet.has(cursor)) {
32454
32532
  if (opts.onAction(items[cursor], "left"))
@@ -33850,20 +33928,28 @@ async function handleEndpoint(arg, ctx, local = false) {
33850
33928
  const items = history.map((h) => {
33851
33929
  const provider2 = h.meta?.provider ?? detectProvider(h.value).label;
33852
33930
  const uses = h.localUses > 0 ? `${h.useCount} uses (${h.localUses} local)` : `${h.useCount} uses`;
33931
+ const auth = h.meta?.authHint ? ` Auth: ${h.meta.authHint}` : "";
33853
33932
  return {
33854
33933
  key: h.value,
33855
33934
  label: h.value,
33856
- detail: `${provider2} ${uses}`
33935
+ detail: `${provider2} ${uses}${auth}`
33857
33936
  };
33858
33937
  });
33859
33938
  const result = await tuiSelect({
33860
33939
  items,
33861
33940
  activeKey: ctx.config.backendUrl,
33862
33941
  title: "Select Endpoint",
33863
- rl: ctx.rl
33942
+ rl: ctx.rl,
33943
+ onDelete: (item, done) => {
33944
+ deleteUsageRecord("endpoint", item.key, ctx.repoRoot);
33945
+ done(true);
33946
+ }
33864
33947
  });
33865
33948
  if (result.confirmed && result.key) {
33866
- await handleEndpoint(result.key, ctx, local);
33949
+ const selectedRecord = history.find((h) => h.value === result.key);
33950
+ const savedAuth = selectedRecord?.meta?.authKey;
33951
+ const endpointArg = savedAuth ? `${result.key} --auth ${savedAuth}` : result.key;
33952
+ await handleEndpoint(endpointArg, ctx, local);
33867
33953
  return;
33868
33954
  }
33869
33955
  renderInfo("Endpoint selection cancelled.");
@@ -33937,6 +34023,11 @@ async function handleEndpoint(arg, ctx, local = false) {
33937
34023
  await handlePeerEndpoint(url, apiKey, ctx, local);
33938
34024
  return;
33939
34025
  }
34026
+ if (url.startsWith("peer://")) {
34027
+ const extractedPeerId = url.slice(7);
34028
+ await handlePeerEndpoint(extractedPeerId, apiKey, ctx, local);
34029
+ return;
34030
+ }
33940
34031
  try {
33941
34032
  new URL(url);
33942
34033
  } catch {
@@ -34010,7 +34101,7 @@ async function handleEndpoint(arg, ctx, local = false) {
34010
34101
  meta: {
34011
34102
  provider: provider.label,
34012
34103
  backendType,
34013
- ...apiKey ? { authHint: apiKey.slice(0, 4) + "..." } : {}
34104
+ ...apiKey ? { authHint: apiKey.slice(0, 4) + "...", authKey: apiKey } : {}
34014
34105
  }
34015
34106
  });
34016
34107
  process.stdout.write(`
@@ -34102,7 +34193,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
34102
34193
  provider: "libp2p-peer",
34103
34194
  backendType: "nexus",
34104
34195
  peerId,
34105
- ...authKey ? { authHint: authKey.slice(0, 4) + "..." } : {}
34196
+ ...authKey ? { authHint: authKey.slice(0, 4) + "...", authKey } : {}
34106
34197
  }
34107
34198
  });
34108
34199
  process.stdout.write(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.103.23",
3
+ "version": "0.103.24",
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",