loopengine 0.4.9 → 0.4.11
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.
|
@@ -210,6 +210,9 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
210
210
|
.wf-crit-rate { font-variant-numeric: tabular-nums; }
|
|
211
211
|
.wf-case-standins { margin: 0; font-size: 12.5px; color: var(--ink-muted); }
|
|
212
212
|
.wf-panel { min-width: 0; }
|
|
213
|
+
.wf-section { display: grid; gap: 10px; min-width: 0; }
|
|
214
|
+
.wf-panel > .wf-section + .wf-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
|
|
215
|
+
.wf-section .wf-sub { margin: 0; }
|
|
213
216
|
.wf-run-lines, .wf-cand-list, .wf-change-list { min-width: 0; }
|
|
214
217
|
.wf-run-line, .wf-run-link { min-width: 0; overflow: hidden; }
|
|
215
218
|
.wf-run-lines, .wf-cand-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
|
|
@@ -982,8 +985,9 @@ ${renderMarkdownScript}
|
|
|
982
985
|
// header and list. Every link to a workflow lands here.
|
|
983
986
|
var pageParams = new URLSearchParams(location.search);
|
|
984
987
|
var workflowPageId = pageParams.get('tab') === 'workflows' && pageParams.get('workflow') || null;
|
|
985
|
-
//
|
|
986
|
-
|
|
988
|
+
// Older tab names still open their tab: Evidence, Changes and Audit are
|
|
989
|
+
// Activity now, Improve is Evaluation.
|
|
990
|
+
var OLD_TABS = { evidence: 'activity', changes: 'activity', audit: 'activity', improve: 'evaluation' };
|
|
987
991
|
if (workflowPageId && pageParams.get('wtab')) workflowTabs[workflowPageId] = OLD_TABS[pageParams.get('wtab')] || pageParams.get('wtab');
|
|
988
992
|
// A case's page, with a back link to here.
|
|
989
993
|
function caseHref(runId) {
|
|
@@ -1140,7 +1144,7 @@ ${renderMarkdownScript}
|
|
|
1140
1144
|
'<details class="wf-health-more"><summary>By version of its instructions</summary><div class="wf-health-table"><table><thead><tr><th>Version</th><th>Runs</th><th>Failed</th><th>Approved</th><th>Changed or denied</th><th>Questions per run</th><th>Used unedited</th><th>Time</th><th>Cost per run</th></tr></thead><tbody>' + rows + '</tbody></table></div></details>';
|
|
1141
1145
|
}
|
|
1142
1146
|
|
|
1143
|
-
// The
|
|
1147
|
+
// The Activity tab's summary: the workflow's last 30 days in sentences, the
|
|
1144
1148
|
// same as the Audit page's.
|
|
1145
1149
|
function loadAuditSummary(card, base) {
|
|
1146
1150
|
var box = card.querySelector('.wf-audit-summary');
|
|
@@ -1151,7 +1155,7 @@ ${renderMarkdownScript}
|
|
|
1151
1155
|
.catch(function (err) { box.innerHTML = '<p class="error">Could not load its summary: ' + escapeHtml(err.message) + '</p>'; });
|
|
1152
1156
|
}
|
|
1153
1157
|
|
|
1154
|
-
// The
|
|
1158
|
+
// The Activity tab's latest few settings changes, with what changed.
|
|
1155
1159
|
function loadLatestChanges(card, name) {
|
|
1156
1160
|
var box = card.querySelector('.wf-changes-latest');
|
|
1157
1161
|
if (!box) return;
|
|
@@ -1395,22 +1399,23 @@ ${renderMarkdownScript}
|
|
|
1395
1399
|
}
|
|
1396
1400
|
var REFERENCE_CRIT = { id: 'reference', text: 'Matches the good result: the same facts and decisions', kind: 'reference' };
|
|
1397
1401
|
|
|
1398
|
-
// The
|
|
1402
|
+
// The Activity tab: what happened and whether it can be trusted. The same
|
|
1399
1403
|
// summary as the Audit page's, its health over 30 days, its latest runs
|
|
1400
1404
|
// and changes, and the way to the report and the full log.
|
|
1401
|
-
function
|
|
1405
|
+
function workflowActivityHtml(w, runsHtml, name) {
|
|
1402
1406
|
var auditHref = '/audit?agent=' + encodeURIComponent(name) + '&workflow=' + encodeURIComponent(w.id);
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
'<
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
(workflowPageId ? '<
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
//
|
|
1413
|
-
|
|
1407
|
+
var loading = '<p class="hint" style="margin:0">Loading' + String.fromCharCode(8230) + '</p>';
|
|
1408
|
+
return (workflowPageId ? '<section class="wf-section wf-audit-summary">' + loading + '</section>' : '') +
|
|
1409
|
+
(workflowPageId ? '<section class="wf-section wf-health">' + loading + '</section>' : '') +
|
|
1410
|
+
'<section class="wf-section"><h4 class="wf-sub">Latest runs</h4>' +
|
|
1411
|
+
(runsHtml ? '<ul class="wf-run-lines">' + runsHtml + '</ul>' : '<p class="hint" style="margin:0">No runs yet.</p>') + '</section>' +
|
|
1412
|
+
(workflowPageId ? '<section class="wf-section"><h4 class="wf-sub">Latest changes</h4><div class="wf-changes-latest">' + loading + '</div></section>' : '') +
|
|
1413
|
+
(workflowPageId ? '<section class="wf-section"><div class="wf-audit-tools"><a class="primary" href="/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(w.id) + '/audit/report">Open the report</a><a href="' + auditHref + '">See everything in Audit ' + String.fromCharCode(8594) + '</a></div></section>' : '');
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// The Evaluation tab: the checklist, the eval cases (saved, then
|
|
1417
|
+
// suggested from real runs), and Evaluate.
|
|
1418
|
+
function workflowEvaluationHtml(w) {
|
|
1414
1419
|
var evals = w.evals || { cases: [], criteria: [], rounds: [] };
|
|
1415
1420
|
var criteria = evals.criteria && evals.criteria.length ? evals.criteria : [REFERENCE_CRIT];
|
|
1416
1421
|
var round = evals.rounds[0];
|
|
@@ -1470,14 +1475,14 @@ ${renderMarkdownScript}
|
|
|
1470
1475
|
: '<p class="wf-eval-last"><strong>Last evaluation: ' + escapeHtml(new Date(round.at).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })) + (round.briefVersion ? ', version ' + round.briefVersion + ' of its instructions' : '') + '</strong>' +
|
|
1471
1476
|
(checked ? String.fromCharCode(8212) + ' ' + round.allPassed + ' of ' + round.cases.length + ' cases passed every checklist item.' : '') +
|
|
1472
1477
|
' <details class="wf-eval-details"><summary>Details</summary>Ran with ' + escapeHtml(round.model) + DOT + 'judged by ' + escapeHtml(round.judge) + DOT + escapeHtml(new Date(round.at).toLocaleString()) + '</details></p>';
|
|
1473
|
-
return critSection +
|
|
1474
|
-
'<h4 class="wf-sub">Eval cases' + (evals.cases.length ? ' (' + evals.cases.length + ')' : '') + '</h4>' +
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1478
|
+
return '<section class="wf-section">' + critSection + '</section>' +
|
|
1479
|
+
'<section class="wf-section"><h4 class="wf-sub">Eval cases' + (evals.cases.length ? ' (' + evals.cases.length + ')' : '') + '</h4>' +
|
|
1480
|
+
'<p class="hint" style="margin:0">Real runs saved to check every change against.</p>' +
|
|
1481
|
+
(cases ? '<ul class="wf-cases">' + cases + '</ul>' : '<p class="hint" style="margin:0">None yet: add suggested ones below, or save any run from its case page.</p>') +
|
|
1482
|
+
'<div class="wf-evals-bar"><button type="button" class="wf-evals-run"' + (!evals.cases.length || running ? ' disabled' : '') + '>' + (running ? 'Evaluating ' + running.done + ' of ' + running.total + String.fromCharCode(8230) : 'Evaluate') + '</button>' +
|
|
1483
|
+
'<span class="hint">Runs every eval case again with the current instructions and checks each result against the checklist. Nothing is sent, refunded or submitted.</span></div>' +
|
|
1484
|
+
lastLine + '</section>' +
|
|
1485
|
+
(workflowPageId ? '<section class="wf-section"><h4 class="wf-sub">Suggested eval cases</h4><div class="wf-candidates"><p class="hint" style="margin:0">Looking through its runs' + String.fromCharCode(8230) + '</p></div></section>' : '');
|
|
1481
1486
|
}
|
|
1482
1487
|
|
|
1483
1488
|
// Worth testing: runs from the last 30 days that would make good eval
|
|
@@ -1492,12 +1497,12 @@ ${renderMarkdownScript}
|
|
|
1492
1497
|
.then(function (data) {
|
|
1493
1498
|
var list = data.candidates || [];
|
|
1494
1499
|
if (!list.length) { box.innerHTML = '<p class="hint" style="margin:0">Nothing new to suggest from the last 30 days.</p>'; return; }
|
|
1495
|
-
box.innerHTML = '<p class="hint" style="margin:0 0 6px">
|
|
1500
|
+
box.innerHTML = '<p class="hint" style="margin:0 0 6px">Runs from the last 30 days worth adding, best first: where a person denied or changed what it did, a bad result, a question it asked, or a typical good run. Open one to read it in full first.</p><ul class="wf-cand-list">' + list.map(function (c) {
|
|
1496
1501
|
var why = WHY[c.why] || ['', c.why];
|
|
1497
1502
|
return '<li><span class="le-pill ' + why[0] + '">' + why[1] + '</span>' +
|
|
1498
1503
|
'<span class="wf-cand-text"><strong>' + escapeHtml(c.detail) + '</strong><span class="hint">' + escapeHtml(new Date(c.at).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })) + (c.inputs ? DOT + escapeHtml(c.inputs) : '') + '</span></span>' +
|
|
1499
1504
|
'<a class="wf-link" href="' + caseHref(c.runId) + '">Open</a>' +
|
|
1500
|
-
'<button type="button" class="wf-link wf-save-case" data-run="' + escapeHtml(c.runId) + '">
|
|
1505
|
+
'<button type="button" class="wf-link wf-save-case" data-run="' + escapeHtml(c.runId) + '">Add as eval case</button></li>';
|
|
1501
1506
|
}).join('') + '</ul>';
|
|
1502
1507
|
})
|
|
1503
1508
|
.catch(function (err) { box.innerHTML = '<p class="error">Could not look through its runs: ' + escapeHtml(err.message) + '</p>'; });
|
|
@@ -1576,10 +1581,10 @@ ${renderMarkdownScript}
|
|
|
1576
1581
|
'</div>' +
|
|
1577
1582
|
'</header>' +
|
|
1578
1583
|
'<div class="wf-row-body wf-page-body">' +
|
|
1579
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('
|
|
1584
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('activity', 'Activity') + tabBtn('evaluation', 'Evaluation') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messages') + tabBtn('contract', 'Contract') + '</div>' +
|
|
1580
1585
|
panel('brief', workflowBriefHtml(w)) +
|
|
1581
|
-
panel('
|
|
1582
|
-
panel('
|
|
1586
|
+
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
1587
|
+
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
1583
1588
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
1584
1589
|
panel('messages', workflowMessagesHtml(w, name)) +
|
|
1585
1590
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
@@ -1601,13 +1606,13 @@ ${renderMarkdownScript}
|
|
|
1601
1606
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
1602
1607
|
// What it does, in full, once it's open (the row shows just its name).
|
|
1603
1608
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
1604
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('
|
|
1609
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('activity', 'Activity') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messages') + '</div>' +
|
|
1605
1610
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
1606
1611
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
1607
1612
|
panel('messages', workflowMessagesHtml(w, name)) +
|
|
1608
1613
|
panel('brief', workflowBriefHtml(w)) +
|
|
1609
|
-
panel('
|
|
1610
|
-
panel('
|
|
1614
|
+
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
1615
|
+
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
1611
1616
|
'<div class="hint workflow-result"></div>' +
|
|
1612
1617
|
'<div class="wf-row-foot"><span class="hint">Skill <code>' + escapeHtml(w.id) + '</code></span><button type="button" class="wf-remove workflow-forget" title="Its schedules and webhooks go; its instructions stay as a skill for Chat">Remove</button></div>' +
|
|
1613
1618
|
'</div>' +
|
|
@@ -2333,7 +2338,7 @@ ${renderMarkdownScript}
|
|
|
2333
2338
|
}
|
|
2334
2339
|
if (cbtn.classList.contains('wf-crit-add')) { rows.insertAdjacentHTML('beforeend', critRowHtml({ kind: 'judge' })); return; }
|
|
2335
2340
|
if (cbtn.classList.contains('wf-crit-remove')) { cbtn.closest('.wf-crit-row').remove(); return; }
|
|
2336
|
-
if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = '
|
|
2341
|
+
if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = 'evaluation'; loadWorkflowsSection(name); return; }
|
|
2337
2342
|
cbtn.disabled = true;
|
|
2338
2343
|
if (cbtn.classList.contains('wf-crit-draft')) {
|
|
2339
2344
|
critStatus.textContent = 'Drafting from the brief' + String.fromCharCode(8230);
|
|
@@ -2351,7 +2356,7 @@ ${renderMarkdownScript}
|
|
|
2351
2356
|
fetchJsonRetryOnce(base + '/evals/criteria', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ criteria: list }) }).then(function (r) {
|
|
2352
2357
|
cbtn.disabled = false;
|
|
2353
2358
|
if (!r.ok) { critStatus.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't save.'; return; }
|
|
2354
|
-
workflowTabs[id] = '
|
|
2359
|
+
workflowTabs[id] = 'evaluation';
|
|
2355
2360
|
loadWorkflowsSection(name);
|
|
2356
2361
|
});
|
|
2357
2362
|
});
|
|
@@ -2371,7 +2376,7 @@ ${renderMarkdownScript}
|
|
|
2371
2376
|
if (request[1].body) opts.body = JSON.stringify(request[1].body);
|
|
2372
2377
|
fetchJsonRetryOnce(request[0], opts).then(function (r) {
|
|
2373
2378
|
if (!r.ok) { btn.disabled = false; result.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't work.'; return; }
|
|
2374
|
-
workflowTabs[id] = '
|
|
2379
|
+
workflowTabs[id] = 'evaluation';
|
|
2375
2380
|
loadWorkflowsSection(name);
|
|
2376
2381
|
});
|
|
2377
2382
|
});
|
package/dist/web/audit-page.js
CHANGED
|
@@ -201,7 +201,7 @@ ${consoleShellScript}
|
|
|
201
201
|
function eventLink(e) {
|
|
202
202
|
var d = e.data || {};
|
|
203
203
|
if (e.run_id) return { href: '/cases/' + encodeURIComponent(e.run_id) + '?back=' + encodeURIComponent(location.pathname + location.search), text: 'Case' };
|
|
204
|
-
if (e.workflow_id) return { href: workflowHref(e.agent, e.workflow_id, /brief version/i.test(d.label || '') || /Edited the workflow/.test(d.label || '') ? 'brief' : '
|
|
204
|
+
if (e.workflow_id) return { href: workflowHref(e.agent, e.workflow_id, /brief version/i.test(d.label || '') || /Edited the workflow/.test(d.label || '') ? 'brief' : 'activity'), text: 'Workflow' };
|
|
205
205
|
if (e.agent) return { href: '/agents/config?agent=' + encodeURIComponent(e.agent), text: 'Agent' };
|
|
206
206
|
var path = String(d.path || '');
|
|
207
207
|
if (path.indexOf('/config/models') === 0) return { href: '/config?section=models', text: 'Models' };
|
package/dist/web/inbox-page.js
CHANGED
|
@@ -417,7 +417,7 @@ ${renderMarkdownScript}
|
|
|
417
417
|
.then(function (r) { return r.json().then(function (b) { if (!r.ok) throw new Error(b.error || 'Could not save'); return b; }); })
|
|
418
418
|
.then(function (b) {
|
|
419
419
|
btn.textContent = 'Saved as an eval case';
|
|
420
|
-
result.innerHTML = 'Saved. <a class="ib-link" href="/agents/config?agent=' + encodeURIComponent(c.agent) + '&tab=workflows&workflow=' + encodeURIComponent(c.workflowId) + '&wtab=
|
|
420
|
+
result.innerHTML = 'Saved. <a class="ib-link" href="/agents/config?agent=' + encodeURIComponent(c.agent) + '&tab=workflows&workflow=' + encodeURIComponent(c.workflowId) + '&wtab=evaluation">See its eval cases</a>';
|
|
421
421
|
showSuggestions(c, b.suggestions || [], b.criteria || []);
|
|
422
422
|
})
|
|
423
423
|
.catch(function (err) { btn.disabled = false; result.textContent = err.message; });
|