open-agents-ai 0.186.8 → 0.186.9

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 +68 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -66012,9 +66012,11 @@ async function sendMessage() {
66012
66012
  }
66013
66013
  }
66014
66014
 
66015
- messages.push({ role: 'assistant', content: fullContent });
66015
+ // Save with metadata for session recall
66016
+ const msgEntry = { role: 'assistant', content: fullContent, meta: metaInfo, tools: chatTools.map(t => t.tool || t) };
66017
+ messages.push(msgEntry);
66016
66018
  updateTokenCounter(fullContent.split(/\\s+/).length * 1.3 | 0);
66017
- saveSessions(); // persist to localStorage
66019
+ saveSessions();
66018
66020
 
66019
66021
  // Final render: content + collapsible tools + metadata
66020
66022
  contentDiv.innerHTML = renderMarkdown(fullContent);
@@ -66459,11 +66461,37 @@ function switchSession(id) {
66459
66461
  if (s) {
66460
66462
  chatSessionId = id;
66461
66463
  messages = s.messages || [];
66462
- // Re-render messages
66463
66464
  const conv = document.getElementById('conversation');
66464
66465
  conv.innerHTML = '';
66465
66466
  for (const m of messages) {
66466
- addMessage(m.role, m.content);
66467
+ const div = addMessage(m.role, m.content);
66468
+ // Restore metadata bar
66469
+ if (m.meta && m.role === 'assistant') {
66470
+ const metaBar = document.createElement('div');
66471
+ metaBar.style.cssText = 'margin:6px 0 2px;padding:4px 8px;background:#1e1e22;border-radius:3px;font-size:0.6rem;color:#555;display:flex;gap:12px';
66472
+ const parts = [];
66473
+ if (m.meta.turns) parts.push(m.meta.turns + ' turns');
66474
+ if (m.meta.toolCalls) parts.push(m.meta.toolCalls + ' tool calls');
66475
+ if (m.meta.tokens) parts.push(m.meta.tokens + ' tokens');
66476
+ metaBar.innerHTML = parts.map(p => '<span>' + p + '</span>').join('');
66477
+ div.appendChild(metaBar);
66478
+ }
66479
+ // Restore tool call provenance
66480
+ if (m.tools?.length && m.role === 'assistant') {
66481
+ const details = document.createElement('details');
66482
+ details.style.cssText = 'margin:2px 0;font-size:0.6rem;color:#555';
66483
+ const summary = document.createElement('summary');
66484
+ summary.style.cssText = 'cursor:pointer;color:#888';
66485
+ summary.textContent = 'show ' + m.tools.length + ' tool calls';
66486
+ details.appendChild(summary);
66487
+ for (const t of m.tools) {
66488
+ const el = document.createElement('div');
66489
+ el.style.cssText = 'background:#1e1e22;border-left:2px solid #b2920a;padding:4px 8px;margin:2px 0;color:#888';
66490
+ el.textContent = (typeof t === 'string' ? t : t.tool || JSON.stringify(t));
66491
+ details.appendChild(el);
66492
+ }
66493
+ div.appendChild(details);
66494
+ }
66467
66495
  }
66468
66496
  }
66469
66497
  }
@@ -66488,15 +66516,25 @@ function toggleWorkspace() {
66488
66516
  sb.style.display = sb.style.display === 'none' ? 'block' : 'none';
66489
66517
  if (sb.style.display === 'block') loadWorkspaceTree();
66490
66518
  }
66491
- async function loadWorkspaceTree() {
66519
+ async function loadWorkspaceTree(dir) {
66520
+ const tree = document.getElementById('workspace-tree');
66492
66521
  try {
66493
- const r = await fetch('/v1/system', { headers: headers() });
66522
+ const r = await fetch('/v1/files' + (dir ? '?path=' + encodeURIComponent(dir) : ''), { headers: headers() });
66494
66523
  const d = await r.json();
66495
- document.getElementById('workspace-cwd').textContent = d.cwd || process.cwd?.() || '.';
66496
- } catch {}
66497
- // Placeholder tree \u2014 full implementation requires a directory listing endpoint
66498
- document.getElementById('workspace-tree').innerHTML =
66499
- '<div style="color:#555;font-size:0.65rem">File tree requires /v1/files endpoint (future WO)</div>';
66524
+ document.getElementById('workspace-cwd').textContent = d.path || '.';
66525
+ tree.innerHTML = d.entries.map(e => {
66526
+ const icon = e.type === 'dir' ? '\u{1F4C1}' : '\u{1F4C4}';
66527
+ const color = e.type === 'dir' ? '#b2920a' : '#b0b0b0';
66528
+ const click = e.type === 'dir'
66529
+ ? ' onclick="loadWorkspaceTree(\\'' + (d.path + '/' + e.name).replace(/'/g, "\\\\'") + '\\')"'
66530
+ : '';
66531
+ return '<div style="padding:1px 0;cursor:' + (e.type === 'dir' ? 'pointer' : 'default') + ';color:' + color + '"' + click + '>' + icon + ' ' + e.name + '</div>';
66532
+ }).join('');
66533
+ if (dir) {
66534
+ const parent = dir.split('/').slice(0, -1).join('/') || '/';
66535
+ tree.innerHTML = '<div style="padding:1px 0;cursor:pointer;color:#555" onclick="loadWorkspaceTree(\\'' + parent.replace(/'/g, "\\\\'") + '\\')">\u2B06 ..</div>' + tree.innerHTML;
66536
+ }
66537
+ } catch { tree.innerHTML = '<div style="color:#555">Could not load files</div>'; }
66500
66538
  }
66501
66539
 
66502
66540
  // Docker sandbox toggle
@@ -66535,9 +66573,13 @@ async function pollMetrics() {
66535
66573
  }
66536
66574
 
66537
66575
  function doUpdate() {
66538
- if (confirm('Update Open Agents to latest version? This will restart the server.')) {
66539
- fetch('/v1/commands/update', { method: 'POST', headers: headers() }).catch(() => {});
66540
- document.getElementById('update-btn').textContent = 'updating...';
66576
+ const latestVer = document.getElementById('update-btn').title?.match(/Latest: v([d.]+)/)?.[1] || 'latest';
66577
+ const cmd = 'npm install -g open-agents-ai@' + latestVer;
66578
+ if (confirm('Update available!\\n\\nRun this command in your terminal:\\n\\n' + cmd + '\\n\\nThen restart: oa serve')) {
66579
+ navigator.clipboard.writeText(cmd).then(() => {
66580
+ document.getElementById('update-btn').textContent = 'copied!';
66581
+ setTimeout(() => document.getElementById('update-btn').textContent = 'update v' + latestVer, 2000);
66582
+ }).catch(() => {});
66541
66583
  }
66542
66584
  }
66543
66585
 
@@ -68245,6 +68287,16 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
68245
68287
  return;
68246
68288
  }
68247
68289
  }
68290
+ if (pathname === "/v1/files" && method === "GET") {
68291
+ const dir = urlObj.searchParams.get("path") || process.cwd();
68292
+ try {
68293
+ const entries = readdirSync22(resolve31(dir), { withFileTypes: true }).filter((e) => !e.name.startsWith(".") && e.name !== "node_modules").slice(0, 100).map((e) => ({ name: e.name, type: e.isDirectory() ? "dir" : "file" }));
68294
+ jsonResponse(res, 200, { path: resolve31(dir), entries });
68295
+ } catch (e) {
68296
+ jsonResponse(res, 400, { error: e.message });
68297
+ }
68298
+ return;
68299
+ }
68248
68300
  if (pathname === "/v1/system" && method === "GET") {
68249
68301
  const os = __require("node:os");
68250
68302
  const version = getVersion3();
@@ -73961,7 +74013,8 @@ async function runJson(task, config, repoPath) {
73961
74013
  const cleanText = allCaptured.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").replace(/\x1B[78]/g, "").replace(/\x1B\[\?[0-9;]*[hl]/g, "");
73962
74014
  result.text = cleanText;
73963
74015
  if (assistantTexts.length > 0) {
73964
- result.assistant_text = assistantTexts.join("\n\n");
74016
+ const best = assistantTexts.reduce((a, b) => a.length >= b.length ? a : b, "");
74017
+ result.assistant_text = best;
73965
74018
  }
73966
74019
  if (toolCallLog.length > 0) {
73967
74020
  result.tool_calls = toolCallLog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.186.8",
3
+ "version": "0.186.9",
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",