loopengine 0.3.101 → 0.4.2
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/core/audit-store.d.ts +92 -0
- package/dist/core/audit-store.js +300 -0
- package/dist/core/durable-approvals.d.ts +28 -2
- package/dist/core/durable-approvals.js +113 -3
- package/dist/core/messaging/threads.d.ts +3 -2
- package/dist/core/messaging/threads.js +85 -6
- package/dist/core/run-agent.js +2 -0
- package/dist/core/session-store.d.ts +35 -3
- package/dist/core/session-store.js +81 -3
- package/dist/core/usage.d.ts +11 -0
- package/dist/core/usage.js +51 -3
- package/dist/core/workflow-runs.d.ts +82 -10
- package/dist/core/workflow-runs.js +186 -13
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/models.yaml +58 -0
- package/dist/web/agents-config-page.js +188 -9
- package/dist/web/change-log.d.ts +12 -0
- package/dist/web/change-log.js +86 -0
- package/dist/web/global-config.d.ts +20 -0
- package/dist/web/global-config.js +45 -3
- package/dist/web/inbox-admin.d.ts +34 -2
- package/dist/web/inbox-admin.js +45 -6
- package/dist/web/inbox-page.js +81 -9
- package/dist/web/workflow-evidence.d.ts +4 -0
- package/dist/web/workflow-evidence.js +1 -0
- package/dist/web/workflow-health.d.ts +66 -0
- package/dist/web/workflow-health.js +76 -0
- package/package.json +3 -1
|
@@ -86,8 +86,6 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
86
86
|
.wf-page-starts { display: grid; gap: 2px; color: var(--ink); }
|
|
87
87
|
.wf-page-last { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
|
|
88
88
|
.wf-list-box.wf-page-box { border: 0; border-radius: 0; background: none; overflow: visible; }
|
|
89
|
-
.wf-page-brief { display: grid; gap: 10px; }
|
|
90
|
-
.wf-page-brief h2 { margin: 0; font-size: 15px; }
|
|
91
89
|
.wf-page .workflow-steps-text { margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--surface); font-size: 13.5px; line-height: 1.6; max-height: 480px; overflow: auto; white-space: pre-wrap; }
|
|
92
90
|
.wf-page .workflow-result:empty { display: none; }
|
|
93
91
|
.wf-tab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
|
|
@@ -210,6 +208,25 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
210
208
|
.wf-crit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
|
|
211
209
|
.wf-crit-kind { font-size: 12px; color: var(--ink-muted); }
|
|
212
210
|
.wf-crit-rate { font-variant-numeric: tabular-nums; }
|
|
211
|
+
.wf-health { display: grid; gap: 12px; margin-bottom: 8px; }
|
|
212
|
+
.wf-health-alert { padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }
|
|
213
|
+
.wf-health-chart { margin: 0; display: grid; gap: 4px; }
|
|
214
|
+
.wf-health-chart svg { width: 100%; height: 96px; display: block; border-bottom: 1px solid var(--line); }
|
|
215
|
+
.wf-health-chart figcaption { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-faint); }
|
|
216
|
+
.wf-health-table { overflow-x: auto; }
|
|
217
|
+
.wf-health-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
|
|
218
|
+
.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; }
|
|
219
|
+
.wf-health-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
|
|
220
|
+
.wf-change-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; }
|
|
221
|
+
.wf-change-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
|
|
222
|
+
.wf-change-kind { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); min-width: 64px; }
|
|
223
|
+
.wf-change-kind.change { color: var(--accent-ink); }
|
|
224
|
+
.wf-change-text { flex: 1 1 280px; }
|
|
225
|
+
.wf-versions { display: grid; gap: 8px; margin-bottom: 12px; font-size: 13px; }
|
|
226
|
+
.wf-versions[hidden], .wf-versions-list[hidden], .wf-version-text[hidden] { display: none; }
|
|
227
|
+
.wf-versions-line, .wf-versions-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
|
|
228
|
+
.wf-versions-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; border-left: 2px solid var(--line); padding-left: 12px; }
|
|
229
|
+
.wf-versions-list li { display: grid; gap: 6px; }
|
|
213
230
|
.wf-crit-form { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
|
|
214
231
|
.wf-crit-form[hidden] { display: none; }
|
|
215
232
|
.wf-crit-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 180px auto; gap: 8px; align-items: center; }
|
|
@@ -1022,6 +1039,100 @@ ${renderMarkdownScript}
|
|
|
1022
1039
|
for (var i = 0; i < tabs.length; i++) tabs[i].setAttribute('aria-selected', String(tabs[i].dataset.tab === key));
|
|
1023
1040
|
var panels = card.querySelectorAll('.wf-panel');
|
|
1024
1041
|
for (var j = 0; j < panels.length; j++) panels[j].hidden = panels[j].dataset.panel !== key;
|
|
1042
|
+
if (key === 'changes') loadWorkflowChanges(card);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
// The Health panel: the last 30 days of runs, as totals, day by day and
|
|
1046
|
+
// per brief version, and any alert (a rate that just got worse).
|
|
1047
|
+
function loadWorkflowHealth(card, base) {
|
|
1048
|
+
var box = card.querySelector('.wf-health');
|
|
1049
|
+
if (!box) return;
|
|
1050
|
+
fetch(base + '/health', { headers: { accept: 'application/json' } })
|
|
1051
|
+
.then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
|
|
1052
|
+
.then(function (h) { box.innerHTML = '<h4 class="wf-sub">Health, last ' + h.days + ' days</h4>' + workflowHealthHtml(h); })
|
|
1053
|
+
.catch(function (err) { box.innerHTML = '<h4 class="wf-sub">Health</h4><p class="error">Could not load it: ' + escapeHtml(err.message) + '</p>'; });
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
function healthPct(part, whole) { return whole ? Math.round(100 * part / whole) + '%' : String.fromCharCode(8212); }
|
|
1057
|
+
function healthTime(ms) {
|
|
1058
|
+
if (ms == null) return String.fromCharCode(8212);
|
|
1059
|
+
if (ms < 60000) return (ms / 1000).toFixed(1) + ' s';
|
|
1060
|
+
var min = Math.round(ms / 60000);
|
|
1061
|
+
return min < 60 ? min + ' min' : Math.floor(min / 60) + ' h ' + (min % 60) + ' min';
|
|
1062
|
+
}
|
|
1063
|
+
function healthCost(usd) { return usd == null ? String.fromCharCode(8212) : '$' + (usd >= 0.1 ? usd.toFixed(2) : usd.toFixed(3)); }
|
|
1064
|
+
|
|
1065
|
+
// Runs per day as bars, the failed part of each in red.
|
|
1066
|
+
function healthChartHtml(daily) {
|
|
1067
|
+
var max = 1;
|
|
1068
|
+
daily.forEach(function (d) { if (d.runs > max) max = d.runs; });
|
|
1069
|
+
var w = 600, h = 96, gap = 2, bw = (w - gap * (daily.length - 1)) / daily.length;
|
|
1070
|
+
var bars = daily.map(function (d, i) {
|
|
1071
|
+
var x = (i * (bw + gap)).toFixed(1);
|
|
1072
|
+
var all = d.runs / max * (h - 4), bad = d.failed / max * (h - 4);
|
|
1073
|
+
var tip = '<title>' + escapeHtml(d.date) + ': ' + d.runs + ' run' + (d.runs === 1 ? '' : 's') + (d.failed ? ', ' + d.failed + ' failed' : '') + '</title>';
|
|
1074
|
+
return '<g>' + tip + '<rect x="' + x + '" y="0" width="' + bw.toFixed(1) + '" height="' + h + '" fill="transparent"/>' +
|
|
1075
|
+
(d.runs ? '<rect x="' + x + '" y="' + (h - all).toFixed(1) + '" width="' + bw.toFixed(1) + '" height="' + all.toFixed(1) + '" rx="1.5" fill="var(--accent)" opacity="0.75"/>' : '') +
|
|
1076
|
+
(d.failed ? '<rect x="' + x + '" y="' + (h - bad).toFixed(1) + '" width="' + bw.toFixed(1) + '" height="' + bad.toFixed(1) + '" rx="1.5" fill="var(--bad)"/>' : '') + '</g>';
|
|
1077
|
+
}).join('');
|
|
1078
|
+
var first = daily[0] ? daily[0].date.slice(5) : '', last = daily.length ? daily[daily.length - 1].date.slice(5) : '';
|
|
1079
|
+
return '<figure class="wf-health-chart"><svg viewBox="0 0 ' + w + ' ' + h + '" preserveAspectRatio="none" role="img" aria-label="Runs per day, failed in red">' + bars + '</svg>' +
|
|
1080
|
+
'<figcaption><span>' + escapeHtml(first) + '</span><span class="hint">Runs per day' + DOT + 'failed in red' + DOT + 'most ' + max + '</span><span>' + escapeHtml(last) + '</span></figcaption></figure>';
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
function workflowHealthHtml(h) {
|
|
1084
|
+
var t = h.total;
|
|
1085
|
+
if (!t.runs) return '<p class="hint" style="margin:0">No runs in the last ' + h.days + ' days.</p>';
|
|
1086
|
+
var decided = t.approved + t.denied;
|
|
1087
|
+
var alerts = (h.alerts || []).map(function (a) { return '<div class="wf-health-alert" role="alert">' + escapeHtml(a.text) + '</div>'; }).join('');
|
|
1088
|
+
var stat = function (label, value, detail) { 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>'; };
|
|
1089
|
+
var stats = '<div class="wf-scores">' +
|
|
1090
|
+
stat('Runs', String(t.runs), t.failed + ' failed (' + healthPct(t.failed, t.finished) + ')') +
|
|
1091
|
+
stat('Approved', healthPct(t.approved, decided), decided ? t.changed + ' changed first' + DOT + t.denied + ' denied' : 'none asked') +
|
|
1092
|
+
stat('Questions', t.runs ? (t.questions / t.runs).toFixed(1) : '0', 'per run') +
|
|
1093
|
+
stat('Time', healthTime(t.medianMs), 'middle run, start to finish') +
|
|
1094
|
+
stat('Cost', healthCost(t.costPerRunUsd), t.costPerRunUsd == null ? 'no price for its model' : 'per run' + (t.pricedRuns < t.runs ? ', from ' + t.pricedRuns + ' of ' + t.runs + ' runs' : '')) +
|
|
1095
|
+
'</div>';
|
|
1096
|
+
var rows = h.versions.map(function (v) {
|
|
1097
|
+
var d = v.approved + v.denied;
|
|
1098
|
+
return '<tr><td>' + (v.version == null ? '<span class="hint">before versions</span>' : 'v' + 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>' +
|
|
1099
|
+
'<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>';
|
|
1100
|
+
}).join('');
|
|
1101
|
+
return alerts + stats + healthChartHtml(h.daily) +
|
|
1102
|
+
'<div class="wf-health-table"><table><thead><tr><th>Brief</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>';
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// The Changes tab: every change to this workflow's settings, and every
|
|
1106
|
+
// decision, answer and feedback in its runs, newest first, with who.
|
|
1107
|
+
function loadWorkflowChanges(card) {
|
|
1108
|
+
var box = card.querySelector('.wf-changes');
|
|
1109
|
+
if (!box || box.getAttribute('data-loaded') === '1') return;
|
|
1110
|
+
box.setAttribute('data-loaded', '1');
|
|
1111
|
+
var agent = pageParams.get('agent');
|
|
1112
|
+
fetch('/audit?agent=' + encodeURIComponent(agent) + '&workflow=' + encodeURIComponent(card.dataset.workflow) + '&limit=200', { headers: { accept: 'application/json' } })
|
|
1113
|
+
.then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
|
|
1114
|
+
.then(function (data) { box.innerHTML = workflowChangesHtml(data.events || []); })
|
|
1115
|
+
.catch(function (err) { box.setAttribute('data-loaded', '0'); box.innerHTML = '<p class="error">Could not load the changes: ' + escapeHtml(err.message) + '</p>'; });
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
function changeText(e) {
|
|
1119
|
+
var d = e.data || {};
|
|
1120
|
+
if (e.kind === 'change') return escapeHtml(d.label || 'Changed a setting');
|
|
1121
|
+
if (e.kind === 'decision') return (d.approved ? (d.edited ? 'Approved as changed ' : 'Approved ') : 'Denied ') + '<code>' + escapeHtml(d.tool || '') + '</code>' + (d.reason ? ': ' + String.fromCharCode(8220) + escapeHtml(d.reason) + String.fromCharCode(8221) : '');
|
|
1122
|
+
if (e.kind === 'answer') return 'Answered ' + String.fromCharCode(8220) + escapeHtml(String(d.answer || '').slice(0, 200)) + String.fromCharCode(8221);
|
|
1123
|
+
if (e.kind === 'feedback') return 'Feedback: ' + escapeHtml([d.verdict, d.edit ? (d.edit === 'none' ? 'used unedited' : d.edit + ' edits') : '', d.note].filter(Boolean).join(', ') || 'given');
|
|
1124
|
+
return escapeHtml(e.kind);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
function workflowChangesHtml(events) {
|
|
1128
|
+
if (!events.length) return '<p class="hint" style="margin:0">Nothing yet. Edits to this workflow' + RSQ + 's settings, and every approval, answer and feedback in its runs, will be listed here with who and when.</p>';
|
|
1129
|
+
return '<ol class="wf-change-list">' + events.map(function (e) {
|
|
1130
|
+
var when = new Date(e.at).toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
1131
|
+
var kind = e.kind === 'change' ? 'Setting' : e.kind === 'decision' ? 'Decision' : e.kind === 'answer' ? 'Answer' : 'Feedback';
|
|
1132
|
+
return '<li><span class="wf-change-kind ' + escapeHtml(e.kind) + '">' + kind + '</span><span class="wf-change-text">' + changeText(e) + '</span>' +
|
|
1133
|
+
'<span class="hint">' + (e.by ? escapeHtml(e.by) + DOT : '') + escapeHtml(when) +
|
|
1134
|
+
(e.run_id ? DOT + '<a href="/inbox?case=' + encodeURIComponent(e.run_id) + '">case</a>' : '') + '</span></li>';
|
|
1135
|
+
}).join('') + '</ol>';
|
|
1025
1136
|
}
|
|
1026
1137
|
|
|
1027
1138
|
// ---- A workflow in three parts: its contract (what the system holds it
|
|
@@ -1182,7 +1293,9 @@ ${renderMarkdownScript}
|
|
|
1182
1293
|
|
|
1183
1294
|
function workflowBriefHtml(w) {
|
|
1184
1295
|
var policies = workflowsMeta.policies;
|
|
1185
|
-
|
|
1296
|
+
// Filled by loadBriefVersions once the card is on the page.
|
|
1297
|
+
return '<div class="wf-versions" hidden></div>' +
|
|
1298
|
+
'<div class="workflow-steps-text">' + escapeHtml(w.instructions) + '</div>' +
|
|
1186
1299
|
(policies
|
|
1187
1300
|
? '<details class="wf-original"><summary>Shared policies, read by every workflow</summary><div class="workflow-steps-text">' + escapeHtml(policies) + '</div><p class="hint" style="margin:6px 0 0">Change them in <a href="/config?section=settings">Settings</a>.</p></details>'
|
|
1188
1301
|
: '<p class="hint" style="margin:0">No shared policies yet. Rules every workflow should follow, like your refund window or who signs messages, go in <a href="/config?section=settings">Settings</a>, so you write them once.</p>') +
|
|
@@ -1277,10 +1390,12 @@ ${renderMarkdownScript}
|
|
|
1277
1390
|
(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>' : '') +
|
|
1278
1391
|
'</details></li>';
|
|
1279
1392
|
}).join('');
|
|
1280
|
-
|
|
1393
|
+
// On the workflow's page: its health, filled by loadWorkflowHealth.
|
|
1394
|
+
return (workflowPageId ? '<section class="wf-health"><h4 class="wf-sub">Health, last 30 days</h4><p class="hint" style="margin:0">Loading' + String.fromCharCode(8230) + '</p></section>' : '') +
|
|
1395
|
+
tiles + feedbackHint + critSection +
|
|
1281
1396
|
'<h4 class="wf-sub">Eval cases</h4>' +
|
|
1282
1397
|
'<div class="wf-evals-bar"><button type="button" class="wf-evals-run"' + (!evals.cases.length || running ? ' disabled' : '') + '>' + (running ? 'Running ' + running.done + ' of ' + running.total + String.fromCharCode(8230) : 'Run evals') + '</button>' +
|
|
1283
|
-
'<span class="hint">' + (round ? 'Last run ' + escapeHtml(new Date(round.at).toLocaleString()) + DOT + 'model ' + escapeHtml(round.model) + DOT + 'judged by ' + escapeHtml(round.judge) : 'A test run: tools that need approval aren' + RSQ + 't run, and nobody is asked anything.') + '</span></div>' +
|
|
1398
|
+
'<span class="hint">' + (round ? 'Last run ' + escapeHtml(new Date(round.at).toLocaleString()) + (round.briefVersion ? DOT + 'brief v' + round.briefVersion : '') + DOT + 'model ' + escapeHtml(round.model) + DOT + 'judged by ' + escapeHtml(round.judge) : 'A test run: tools that need approval aren' + RSQ + 't run, and nobody is asked anything.') + '</span></div>' +
|
|
1284
1399
|
(cases ? '<ul class="wf-cases">' + cases + '</ul>' : '<p class="hint" style="margin:0">No cases yet. Save a run from History below as a case, then run the cases after each change to the instructions or model.</p>') +
|
|
1285
1400
|
'<h4 class="wf-sub">History</h4>' +
|
|
1286
1401
|
(runsHtml ? '<ul class="schedule-history">' + runsHtml + '</ul>' : '<p class="hint" style="margin:0">No runs yet.</p>');
|
|
@@ -1331,13 +1446,13 @@ ${renderMarkdownScript}
|
|
|
1331
1446
|
var formattedOutcome = outcome ? renderMarkdownPreview(outcome) : '';
|
|
1332
1447
|
return '<li class="workflow-run-entry"><div class="workflow-run-entry-head">' + pill +
|
|
1333
1448
|
'<span class="workflow-run-time">' + escapeHtml(new Date(r.started_at).toLocaleString()) + '</span>' +
|
|
1334
|
-
'<span class="workflow-run-source hint">' + escapeHtml(source) + '</span></div>' +
|
|
1449
|
+
'<span class="workflow-run-source hint">' + escapeHtml(source) + (r.versions && r.versions.brief ? DOT + 'brief v' + r.versions.brief : '') + '</span></div>' +
|
|
1335
1450
|
(values ? '<div><div class="workflow-run-entry-label">Parameters</div><div class="workflow-run-params">' + values + '</div></div>' : '') +
|
|
1336
1451
|
(outcome ? '<div><div class="workflow-run-entry-label">' + (r.status === 'error' ? 'Error' : 'Final response') + '</div><div class="schedule-result workflow-markdown">' + formattedOutcome + '</div><details class="schedule-result-details"><summary>View full ' + (r.status === 'error' ? 'error' : 'response') + '</summary><div class="schedule-result-full workflow-markdown workflow-markdown-full">' + formattedOutcome + '</div></details></div>' : '') +
|
|
1337
1452
|
runEvidenceHtml(w, r) + '</li>';
|
|
1338
1453
|
}).join('');
|
|
1339
1454
|
var last = workflowLastRun(w);
|
|
1340
|
-
var tab = workflowTabs[w.id] ||
|
|
1455
|
+
var tab = workflowTabs[w.id] || 'brief';
|
|
1341
1456
|
var open = openWorkflowId === w.id;
|
|
1342
1457
|
var panel = function (key, html) { return '<div class="wf-panel" data-panel="' + key + '"' + (tab === key ? '' : ' hidden') + '>' + html + '</div>'; };
|
|
1343
1458
|
var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '" aria-selected="' + (tab === key) + '">' + label + '</button>'; };
|
|
@@ -1359,12 +1474,13 @@ ${renderMarkdownScript}
|
|
|
1359
1474
|
'</div>' +
|
|
1360
1475
|
'</header>' +
|
|
1361
1476
|
'<div class="wf-row-body wf-page-body">' +
|
|
1362
|
-
'<
|
|
1363
|
-
|
|
1477
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Brief') + tabBtn('evidence', 'Evidence' + (runs ? ' <span class="wf-tab-count">' + w.recentRuns.length + '</span>' : '')) + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messages') + tabBtn('contract', 'Contract') + tabBtn('changes', 'Changes') + '</div>' +
|
|
1478
|
+
panel('brief', workflowBriefHtml(w)) +
|
|
1364
1479
|
panel('evidence', workflowEvidenceHtml(w, runs)) +
|
|
1365
1480
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
1366
1481
|
panel('messages', workflowMessagesHtml(w, name)) +
|
|
1367
1482
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
1483
|
+
panel('changes', '<div class="wf-changes"><span class="hint">Loading' + String.fromCharCode(8230) + '</span></div>') +
|
|
1368
1484
|
'<div class="hint workflow-result"></div>' +
|
|
1369
1485
|
'<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>' +
|
|
1370
1486
|
'</div>' +
|
|
@@ -1937,6 +2053,66 @@ ${renderMarkdownScript}
|
|
|
1937
2053
|
render(shown ? shown.url : null, shown ? shown.id : null);
|
|
1938
2054
|
}
|
|
1939
2055
|
|
|
2056
|
+
// The Brief tab's versions: which one is in use, who saved it and why,
|
|
2057
|
+
// and every earlier one to read or restore (restoring saves it as a new
|
|
2058
|
+
// version). Hidden where the workspace keeps no versions.
|
|
2059
|
+
function loadBriefVersions(card, base) {
|
|
2060
|
+
var box = card.querySelector('.wf-versions');
|
|
2061
|
+
if (!box) return;
|
|
2062
|
+
fetch(base + '/versions', { headers: { accept: 'application/json' } })
|
|
2063
|
+
.then(function (r) { return r.ok ? r.json() : null; })
|
|
2064
|
+
.then(function (data) { if (data) renderBriefVersions(box, base, data); })
|
|
2065
|
+
.catch(function () {});
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
function versionWhen(v) {
|
|
2069
|
+
return new Date(v.at).toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
function renderBriefVersions(box, base, data) {
|
|
2073
|
+
var versions = data.versions || [];
|
|
2074
|
+
if (!versions.length) { box.hidden = true; return; }
|
|
2075
|
+
var current = versions.filter(function (v) { return v.number === data.current; })[0] || versions[0];
|
|
2076
|
+
var about = function (v) { return [v.by ? 'by ' + escapeHtml(v.by) : '', escapeHtml(versionWhen(v)), v.reason ? escapeHtml(v.reason) : ''].filter(Boolean).join(DOT); };
|
|
2077
|
+
box.innerHTML = '<div class="wf-versions-line"><strong>Version ' + current.number + '</strong><span class="hint">' + about(current) + '</span>' +
|
|
2078
|
+
(versions.length > 1 ? '<button type="button" class="wf-link wf-versions-toggle">History (' + versions.length + ')</button>' : '') + '</div>' +
|
|
2079
|
+
'<ol class="wf-versions-list" hidden>' + versions.map(function (v) {
|
|
2080
|
+
var isCurrent = v.number === current.number;
|
|
2081
|
+
return '<li data-version="' + v.number + '"><div class="wf-versions-row"><strong>v' + v.number + '</strong><span class="hint">' + about(v) + '</span>' +
|
|
2082
|
+
(isCurrent ? '<span class="le-pill good">In use</span>' : '') +
|
|
2083
|
+
'<button type="button" class="wf-link wf-version-view">View</button>' +
|
|
2084
|
+
(isCurrent ? '' : '<button type="button" class="wf-link wf-version-restore">Restore</button>') + '</div>' +
|
|
2085
|
+
'<div class="workflow-steps-text wf-version-text" hidden>' + escapeHtml(v.content) + '</div></li>';
|
|
2086
|
+
}).join('') + '</ol><span class="hint wf-versions-status" role="status"></span>';
|
|
2087
|
+
box.hidden = false;
|
|
2088
|
+
var list = box.querySelector('.wf-versions-list');
|
|
2089
|
+
var toggle = box.querySelector('.wf-versions-toggle');
|
|
2090
|
+
if (toggle) toggle.addEventListener('click', function () {
|
|
2091
|
+
list.hidden = !list.hidden;
|
|
2092
|
+
toggle.textContent = list.hidden ? 'History (' + versions.length + ')' : 'Hide history';
|
|
2093
|
+
});
|
|
2094
|
+
list.addEventListener('click', function (ev) {
|
|
2095
|
+
var item = ev.target.closest('li[data-version]');
|
|
2096
|
+
if (!item) return;
|
|
2097
|
+
if (ev.target.closest('.wf-version-view')) {
|
|
2098
|
+
var text = item.querySelector('.wf-version-text');
|
|
2099
|
+
text.hidden = !text.hidden;
|
|
2100
|
+
ev.target.textContent = text.hidden ? 'View' : 'Hide';
|
|
2101
|
+
return;
|
|
2102
|
+
}
|
|
2103
|
+
var restore = ev.target.closest('.wf-version-restore');
|
|
2104
|
+
if (!restore) return;
|
|
2105
|
+
if (restore.getAttribute('data-confirming') !== '1') { restore.setAttribute('data-confirming', '1'); restore.textContent = 'Click again to restore'; return; }
|
|
2106
|
+
restore.disabled = true;
|
|
2107
|
+
var status = box.querySelector('.wf-versions-status');
|
|
2108
|
+
status.textContent = 'Restoring' + String.fromCharCode(8230);
|
|
2109
|
+
fetch(base + '/versions/' + item.getAttribute('data-version') + '/restore', { method: 'POST' })
|
|
2110
|
+
.then(function (r) { return r.json().then(function (b) { if (!r.ok) throw new Error(b.error || 'That did not work'); return b; }); })
|
|
2111
|
+
.then(function () { location.reload(); })
|
|
2112
|
+
.catch(function (err) { status.textContent = err.message; restore.disabled = false; });
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
|
|
1940
2116
|
function wireWorkflowCard(name, card) {
|
|
1941
2117
|
var id = card.dataset.workflow;
|
|
1942
2118
|
var result = card.querySelector('.workflow-result');
|
|
@@ -1956,6 +2132,9 @@ ${renderMarkdownScript}
|
|
|
1956
2132
|
}
|
|
1957
2133
|
var tabs = card.querySelectorAll('.wf-tab');
|
|
1958
2134
|
for (var t = 0; t < tabs.length; t++) tabs[t].addEventListener('click', function (ev) { showWorkflowTab(card, ev.currentTarget.dataset.tab); });
|
|
2135
|
+
loadBriefVersions(card, base);
|
|
2136
|
+
loadWorkflowHealth(card, base);
|
|
2137
|
+
if (workflowTabs[id] === 'changes') loadWorkflowChanges(card);
|
|
1959
2138
|
card.querySelector('.workflow-edit').addEventListener('click', function () { openWorkflowEditor(name, card); });
|
|
1960
2139
|
// Opens the workflow's page on its Triggers tab.
|
|
1961
2140
|
var triggersBtn = card.querySelector('.workflow-triggers-open');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Change {
|
|
2
|
+
/** In words: "Edited the workflow", "Changed permissions". */
|
|
3
|
+
label: string;
|
|
4
|
+
agent?: string;
|
|
5
|
+
workflowId?: string;
|
|
6
|
+
}
|
|
7
|
+
/** The change a request makes, or undefined when it doesn't change a
|
|
8
|
+
* setting. */
|
|
9
|
+
export declare function changeOf(method: string, path: string): Change | undefined;
|
|
10
|
+
/** A body as kept in the log: secret-looking fields blanked, long text
|
|
11
|
+
* cut. Secrets' bodies are dropped whole. */
|
|
12
|
+
export declare function keptBody(path: string, body: unknown): unknown;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// The workspace's change log: every setting changed in the console or over
|
|
2
|
+
// the API, with who changed it, kept as an audit event of kind "change"
|
|
3
|
+
// (core/audit-store.ts). adapters/http.ts calls changeOf for each request
|
|
4
|
+
// that changes something and records it once the answer is a success.
|
|
5
|
+
//
|
|
6
|
+
// What's a change is decided by path: agents, their workflows, triggers,
|
|
7
|
+
// schedules, permissions, tools, apps, messaging, secrets, and the
|
|
8
|
+
// workspace's settings. Doing work (running, previewing, chatting,
|
|
9
|
+
// deciding, feedback) isn't: decisions and feedback are events of their
|
|
10
|
+
// own. The request's body is kept with anything secret blanked, and the
|
|
11
|
+
// brief's own before and after are its versions.
|
|
12
|
+
// Doing, not changing.
|
|
13
|
+
const NOT_CHANGES = [
|
|
14
|
+
/^\/agents\/[^/]+\/messages(\/stream)?$/,
|
|
15
|
+
/\/(feedback|run|preview|test|evals\/run|criteria\/draft|telegram-webhook|slack-channels|search|install-deps|refresh)$/,
|
|
16
|
+
];
|
|
17
|
+
const LABELS = [
|
|
18
|
+
[/^\/agents$/, 'Added an agent'],
|
|
19
|
+
[/^\/agents\/[^/]+$/, (method) => (method === 'DELETE' ? 'Removed the agent' : 'Changed the agent')],
|
|
20
|
+
[/^\/agents\/[^/]+\/workflows$/, 'Created a workflow'],
|
|
21
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+$/, (method) => (method === 'DELETE' ? 'Removed the workflow' : 'Edited the workflow')],
|
|
22
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+\/versions\/(\d+)\/restore$/, (_method, m) => `Restored brief version ${m[1]}`],
|
|
23
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+\/messages$/, 'Changed where messages go'],
|
|
24
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+\/triggers/, 'Changed webhook triggers'],
|
|
25
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+\/evals\/criteria/, 'Changed the checklist'],
|
|
26
|
+
[/^\/agents\/[^/]+\/workflows\/[^/]+\/evals/, 'Changed eval cases'],
|
|
27
|
+
[/^\/agents\/[^/]+\/schedules/, 'Changed schedules'],
|
|
28
|
+
[/^\/schedules\//, 'Changed a schedule'],
|
|
29
|
+
[/^\/agents\/[^/]+\/actauth/, 'Changed permissions'],
|
|
30
|
+
[/^\/agents\/[^/]+\/tools\/http/, 'Changed HTTP tools'],
|
|
31
|
+
[/^\/agents\/[^/]+\/gateway-tools/, 'Changed app tools'],
|
|
32
|
+
[/^\/agents\/[^/]+\/apps\//, 'Changed apps'],
|
|
33
|
+
[/^\/agents\/[^/]+\/skills\//, 'Changed skills'],
|
|
34
|
+
[/^\/agents\/[^/]+\/abilities/, 'Changed abilities'],
|
|
35
|
+
[/^\/agents\/[^/]+\/notifier/, 'Changed the messaging app'],
|
|
36
|
+
[/^\/agents\/[^/]+\/env/, 'Changed agent secrets'],
|
|
37
|
+
[/^\/config\/policies$/, 'Changed shared policies'],
|
|
38
|
+
[/^\/config\/models/, 'Changed models'],
|
|
39
|
+
[/^\/config\/time-zone$/, 'Changed the time zone'],
|
|
40
|
+
[/^\/config\/apps/, 'Changed apps'],
|
|
41
|
+
[/^\/config\/gateways/, 'Changed the app gateway'],
|
|
42
|
+
[/^\/config\/upgrade$/, 'Upgraded LoopEngine'],
|
|
43
|
+
[/^\/abilities\//, 'Changed workspace abilities'],
|
|
44
|
+
];
|
|
45
|
+
/** The change a request makes, or undefined when it doesn't change a
|
|
46
|
+
* setting. */
|
|
47
|
+
export function changeOf(method, path) {
|
|
48
|
+
if (method !== 'POST' && method !== 'PUT' && method !== 'PATCH' && method !== 'DELETE')
|
|
49
|
+
return undefined;
|
|
50
|
+
if (NOT_CHANGES.some((pattern) => pattern.test(path)))
|
|
51
|
+
return undefined;
|
|
52
|
+
for (const [pattern, label] of LABELS) {
|
|
53
|
+
const m = path.match(pattern);
|
|
54
|
+
if (!m)
|
|
55
|
+
continue;
|
|
56
|
+
const agent = path.match(/^\/agents\/([^/]+)/)?.[1];
|
|
57
|
+
const workflowId = path.match(/^\/agents\/[^/]+\/workflows\/([^/]+)/)?.[1];
|
|
58
|
+
return {
|
|
59
|
+
label: typeof label === 'string' ? label : label(method, m),
|
|
60
|
+
...(agent ? { agent: decodeURIComponent(agent) } : {}),
|
|
61
|
+
...(workflowId ? { workflowId } : {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const SECRET_KEY = /secret|token|password|passwd|api[_-]?key|authorization|credential|private|^value$|^key$/i;
|
|
67
|
+
const MAX_TEXT = 4000;
|
|
68
|
+
/** A body as kept in the log: secret-looking fields blanked, long text
|
|
69
|
+
* cut. Secrets' bodies are dropped whole. */
|
|
70
|
+
export function keptBody(path, body) {
|
|
71
|
+
if (/\/env(\/|$)/.test(path))
|
|
72
|
+
return undefined;
|
|
73
|
+
return redact(body, 0);
|
|
74
|
+
}
|
|
75
|
+
function redact(value, depth) {
|
|
76
|
+
if (depth > 6)
|
|
77
|
+
return '…';
|
|
78
|
+
if (typeof value === 'string')
|
|
79
|
+
return value.length > MAX_TEXT ? value.slice(0, MAX_TEXT) + '…' : value;
|
|
80
|
+
if (Array.isArray(value))
|
|
81
|
+
return value.slice(0, 100).map((v) => redact(v, depth + 1));
|
|
82
|
+
if (value && typeof value === 'object') {
|
|
83
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, SECRET_KEY.test(k) && v ? '(hidden)' : redact(v, depth + 1)]));
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
@@ -101,8 +101,28 @@ export declare function setDefaultModelsFile(path: string | null): void;
|
|
|
101
101
|
*/
|
|
102
102
|
export declare function readModelsFile(): {
|
|
103
103
|
models: Partial<Record<ModelProviderInfo['provider'], string[]>>;
|
|
104
|
+
prices: ModelPrices;
|
|
104
105
|
error?: string;
|
|
105
106
|
};
|
|
107
|
+
/** A model's price, in US dollars per million tokens. */
|
|
108
|
+
export interface ModelPrice {
|
|
109
|
+
input: number;
|
|
110
|
+
output: number;
|
|
111
|
+
/** Input read from the provider's prompt cache, where it's cheaper. */
|
|
112
|
+
cachedInput?: number;
|
|
113
|
+
}
|
|
114
|
+
/** provider -> model -> price, from models.yaml's `prices` section:
|
|
115
|
+
*
|
|
116
|
+
* prices:
|
|
117
|
+
* openai:
|
|
118
|
+
* gpt-6.2-sol: { input: 5, output: 40, cached_input: 0.5 }
|
|
119
|
+
*
|
|
120
|
+
* The workspace's file overrides the shipped one model by model. */
|
|
121
|
+
export type ModelPrices = Record<string, Record<string, ModelPrice>>;
|
|
122
|
+
/** The price of a provider's model, or undefined when none is listed. */
|
|
123
|
+
export declare function modelPrice(provider: string | undefined, model: string | undefined): ModelPrice | undefined;
|
|
124
|
+
/** What a call cost in US dollars, or undefined without a price. */
|
|
125
|
+
export declare function callCost(provider: string | undefined, model: string | undefined, inputTokens: number, outputTokens: number): number | undefined;
|
|
106
126
|
/**
|
|
107
127
|
* The models a provider offers, for the model dropdown in the New agent
|
|
108
128
|
* and Model forms. A provider listed in models.yaml, the workspace's or
|
|
@@ -169,7 +169,45 @@ export function readModelsFile() {
|
|
|
169
169
|
const path = modelsFilePath();
|
|
170
170
|
const own = path === defaultModelsFile ? { models: {} } : parseModelsFile(path, process.env[MODELS_FILE_ENV]?.trim() || 'models.yaml');
|
|
171
171
|
const error = [shipped.error, own.error].filter(Boolean).join(' ');
|
|
172
|
-
|
|
172
|
+
const prices = {};
|
|
173
|
+
for (const from of [shipped.prices, own.prices]) {
|
|
174
|
+
for (const [provider, models] of Object.entries(from ?? {}))
|
|
175
|
+
prices[provider] = { ...prices[provider], ...models };
|
|
176
|
+
}
|
|
177
|
+
return { models: { ...shipped.models, ...own.models }, prices, ...(error ? { error } : {}) };
|
|
178
|
+
}
|
|
179
|
+
/** The price of a provider's model, or undefined when none is listed. */
|
|
180
|
+
export function modelPrice(provider, model) {
|
|
181
|
+
if (!provider || !model)
|
|
182
|
+
return undefined;
|
|
183
|
+
return readModelsFile().prices[provider]?.[model];
|
|
184
|
+
}
|
|
185
|
+
/** What a call cost in US dollars, or undefined without a price. */
|
|
186
|
+
export function callCost(provider, model, inputTokens, outputTokens) {
|
|
187
|
+
const price = modelPrice(provider, model);
|
|
188
|
+
return price ? (inputTokens * price.input + outputTokens * price.output) / 1_000_000 : undefined;
|
|
189
|
+
}
|
|
190
|
+
function parsePrices(value, name) {
|
|
191
|
+
if (value == null)
|
|
192
|
+
return { prices: {} };
|
|
193
|
+
const bad = { prices: {}, error: `${name}: 'prices' should map each provider to its models, each { input, output } in US dollars per million tokens.` };
|
|
194
|
+
if (typeof value !== 'object' || Array.isArray(value))
|
|
195
|
+
return bad;
|
|
196
|
+
const prices = {};
|
|
197
|
+
for (const [provider, models] of Object.entries(value)) {
|
|
198
|
+
if (models == null)
|
|
199
|
+
continue;
|
|
200
|
+
if (typeof models !== 'object' || Array.isArray(models))
|
|
201
|
+
return bad;
|
|
202
|
+
for (const [model, p] of Object.entries(models)) {
|
|
203
|
+
const r = p;
|
|
204
|
+
const num = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0;
|
|
205
|
+
if (!r || typeof r !== 'object' || !num(r.input) || !num(r.output) || (r.cached_input !== undefined && !num(r.cached_input)))
|
|
206
|
+
return bad;
|
|
207
|
+
(prices[provider] ??= {})[model] = { input: r.input, output: r.output, ...(r.cached_input !== undefined ? { cachedInput: r.cached_input } : {}) };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return { prices };
|
|
173
211
|
}
|
|
174
212
|
function parseModelsFile(path, name) {
|
|
175
213
|
if (!existsSync(path))
|
|
@@ -185,8 +223,12 @@ function parseModelsFile(path, name) {
|
|
|
185
223
|
return { models: {} };
|
|
186
224
|
if (typeof data !== 'object' || Array.isArray(data))
|
|
187
225
|
return { models: {}, error: `${name} should map each provider to a list of models.` };
|
|
226
|
+
const { prices: priceSection, ...lists } = data;
|
|
227
|
+
const parsedPrices = parsePrices(priceSection, name);
|
|
228
|
+
if (parsedPrices.error)
|
|
229
|
+
return { models: {}, error: parsedPrices.error };
|
|
188
230
|
const models = {};
|
|
189
|
-
for (const [provider, list] of Object.entries(
|
|
231
|
+
for (const [provider, list] of Object.entries(lists)) {
|
|
190
232
|
if (!modelKeyEnvVar(provider)) {
|
|
191
233
|
return { models: {}, error: `${name}: unknown provider '${provider}'. Use one of ${KNOWN_PROVIDERS.map((p) => p.provider).join(', ')}.` };
|
|
192
234
|
}
|
|
@@ -198,7 +240,7 @@ function parseModelsFile(path, name) {
|
|
|
198
240
|
}
|
|
199
241
|
models[provider] = [...new Set(list.map((m) => m.trim()))];
|
|
200
242
|
}
|
|
201
|
-
return { models };
|
|
243
|
+
return { models, prices: parsedPrices.prices };
|
|
202
244
|
}
|
|
203
245
|
/**
|
|
204
246
|
* The models a provider offers, for the model dropdown in the New agent
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Message } from '../core/run-agent.js';
|
|
2
|
+
import type { UsageRow } from '../core/usage.js';
|
|
2
3
|
import type { WorkflowRun } from '../core/workflow-runs.js';
|
|
3
4
|
/** An open approval or question, as listAgentPending gives it. */
|
|
4
5
|
export interface InboxPending {
|
|
@@ -16,6 +17,10 @@ export interface InboxDeps {
|
|
|
16
17
|
pending(): Promise<InboxPending[]>;
|
|
17
18
|
history(run: WorkflowRun): Promise<Message[]>;
|
|
18
19
|
workflowTitle(agent: string, workflowId: string): string | undefined;
|
|
20
|
+
/** A run by id, including one too old for runs() (an archived case). */
|
|
21
|
+
run?(runId: string): Promise<WorkflowRun | undefined>;
|
|
22
|
+
/** The run's model calls, oldest first (core/usage.ts). */
|
|
23
|
+
usage?(run: WorkflowRun): UsageRow[];
|
|
19
24
|
}
|
|
20
25
|
/** One row in the list. */
|
|
21
26
|
export interface InboxItem {
|
|
@@ -47,7 +52,7 @@ export declare function listInbox(deps: InboxDeps, filter?: {
|
|
|
47
52
|
}[];
|
|
48
53
|
}>;
|
|
49
54
|
/** A step in a case's timeline. */
|
|
50
|
-
export type InboxStep = {
|
|
55
|
+
export type InboxStep = ({
|
|
51
56
|
kind: 'text';
|
|
52
57
|
text: string;
|
|
53
58
|
} | {
|
|
@@ -60,12 +65,37 @@ export type InboxStep = {
|
|
|
60
65
|
kind: 'question';
|
|
61
66
|
question: string;
|
|
62
67
|
answer?: string;
|
|
68
|
+
}) & {
|
|
69
|
+
/** On the first step of each model reply: that model call. */
|
|
70
|
+
call?: {
|
|
71
|
+
inputTokens: number;
|
|
72
|
+
outputTokens: number;
|
|
73
|
+
durationMs?: number;
|
|
74
|
+
model?: string;
|
|
75
|
+
costUsd?: number;
|
|
76
|
+
};
|
|
77
|
+
/** On the first tool or question step of a reply: the time from the
|
|
78
|
+
* end of that model call to the start of the next (the tools running,
|
|
79
|
+
* or a person deciding). */
|
|
80
|
+
waitMs?: number;
|
|
63
81
|
};
|
|
82
|
+
/** A case's totals, from its model calls. */
|
|
83
|
+
export interface InboxTotals {
|
|
84
|
+
calls: number;
|
|
85
|
+
inputTokens: number;
|
|
86
|
+
outputTokens: number;
|
|
87
|
+
/** Time spent in model calls. */
|
|
88
|
+
modelMs: number;
|
|
89
|
+
/** Start to finish (or to now, for one still open). */
|
|
90
|
+
elapsedMs?: number;
|
|
91
|
+
/** US dollars, when every call's model has a price. */
|
|
92
|
+
costUsd?: number;
|
|
93
|
+
}
|
|
64
94
|
/** What the agent did, in order: its words, the tools it used with what
|
|
65
95
|
* came back, and the questions it asked with their answers. The run's
|
|
66
96
|
* first message (its instructions) is left out; its inputs are shown
|
|
67
97
|
* apart. */
|
|
68
|
-
export declare function timelineOf(history: Message[]): InboxStep[];
|
|
98
|
+
export declare function timelineOf(history: Message[], usage?: UsageRow[]): InboxStep[];
|
|
69
99
|
export interface InboxCase {
|
|
70
100
|
id: string;
|
|
71
101
|
title: string;
|
|
@@ -79,5 +109,7 @@ export interface InboxCase {
|
|
|
79
109
|
options?: string[];
|
|
80
110
|
})[];
|
|
81
111
|
steps: InboxStep[];
|
|
112
|
+
totals?: InboxTotals;
|
|
82
113
|
}
|
|
114
|
+
export declare function totalsOf(run: WorkflowRun, usage: UsageRow[]): InboxTotals | undefined;
|
|
83
115
|
export declare function getInboxCase(deps: InboxDeps, id: string): Promise<InboxCase | undefined>;
|