loopengine 0.5.4 → 0.5.6
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/messaging/jobs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/web/agents-config-page.js +27 -20
- package/dist/web/agents-list-page.js +32 -4
- package/dist/web/audit-admin.js +3 -3
- package/dist/web/audit-page.js +1 -1
- package/dist/web/console-shell.js +43 -6
- package/dist/web/dev-ui-styles.js +95 -43
- package/dist/web/global-config-page.js +12 -12
- package/dist/web/goals-admin.js +1 -1
- package/dist/web/goals-page.js +7 -3
- package/dist/web/home-page.js +190 -128
- package/dist/web/inbox-admin.js +2 -2
- package/dist/web/inbox-page.js +3 -2
- package/dist/web/interview-page.js +1 -1
- package/dist/web/mascot.d.ts +3 -0
- package/dist/web/mascot.js +32 -0
- package/dist/web/notifier-admin.js +2 -2
- package/dist/web/playground.js +1 -1
- package/dist/web/schedules-page.d.ts +1 -0
- package/dist/web/schedules-page.js +559 -0
- package/dist/web/workflow-evidence.js +3 -3
- package/dist/web/workflow-page.js +3 -3
- package/dist/web/workflows-overview-page.js +1 -1
- package/package.json +1 -1
package/dist/web/home-page.js
CHANGED
|
@@ -1,166 +1,228 @@
|
|
|
1
|
-
// The console's home page (/home)
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// The console's home page (/ and /home). Under its top bar, a two-line
|
|
2
|
+
// question, "What should your agents take care of today?", and the box
|
|
3
|
+
// to answer it in, with the mascot perched on its edge. Two ways to send
|
|
4
|
+
// it: Suggest workflows (the default) starts a goal (web/goals-page.ts,
|
|
5
|
+
// which suggests the workflows it takes), One workflow plans a single one
|
|
6
|
+
// for the agent chosen (web/workflow-page.ts). Under the box, a link to
|
|
7
|
+
// connect apps, three ideas to start from, then what's waiting for you
|
|
8
|
+
// and the latest runs, from the Inbox's data (/inbox/items), each opening
|
|
9
|
+
// its conversation. Every workflow, as a table, is at /workflows.
|
|
6
10
|
// Like the other console pages, its inline script avoids backslashes and
|
|
7
11
|
// template placeholders, since it lives inside a template literal.
|
|
8
12
|
import { devUiCss } from './dev-ui-styles.js';
|
|
9
13
|
import { consoleShellScript, consoleSidebarHtml } from './console-shell.js';
|
|
14
|
+
import { MASCOT_CSS, mascotSvg } from './mascot.js';
|
|
15
|
+
const IDEA_ICONS = {
|
|
16
|
+
mail: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg>',
|
|
17
|
+
chart: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 20V10"/><path d="M10 20V4"/><path d="M16 20v-7"/><path d="M22 20H2"/></svg>',
|
|
18
|
+
invoice: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 2h9l5 5v15H6z"/><path d="M14 2v6h6"/><path d="M9 13h6"/><path d="M9 17h4"/></svg>',
|
|
19
|
+
};
|
|
10
20
|
export const homePageHtml = `<!doctype html>
|
|
11
21
|
<html lang="en">
|
|
12
22
|
<head>
|
|
13
23
|
<meta charset="utf-8">
|
|
14
24
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
15
25
|
<title>Home</title>
|
|
16
|
-
<style>${devUiCss}
|
|
17
|
-
.hm { max-width: 860px; display: grid; gap:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
.hm-
|
|
25
|
-
.hm-
|
|
26
|
-
|
|
27
|
-
.hm-
|
|
28
|
-
.hm-
|
|
29
|
-
.hm-
|
|
30
|
-
.hm-
|
|
31
|
-
.hm-
|
|
32
|
-
.hm-
|
|
33
|
-
.hm-
|
|
34
|
-
.hm-
|
|
35
|
-
.hm-
|
|
36
|
-
.hm-
|
|
37
|
-
.hm-
|
|
38
|
-
.hm-
|
|
39
|
-
.hm-
|
|
40
|
-
.hm-
|
|
41
|
-
.hm-
|
|
42
|
-
.hm-
|
|
43
|
-
.hm-
|
|
44
|
-
.hm-
|
|
45
|
-
.hm-
|
|
46
|
-
.hm-
|
|
47
|
-
.hm-
|
|
48
|
-
.hm-
|
|
49
|
-
.hm-
|
|
50
|
-
.hm-
|
|
51
|
-
.hm-
|
|
52
|
-
.hm-
|
|
53
|
-
.hm-
|
|
54
|
-
|
|
55
|
-
.hm-
|
|
56
|
-
.hm-
|
|
57
|
-
.hm-
|
|
58
|
-
.hm-
|
|
59
|
-
.hm-
|
|
60
|
-
.hm-
|
|
61
|
-
.hm-
|
|
62
|
-
.hm-
|
|
26
|
+
<style>${devUiCss}${MASCOT_CSS}
|
|
27
|
+
.hm { width: 100%; max-width: 860px; margin: 0 auto; display: grid; gap: 44px; padding: 0 0 56px; }
|
|
28
|
+
/* The hero, between two guide lines, with crosses where they end. */
|
|
29
|
+
.hm-hero { position: relative; display: grid; justify-items: center; gap: 0; padding: 7vh 56px 44px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
|
|
30
|
+
.hm-hero::before, .hm-hero::after { content: ""; position: absolute; bottom: -5px; width: 9px; height: 9px; background: linear-gradient(var(--accent), var(--accent)) center / 1px 100% no-repeat, linear-gradient(var(--accent), var(--accent)) center / 100% 1px no-repeat; }
|
|
31
|
+
.hm-hero::before { left: -5px; }
|
|
32
|
+
.hm-hero::after { right: -5px; }
|
|
33
|
+
.hm-q { margin: 0 0 30px; text-align: center; font-size: 40px; line-height: 1.15; font-weight: 400; letter-spacing: -0.03em; }
|
|
34
|
+
.hm-q .soft { display: block; color: var(--ink-faint); }
|
|
35
|
+
.hm-mascot { margin: 0 0 -16px; position: relative; z-index: 1; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .12)); }
|
|
36
|
+
.hm-composer { width: 100%; max-width: 620px; border-radius: 18px; background: var(--surface); padding: 0 0 2px; }
|
|
37
|
+
.hm-box { display: grid; gap: 12px; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); box-shadow: 0 3px 14px rgba(0, 0, 0, .06); transition: border-color .15s, box-shadow .15s; }
|
|
38
|
+
.hm-box:focus-within { border-color: var(--ink-faint); box-shadow: 0 6px 22px rgba(0, 0, 0, .09); }
|
|
39
|
+
.hm-box textarea { border: 0; padding: 2px 2px; min-height: 54px; max-height: 240px; resize: none; font-size: 15.5px; line-height: 1.5; background: none; }
|
|
40
|
+
.hm-box textarea:focus { outline: none; }
|
|
41
|
+
.hm-box-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
42
|
+
.hm-box-foot .le-seg { margin-right: auto; }
|
|
43
|
+
.hm-agent { height: 34px; border: 0; background: none; font-size: 13px; color: var(--ink-muted); padding: 0 6px; }
|
|
44
|
+
.hm-agent[hidden] { display: none; }
|
|
45
|
+
.hm-send { width: 38px; height: 38px; padding: 0; border-radius: 11px; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
|
|
46
|
+
.hm-send:hover:not(:disabled) { background: var(--primary); opacity: .88; }
|
|
47
|
+
.hm-send:disabled { opacity: .3; }
|
|
48
|
+
.hm-send svg { width: 17px; height: 17px; }
|
|
49
|
+
.hm-connect { display: flex; align-items: center; gap: 8px; padding: 10px 16px 9px; font-size: 13px; color: var(--ink-muted); text-decoration: none; }
|
|
50
|
+
.hm-connect:hover { color: var(--ink); }
|
|
51
|
+
.hm-connect svg { width: 15px; height: 15px; flex: none; }
|
|
52
|
+
.hm-ideas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
53
|
+
.hm-top { display: grid; }
|
|
54
|
+
.hm-top .hm-ideas { border-top: 0; }
|
|
55
|
+
.hm-top .hm-ideas::before, .hm-top .hm-ideas::after { display: none; }
|
|
56
|
+
.hm-idea { display: flex; align-items: center; gap: 14px; padding: 22px 20px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: var(--bg); text-align: left; font-size: 14px; line-height: 1.35; color: var(--ink-muted); height: auto; cursor: pointer; transition: background .15s, color .15s; }
|
|
57
|
+
.hm-idea:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
|
|
58
|
+
.hm-idea-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-muted); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
|
|
59
|
+
.hm-idea-icon svg { width: 18px; height: 18px; }
|
|
60
|
+
.hm-section { display: grid; gap: 12px; }
|
|
61
|
+
.hm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
|
|
62
|
+
.hm-label { margin: 0; font-size: 12px; color: var(--ink-faint); font-family: var(--font-mono); }
|
|
63
|
+
.hm-section-head a { font-size: 12.5px; font-weight: 600; color: var(--ink-muted); text-decoration: none; }
|
|
64
|
+
.hm-section-head a:hover { color: var(--ink); }
|
|
65
|
+
.hm-list { grid-template-columns: minmax(0, 1fr); }
|
|
66
|
+
.hm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 18px; color: var(--ink); text-decoration: none; background: var(--bg); }
|
|
67
|
+
.hm-row:hover { background: var(--surface); }
|
|
68
|
+
.hm-row-main { display: grid; gap: 2px; min-width: 0; }
|
|
69
|
+
.hm-row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
70
|
+
.hm-row-sub { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
71
|
+
.hm-row-side { display: grid; justify-items: end; gap: 3px; font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
|
|
72
|
+
.hm-empty { padding: 20px 18px; font-size: 13px; color: var(--ink-muted); text-align: center; }
|
|
73
|
+
.hm-state { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); }
|
|
74
|
+
.hm-state.warn { background: var(--warn-soft); color: var(--warn); }
|
|
75
|
+
.hm-state.good { background: var(--good-soft); color: var(--good); }
|
|
76
|
+
.hm-state.bad { background: var(--bad-soft); color: var(--bad); }
|
|
77
|
+
.hm-state.run { background: var(--accent-soft); color: var(--accent-ink); }
|
|
78
|
+
.hm-page { padding-top: 0; max-width: none; }
|
|
63
79
|
.hint { font-size: 12.5px; color: var(--ink-muted); }
|
|
64
80
|
.error { font-size: 13px; color: var(--bad); margin: 0; }
|
|
65
|
-
@media (max-width:
|
|
81
|
+
@media (max-width: 720px) {
|
|
82
|
+
.hm-hero { padding: 32px 18px 30px; }
|
|
83
|
+
.hm-q { font-size: 30px; }
|
|
84
|
+
.hm-ideas { grid-template-columns: minmax(0, 1fr); }
|
|
85
|
+
.hm-row { grid-template-columns: minmax(0, 1fr); }
|
|
86
|
+
.hm-row-side { justify-items: start; grid-auto-flow: column; justify-content: start; gap: 8px; }
|
|
87
|
+
}
|
|
66
88
|
</style>
|
|
67
89
|
</head>
|
|
68
90
|
<body data-le-page="home">
|
|
69
91
|
<div class="le-app">
|
|
70
92
|
${consoleSidebarHtml}
|
|
71
93
|
<main class="le-main">
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
<header class="le-topbar">
|
|
95
|
+
<button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>
|
|
96
|
+
<h1 class="le-topbar-title">Home</h1>
|
|
97
|
+
<span class="le-topbar-gap"></span>
|
|
98
|
+
<a class="le-btn-dark" href="/workflows/new">+ New workflow</a>
|
|
99
|
+
</header>
|
|
100
|
+
<div class="le-scroll"><div class="le-page hm-page">
|
|
101
|
+
<div class="hm">
|
|
102
|
+
<div class="hm-top">
|
|
103
|
+
<section class="hm-hero">
|
|
104
|
+
<h2 class="hm-q"><span class="soft" id="hmGreet">Hello,</span>what should your agents take care of?</h2>
|
|
105
|
+
<span class="hm-mascot">${mascotSvg(76)}</span>
|
|
106
|
+
<div class="hm-composer">
|
|
107
|
+
<form class="hm-box" id="hmForm">
|
|
108
|
+
<textarea id="hmText" rows="2" maxlength="500" aria-label="What should your agents take care of?" placeholder="Describe what you want done, in your own words"></textarea>
|
|
109
|
+
<div class="hm-box-foot">
|
|
110
|
+
<span class="le-seg" role="group" aria-label="What to make">
|
|
111
|
+
<button type="button" data-mode="goal" aria-pressed="true" title="Your agents suggest the workflows it takes">Suggest workflows</button>
|
|
112
|
+
<button type="button" data-mode="one" aria-pressed="false" title="Plan a single workflow for one agent">One workflow</button>
|
|
113
|
+
</span>
|
|
114
|
+
<select class="hm-agent" id="hmAgent" aria-label="Agent" hidden><option value="">Any agent</option></select>
|
|
115
|
+
<button type="submit" class="hm-send" id="hmSend" aria-label="Send" disabled><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4z"/></svg></button>
|
|
116
|
+
</div>
|
|
117
|
+
</form>
|
|
118
|
+
<a class="hm-connect" href="/config?section=apps"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.4 11.1l-9.2 9.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"/></svg>Connect your apps to give your agents more to work with</a>
|
|
119
|
+
</div>
|
|
120
|
+
</section>
|
|
121
|
+
<div class="le-grid hm-ideas" id="hmIdeas">
|
|
122
|
+
<button type="button" class="hm-idea"><span class="hm-idea-icon">${IDEA_ICONS.mail}</span><span>Answer every customer email within a day</span></button>
|
|
123
|
+
<button type="button" class="hm-idea"><span class="hm-idea-icon">${IDEA_ICONS.chart}</span><span>Send me a sales summary every Monday</span></button>
|
|
124
|
+
<button type="button" class="hm-idea"><span class="hm-idea-icon">${IDEA_ICONS.invoice}</span><span>Follow up on unpaid invoices each week</span></button>
|
|
125
|
+
</div>
|
|
76
126
|
</div>
|
|
77
|
-
<
|
|
127
|
+
<section class="hm-section" id="hmWaiting" hidden></section>
|
|
128
|
+
<section class="hm-section" id="hmRecent"><div class="hm-section-head"><p class="hm-label">// Latest runs</p></div><p class="hint">Loading…</p></section>
|
|
78
129
|
</div>
|
|
79
|
-
</div>
|
|
80
|
-
<div class="le-scroll"><div class="le-page"><div class="hm" id="hmPage"><p class="hint">Loading…</p></div></div></div>
|
|
130
|
+
</div></div>
|
|
81
131
|
</main>
|
|
82
132
|
</div>
|
|
83
133
|
${consoleShellScript}
|
|
84
134
|
<script>
|
|
85
135
|
(function () {
|
|
86
|
-
var page = document.getElementById('hmPage');
|
|
87
|
-
var DOT = ' ' + String.fromCharCode(183) + ' ';
|
|
88
136
|
var esc = window.leShell.esc;
|
|
137
|
+
var DOT = ' ' + String.fromCharCode(183) + ' ';
|
|
138
|
+
var text = document.getElementById('hmText');
|
|
139
|
+
var send = document.getElementById('hmSend');
|
|
140
|
+
var agentPick = document.getElementById('hmAgent');
|
|
141
|
+
var mode = 'goal';
|
|
89
142
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
function agentTag(name) { return '<span class="hm-tag hm-t-agent">' + esc(name) + '</span>'; }
|
|
94
|
-
|
|
95
|
-
// A workflow or group's workflows, a chained one marked "then", and a
|
|
96
|
-
// group's steps not built yet.
|
|
97
|
-
function howHtml(j) {
|
|
98
|
-
var unbuilt = j.group ? j.group.steps.filter(function (st) { return !st.built; }) : [];
|
|
99
|
-
if (j.flows.length) {
|
|
100
|
-
return '<div class="hm-node hm-how">' + j.flows.map(function (f) {
|
|
101
|
-
return '<div class="hm-row">' +
|
|
102
|
-
(f.then ? '<span class="hm-m">then ' + String.fromCharCode(8594) + '</span>' : '<span class="hm-tag hm-t-how">Workflow</span>') +
|
|
103
|
-
'<a class="hm-slug" href="' + wfHref(f.agent, f.id) + '">' + esc(f.id) + '</a>' + agentTag(f.agent) +
|
|
104
|
-
(f.gone ? '<span class="hm-m">no longer on this agent</span>' : f.starts.length ? '<span class="hm-m">' + esc(f.starts.join(DOT)) + '</span>' : '') +
|
|
105
|
-
(f.waiting ? '<a class="hm-tag hm-t-warn" href="/inbox">' + f.waiting + ' waiting</a>' : '') +
|
|
106
|
-
'</div>';
|
|
107
|
-
}).join('') + unbuilt.map(function (st) { return '<div class="hm-row"><span class="hm-m">then ' + String.fromCharCode(8594) + ' ' + esc(st.name) + ', not built yet</span></div>'; }).join('') + '</div>';
|
|
108
|
-
}
|
|
109
|
-
return '';
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// A goal's workflow, or group of workflows that run in order.
|
|
113
|
-
function itemHtml(j, goalId) {
|
|
114
|
-
return '<div class="hm-node hm-job"><div class="hm-row"><span class="hm-tag hm-t-job">' + (j.group ? 'Group' : 'Workflow') + '</span>' +
|
|
115
|
-
'<strong><a href="/goals?goal=' + encodeURIComponent(goalId) + '">' + esc(j.title) + '</a></strong>' +
|
|
116
|
-
(j.group ? '<span class="hm-m">' + j.group.steps.length + ' workflows in order</span>' : '') + '</div>' +
|
|
117
|
-
(j.measure ? '<span class="hm-m">measured by: ' + esc(j.measure) + '</span>' : '') +
|
|
118
|
-
'</div>' + howHtml(j);
|
|
119
|
-
}
|
|
143
|
+
var hour = new Date().getHours();
|
|
144
|
+
document.getElementById('hmGreet').textContent = (hour < 5 ? 'Working late?' : hour < 12 ? 'Good morning,' : hour < 18 ? 'Good afternoon,' : 'Good evening,');
|
|
120
145
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
'
|
|
146
|
+
// The box grows with what's typed, and sends on Enter (Shift+Enter for
|
|
147
|
+
// a new line).
|
|
148
|
+
function sync() {
|
|
149
|
+
send.disabled = text.value.trim().length < 5;
|
|
150
|
+
text.style.height = 'auto';
|
|
151
|
+
text.style.height = Math.min(240, text.scrollHeight) + 'px';
|
|
127
152
|
}
|
|
128
|
-
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
153
|
+
text.addEventListener('input', sync);
|
|
154
|
+
text.addEventListener('keydown', function (ev) {
|
|
155
|
+
if (ev.key === 'Enter' && !ev.shiftKey && !ev.isComposing) { ev.preventDefault(); if (!send.disabled) go(); }
|
|
156
|
+
});
|
|
157
|
+
function go() {
|
|
158
|
+
var said = text.value.trim();
|
|
159
|
+
if (mode === 'one') location.href = '/workflows/new?description=' + encodeURIComponent(said) + (agentPick.value ? '&agent=' + encodeURIComponent(agentPick.value) : '');
|
|
160
|
+
else location.href = '/goals?new=1&go=1&text=' + encodeURIComponent(said);
|
|
134
161
|
}
|
|
162
|
+
document.getElementById('hmForm').addEventListener('submit', function (ev) { ev.preventDefault(); if (!send.disabled) go(); });
|
|
163
|
+
// Suggest workflows, or One workflow (for the agent chosen).
|
|
164
|
+
document.querySelector('.hm-box .le-seg').addEventListener('click', function (ev) {
|
|
165
|
+
var b = ev.target.closest('[data-mode]');
|
|
166
|
+
if (!b) return;
|
|
167
|
+
mode = b.getAttribute('data-mode');
|
|
168
|
+
var all = this.querySelectorAll('[data-mode]');
|
|
169
|
+
for (var i = 0; i < all.length; i++) all[i].setAttribute('aria-pressed', String(all[i] === b));
|
|
170
|
+
agentPick.hidden = mode !== 'one';
|
|
171
|
+
text.focus();
|
|
172
|
+
});
|
|
173
|
+
window.leShell.ready.then(function (agents) {
|
|
174
|
+
agentPick.innerHTML = '<option value="">Any agent</option>' + (agents || []).map(function (a) { return '<option value="' + esc(a.name) + '">' + esc(a.displayName || a.name) + '</option>'; }).join('');
|
|
175
|
+
});
|
|
176
|
+
document.getElementById('hmIdeas').addEventListener('click', function (ev) {
|
|
177
|
+
var b = ev.target.closest('.hm-idea');
|
|
178
|
+
if (!b) return;
|
|
179
|
+
text.value = b.textContent.trim();
|
|
180
|
+
sync();
|
|
181
|
+
text.focus();
|
|
182
|
+
});
|
|
183
|
+
text.focus();
|
|
135
184
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
185
|
+
// 1 hour ago, Yesterday, 3 days ago, then the date.
|
|
186
|
+
function ago(iso) {
|
|
187
|
+
if (!iso) return '';
|
|
188
|
+
var d = new Date(iso);
|
|
189
|
+
var s = Math.max(0, (Date.now() - d.getTime()) / 1000);
|
|
190
|
+
if (s < 60) return 'Just now';
|
|
191
|
+
if (s < 3600) { var m = Math.floor(s / 60); return m + (m === 1 ? ' minute ago' : ' minutes ago'); }
|
|
192
|
+
var today = new Date(); today.setHours(0, 0, 0, 0);
|
|
193
|
+
if (d >= today) { var h = Math.floor(s / 3600); return h + (h === 1 ? ' hour ago' : ' hours ago'); }
|
|
194
|
+
var days = Math.round((today - new Date(d.getFullYear(), d.getMonth(), d.getDate())) / 86400000);
|
|
195
|
+
if (days === 1) return 'Yesterday';
|
|
196
|
+
if (days < 7) return days + ' days ago';
|
|
197
|
+
return d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
|
|
144
198
|
}
|
|
145
|
-
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
'<a class="hm-stat" href="/workflows"><b>' + s.runsThisWeek + '</b><span>Runs in the last 7 days</span></a>' +
|
|
153
|
-
'<a class="hm-stat" href="/workflows"><b>' + s.failedThisWeek + '</b><span>Failed in the last 7 days</span></a>' +
|
|
154
|
-
'</div>';
|
|
155
|
-
if (d.goals.length) html += '<div class="hm-section"><h2>Goals</h2>' + d.goals.map(goalHtml).join('') + '</div>';
|
|
156
|
-
if (d.loose.length) html += '<div class="hm-section"><h2>' + (d.goals.length ? 'Workflows not for a goal' : 'Workflows') + '</h2><div class="hm-tree loose">' + d.loose.map(looseHtml).join('') + '</div></div>';
|
|
157
|
-
page.innerHTML = html;
|
|
199
|
+
var STATES = { needs: ['warn', 'Needs you'], running: ['run', 'Running'], completed: ['good', 'Completed'], failed: ['bad', 'Failed'] };
|
|
200
|
+
function rowHtml(i) {
|
|
201
|
+
var st = i.waiting && i.waiting.length ? ['warn', i.waiting.indexOf('approval') !== -1 ? 'Approval needed' : 'Question for you'] : (STATES[i.state] || ['', i.state]);
|
|
202
|
+
return '<a class="hm-row" href="/inbox?item=' + encodeURIComponent(i.id) + '">' +
|
|
203
|
+
'<span class="hm-row-main"><span class="hm-row-title">' + esc(i.title) + '</span>' +
|
|
204
|
+
'<span class="hm-row-sub">' + esc(i.agentLabel || i.agent) + DOT + esc(i.workflowTitle) + (i.summary ? DOT + esc(i.summary) : '') + '</span></span>' +
|
|
205
|
+
'<span class="hm-row-side"><span class="hm-state ' + st[0] + '">' + esc(st[1]) + '</span><span>' + esc(ago(i.waitingSince || i.lastActivity)) + '</span></span></a>';
|
|
158
206
|
}
|
|
159
207
|
|
|
160
|
-
|
|
208
|
+
// Waiting for you (its own block, when anything waits), then the latest
|
|
209
|
+
// runs that don't.
|
|
210
|
+
fetch('/inbox/items?view=all', { headers: { accept: 'application/json' }, cache: 'no-store' })
|
|
161
211
|
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); })
|
|
162
|
-
.then(
|
|
163
|
-
|
|
212
|
+
.then(function (d) {
|
|
213
|
+
var items = d.items || [];
|
|
214
|
+
var needs = items.filter(function (i) { return i.state === 'needs'; });
|
|
215
|
+
var rest = items.filter(function (i) { return i.state !== 'needs'; }).slice(0, 6);
|
|
216
|
+
var waiting = document.getElementById('hmWaiting');
|
|
217
|
+
if (needs.length) {
|
|
218
|
+
waiting.hidden = false;
|
|
219
|
+
waiting.innerHTML = '<div class="hm-section-head"><p class="hm-label">// Waiting for you ' + String.fromCharCode(183) + ' ' + needs.length + '</p><a href="/inbox?view=needs">Open the Inbox ' + String.fromCharCode(8594) + '</a></div>' +
|
|
220
|
+
'<div class="le-grid hm-list">' + needs.slice(0, 5).map(rowHtml).join('') + '</div>';
|
|
221
|
+
}
|
|
222
|
+
document.getElementById('hmRecent').innerHTML = '<div class="hm-section-head"><p class="hm-label">// Latest runs</p>' + (rest.length ? '<a href="/workflows">All workflows ' + String.fromCharCode(8594) + '</a>' : '') + '</div>' +
|
|
223
|
+
'<div class="le-grid hm-list">' + (rest.length ? rest.map(rowHtml).join('') : '<p class="hm-empty">No runs yet. Describe something above, and the workflows your agents build will show their runs here.</p>') + '</div>';
|
|
224
|
+
})
|
|
225
|
+
.catch(function (err) { document.getElementById('hmRecent').innerHTML = '<p class="error">Couldn' + String.fromCharCode(8217) + 't load your runs: ' + esc(err.message) + '</p>'; });
|
|
164
226
|
})();
|
|
165
227
|
</script>
|
|
166
228
|
</body>
|
package/dist/web/inbox-admin.js
CHANGED
|
@@ -59,7 +59,7 @@ export async function listInbox(deps, filter = {}) {
|
|
|
59
59
|
bySession.set(p.sessionId, [...(bySession.get(p.sessionId) ?? []), p]);
|
|
60
60
|
const runSessions = new Set(runs.map((r) => r.session_id));
|
|
61
61
|
const items = runs.map((run) => {
|
|
62
|
-
const wfTitle = deps.workflowTitle(run.agent, run.workflow_id) ?? (run.workflow_id || 'One-off
|
|
62
|
+
const wfTitle = deps.workflowTitle(run.agent, run.workflow_id) ?? (run.workflow_id || 'One-off run');
|
|
63
63
|
const waits = run.status === 'awaiting_approval' ? (bySession.get(run.session_id) ?? []) : [];
|
|
64
64
|
const decided = [...(run.decisions ?? []), ...(run.answers ?? [])].sort((a, b) => a.at.localeCompare(b.at));
|
|
65
65
|
const lastBy = decided.at(-1)?.by;
|
|
@@ -221,7 +221,7 @@ export async function getInboxCase(deps, id) {
|
|
|
221
221
|
const run = runs.find((r) => r.run_id === id) ?? (deps.run ? await deps.run(id) : undefined);
|
|
222
222
|
if (!run)
|
|
223
223
|
return undefined;
|
|
224
|
-
const wfTitle = deps.workflowTitle(run.agent, run.workflow_id) ?? (run.workflow_id || 'One-off
|
|
224
|
+
const wfTitle = deps.workflowTitle(run.agent, run.workflow_id) ?? (run.workflow_id || 'One-off run');
|
|
225
225
|
const waits = run.status === 'awaiting_approval' ? pending.filter((p) => p.sessionId === run.session_id).map(full) : [];
|
|
226
226
|
const usage = deps.usage?.(run) ?? [];
|
|
227
227
|
let steps = [];
|
package/dist/web/inbox-page.js
CHANGED
|
@@ -101,7 +101,7 @@ export const inboxPageHtml = `<!doctype html>
|
|
|
101
101
|
.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; }
|
|
102
102
|
.ib-card textarea.mono { font-family: var(--font-mono); font-size: 12.5px; min-height: 200px; }
|
|
103
103
|
.ib-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
104
|
-
.ib-btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--
|
|
104
|
+
.ib-btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); cursor: pointer; }
|
|
105
105
|
.ib-btn.plain { background: none; border-color: var(--line); color: var(--ink); font-weight: 500; }
|
|
106
106
|
.ib-btn.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
|
|
107
107
|
.ib-btn.opt { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 500; }
|
|
@@ -200,6 +200,7 @@ ${renderMarkdownScript}
|
|
|
200
200
|
function stateHtml(item) {
|
|
201
201
|
if (item.waiting && item.waiting.length) return '<span class="ib-state warn">' + (item.waiting.indexOf('approval') !== -1 ? 'Approval needed' : 'Question for you') + '</span>';
|
|
202
202
|
if (item.status === 'running') return '<span class="ib-state run">Running</span>';
|
|
203
|
+
if (item.status === 'awaiting_approval') return '<span class="ib-state warn">Waiting</span>';
|
|
203
204
|
if (item.status === 'error') return '<span class="ib-state bad">Failed</span>';
|
|
204
205
|
if (item.status === 'done') return '<span class="ib-state good">Completed</span>';
|
|
205
206
|
return '<span class="ib-state">' + esc(item.status) + '</span>';
|
|
@@ -468,7 +469,7 @@ ${renderMarkdownScript}
|
|
|
468
469
|
'<p class="ib-question">The agent wants to run <code>' + esc(p.tool) + '</code> with:</p>' + kvHtml(p.args) +
|
|
469
470
|
(canDecide()
|
|
470
471
|
? '<textarea class="ib-args mono" hidden>' + esc(JSON.stringify(p.args, null, 2)) + '</textarea>' +
|
|
471
|
-
'<textarea class="ib-deny-reason" hidden placeholder="Why not? (optional) The agent reads this, and it' + String.fromCharCode(8217) + 's kept with the
|
|
472
|
+
'<textarea class="ib-deny-reason" hidden placeholder="Why not? (optional) The agent reads this, and it' + String.fromCharCode(8217) + 's kept with the run."></textarea>' +
|
|
472
473
|
'<div class="ib-actions"><button type="button" class="ib-btn" data-act="approve">Approve</button>' +
|
|
473
474
|
'<button type="button" class="ib-btn plain" data-act="change">Change</button>' +
|
|
474
475
|
'<button type="button" class="ib-btn bad" data-act="deny">Deny</button><span class="hint ib-result" role="status"></span></div>'
|
|
@@ -32,7 +32,7 @@ export const interviewPageHtml = `<!doctype html>
|
|
|
32
32
|
.iv-preview pre { white-space: pre-wrap; max-height: 180px; overflow: auto; margin: 0; }
|
|
33
33
|
.iv-list { display: grid; gap: 6px; max-width: 760px; }
|
|
34
34
|
.iv-list a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-size: 13.5px; }
|
|
35
|
-
.iv-btn { display: inline-block; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 500; background: var(--
|
|
35
|
+
.iv-btn { display: inline-block; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 500; background: var(--primary); color: var(--on-primary); }
|
|
36
36
|
.iv-btn.plain { background: none; color: var(--ink); border: 1px solid var(--line); }
|
|
37
37
|
.hint { font-size: 12px; color: var(--ink-muted); }
|
|
38
38
|
.error { font-size: 13px; color: var(--bad); }
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const MASCOT_CSS = "\n .le-mascot .le-mascot-eye { transform-box: fill-box; transform-origin: center; animation: le-mascot-blink 6s infinite; }\n .le-mascot .le-mascot-tip { animation: le-mascot-glow 3s ease-in-out infinite; }\n @keyframes le-mascot-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }\n @keyframes le-mascot-glow { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }\n @media (prefers-reduced-motion: reduce) { .le-mascot .le-mascot-eye, .le-mascot .le-mascot-tip { animation: none; } }\n";
|
|
2
|
+
/** The mascot at `size` pixels wide. */
|
|
3
|
+
export declare function mascotSvg(size: number): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// LoopEngine's mascot: a small robot with a rounded helmet, a dark visor
|
|
2
|
+
// and teal eyes that blink now and then, an antenna tipped in the accent
|
|
3
|
+
// colour, and two short arms (it perches on the edge of what it sits on).
|
|
4
|
+
// Plain SVG and CSS, no image file, so it's crisp at any size, follows the
|
|
5
|
+
// theme, and loads nothing. Used on Home and Schedules.
|
|
6
|
+
export const MASCOT_CSS = `
|
|
7
|
+
.le-mascot .le-mascot-eye { transform-box: fill-box; transform-origin: center; animation: le-mascot-blink 6s infinite; }
|
|
8
|
+
.le-mascot .le-mascot-tip { animation: le-mascot-glow 3s ease-in-out infinite; }
|
|
9
|
+
@keyframes le-mascot-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
|
|
10
|
+
@keyframes le-mascot-glow { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
|
|
11
|
+
@media (prefers-reduced-motion: reduce) { .le-mascot .le-mascot-eye, .le-mascot .le-mascot-tip { animation: none; } }
|
|
12
|
+
`;
|
|
13
|
+
/** The mascot at `size` pixels wide. */
|
|
14
|
+
export function mascotSvg(size) {
|
|
15
|
+
return `<svg class="le-mascot" width="${size}" height="${size}" viewBox="0 0 64 64" fill="none" aria-hidden="true">
|
|
16
|
+
<defs>
|
|
17
|
+
<linearGradient id="leMascotHead" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#4a5254"/><stop offset="1" stop-color="#1c2224"/></linearGradient>
|
|
18
|
+
<linearGradient id="leMascotBody" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a4244"/><stop offset="1" stop-color="#1c2224"/></linearGradient>
|
|
19
|
+
</defs>
|
|
20
|
+
<path d="M32 5.5v6" stroke="#2a3133" stroke-width="2.4" stroke-linecap="round"/>
|
|
21
|
+
<circle class="le-mascot-tip" cx="32" cy="4.5" r="3" fill="var(--accent)"/>
|
|
22
|
+
<rect x="11" y="10.5" width="42" height="30" rx="15" fill="url(#leMascotHead)"/>
|
|
23
|
+
<rect x="13.5" y="12.5" width="37" height="8" rx="4" fill="#ffffff" opacity=".08"/>
|
|
24
|
+
<rect x="17.5" y="17" width="29" height="16" rx="8" fill="#0b1012"/>
|
|
25
|
+
<rect class="le-mascot-eye" x="23.5" y="20.5" width="5.5" height="9" rx="2.75" fill="#5ff0d2"/>
|
|
26
|
+
<rect class="le-mascot-eye" x="35" y="20.5" width="5.5" height="9" rx="2.75" fill="#5ff0d2"/>
|
|
27
|
+
<rect x="27.5" y="40" width="9" height="4.5" rx="2" fill="#2a3133"/>
|
|
28
|
+
<rect x="21" y="43.5" width="22" height="11" rx="5.5" fill="url(#leMascotBody)"/>
|
|
29
|
+
<path d="M22 47.5c-4.5 1.2-6.5 4.6-7 9.5" stroke="#2a3133" stroke-width="4" stroke-linecap="round"/>
|
|
30
|
+
<path d="M42 47.5c4.5 1.2 6.5 4.6 7 9.5" stroke="#2a3133" stroke-width="4" stroke-linecap="round"/>
|
|
31
|
+
</svg>`;
|
|
32
|
+
}
|
|
@@ -155,13 +155,13 @@ export function jobAllowed(config, app, message) {
|
|
|
155
155
|
if (approvers.length) {
|
|
156
156
|
if (approvers.some((a) => a.user === message.user))
|
|
157
157
|
return { allowed: true };
|
|
158
|
-
return { allowed: false, message: `Only approvers can
|
|
158
|
+
return { allowed: false, message: `Only approvers can start runs here: ${approverList(app, approvers)}.` };
|
|
159
159
|
}
|
|
160
160
|
const file = savedConnection(config, app);
|
|
161
161
|
const home = app === 'slack' ? file?.channelId : file?.chatId;
|
|
162
162
|
if (!message.direct && home && home === message.conversation)
|
|
163
163
|
return { allowed: true };
|
|
164
|
-
return { allowed: false, message: `
|
|
164
|
+
return { allowed: false, message: `Runs started by direct message need approvers: in LoopEngine, open this agent's Messaging tab, then ${APP_NAMES[app]} → Approvers, and add yourself.` };
|
|
165
165
|
}
|
|
166
166
|
/** Replaces the approver list on the agent's saved connection for `app`,
|
|
167
167
|
* primary or not. Throws NotifierFileError when there's no connection
|
package/dist/web/playground.js
CHANGED
|
@@ -304,7 +304,7 @@ export const playgroundHtml = `<!doctype html>
|
|
|
304
304
|
}
|
|
305
305
|
.send-row { display: flex; gap: 8px; align-items: flex-end; }
|
|
306
306
|
#messageInput { flex: 1; min-width: 0; resize: vertical; height: 64px; border-radius: var(--radius); padding: 10px 12px; }
|
|
307
|
-
#sendButton { background: var(--
|
|
307
|
+
#sendButton { background: var(--primary); border-color: var(--primary); color: var(--on-primary); padding: 8px 16px; }
|
|
308
308
|
#messageInput:disabled, #sendButton:disabled { cursor: not-allowed; }
|
|
309
309
|
details summary { cursor: pointer; font-size: 12px; color: var(--ink-muted); }
|
|
310
310
|
.advanced-hint { margin: 6px 0 0; font-size: 11px; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const schedulesPageHtml: string;
|