open-agents-ai 0.186.7 → 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.
- package/dist/index.js +85 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26341,6 +26341,7 @@ TASK: ${task}` : task;
|
|
|
26341
26341
|
let summary = "";
|
|
26342
26342
|
let bruteForceCycle = 0;
|
|
26343
26343
|
this._assistantTextEmitted = false;
|
|
26344
|
+
let pendingConstraintWarnings = [];
|
|
26344
26345
|
let consecutiveTextOnly = 0;
|
|
26345
26346
|
const MAX_CONSECUTIVE_TEXT_ONLY = 3;
|
|
26346
26347
|
let narratedToolCallCount = 0;
|
|
@@ -26358,6 +26359,11 @@ TASK: ${task}` : task;
|
|
|
26358
26359
|
this.emit({ type: "error", content: "Task aborted by user", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
26359
26360
|
break;
|
|
26360
26361
|
}
|
|
26362
|
+
if (pendingConstraintWarnings.length > 0) {
|
|
26363
|
+
const warningMsg = "<constraint-recall>\n" + pendingConstraintWarnings.join("\n") + "\n</constraint-recall>";
|
|
26364
|
+
messages.push({ role: "system", content: warningMsg });
|
|
26365
|
+
pendingConstraintWarnings = [];
|
|
26366
|
+
}
|
|
26361
26367
|
const now = Date.now();
|
|
26362
26368
|
if (now > nextSelfEval) {
|
|
26363
26369
|
selfEvalCount++;
|
|
@@ -26816,7 +26822,9 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
26816
26822
|
} else {
|
|
26817
26823
|
const warnViolations = violations.filter((v) => v.constraint.action === "warn");
|
|
26818
26824
|
if (warnViolations.length > 0) {
|
|
26819
|
-
|
|
26825
|
+
const warning = formatViolationWarning(warnViolations);
|
|
26826
|
+
this.emit({ type: "status", content: `\u26A0\uFE0F ${warning}`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
26827
|
+
pendingConstraintWarnings.push(warning);
|
|
26820
26828
|
}
|
|
26821
26829
|
try {
|
|
26822
26830
|
result = await tool.execute(tc.arguments);
|
|
@@ -29313,6 +29321,13 @@ ${description}`
|
|
|
29313
29321
|
}
|
|
29314
29322
|
});
|
|
29315
29323
|
|
|
29324
|
+
// packages/orchestrator/dist/constraint-learner.js
|
|
29325
|
+
var init_constraint_learner = __esm({
|
|
29326
|
+
"packages/orchestrator/dist/constraint-learner.js"() {
|
|
29327
|
+
"use strict";
|
|
29328
|
+
}
|
|
29329
|
+
});
|
|
29330
|
+
|
|
29316
29331
|
// packages/orchestrator/dist/nexusBackend.js
|
|
29317
29332
|
import { existsSync as existsSync32, statSync as statSync10, openSync, readSync, closeSync, unlinkSync as unlinkSync5, writeFileSync as writeFileSync12 } from "node:fs";
|
|
29318
29333
|
import { watch as fsWatch } from "node:fs";
|
|
@@ -30480,6 +30495,7 @@ var init_dist5 = __esm({
|
|
|
30480
30495
|
init_retryController();
|
|
30481
30496
|
init_agenticRunner();
|
|
30482
30497
|
init_pressure_gate();
|
|
30498
|
+
init_constraint_learner();
|
|
30483
30499
|
init_nexusBackend();
|
|
30484
30500
|
init_cascadeBackend();
|
|
30485
30501
|
init_flowstatePrompt();
|
|
@@ -65996,9 +66012,11 @@ async function sendMessage() {
|
|
|
65996
66012
|
}
|
|
65997
66013
|
}
|
|
65998
66014
|
|
|
65999
|
-
|
|
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);
|
|
66000
66018
|
updateTokenCounter(fullContent.split(/\\s+/).length * 1.3 | 0);
|
|
66001
|
-
saveSessions();
|
|
66019
|
+
saveSessions();
|
|
66002
66020
|
|
|
66003
66021
|
// Final render: content + collapsible tools + metadata
|
|
66004
66022
|
contentDiv.innerHTML = renderMarkdown(fullContent);
|
|
@@ -66443,11 +66461,37 @@ function switchSession(id) {
|
|
|
66443
66461
|
if (s) {
|
|
66444
66462
|
chatSessionId = id;
|
|
66445
66463
|
messages = s.messages || [];
|
|
66446
|
-
// Re-render messages
|
|
66447
66464
|
const conv = document.getElementById('conversation');
|
|
66448
66465
|
conv.innerHTML = '';
|
|
66449
66466
|
for (const m of messages) {
|
|
66450
|
-
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
|
+
}
|
|
66451
66495
|
}
|
|
66452
66496
|
}
|
|
66453
66497
|
}
|
|
@@ -66472,15 +66516,25 @@ function toggleWorkspace() {
|
|
|
66472
66516
|
sb.style.display = sb.style.display === 'none' ? 'block' : 'none';
|
|
66473
66517
|
if (sb.style.display === 'block') loadWorkspaceTree();
|
|
66474
66518
|
}
|
|
66475
|
-
async function loadWorkspaceTree() {
|
|
66519
|
+
async function loadWorkspaceTree(dir) {
|
|
66520
|
+
const tree = document.getElementById('workspace-tree');
|
|
66476
66521
|
try {
|
|
66477
|
-
const r = await fetch('/v1/
|
|
66522
|
+
const r = await fetch('/v1/files' + (dir ? '?path=' + encodeURIComponent(dir) : ''), { headers: headers() });
|
|
66478
66523
|
const d = await r.json();
|
|
66479
|
-
document.getElementById('workspace-cwd').textContent = d.
|
|
66480
|
-
|
|
66481
|
-
|
|
66482
|
-
|
|
66483
|
-
|
|
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>'; }
|
|
66484
66538
|
}
|
|
66485
66539
|
|
|
66486
66540
|
// Docker sandbox toggle
|
|
@@ -66519,9 +66573,13 @@ async function pollMetrics() {
|
|
|
66519
66573
|
}
|
|
66520
66574
|
|
|
66521
66575
|
function doUpdate() {
|
|
66522
|
-
|
|
66523
|
-
|
|
66524
|
-
|
|
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(() => {});
|
|
66525
66583
|
}
|
|
66526
66584
|
}
|
|
66527
66585
|
|
|
@@ -68229,6 +68287,16 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
|
|
|
68229
68287
|
return;
|
|
68230
68288
|
}
|
|
68231
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
|
+
}
|
|
68232
68300
|
if (pathname === "/v1/system" && method === "GET") {
|
|
68233
68301
|
const os = __require("node:os");
|
|
68234
68302
|
const version = getVersion3();
|
|
@@ -73945,7 +74013,8 @@ async function runJson(task, config, repoPath) {
|
|
|
73945
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, "");
|
|
73946
74014
|
result.text = cleanText;
|
|
73947
74015
|
if (assistantTexts.length > 0) {
|
|
73948
|
-
|
|
74016
|
+
const best = assistantTexts.reduce((a, b) => a.length >= b.length ? a : b, "");
|
|
74017
|
+
result.assistant_text = best;
|
|
73949
74018
|
}
|
|
73950
74019
|
if (toolCallLog.length > 0) {
|
|
73951
74020
|
result.tool_calls = toolCallLog;
|
package/package.json
CHANGED