loopengine 0.5.3 → 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.
- package/dist/web/agents-config-page.js +265 -76
- package/dist/web/agents-list-page.js +34 -6
- package/dist/web/console-shell.js +39 -4
- package/dist/web/dev-ui-styles.js +4 -0
- package/dist/web/global-config-page.js +43 -24
- package/dist/web/home-page.js +1 -1
- package/dist/web/workflows-overview-page.js +3 -3
- package/package.json +1 -1
|
@@ -177,6 +177,7 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
177
177
|
.wf-cb-line code { font-size: 12px; }
|
|
178
178
|
.wf-cb-indent { padding-left: 14px; }
|
|
179
179
|
.wf-cb-tools { flex: 1 1 260px; min-width: 0; }
|
|
180
|
+
.wf-cb-named { font-weight: 700; color: var(--ink); }
|
|
180
181
|
.wf-cb-decision { font-size: 11.5px; font-weight: 700; padding: 0 8px; border-radius: 999px; white-space: nowrap; }
|
|
181
182
|
.wf-cb-decision.allow { background: var(--good-soft); color: var(--good); }
|
|
182
183
|
.wf-cb-decision.ask { background: var(--warn-soft); color: var(--warn); }
|
|
@@ -331,7 +332,18 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
331
332
|
.wf-version-actions .wf-version-restore { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
|
|
332
333
|
.wf-version-reason { margin: 0; color: var(--ink-muted); }
|
|
333
334
|
.wf-version-text[hidden], .wf-version-diff[hidden] { display: none; }
|
|
334
|
-
.wf-version-diff { margin: 0; }
|
|
335
|
+
.wf-version-diff { margin: 0; display: grid; gap: 10px; }
|
|
336
|
+
.wf-vd { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; line-height: 1.5; }
|
|
337
|
+
.wf-vd-k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); padding-top: 2px; }
|
|
338
|
+
.wf-vd-v { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
|
|
339
|
+
.wf-vd-v .workflow-steps-text { margin: 0; }
|
|
340
|
+
.wf-vc-summary { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 13px; }
|
|
341
|
+
.wf-vc-part { display: grid; gap: 4px; }
|
|
342
|
+
.wf-vc-part h5 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
|
|
343
|
+
.wf-vc-body del { color: var(--bad); }
|
|
344
|
+
.wf-vc-body ins { color: var(--good); text-decoration: none; }
|
|
345
|
+
.wf-vc-body > div:not([class]) { padding: 1px 6px; font-family: var(--font-sans, inherit); }
|
|
346
|
+
@media (max-width: 640px) { .wf-vd { grid-template-columns: minmax(0, 1fr); } }
|
|
335
347
|
.wf-version-diff .chg-lines { margin: 0; max-height: 480px; overflow: auto; }
|
|
336
348
|
.chg-same { color: var(--ink-muted); padding: 1px 6px; }
|
|
337
349
|
.chg-gap { color: var(--ink-faint); font-family: var(--font-sans, inherit); font-style: italic; padding: 2px 6px; }
|
|
@@ -376,8 +388,8 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
376
388
|
@media (max-width: 640px) { .wf-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
377
389
|
.wf-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
|
|
378
390
|
/* Triggers in the pink of .delete-btn, apart from Edit's accent. */
|
|
379
|
-
.wf-row-actions .workflow-triggers-open { border-color: var(--
|
|
380
|
-
.wf-row-actions .workflow-triggers-open:hover:not(:disabled) { background: var(--
|
|
391
|
+
.wf-row-actions .workflow-triggers-open { border-color: var(--line); background: var(--bg); color: var(--ink); }
|
|
392
|
+
.wf-row-actions .workflow-triggers-open:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
|
|
381
393
|
.wf-row-foot .wf-remove { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
|
|
382
394
|
.wf-row-foot .wf-remove:hover:not(:disabled) { background: var(--bad); color: var(--bg); }
|
|
383
395
|
@media (max-width: 760px) {
|
|
@@ -601,7 +613,9 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
601
613
|
.decision-deny { color: var(--bad); }
|
|
602
614
|
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; }
|
|
603
615
|
.kv dt { color: var(--ink-muted); }
|
|
604
|
-
.kv dd { margin
|
|
616
|
+
.kv dd .hint { margin-left: 6px; }
|
|
617
|
+
#systemPromptDisplay { font-family: inherit; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; background: var(--surface); }
|
|
618
|
+
.kv dd { margin: 0; }
|
|
605
619
|
.error { color: var(--bad); font-size: 13px; }
|
|
606
620
|
.hint { font-size: 11px; color: var(--ink-muted); }
|
|
607
621
|
#playgroundLink { font-size: 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: normal; text-decoration: none; margin-left: 8px; }
|
|
@@ -898,9 +912,10 @@ ${renderMarkdownScript}
|
|
|
898
912
|
var decisions = [];
|
|
899
913
|
matching.forEach(function (r) { if (decisions.indexOf(r.decision) === -1) decisions.push(r.decision); });
|
|
900
914
|
var conditional = matching.some(function (r) { return r.when; });
|
|
901
|
-
|
|
902
|
-
if (
|
|
903
|
-
return '<span class="le-pill
|
|
915
|
+
var word = function (d) { return DEFAULT_DECISIONS[d] ? DEFAULT_DECISIONS[d].charAt(0).toUpperCase() + DEFAULT_DECISIONS[d].slice(1) : d; };
|
|
916
|
+
if (!matching.length) return '<span class="le-pill ' + perms.defaultDecision + '" title="No rule names this tool; the default applies">' + escapeHtml(word(perms.defaultDecision)) + '</span>';
|
|
917
|
+
if (decisions.length === 1 && !conditional) return '<span class="le-pill ' + decisions[0] + '">' + escapeHtml(word(decisions[0])) + '</span>';
|
|
918
|
+
return '<span class="le-pill neutral" title="' + escapeHtml(decisions.map(word).join(' / ')) + ', depending on who, where or the call' + String.fromCharCode(8217) + 's values">Depends</span>';
|
|
904
919
|
}
|
|
905
920
|
|
|
906
921
|
function renderTools(tools) {
|
|
@@ -909,9 +924,9 @@ ${renderMarkdownScript}
|
|
|
909
924
|
return '<tr><td><code>' + escapeHtml(t.name) + '</code></td>' +
|
|
910
925
|
'<td>' + escapeHtml(t.description) + '</td>' +
|
|
911
926
|
'<td>' + runsPill(t.name) + '</td>' +
|
|
912
|
-
'<td>' + (t.safe ? '
|
|
927
|
+
'<td>' + (t.safe ? 'Yes' : 'No') + '</td></tr>';
|
|
913
928
|
}).join('');
|
|
914
|
-
return '<table><thead><tr><th>Name</th><th>What it does</th><th>
|
|
929
|
+
return '<table><thead><tr><th>Name</th><th>What it does</th><th>Permission</th><th>Only reads</th></tr></thead><tbody>' + rows + '</tbody></table>';
|
|
915
930
|
}
|
|
916
931
|
|
|
917
932
|
// Local tools' own table, unlike renderTools above (shared by Agent as
|
|
@@ -931,10 +946,10 @@ ${renderMarkdownScript}
|
|
|
931
946
|
return '<tr><td><code>' + escapeHtml(t.name) + '</code></td>' +
|
|
932
947
|
'<td>' + escapeHtml(t.description) + '</td>' +
|
|
933
948
|
'<td>' + runsPill(t.name) + '</td>' +
|
|
934
|
-
'<td>' + (t.safe ? '
|
|
949
|
+
'<td>' + (t.safe ? 'Yes' : 'No') + '</td>' +
|
|
935
950
|
'<td>' + actions + '</td></tr>';
|
|
936
951
|
}).join('');
|
|
937
|
-
return '<table><thead><tr><th>Name</th><th>What it does</th><th>
|
|
952
|
+
return '<table><thead><tr><th>Name</th><th>What it does</th><th>Permission</th><th>Only reads</th><th></th></tr></thead><tbody>' + rows + '</tbody></table>';
|
|
938
953
|
}
|
|
939
954
|
|
|
940
955
|
// Overview's own tools table, unlike the Tools tab's three separately-
|
|
@@ -992,8 +1007,9 @@ ${renderMarkdownScript}
|
|
|
992
1007
|
var inner = '<span class="le-card-label"><span>' + label + '</span>' + (tab ? '<span aria-hidden="true">→</span>' : '') + '</span>' +
|
|
993
1008
|
'<span class="le-card-value">' + value + '</span>' +
|
|
994
1009
|
'<span class="le-card-detail">' + detailText + '</span>';
|
|
1010
|
+
var adv = ['tools', 'env'].indexOf(tab) !== -1 ? ' data-advanced' : '';
|
|
995
1011
|
return tab
|
|
996
|
-
? '<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>'
|
|
997
1013
|
: '<div class="le-card">' + inner + '</div>';
|
|
998
1014
|
}
|
|
999
1015
|
return '<div class="le-cards" style="margin-bottom:28px">' +
|
|
@@ -1005,7 +1021,7 @@ ${renderMarkdownScript}
|
|
|
1005
1021
|
card('tools', 'Tools & skills', cfg.tools.length + (cfg.tools.length === 1 ? ' tool' : ' tools'),
|
|
1006
1022
|
(cfg.skills.length + (cfg.skills.length === 1 ? ' skill' : ' skills')) + (toolNames.length ? ' \u00b7 ' + escapeHtml(toolNames.slice(0, 2).join(', ') + (toolNames.length > 2 ? ', \u2026' : '')) : '')) +
|
|
1007
1023
|
card('actauth', 'Permissions', rules.length + (rules.length === 1 ? ' rule' : ' rules'),
|
|
1008
|
-
(asks ? asks + '
|
|
1024
|
+
(asks ? asks + ' ask you first \u00b7 ' : '') + escapeHtml(defaultDecisionText(cfg.permissions.defaultDecision).toLowerCase())) +
|
|
1009
1025
|
card('messaging', 'Messaging Apps', '<span id="ovMessagingValue">…</span>', '<span id="ovMessagingDetail">Loading…</span>') +
|
|
1010
1026
|
card('schedules', 'Schedules', '<span id="ovSchedulesValue">…</span>', '<span id="ovSchedulesDetail">Loading…</span>') +
|
|
1011
1027
|
card('env', 'Environment', 'Settings', '<span data-le-env-count="' + escapeHtml(cfg.name) + '">' + leShell.envCountHtml(cfg.name) + '</span> Values your installed abilities read') +
|
|
@@ -1282,7 +1298,7 @@ ${renderMarkdownScript}
|
|
|
1282
1298
|
// ---- A workflow in three parts: its contract (what the system holds it
|
|
1283
1299
|
// to: how it starts, its inputs, lookups, tools, model and result), its
|
|
1284
1300
|
// brief (what the agent reads) and its evidence (how it's doing). ----
|
|
1285
|
-
var workflowsMeta = { policies: '', agentModel: '', messaging: null };
|
|
1301
|
+
var workflowsMeta = { policies: '', agentModel: '', messaging: null, agentTools: null, limits: null };
|
|
1286
1302
|
var RSQ = String.fromCharCode(8217);
|
|
1287
1303
|
var DOT = ' ' + String.fromCharCode(183) + ' ';
|
|
1288
1304
|
|
|
@@ -1344,7 +1360,7 @@ ${renderMarkdownScript}
|
|
|
1344
1360
|
'<div class="wf-msg-dest"><div class="wf-msg-dest-k">' + chatCol + '</div><div class="hint">' +
|
|
1345
1361
|
(chatName ? 'The agent' + RSQ + 's messaging app, set in its <a href="?agent=' + encodeURIComponent(agentName) + '&tab=messaging">Messaging Apps</a> tab.'
|
|
1346
1362
|
: 'Not set up. <a href="?agent=' + encodeURIComponent(agentName) + '&tab=messaging">Set one up in Messaging</a> (Slack, Telegram or Lark) to post to chat.') + '</div></div>' +
|
|
1347
|
-
'<div class="wf-msg-dest"><div class="wf-msg-dest-k">Inbox</div><div class="hint">Always. Every run is
|
|
1363
|
+
'<div class="wf-msg-dest"><div class="wf-msg-dest-k">Inbox</div><div class="hint">Always. Every run is a conversation there, where approvals and questions can be answered.</div></div>' +
|
|
1348
1364
|
'<div class="wf-msg-dest"><div class="wf-msg-dest-k">Your app</div><div class="hint">Optional. Only when you set an address: it then gets each update as signed JSON (a webhook).</div>' +
|
|
1349
1365
|
'<input name="msgUrl" inputmode="url" placeholder="https://example.com/hooks/loopengine" value="' + escapeHtml(d.callback_url || '') + '"></div>' +
|
|
1350
1366
|
'</div>' +
|
|
@@ -1380,10 +1396,10 @@ ${renderMarkdownScript}
|
|
|
1380
1396
|
var schedules = workflowScheduleItemsHtml(w, name);
|
|
1381
1397
|
var hasHooks = Boolean(w.webhooks || w.webhooksWaiting || w.webhooksOff);
|
|
1382
1398
|
var way = function (key, title, what, body) {
|
|
1383
|
-
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>';
|
|
1384
1400
|
};
|
|
1385
1401
|
return '<div class="wf-ways">' +
|
|
1386
|
-
way('run', 'Run now', 'Starts a run right away, from here.
|
|
1402
|
+
way('run', 'Run now', 'Starts a run right away, from here. Follow it in Activity.', workflowRunBarHtml(w, params)) +
|
|
1387
1403
|
way('schedule', 'Schedule', 'Runs it on a timer, like every day at 9:00. Approvals and questions go where its Messaging tab says.',
|
|
1388
1404
|
(schedules || '<p class="hint" style="margin:0">None yet.</p>') +
|
|
1389
1405
|
'<div><button type="button" class="workflow-add-schedule">+ Schedule</button></div>') +
|
|
@@ -1395,8 +1411,21 @@ ${renderMarkdownScript}
|
|
|
1395
1411
|
'</div>';
|
|
1396
1412
|
}
|
|
1397
1413
|
|
|
1414
|
+
// Its Contract tab: what every run is held to, as the system enforces
|
|
1415
|
+
// it, apart from what the agent is only asked to do. Held to: the
|
|
1416
|
+
// published version; how it starts; its inputs, checked before it
|
|
1417
|
+
// starts; the tools it can call (every tool the agent has) and their
|
|
1418
|
+
// permissions; its output schema, checked on its result; its model;
|
|
1419
|
+
// where approvals go; its limits; where its result goes. Asked: its
|
|
1420
|
+
// prompt and the shared policies, its result format, and its success
|
|
1421
|
+
// criteria (judged in Evaluation only).
|
|
1398
1422
|
function workflowContractHtml(w, name, params) {
|
|
1399
|
-
|
|
1423
|
+
var row = function (k, lines) { return '<div class="wf-cb-k">' + k + '</div><div class="wf-cb-v">' + contractLinesHtml(lines) + '</div>'; };
|
|
1424
|
+
var hint = function (t) { return '<span class="hint">' + t + '</span>'; };
|
|
1425
|
+
|
|
1426
|
+
var version = ['the published version, <span class="wf-contract-version">' + hint('loading' + String.fromCharCode(8230)) + '</span>' +
|
|
1427
|
+
(w.draft ? ' <span class="le-pill warn">Draft not live</span>' : ''), hint('A draft never runs: its changes, a webhook made in it included, apply once it' + RSQ + 's published. Each run records the version it ran.')];
|
|
1428
|
+
|
|
1400
1429
|
var trigger = [];
|
|
1401
1430
|
(w.schedules || []).filter(function (x) { return x.status !== 'cancelled'; }).forEach(function (x) {
|
|
1402
1431
|
trigger.push('schedule, ' + escapeHtml(x.describe) + (x.status === 'paused' ? ' <span class="le-pill warn">Paused</span>' : ''));
|
|
@@ -1406,42 +1435,72 @@ ${renderMarkdownScript}
|
|
|
1406
1435
|
(t.waiting ? ' <span class="le-pill ask">Needs its signing secret</span>' : !t.enabled ? ' <span class="le-pill warn">Off</span>' : ''));
|
|
1407
1436
|
Object.keys(t.mapping || {}).forEach(function (param) { trigger.push('<span class="wf-cb-indent"><code>' + escapeHtml(param) + '</code> ' + ARROW_L + ' <code>' + escapeHtml(t.mapping[param]) + '</code></span>'); });
|
|
1408
1437
|
});
|
|
1409
|
-
trigger.push('
|
|
1410
|
-
|
|
1411
|
-
|
|
1438
|
+
trigger.push('by hand (Run now) or from an app (API)');
|
|
1439
|
+
trigger.push(hint('A run with the same inputs as one still under way is turned away.'));
|
|
1440
|
+
|
|
1412
1441
|
var names = Object.keys(w.parameters || {});
|
|
1413
1442
|
var inputs = names.length ? names.map(function (n) {
|
|
1414
1443
|
var spec = w.parameters[n];
|
|
1415
1444
|
var typed = inputTypeText(spec);
|
|
1416
|
-
return '<code>' + escapeHtml(n) + '</code>' + (spec.required ? ' (required)' : '') + (typed ? ' ' + escapeHtml(typed) : '') + (spec.description ? ' <span class="hint">' + escapeHtml(spec.description) + '</span>' : '');
|
|
1417
|
-
}) : ['
|
|
1445
|
+
return '<code>' + escapeHtml(n) + '</code>' + (spec.required ? ' (required)' : ' (optional)') + (typed ? ' ' + escapeHtml(typed) : '') + (spec.description ? ' <span class="hint">' + escapeHtml(spec.description) + '</span>' : '');
|
|
1446
|
+
}) : ['none: every run is the same'];
|
|
1447
|
+
inputs.push(hint('Checked before a run starts: a missing required input, any other input, or a value of the wrong type or outside its limits is refused (an app' + RSQ + 's call gets 400, a webhook 422, a schedule' + RSQ + 's run fails).'));
|
|
1448
|
+
|
|
1449
|
+
// Every tool the agent has, by permission; those its prompt names first.
|
|
1450
|
+
var named = {};
|
|
1451
|
+
(w.tools || []).forEach(function (t) { named[t.name] = true; });
|
|
1452
|
+
var all = workflowsMeta.agentTools || w.tools || [];
|
|
1418
1453
|
var groups = { allow: [], ask: [], deny: [] };
|
|
1419
|
-
|
|
1454
|
+
all.forEach(function (t) { (groups[t.decision] || groups.ask).push(t.name); });
|
|
1420
1455
|
var tools = [];
|
|
1421
1456
|
[['allow', 'runs on its own'], ['ask', 'asks you first'], ['deny', 'never runs']].forEach(function (g) {
|
|
1422
|
-
|
|
1423
|
-
|
|
1457
|
+
var list = groups[g[0]].slice().sort(function (a, b) { return Number(!named[a]) - Number(!named[b]) || a.localeCompare(b); });
|
|
1458
|
+
if (!list.length) return;
|
|
1459
|
+
tools.push('<span class="wf-cb-tools">' + list.map(function (n) { return named[n] ? '<code class="wf-cb-named" title="Named in its prompt">' + escapeHtml(n) + '</code>' : '<code>' + escapeHtml(n) + '</code>'; }).join(', ') + '</span><span class="wf-cb-decision ' + g[0] + '">' + g[1] + '</span>');
|
|
1424
1460
|
});
|
|
1425
|
-
if (!
|
|
1426
|
-
|
|
1427
|
-
|
|
1461
|
+
if (!all.length) tools.push('none: the agent has no tools');
|
|
1462
|
+
tools.push('built in: asking a person a question, and scheduling ' + hint('(always allowed)'));
|
|
1463
|
+
tools.push(hint('A run can call any of the agent' + RSQ + 's tools, not only those its prompt names (in bold). Permissions are the agent' + RSQ + 's, shared by all its workflows, and are shown here as they apply before a call' + RSQ + 's values are known: a rule on the values can decide a call differently.'));
|
|
1464
|
+
|
|
1465
|
+
var output = [];
|
|
1428
1466
|
if (w.outputSchema) {
|
|
1429
1467
|
var props = w.outputSchema.type === 'object' && w.outputSchema.properties ? Object.keys(w.outputSchema.properties) : [];
|
|
1430
|
-
|
|
1468
|
+
output.push('JSON matching its output schema' + (props.length ? ': ' + props.map(function (n) { return '<code>' + escapeHtml(n) + '</code>'; }).join(', ') : '') +
|
|
1431
1469
|
'<details class="wf-schema"><summary>Show the schema</summary><pre>' + escapeHtml(JSON.stringify(w.outputSchema, null, 2)) + '</pre></details>');
|
|
1432
|
-
|
|
1433
|
-
|
|
1470
|
+
output.push(hint('A result that doesn' + RSQ + 't match goes back to the agent with what' + RSQ + 's wrong, twice at most; then the run fails.'));
|
|
1471
|
+
} else output.push('not checked: no output schema ' + hint('(add one with Edit workflow to hold every result to a shape)'));
|
|
1472
|
+
|
|
1473
|
+
var model = [w.model ? escapeHtml(w.model.provider + ' ' + w.model.model) : escapeHtml(workflowsMeta.agentModel || 'the agent' + RSQ + 's') + ' ' + hint('(the agent' + RSQ + 's model)')];
|
|
1474
|
+
|
|
1475
|
+
var decisions = [(w.delivery && w.delivery.decisions_to === 'callback' ? 'your app (' + escapeHtml(w.delivery.callback_url || '') + ')' : escapeHtml(workflowChatName() || 'the Inbox') + (workflowChatName() ? ', and the Inbox' : '')),
|
|
1476
|
+
hint('A run that needs a decision or an answer waits for it, however long. An app or webhook that sets its own update address can take them instead.')];
|
|
1477
|
+
|
|
1478
|
+
var lim = workflowsMeta.limits;
|
|
1479
|
+
var limits = [lim ? 'at most ' + lim.maxTurns + ' model turns, then the run stops' : 'the agent' + RSQ + 's limit on model turns',
|
|
1480
|
+
lim ? 'its conversation kept under ' + Number(lim.contextBudgetTokens).toLocaleString() + ' tokens ' + hint('(older steps are summarised as it fills)') : '',
|
|
1481
|
+
hint('No limit on time or cost: both are recorded on each run (Activity).')].filter(Boolean);
|
|
1482
|
+
|
|
1483
|
+
var result = ['returned to whoever started it ' + hint('(Run now, or the app' + RSQ + 's API call)')];
|
|
1434
1484
|
var notified = (w.delivery && w.delivery.result_to_chat) || (w.schedules || []).some(function (x) { return x.notify && x.status !== 'cancelled'; }) || (w.triggers || []).some(function (t) { return t.result_to_chat; });
|
|
1435
|
-
if (notified) result.push(escapeHtml(workflowsMeta.messaging ? (APP_NAMES[workflowsMeta.messaging] || workflowsMeta.messaging) : 'messaging app') +
|
|
1436
|
-
if (
|
|
1437
|
-
if (w.
|
|
1438
|
-
|
|
1439
|
-
var
|
|
1440
|
-
var
|
|
1441
|
-
|
|
1442
|
-
|
|
1485
|
+
if (notified) result.push('posted to ' + escapeHtml(workflowsMeta.messaging ? (APP_NAMES[workflowsMeta.messaging] || workflowsMeta.messaging) : 'the messaging app') + (w.delivery && w.delivery.result_to_chat ? '' : ' ' + hint('(for the schedules and webhooks set to send it)')) + ', or its error if it fails');
|
|
1486
|
+
if (w.delivery && w.delivery.callback_url) result.push('posted to ' + escapeHtml(w.delivery.callback_url) + ' when it finishes, fails or waits for a decision ' + hint('(signed)'));
|
|
1487
|
+
if ((w.triggers || []).some(function (t) { return t.callback; })) result.push('posted to each webhook' + RSQ + 's update address, for runs it starts');
|
|
1488
|
+
|
|
1489
|
+
var criteria = (w.evals && w.evals.criteria) || [];
|
|
1490
|
+
var asked = [
|
|
1491
|
+
'its prompt and the shared policies ' + hint('(Prompt tab; policies in Settings)'),
|
|
1492
|
+
w.output ? 'its result format: ' + escapeHtml(w.output) : 'no result format',
|
|
1493
|
+
criteria.length ? criteria.length + ' success ' + (criteria.length === 1 ? 'criterion' : 'criteria') + ' ' + hint('(judged when you evaluate it, not on live runs)') : 'no success criteria',
|
|
1494
|
+
];
|
|
1495
|
+
|
|
1496
|
+
return '<section class="wf-section"><div class="wf-sub-row"><h4 class="wf-sub">Held to on every run</h4><span class="hint">enforced by LoopEngine, whatever the agent decides</span></div>' +
|
|
1497
|
+
'<div class="wf-cb">' + row('version', version) + row('starts', trigger) + row('inputs', inputs) + row('tools', tools) + row('output', output) + row('model', model) + row('approvals', decisions) + row('limits', limits) + row('result', result) + '</div></section>' +
|
|
1498
|
+
'<section class="wf-section"><div class="wf-sub-row"><h4 class="wf-sub">Asked of the agent</h4><span class="hint">what it reads and follows; not checked</span></div>' +
|
|
1499
|
+
'<div class="wf-cb">' + row('reads', asked) + '</div>' +
|
|
1500
|
+
'<p class="hint" style="margin:0">Change the prompt, inputs, output schema and model with Edit workflow, where approvals and results go in Messaging, the agent' + RSQ + 's tool permissions in Permissions, and success criteria in Evaluation.</p></section>';
|
|
1443
1501
|
}
|
|
1444
1502
|
|
|
1503
|
+
|
|
1445
1504
|
function workflowBriefHtml(w) {
|
|
1446
1505
|
var policies = workflowsMeta.policies;
|
|
1447
1506
|
return '<div class="workflow-steps-text">' + escapeHtml(w.instructions) + '</div>' +
|
|
@@ -1965,6 +2024,10 @@ ${renderMarkdownScript}
|
|
|
1965
2024
|
return parts.length ? '<div class="wf-run-evidence">' + parts.join('') + '</div>' : '';
|
|
1966
2025
|
}
|
|
1967
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
|
+
|
|
1968
2031
|
function renderWorkflowsHtml(name, workflows) {
|
|
1969
2032
|
if (workflowPageId) {
|
|
1970
2033
|
var page = workflows.filter(function (x) { return x.id === workflowPageId; });
|
|
@@ -2003,10 +2066,10 @@ ${renderMarkdownScript}
|
|
|
2003
2066
|
runEvidenceHtml(w, r) + '</li>';
|
|
2004
2067
|
}).join('');
|
|
2005
2068
|
var last = workflowLastRun(w);
|
|
2006
|
-
var tab = workflowTabs[w.id] || '
|
|
2069
|
+
var tab = workflowTabs[w.id] || 'activity';
|
|
2007
2070
|
var open = openWorkflowId === w.id;
|
|
2008
2071
|
var panel = function (key, html) { return '<div class="wf-panel" data-panel="' + key + '"' + (tab === key ? '' : ' hidden') + '>' + html + '</div>'; };
|
|
2009
|
-
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>'; };
|
|
2010
2073
|
if (workflowPageId) {
|
|
2011
2074
|
var agentLabel = currentCfg && currentCfg.displayName ? currentCfg.displayName : name;
|
|
2012
2075
|
document.title = w.title + ' ' + String.fromCharCode(183) + ' ' + agentLabel;
|
|
@@ -2028,7 +2091,7 @@ ${renderMarkdownScript}
|
|
|
2028
2091
|
'</header>' +
|
|
2029
2092
|
workflowDraftBannerHtml(w) +
|
|
2030
2093
|
'<div class="wf-row-body wf-page-body">' +
|
|
2031
|
-
'<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>' +
|
|
2032
2095
|
panel('brief', workflowBriefHtml(w)) +
|
|
2033
2096
|
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
2034
2097
|
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
@@ -2054,7 +2117,7 @@ ${renderMarkdownScript}
|
|
|
2054
2117
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
2055
2118
|
// What it does, in full, once it's open (the row shows just its name).
|
|
2056
2119
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
2057
|
-
'<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>' +
|
|
2058
2121
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
2059
2122
|
panel('versions', workflowVersionsHtml()) +
|
|
2060
2123
|
panel('triggers', workflowTriggersHtml(w, name, params)) +
|
|
@@ -2148,7 +2211,7 @@ ${renderMarkdownScript}
|
|
|
2148
2211
|
if (currentName !== name) return;
|
|
2149
2212
|
if (!r.ok) { el.innerHTML = '<p class="error">Could not load workflows: ' + escapeHtml(r.body.error || 'unknown error') + '</p>'; return; }
|
|
2150
2213
|
var workflows = r.body.workflows || [];
|
|
2151
|
-
workflowsMeta = { policies: r.body.policies || '', agentModel: r.body.agentModel || '', messaging: r.body.messaging || null };
|
|
2214
|
+
workflowsMeta = { policies: r.body.policies || '', agentModel: r.body.agentModel || '', messaging: r.body.messaging || null, agentTools: r.body.agentTools || null, limits: r.body.limits || null };
|
|
2152
2215
|
fillWorkflowsCard(workflows);
|
|
2153
2216
|
leShell.setCount('workflows', workflows.length);
|
|
2154
2217
|
workflowsById = {};
|
|
@@ -2835,9 +2898,16 @@ ${renderMarkdownScript}
|
|
|
2835
2898
|
fetch(base + '/versions', { headers: { accept: 'application/json' } })
|
|
2836
2899
|
.then(function (r) { return r.ok ? r.json() : null; })
|
|
2837
2900
|
.then(function (data) {
|
|
2838
|
-
if (!data) {
|
|
2901
|
+
if (!data) {
|
|
2902
|
+
if (box) box.innerHTML = '<p class="hint" style="margin:0">This workspace keeps no versions.</p>';
|
|
2903
|
+
var unkept = card.querySelector('.wf-contract-version');
|
|
2904
|
+
if (unkept) unkept.textContent = 'not numbered: this workspace keeps no versions';
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2839
2907
|
var versions = data.versions || [];
|
|
2840
2908
|
var current = versions.filter(function (v) { return v.number === data.current; })[0] || versions[0];
|
|
2909
|
+
var contractVersion = card.querySelector('.wf-contract-version');
|
|
2910
|
+
if (contractVersion) contractVersion.innerHTML = current ? '<strong>v' + current.number + '</strong>' : 'not numbered yet';
|
|
2841
2911
|
if (meta && current) {
|
|
2842
2912
|
var draft = workflowsById[card.dataset.workflow] && workflowsById[card.dataset.workflow].draft;
|
|
2843
2913
|
meta.innerHTML = '<a href="' + workflowPageHref(name, card.dataset.workflow, 'versions') + '">v' + current.number + '</a>' + (draft ? ' <span class="hint">+ draft</span>' : '');
|
|
@@ -2908,6 +2978,114 @@ ${renderMarkdownScript}
|
|
|
2908
2978
|
return '<div class="chg-lines">' + html + '</div>';
|
|
2909
2979
|
}
|
|
2910
2980
|
|
|
2981
|
+
// A version laid out like the workflow itself: its name, prompt,
|
|
2982
|
+
// inputs, result, model, tools, triggers and success criteria. A
|
|
2983
|
+
// version from when only the brief was numbered has just its prompt
|
|
2984
|
+
// and result format; one with nothing read back shows its text.
|
|
2985
|
+
var PERMISSIONS = { allow: 'runs on its own', ask: 'asks you first', deny: 'never runs' };
|
|
2986
|
+
function versionFull(v) { return Boolean(v.fields && v.fields.title !== undefined); }
|
|
2987
|
+
function versionInputsHtml(params) {
|
|
2988
|
+
var names = Object.keys(params || {});
|
|
2989
|
+
if (!names.length) return '<span class="hint">None: every run is the same</span>';
|
|
2990
|
+
return names.map(function (n) {
|
|
2991
|
+
var spec = params[n] || {};
|
|
2992
|
+
var typed = inputTypeText(spec);
|
|
2993
|
+
return '<div><code>' + escapeHtml(n) + '</code>' + (spec.required ? ' (required)' : '') + (typed ? ' ' + escapeHtml(typed) : '') + (spec.description ? ' <span class="hint">' + escapeHtml(spec.description) + '</span>' : '') + '</div>';
|
|
2994
|
+
}).join('');
|
|
2995
|
+
}
|
|
2996
|
+
function versionModelText(m) { return m ? m.provider + ' ' + m.model : 'The agent' + RSQ + 's model'; }
|
|
2997
|
+
function versionToolHtml(t) {
|
|
2998
|
+
return '<div><code>' + escapeHtml(t.name) + '</code> <span class="wf-cb-decision ' + escapeHtml(t.permission) + '">' + escapeHtml(PERMISSIONS[t.permission] || t.permission) + '</span></div>';
|
|
2999
|
+
}
|
|
3000
|
+
function versionCritText(c) { return c.text + ' (' + critKindText(c) + ')'; }
|
|
3001
|
+
function versionDetailHtml(v) {
|
|
3002
|
+
var f = v.fields;
|
|
3003
|
+
if (!f) return '<div class="workflow-steps-text">' + escapeHtml(v.content) + '</div>';
|
|
3004
|
+
var row = function (k, html) { return '<div class="wf-vd-k">' + k + '</div><div class="wf-vd-v">' + html + '</div>'; };
|
|
3005
|
+
var list = function (items, empty, fn) { return items && items.length ? items.map(fn).join('') : '<span class="hint">' + empty + '</span>'; };
|
|
3006
|
+
var rows = '';
|
|
3007
|
+
if (versionFull(v)) rows += row('Name', '<strong>' + escapeHtml(f.title) + '</strong>' + (f.description ? '<div class="hint">' + escapeHtml(f.description) + '</div>' : ''));
|
|
3008
|
+
rows += row('Prompt', '<div class="workflow-steps-text">' + escapeHtml(f.instructions || '') + '</div>');
|
|
3009
|
+
if (versionFull(v)) rows += row('Inputs', versionInputsHtml(f.parameters));
|
|
3010
|
+
rows += row('Result', (f.output ? '<div class="workflow-steps-text">' + escapeHtml(f.output) + '</div>' : '<span class="hint">No result format set</span>') +
|
|
3011
|
+
(f.outputSchema ? '<details class="wf-schema"><summary>Output schema</summary><pre>' + escapeHtml(JSON.stringify(f.outputSchema, null, 2)) + '</pre></details>' : ''));
|
|
3012
|
+
if (versionFull(v)) rows += row('Model', escapeHtml(versionModelText(f.model)));
|
|
3013
|
+
if (f.tools) rows += row('Tools', list(f.tools, 'None named in its prompt', versionToolHtml));
|
|
3014
|
+
if (f.triggers) rows += row('Triggers', list(f.triggers, 'None: run by hand (Run now) or from an app', function (t) { return '<div>' + escapeHtml(t) + '</div>'; }));
|
|
3015
|
+
if (f.criteria) rows += row('Success criteria', list(f.criteria, 'None', function (c) { return '<div>' + escapeHtml(versionCritText(c)) + '</div>'; }));
|
|
3016
|
+
return '<div class="wf-vd">' + rows + '</div>' + (versionFull(v) ? '' : '<p class="hint" style="margin:6px 0 0">An early version: only its prompt and result format were kept.</p>');
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
// What changed from one version to the next, part by part: a name or
|
|
3020
|
+
// model from and to; the prompt, result format and output schema line
|
|
3021
|
+
// by line; inputs, tools, triggers and success criteria added, removed
|
|
3022
|
+
// or changed. A part the older version didn't record isn't compared.
|
|
3023
|
+
function versionCompareHtml(prev, v) {
|
|
3024
|
+
var a = prev.fields, b = v.fields;
|
|
3025
|
+
var intro = '<p class="hint" style="margin:0">What changed from version ' + prev.number + ' to version ' + v.number + '.</p>';
|
|
3026
|
+
if (!a || !b) return intro + versionDiffHtml(prev.content, v.content);
|
|
3027
|
+
var MINUS = String.fromCharCode(8722), ARROW = ' ' + String.fromCharCode(8594) + ' ';
|
|
3028
|
+
var parts = [];
|
|
3029
|
+
var add = function (label, html, summary) { parts.push({ label: label, html: html, summary: summary }); };
|
|
3030
|
+
var fromTo = function (x, y) { return '<del>' + escapeHtml(x || '(none)') + '</del>' + ARROW + '<ins>' + escapeHtml(y || '(none)') + '</ins>'; };
|
|
3031
|
+
var lines = function (x, y) {
|
|
3032
|
+
var d = versionLineDiff(x || '', y || '');
|
|
3033
|
+
var plus = d.filter(function (l) { return l.t === '+' && l.l.trim(); }).length, minus = d.filter(function (l) { return l.t === '-' && l.l.trim(); }).length;
|
|
3034
|
+
return plus + ' line' + (plus === 1 ? '' : 's') + ' added, ' + minus + ' removed';
|
|
3035
|
+
};
|
|
3036
|
+
var setDiff = function (xs, ys, key, show) {
|
|
3037
|
+
var ka = xs.map(key), kb = ys.map(key);
|
|
3038
|
+
var out = [];
|
|
3039
|
+
ys.forEach(function (y, i) { if (ka.indexOf(kb[i]) === -1) out.push('<div class="chg-ins">+ ' + show(y) + '</div>'); });
|
|
3040
|
+
xs.forEach(function (x, i) { if (kb.indexOf(ka[i]) === -1) out.push('<div class="chg-del">' + MINUS + ' ' + show(x) + '</div>'); });
|
|
3041
|
+
return out;
|
|
3042
|
+
};
|
|
3043
|
+
var full = versionFull(prev) && versionFull(v);
|
|
3044
|
+
if (full && (a.title !== b.title || (a.description || '') !== (b.description || ''))) {
|
|
3045
|
+
add('Name', (a.title !== b.title ? '<div>' + fromTo(a.title, b.title) + '</div>' : '') + ((a.description || '') !== (b.description || '') ? '<div>' + fromTo(a.description, b.description) + '</div>' : ''), a.title !== b.title ? 'renamed' : 'description changed');
|
|
3046
|
+
}
|
|
3047
|
+
if ((a.instructions || '') !== (b.instructions || '')) add('Prompt', versionDiffHtml(a.instructions || '', b.instructions || ''), lines(a.instructions, b.instructions));
|
|
3048
|
+
if (full) {
|
|
3049
|
+
var pa = a.parameters || {}, pb = b.parameters || {};
|
|
3050
|
+
var inputs = [];
|
|
3051
|
+
Object.keys(pb).forEach(function (n) { if (!(n in pa)) inputs.push('<div class="chg-ins">+ <code>' + escapeHtml(n) + '</code>' + (pb[n].required ? ' (required)' : '') + '</div>'); });
|
|
3052
|
+
Object.keys(pa).forEach(function (n) { if (!(n in pb)) inputs.push('<div class="chg-del">' + MINUS + ' <code>' + escapeHtml(n) + '</code></div>'); });
|
|
3053
|
+
Object.keys(pb).forEach(function (n) {
|
|
3054
|
+
if (!(n in pa) || JSON.stringify(pa[n]) === JSON.stringify(pb[n])) return;
|
|
3055
|
+
var said = function (spec) { return [spec.required ? 'required' : 'optional', inputTypeText(spec), spec.description || ''].filter(Boolean).join(', '); };
|
|
3056
|
+
inputs.push('<div><code>' + escapeHtml(n) + '</code>: ' + fromTo(said(pa[n]), said(pb[n])) + '</div>');
|
|
3057
|
+
});
|
|
3058
|
+
if (inputs.length) add('Inputs', inputs.join(''), inputs.length + ' changed');
|
|
3059
|
+
}
|
|
3060
|
+
if ((a.output || '') !== (b.output || '')) add('Result format', versionDiffHtml(a.output || '', b.output || ''), lines(a.output, b.output));
|
|
3061
|
+
if (a.criteria !== undefined && b.criteria !== undefined && JSON.stringify(a.outputSchema || null) !== JSON.stringify(b.outputSchema || null)) {
|
|
3062
|
+
var sa = a.outputSchema ? JSON.stringify(a.outputSchema, null, 2) : '', sb = b.outputSchema ? JSON.stringify(b.outputSchema, null, 2) : '';
|
|
3063
|
+
add('Output schema', versionDiffHtml(sa, sb), !sa ? 'added' : !sb ? 'removed' : lines(sa, sb));
|
|
3064
|
+
}
|
|
3065
|
+
if (full && versionModelText(a.model) !== versionModelText(b.model)) add('Model', fromTo(versionModelText(a.model), versionModelText(b.model)), versionModelText(b.model));
|
|
3066
|
+
if (a.tools && b.tools) {
|
|
3067
|
+
var tools = setDiff(a.tools, b.tools, function (t) { return t.name; }, function (t) { return '<code>' + escapeHtml(t.name) + '</code> ' + escapeHtml(PERMISSIONS[t.permission] || t.permission); });
|
|
3068
|
+
b.tools.forEach(function (t) {
|
|
3069
|
+
var was = a.tools.filter(function (x) { return x.name === t.name; })[0];
|
|
3070
|
+
if (was && was.permission !== t.permission) tools.push('<div><code>' + escapeHtml(t.name) + '</code>: ' + fromTo(PERMISSIONS[was.permission] || was.permission, PERMISSIONS[t.permission] || t.permission) + '</div>');
|
|
3071
|
+
});
|
|
3072
|
+
if (tools.length) add('Tools', tools.join(''), tools.length + ' changed');
|
|
3073
|
+
}
|
|
3074
|
+
if (a.triggers && b.triggers) {
|
|
3075
|
+
var trig = setDiff(a.triggers, b.triggers, function (t) { return t; }, escapeHtml);
|
|
3076
|
+
if (trig.length) add('Triggers', trig.join(''), trig.length + ' changed');
|
|
3077
|
+
}
|
|
3078
|
+
if (a.criteria && b.criteria) {
|
|
3079
|
+
var crit = setDiff(a.criteria, b.criteria, function (c) { return c.kind + '|' + (c.value || '') + '|' + c.text; }, function (c) { return escapeHtml(versionCritText(c)); });
|
|
3080
|
+
if (crit.length) add('Success criteria', crit.join(''), crit.length + ' changed');
|
|
3081
|
+
}
|
|
3082
|
+
var unrecorded = !full ? '<p class="hint" style="margin:0">Version ' + (versionFull(prev) ? v.number : prev.number) + ' kept only its prompt and result format, so only those are compared.</p>' : '';
|
|
3083
|
+
if (!parts.length) return intro + unrecorded + '<p class="hint" style="margin:0">Nothing it holds changed' + (v.reason ? ': ' + escapeHtml(v.reason) : '') + '.</p>';
|
|
3084
|
+
return intro + unrecorded +
|
|
3085
|
+
'<ul class="wf-vc-summary">' + parts.map(function (p) { return '<li><strong>' + p.label + '</strong> <span class="hint">' + escapeHtml(p.summary) + '</span></li>'; }).join('') + '</ul>' +
|
|
3086
|
+
parts.map(function (p) { return '<section class="wf-vc-part"><h5>' + p.label + '</h5><div class="chg-lines wf-vc-body">' + p.html + '</div></section>'; }).join('');
|
|
3087
|
+
}
|
|
3088
|
+
|
|
2911
3089
|
function renderWorkflowVersions(name, card, box, base, data) {
|
|
2912
3090
|
var versions = data.versions || [];
|
|
2913
3091
|
if (!versions.length) { box.innerHTML = '<p class="hint" style="margin:0">No versions yet: the first is numbered when it' + RSQ + 's first run or published.</p>'; return; }
|
|
@@ -2935,7 +3113,7 @@ ${renderMarkdownScript}
|
|
|
2935
3113
|
(isCurrent ? '' : '<button type="button" class="wf-version-restore">Restore</button>') +
|
|
2936
3114
|
'</span></div>' +
|
|
2937
3115
|
(v.reason ? '<p class="wf-version-reason">' + escapeHtml(v.reason) + '</p>' : '') +
|
|
2938
|
-
'<div class="
|
|
3116
|
+
'<div class="wf-version-text" hidden></div>' +
|
|
2939
3117
|
'<div class="wf-version-diff" hidden></div>' +
|
|
2940
3118
|
'<span class="hint wf-version-status" role="status"></span>' +
|
|
2941
3119
|
'</li>';
|
|
@@ -2960,11 +3138,15 @@ ${renderMarkdownScript}
|
|
|
2960
3138
|
compareBtn.textContent = which === 'compare' ? 'Hide changes' : 'Compare';
|
|
2961
3139
|
}
|
|
2962
3140
|
};
|
|
2963
|
-
if (btn.classList.contains('wf-version-view')) {
|
|
3141
|
+
if (btn.classList.contains('wf-version-view')) {
|
|
3142
|
+
if (!text.innerHTML) text.innerHTML = versionDetailHtml(v);
|
|
3143
|
+
show(text.hidden ? 'view' : null);
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
2964
3146
|
if (btn.classList.contains('wf-version-compare')) {
|
|
2965
3147
|
if (!diff.hidden) { show(null); return; }
|
|
2966
3148
|
var prev = previous(v);
|
|
2967
|
-
if (!diff.innerHTML) diff.innerHTML =
|
|
3149
|
+
if (!diff.innerHTML) diff.innerHTML = versionCompareHtml(prev, v);
|
|
2968
3150
|
show('compare');
|
|
2969
3151
|
return;
|
|
2970
3152
|
}
|
|
@@ -3226,7 +3408,7 @@ ${renderMarkdownScript}
|
|
|
3226
3408
|
btn.disabled = false;
|
|
3227
3409
|
if (!r.ok) { result.textContent = r.body.error || 'Could not start it.'; return; }
|
|
3228
3410
|
var started = workflowsById[id];
|
|
3229
|
-
result.innerHTML = 'Started. Questions and approvals go to ' + workflowDecisionsTo(started || {}) + ';
|
|
3411
|
+
result.innerHTML = 'Started. Questions and approvals go to ' + workflowDecisionsTo(started || {}) + '; follow it in Activity.' + (started && started.delivery && started.delivery.result_to_chat ? ' The result will also be posted to the messaging app when it finishes.' : '') +
|
|
3230
3412
|
(r.body.warnings ? ' ' + escapeHtml(r.body.warnings.join(' ')) : '');
|
|
3231
3413
|
setTimeout(function () { loadWorkflowsSection(name); }, 800);
|
|
3232
3414
|
});
|
|
@@ -3309,7 +3491,7 @@ ${renderMarkdownScript}
|
|
|
3309
3491
|
var nameSection =
|
|
3310
3492
|
'<h3>Name <button type="button" class="edit-btn" id="editDisplayNameBtn">Edit</button></h3>' +
|
|
3311
3493
|
'<p class="ov-name"><span id="displayNameDisplay">' + escapeHtml(cfg.displayName || cfg.name) + '</span>' +
|
|
3312
|
-
' <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>' +
|
|
3313
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>',
|
|
3314
3496
|
'<form class="add-source" id="displayNameForm" style="display:none">' +
|
|
3315
3497
|
'<label>Name<input type="text" name="displayName" maxlength="60" placeholder="' + escapeHtml(cfg.name) + '" value="' + escapeHtml(cfg.displayName || '') + '"></label>' +
|
|
@@ -3319,9 +3501,9 @@ ${renderMarkdownScript}
|
|
|
3319
3501
|
'</form>');
|
|
3320
3502
|
|
|
3321
3503
|
var systemPromptSection =
|
|
3322
|
-
'<h3>
|
|
3504
|
+
'<h3>Instructions <button type="button" class="edit-btn" id="editSystemPromptBtn">Edit</button></h3>' +
|
|
3323
3505
|
'<pre id="systemPromptDisplay">' + escapeHtml(cfg.systemPrompt) + '</pre>' +
|
|
3324
|
-
editDialogHtml('<h3>Edit
|
|
3506
|
+
editDialogHtml('<h3>Edit instructions</h3>', '<p>What the agent reads on every run: who it is and the rules it always follows.</p>',
|
|
3325
3507
|
'<form class="add-source" id="systemPromptForm" style="display:none">' +
|
|
3326
3508
|
'<textarea name="systemPrompt" class="ed-tall">' + escapeHtml(cfg.systemPrompt) + '</textarea>' +
|
|
3327
3509
|
'<div class="error" id="systemPromptError"></div>' +
|
|
@@ -3340,13 +3522,13 @@ ${renderMarkdownScript}
|
|
|
3340
3522
|
modelSection =
|
|
3341
3523
|
'<h3>Model <button type="button" class="edit-btn" id="editModelBtn">Edit</button></h3>' +
|
|
3342
3524
|
'<dl class="kv" id="modelDisplay">' +
|
|
3343
|
-
'<dt>Provider</dt><dd>' + escapeHtml(cfg.model.provider) + '</dd>' +
|
|
3525
|
+
'<dt>Provider</dt><dd>' + escapeHtml(providerName(cfg.model.provider)) + '</dd>' +
|
|
3344
3526
|
'<dt>Model</dt><dd>' + escapeHtml(cfg.model.model || '(provider default)') + '</dd>' +
|
|
3345
|
-
'<dt>
|
|
3527
|
+
'<dt>Longest reply</dt><dd>' + escapeHtml(cfg.model.maxTokens != null ? Number(cfg.model.maxTokens).toLocaleString() + ' tokens' : 'The provider' + String.fromCharCode(8217) + 's default') + '</dd>' +
|
|
3346
3528
|
// Unset is low for OpenAI's reasoning models (core/model-calls/openai-model-call.ts).
|
|
3347
3529
|
'<dt>Reasoning effort</dt><dd>' + escapeHtml(cfg.model.reasoningEffort ||
|
|
3348
3530
|
(cfg.model.provider === 'openai' && /^(gpt-[5-9]|o[0-9])/i.test(cfg.model.model || '') ? 'low (default)'
|
|
3349
|
-
: REASONING_PROVIDERS.indexOf(cfg.model.provider) !== -1 ? '
|
|
3531
|
+
: REASONING_PROVIDERS.indexOf(cfg.model.provider) !== -1 ? 'The model' + String.fromCharCode(8217) + 's default' : 'Not supported by this provider')) + '</dd>' +
|
|
3350
3532
|
'</dl>' +
|
|
3351
3533
|
editDialogHtml('<h3>Edit model</h3>', '<p>The model this agent uses, and how much it may write and think.</p>',
|
|
3352
3534
|
'<form class="add-source" id="modelForm" style="display:none">' +
|
|
@@ -3378,22 +3560,22 @@ ${renderMarkdownScript}
|
|
|
3378
3560
|
return renderOverviewCards(cfg) +
|
|
3379
3561
|
'<section>' + nameSection + '</section>' +
|
|
3380
3562
|
'<section>' + systemPromptSection + '</section>' +
|
|
3381
|
-
'<section>' + modelSection + '</section>' +
|
|
3382
|
-
'<section><h3>Limits
|
|
3383
|
-
'<dl class="kv" id="limitsDisplay">' +
|
|
3384
|
-
'<dt>
|
|
3385
|
-
'<dt>
|
|
3386
|
-
'<dt>
|
|
3563
|
+
'<section data-advanced>' + modelSection + '</section>' +
|
|
3564
|
+
'<section data-advanced><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3565
|
+
'<dl class="kv kv-wide" id="limitsDisplay">' +
|
|
3566
|
+
'<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
|
|
3567
|
+
'<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
|
|
3568
|
+
'<dt>Skill list size</dt><dd>' + escapeHtml(Number(cfg.skillIndexBudgetTokens).toLocaleString()) + ' tokens <span class="hint">for the names and descriptions of its skills</span></dd>' +
|
|
3387
3569
|
'</dl>' +
|
|
3388
|
-
editDialogHtml('<h3>Edit limits
|
|
3570
|
+
editDialogHtml('<h3>Edit limits</h3>', '<p>How long a run may go on, and how much of its conversation it keeps.</p>',
|
|
3389
3571
|
'<form class="add-source" id="limitsForm" style="display:none">' +
|
|
3390
|
-
'<label>
|
|
3572
|
+
'<label>Model turns per run <span class="hint">(the most model calls in one chat turn or workflow run; then it stops)</span>' +
|
|
3391
3573
|
'<input type="number" name="maxTurns" min="1" step="1" value="' + escapeHtml(cfg.maxTurns) + '">' +
|
|
3392
3574
|
'</label>' +
|
|
3393
|
-
'<label>
|
|
3575
|
+
'<label>Conversation size <span class="hint">(tokens; beyond this, older steps are summarised)</span>' +
|
|
3394
3576
|
'<input type="number" name="contextBudgetTokens" min="1" step="1" value="' + escapeHtml(cfg.contextBudgetTokens) + '">' +
|
|
3395
3577
|
'</label>' +
|
|
3396
|
-
'<label>Skill
|
|
3578
|
+
'<label>Skill list size <span class="hint">(tokens for the names and descriptions of its skills, which it always reads)</span>' +
|
|
3397
3579
|
'<input type="number" name="skillIndexBudgetTokens" min="1" step="1" value="' + escapeHtml(cfg.skillIndexBudgetTokens) + '">' +
|
|
3398
3580
|
'</label>' +
|
|
3399
3581
|
'<div class="error" id="limitsError"></div>' +
|
|
@@ -3402,7 +3584,7 @@ ${renderMarkdownScript}
|
|
|
3402
3584
|
'</section>';
|
|
3403
3585
|
}
|
|
3404
3586
|
|
|
3405
|
-
// Wires the
|
|
3587
|
+
// Wires the Instructions / Model / Limits Edit buttons rendered by
|
|
3406
3588
|
// renderOverviewHtml above — called every time that HTML gets (re)set
|
|
3407
3589
|
// (renderDetail, refreshOverviewPanel, refreshSkillsDependentPanels),
|
|
3408
3590
|
// same pattern every other tab's own wireXHandlers already follows.
|
|
@@ -3769,7 +3951,7 @@ ${renderMarkdownScript}
|
|
|
3769
3951
|
// its package name.
|
|
3770
3952
|
function abilityCellHtml(x) {
|
|
3771
3953
|
if (x.app) return '<span title="' + escapeHtml(x.ability || '') + '">' + escapeHtml(x.app) + '</span>';
|
|
3772
|
-
return x.ability ? '<code>' + escapeHtml(x.ability) + '</code>' : '';
|
|
3954
|
+
return x.ability ? '<code>' + escapeHtml(x.ability) + '</code>' : '<span class="hint">The agent' + String.fromCharCode(8217) + 's own</span>';
|
|
3773
3955
|
}
|
|
3774
3956
|
|
|
3775
3957
|
// The Permissions tab: every tool the agent has, each with its ability
|
|
@@ -3784,15 +3966,15 @@ ${renderMarkdownScript}
|
|
|
3784
3966
|
: '<span class="le-pill ' + escapeHtml(t.decision) + '">' + escapeHtml(DECISION_LABELS[t.decision] || t.decision) + '</span>';
|
|
3785
3967
|
var note = t.isDefault ? 'default' : t.scopeNote;
|
|
3786
3968
|
return '<tr>' +
|
|
3787
|
-
'<td>' + abilityCellHtml(t) + '</td>' +
|
|
3788
3969
|
'<td><code>' + escapeHtml(t.tool) + '</code></td>' +
|
|
3970
|
+
'<td>' + abilityCellHtml(t) + '</td>' +
|
|
3789
3971
|
'<td>' + decision + (note ? ' <span class="hint">' + escapeHtml(note) + '</span>' : '') + '</td>' +
|
|
3790
3972
|
'</tr>';
|
|
3791
3973
|
}).join('');
|
|
3792
3974
|
return '<p class="muted" style="margin:0 0 20px">Decide which tool calls run on their own (Allow), which wait for a person (Ask me), and which never run (Never). Click to change; it's saved at once. Scoped rules, adding and removing rules are in <a href="?tab=advanced" data-tab="advanced">Advanced</a>.</p>' +
|
|
3793
3975
|
'<section><h3>Tools (' + tools.length + ')</h3>' +
|
|
3794
3976
|
(tools.length
|
|
3795
|
-
? '<div class="le-table-wrap"><table class="actauth-rules"><thead><tr><th>
|
|
3977
|
+
? '<div class="le-table-wrap"><table class="actauth-rules"><thead><tr><th>Tool</th><th>From</th><th>Permission</th></tr></thead><tbody>' + rows + '</tbody></table></div>'
|
|
3796
3978
|
: '<p class="hint">This agent has no tools yet. Install an ability, or add a tool in Advanced.</p>') +
|
|
3797
3979
|
'<p class="error" id="toolsDecisionError" style="margin:6px 0 0"></p></section>' +
|
|
3798
3980
|
'<section><h3>When no rule matches</h3>' +
|
|
@@ -4099,7 +4281,7 @@ ${renderMarkdownScript}
|
|
|
4099
4281
|
}
|
|
4100
4282
|
|
|
4101
4283
|
function renderConnectionsHtml(n) {
|
|
4102
|
-
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.') : '') +
|
|
4103
4285
|
'<div class="msg-conns">' + (n.channels || ['slack', 'telegram', 'lark', 'email', 'webhook']).map(function (c) { return renderConnectionSection(n, c); }).join('') + '</div>';
|
|
4104
4286
|
}
|
|
4105
4287
|
|
|
@@ -4157,7 +4339,7 @@ ${renderMarkdownScript}
|
|
|
4157
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>'
|
|
4158
4340
|
: '<p class="hint">No approvers yet. Until you add someone, anyone can use the buttons, and deciding by reply is off.</p>') +
|
|
4159
4341
|
(n.canSave === false
|
|
4160
|
-
? '
|
|
4342
|
+
? leShell.adminNote('Changing approvers needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server.')
|
|
4161
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>' +
|
|
4162
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>' +
|
|
4163
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>' : '') +
|
|
@@ -5634,7 +5816,7 @@ ${renderMarkdownScript}
|
|
|
5634
5816
|
'</span></label>';
|
|
5635
5817
|
}).join('') + '</div>' +
|
|
5636
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>' +
|
|
5637
|
-
(agentApps.canChange ? '' : '
|
|
5819
|
+
(agentApps.canChange ? '' : leShell.adminNote('Changing an agent' + String.fromCharCode(8217) + 's tools needs <code>LOOPENGINE_ADMIN_AUTH</code> set.')) +
|
|
5638
5820
|
(p.message ? '<span class="' + (p.messageBad ? 'error' : 'hint') + '">' + escapeHtml(p.message) + '</span>' : '') + '</div>' +
|
|
5639
5821
|
'</div>';
|
|
5640
5822
|
}
|
|
@@ -5950,7 +6132,7 @@ ${renderMarkdownScript}
|
|
|
5950
6132
|
// describeGatewayTools), a real cost not worth paying up front. ----
|
|
5951
6133
|
|
|
5952
6134
|
function renderToolsTabHtml(cfg) {
|
|
5953
|
-
return '<p class="muted" style="margin:0 0 20px">Everything this agent can call. <strong>
|
|
6135
|
+
return '<p class="muted" style="margin:0 0 20px">Everything this agent can call. <strong>Permission</strong> is set in the Permissions tab.</p>' +
|
|
5954
6136
|
'<section><h3>Your tools (' + cfg.localTools.length + ')</h3>' + renderLocalTools(cfg.localTools) +
|
|
5955
6137
|
'<div class="admin-subsection"><button type="button" class="open-http-tool-form">Create an HTTP tool</button>' +
|
|
5956
6138
|
editDialogHtml('<h3 id="httpToolFormHeading">Create an HTTP tool</h3>', '<p>A tool that calls a web address, with the fields the agent fills in.</p>', renderHttpToolFormHtml()) + '</div>' +
|
|
@@ -6656,9 +6838,16 @@ ${renderMarkdownScript}
|
|
|
6656
6838
|
.catch(function () {});
|
|
6657
6839
|
}
|
|
6658
6840
|
|
|
6841
|
+
// A model provider by its name: OpenAI, Anthropic, Gemini...
|
|
6842
|
+
var PROVIDER_NAMES = { openai: 'OpenAI', anthropic: 'Anthropic', gemini: 'Gemini', meta: 'Meta', xai: 'xAI', deepseek: 'DeepSeek', kimi: 'Kimi', glm: 'GLM' };
|
|
6843
|
+
function providerName(p) { return PROVIDER_NAMES[p] || p; }
|
|
6844
|
+
// What a call no rule covers does, in words.
|
|
6845
|
+
var DEFAULT_DECISIONS = { allow: 'runs on its own', ask: 'asks you first', deny: 'never runs' };
|
|
6846
|
+
var OTHER_CALLS = { allow: 'run on their own', ask: 'ask you first', deny: 'never run' };
|
|
6847
|
+
function defaultDecisionText(d) { return 'Other tool calls ' + (OTHER_CALLS[d] || d); }
|
|
6659
6848
|
function modelChip(cfg) {
|
|
6660
6849
|
if (typeof cfg.model === 'string') return { text: cfg.model, mono: true };
|
|
6661
|
-
return { text: cfg.model.provider + ' \u00b7 ' + (cfg.model.model || 'default model')
|
|
6850
|
+
return { text: providerName(cfg.model.provider) + ' \u00b7 ' + (cfg.model.model || 'default model') };
|
|
6662
6851
|
}
|
|
6663
6852
|
|
|
6664
6853
|
function renderDetail(cfg) {
|
|
@@ -6669,7 +6858,7 @@ ${renderMarkdownScript}
|
|
|
6669
6858
|
name: cfg.name,
|
|
6670
6859
|
displayName: cfg.displayName,
|
|
6671
6860
|
prompt: cfg.systemPrompt,
|
|
6672
|
-
chips: [modelChip(cfg), { text:
|
|
6861
|
+
chips: [modelChip(cfg), { text: defaultDecisionText(cfg.permissions.defaultDecision) }],
|
|
6673
6862
|
tab: currentTab,
|
|
6674
6863
|
counts: { tools: cfg.tools.length, skills: cfg.skills.length, abilities: cfg.abilityCount, workflows: cfg.skills.filter(function (s) { return s.workflow; }).length },
|
|
6675
6864
|
}) +
|
|
@@ -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); }
|
|
@@ -48,9 +51,9 @@ ${consoleSidebarHtml}
|
|
|
48
51
|
<div class="le-head plain">
|
|
49
52
|
<div class="le-head-row">
|
|
50
53
|
<div class="le-title"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>
|
|
51
|
-
<div><h1>Agents</h1><p>
|
|
54
|
+
<div><h1>Agents</h1><p>Each agent has its own instructions, tools and permissions. Open one to chat with it, give it workflows, or change how it works.</p></div>
|
|
52
55
|
</div>
|
|
53
|
-
<div style="display:flex;gap:8px;flex-wrap:wrap"><a href="/
|
|
56
|
+
<div style="display:flex;gap:8px;flex-wrap:wrap"><a href="/interview" style="padding:6px 12px;border:1px solid var(--line);border-radius:6px;text-decoration:none;color:var(--ink);font-size:13px">Find your first agent</a>
|
|
54
57
|
<button type="button" id="newAgentBtn" class="primary">New agent</button></div>
|
|
55
58
|
</div>
|
|
56
59
|
</div>
|
|
@@ -64,7 +67,7 @@ ${consoleSidebarHtml}
|
|
|
64
67
|
<label>ID <span class="hint">(lowercase and hyphens; its folder agents/<id>/ and API address use it, so it can't be changed later)</span>
|
|
65
68
|
<input type="text" name="name" placeholder="weather-assistant" pattern="[a-z0-9]+(-[a-z0-9]+)*" required>
|
|
66
69
|
</label>
|
|
67
|
-
<label>
|
|
70
|
+
<label>Instructions <span class="hint">(who it is and the rules it always follows)</span>
|
|
68
71
|
<textarea name="systemPrompt" placeholder="You are ..."></textarea>
|
|
69
72
|
</label>
|
|
70
73
|
<label>Model provider
|
|
@@ -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; }
|
|
@@ -29,6 +29,9 @@ export const globalConfigPageHtml = `<!doctype html>
|
|
|
29
29
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
30
30
|
<title>LoopEngine Settings</title>
|
|
31
31
|
<style>${devUiCss}
|
|
32
|
+
.ability-name { display: grid; gap: 1px; }
|
|
33
|
+
.ability-name .hint { white-space: nowrap; }
|
|
34
|
+
.ability-name .hint code { font-size: 11px; }
|
|
32
35
|
.policy-versions { margin-top: 12px; max-width: 720px; font-size: 13px; }
|
|
33
36
|
.policy-versions summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); }
|
|
34
37
|
.policy-versions ol { list-style: none; margin: 10px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
|
|
@@ -165,8 +168,9 @@ ${consoleShellScript}
|
|
|
165
168
|
|
|
166
169
|
// Each provider's logo (web/provider-icons.ts), shown beside its name.
|
|
167
170
|
var PROVIDER_ICONS = ${JSON.stringify(PROVIDER_ICONS)};
|
|
171
|
+
var PROVIDER_NAMES = { openai: 'OpenAI', anthropic: 'Anthropic', gemini: 'Gemini', meta: 'Meta', xai: 'xAI', deepseek: 'DeepSeek', kimi: 'Kimi', glm: 'GLM' };
|
|
168
172
|
function providerName(provider) {
|
|
169
|
-
return '<span class="provider-name">' + (PROVIDER_ICONS[provider] || '') + '<
|
|
173
|
+
return '<span class="provider-name">' + (PROVIDER_ICONS[provider] || '') + '<span>' + escapeHtml(PROVIDER_NAMES[provider] || provider) + '</span></span>';
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
function renderModels(data) {
|
|
@@ -179,25 +183,27 @@ ${consoleShellScript}
|
|
|
179
183
|
'<button type="submit">Save</button>' +
|
|
180
184
|
(p.configured ? '<button type="button" class="delete-btn" data-remove-key="' + escapeHtml(p.provider) + '">Remove</button>' : '') +
|
|
181
185
|
'</form><div class="key-msg" data-key-msg="' + escapeHtml(p.provider) + '"></div>'
|
|
182
|
-
: '
|
|
186
|
+
: '';
|
|
183
187
|
return '<tr><td>' + providerName(p.provider) + '</td>' +
|
|
188
|
+
'<td>' + badge(p.configured, 'Key set', 'No key') + '</td>' +
|
|
184
189
|
'<td><code>' + escapeHtml(p.envVar) + '</code></td>' +
|
|
185
|
-
'<td>' +
|
|
186
|
-
'<td>' + keyCell + '</td></tr>';
|
|
190
|
+
(data.canSave ? '<td>' + keyCell + '</td>' : '') + '</tr>';
|
|
187
191
|
}).join('');
|
|
192
|
+
// Without the admin sign-in, keys can't be saved here: said once.
|
|
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.');
|
|
188
194
|
|
|
189
195
|
var agentRows = data.agents.length
|
|
190
196
|
? data.agents.map(function (a) {
|
|
191
|
-
return '<tr><td><
|
|
197
|
+
return '<tr><td><a href="/agents/config?agent=' + encodeURIComponent(a.agent) + '">' + escapeHtml(a.agent) + '</a></td>' +
|
|
192
198
|
'<td>' + providerName(a.provider) + '</td>' +
|
|
193
199
|
'<td><code>' + escapeHtml(a.model) + '</code></td></tr>';
|
|
194
200
|
}).join('')
|
|
195
201
|
: '<tr><td colspan="3"><p class="hint">No agents with a resolved model config (a custom createModelCall has nothing to report here).</p></td></tr>';
|
|
196
202
|
|
|
197
|
-
return '<section><h3>Providers</h3>' +
|
|
198
|
-
'<table><thead><tr><th>Provider</th><th>
|
|
203
|
+
return '<section><h3>Providers</h3>' + keysNote +
|
|
204
|
+
'<table><thead><tr><th>Provider</th><th>Status</th><th>Key name in .env</th>' + (data.canSave ? '<th>API key</th>' : '') + '</tr></thead><tbody>' + providerRows + '</tbody></table>' +
|
|
199
205
|
'</section>' +
|
|
200
|
-
'<section><h3>
|
|
206
|
+
'<section><h3>Which model each agent uses</h3>' +
|
|
201
207
|
'<table><thead><tr><th>Agent</th><th>Provider</th><th>Model</th></tr></thead><tbody>' + agentRows + '</tbody></table>' +
|
|
202
208
|
'</section>';
|
|
203
209
|
}
|
|
@@ -389,13 +395,25 @@ ${consoleShellScript}
|
|
|
389
395
|
else if (btn.classList.contains('workspace-remove-btn')) removeFromWorkspace(btn);
|
|
390
396
|
});
|
|
391
397
|
|
|
398
|
+
// An ability as people read it: its name (Gmail, from @loopengine-co/gmail)
|
|
399
|
+
// with its package and version under it.
|
|
400
|
+
function abilityNameHtml(name, version) {
|
|
401
|
+
var base = String(name).replace(/^@[^/]+[/]/, '').replace(/^loopengine-ability-/, '');
|
|
402
|
+
var title = base.split('-').map(function (w) { return w ? w.charAt(0).toUpperCase() + w.slice(1) : w; }).join(' ');
|
|
403
|
+
return '<div class="ability-name"><strong>' + escapeHtml(title) + '</strong><span class="hint"><code>' + escapeHtml(name) + '</code>' + (version ? ' ' + escapeHtml(version) : '') + '</span></div>';
|
|
404
|
+
}
|
|
405
|
+
// Its description without the "A loopengine ability:" every one begins with.
|
|
406
|
+
function abilityAbout(text) {
|
|
407
|
+
return escapeHtml(String(text || '').replace(/^an? loopengine ability: */i, '').replace(/^./, function (c) { return c.toUpperCase(); }));
|
|
408
|
+
}
|
|
409
|
+
|
|
392
410
|
function renderSearchResults() {
|
|
393
411
|
var resultsEl = document.getElementById('abilitySearchResults');
|
|
394
412
|
var results = lastSearch.results;
|
|
395
413
|
resultsEl.innerHTML = results.length
|
|
396
414
|
? '<table><thead><tr><th>Ability</th><th>What it does</th><th></th></tr></thead><tbody>' + results.map(function (pkg) {
|
|
397
|
-
return '<tr><td
|
|
398
|
-
'<td>' +
|
|
415
|
+
return '<tr><td>' + abilityNameHtml(pkg.name, pkg.version) + '</td>' +
|
|
416
|
+
'<td>' + abilityAbout(pkg.description) + '</td>' +
|
|
399
417
|
'<td style="white-space:nowrap">' + detailsButton(pkg.name + '@' + pkg.version) + '</td></tr>';
|
|
400
418
|
}).join('') + '</tbody></table>'
|
|
401
419
|
: '<p class="hint">No published abilities match.</p>';
|
|
@@ -444,8 +462,8 @@ ${consoleShellScript}
|
|
|
444
462
|
: copy.version && a.version && copy.version !== a.version
|
|
445
463
|
? '<span class="hint">In workspace (' + escapeHtml(copy.version) + ')</span> <button type="button" class="workspace-install-btn" data-spec="' + escapeHtml(a.spec) + '">Update to ' + escapeHtml(a.version) + '</button>'
|
|
446
464
|
: '<span class="hint">In workspace</span>';
|
|
447
|
-
return '<tr><td
|
|
448
|
-
'<td>' +
|
|
465
|
+
return '<tr><td>' + abilityNameHtml(a.name, a.version) + '</td>' +
|
|
466
|
+
'<td>' + abilityAbout(a.description) + '</td>' +
|
|
449
467
|
'<td style="white-space:nowrap">' + detailsButton(a.spec) + ' ' + action + '</td></tr>';
|
|
450
468
|
}).join('') + '</tbody></table>'
|
|
451
469
|
: '<p class="hint" style="margin:0">No abilities found here.</p>';
|
|
@@ -680,7 +698,7 @@ ${consoleShellScript}
|
|
|
680
698
|
apps.apps.forEach(function (a) { if (categories.indexOf(a.category) === -1) categories.push(a.category); });
|
|
681
699
|
var shown = apps.apps.filter(function (a) { return appCategory === 'All' || a.category === appCategory; });
|
|
682
700
|
el.innerHTML =
|
|
683
|
-
(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.')) +
|
|
684
702
|
(signInNote ? '<p class="' + (signInNote.bad ? 'error' : 'hint') + '">' + escapeHtml(signInNote.text) + '</p>' : '') +
|
|
685
703
|
'<section><h3>Connected</h3>' + (apps.connected.length
|
|
686
704
|
? '<div class="app-list">' + apps.connected.map(function (c) {
|
|
@@ -1006,22 +1024,23 @@ ${consoleShellScript}
|
|
|
1006
1024
|
(si.dashboardUrl ? ' · <a href="' + escapeHtml(si.dashboardUrl) + '">Dashboard</a>' : '')
|
|
1007
1025
|
: si.mode === 'basic'
|
|
1008
1026
|
? 'Basic Auth (<code>LOOPENGINE_ADMIN_AUTH</code>)'
|
|
1009
|
-
: '<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>';
|
|
1010
1028
|
var rows = [
|
|
1011
1029
|
['Admin sign-in', signIn],
|
|
1012
1030
|
['LoopEngine version', '<code>' + escapeHtml(d.version) + '</code>'],
|
|
1013
|
-
['Environment name', '<code>' + escapeHtml(d.environment) + '</code> <span class="hint">(LOOPENGINE_ENV)</span>'],
|
|
1014
|
-
['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>'],
|
|
1015
|
-
['Scheduled tasks', d.scheduler === 'off' ? 'Off on this server (LOOPENGINE_SCHEDULER=off)' : 'Run by this server'],
|
|
1016
|
-
|
|
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
|
+
// With a time zone to choose, it has its own section below.
|
|
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>'],
|
|
1017
1036
|
['Theme', 'Follows your system'],
|
|
1018
1037
|
];
|
|
1019
1038
|
return '<section><table><thead><tr><th>Setting</th><th>Value</th></tr></thead><tbody>' +
|
|
1020
|
-
rows.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('') +
|
|
1021
1040
|
'</tbody></table></section>' +
|
|
1022
1041
|
(d.timeZone ? '<section><h3>Time zone</h3><div class="source" id="timeZoneBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' : '') +
|
|
1023
1042
|
'<section><h3>Shared policies</h3><div class="source" id="policiesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1024
|
-
'<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>' +
|
|
1025
1044
|
'<section><h3>Updates</h3><div class="source" id="upgradeBox"><p class="hint">Checking for a newer LoopEngine' + String.fromCharCode(8230) + '</p></div></section>';
|
|
1026
1045
|
}
|
|
1027
1046
|
|
|
@@ -1063,7 +1082,7 @@ ${consoleShellScript}
|
|
|
1063
1082
|
'<button type="submit">Add source</button>' +
|
|
1064
1083
|
'<div class="error" id="sourceError"></div>' +
|
|
1065
1084
|
'</form>'
|
|
1066
|
-
: '
|
|
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>.'));
|
|
1067
1086
|
var form = document.getElementById('sourceForm');
|
|
1068
1087
|
if (!form) return;
|
|
1069
1088
|
var TOKEN_HINTS = {
|
|
@@ -1130,7 +1149,7 @@ ${consoleShellScript}
|
|
|
1130
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. ' +
|
|
1131
1150
|
(t.chosen ? '' : 'Not chosen yet, so it' + String.fromCharCode(8217) + 's the server' + String.fromCharCode(8217) + 's (<code>' + escapeHtml(t.server) + '</code>).') + '</p>';
|
|
1132
1151
|
if (!t.canSave) {
|
|
1133
|
-
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.');
|
|
1134
1153
|
return;
|
|
1135
1154
|
}
|
|
1136
1155
|
var browserZone = '';
|
|
@@ -1180,7 +1199,7 @@ ${consoleShellScript}
|
|
|
1180
1199
|
if (!box) return;
|
|
1181
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>';
|
|
1182
1201
|
if (!p.canSave) {
|
|
1183
|
-
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.');
|
|
1184
1203
|
return;
|
|
1185
1204
|
}
|
|
1186
1205
|
box.innerHTML = intro +
|
|
@@ -1298,7 +1317,7 @@ ${consoleShellScript}
|
|
|
1298
1317
|
if (u.unavailableReason) {
|
|
1299
1318
|
box.innerHTML = headline + '<p class="hint">' + escapeHtml(u.unavailableReason) + '</p>';
|
|
1300
1319
|
} else if (!u.canUpgrade) {
|
|
1301
|
-
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>.');
|
|
1302
1321
|
} else {
|
|
1303
1322
|
box.innerHTML = headline +
|
|
1304
1323
|
'<p class="hint">' + UPGRADE_NOTE + (u.restartsItself ? '' : ' This server has nothing to restart it, so restart it yourself afterwards.') + '</p>' +
|
package/dist/web/home-page.js
CHANGED
|
@@ -148,7 +148,7 @@ ${consoleShellScript}
|
|
|
148
148
|
var s = d.summary;
|
|
149
149
|
var html =
|
|
150
150
|
'<div class="hm-stats">' +
|
|
151
|
-
'<a class="hm-stat' + (s.waiting ? ' warn' : '') + '" href="/inbox"><b>' + s.waiting + '</b><span>' +
|
|
151
|
+
'<a class="hm-stat' + (s.waiting ? ' warn' : '') + '" href="/inbox"><b>' + s.waiting + '</b><span>' + 'Waiting for you' + '</span></a>' +
|
|
152
152
|
'<a class="hm-stat" href="/workflows"><b>' + s.runsThisWeek + '</b><span>Runs in the last 7 days</span></a>' +
|
|
153
153
|
'<a class="hm-stat" href="/workflows"><b>' + s.failedThisWeek + '</b><span>Failed in the last 7 days</span></a>' +
|
|
154
154
|
'</div>';
|
|
@@ -106,7 +106,7 @@ ${consoleShellScript}
|
|
|
106
106
|
var s = d.summary;
|
|
107
107
|
var stats =
|
|
108
108
|
'<div class="wo-stats">' +
|
|
109
|
-
'<a class="wo-stat' + (s.waiting ? ' warn' : '') + '" href="/inbox"><b>' + s.waiting + '</b><span>' +
|
|
109
|
+
'<a class="wo-stat' + (s.waiting ? ' warn' : '') + '" href="/inbox"><b>' + s.waiting + '</b><span>' + 'Waiting for you' + '</span></a>' +
|
|
110
110
|
'<div class="wo-stat"><b>' + s.runsThisWeek + '</b><span>Runs in the last 7 days</span></div>' +
|
|
111
111
|
'<div class="wo-stat"><b>' + s.failedThisWeek + '</b><span>Failed in the last 7 days</span></div>' +
|
|
112
112
|
'<div class="wo-stat"><b>' + s.workflows + '</b><span>' + (s.workflows === 1 ? 'Workflow' : 'Workflows') + '</span></div>' +
|
|
@@ -117,12 +117,12 @@ ${consoleShellScript}
|
|
|
117
117
|
'<span style="min-width:0"><div class="wo-title">' + esc(w.title) + '</div><div class="wo-sub">' + esc(w.agentLabel) + '</div></span>' +
|
|
118
118
|
'<span class="wo-col-starts wo-sub" title="' + esc(w.starts.join(', ')) + '">' + esc(w.starts.join(DOT)) + '</span>' +
|
|
119
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 ' + esc(ago(w.lastRun.at)) : 'Not run yet') + (decided ? DOT + w.approved + ' of ' + decided + ' approved' : '') + '</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
121
|
'<span class="wo-side">' + lastRunPill(w) + '</span>' +
|
|
122
122
|
'</a>';
|
|
123
123
|
}).join('');
|
|
124
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
|
|
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>';
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// The sidebar asks for the same list as the page opens: one request.
|