loopengine 0.4.8 → 0.4.10
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.
|
@@ -209,6 +209,12 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
209
209
|
.wf-crit-kind { font-size: 12px; color: var(--ink-muted); }
|
|
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
|
+
.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; }
|
|
216
|
+
.wf-run-lines, .wf-cand-list, .wf-change-list { min-width: 0; }
|
|
217
|
+
.wf-run-line, .wf-run-link { min-width: 0; overflow: hidden; }
|
|
212
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; }
|
|
213
219
|
.wf-run-line, .wf-cand-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; }
|
|
214
220
|
.wf-run-line:first-child, .wf-cand-list li:first-child { border-top: 0; }
|
|
@@ -228,8 +234,16 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
228
234
|
.wf-health-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
|
|
229
235
|
.wf-health-table th { text-align: left; font-weight: 600; color: var(--ink-muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
|
|
230
236
|
.wf-health-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
|
|
231
|
-
.wf-audit-
|
|
232
|
-
.wf-audit-
|
|
237
|
+
.wf-audit-summary ul.wf-audit-lines { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.5; }
|
|
238
|
+
.wf-audit-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
|
|
239
|
+
.wf-audit-tools a { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
|
|
240
|
+
.wf-audit-tools a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
|
|
241
|
+
.wf-health-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
|
|
242
|
+
.wf-health-more .wf-health-table { margin-top: 8px; }
|
|
243
|
+
.wf-sub-sub { font-size: 12px; font-weight: 700; color: var(--ink-muted); margin-top: 6px; }
|
|
244
|
+
.wf-eval-last { margin: 0; font-size: 13px; }
|
|
245
|
+
.wf-eval-details { display: inline; }
|
|
246
|
+
.wf-eval-details summary { display: inline; cursor: pointer; color: var(--accent-ink); font-size: 12.5px; }
|
|
233
247
|
.chg { display: grid; gap: 6px; margin-top: 4px; font-size: 12.5px; flex-basis: 100%; }
|
|
234
248
|
.chg-field del { color: var(--bad); }
|
|
235
249
|
.chg-field ins { color: var(--good); text-decoration: none; }
|
|
@@ -971,7 +985,9 @@ ${renderMarkdownScript}
|
|
|
971
985
|
// header and list. Every link to a workflow lands here.
|
|
972
986
|
var pageParams = new URLSearchParams(location.search);
|
|
973
987
|
var workflowPageId = pageParams.get('tab') === 'workflows' && pageParams.get('workflow') || null;
|
|
974
|
-
|
|
988
|
+
// Evidence and Changes became Audit and Improve: old links still open.
|
|
989
|
+
var OLD_TABS = { evidence: 'audit', changes: 'audit' };
|
|
990
|
+
if (workflowPageId && pageParams.get('wtab')) workflowTabs[workflowPageId] = OLD_TABS[pageParams.get('wtab')] || pageParams.get('wtab');
|
|
975
991
|
// A case's page, with a back link to here.
|
|
976
992
|
function caseHref(runId) {
|
|
977
993
|
return '/cases/' + encodeURIComponent(runId) + '?back=' + encodeURIComponent(location.pathname + location.search);
|
|
@@ -1065,7 +1081,6 @@ ${renderMarkdownScript}
|
|
|
1065
1081
|
for (var i = 0; i < tabs.length; i++) tabs[i].setAttribute('aria-selected', String(tabs[i].dataset.tab === key));
|
|
1066
1082
|
var panels = card.querySelectorAll('.wf-panel');
|
|
1067
1083
|
for (var j = 0; j < panels.length; j++) panels[j].hidden = panels[j].dataset.panel !== key;
|
|
1068
|
-
if (key === 'changes') loadWorkflowChanges(card);
|
|
1069
1084
|
}
|
|
1070
1085
|
|
|
1071
1086
|
// The Health panel: the last 30 days of runs, as totals, day by day and
|
|
@@ -1075,7 +1090,7 @@ ${renderMarkdownScript}
|
|
|
1075
1090
|
if (!box) return;
|
|
1076
1091
|
fetch(base + '/health', { headers: { accept: 'application/json' } })
|
|
1077
1092
|
.then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
|
|
1078
|
-
.then(function (h) { box.innerHTML = '<h4 class="wf-sub">
|
|
1093
|
+
.then(function (h) { box.innerHTML = '<h4 class="wf-sub">At a glance</h4>' + workflowHealthHtml(h); })
|
|
1079
1094
|
.catch(function (err) { box.innerHTML = '<h4 class="wf-sub">Health</h4><p class="error">Could not load it: ' + escapeHtml(err.message) + '</p>'; });
|
|
1080
1095
|
}
|
|
1081
1096
|
|
|
@@ -1121,26 +1136,36 @@ ${renderMarkdownScript}
|
|
|
1121
1136
|
'</div>';
|
|
1122
1137
|
var rows = h.versions.map(function (v) {
|
|
1123
1138
|
var d = v.approved + v.denied;
|
|
1124
|
-
return '<tr><td>' + (v.version == null ? '<span class="hint">before versions</span>' : '
|
|
1139
|
+
return '<tr><td>' + (v.version == null ? '<span class="hint">before versions</span>' : 'Version ' + v.version) + '</td><td>' + v.runs + '</td><td>' + healthPct(v.failed, v.finished) + '</td><td>' + healthPct(v.approved, d) + '</td><td>' + healthPct(v.changed + v.denied, d) + '</td>' +
|
|
1125
1140
|
'<td>' + (v.runs ? (v.questions / v.runs).toFixed(1) : '0') + '</td><td>' + (v.feedback ? healthPct(v.unedited, v.feedback) : String.fromCharCode(8212)) + '</td><td>' + healthTime(v.medianMs) + '</td><td>' + healthCost(v.costPerRunUsd) + '</td></tr>';
|
|
1126
1141
|
}).join('');
|
|
1127
1142
|
return alerts + stats + healthChartHtml(h.daily) +
|
|
1128
|
-
'<div class="wf-health-table"><table><thead><tr><th>
|
|
1143
|
+
'<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>';
|
|
1129
1144
|
}
|
|
1130
1145
|
|
|
1131
|
-
// The
|
|
1132
|
-
//
|
|
1133
|
-
function
|
|
1134
|
-
var box = card.querySelector('.wf-
|
|
1135
|
-
if (!box
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1146
|
+
// The Audit tab's summary: the workflow's last 30 days in sentences, the
|
|
1147
|
+
// same as the Audit page's.
|
|
1148
|
+
function loadAuditSummary(card, base) {
|
|
1149
|
+
var box = card.querySelector('.wf-audit-summary');
|
|
1150
|
+
if (!box) return;
|
|
1151
|
+
fetch(base + '/audit', { headers: { accept: 'application/json' } })
|
|
1152
|
+
.then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
|
|
1153
|
+
.then(function (a) { box.innerHTML = '<h4 class="wf-sub">In the last 30 days</h4><ul class="wf-audit-lines">' + a.summary.map(function (line) { return '<li>' + escapeHtml(line) + '</li>'; }).join('') + '</ul>'; })
|
|
1154
|
+
.catch(function (err) { box.innerHTML = '<p class="error">Could not load its summary: ' + escapeHtml(err.message) + '</p>'; });
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// The Audit tab's latest few settings changes, with what changed.
|
|
1158
|
+
function loadLatestChanges(card, name) {
|
|
1159
|
+
var box = card.querySelector('.wf-changes-latest');
|
|
1160
|
+
if (!box) return;
|
|
1161
|
+
fetch('/audit?agent=' + encodeURIComponent(name) + '&workflow=' + encodeURIComponent(card.dataset.workflow) + '&kind=change&limit=3', { headers: { accept: 'application/json' } })
|
|
1139
1162
|
.then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
|
|
1140
|
-
.then(function (data) { box.innerHTML =
|
|
1141
|
-
.catch(function (err) { box.
|
|
1163
|
+
.then(function (data) { box.innerHTML = (data.events || []).length ? workflowChangesHtml(data.events) : '<p class="hint" style="margin:0">No settings changed yet.</p>'; })
|
|
1164
|
+
.catch(function (err) { box.innerHTML = '<p class="error">Could not load its changes: ' + escapeHtml(err.message) + '</p>'; });
|
|
1142
1165
|
}
|
|
1143
1166
|
|
|
1167
|
+
// A list of changes (and decisions): every change to this workflow's settings, and every
|
|
1168
|
+
// decision, answer and feedback in its runs, newest first, with who.
|
|
1144
1169
|
function changeText(e) {
|
|
1145
1170
|
var d = e.data || {};
|
|
1146
1171
|
if (e.kind === 'change') return escapeHtml(d.label || 'Changed a setting');
|
|
@@ -1349,10 +1374,6 @@ ${renderMarkdownScript}
|
|
|
1349
1374
|
(w.originalRequest ? '<details class="wf-original"><summary>Original message</summary><div class="workflow-steps-text">' + escapeHtml(w.originalRequest) + '</div></details>' : '');
|
|
1350
1375
|
}
|
|
1351
1376
|
|
|
1352
|
-
function scoreTileHtml(label, value, detail) {
|
|
1353
|
-
return '<div class="wf-score"><span class="wf-score-k">' + label + '</span><strong class="wf-score-v">' + value + '</strong>' + (detail ? '<span class="hint">' + detail + '</span>' : '') + '</div>';
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
1377
|
// A criterion's kind, in words, for its row and its editor.
|
|
1357
1378
|
var CRIT_KINDS = [
|
|
1358
1379
|
['judge', 'Judge decides'],
|
|
@@ -1363,6 +1384,7 @@ ${renderMarkdownScript}
|
|
|
1363
1384
|
['reference', 'Matches the good result'],
|
|
1364
1385
|
];
|
|
1365
1386
|
function critKindText(c) {
|
|
1387
|
+
if (c.kind === 'reference') return 'Checked against each eval case' + RSQ + 's saved good result';
|
|
1366
1388
|
var label = (CRIT_KINDS.filter(function (k) { return k[0] === c.kind; })[0] || CRIT_KINDS[0])[1];
|
|
1367
1389
|
return c.value ? label + ' ' + String.fromCharCode(8220) + c.value + String.fromCharCode(8221) : label;
|
|
1368
1390
|
}
|
|
@@ -1376,23 +1398,27 @@ ${renderMarkdownScript}
|
|
|
1376
1398
|
}
|
|
1377
1399
|
var REFERENCE_CRIT = { id: 'reference', text: 'Matches the good result: the same facts and decisions', kind: 'reference' };
|
|
1378
1400
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1401
|
+
// The Audit tab: what happened and whether it can be trusted. The same
|
|
1402
|
+
// summary as the Audit page's, its health over 30 days, its latest runs
|
|
1403
|
+
// and changes, and the way to the report and the full log.
|
|
1404
|
+
function workflowAuditHtml(w, runsHtml, name) {
|
|
1405
|
+
var auditHref = '/audit?agent=' + encodeURIComponent(name) + '&workflow=' + encodeURIComponent(w.id);
|
|
1406
|
+
var loading = '<p class="hint" style="margin:0">Loading' + String.fromCharCode(8230) + '</p>';
|
|
1407
|
+
return (workflowPageId ? '<section class="wf-section wf-audit-summary">' + loading + '</section>' : '') +
|
|
1408
|
+
(workflowPageId ? '<section class="wf-section wf-health">' + loading + '</section>' : '') +
|
|
1409
|
+
'<section class="wf-section"><h4 class="wf-sub">Latest runs</h4>' +
|
|
1410
|
+
(runsHtml ? '<ul class="wf-run-lines">' + runsHtml + '</ul>' : '<p class="hint" style="margin:0">No runs yet.</p>') + '</section>' +
|
|
1411
|
+
(workflowPageId ? '<section class="wf-section"><h4 class="wf-sub">Latest changes</h4><div class="wf-changes-latest">' + loading + '</div></section>' : '') +
|
|
1412
|
+
(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>' : '');
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// The Improve tab: the checklist, the eval cases (suggested from real
|
|
1416
|
+
// runs, and saved), and Evaluate.
|
|
1417
|
+
function workflowImproveHtml(w) {
|
|
1381
1418
|
var evals = w.evals || { cases: [], criteria: [], rounds: [] };
|
|
1382
1419
|
var criteria = evals.criteria && evals.criteria.length ? evals.criteria : [REFERENCE_CRIT];
|
|
1383
1420
|
var round = evals.rounds[0];
|
|
1384
1421
|
var checked = round && round.passRates;
|
|
1385
|
-
var decided = s.approvals.approved + s.approvals.refused;
|
|
1386
|
-
var f = s.feedback;
|
|
1387
|
-
var evalsValue = !round ? String.fromCharCode(8212) : checked ? round.allPassed + ' / ' + round.cases.length : typeof round.average === 'number' ? round.average.toFixed(1) + ' / 5' : String.fromCharCode(8212);
|
|
1388
|
-
var evalsDetail = !round ? (evals.cases.length ? 'not run yet' : 'no cases yet') : (checked ? 'passed every check' + DOT : '') + new Date(round.at).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
|
|
1389
|
-
var tiles = '<div class="wf-scores">' +
|
|
1390
|
-
scoreTileHtml('Runs', String(s.runs), s.runs ? s.done + ' done' + DOT + s.failed + ' failed' : 'none yet') +
|
|
1391
|
-
scoreTileHtml('Approvals', decided ? Math.round(100 * s.approvals.approved / decided) + '%' : String.fromCharCode(8212), decided ? s.approvals.approved + ' approved' + DOT + s.approvals.refused + ' refused' : 'none asked yet') +
|
|
1392
|
-
scoreTileHtml('Feedback', f.count ? String(f.count) : String.fromCharCode(8212), f.count ? (f.good + f.bad ? f.good + ' good' + DOT + f.bad + ' bad' + DOT : '') + f.edits.none + ' unedited' + DOT + f.edits.light + ' light' + DOT + f.edits.heavy + ' heavy edits' : 'none reported yet') +
|
|
1393
|
-
scoreTileHtml('Evals', evalsValue, evalsDetail) +
|
|
1394
|
-
'</div>';
|
|
1395
|
-
var feedbackHint = f.count ? '' : '<p class="hint" style="margin:0">An app reports what happened to a result with <code>POST /agents/' + escapeHtml(currentName || '') + '/runs/<runId>/feedback</code> and <code>{"final": "the text it sent"}</code> or <code>{"verdict": "good"}</code>.</p>';
|
|
1396
1422
|
// Each criterion, with how often the latest round passed it.
|
|
1397
1423
|
var rateOf = {};
|
|
1398
1424
|
(checked ? round.passRates : []).forEach(function (r) { rateOf[r.criterionId] = r; });
|
|
@@ -1401,16 +1427,16 @@ ${renderMarkdownScript}
|
|
|
1401
1427
|
var pill = !r || !r.total ? '' : '<span class="le-pill ' + (r.passed === r.total ? 'good' : r.passed * 2 >= r.total ? 'ask' : 'bad') + ' wf-crit-rate">' + r.passed + ' / ' + r.total + '</span>';
|
|
1402
1428
|
return '<li class="wf-crit"><span><strong>' + escapeHtml(c.text) + '</strong><br><span class="wf-crit-kind">' + escapeHtml(critKindText(c)) + '</span></span>' + pill + '</li>';
|
|
1403
1429
|
}).join('');
|
|
1404
|
-
var critSection = '<h4 class="wf-sub">
|
|
1430
|
+
var critSection = '<h4 class="wf-sub">Checklist</h4>' +
|
|
1405
1431
|
'<p class="hint" style="margin:0">' + (evals.criteria && evals.criteria.length
|
|
1406
|
-
? '
|
|
1407
|
-
: '
|
|
1432
|
+
? 'What every good result must get right. Each eval case is checked against every item, yes or no.'
|
|
1433
|
+
: 'What every good result must get right. Nothing on it yet, so each eval case is only compared with its good result. Add the items that matter, or have them suggested from its instructions.') + '</p>' +
|
|
1408
1434
|
'<ul class="wf-crits">' + critList + '</ul>' +
|
|
1409
|
-
'<div class="wf-crit-bar"><button type="button" class="wf-crit-edit">' + (evals.criteria && evals.criteria.length ? 'Edit
|
|
1435
|
+
'<div class="wf-crit-bar"><button type="button" class="wf-crit-edit">' + (evals.criteria && evals.criteria.length ? 'Edit the checklist' : 'Add to the checklist') + '</button></div>' +
|
|
1410
1436
|
'<div class="wf-crit-form" hidden>' +
|
|
1411
1437
|
'<div class="wf-crit-rows">' + (evals.criteria && evals.criteria.length ? evals.criteria : []).map(critRowHtml).join('') + '</div>' +
|
|
1412
|
-
'<div class="wf-crit-bar"><button type="button" class="plain wf-crit-add">+ Add
|
|
1413
|
-
'<span style="flex:1"></span><button type="button" class="plain wf-crit-cancel">Cancel</button><button type="button" class="wf-crit-save">Save
|
|
1438
|
+
'<div class="wf-crit-bar"><button type="button" class="plain wf-crit-add">+ Add an item</button><button type="button" class="plain wf-crit-draft">Suggest from its instructions</button>' +
|
|
1439
|
+
'<span style="flex:1"></span><button type="button" class="plain wf-crit-cancel">Cancel</button><button type="button" class="wf-crit-save">Save the checklist</button></div>' +
|
|
1414
1440
|
'<span class="hint wf-crit-status"></span>' +
|
|
1415
1441
|
'</div>';
|
|
1416
1442
|
var latest = {};
|
|
@@ -1423,7 +1449,7 @@ ${renderMarkdownScript}
|
|
|
1423
1449
|
var values = Object.keys(c.params || {}).map(function (k) { var v = String(c.params[k]); return escapeHtml(k) + ': ' + escapeHtml(v.length > 60 ? v.slice(0, 60) + String.fromCharCode(8230) : v); }).join(DOT);
|
|
1424
1450
|
var fails = last && last.checks ? last.checks.filter(function (x) { return !x.pass; }) : [];
|
|
1425
1451
|
var pill = !last ? ''
|
|
1426
|
-
: last.checks ? (fails.length ? '<span class="le-pill bad">' + fails.length + ' of ' + last.checks.length + '
|
|
1452
|
+
: last.checks ? (fails.length ? '<span class="le-pill bad">' + fails.length + ' of ' + last.checks.length + ' items missed</span>' : '<span class="le-pill good">Passed all ' + last.checks.length + '</span>')
|
|
1427
1453
|
: typeof last.score === 'number' ? '<span class="le-pill ' + (last.score >= 4 ? 'good' : last.score === 3 ? 'ask' : 'bad') + '">' + last.score + ' / 5</span>' : '<span class="le-pill bad">Not scored</span>';
|
|
1428
1454
|
var why = !last ? ''
|
|
1429
1455
|
: last.checks ? (fails.length ? '<ul class="wf-case-fails">' + fails.map(function (x) { return '<li><strong>' + escapeHtml(critName[x.criterionId] || x.criterionId) + '</strong>' + (x.reason ? ': ' + escapeHtml(x.reason) : '') + '</li>'; }).join('') + '</ul>' : '')
|
|
@@ -1444,17 +1470,18 @@ ${renderMarkdownScript}
|
|
|
1444
1470
|
(last && last.result ? '<div class="workflow-run-entry-label">Latest result' + (last.tools && last.tools.length ? ' <span class="hint">(called ' + escapeHtml(last.tools.join(', ')) + ')</span>' : '') + '</div><div class="workflow-steps-text">' + escapeHtml(last.result) + '</div>' : '') +
|
|
1445
1471
|
'</details></li>';
|
|
1446
1472
|
}).join('');
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1473
|
+
var lastLine = !round ? ''
|
|
1474
|
+
: '<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>' +
|
|
1475
|
+
(checked ? String.fromCharCode(8212) + ' ' + round.allPassed + ' of ' + round.cases.length + ' cases passed every checklist item.' : '') +
|
|
1476
|
+
' <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>';
|
|
1477
|
+
return '<section class="wf-section">' + critSection + '</section>' +
|
|
1478
|
+
'<section class="wf-section"><h4 class="wf-sub">Eval cases' + (evals.cases.length ? ' (' + evals.cases.length + ')' : '') + '</h4>' +
|
|
1479
|
+
'<p class="hint" style="margin:0">Real runs saved to check every change against.</p>' +
|
|
1480
|
+
(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>') +
|
|
1481
|
+
'<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>' +
|
|
1482
|
+
'<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>' +
|
|
1483
|
+
lastLine + '</section>' +
|
|
1484
|
+
(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>' : '');
|
|
1458
1485
|
}
|
|
1459
1486
|
|
|
1460
1487
|
// Worth testing: runs from the last 30 days that would make good eval
|
|
@@ -1469,12 +1496,12 @@ ${renderMarkdownScript}
|
|
|
1469
1496
|
.then(function (data) {
|
|
1470
1497
|
var list = data.candidates || [];
|
|
1471
1498
|
if (!list.length) { box.innerHTML = '<p class="hint" style="margin:0">Nothing new to suggest from the last 30 days.</p>'; return; }
|
|
1472
|
-
box.innerHTML = '<p class="hint" style="margin:0 0 6px">
|
|
1499
|
+
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) {
|
|
1473
1500
|
var why = WHY[c.why] || ['', c.why];
|
|
1474
1501
|
return '<li><span class="le-pill ' + why[0] + '">' + why[1] + '</span>' +
|
|
1475
1502
|
'<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>' +
|
|
1476
1503
|
'<a class="wf-link" href="' + caseHref(c.runId) + '">Open</a>' +
|
|
1477
|
-
'<button type="button" class="wf-link wf-save-case" data-run="' + escapeHtml(c.runId) + '">
|
|
1504
|
+
'<button type="button" class="wf-link wf-save-case" data-run="' + escapeHtml(c.runId) + '">Add as eval case</button></li>';
|
|
1478
1505
|
}).join('') + '</ul>';
|
|
1479
1506
|
})
|
|
1480
1507
|
.catch(function (err) { box.innerHTML = '<p class="error">Could not look through its runs: ' + escapeHtml(err.message) + '</p>'; });
|
|
@@ -1489,7 +1516,7 @@ ${renderMarkdownScript}
|
|
|
1489
1516
|
}
|
|
1490
1517
|
if ((r.decisions || []).length) parts.push('<span class="hint">' + r.decisions.map(function (d) { return escapeHtml(d.tool) + (d.approved ? ' approved' : ' refused'); }).join(DOT) + '</span>');
|
|
1491
1518
|
var saved = ((w.evals && w.evals.cases) || []).some(function (c) { return c.fromRun === r.run_id; });
|
|
1492
|
-
if (
|
|
1519
|
+
if (saved) parts.push('<span class="hint">An eval case</span>');
|
|
1493
1520
|
return parts.length ? '<div class="wf-run-evidence">' + parts.join('') + '</div>' : '';
|
|
1494
1521
|
}
|
|
1495
1522
|
|
|
@@ -1543,7 +1570,7 @@ ${renderMarkdownScript}
|
|
|
1543
1570
|
'<div class="wf-page-crumb-row"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>' +
|
|
1544
1571
|
'<a class="wf-page-crumb" href="/agents/config?agent=' + encodeURIComponent(name) + '&tab=workflows">' + String.fromCharCode(8592) + ' ' + escapeHtml(agentLabel) + ' ' + String.fromCharCode(183) + ' Workflows</a></div>' +
|
|
1545
1572
|
'<div class="wf-page-title-row"><h1>' + escapeHtml(w.title) + '</h1>' +
|
|
1546
|
-
'<span class="wf-row-actions"><
|
|
1573
|
+
'<span class="wf-row-actions"><button type="button" class="workflow-edit">Edit</button></span></div>' +
|
|
1547
1574
|
(w.description && w.description !== w.title ? '<p class="wf-page-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
1548
1575
|
'<div class="wf-page-meta">' +
|
|
1549
1576
|
'<span class="wf-page-meta-item"><span class="wf-page-meta-k">Agent</span><a href="/agents/config?agent=' + encodeURIComponent(name) + '">' + escapeHtml(agentLabel) + '</a></span>' +
|
|
@@ -1553,13 +1580,13 @@ ${renderMarkdownScript}
|
|
|
1553
1580
|
'</div>' +
|
|
1554
1581
|
'</header>' +
|
|
1555
1582
|
'<div class="wf-row-body wf-page-body">' +
|
|
1556
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('
|
|
1583
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('audit', 'Audit') + tabBtn('improve', 'Improve') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messages') + tabBtn('contract', 'Contract') + '</div>' +
|
|
1557
1584
|
panel('brief', workflowBriefHtml(w)) +
|
|
1558
|
-
panel('
|
|
1585
|
+
panel('audit', workflowAuditHtml(w, runs, name)) +
|
|
1586
|
+
panel('improve', workflowImproveHtml(w)) +
|
|
1559
1587
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
1560
1588
|
panel('messages', workflowMessagesHtml(w, name)) +
|
|
1561
1589
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
1562
|
-
panel('changes', '<div class="wf-changes"><span class="hint">Loading' + String.fromCharCode(8230) + '</span></div>') +
|
|
1563
1590
|
'<div class="hint workflow-result"></div>' +
|
|
1564
1591
|
'<div class="wf-row-foot"><span class="hint">ID <code>' + escapeHtml(w.id) + '</code>, used by the API, schedules and webhooks</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>' +
|
|
1565
1592
|
'</div>' +
|
|
@@ -1578,12 +1605,13 @@ ${renderMarkdownScript}
|
|
|
1578
1605
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
1579
1606
|
// What it does, in full, once it's open (the row shows just its name).
|
|
1580
1607
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
1581
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('
|
|
1608
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('audit', 'Audit') + tabBtn('improve', 'Improve') + tabBtn('contract', 'Contract') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messages') + '</div>' +
|
|
1582
1609
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
1583
1610
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
1584
1611
|
panel('messages', workflowMessagesHtml(w, name)) +
|
|
1585
1612
|
panel('brief', workflowBriefHtml(w)) +
|
|
1586
|
-
panel('
|
|
1613
|
+
panel('audit', workflowAuditHtml(w, runs, name)) +
|
|
1614
|
+
panel('improve', workflowImproveHtml(w)) +
|
|
1587
1615
|
'<div class="hint workflow-result"></div>' +
|
|
1588
1616
|
'<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>' +
|
|
1589
1617
|
'</div>' +
|
|
@@ -2214,7 +2242,8 @@ ${renderMarkdownScript}
|
|
|
2214
2242
|
loadBriefVersions(card, base);
|
|
2215
2243
|
loadWorkflowHealth(card, base);
|
|
2216
2244
|
loadCandidates(card, base);
|
|
2217
|
-
|
|
2245
|
+
loadAuditSummary(card, base);
|
|
2246
|
+
loadLatestChanges(card, name);
|
|
2218
2247
|
card.querySelector('.workflow-edit').addEventListener('click', function () { openWorkflowEditor(name, card); });
|
|
2219
2248
|
// Opens the workflow's page on its Triggers tab.
|
|
2220
2249
|
var triggersBtn = card.querySelector('.workflow-triggers-open');
|
|
@@ -2308,7 +2337,7 @@ ${renderMarkdownScript}
|
|
|
2308
2337
|
}
|
|
2309
2338
|
if (cbtn.classList.contains('wf-crit-add')) { rows.insertAdjacentHTML('beforeend', critRowHtml({ kind: 'judge' })); return; }
|
|
2310
2339
|
if (cbtn.classList.contains('wf-crit-remove')) { cbtn.closest('.wf-crit-row').remove(); return; }
|
|
2311
|
-
if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = '
|
|
2340
|
+
if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = 'improve'; loadWorkflowsSection(name); return; }
|
|
2312
2341
|
cbtn.disabled = true;
|
|
2313
2342
|
if (cbtn.classList.contains('wf-crit-draft')) {
|
|
2314
2343
|
critStatus.textContent = 'Drafting from the brief' + String.fromCharCode(8230);
|
|
@@ -2326,7 +2355,7 @@ ${renderMarkdownScript}
|
|
|
2326
2355
|
fetchJsonRetryOnce(base + '/evals/criteria', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ criteria: list }) }).then(function (r) {
|
|
2327
2356
|
cbtn.disabled = false;
|
|
2328
2357
|
if (!r.ok) { critStatus.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't save.'; return; }
|
|
2329
|
-
workflowTabs[id] = '
|
|
2358
|
+
workflowTabs[id] = 'improve';
|
|
2330
2359
|
loadWorkflowsSection(name);
|
|
2331
2360
|
});
|
|
2332
2361
|
});
|
|
@@ -2346,7 +2375,7 @@ ${renderMarkdownScript}
|
|
|
2346
2375
|
if (request[1].body) opts.body = JSON.stringify(request[1].body);
|
|
2347
2376
|
fetchJsonRetryOnce(request[0], opts).then(function (r) {
|
|
2348
2377
|
if (!r.ok) { btn.disabled = false; result.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't work.'; return; }
|
|
2349
|
-
workflowTabs[id] = '
|
|
2378
|
+
workflowTabs[id] = 'improve';
|
|
2350
2379
|
loadWorkflowsSection(name);
|
|
2351
2380
|
});
|
|
2352
2381
|
});
|
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' : 'audit'), 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=improve">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; });
|