loopengine 0.5.4 → 0.5.5
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.
|
@@ -1007,8 +1007,9 @@ ${renderMarkdownScript}
|
|
|
1007
1007
|
var inner = '<span class="le-card-label"><span>' + label + '</span>' + (tab ? '<span aria-hidden="true">→</span>' : '') + '</span>' +
|
|
1008
1008
|
'<span class="le-card-value">' + value + '</span>' +
|
|
1009
1009
|
'<span class="le-card-detail">' + detailText + '</span>';
|
|
1010
|
+
var adv = ['tools', 'env'].indexOf(tab) !== -1 ? ' data-advanced' : '';
|
|
1010
1011
|
return tab
|
|
1011
|
-
? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '">' + inner + '</a>'
|
|
1012
|
+
? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '"' + adv + '>' + inner + '</a>'
|
|
1012
1013
|
: '<div class="le-card">' + inner + '</div>';
|
|
1013
1014
|
}
|
|
1014
1015
|
return '<div class="le-cards" style="margin-bottom:28px">' +
|
|
@@ -1395,7 +1396,7 @@ ${renderMarkdownScript}
|
|
|
1395
1396
|
var schedules = workflowScheduleItemsHtml(w, name);
|
|
1396
1397
|
var hasHooks = Boolean(w.webhooks || w.webhooksWaiting || w.webhooksOff);
|
|
1397
1398
|
var way = function (key, title, what, body) {
|
|
1398
|
-
return '<section class="wf-way wf-way-' + key + '"><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
|
|
1399
|
+
return '<section class="wf-way wf-way-' + key + '"' + (key === 'api' ? ' data-advanced' : '') + '><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
|
|
1399
1400
|
};
|
|
1400
1401
|
return '<div class="wf-ways">' +
|
|
1401
1402
|
way('run', 'Run now', 'Starts a run right away, from here. Follow it in Activity.', workflowRunBarHtml(w, params)) +
|
|
@@ -2023,6 +2024,10 @@ ${renderMarkdownScript}
|
|
|
2023
2024
|
return parts.length ? '<div class="wf-run-evidence">' + parts.join('') + '</div>' : '';
|
|
2024
2025
|
}
|
|
2025
2026
|
|
|
2027
|
+
// A workflow's tabs for Advanced view only: for whoever builds and
|
|
2028
|
+
// audits it, not the operator who runs it.
|
|
2029
|
+
var WORKFLOW_ADVANCED_TABS = ['evaluation', 'contract', 'versions'];
|
|
2030
|
+
|
|
2026
2031
|
function renderWorkflowsHtml(name, workflows) {
|
|
2027
2032
|
if (workflowPageId) {
|
|
2028
2033
|
var page = workflows.filter(function (x) { return x.id === workflowPageId; });
|
|
@@ -2061,10 +2066,10 @@ ${renderMarkdownScript}
|
|
|
2061
2066
|
runEvidenceHtml(w, r) + '</li>';
|
|
2062
2067
|
}).join('');
|
|
2063
2068
|
var last = workflowLastRun(w);
|
|
2064
|
-
var tab = workflowTabs[w.id] || '
|
|
2069
|
+
var tab = workflowTabs[w.id] || 'activity';
|
|
2065
2070
|
var open = openWorkflowId === w.id;
|
|
2066
2071
|
var panel = function (key, html) { return '<div class="wf-panel" data-panel="' + key + '"' + (tab === key ? '' : ' hidden') + '>' + html + '</div>'; };
|
|
2067
|
-
var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '" aria-selected="' + (tab === key) + '">' + label + '</button>'; };
|
|
2072
|
+
var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '"' + (WORKFLOW_ADVANCED_TABS.indexOf(key) !== -1 ? ' data-advanced' : '') + ' aria-selected="' + (tab === key) + '">' + label + '</button>'; };
|
|
2068
2073
|
if (workflowPageId) {
|
|
2069
2074
|
var agentLabel = currentCfg && currentCfg.displayName ? currentCfg.displayName : name;
|
|
2070
2075
|
document.title = w.title + ' ' + String.fromCharCode(183) + ' ' + agentLabel;
|
|
@@ -2086,7 +2091,7 @@ ${renderMarkdownScript}
|
|
|
2086
2091
|
'</header>' +
|
|
2087
2092
|
workflowDraftBannerHtml(w) +
|
|
2088
2093
|
'<div class="wf-row-body wf-page-body">' +
|
|
2089
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('
|
|
2094
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
|
|
2090
2095
|
panel('brief', workflowBriefHtml(w)) +
|
|
2091
2096
|
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
2092
2097
|
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
@@ -2112,7 +2117,7 @@ ${renderMarkdownScript}
|
|
|
2112
2117
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
2113
2118
|
// What it does, in full, once it's open (the row shows just its name).
|
|
2114
2119
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
2115
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('
|
|
2120
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
|
|
2116
2121
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
2117
2122
|
panel('versions', workflowVersionsHtml()) +
|
|
2118
2123
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
@@ -3486,7 +3491,7 @@ ${renderMarkdownScript}
|
|
|
3486
3491
|
var nameSection =
|
|
3487
3492
|
'<h3>Name <button type="button" class="edit-btn" id="editDisplayNameBtn">Edit</button></h3>' +
|
|
3488
3493
|
'<p class="ov-name"><span id="displayNameDisplay">' + escapeHtml(cfg.displayName || cfg.name) + '</span>' +
|
|
3489
|
-
' <span class="muted">· id <code>' + escapeHtml(cfg.name) + '</code></span></p>' +
|
|
3494
|
+
' <span class="muted" data-advanced>· id <code>' + escapeHtml(cfg.name) + '</code></span></p>' +
|
|
3490
3495
|
editDialogHtml('<h3>Edit name</h3>', '<p>The name shown in the sidebar and at the top of its pages. Its id, <code>' + escapeHtml(cfg.name) + '</code>, stays the same: its API address and saved runs use it.</p>',
|
|
3491
3496
|
'<form class="add-source" id="displayNameForm" style="display:none">' +
|
|
3492
3497
|
'<label>Name<input type="text" name="displayName" maxlength="60" placeholder="' + escapeHtml(cfg.name) + '" value="' + escapeHtml(cfg.displayName || '') + '"></label>' +
|
|
@@ -3555,8 +3560,8 @@ ${renderMarkdownScript}
|
|
|
3555
3560
|
return renderOverviewCards(cfg) +
|
|
3556
3561
|
'<section>' + nameSection + '</section>' +
|
|
3557
3562
|
'<section>' + systemPromptSection + '</section>' +
|
|
3558
|
-
'<section>' + modelSection + '</section>' +
|
|
3559
|
-
'<section><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3563
|
+
'<section data-advanced>' + modelSection + '</section>' +
|
|
3564
|
+
'<section data-advanced><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3560
3565
|
'<dl class="kv kv-wide" id="limitsDisplay">' +
|
|
3561
3566
|
'<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
|
|
3562
3567
|
'<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
|
|
@@ -4276,7 +4281,7 @@ ${renderMarkdownScript}
|
|
|
4276
4281
|
}
|
|
4277
4282
|
|
|
4278
4283
|
function renderConnectionsHtml(n) {
|
|
4279
|
-
return (n.canSave === false ? '
|
|
4284
|
+
return (n.canSave === false ? leShell.adminNote('Saving needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server, because this stores a secret. Add <code>LOOPENGINE_ADMIN_AUTH=user:pass</code> to <code>.env</code> and restart.') : '') +
|
|
4280
4285
|
'<div class="msg-conns">' + (n.channels || ['slack', 'telegram', 'lark', 'email', 'webhook']).map(function (c) { return renderConnectionSection(n, c); }).join('') + '</div>';
|
|
4281
4286
|
}
|
|
4282
4287
|
|
|
@@ -4334,7 +4339,7 @@ ${renderMarkdownScript}
|
|
|
4334
4339
|
? '<div class="le-table-wrap" style="max-width:560px"><table><thead><tr><th>Name</th><th>' + title + ' ID</th><th></th></tr></thead><tbody>' + rows + '</tbody></table></div>'
|
|
4335
4340
|
: '<p class="hint">No approvers yet. Until you add someone, anyone can use the buttons, and deciding by reply is off.</p>') +
|
|
4336
4341
|
(n.canSave === false
|
|
4337
|
-
? '
|
|
4342
|
+
? leShell.adminNote('Changing approvers needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server.')
|
|
4338
4343
|
: '<p style="margin:10px 0 0"><button type="button" class="approvers-load">' + (app === 'telegram' ? 'Add people who messaged the bot' : 'Add people from the channel') + '</button></p>' +
|
|
4339
4344
|
(app === 'telegram' ? '<p class="hint" style="margin:6px 0 0">Telegram can't list a chat's members, so people show up here once they've written to the bot (a private message to it is enough), or add someone by their numeric user id:</p>' +
|
|
4340
4345
|
'<span style="display:flex;gap:6px;max-width:560px;margin-top:6px"><input class="approver-manual-id" placeholder="User id, like 123456789" style="flex:1;min-width:0"><input class="approver-manual-name" placeholder="Name" style="flex:1;min-width:0"><button type="button" class="approver-manual-add">Add</button></span>' : '') +
|
|
@@ -5811,7 +5816,7 @@ ${renderMarkdownScript}
|
|
|
5811
5816
|
'</span></label>';
|
|
5812
5817
|
}).join('') + '</div>' +
|
|
5813
5818
|
'<div class="app-pick-bar"><button type="button" class="app-pick-save" data-ability="' + escapeHtml(ability) + '"' + (chosen && !p.busy && agentApps.canChange ? '' : ' disabled') + '>' + (p.installed ? 'Save' : 'Add with ' + chosen + ' tool' + (chosen === 1 ? '' : 's')) + '</button>' +
|
|
5814
|
-
(agentApps.canChange ? '' : '
|
|
5819
|
+
(agentApps.canChange ? '' : leShell.adminNote('Changing an agent' + String.fromCharCode(8217) + 's tools needs <code>LOOPENGINE_ADMIN_AUTH</code> set.')) +
|
|
5815
5820
|
(p.message ? '<span class="' + (p.messageBad ? 'error' : 'hint') + '">' + escapeHtml(p.message) + '</span>' : '') + '</div>' +
|
|
5816
5821
|
'</div>';
|
|
5817
5822
|
}
|
|
@@ -18,7 +18,10 @@ export const agentsListPageHtml = `<!doctype html>
|
|
|
18
18
|
#agentUl li { display: contents; }
|
|
19
19
|
.agent-card { display: grid; gap: 10px; align-content: start; }
|
|
20
20
|
.agent-card .name { font-weight: 600; font-size: 15px; }
|
|
21
|
-
.agent-card .prompt { font-size:
|
|
21
|
+
.agent-card .prompt { font-size: 12.5px; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
22
|
+
.agent-card .does { font-size: 13px; color: var(--ink); line-height: 1.45; }
|
|
23
|
+
.agent-card .does a { color: var(--accent-ink); text-decoration: none; }
|
|
24
|
+
.agent-card .does .hint { font-size: 12.5px; }
|
|
22
25
|
.agent-card .links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
|
|
23
26
|
.agent-card .links a { font-size: 12.5px; font-weight: 500; text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; color: var(--ink); }
|
|
24
27
|
.agent-card .links a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
|
|
@@ -105,6 +108,28 @@ ${consoleShellScript}
|
|
|
105
108
|
var newAgentResult = document.getElementById('newAgentResult');
|
|
106
109
|
var cancelNewAgentBtn = document.getElementById('cancelNewAgentBtn');
|
|
107
110
|
|
|
111
|
+
var agentNames = [];
|
|
112
|
+
// What each agent does, from its workflows: on each card, the first
|
|
113
|
+
// few by name, each opening its page.
|
|
114
|
+
function fillWorkflows() {
|
|
115
|
+
return fetch('/workflows/overview', { headers: { accept: 'application/json' } })
|
|
116
|
+
.then(function (r) { return r.ok ? r.json() : null; })
|
|
117
|
+
.then(function (d) {
|
|
118
|
+
var by = {};
|
|
119
|
+
((d && d.workflows) || []).forEach(function (w) { (by[w.agent] = by[w.agent] || []).push(w); });
|
|
120
|
+
agentNames.forEach(function (name) {
|
|
121
|
+
var box = document.querySelector('[data-agent-does="' + CSS.escape(name) + '"]');
|
|
122
|
+
if (!box || !d) return;
|
|
123
|
+
var list = by[name] || [];
|
|
124
|
+
var link = function (w) { return '<a href="/agents/config?agent=' + encodeURIComponent(name) + '&tab=workflows&workflow=' + encodeURIComponent(w.id) + '">' + escapeHtml(w.title) + '</a>'; };
|
|
125
|
+
box.innerHTML = list.length
|
|
126
|
+
? '<strong>' + list.length + (list.length === 1 ? ' workflow' : ' workflows') + ':</strong> ' + list.slice(0, 3).map(link).join(', ') + (list.length > 3 ? ' <span class="hint">and ' + (list.length - 3) + ' more</span>' : '')
|
|
127
|
+
: '<span class="hint">No workflows yet. <a href="/workflows/new?agent=' + encodeURIComponent(name) + '">Give it one</a></span>';
|
|
128
|
+
});
|
|
129
|
+
})
|
|
130
|
+
.catch(function () {});
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
function escapeHtml(s) {
|
|
109
134
|
return String(s).replace(/[&<>"']/g, function (c) {
|
|
110
135
|
return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c];
|
|
@@ -119,6 +144,7 @@ ${consoleShellScript}
|
|
|
119
144
|
.then(function (data) {
|
|
120
145
|
var agents = data.agents || [];
|
|
121
146
|
agentUl.textContent = '';
|
|
147
|
+
agentNames = agents.map(function (a) { return a.name; });
|
|
122
148
|
if (!agents.length) {
|
|
123
149
|
empty.style.display = 'block';
|
|
124
150
|
return;
|
|
@@ -130,15 +156,17 @@ ${consoleShellScript}
|
|
|
130
156
|
var qs = '?agent=' + encodeURIComponent(agent.name);
|
|
131
157
|
li.innerHTML =
|
|
132
158
|
'<div class="le-card agent-card">' +
|
|
133
|
-
'<div class="name">' + escapeHtml(agent.displayName || agent.name) + (agent.displayName ? ' <span class="hint" style="font-family:var(--font-mono);font-weight:400">' + escapeHtml(agent.name) + '</span>' : '') + '</div>' +
|
|
159
|
+
'<div class="name">' + escapeHtml(agent.displayName || agent.name) + (agent.displayName ? ' <span class="hint" data-advanced style="font-family:var(--font-mono);font-weight:400">' + escapeHtml(agent.name) + '</span>' : '') + '</div>' +
|
|
160
|
+
'<div class="does" data-agent-does="' + escapeHtml(agent.name) + '"></div>' +
|
|
134
161
|
'<div class="prompt">' + escapeHtml(agent.systemPrompt) + '</div>' +
|
|
135
162
|
'<div class="links">' +
|
|
136
163
|
'<a class="primary" href="/playground' + qs + '">Chat</a>' +
|
|
137
|
-
'<a href="/agents/config' + qs + '">
|
|
164
|
+
'<a href="/agents/config' + qs + '">Open</a>' +
|
|
138
165
|
'</div></div>';
|
|
139
166
|
agentUl.appendChild(li);
|
|
140
167
|
}
|
|
141
168
|
})
|
|
169
|
+
.then(fillWorkflows)
|
|
142
170
|
.catch(function (err) {
|
|
143
171
|
empty.textContent = 'Could not load agents: ' + err.message;
|
|
144
172
|
empty.style.display = 'block';
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
// leShell.applyProviderKeys(form, keys, keep) only providers with a key
|
|
20
20
|
// leShell.abilityOriginBadge(origin) Official/Public/Private badge for an ability
|
|
21
21
|
// leShell.toggleAbilityDetails(btn) an ability's tools, skills and settings
|
|
22
|
+
// leShell.advanced() whether this person has Advanced view on
|
|
23
|
+
// leShell.adminNote(tech) "Only your workspace admin can change this",
|
|
24
|
+
// with the technical how-to in Advanced view
|
|
25
|
+
//
|
|
26
|
+
// Simple and Advanced view: the console is for operators first, so what
|
|
27
|
+
// only a developer or the workspace's admin needs (version history,
|
|
28
|
+
// evaluations, the contract, the API, environment, limits) is marked
|
|
29
|
+
// data-advanced and hidden until a person turns on Advanced in the
|
|
30
|
+
// sidebar (kept in this browser). data-simple marks what shows only
|
|
31
|
+
// without it.
|
|
22
32
|
// Same embedded-string conventions as the pages themselves: plain
|
|
23
33
|
// string concatenation and no backslashes inside the script, so nothing
|
|
24
34
|
// here needs double-escaping in the template literal.
|
|
@@ -37,6 +47,7 @@ const GOALS_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" str
|
|
|
37
47
|
// A clipboard with a tick, for Audit.
|
|
38
48
|
const AUDIT_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4V3h6v1"/><path d="m9 13 2 2 4-4"/></svg>';
|
|
39
49
|
// A gear, for Settings.
|
|
50
|
+
const ADVANCED_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>';
|
|
40
51
|
const SETTINGS_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>';
|
|
41
52
|
// Two columns: the sections (Inbox, Goals, Agents, Workflows, Audit,
|
|
42
53
|
// Settings), and beside them what's in the current one. A goal holds the
|
|
@@ -53,6 +64,7 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
53
64
|
<a class="le-rail-item" href="/workflows" data-le-nav-head="workflows" data-le-section="workflows">${WORKFLOWS_ICON}<span>Workflows</span></a>
|
|
54
65
|
<a class="le-rail-item" href="/audit" data-le-nav-head="audit" data-le-section="audit">${AUDIT_ICON}<span>Audit</span></a>
|
|
55
66
|
<span class="le-rail-gap"></span>
|
|
67
|
+
<button type="button" class="le-rail-item le-adv-toggle" id="leAdvToggle" aria-pressed="false" title="Advanced view: also show version history, evaluations, the contract, the API and agent internals">${ADVANCED_ICON}<span>Advanced</span></button>
|
|
56
68
|
<a class="le-rail-item" href="/config?section=settings" data-le-nav-head="settings" data-le-section="settings">${SETTINGS_ICON}<span>Settings</span></a>
|
|
57
69
|
<div class="le-who" id="leWho" hidden></div>
|
|
58
70
|
</nav>
|
|
@@ -75,7 +87,7 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
75
87
|
<nav class="le-settings-menu" aria-label="Settings">
|
|
76
88
|
<a href="/config?section=models" data-le-nav="models">Models</a>
|
|
77
89
|
<a href="/config?section=apps" data-le-nav="apps">Apps</a>
|
|
78
|
-
<a href="/config?section=abilities" data-le-nav="abilities">Abilities</a>
|
|
90
|
+
<a href="/config?section=abilities" data-le-nav="abilities" data-advanced>Abilities</a>
|
|
79
91
|
<a href="/config?section=settings" data-le-nav="settings">General settings</a>
|
|
80
92
|
</nav>
|
|
81
93
|
</section>
|
|
@@ -83,6 +95,26 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
83
95
|
</aside>`;
|
|
84
96
|
export const consoleShellScript = `<script>
|
|
85
97
|
(function () {
|
|
98
|
+
// Simple view unless this person turned Advanced on.
|
|
99
|
+
var advancedOn = false;
|
|
100
|
+
try { advancedOn = localStorage.getItem('le-advanced') === '1'; } catch (e) {}
|
|
101
|
+
document.documentElement.classList.toggle('le-simple', !advancedOn);
|
|
102
|
+
var advToggle = document.getElementById('leAdvToggle');
|
|
103
|
+
if (advToggle) {
|
|
104
|
+
advToggle.setAttribute('aria-pressed', String(advancedOn));
|
|
105
|
+
advToggle.addEventListener('click', function () {
|
|
106
|
+
advancedOn = !advancedOn;
|
|
107
|
+
try { localStorage.setItem('le-advanced', advancedOn ? '1' : '0'); } catch (e) {}
|
|
108
|
+
document.documentElement.classList.toggle('le-simple', !advancedOn);
|
|
109
|
+
advToggle.setAttribute('aria-pressed', String(advancedOn));
|
|
110
|
+
document.dispatchEvent(new CustomEvent('le-advanced', { detail: advancedOn }));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// A setting only the workspace's admin can change: said plainly, with
|
|
114
|
+
// the technical how-to for Advanced view.
|
|
115
|
+
function adminNote(tech) {
|
|
116
|
+
return '<p class="hint le-admin-note"><span data-simple>Only your workspace admin can change this.</span><span data-advanced>' + tech + '</span></p>';
|
|
117
|
+
}
|
|
86
118
|
var page = document.body.getAttribute('data-le-page') || '';
|
|
87
119
|
var params = new URLSearchParams(location.search);
|
|
88
120
|
var app = document.querySelector('.le-app');
|
|
@@ -103,6 +135,9 @@ export const consoleShellScript = `<script>
|
|
|
103
135
|
['schedules', 'Schedules'], ['chat', 'Chat'], ['actauth', 'Permissions'], ['env', 'Environment'], ['advanced', 'Advanced']
|
|
104
136
|
];
|
|
105
137
|
|
|
138
|
+
// The agent tabs for Advanced view only.
|
|
139
|
+
var ADVANCED_TABS = ['env', 'advanced'];
|
|
140
|
+
|
|
106
141
|
function esc(s) {
|
|
107
142
|
return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
|
|
108
143
|
return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c];
|
|
@@ -314,12 +349,12 @@ export const consoleShellScript = `<script>
|
|
|
314
349
|
var count = t[0] === 'env'
|
|
315
350
|
? '<span data-le-env-count="' + esc(opts.name) + '">' + envCountHtml(opts.name) + '</span>'
|
|
316
351
|
: (counts[t[0]] != null ? '<span class="le-count">' + counts[t[0]] + '</span>' : '');
|
|
317
|
-
return '<a class="le-tab" data-tab="' + t[0] + '" href="' + tabHref(opts.name, t[0]) + '" aria-selected="' + (t[0] === opts.tab) + '">' + t[1] + count + '</a>';
|
|
352
|
+
return '<a class="le-tab" data-tab="' + t[0] + '" href="' + tabHref(opts.name, t[0]) + '" aria-selected="' + (t[0] === opts.tab) + '"' + (ADVANCED_TABS.indexOf(t[0]) !== -1 ? ' data-advanced' : '') + '>' + t[1] + count + '</a>';
|
|
318
353
|
}).join('');
|
|
319
354
|
return '<div class="le-head"><div class="le-head-row">' +
|
|
320
355
|
'<div class="le-title"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>' +
|
|
321
356
|
'<div style="min-width:0"><h1><span data-le-head-name>' + esc(opts.displayName || opts.name) + '</span>' +
|
|
322
|
-
'<span class="le-head-id" data-le-head-id' + (opts.displayName ? '' : ' hidden') + '>' + esc(opts.name) + '</span></h1>' + (opts.prompt ? '<p>' + esc(opts.prompt) + '</p>' : '') + '</div></div>' +
|
|
357
|
+
'<span class="le-head-id" data-le-head-id data-advanced' + (opts.displayName ? '' : ' hidden') + '>' + esc(opts.name) + '</span></h1>' + (opts.prompt ? '<p>' + esc(opts.prompt) + '</p>' : '') + '</div></div>' +
|
|
323
358
|
'<div class="le-chips">' + chips + '</div></div>' +
|
|
324
359
|
'<nav class="le-tabs" aria-label="Agent sections">' + tabs + '</nav></div>';
|
|
325
360
|
}
|
|
@@ -671,6 +706,6 @@ export const consoleShellScript = `<script>
|
|
|
671
706
|
}
|
|
672
707
|
|
|
673
708
|
|
|
674
|
-
window.leShell = { loadError: function () { return loadError; }, ready: ready, settings: function () { return settings; }, getJson: getJson, reloadGoals: reloadGoals, reloadJobs: reloadJobs, reloadWorkflows: reloadWorkflows, reloadInboxCount: reloadInboxCount, renderHead: renderHead, setTab: setTab, setActive: setActive, setDisplayName: setDisplayName, displayNameOf: displayNameOf, esc: esc, tabHref: tabHref, envCountHtml: envCountHtml, setCount: setCount, wireModelPicker: wireModelPicker, loadProviderKeys: loadProviderKeys, applyProviderKeys: applyProviderKeys, abilityOriginBadge: abilityOriginBadge, toggleAbilityDetails: toggleAbilityDetails };
|
|
709
|
+
window.leShell = { advanced: function () { return advancedOn; }, adminNote: adminNote, loadError: function () { return loadError; }, ready: ready, settings: function () { return settings; }, getJson: getJson, reloadGoals: reloadGoals, reloadJobs: reloadJobs, reloadWorkflows: reloadWorkflows, reloadInboxCount: reloadInboxCount, renderHead: renderHead, setTab: setTab, setActive: setActive, setDisplayName: setDisplayName, displayNameOf: displayNameOf, esc: esc, tabHref: tabHref, envCountHtml: envCountHtml, setCount: setCount, wireModelPicker: wireModelPicker, loadProviderKeys: loadProviderKeys, applyProviderKeys: applyProviderKeys, abilityOriginBadge: abilityOriginBadge, toggleAbilityDetails: toggleAbilityDetails };
|
|
675
710
|
})();
|
|
676
711
|
</script>`;
|
|
@@ -138,6 +138,10 @@ export const devUiCss = `
|
|
|
138
138
|
.le-rail-item .le-inbox-count { position: absolute; top: 3px; right: 6px; margin: 0; padding: 0 6px; font-size: 10.5px; }
|
|
139
139
|
.le-inbox-count[hidden] { display: none; }
|
|
140
140
|
.le-rail-gap { flex: 1; }
|
|
141
|
+
button.le-rail-item { border: 0; background: none; height: auto; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; width: 100%; }
|
|
142
|
+
.le-adv-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
|
|
143
|
+
.le-simple [data-advanced] { display: none !important; }
|
|
144
|
+
html:not(.le-simple) [data-simple] { display: none !important; }
|
|
141
145
|
.le-nav-icon { width: 15px; height: 15px; flex-shrink: 0; }
|
|
142
146
|
.le-panel { width: 228px; flex: none; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); padding-top: 14px; }
|
|
143
147
|
.le-panel[hidden] { display: none; }
|
|
@@ -190,7 +190,7 @@ ${consoleShellScript}
|
|
|
190
190
|
(data.canSave ? '<td>' + keyCell + '</td>' : '') + '</tr>';
|
|
191
191
|
}).join('');
|
|
192
192
|
// Without the admin sign-in, keys can't be saved here: said once.
|
|
193
|
-
var keysNote = data.canSave ? '' : '
|
|
193
|
+
var keysNote = data.canSave ? '' : leShell.adminNote('To add keys here, set <code>LOOPENGINE_ADMIN_AUTH</code> first. Or put each key in the project' + String.fromCharCode(8217) + 's <code>.env</code> under the name shown.');
|
|
194
194
|
|
|
195
195
|
var agentRows = data.agents.length
|
|
196
196
|
? data.agents.map(function (a) {
|
|
@@ -698,7 +698,7 @@ ${consoleShellScript}
|
|
|
698
698
|
apps.apps.forEach(function (a) { if (categories.indexOf(a.category) === -1) categories.push(a.category); });
|
|
699
699
|
var shown = apps.apps.filter(function (a) { return appCategory === 'All' || a.category === appCategory; });
|
|
700
700
|
el.innerHTML =
|
|
701
|
-
(apps.canConnect ? '' : '
|
|
701
|
+
(apps.canConnect ? '' : leShell.adminNote('Connecting an app saves its key on this server, so it needs <code>LOOPENGINE_ADMIN_AUTH</code> set first.')) +
|
|
702
702
|
(signInNote ? '<p class="' + (signInNote.bad ? 'error' : 'hint') + '">' + escapeHtml(signInNote.text) + '</p>' : '') +
|
|
703
703
|
'<section><h3>Connected</h3>' + (apps.connected.length
|
|
704
704
|
? '<div class="app-list">' + apps.connected.map(function (c) {
|
|
@@ -1024,23 +1024,23 @@ ${consoleShellScript}
|
|
|
1024
1024
|
(si.dashboardUrl ? ' · <a href="' + escapeHtml(si.dashboardUrl) + '">Dashboard</a>' : '')
|
|
1025
1025
|
: si.mode === 'basic'
|
|
1026
1026
|
? 'Basic Auth (<code>LOOPENGINE_ADMIN_AUTH</code>)'
|
|
1027
|
-
: '<span class="error">None: anyone who can reach this
|
|
1027
|
+
: '<span class="error">None: anyone who can reach this workspace can use it.</span><span class="hint" data-advanced> Set <code>LOOPENGINE_ADMIN_AUTH</code>.</span>';
|
|
1028
1028
|
var rows = [
|
|
1029
1029
|
['Admin sign-in', signIn],
|
|
1030
1030
|
['LoopEngine version', '<code>' + escapeHtml(d.version) + '</code>'],
|
|
1031
|
-
['Environment name', '<code>' + escapeHtml(d.environment) + '</code> <span class="hint">(LOOPENGINE_ENV)</span>'],
|
|
1032
|
-
['Public address', d.publicUrl ? '<code>' + escapeHtml(d.publicUrl) + '</code>' : '<span class="hint">Not set (LOOPENGINE_PUBLIC_URL); links in notifications use the address saved with each notifier</span>'],
|
|
1033
|
-
['Scheduled tasks', d.scheduler === 'off' ? 'Off on this server (LOOPENGINE_SCHEDULER=off)' : 'Run by this server'],
|
|
1031
|
+
['Environment name', '<code>' + escapeHtml(d.environment) + '</code> <span class="hint">(LOOPENGINE_ENV)</span>', true],
|
|
1032
|
+
['Public address', d.publicUrl ? '<code>' + escapeHtml(d.publicUrl) + '</code>' : '<span class="hint">Not set (LOOPENGINE_PUBLIC_URL); links in notifications use the address saved with each notifier</span>', true],
|
|
1033
|
+
['Scheduled tasks', d.scheduler === 'off' ? 'Off on this server (LOOPENGINE_SCHEDULER=off)' : 'Run by this server', true],
|
|
1034
1034
|
// With a time zone to choose, it has its own section below.
|
|
1035
1035
|
d.timeZone ? null : ['Time zone', '<span class="hint">The server' + String.fromCharCode(8217) + 's own. Update the template below to choose one here.</span>'],
|
|
1036
1036
|
['Theme', 'Follows your system'],
|
|
1037
1037
|
];
|
|
1038
1038
|
return '<section><table><thead><tr><th>Setting</th><th>Value</th></tr></thead><tbody>' +
|
|
1039
|
-
rows.filter(Boolean).map(function (r) { return '<tr><td>' + r[0] + '</td><td>' + r[1] + '</td></tr>'; }).join('') +
|
|
1039
|
+
rows.filter(Boolean).map(function (r) { return '<tr' + (r[2] ? ' data-advanced' : '') + '><td>' + r[0] + '</td><td>' + r[1] + '</td></tr>'; }).join('') +
|
|
1040
1040
|
'</tbody></table></section>' +
|
|
1041
1041
|
(d.timeZone ? '<section><h3>Time zone</h3><div class="source" id="timeZoneBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' : '') +
|
|
1042
1042
|
'<section><h3>Shared policies</h3><div class="source" id="policiesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1043
|
-
'<section><h3>Private ability sources</h3><p class="muted" style="margin:0 0 10px">Where your own abilities come from, listed under Private on the Abilities page next to LoopEngine's official ones.</p><div class="source" id="abilitySourcesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1043
|
+
'<section data-advanced><h3>Private ability sources</h3><p class="muted" style="margin:0 0 10px">Where your own abilities come from, listed under Private on the Abilities page next to LoopEngine's official ones.</p><div class="source" id="abilitySourcesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1044
1044
|
'<section><h3>Updates</h3><div class="source" id="upgradeBox"><p class="hint">Checking for a newer LoopEngine' + String.fromCharCode(8230) + '</p></div></section>';
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
@@ -1082,7 +1082,7 @@ ${consoleShellScript}
|
|
|
1082
1082
|
'<button type="submit">Add source</button>' +
|
|
1083
1083
|
'<div class="error" id="sourceError"></div>' +
|
|
1084
1084
|
'</form>'
|
|
1085
|
-
: '
|
|
1085
|
+
: leShell.adminNote('Adding a source needs <code>LOOPENGINE_ADMIN_AUTH</code> set, because it stores a token. Or edit <code>ability-sources.yml</code> and <code>.env</code>.'));
|
|
1086
1086
|
var form = document.getElementById('sourceForm');
|
|
1087
1087
|
if (!form) return;
|
|
1088
1088
|
var TOKEN_HINTS = {
|
|
@@ -1149,7 +1149,7 @@ ${consoleShellScript}
|
|
|
1149
1149
|
var intro = '<p>Schedules and templates use this for times of day: “daily at 09:00” runs at 9:00 here, and daily and weekly schedules keep that time when the clocks change. ' +
|
|
1150
1150
|
(t.chosen ? '' : 'Not chosen yet, so it' + String.fromCharCode(8217) + 's the server' + String.fromCharCode(8217) + 's (<code>' + escapeHtml(t.server) + '</code>).') + '</p>';
|
|
1151
1151
|
if (!t.canSave) {
|
|
1152
|
-
box.innerHTML = intro + '<p>In use: <code>' + escapeHtml(t.timeZone) + '</code></p
|
|
1152
|
+
box.innerHTML = intro + '<p>In use: <code>' + escapeHtml(t.timeZone) + '</code></p>' + leShell.adminNote('Set <code>LOOPENGINE_ADMIN_AUTH</code> to change it here, or put <code>LOOPENGINE_TIME_ZONE</code> in .env.');
|
|
1153
1153
|
return;
|
|
1154
1154
|
}
|
|
1155
1155
|
var browserZone = '';
|
|
@@ -1199,7 +1199,7 @@ ${consoleShellScript}
|
|
|
1199
1199
|
if (!box) return;
|
|
1200
1200
|
var intro = '<p style="margin:0 0 10px">Rules every workflow follows, written once: your refund window, delivery promises, tone, who signs messages. Each run reads them above its own instructions, and a workflow' + String.fromCharCode(8217) + 's own instructions win where they say more.</p>';
|
|
1201
1201
|
if (!p.canSave) {
|
|
1202
|
-
box.innerHTML = intro + (p.policies ? '<pre class="hint" style="white-space:pre-wrap;margin:0">' + escapeHtml(p.policies) + '</pre>' : '<p class="hint">None yet.</p>') + '<
|
|
1202
|
+
box.innerHTML = intro + (p.policies ? '<pre class="hint" style="white-space:pre-wrap;margin:0">' + escapeHtml(p.policies) + '</pre>' : '<p class="hint">None yet.</p>') + leShell.adminNote('Set <code>LOOPENGINE_ADMIN_AUTH</code> to change them here, or edit <code>policies.md</code> in the project.');
|
|
1203
1203
|
return;
|
|
1204
1204
|
}
|
|
1205
1205
|
box.innerHTML = intro +
|
|
@@ -1317,7 +1317,7 @@ ${consoleShellScript}
|
|
|
1317
1317
|
if (u.unavailableReason) {
|
|
1318
1318
|
box.innerHTML = headline + '<p class="hint">' + escapeHtml(u.unavailableReason) + '</p>';
|
|
1319
1319
|
} else if (!u.canUpgrade) {
|
|
1320
|
-
box.innerHTML = headline + '<
|
|
1320
|
+
box.innerHTML = headline + leShell.adminNote('Set <code>LOOPENGINE_ADMIN_AUTH</code> to upgrade from here, or run <code>npx create-loopengine@latest upgrade</code>.');
|
|
1321
1321
|
} else {
|
|
1322
1322
|
box.innerHTML = headline +
|
|
1323
1323
|
'<p class="hint">' + UPGRADE_NOTE + (u.restartsItself ? '' : ' This server has nothing to restart it, so restart it yourself afterwards.') + '</p>' +
|