loopengine 0.4.10 → 0.4.12

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.
@@ -985,8 +985,9 @@ ${renderMarkdownScript}
985
985
  // header and list. Every link to a workflow lands here.
986
986
  var pageParams = new URLSearchParams(location.search);
987
987
  var workflowPageId = pageParams.get('tab') === 'workflows' && pageParams.get('workflow') || null;
988
- // Evidence and Changes became Audit and Improve: old links still open.
989
- var OLD_TABS = { evidence: 'audit', changes: 'audit' };
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' };
990
991
  if (workflowPageId && pageParams.get('wtab')) workflowTabs[workflowPageId] = OLD_TABS[pageParams.get('wtab')] || pageParams.get('wtab');
991
992
  // A case's page, with a back link to here.
992
993
  function caseHref(runId) {
@@ -1143,7 +1144,7 @@ ${renderMarkdownScript}
1143
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>';
1144
1145
  }
1145
1146
 
1146
- // The Audit tab's summary: the workflow's last 30 days in sentences, the
1147
+ // The Activity tab's summary: the workflow's last 30 days in sentences, the
1147
1148
  // same as the Audit page's.
1148
1149
  function loadAuditSummary(card, base) {
1149
1150
  var box = card.querySelector('.wf-audit-summary');
@@ -1154,7 +1155,7 @@ ${renderMarkdownScript}
1154
1155
  .catch(function (err) { box.innerHTML = '<p class="error">Could not load its summary: ' + escapeHtml(err.message) + '</p>'; });
1155
1156
  }
1156
1157
 
1157
- // The Audit tab's latest few settings changes, with what changed.
1158
+ // The Activity tab's latest few settings changes, with what changed.
1158
1159
  function loadLatestChanges(card, name) {
1159
1160
  var box = card.querySelector('.wf-changes-latest');
1160
1161
  if (!box) return;
@@ -1398,10 +1399,10 @@ ${renderMarkdownScript}
1398
1399
  }
1399
1400
  var REFERENCE_CRIT = { id: 'reference', text: 'Matches the good result: the same facts and decisions', kind: 'reference' };
1400
1401
 
1401
- // The Audit tab: what happened and whether it can be trusted. The same
1402
+ // The Activity tab: what happened and whether it can be trusted. The same
1402
1403
  // summary as the Audit page's, its health over 30 days, its latest runs
1403
1404
  // and changes, and the way to the report and the full log.
1404
- function workflowAuditHtml(w, runsHtml, name) {
1405
+ function workflowActivityHtml(w, runsHtml, name) {
1405
1406
  var auditHref = '/audit?agent=' + encodeURIComponent(name) + '&workflow=' + encodeURIComponent(w.id);
1406
1407
  var loading = '<p class="hint" style="margin:0">Loading' + String.fromCharCode(8230) + '</p>';
1407
1408
  return (workflowPageId ? '<section class="wf-section wf-audit-summary">' + loading + '</section>' : '') +
@@ -1412,9 +1413,9 @@ ${renderMarkdownScript}
1412
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>' : '');
1413
1414
  }
1414
1415
 
1415
- // The Improve tab: the checklist, the eval cases (suggested from real
1416
- // runs, and saved), and Evaluate.
1417
- function workflowImproveHtml(w) {
1416
+ // The Evaluation tab: the success criteria, the eval cases (saved, then
1417
+ // suggested from real runs), and Evaluate.
1418
+ function workflowEvaluationHtml(w) {
1418
1419
  var evals = w.evals || { cases: [], criteria: [], rounds: [] };
1419
1420
  var criteria = evals.criteria && evals.criteria.length ? evals.criteria : [REFERENCE_CRIT];
1420
1421
  var round = evals.rounds[0];
@@ -1427,16 +1428,16 @@ ${renderMarkdownScript}
1427
1428
  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>';
1428
1429
  return '<li class="wf-crit"><span><strong>' + escapeHtml(c.text) + '</strong><br><span class="wf-crit-kind">' + escapeHtml(critKindText(c)) + '</span></span>' + pill + '</li>';
1429
1430
  }).join('');
1430
- var critSection = '<h4 class="wf-sub">Checklist</h4>' +
1431
+ var critSection = '<h4 class="wf-sub">Success criteria</h4>' +
1431
1432
  '<p class="hint" style="margin:0">' + (evals.criteria && evals.criteria.length
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>' +
1433
+ ? 'What every good result must get right. Each eval case is checked against every criterion, yes or no.'
1434
+ : 'What every good result must get right. None set yet, so each eval case is only compared with its good result. Add the criteria that matter, or have them suggested from its instructions.') + '</p>' +
1434
1435
  '<ul class="wf-crits">' + critList + '</ul>' +
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>' +
1436
+ '<div class="wf-crit-bar"><button type="button" class="wf-crit-edit">' + (evals.criteria && evals.criteria.length ? 'Edit the success criteria' : 'Add success criteria') + '</button></div>' +
1436
1437
  '<div class="wf-crit-form" hidden>' +
1437
1438
  '<div class="wf-crit-rows">' + (evals.criteria && evals.criteria.length ? evals.criteria : []).map(critRowHtml).join('') + '</div>' +
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>' +
1439
+ '<div class="wf-crit-bar"><button type="button" class="plain wf-crit-add">+ Add a criterion</button><button type="button" class="plain wf-crit-draft">Suggest from its instructions</button>' +
1440
+ '<span style="flex:1"></span><button type="button" class="plain wf-crit-cancel">Cancel</button><button type="button" class="wf-crit-save">Save success criteria</button></div>' +
1440
1441
  '<span class="hint wf-crit-status"></span>' +
1441
1442
  '</div>';
1442
1443
  var latest = {};
@@ -1449,7 +1450,7 @@ ${renderMarkdownScript}
1449
1450
  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);
1450
1451
  var fails = last && last.checks ? last.checks.filter(function (x) { return !x.pass; }) : [];
1451
1452
  var pill = !last ? ''
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>')
1453
+ : last.checks ? (fails.length ? '<span class="le-pill bad">' + fails.length + ' of ' + last.checks.length + ' criteria missed</span>' : '<span class="le-pill good">Passed all ' + last.checks.length + '</span>')
1453
1454
  : 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>';
1454
1455
  var why = !last ? ''
1455
1456
  : 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>' : '')
@@ -1472,14 +1473,14 @@ ${renderMarkdownScript}
1472
1473
  }).join('');
1473
1474
  var lastLine = !round ? ''
1474
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>' +
1475
- (checked ? String.fromCharCode(8212) + ' ' + round.allPassed + ' of ' + round.cases.length + ' cases passed every checklist item.' : '') +
1476
+ (checked ? String.fromCharCode(8212) + ' ' + round.allPassed + ' of ' + round.cases.length + ' cases met every success criterion.' : '') +
1476
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>';
1477
1478
  return '<section class="wf-section">' + critSection + '</section>' +
1478
1479
  '<section class="wf-section"><h4 class="wf-sub">Eval cases' + (evals.cases.length ? ' (' + evals.cases.length + ')' : '') + '</h4>' +
1479
1480
  '<p class="hint" style="margin:0">Real runs saved to check every change against.</p>' +
1480
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>') +
1481
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>' +
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
+ '<span class="hint">Runs every eval case again with the current instructions and checks each result against the success criteria. Nothing is sent, refunded or submitted.</span></div>' +
1483
1484
  lastLine + '</section>' +
1484
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>' : '');
1485
1486
  }
@@ -1580,10 +1581,10 @@ ${renderMarkdownScript}
1580
1581
  '</div>' +
1581
1582
  '</header>' +
1582
1583
  '<div class="wf-row-body wf-page-body">' +
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>' +
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>' +
1584
1585
  panel('brief', workflowBriefHtml(w)) +
1585
- panel('audit', workflowAuditHtml(w, runs, name)) +
1586
- panel('improve', workflowImproveHtml(w)) +
1586
+ panel('activity', workflowActivityHtml(w, runs, name)) +
1587
+ panel('evaluation', workflowEvaluationHtml(w)) +
1587
1588
  panel('triggers', workflowTriggersHtml(w, name, params)) +
1588
1589
  panel('messages', workflowMessagesHtml(w, name)) +
1589
1590
  panel('contract', workflowContractHtml(w, name, params)) +
@@ -1605,13 +1606,13 @@ ${renderMarkdownScript}
1605
1606
  '<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
1606
1607
  // What it does, in full, once it's open (the row shows just its name).
1607
1608
  (w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
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>' +
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>' +
1609
1610
  panel('contract', workflowContractHtml(w, name, params)) +
1610
1611
  panel('triggers', workflowTriggersHtml(w, name, params)) +
1611
1612
  panel('messages', workflowMessagesHtml(w, name)) +
1612
1613
  panel('brief', workflowBriefHtml(w)) +
1613
- panel('audit', workflowAuditHtml(w, runs, name)) +
1614
- panel('improve', workflowImproveHtml(w)) +
1614
+ panel('activity', workflowActivityHtml(w, runs, name)) +
1615
+ panel('evaluation', workflowEvaluationHtml(w)) +
1615
1616
  '<div class="hint workflow-result"></div>' +
1616
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>' +
1617
1618
  '</div>' +
@@ -2337,7 +2338,7 @@ ${renderMarkdownScript}
2337
2338
  }
2338
2339
  if (cbtn.classList.contains('wf-crit-add')) { rows.insertAdjacentHTML('beforeend', critRowHtml({ kind: 'judge' })); return; }
2339
2340
  if (cbtn.classList.contains('wf-crit-remove')) { cbtn.closest('.wf-crit-row').remove(); return; }
2340
- if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = 'improve'; loadWorkflowsSection(name); return; }
2341
+ if (cbtn.classList.contains('wf-crit-cancel')) { workflowTabs[id] = 'evaluation'; loadWorkflowsSection(name); return; }
2341
2342
  cbtn.disabled = true;
2342
2343
  if (cbtn.classList.contains('wf-crit-draft')) {
2343
2344
  critStatus.textContent = 'Drafting from the brief' + String.fromCharCode(8230);
@@ -2355,7 +2356,7 @@ ${renderMarkdownScript}
2355
2356
  fetchJsonRetryOnce(base + '/evals/criteria', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ criteria: list }) }).then(function (r) {
2356
2357
  cbtn.disabled = false;
2357
2358
  if (!r.ok) { critStatus.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't save.'; return; }
2358
- workflowTabs[id] = 'improve';
2359
+ workflowTabs[id] = 'evaluation';
2359
2360
  loadWorkflowsSection(name);
2360
2361
  });
2361
2362
  });
@@ -2375,7 +2376,7 @@ ${renderMarkdownScript}
2375
2376
  if (request[1].body) opts.body = JSON.stringify(request[1].body);
2376
2377
  fetchJsonRetryOnce(request[0], opts).then(function (r) {
2377
2378
  if (!r.ok) { btn.disabled = false; result.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't work.'; return; }
2378
- workflowTabs[id] = 'improve';
2379
+ workflowTabs[id] = 'evaluation';
2379
2380
  loadWorkflowsSection(name);
2380
2381
  });
2381
2382
  });
@@ -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' : 'audit'), text: 'Workflow' };
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' };
@@ -22,7 +22,7 @@ const LABELS = [
22
22
  [/^\/agents\/[^/]+\/workflows\/[^/]+\/versions\/(\d+)\/restore$/, (_method, m) => `Restored brief version ${m[1]}`],
23
23
  [/^\/agents\/[^/]+\/workflows\/[^/]+\/messages$/, 'Changed where messages go'],
24
24
  [/^\/agents\/[^/]+\/workflows\/[^/]+\/triggers/, 'Changed webhook triggers'],
25
- [/^\/agents\/[^/]+\/workflows\/[^/]+\/evals\/criteria/, 'Changed the checklist'],
25
+ [/^\/agents\/[^/]+\/workflows\/[^/]+\/evals\/criteria/, 'Changed the success criteria'],
26
26
  [/^\/agents\/[^/]+\/workflows\/[^/]+\/evals/, 'Changed eval cases'],
27
27
  [/^\/agents\/[^/]+\/schedules/, 'Changed schedules'],
28
28
  [/^\/schedules\//, 'Changed a schedule'],
@@ -127,7 +127,7 @@ function lineChanges(before, after) {
127
127
  * field. A text of several lines, or a long one, is told as lines added
128
128
  * and removed; anything else as its value before and after. */
129
129
  // Always told as lines, however short: what an agent reads.
130
- const TEXT_FIELDS = new Set(['instructions', 'shared policies', 'checklist']);
130
+ const TEXT_FIELDS = new Set(['instructions', 'shared policies', 'success criteria']);
131
131
  export function describeChanges(before, after) {
132
132
  const out = [];
133
133
  for (const field of [...new Set([...Object.keys(before), ...Object.keys(after)])]) {
@@ -386,7 +386,7 @@ ${renderMarkdownScript}
386
386
  }
387
387
 
388
388
  // Save this run as one of its workflow's eval cases (owners, admins and
389
- // editors): a test it must keep passing. Then the checklist items it
389
+ // editors): a test it must keep passing. Then the success criteria it
390
390
  // suggests, from what people corrected in it, to add or not.
391
391
  function evalCaseHtml(c) {
392
392
  var run = c.run;
@@ -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=improve">See its eval cases</a>';
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; });
@@ -429,7 +429,7 @@ ${renderMarkdownScript}
429
429
  var fresh = suggestions.filter(function (s) { return have.indexOf(s.text) === -1; });
430
430
  if (!fresh.length) return;
431
431
  box.hidden = false;
432
- box.innerHTML = '<h4>Add to its checklist?</h4><p class="hint" style="margin:0">From what people corrected in this run. Each becomes a check every eval case is judged on.</p>' +
432
+ box.innerHTML = '<h4>Add to its success criteria?</h4><p class="hint" style="margin:0">From what people corrected in this run. Each becomes a criterion every eval case is judged on.</p>' +
433
433
  fresh.map(function (s, i) { return '<div class="ib-suggest-row"><span>' + esc(s.text) + '</span><button type="button" class="ib-btn plain" data-suggest="' + i + '">Add</button></div>'; }).join('');
434
434
  box.addEventListener('click', function (ev) {
435
435
  var b = ev.target.closest('[data-suggest]');
@@ -185,7 +185,7 @@ export interface EvalRunDeps {
185
185
  /** Runs every case once and scores it, recording progress as it goes.
186
186
  * Throws when a round is already running or there are no cases. */
187
187
  export declare function startEvalRound(deps: EvalRunDeps): Promise<EvalRound>;
188
- /** Checklist items a run suggests (web/agents-config-page's Criteria),
188
+ /** Success criteria a run suggests (the Evaluation tab's),
189
189
  * from what people corrected in it: a denial's reason, a changed
190
190
  * request, a bad result's note, a question it had to ask. */
191
191
  export declare function suggestedCriteria(run: WorkflowRun): {
@@ -343,7 +343,7 @@ const clip = (text, max) => {
343
343
  return flat.length > max ? flat.slice(0, max - 1) + '…' : flat;
344
344
  };
345
345
  const shown = (v) => clip(v === undefined ? '(none)' : typeof v === 'string' ? v : JSON.stringify(v), 80);
346
- /** Checklist items a run suggests (web/agents-config-page's Criteria),
346
+ /** Success criteria a run suggests (the Evaluation tab's),
347
347
  * from what people corrected in it: a denial's reason, a changed
348
348
  * request, a bad result's note, a question it had to ask. */
349
349
  export function suggestedCriteria(run) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",