open-agents-ai 0.187.549 → 0.187.551

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 CHANGED
@@ -6853,6 +6853,13 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync, readdir
6853
6853
  import { join } from 'node:path';
6854
6854
  import { homedir, hostname } from 'node:os';
6855
6855
  import { createHash, createHmac } from 'node:crypto';
6856
+ import { createRequire as _createRequire } from 'node:module';
6857
+
6858
+ // CommonJS require() shim — the daemon body uses require('node:child_process'),
6859
+ // require('node:path'), require('node:fs'), etc. which are NOT available in
6860
+ // .mjs files by default. This shim restores it without converting every
6861
+ // individual call site to dynamic import().
6862
+ const require = _createRequire(import.meta.url);
6856
6863
 
6857
6864
  // NKN utilities — imported dynamically to avoid crash on older open-agents-nexus versions.
6858
6865
  // Falls back to inline implementations if the package doesn't export them yet.
@@ -7809,15 +7816,12 @@ async function handleCmd(cmd) {
7809
7816
  writeResp(id, { ok: true, output: JSON.stringify({ streaming: true, stream_file: icStreamFile }) });
7810
7817
  try {
7811
7818
  for await (var icEvt of icStreamGen) {
7812
- appendFileSync(icStreamFile, JSON.stringify({ type: 'event', event: icEvt.event || '', seq: icEvt.seq || 0, data: icEvt.data }) + '
7813
- ');
7819
+ appendFileSync(icStreamFile, JSON.stringify({ type: 'event', event: icEvt.event || '', seq: icEvt.seq || 0, data: icEvt.data }) + '\\n');
7814
7820
  }
7815
- appendFileSync(icStreamFile, JSON.stringify({ type: 'done' }) + '
7816
- ');
7821
+ appendFileSync(icStreamFile, JSON.stringify({ type: 'done' }) + '\\n');
7817
7822
  dlog('invoke_capability: stream complete');
7818
7823
  } catch (icStreamErr) {
7819
- appendFileSync(icStreamFile, JSON.stringify({ type: 'error', error: String(icStreamErr.message || icStreamErr) }) + '
7820
- ');
7824
+ appendFileSync(icStreamFile, JSON.stringify({ type: 'error', error: String(icStreamErr.message || icStreamErr) }) + '\\n');
7821
7825
  dlog('invoke_capability: stream error: ' + (icStreamErr.message || icStreamErr));
7822
7826
  }
7823
7827
  break;
@@ -587531,12 +587535,12 @@ function resolveLocalPeerId() {
587531
587535
  }
587532
587536
  function locateTorScript(filename) {
587533
587537
  const candidates = [
587534
- // npm-installed layout: scripts get copied to dist/scripts/tor/ by
587535
- // scripts/build-publish.mjs. __dirname at runtime points at dist/api.
587538
+ // npm-installed layout: build-publish.mjs copies scripts to
587539
+ // publish/dist/scripts/tor/ which lands at <install>/dist/scripts/tor/.
587540
+ join119(__dirname, "scripts", "tor", filename),
587536
587541
  join119(__dirname, "..", "scripts", "tor", filename),
587537
- // Workspace dev: cli package's source tree.
587538
587542
  join119(__dirname, "..", "..", "scripts", "tor", filename),
587539
- // Workspace dev (from cwd at repo root):
587543
+ // Workspace dev: cli package's source tree.
587540
587544
  join119(process.cwd(), "packages", "cli", "scripts", "tor", filename),
587541
587545
  join119(process.cwd(), "scripts", "tor", filename)
587542
587546
  ];
@@ -587712,7 +587716,7 @@ async function handleGenerateShare(ctx3) {
587712
587716
  const tool = new NexusTool2(repoRoot);
587713
587717
  await Promise.race([
587714
587718
  tool.execute({ action: "connect" }),
587715
- new Promise((_r, rej) => setTimeout(() => rej(new Error("nexus connect 25s budget")), 25e3))
587719
+ new Promise((_r, rej) => setTimeout(() => rej(new Error("nexus connect 8s budget")), 8e3))
587716
587720
  ]).catch(() => null);
587717
587721
  peerInfo = resolveLocalPeerId();
587718
587722
  } catch {
@@ -591345,13 +591349,43 @@ async function loadModels() {
591345
591349
  fetch('/v1/config', { headers: headers() }).then(r => r.json()).catch(() => ({})),
591346
591350
  ]);
591347
591351
  modelSelect.innerHTML = '';
591348
- for (const m of (modelsResp.data || [])) {
591352
+ const list = Array.isArray(modelsResp.data) ? modelsResp.data : [];
591353
+ if (list.length === 0) {
591354
+ // Empty backend — most common cause is ollama not running on this
591355
+ // host, OR /v1/models 401'd due to auth. Surface a clickable
591356
+ // diagnostic in the dropdown so the user knows what to do.
591357
+ const opt = document.createElement('option');
591358
+ opt.value = '';
591359
+ opt.disabled = true;
591360
+ opt.selected = true;
591361
+ const backendUrl = (cfgResp && cfgResp.config && cfgResp.config.backendUrl) || '';
591362
+ opt.textContent = backendUrl
591363
+ ? '(no models — backend at ' + backendUrl + ' not reachable; check ollama/vllm)'
591364
+ : '(no models — set endpoint via /endpoint or check backend)';
591365
+ modelSelect.appendChild(opt);
591366
+ // Visible status hint near the picker if there's a slot for it.
591367
+ try {
591368
+ const hint = document.getElementById('model-empty-hint');
591369
+ if (hint) {
591370
+ hint.style.display = 'block';
591371
+ hint.style.color = 'var(--color-warning)';
591372
+ hint.textContent = 'No models found. Start ollama (run "ollama serve") and pull a model (run "ollama pull qwen3.6:latest"), or change the backend endpoint.';
591373
+ }
591374
+ } catch {}
591375
+ return;
591376
+ }
591377
+ for (const m of list) {
591349
591378
  const opt = document.createElement('option');
591350
591379
  // Strip "local/" prefix for cleaner display
591351
591380
  opt.value = m.id.replace(/^local\\//, '');
591352
591381
  opt.textContent = m.id.replace(/^local\\//, '');
591353
591382
  modelSelect.appendChild(opt);
591354
591383
  }
591384
+ // Hide the empty-state hint if we got models.
591385
+ try {
591386
+ const hint = document.getElementById('model-empty-hint');
591387
+ if (hint) hint.style.display = 'none';
591388
+ } catch {}
591355
591389
  // Resolve the recalled model in priority order
591356
591390
  const daemonModel = (cfgResp && cfgResp.config && cfgResp.config.model) || '';
591357
591391
  let cachedModel = '';
@@ -592716,13 +592750,30 @@ async function generateShareUrl() {
592716
592750
  const out = document.getElementById('share-result');
592717
592751
  if (!out) return;
592718
592752
  out.style.display = 'block';
592719
- out.innerHTML = '<div style="color:var(--color-fg-muted)">generating…</div>';
592753
+ // The first call after a daemon restart can take ~5-8s while the
592754
+ // backend wakes nexus. Show a visible progress hint so the user
592755
+ // knows nothing is hung.
592756
+ out.innerHTML =
592757
+ '<div style="color:var(--color-fg-muted)" id="share-progress">' +
592758
+ ' generating share key' +
592759
+ ' <span id="share-dots">…</span>' +
592760
+ ' <div style="font-size:0.68rem;margin-top:4px">waking nexus for global reach (up to 8s) — falls back to direct-HTTP if unavailable</div>' +
592761
+ '</div>';
592762
+ // Animated dots so the user sees it's alive.
592763
+ let _shareDotN = 1;
592764
+ const _shareDotsTimer = setInterval(() => {
592765
+ const el = document.getElementById('share-dots');
592766
+ if (!el) { clearInterval(_shareDotsTimer); return; }
592767
+ _shareDotN = (_shareDotN % 3) + 1;
592768
+ el.textContent = '.'.repeat(_shareDotN);
592769
+ }, 400);
592720
592770
  try {
592721
592771
  const r = await fetch('/v1/share/generate', {
592722
592772
  method: 'POST',
592723
592773
  headers: { ...headers(), 'Content-Type': 'application/json' },
592724
592774
  body: JSON.stringify({ scope: 'run' }),
592725
592775
  });
592776
+ clearInterval(_shareDotsTimer);
592726
592777
  if (r.status === 403) {
592727
592778
  out.innerHTML = '<div style="color:var(--color-error)">✗ admin scope required — your current key does not have permission to mint share URLs. Set an admin-scope key first.</div>';
592728
592779
  return;
@@ -592774,6 +592825,7 @@ async function generateShareUrl() {
592774
592825
  window.__oaLastTorUrl = j.torShareUrl || null;
592775
592826
  saveRecentKey({ key: j.key, host: j.host + ':' + j.port, label: j.label || ('shared ' + j.host) });
592776
592827
  } catch (e) {
592828
+ clearInterval(_shareDotsTimer);
592777
592829
  out.innerHTML = '<div style="color:var(--color-error)">✗ ' + escapeHtml(e && e.message ? e.message : String(e)) + '</div>';
592778
592830
  }
592779
592831
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.549",
3
+ "version": "0.187.551",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.549",
9
+ "version": "0.187.551",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.549",
3
+ "version": "0.187.551",
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",