loopengine 0.5.10 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/agents-list-page.js +167 -127
- package/dist/web/audit-page.js +59 -40
- package/dist/web/goals-page.js +483 -372
- package/dist/web/inbox-page.js +38 -40
- package/dist/web/workflows-overview-page.js +102 -74
- package/package.json +1 -1
package/dist/web/inbox-page.js
CHANGED
|
@@ -22,43 +22,42 @@ export const inboxPageHtml = `<!doctype html>
|
|
|
22
22
|
<title>Inbox</title>
|
|
23
23
|
<style>${devUiCss}
|
|
24
24
|
.ib { max-width: 980px; display: grid; gap: 16px; }
|
|
25
|
-
.ib-
|
|
26
|
-
.ib-bar select, .ib-bar input { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
|
|
27
|
-
.ib-bar input { flex: 1; min-width: 160px; }
|
|
28
|
-
.ib-state { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); }
|
|
25
|
+
.ib-state { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--ink-muted); white-space: nowrap; }
|
|
29
26
|
.ib-state.warn { background: var(--warn-soft); color: var(--warn); }
|
|
30
27
|
.ib-state.good { background: var(--good-soft); color: var(--good); }
|
|
31
28
|
.ib-state.bad { background: var(--bad-soft); color: var(--bad); }
|
|
32
29
|
.ib-state.run { background: var(--accent-soft); color: var(--accent-ink); }
|
|
33
30
|
body[data-le-page="inbox"] .le-page { max-width: 1320px; }
|
|
34
31
|
.ib.is-inbox { max-width: none; }
|
|
35
|
-
.ib-
|
|
36
|
-
.ib-tabs
|
|
37
|
-
.ib-tabs
|
|
38
|
-
.ib-
|
|
32
|
+
.ib-topbar { flex-wrap: wrap; row-gap: 8px; }
|
|
33
|
+
.ib-tabs { flex-wrap: wrap; }
|
|
34
|
+
.ib-tabs .ib-count { margin-left: 6px; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-muted); }
|
|
35
|
+
.ib-select { height: 36px; padding: 0 10px; border-radius: 10px; border: 0; background: var(--surface); font-size: 13px; color: var(--ink); max-width: 220px; }
|
|
39
36
|
.ib-tabs button[data-view="needs"] .ib-count.on { background: var(--warn-soft); color: var(--warn); }
|
|
40
|
-
|
|
41
|
-
.ib-
|
|
42
|
-
.ib-
|
|
43
|
-
.ib-item
|
|
44
|
-
.ib-item
|
|
45
|
-
.ib-item.is-
|
|
46
|
-
.ib-item-
|
|
37
|
+
/* The list and the open conversation side by side, in one hairline grid. */
|
|
38
|
+
.ib-split { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); align-items: stretch; }
|
|
39
|
+
.ib-items { display: grid; align-content: start; max-height: calc(100vh - 150px); overflow: auto; background: var(--bg); }
|
|
40
|
+
.ib-item { position: relative; display: grid; gap: 6px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; transition: background .15s; }
|
|
41
|
+
.ib-item:hover { background: var(--surface); }
|
|
42
|
+
.ib-item.is-selected { background: var(--surface); }
|
|
43
|
+
.ib-item.is-selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink); }
|
|
44
|
+
.ib-item.is-needs .ib-item-title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
|
|
45
|
+
.ib-item-title { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
|
|
47
46
|
.ib-item-meta { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
48
47
|
.ib-item .ib-state { justify-self: start; }
|
|
49
48
|
.ib-item-summary { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
|
|
50
49
|
.ib-item-time { font-size: 12px; color: var(--ink-faint); }
|
|
51
50
|
.ib-item-time.late { color: var(--warn); font-weight: 700; }
|
|
52
|
-
.ib-thread {
|
|
51
|
+
.ib-thread { background: var(--bg); min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100vh - 150px); }
|
|
53
52
|
.ib-thread-empty { padding: 48px 24px; text-align: center; color: var(--ink-muted); font-size: 13.5px; }
|
|
54
|
-
.ib-thread-head { display: grid; gap:
|
|
55
|
-
.ib-thread-head h2 { margin: 0; font-size:
|
|
53
|
+
.ib-thread-head { display: grid; gap: 8px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
|
|
54
|
+
.ib-thread-head h2 { margin: 0; font-size: 22px; font-weight: 400; letter-spacing: -0.02em; overflow-wrap: anywhere; }
|
|
56
55
|
.ib-thread-top { display: flex; align-items: flex-start; gap: 10px; }
|
|
57
56
|
.ib-thread-top h2 { flex: 1; min-width: 0; }
|
|
58
57
|
.ib-thread-tools { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
|
|
59
|
-
.ib-thread-tools a, .ib-thread-tools button { height: 30px; padding: 0 12px; border-radius:
|
|
58
|
+
.ib-thread-tools a, .ib-thread-tools button { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
|
|
60
59
|
.ib-thread-tools .ib-thread-back { display: none; }
|
|
61
|
-
.ib-msgs { list-style: none; margin: 0; padding:
|
|
60
|
+
.ib-msgs { list-style: none; margin: 0; padding: 18px 22px 22px; display: grid; gap: 12px; overflow: auto; align-content: start; }
|
|
62
61
|
.ib-msg { display: grid; gap: 4px; max-width: 86%; min-width: 0; }
|
|
63
62
|
.ib-msg.person { justify-self: end; justify-items: end; }
|
|
64
63
|
.ib-msg.system { justify-self: center; justify-items: center; max-width: 100%; }
|
|
@@ -98,8 +97,10 @@ export const inboxPageHtml = `<!doctype html>
|
|
|
98
97
|
.ib-split:not(.has-thread) .ib-thread { display: none; }
|
|
99
98
|
.ib-thread-tools .ib-thread-back { display: inline-flex; }
|
|
100
99
|
.ib-items, .ib-thread { max-height: none; }
|
|
100
|
+
.ib-split { grid-template-columns: minmax(0, 1fr); }
|
|
101
|
+
.le-search { min-width: 0; flex: 1; }
|
|
101
102
|
}
|
|
102
|
-
.ib-empty { padding:
|
|
103
|
+
.ib-empty { margin: 0; padding: 36px 20px; text-align: center; color: var(--ink-muted); font-size: 13.5px; }
|
|
103
104
|
.ib-link { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
|
|
104
105
|
.ib-link:hover { text-decoration: underline; }
|
|
105
106
|
.ib-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-muted); }
|
|
@@ -114,7 +115,7 @@ export const inboxPageHtml = `<!doctype html>
|
|
|
114
115
|
.ib-card textarea { width: 100%; box-sizing: border-box; min-height: 80px; font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
|
|
115
116
|
.ib-card textarea.mono { font-family: var(--font-mono); font-size: 12.5px; min-height: 200px; }
|
|
116
117
|
.ib-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
117
|
-
.ib-btn { height: 34px; padding: 0 14px; border-radius:
|
|
118
|
+
.ib-btn { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); cursor: pointer; }
|
|
118
119
|
.ib-btn.plain { background: none; border-color: var(--line); color: var(--ink); font-weight: 500; }
|
|
119
120
|
.ib-btn.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
|
|
120
121
|
.ib-btn.opt { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 500; }
|
|
@@ -146,13 +147,14 @@ export const inboxPageHtml = `<!doctype html>
|
|
|
146
147
|
<div class="le-app">
|
|
147
148
|
${consoleSidebarHtml}
|
|
148
149
|
<main class="le-main">
|
|
149
|
-
<
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
155
|
-
|
|
150
|
+
<header class="le-topbar ib-topbar">
|
|
151
|
+
<button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>
|
|
152
|
+
<h1 class="le-topbar-title">Inbox</h1>
|
|
153
|
+
<span class="le-seg ib-tabs" role="tablist" aria-label="Show"></span>
|
|
154
|
+
<span class="le-topbar-gap"></span>
|
|
155
|
+
<select id="ibWorkflow" class="ib-select" aria-label="Workflow"><option value="">All workflows</option></select>
|
|
156
|
+
<label class="le-search"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg><input id="ibSearch" type="search" placeholder="Search conversations" aria-label="Search conversations, inputs or people"></label>
|
|
157
|
+
</header>
|
|
156
158
|
<div class="le-scroll"><div class="le-page"><div class="ib" id="ibPage"><p class="hint">Loading…</p></div></div></div>
|
|
157
159
|
</main>
|
|
158
160
|
</div>
|
|
@@ -267,21 +269,17 @@ ${renderMarkdownScript}
|
|
|
267
269
|
function renderInbox() {
|
|
268
270
|
page.classList.add('is-inbox');
|
|
269
271
|
page.innerHTML =
|
|
270
|
-
'<div class="ib-
|
|
271
|
-
'<div class="ib-bar">' +
|
|
272
|
-
'<select id="ibWorkflow" aria-label="Workflow"><option value="">All workflows</option></select>' +
|
|
273
|
-
'<input id="ibSearch" type="search" placeholder="Search conversations, inputs or people" value="' + esc(state.q) + '" aria-label="Search">' +
|
|
274
|
-
'</div>' +
|
|
275
|
-
'<div class="ib-split"><div class="ib-items" role="list"><p class="hint">Loading' + ELLIPSIS + '</p></div>' +
|
|
272
|
+
'<div class="ib-split le-grid"><div class="ib-items" role="list"><p class="hint" style="padding:16px">Loading' + ELLIPSIS + '</p></div>' +
|
|
276
273
|
'<section class="ib-thread" aria-live="polite"><div class="ib-thread-empty">Pick a conversation to see it here.</div></section></div>';
|
|
277
|
-
|
|
274
|
+
document.getElementById('ibSearch').value = state.q;
|
|
275
|
+
document.querySelector('.ib-tabs').addEventListener('click', function (ev) {
|
|
278
276
|
var b = ev.target.closest('[data-view]');
|
|
279
277
|
if (!b) return;
|
|
280
278
|
state.view = b.getAttribute('data-view');
|
|
281
279
|
refreshList();
|
|
282
280
|
});
|
|
283
|
-
|
|
284
|
-
var search =
|
|
281
|
+
document.getElementById('ibWorkflow').addEventListener('change', function (ev) { state.workflow = ev.currentTarget.value; refreshList(); });
|
|
282
|
+
var search = document.getElementById('ibSearch');
|
|
285
283
|
var timer = null;
|
|
286
284
|
search.addEventListener('input', function () {
|
|
287
285
|
clearTimeout(timer);
|
|
@@ -301,12 +299,12 @@ ${renderMarkdownScript}
|
|
|
301
299
|
(data.workflows || []).forEach(function (w) { workflows[w.id] = w.title; });
|
|
302
300
|
state.view = data.view || state.view || 'all';
|
|
303
301
|
var counts = data.counts || {};
|
|
304
|
-
|
|
302
|
+
document.querySelector('.ib-tabs').innerHTML = VIEWS.map(function (v) {
|
|
305
303
|
var n = counts[v[0]];
|
|
306
304
|
return '<button type="button" role="tab" data-view="' + v[0] + '" aria-selected="' + (state.view === v[0]) + '">' + v[1] +
|
|
307
305
|
(n ? '<span class="ib-count' + (v[0] === 'needs' ? ' on' : '') + '">' + n + '</span>' : '') + '</button>';
|
|
308
306
|
}).join('');
|
|
309
|
-
var select =
|
|
307
|
+
var select = document.getElementById('ibWorkflow');
|
|
310
308
|
select.innerHTML = '<option value="">All workflows</option>' + Object.keys(workflows).sort(function (a, b) { return workflows[a].localeCompare(workflows[b]); })
|
|
311
309
|
.map(function (id) { return '<option value="' + esc(id) + '"' + (id === state.workflow ? ' selected' : '') + '>' + esc(workflows[id]) + '</option>'; }).join('');
|
|
312
310
|
var box = page.querySelector('.ib-items');
|
|
@@ -5,70 +5,90 @@
|
|
|
5
5
|
// template placeholders, since it lives inside a template literal.
|
|
6
6
|
import { devUiCss } from './dev-ui-styles.js';
|
|
7
7
|
import { consoleShellScript, consoleSidebarHtml } from './console-shell.js';
|
|
8
|
+
import { MASCOT_CSS, mascotSvg } from './mascot.js';
|
|
8
9
|
export const workflowsOverviewPageHtml = `<!doctype html>
|
|
9
10
|
<html lang="en">
|
|
10
11
|
<head>
|
|
11
12
|
<meta charset="utf-8">
|
|
12
13
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
13
14
|
<title>Workflows</title>
|
|
14
|
-
<style>${devUiCss}
|
|
15
|
-
.wo { max-width:
|
|
16
|
-
.wo-
|
|
17
|
-
.wo-
|
|
18
|
-
|
|
19
|
-
.wo-
|
|
20
|
-
.wo-stat
|
|
21
|
-
.wo-stat
|
|
15
|
+
<style>${devUiCss}${MASCOT_CSS}
|
|
16
|
+
.wo { max-width: 1120px; display: grid; gap: 0; }
|
|
17
|
+
.wo-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 36px 32px 28px; border: 1px solid var(--line); border-bottom: 0; }
|
|
18
|
+
.wo-hero .le-mascot { flex: none; margin-bottom: -6px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .12)); }
|
|
19
|
+
.wo-cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
20
|
+
.wo-cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
21
|
+
.wo-stat { padding: 20px 22px; background: var(--bg); display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
|
|
22
|
+
a.wo-stat:hover { background: var(--surface); }
|
|
23
|
+
.wo-stat b { font-size: 34px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
|
|
24
|
+
.wo-stat span { font-size: 13px; color: var(--ink-muted); }
|
|
22
25
|
.wo-stat.warn b { color: var(--warn); }
|
|
23
|
-
.wo-
|
|
24
|
-
.wo-
|
|
25
|
-
.wo-
|
|
26
|
-
.wo-
|
|
27
|
-
.wo-
|
|
28
|
-
.wo-
|
|
29
|
-
.wo-
|
|
30
|
-
.wo-
|
|
31
|
-
.wo-
|
|
32
|
-
.wo-
|
|
33
|
-
.wo-
|
|
34
|
-
.wo-
|
|
35
|
-
.wo-
|
|
36
|
-
.wo-
|
|
37
|
-
.wo-
|
|
38
|
-
.wo-
|
|
39
|
-
.wo-
|
|
40
|
-
.wo-
|
|
41
|
-
.wo-
|
|
42
|
-
.wo-
|
|
43
|
-
.wo-
|
|
44
|
-
.wo-
|
|
45
|
-
.wo-
|
|
26
|
+
.wo-stat.bad b { color: var(--bad); }
|
|
27
|
+
.wo-section-title { margin: 0; padding: 30px 32px 16px; font-size: 22px; font-weight: 400; letter-spacing: -0.02em; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
|
|
28
|
+
.wo-card { display: grid; gap: 14px; align-content: start; padding: 20px 22px; background: var(--bg); }
|
|
29
|
+
.wo-card-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
|
|
30
|
+
.wo-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-muted); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
|
|
31
|
+
.wo-icon svg { width: 16px; height: 16px; }
|
|
32
|
+
.wo-icon.live { color: var(--good); }
|
|
33
|
+
.wo-card-text { display: grid; gap: 3px; min-width: 0; }
|
|
34
|
+
.wo-card-title { font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
|
|
35
|
+
a.wo-card-title:hover { text-decoration: underline; }
|
|
36
|
+
.wo-card-desc { font-size: 13px; color: var(--ink-muted); }
|
|
37
|
+
.wo-open { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--ink); background: var(--bg); }
|
|
38
|
+
.wo-open:hover { background: var(--surface); }
|
|
39
|
+
.wo-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
40
|
+
.wo-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); white-space: nowrap; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
41
|
+
.wo-chip.strong { background: var(--surface); border-color: transparent; color: var(--ink); font-weight: 500; }
|
|
42
|
+
.wo-chip.good { background: var(--good-soft); border-color: transparent; color: var(--good); font-weight: 600; }
|
|
43
|
+
.wo-chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); font-weight: 600; }
|
|
44
|
+
.wo-chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); font-weight: 600; }
|
|
45
|
+
.wo-chip.run { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
|
|
46
|
+
.wo-chip-k { color: var(--ink-faint); font-weight: 400; margin-right: 6px; }
|
|
47
|
+
a.wo-chip:hover { color: var(--ink); border-color: var(--ink-faint); }
|
|
48
|
+
.wo-next { font-size: 12px; color: var(--ink-faint); margin-left: 4px; white-space: nowrap; }
|
|
49
|
+
.wo-tile { display: grid; gap: 6px; align-content: start; padding: 22px; background: var(--bg); text-decoration: none; color: inherit; transition: background .15s; }
|
|
50
|
+
.wo-tile:hover { background: var(--surface); }
|
|
51
|
+
.wo-tile b { font-size: 15px; font-weight: 600; color: var(--ink); }
|
|
52
|
+
.wo-tile span { font-size: 13px; color: var(--ink-muted); line-height: 1.45; }
|
|
53
|
+
.wo-filler { background: var(--bg); }
|
|
54
|
+
.wo-empty { padding: 40px 32px; text-align: center; color: var(--ink-muted); font-size: 14px; background: var(--bg); grid-column: 1 / -1; margin: 0; }
|
|
46
55
|
.hint { font-size: 12.5px; color: var(--ink-muted); }
|
|
47
56
|
.error { font-size: 13px; color: var(--bad); margin: 0; }
|
|
48
|
-
@media (max-width:
|
|
57
|
+
@media (max-width: 860px) {
|
|
58
|
+
.wo-hero { padding: 24px 18px 20px; }
|
|
59
|
+
.wo-hero .le-mascot { display: none; }
|
|
60
|
+
.wo-cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
61
|
+
.wo-cols2 { grid-template-columns: minmax(0, 1fr); }
|
|
62
|
+
.wo-section-title { padding: 24px 18px 14px; }
|
|
63
|
+
.le-search { display: none; }
|
|
64
|
+
}
|
|
49
65
|
</style>
|
|
50
66
|
</head>
|
|
51
67
|
<body data-le-page="workflows-overview">
|
|
52
68
|
<div class="le-app">
|
|
53
69
|
${consoleSidebarHtml}
|
|
54
70
|
<main class="le-main">
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</div>
|
|
71
|
+
<header class="le-topbar">
|
|
72
|
+
<button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>
|
|
73
|
+
<h1 class="le-topbar-title">Workflows</h1>
|
|
74
|
+
<span class="le-topbar-gap"></span>
|
|
75
|
+
<label class="le-search"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg><input type="search" id="woSearch" placeholder="Search workflows" aria-label="Search workflows"></label>
|
|
76
|
+
<a class="le-btn-dark" href="/workflows/new">+ New workflow</a>
|
|
77
|
+
</header>
|
|
63
78
|
<div class="le-scroll"><div class="le-page"><div class="wo" id="woPage"><p class="hint">Loading…</p></div></div></div>
|
|
64
79
|
</main>
|
|
65
80
|
</div>
|
|
81
|
+
<template id="woMascot">${mascotSvg(92)}</template>
|
|
66
82
|
${consoleShellScript}
|
|
67
83
|
<script>
|
|
68
84
|
(function () {
|
|
69
85
|
var page = document.getElementById('woPage');
|
|
86
|
+
var search = document.getElementById('woSearch');
|
|
87
|
+
var mascot = document.getElementById('woMascot').innerHTML;
|
|
70
88
|
var DOT = ' ' + String.fromCharCode(183) + ' ';
|
|
71
89
|
var esc = window.leShell.esc;
|
|
90
|
+
var ICON_FLOW = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="8" height="8" rx="2"/><rect x="13" y="13" width="8" height="8" rx="2"/><path d="M7 11v3a3 3 0 0 0 3 3h3"/></svg>';
|
|
91
|
+
var data = null;
|
|
72
92
|
|
|
73
93
|
function ago(iso) {
|
|
74
94
|
var s = Math.max(0, (Date.now() - Date.parse(iso)) / 1000);
|
|
@@ -77,59 +97,67 @@ ${consoleShellScript}
|
|
|
77
97
|
if (s < 86400) return Math.round(s / 3600) + ' h ago';
|
|
78
98
|
return Math.round(s / 86400) + ' d ago';
|
|
79
99
|
}
|
|
80
|
-
function
|
|
81
|
-
if (w.waiting) return '<
|
|
82
|
-
if (!w.lastRun) return '<span class="wo-
|
|
100
|
+
function lastRunChip(w) {
|
|
101
|
+
if (w.waiting) return '<a class="wo-chip warn" href="/inbox?view=needs">' + w.waiting + ' waiting for you</a>';
|
|
102
|
+
if (!w.lastRun) return '<span class="wo-chip">Not run yet</span>';
|
|
83
103
|
var st = w.lastRun.status;
|
|
84
|
-
if (st === 'running') return '<span class="wo-
|
|
85
|
-
if (st === 'error') return '<span class="wo-
|
|
86
|
-
if (st === 'awaiting_approval') return '<span class="wo-
|
|
87
|
-
return '<span class="wo-
|
|
104
|
+
if (st === 'running') return '<span class="wo-chip run">Running now</span>';
|
|
105
|
+
if (st === 'error') return '<span class="wo-chip bad">Last run failed</span>';
|
|
106
|
+
if (st === 'awaiting_approval') return '<span class="wo-chip warn">Waiting</span>';
|
|
107
|
+
return '<span class="wo-chip good">Last run done</span>';
|
|
88
108
|
}
|
|
89
109
|
function href(w) {
|
|
90
110
|
return '/agents/config?agent=' + encodeURIComponent(w.agent) + '&tab=workflows&workflow=' + encodeURIComponent(w.id);
|
|
91
111
|
}
|
|
92
112
|
function plural(n, one, many) { return n + ' ' + (n === 1 ? one : many); }
|
|
113
|
+
function hero(sub) {
|
|
114
|
+
return '<div class="wo-hero"><div><h2 class="le-display">Your workflows</h2><p class="le-display-sub">' + sub + '</p></div>' + mascot + '</div>';
|
|
115
|
+
}
|
|
116
|
+
var TILES = '<a class="wo-tile" href="/workflows/new"><b>Describe a workflow</b><span>Say what the agent should do in a sentence or two, and review the plan.</span></a>' +
|
|
117
|
+
'<a class="wo-tile" href="/workflows/new#examples"><b>Start from an example</b><span>A ready-made workflow for a common task.</span></a>';
|
|
93
118
|
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
'<
|
|
99
|
-
'<
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
function cardHtml(w) {
|
|
120
|
+
var decided = w.approved + w.refused;
|
|
121
|
+
return '<div class="wo-card">' +
|
|
122
|
+
'<div class="wo-card-head"><span class="wo-icon' + (w.live ? ' live' : '') + '">' + ICON_FLOW + '</span>' +
|
|
123
|
+
'<span class="wo-card-text"><a class="wo-card-title" href="' + href(w) + '">' + esc(w.title) + '</a>' +
|
|
124
|
+
'<span class="wo-card-desc">' + plural(w.runsThisWeek, 'run', 'runs') + ' this week' + (w.failedThisWeek ? ', <span style="color:var(--bad)">' + w.failedThisWeek + ' failed</span>' : '') + (decided ? DOT + w.approved + ' of ' + decided + ' approved' : '') + '</span></span>' +
|
|
125
|
+
'<a class="wo-open" href="' + href(w) + '">Open</a></div>' +
|
|
126
|
+
'<div class="wo-chips">' + w.starts.map(function (x, i) { var t = x === 'Run now' ? 'when someone runs it' : x; return '<span class="wo-chip' + (i === 0 ? ' strong' : '') + '" title="' + esc(t) + '">' + (i === 0 ? '<span class="wo-chip-k">Starts</span>' : '') + esc(t) + '</span>'; }).join('') +
|
|
127
|
+
'<a class="wo-chip" href="/agents/config?agent=' + encodeURIComponent(w.agent) + '">' + esc(w.agentLabel) + '</a>' +
|
|
128
|
+
lastRunChip(w) + (w.lastRun ? '<span class="wo-next">Last run ' + esc(ago(w.lastRun.at)) + '</span>' : '') + '</div>' +
|
|
129
|
+
'</div>';
|
|
102
130
|
}
|
|
103
131
|
|
|
104
|
-
function render(
|
|
105
|
-
|
|
132
|
+
function render() {
|
|
133
|
+
var d = data;
|
|
134
|
+
if (!d.workflows.length) {
|
|
135
|
+
page.innerHTML = hero('A workflow is how an agent does something again and again: on a schedule, from a webhook or your app. It asks you when it needs to, and every run is kept to check and improve.') +
|
|
136
|
+
'<div class="le-grid wo-cols2">' + TILES + '</div>';
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
106
139
|
var s = d.summary;
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
140
|
+
var q = (search.value || '').trim().toLowerCase();
|
|
141
|
+
var shown = d.workflows.filter(function (w) { return !q || [w.title, w.agentLabel, w.starts.join(' ')].join(' ').toLowerCase().indexOf(q) !== -1; });
|
|
142
|
+
var stats = '<div class="le-grid wo-cols4">' +
|
|
143
|
+
'<a class="wo-stat' + (s.waiting ? ' warn' : '') + '" href="/inbox"><b>' + s.waiting + '</b><span>Waiting for you</span></a>' +
|
|
110
144
|
'<div class="wo-stat"><b>' + s.runsThisWeek + '</b><span>Runs in the last 7 days</span></div>' +
|
|
111
|
-
'<div class="wo-stat"><b>' + s.failedThisWeek + '</b><span>Failed in the last 7 days</span></div>' +
|
|
145
|
+
'<div class="wo-stat' + (s.failedThisWeek ? ' bad' : '') + '"><b>' + s.failedThisWeek + '</b><span>Failed in the last 7 days</span></div>' +
|
|
112
146
|
'<div class="wo-stat"><b>' + s.workflows + '</b><span>' + (s.workflows === 1 ? 'Workflow' : 'Workflows') + '</span></div>' +
|
|
113
147
|
'</div>';
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'<span class="wo-col-runs wo-runs"><span>' + plural(w.runsThisWeek, 'run', 'runs') + ' this week' + (w.failedThisWeek ? ', <span style="color:var(--bad)">' + w.failedThisWeek + ' failed</span>' : '') + '</span>' +
|
|
120
|
-
'<span class="wo-sub">' + (w.lastRun ? 'Last run ' + esc(ago(w.lastRun.at)) : 'Not run yet') + (decided ? DOT + w.approved + ' of ' + decided + ' approved' : '') + '</span></span>' +
|
|
121
|
-
'<span class="wo-side">' + lastRunPill(w) + '</span>' +
|
|
122
|
-
'</a>';
|
|
123
|
-
}).join('');
|
|
124
|
-
page.innerHTML = stats +
|
|
125
|
-
'<div class="wo-list"><div class="wo-row wo-head"><span>Workflow</span><span class="wo-col-starts">Starts</span><span class="wo-col-runs">Runs</span><span>Last run</span></div>' + rows + '</div>';
|
|
148
|
+
var cells = shown.map(cardHtml);
|
|
149
|
+
page.innerHTML = hero(plural(s.workflows, 'workflow', 'workflows') + ': how each one starts, how it' + String.fromCharCode(8217) + 's been going, and what' + String.fromCharCode(8217) + 's waiting for you.') + stats +
|
|
150
|
+
'<h3 class="wo-section-title">All workflows</h3>' +
|
|
151
|
+
'<div class="le-grid wo-cols2">' + (cells.length ? cells.join('') + (cells.length % 2 ? '<div class="wo-filler" aria-hidden="true"></div>' : '') : '<p class="wo-empty">No workflow matches.</p>') + '</div>' +
|
|
152
|
+
(q ? '' : '<h3 class="wo-section-title">Add a workflow</h3><div class="le-grid wo-cols2">' + TILES + '</div>');
|
|
126
153
|
}
|
|
154
|
+
search.addEventListener('input', function () { if (data) render(); });
|
|
127
155
|
|
|
128
156
|
// The sidebar asks for the same list as the page opens: one request.
|
|
129
157
|
(window.leShell && window.leShell.getJson
|
|
130
158
|
? window.leShell.getJson('/workflows/overview').then(function (d) { if (!d) throw new Error('could not reach the server'); return d; })
|
|
131
159
|
: fetch('/workflows/overview', { cache: 'no-store' }).then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); }))
|
|
132
|
-
.then(render)
|
|
160
|
+
.then(function (d) { data = d; render(); })
|
|
133
161
|
.catch(function (err) { page.innerHTML = '<p class="error">Couldn' + String.fromCharCode(8217) + 't load your workflows: ' + esc(err.message) + '</p>'; });
|
|
134
162
|
})();
|
|
135
163
|
</script>
|