loopengine 0.5.3 → 0.5.4
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.
|
@@ -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-
|
|
@@ -1005,7 +1020,7 @@ ${renderMarkdownScript}
|
|
|
1005
1020
|
card('tools', 'Tools & skills', cfg.tools.length + (cfg.tools.length === 1 ? ' tool' : ' tools'),
|
|
1006
1021
|
(cfg.skills.length + (cfg.skills.length === 1 ? ' skill' : ' skills')) + (toolNames.length ? ' \u00b7 ' + escapeHtml(toolNames.slice(0, 2).join(', ') + (toolNames.length > 2 ? ', \u2026' : '')) : '')) +
|
|
1007
1022
|
card('actauth', 'Permissions', rules.length + (rules.length === 1 ? ' rule' : ' rules'),
|
|
1008
|
-
(asks ? asks + '
|
|
1023
|
+
(asks ? asks + ' ask you first \u00b7 ' : '') + escapeHtml(defaultDecisionText(cfg.permissions.defaultDecision).toLowerCase())) +
|
|
1009
1024
|
card('messaging', 'Messaging Apps', '<span id="ovMessagingValue">…</span>', '<span id="ovMessagingDetail">Loading…</span>') +
|
|
1010
1025
|
card('schedules', 'Schedules', '<span id="ovSchedulesValue">…</span>', '<span id="ovSchedulesDetail">Loading…</span>') +
|
|
1011
1026
|
card('env', 'Environment', 'Settings', '<span data-le-env-count="' + escapeHtml(cfg.name) + '">' + leShell.envCountHtml(cfg.name) + '</span> Values your installed abilities read') +
|
|
@@ -1282,7 +1297,7 @@ ${renderMarkdownScript}
|
|
|
1282
1297
|
// ---- A workflow in three parts: its contract (what the system holds it
|
|
1283
1298
|
// to: how it starts, its inputs, lookups, tools, model and result), its
|
|
1284
1299
|
// brief (what the agent reads) and its evidence (how it's doing). ----
|
|
1285
|
-
var workflowsMeta = { policies: '', agentModel: '', messaging: null };
|
|
1300
|
+
var workflowsMeta = { policies: '', agentModel: '', messaging: null, agentTools: null, limits: null };
|
|
1286
1301
|
var RSQ = String.fromCharCode(8217);
|
|
1287
1302
|
var DOT = ' ' + String.fromCharCode(183) + ' ';
|
|
1288
1303
|
|
|
@@ -1344,7 +1359,7 @@ ${renderMarkdownScript}
|
|
|
1344
1359
|
'<div class="wf-msg-dest"><div class="wf-msg-dest-k">' + chatCol + '</div><div class="hint">' +
|
|
1345
1360
|
(chatName ? 'The agent' + RSQ + 's messaging app, set in its <a href="?agent=' + encodeURIComponent(agentName) + '&tab=messaging">Messaging Apps</a> tab.'
|
|
1346
1361
|
: '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
|
|
1362
|
+
'<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
1363
|
'<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
1364
|
'<input name="msgUrl" inputmode="url" placeholder="https://example.com/hooks/loopengine" value="' + escapeHtml(d.callback_url || '') + '"></div>' +
|
|
1350
1365
|
'</div>' +
|
|
@@ -1383,7 +1398,7 @@ ${renderMarkdownScript}
|
|
|
1383
1398
|
return '<section class="wf-way wf-way-' + key + '"><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
|
|
1384
1399
|
};
|
|
1385
1400
|
return '<div class="wf-ways">' +
|
|
1386
|
-
way('run', 'Run now', 'Starts a run right away, from here.
|
|
1401
|
+
way('run', 'Run now', 'Starts a run right away, from here. Follow it in Activity.', workflowRunBarHtml(w, params)) +
|
|
1387
1402
|
way('schedule', 'Schedule', 'Runs it on a timer, like every day at 9:00. Approvals and questions go where its Messaging tab says.',
|
|
1388
1403
|
(schedules || '<p class="hint" style="margin:0">None yet.</p>') +
|
|
1389
1404
|
'<div><button type="button" class="workflow-add-schedule">+ Schedule</button></div>') +
|
|
@@ -1395,8 +1410,21 @@ ${renderMarkdownScript}
|
|
|
1395
1410
|
'</div>';
|
|
1396
1411
|
}
|
|
1397
1412
|
|
|
1413
|
+
// Its Contract tab: what every run is held to, as the system enforces
|
|
1414
|
+
// it, apart from what the agent is only asked to do. Held to: the
|
|
1415
|
+
// published version; how it starts; its inputs, checked before it
|
|
1416
|
+
// starts; the tools it can call (every tool the agent has) and their
|
|
1417
|
+
// permissions; its output schema, checked on its result; its model;
|
|
1418
|
+
// where approvals go; its limits; where its result goes. Asked: its
|
|
1419
|
+
// prompt and the shared policies, its result format, and its success
|
|
1420
|
+
// criteria (judged in Evaluation only).
|
|
1398
1421
|
function workflowContractHtml(w, name, params) {
|
|
1399
|
-
|
|
1422
|
+
var row = function (k, lines) { return '<div class="wf-cb-k">' + k + '</div><div class="wf-cb-v">' + contractLinesHtml(lines) + '</div>'; };
|
|
1423
|
+
var hint = function (t) { return '<span class="hint">' + t + '</span>'; };
|
|
1424
|
+
|
|
1425
|
+
var version = ['the published version, <span class="wf-contract-version">' + hint('loading' + String.fromCharCode(8230)) + '</span>' +
|
|
1426
|
+
(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.')];
|
|
1427
|
+
|
|
1400
1428
|
var trigger = [];
|
|
1401
1429
|
(w.schedules || []).filter(function (x) { return x.status !== 'cancelled'; }).forEach(function (x) {
|
|
1402
1430
|
trigger.push('schedule, ' + escapeHtml(x.describe) + (x.status === 'paused' ? ' <span class="le-pill warn">Paused</span>' : ''));
|
|
@@ -1406,42 +1434,72 @@ ${renderMarkdownScript}
|
|
|
1406
1434
|
(t.waiting ? ' <span class="le-pill ask">Needs its signing secret</span>' : !t.enabled ? ' <span class="le-pill warn">Off</span>' : ''));
|
|
1407
1435
|
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
1436
|
});
|
|
1409
|
-
trigger.push('
|
|
1410
|
-
|
|
1411
|
-
|
|
1437
|
+
trigger.push('by hand (Run now) or from an app (API)');
|
|
1438
|
+
trigger.push(hint('A run with the same inputs as one still under way is turned away.'));
|
|
1439
|
+
|
|
1412
1440
|
var names = Object.keys(w.parameters || {});
|
|
1413
1441
|
var inputs = names.length ? names.map(function (n) {
|
|
1414
1442
|
var spec = w.parameters[n];
|
|
1415
1443
|
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
|
-
}) : ['
|
|
1444
|
+
return '<code>' + escapeHtml(n) + '</code>' + (spec.required ? ' (required)' : ' (optional)') + (typed ? ' ' + escapeHtml(typed) : '') + (spec.description ? ' <span class="hint">' + escapeHtml(spec.description) + '</span>' : '');
|
|
1445
|
+
}) : ['none: every run is the same'];
|
|
1446
|
+
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).'));
|
|
1447
|
+
|
|
1448
|
+
// Every tool the agent has, by permission; those its prompt names first.
|
|
1449
|
+
var named = {};
|
|
1450
|
+
(w.tools || []).forEach(function (t) { named[t.name] = true; });
|
|
1451
|
+
var all = workflowsMeta.agentTools || w.tools || [];
|
|
1418
1452
|
var groups = { allow: [], ask: [], deny: [] };
|
|
1419
|
-
|
|
1453
|
+
all.forEach(function (t) { (groups[t.decision] || groups.ask).push(t.name); });
|
|
1420
1454
|
var tools = [];
|
|
1421
1455
|
[['allow', 'runs on its own'], ['ask', 'asks you first'], ['deny', 'never runs']].forEach(function (g) {
|
|
1422
|
-
|
|
1423
|
-
|
|
1456
|
+
var list = groups[g[0]].slice().sort(function (a, b) { return Number(!named[a]) - Number(!named[b]) || a.localeCompare(b); });
|
|
1457
|
+
if (!list.length) return;
|
|
1458
|
+
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
1459
|
});
|
|
1425
|
-
if (!
|
|
1426
|
-
|
|
1427
|
-
|
|
1460
|
+
if (!all.length) tools.push('none: the agent has no tools');
|
|
1461
|
+
tools.push('built in: asking a person a question, and scheduling ' + hint('(always allowed)'));
|
|
1462
|
+
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.'));
|
|
1463
|
+
|
|
1464
|
+
var output = [];
|
|
1428
1465
|
if (w.outputSchema) {
|
|
1429
1466
|
var props = w.outputSchema.type === 'object' && w.outputSchema.properties ? Object.keys(w.outputSchema.properties) : [];
|
|
1430
|
-
|
|
1467
|
+
output.push('JSON matching its output schema' + (props.length ? ': ' + props.map(function (n) { return '<code>' + escapeHtml(n) + '</code>'; }).join(', ') : '') +
|
|
1431
1468
|
'<details class="wf-schema"><summary>Show the schema</summary><pre>' + escapeHtml(JSON.stringify(w.outputSchema, null, 2)) + '</pre></details>');
|
|
1432
|
-
|
|
1433
|
-
|
|
1469
|
+
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.'));
|
|
1470
|
+
} else output.push('not checked: no output schema ' + hint('(add one with Edit workflow to hold every result to a shape)'));
|
|
1471
|
+
|
|
1472
|
+
var model = [w.model ? escapeHtml(w.model.provider + ' ' + w.model.model) : escapeHtml(workflowsMeta.agentModel || 'the agent' + RSQ + 's') + ' ' + hint('(the agent' + RSQ + 's model)')];
|
|
1473
|
+
|
|
1474
|
+
var decisions = [(w.delivery && w.delivery.decisions_to === 'callback' ? 'your app (' + escapeHtml(w.delivery.callback_url || '') + ')' : escapeHtml(workflowChatName() || 'the Inbox') + (workflowChatName() ? ', and the Inbox' : '')),
|
|
1475
|
+
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.')];
|
|
1476
|
+
|
|
1477
|
+
var lim = workflowsMeta.limits;
|
|
1478
|
+
var limits = [lim ? 'at most ' + lim.maxTurns + ' model turns, then the run stops' : 'the agent' + RSQ + 's limit on model turns',
|
|
1479
|
+
lim ? 'its conversation kept under ' + Number(lim.contextBudgetTokens).toLocaleString() + ' tokens ' + hint('(older steps are summarised as it fills)') : '',
|
|
1480
|
+
hint('No limit on time or cost: both are recorded on each run (Activity).')].filter(Boolean);
|
|
1481
|
+
|
|
1482
|
+
var result = ['returned to whoever started it ' + hint('(Run now, or the app' + RSQ + 's API call)')];
|
|
1434
1483
|
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
|
-
|
|
1484
|
+
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');
|
|
1485
|
+
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)'));
|
|
1486
|
+
if ((w.triggers || []).some(function (t) { return t.callback; })) result.push('posted to each webhook' + RSQ + 's update address, for runs it starts');
|
|
1487
|
+
|
|
1488
|
+
var criteria = (w.evals && w.evals.criteria) || [];
|
|
1489
|
+
var asked = [
|
|
1490
|
+
'its prompt and the shared policies ' + hint('(Prompt tab; policies in Settings)'),
|
|
1491
|
+
w.output ? 'its result format: ' + escapeHtml(w.output) : 'no result format',
|
|
1492
|
+
criteria.length ? criteria.length + ' success ' + (criteria.length === 1 ? 'criterion' : 'criteria') + ' ' + hint('(judged when you evaluate it, not on live runs)') : 'no success criteria',
|
|
1493
|
+
];
|
|
1494
|
+
|
|
1495
|
+
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>' +
|
|
1496
|
+
'<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>' +
|
|
1497
|
+
'<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>' +
|
|
1498
|
+
'<div class="wf-cb">' + row('reads', asked) + '</div>' +
|
|
1499
|
+
'<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
1500
|
}
|
|
1444
1501
|
|
|
1502
|
+
|
|
1445
1503
|
function workflowBriefHtml(w) {
|
|
1446
1504
|
var policies = workflowsMeta.policies;
|
|
1447
1505
|
return '<div class="workflow-steps-text">' + escapeHtml(w.instructions) + '</div>' +
|
|
@@ -2148,7 +2206,7 @@ ${renderMarkdownScript}
|
|
|
2148
2206
|
if (currentName !== name) return;
|
|
2149
2207
|
if (!r.ok) { el.innerHTML = '<p class="error">Could not load workflows: ' + escapeHtml(r.body.error || 'unknown error') + '</p>'; return; }
|
|
2150
2208
|
var workflows = r.body.workflows || [];
|
|
2151
|
-
workflowsMeta = { policies: r.body.policies || '', agentModel: r.body.agentModel || '', messaging: r.body.messaging || null };
|
|
2209
|
+
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
2210
|
fillWorkflowsCard(workflows);
|
|
2153
2211
|
leShell.setCount('workflows', workflows.length);
|
|
2154
2212
|
workflowsById = {};
|
|
@@ -2835,9 +2893,16 @@ ${renderMarkdownScript}
|
|
|
2835
2893
|
fetch(base + '/versions', { headers: { accept: 'application/json' } })
|
|
2836
2894
|
.then(function (r) { return r.ok ? r.json() : null; })
|
|
2837
2895
|
.then(function (data) {
|
|
2838
|
-
if (!data) {
|
|
2896
|
+
if (!data) {
|
|
2897
|
+
if (box) box.innerHTML = '<p class="hint" style="margin:0">This workspace keeps no versions.</p>';
|
|
2898
|
+
var unkept = card.querySelector('.wf-contract-version');
|
|
2899
|
+
if (unkept) unkept.textContent = 'not numbered: this workspace keeps no versions';
|
|
2900
|
+
return;
|
|
2901
|
+
}
|
|
2839
2902
|
var versions = data.versions || [];
|
|
2840
2903
|
var current = versions.filter(function (v) { return v.number === data.current; })[0] || versions[0];
|
|
2904
|
+
var contractVersion = card.querySelector('.wf-contract-version');
|
|
2905
|
+
if (contractVersion) contractVersion.innerHTML = current ? '<strong>v' + current.number + '</strong>' : 'not numbered yet';
|
|
2841
2906
|
if (meta && current) {
|
|
2842
2907
|
var draft = workflowsById[card.dataset.workflow] && workflowsById[card.dataset.workflow].draft;
|
|
2843
2908
|
meta.innerHTML = '<a href="' + workflowPageHref(name, card.dataset.workflow, 'versions') + '">v' + current.number + '</a>' + (draft ? ' <span class="hint">+ draft</span>' : '');
|
|
@@ -2908,6 +2973,114 @@ ${renderMarkdownScript}
|
|
|
2908
2973
|
return '<div class="chg-lines">' + html + '</div>';
|
|
2909
2974
|
}
|
|
2910
2975
|
|
|
2976
|
+
// A version laid out like the workflow itself: its name, prompt,
|
|
2977
|
+
// inputs, result, model, tools, triggers and success criteria. A
|
|
2978
|
+
// version from when only the brief was numbered has just its prompt
|
|
2979
|
+
// and result format; one with nothing read back shows its text.
|
|
2980
|
+
var PERMISSIONS = { allow: 'runs on its own', ask: 'asks you first', deny: 'never runs' };
|
|
2981
|
+
function versionFull(v) { return Boolean(v.fields && v.fields.title !== undefined); }
|
|
2982
|
+
function versionInputsHtml(params) {
|
|
2983
|
+
var names = Object.keys(params || {});
|
|
2984
|
+
if (!names.length) return '<span class="hint">None: every run is the same</span>';
|
|
2985
|
+
return names.map(function (n) {
|
|
2986
|
+
var spec = params[n] || {};
|
|
2987
|
+
var typed = inputTypeText(spec);
|
|
2988
|
+
return '<div><code>' + escapeHtml(n) + '</code>' + (spec.required ? ' (required)' : '') + (typed ? ' ' + escapeHtml(typed) : '') + (spec.description ? ' <span class="hint">' + escapeHtml(spec.description) + '</span>' : '') + '</div>';
|
|
2989
|
+
}).join('');
|
|
2990
|
+
}
|
|
2991
|
+
function versionModelText(m) { return m ? m.provider + ' ' + m.model : 'The agent' + RSQ + 's model'; }
|
|
2992
|
+
function versionToolHtml(t) {
|
|
2993
|
+
return '<div><code>' + escapeHtml(t.name) + '</code> <span class="wf-cb-decision ' + escapeHtml(t.permission) + '">' + escapeHtml(PERMISSIONS[t.permission] || t.permission) + '</span></div>';
|
|
2994
|
+
}
|
|
2995
|
+
function versionCritText(c) { return c.text + ' (' + critKindText(c) + ')'; }
|
|
2996
|
+
function versionDetailHtml(v) {
|
|
2997
|
+
var f = v.fields;
|
|
2998
|
+
if (!f) return '<div class="workflow-steps-text">' + escapeHtml(v.content) + '</div>';
|
|
2999
|
+
var row = function (k, html) { return '<div class="wf-vd-k">' + k + '</div><div class="wf-vd-v">' + html + '</div>'; };
|
|
3000
|
+
var list = function (items, empty, fn) { return items && items.length ? items.map(fn).join('') : '<span class="hint">' + empty + '</span>'; };
|
|
3001
|
+
var rows = '';
|
|
3002
|
+
if (versionFull(v)) rows += row('Name', '<strong>' + escapeHtml(f.title) + '</strong>' + (f.description ? '<div class="hint">' + escapeHtml(f.description) + '</div>' : ''));
|
|
3003
|
+
rows += row('Prompt', '<div class="workflow-steps-text">' + escapeHtml(f.instructions || '') + '</div>');
|
|
3004
|
+
if (versionFull(v)) rows += row('Inputs', versionInputsHtml(f.parameters));
|
|
3005
|
+
rows += row('Result', (f.output ? '<div class="workflow-steps-text">' + escapeHtml(f.output) + '</div>' : '<span class="hint">No result format set</span>') +
|
|
3006
|
+
(f.outputSchema ? '<details class="wf-schema"><summary>Output schema</summary><pre>' + escapeHtml(JSON.stringify(f.outputSchema, null, 2)) + '</pre></details>' : ''));
|
|
3007
|
+
if (versionFull(v)) rows += row('Model', escapeHtml(versionModelText(f.model)));
|
|
3008
|
+
if (f.tools) rows += row('Tools', list(f.tools, 'None named in its prompt', versionToolHtml));
|
|
3009
|
+
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>'; }));
|
|
3010
|
+
if (f.criteria) rows += row('Success criteria', list(f.criteria, 'None', function (c) { return '<div>' + escapeHtml(versionCritText(c)) + '</div>'; }));
|
|
3011
|
+
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>');
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
// What changed from one version to the next, part by part: a name or
|
|
3015
|
+
// model from and to; the prompt, result format and output schema line
|
|
3016
|
+
// by line; inputs, tools, triggers and success criteria added, removed
|
|
3017
|
+
// or changed. A part the older version didn't record isn't compared.
|
|
3018
|
+
function versionCompareHtml(prev, v) {
|
|
3019
|
+
var a = prev.fields, b = v.fields;
|
|
3020
|
+
var intro = '<p class="hint" style="margin:0">What changed from version ' + prev.number + ' to version ' + v.number + '.</p>';
|
|
3021
|
+
if (!a || !b) return intro + versionDiffHtml(prev.content, v.content);
|
|
3022
|
+
var MINUS = String.fromCharCode(8722), ARROW = ' ' + String.fromCharCode(8594) + ' ';
|
|
3023
|
+
var parts = [];
|
|
3024
|
+
var add = function (label, html, summary) { parts.push({ label: label, html: html, summary: summary }); };
|
|
3025
|
+
var fromTo = function (x, y) { return '<del>' + escapeHtml(x || '(none)') + '</del>' + ARROW + '<ins>' + escapeHtml(y || '(none)') + '</ins>'; };
|
|
3026
|
+
var lines = function (x, y) {
|
|
3027
|
+
var d = versionLineDiff(x || '', y || '');
|
|
3028
|
+
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;
|
|
3029
|
+
return plus + ' line' + (plus === 1 ? '' : 's') + ' added, ' + minus + ' removed';
|
|
3030
|
+
};
|
|
3031
|
+
var setDiff = function (xs, ys, key, show) {
|
|
3032
|
+
var ka = xs.map(key), kb = ys.map(key);
|
|
3033
|
+
var out = [];
|
|
3034
|
+
ys.forEach(function (y, i) { if (ka.indexOf(kb[i]) === -1) out.push('<div class="chg-ins">+ ' + show(y) + '</div>'); });
|
|
3035
|
+
xs.forEach(function (x, i) { if (kb.indexOf(ka[i]) === -1) out.push('<div class="chg-del">' + MINUS + ' ' + show(x) + '</div>'); });
|
|
3036
|
+
return out;
|
|
3037
|
+
};
|
|
3038
|
+
var full = versionFull(prev) && versionFull(v);
|
|
3039
|
+
if (full && (a.title !== b.title || (a.description || '') !== (b.description || ''))) {
|
|
3040
|
+
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');
|
|
3041
|
+
}
|
|
3042
|
+
if ((a.instructions || '') !== (b.instructions || '')) add('Prompt', versionDiffHtml(a.instructions || '', b.instructions || ''), lines(a.instructions, b.instructions));
|
|
3043
|
+
if (full) {
|
|
3044
|
+
var pa = a.parameters || {}, pb = b.parameters || {};
|
|
3045
|
+
var inputs = [];
|
|
3046
|
+
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>'); });
|
|
3047
|
+
Object.keys(pa).forEach(function (n) { if (!(n in pb)) inputs.push('<div class="chg-del">' + MINUS + ' <code>' + escapeHtml(n) + '</code></div>'); });
|
|
3048
|
+
Object.keys(pb).forEach(function (n) {
|
|
3049
|
+
if (!(n in pa) || JSON.stringify(pa[n]) === JSON.stringify(pb[n])) return;
|
|
3050
|
+
var said = function (spec) { return [spec.required ? 'required' : 'optional', inputTypeText(spec), spec.description || ''].filter(Boolean).join(', '); };
|
|
3051
|
+
inputs.push('<div><code>' + escapeHtml(n) + '</code>: ' + fromTo(said(pa[n]), said(pb[n])) + '</div>');
|
|
3052
|
+
});
|
|
3053
|
+
if (inputs.length) add('Inputs', inputs.join(''), inputs.length + ' changed');
|
|
3054
|
+
}
|
|
3055
|
+
if ((a.output || '') !== (b.output || '')) add('Result format', versionDiffHtml(a.output || '', b.output || ''), lines(a.output, b.output));
|
|
3056
|
+
if (a.criteria !== undefined && b.criteria !== undefined && JSON.stringify(a.outputSchema || null) !== JSON.stringify(b.outputSchema || null)) {
|
|
3057
|
+
var sa = a.outputSchema ? JSON.stringify(a.outputSchema, null, 2) : '', sb = b.outputSchema ? JSON.stringify(b.outputSchema, null, 2) : '';
|
|
3058
|
+
add('Output schema', versionDiffHtml(sa, sb), !sa ? 'added' : !sb ? 'removed' : lines(sa, sb));
|
|
3059
|
+
}
|
|
3060
|
+
if (full && versionModelText(a.model) !== versionModelText(b.model)) add('Model', fromTo(versionModelText(a.model), versionModelText(b.model)), versionModelText(b.model));
|
|
3061
|
+
if (a.tools && b.tools) {
|
|
3062
|
+
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); });
|
|
3063
|
+
b.tools.forEach(function (t) {
|
|
3064
|
+
var was = a.tools.filter(function (x) { return x.name === t.name; })[0];
|
|
3065
|
+
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>');
|
|
3066
|
+
});
|
|
3067
|
+
if (tools.length) add('Tools', tools.join(''), tools.length + ' changed');
|
|
3068
|
+
}
|
|
3069
|
+
if (a.triggers && b.triggers) {
|
|
3070
|
+
var trig = setDiff(a.triggers, b.triggers, function (t) { return t; }, escapeHtml);
|
|
3071
|
+
if (trig.length) add('Triggers', trig.join(''), trig.length + ' changed');
|
|
3072
|
+
}
|
|
3073
|
+
if (a.criteria && b.criteria) {
|
|
3074
|
+
var crit = setDiff(a.criteria, b.criteria, function (c) { return c.kind + '|' + (c.value || '') + '|' + c.text; }, function (c) { return escapeHtml(versionCritText(c)); });
|
|
3075
|
+
if (crit.length) add('Success criteria', crit.join(''), crit.length + ' changed');
|
|
3076
|
+
}
|
|
3077
|
+
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>' : '';
|
|
3078
|
+
if (!parts.length) return intro + unrecorded + '<p class="hint" style="margin:0">Nothing it holds changed' + (v.reason ? ': ' + escapeHtml(v.reason) : '') + '.</p>';
|
|
3079
|
+
return intro + unrecorded +
|
|
3080
|
+
'<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>' +
|
|
3081
|
+
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('');
|
|
3082
|
+
}
|
|
3083
|
+
|
|
2911
3084
|
function renderWorkflowVersions(name, card, box, base, data) {
|
|
2912
3085
|
var versions = data.versions || [];
|
|
2913
3086
|
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 +3108,7 @@ ${renderMarkdownScript}
|
|
|
2935
3108
|
(isCurrent ? '' : '<button type="button" class="wf-version-restore">Restore</button>') +
|
|
2936
3109
|
'</span></div>' +
|
|
2937
3110
|
(v.reason ? '<p class="wf-version-reason">' + escapeHtml(v.reason) + '</p>' : '') +
|
|
2938
|
-
'<div class="
|
|
3111
|
+
'<div class="wf-version-text" hidden></div>' +
|
|
2939
3112
|
'<div class="wf-version-diff" hidden></div>' +
|
|
2940
3113
|
'<span class="hint wf-version-status" role="status"></span>' +
|
|
2941
3114
|
'</li>';
|
|
@@ -2960,11 +3133,15 @@ ${renderMarkdownScript}
|
|
|
2960
3133
|
compareBtn.textContent = which === 'compare' ? 'Hide changes' : 'Compare';
|
|
2961
3134
|
}
|
|
2962
3135
|
};
|
|
2963
|
-
if (btn.classList.contains('wf-version-view')) {
|
|
3136
|
+
if (btn.classList.contains('wf-version-view')) {
|
|
3137
|
+
if (!text.innerHTML) text.innerHTML = versionDetailHtml(v);
|
|
3138
|
+
show(text.hidden ? 'view' : null);
|
|
3139
|
+
return;
|
|
3140
|
+
}
|
|
2964
3141
|
if (btn.classList.contains('wf-version-compare')) {
|
|
2965
3142
|
if (!diff.hidden) { show(null); return; }
|
|
2966
3143
|
var prev = previous(v);
|
|
2967
|
-
if (!diff.innerHTML) diff.innerHTML =
|
|
3144
|
+
if (!diff.innerHTML) diff.innerHTML = versionCompareHtml(prev, v);
|
|
2968
3145
|
show('compare');
|
|
2969
3146
|
return;
|
|
2970
3147
|
}
|
|
@@ -3226,7 +3403,7 @@ ${renderMarkdownScript}
|
|
|
3226
3403
|
btn.disabled = false;
|
|
3227
3404
|
if (!r.ok) { result.textContent = r.body.error || 'Could not start it.'; return; }
|
|
3228
3405
|
var started = workflowsById[id];
|
|
3229
|
-
result.innerHTML = 'Started. Questions and approvals go to ' + workflowDecisionsTo(started || {}) + ';
|
|
3406
|
+
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
3407
|
(r.body.warnings ? ' ' + escapeHtml(r.body.warnings.join(' ')) : '');
|
|
3231
3408
|
setTimeout(function () { loadWorkflowsSection(name); }, 800);
|
|
3232
3409
|
});
|
|
@@ -3319,9 +3496,9 @@ ${renderMarkdownScript}
|
|
|
3319
3496
|
'</form>');
|
|
3320
3497
|
|
|
3321
3498
|
var systemPromptSection =
|
|
3322
|
-
'<h3>
|
|
3499
|
+
'<h3>Instructions <button type="button" class="edit-btn" id="editSystemPromptBtn">Edit</button></h3>' +
|
|
3323
3500
|
'<pre id="systemPromptDisplay">' + escapeHtml(cfg.systemPrompt) + '</pre>' +
|
|
3324
|
-
editDialogHtml('<h3>Edit
|
|
3501
|
+
editDialogHtml('<h3>Edit instructions</h3>', '<p>What the agent reads on every run: who it is and the rules it always follows.</p>',
|
|
3325
3502
|
'<form class="add-source" id="systemPromptForm" style="display:none">' +
|
|
3326
3503
|
'<textarea name="systemPrompt" class="ed-tall">' + escapeHtml(cfg.systemPrompt) + '</textarea>' +
|
|
3327
3504
|
'<div class="error" id="systemPromptError"></div>' +
|
|
@@ -3340,13 +3517,13 @@ ${renderMarkdownScript}
|
|
|
3340
3517
|
modelSection =
|
|
3341
3518
|
'<h3>Model <button type="button" class="edit-btn" id="editModelBtn">Edit</button></h3>' +
|
|
3342
3519
|
'<dl class="kv" id="modelDisplay">' +
|
|
3343
|
-
'<dt>Provider</dt><dd>' + escapeHtml(cfg.model.provider) + '</dd>' +
|
|
3520
|
+
'<dt>Provider</dt><dd>' + escapeHtml(providerName(cfg.model.provider)) + '</dd>' +
|
|
3344
3521
|
'<dt>Model</dt><dd>' + escapeHtml(cfg.model.model || '(provider default)') + '</dd>' +
|
|
3345
|
-
'<dt>
|
|
3522
|
+
'<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
3523
|
// Unset is low for OpenAI's reasoning models (core/model-calls/openai-model-call.ts).
|
|
3347
3524
|
'<dt>Reasoning effort</dt><dd>' + escapeHtml(cfg.model.reasoningEffort ||
|
|
3348
3525
|
(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 ? '
|
|
3526
|
+
: REASONING_PROVIDERS.indexOf(cfg.model.provider) !== -1 ? 'The model' + String.fromCharCode(8217) + 's default' : 'Not supported by this provider')) + '</dd>' +
|
|
3350
3527
|
'</dl>' +
|
|
3351
3528
|
editDialogHtml('<h3>Edit model</h3>', '<p>The model this agent uses, and how much it may write and think.</p>',
|
|
3352
3529
|
'<form class="add-source" id="modelForm" style="display:none">' +
|
|
@@ -3379,21 +3556,21 @@ ${renderMarkdownScript}
|
|
|
3379
3556
|
'<section>' + nameSection + '</section>' +
|
|
3380
3557
|
'<section>' + systemPromptSection + '</section>' +
|
|
3381
3558
|
'<section>' + modelSection + '</section>' +
|
|
3382
|
-
'<section><h3>Limits
|
|
3383
|
-
'<dl class="kv" id="limitsDisplay">' +
|
|
3384
|
-
'<dt>
|
|
3385
|
-
'<dt>
|
|
3386
|
-
'<dt>
|
|
3559
|
+
'<section><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3560
|
+
'<dl class="kv kv-wide" id="limitsDisplay">' +
|
|
3561
|
+
'<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
|
|
3562
|
+
'<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
|
|
3563
|
+
'<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
3564
|
'</dl>' +
|
|
3388
|
-
editDialogHtml('<h3>Edit limits
|
|
3565
|
+
editDialogHtml('<h3>Edit limits</h3>', '<p>How long a run may go on, and how much of its conversation it keeps.</p>',
|
|
3389
3566
|
'<form class="add-source" id="limitsForm" style="display:none">' +
|
|
3390
|
-
'<label>
|
|
3567
|
+
'<label>Model turns per run <span class="hint">(the most model calls in one chat turn or workflow run; then it stops)</span>' +
|
|
3391
3568
|
'<input type="number" name="maxTurns" min="1" step="1" value="' + escapeHtml(cfg.maxTurns) + '">' +
|
|
3392
3569
|
'</label>' +
|
|
3393
|
-
'<label>
|
|
3570
|
+
'<label>Conversation size <span class="hint">(tokens; beyond this, older steps are summarised)</span>' +
|
|
3394
3571
|
'<input type="number" name="contextBudgetTokens" min="1" step="1" value="' + escapeHtml(cfg.contextBudgetTokens) + '">' +
|
|
3395
3572
|
'</label>' +
|
|
3396
|
-
'<label>Skill
|
|
3573
|
+
'<label>Skill list size <span class="hint">(tokens for the names and descriptions of its skills, which it always reads)</span>' +
|
|
3397
3574
|
'<input type="number" name="skillIndexBudgetTokens" min="1" step="1" value="' + escapeHtml(cfg.skillIndexBudgetTokens) + '">' +
|
|
3398
3575
|
'</label>' +
|
|
3399
3576
|
'<div class="error" id="limitsError"></div>' +
|
|
@@ -3402,7 +3579,7 @@ ${renderMarkdownScript}
|
|
|
3402
3579
|
'</section>';
|
|
3403
3580
|
}
|
|
3404
3581
|
|
|
3405
|
-
// Wires the
|
|
3582
|
+
// Wires the Instructions / Model / Limits Edit buttons rendered by
|
|
3406
3583
|
// renderOverviewHtml above — called every time that HTML gets (re)set
|
|
3407
3584
|
// (renderDetail, refreshOverviewPanel, refreshSkillsDependentPanels),
|
|
3408
3585
|
// same pattern every other tab's own wireXHandlers already follows.
|
|
@@ -3769,7 +3946,7 @@ ${renderMarkdownScript}
|
|
|
3769
3946
|
// its package name.
|
|
3770
3947
|
function abilityCellHtml(x) {
|
|
3771
3948
|
if (x.app) return '<span title="' + escapeHtml(x.ability || '') + '">' + escapeHtml(x.app) + '</span>';
|
|
3772
|
-
return x.ability ? '<code>' + escapeHtml(x.ability) + '</code>' : '';
|
|
3949
|
+
return x.ability ? '<code>' + escapeHtml(x.ability) + '</code>' : '<span class="hint">The agent' + String.fromCharCode(8217) + 's own</span>';
|
|
3773
3950
|
}
|
|
3774
3951
|
|
|
3775
3952
|
// The Permissions tab: every tool the agent has, each with its ability
|
|
@@ -3784,15 +3961,15 @@ ${renderMarkdownScript}
|
|
|
3784
3961
|
: '<span class="le-pill ' + escapeHtml(t.decision) + '">' + escapeHtml(DECISION_LABELS[t.decision] || t.decision) + '</span>';
|
|
3785
3962
|
var note = t.isDefault ? 'default' : t.scopeNote;
|
|
3786
3963
|
return '<tr>' +
|
|
3787
|
-
'<td>' + abilityCellHtml(t) + '</td>' +
|
|
3788
3964
|
'<td><code>' + escapeHtml(t.tool) + '</code></td>' +
|
|
3965
|
+
'<td>' + abilityCellHtml(t) + '</td>' +
|
|
3789
3966
|
'<td>' + decision + (note ? ' <span class="hint">' + escapeHtml(note) + '</span>' : '') + '</td>' +
|
|
3790
3967
|
'</tr>';
|
|
3791
3968
|
}).join('');
|
|
3792
3969
|
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
3970
|
'<section><h3>Tools (' + tools.length + ')</h3>' +
|
|
3794
3971
|
(tools.length
|
|
3795
|
-
? '<div class="le-table-wrap"><table class="actauth-rules"><thead><tr><th>
|
|
3972
|
+
? '<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
3973
|
: '<p class="hint">This agent has no tools yet. Install an ability, or add a tool in Advanced.</p>') +
|
|
3797
3974
|
'<p class="error" id="toolsDecisionError" style="margin:6px 0 0"></p></section>' +
|
|
3798
3975
|
'<section><h3>When no rule matches</h3>' +
|
|
@@ -5950,7 +6127,7 @@ ${renderMarkdownScript}
|
|
|
5950
6127
|
// describeGatewayTools), a real cost not worth paying up front. ----
|
|
5951
6128
|
|
|
5952
6129
|
function renderToolsTabHtml(cfg) {
|
|
5953
|
-
return '<p class="muted" style="margin:0 0 20px">Everything this agent can call. <strong>
|
|
6130
|
+
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
6131
|
'<section><h3>Your tools (' + cfg.localTools.length + ')</h3>' + renderLocalTools(cfg.localTools) +
|
|
5955
6132
|
'<div class="admin-subsection"><button type="button" class="open-http-tool-form">Create an HTTP tool</button>' +
|
|
5956
6133
|
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 +6833,16 @@ ${renderMarkdownScript}
|
|
|
6656
6833
|
.catch(function () {});
|
|
6657
6834
|
}
|
|
6658
6835
|
|
|
6836
|
+
// A model provider by its name: OpenAI, Anthropic, Gemini...
|
|
6837
|
+
var PROVIDER_NAMES = { openai: 'OpenAI', anthropic: 'Anthropic', gemini: 'Gemini', meta: 'Meta', xai: 'xAI', deepseek: 'DeepSeek', kimi: 'Kimi', glm: 'GLM' };
|
|
6838
|
+
function providerName(p) { return PROVIDER_NAMES[p] || p; }
|
|
6839
|
+
// What a call no rule covers does, in words.
|
|
6840
|
+
var DEFAULT_DECISIONS = { allow: 'runs on its own', ask: 'asks you first', deny: 'never runs' };
|
|
6841
|
+
var OTHER_CALLS = { allow: 'run on their own', ask: 'ask you first', deny: 'never run' };
|
|
6842
|
+
function defaultDecisionText(d) { return 'Other tool calls ' + (OTHER_CALLS[d] || d); }
|
|
6659
6843
|
function modelChip(cfg) {
|
|
6660
6844
|
if (typeof cfg.model === 'string') return { text: cfg.model, mono: true };
|
|
6661
|
-
return { text: cfg.model.provider + ' \u00b7 ' + (cfg.model.model || 'default model')
|
|
6845
|
+
return { text: providerName(cfg.model.provider) + ' \u00b7 ' + (cfg.model.model || 'default model') };
|
|
6662
6846
|
}
|
|
6663
6847
|
|
|
6664
6848
|
function renderDetail(cfg) {
|
|
@@ -6669,7 +6853,7 @@ ${renderMarkdownScript}
|
|
|
6669
6853
|
name: cfg.name,
|
|
6670
6854
|
displayName: cfg.displayName,
|
|
6671
6855
|
prompt: cfg.systemPrompt,
|
|
6672
|
-
chips: [modelChip(cfg), { text:
|
|
6856
|
+
chips: [modelChip(cfg), { text: defaultDecisionText(cfg.permissions.defaultDecision) }],
|
|
6673
6857
|
tab: currentTab,
|
|
6674
6858
|
counts: { tools: cfg.tools.length, skills: cfg.skills.length, abilities: cfg.abilityCount, workflows: cfg.skills.filter(function (s) { return s.workflow; }).length },
|
|
6675
6859
|
}) +
|
|
@@ -48,9 +48,9 @@ ${consoleSidebarHtml}
|
|
|
48
48
|
<div class="le-head plain">
|
|
49
49
|
<div class="le-head-row">
|
|
50
50
|
<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>
|
|
51
|
+
<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
52
|
</div>
|
|
53
|
-
<div style="display:flex;gap:8px;flex-wrap:wrap"><a href="/
|
|
53
|
+
<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
54
|
<button type="button" id="newAgentBtn" class="primary">New agent</button></div>
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
@@ -64,7 +64,7 @@ ${consoleSidebarHtml}
|
|
|
64
64
|
<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
65
|
<input type="text" name="name" placeholder="weather-assistant" pattern="[a-z0-9]+(-[a-z0-9]+)*" required>
|
|
66
66
|
</label>
|
|
67
|
-
<label>
|
|
67
|
+
<label>Instructions <span class="hint">(who it is and the rules it always follows)</span>
|
|
68
68
|
<textarea name="systemPrompt" placeholder="You are ..."></textarea>
|
|
69
69
|
</label>
|
|
70
70
|
<label>Model provider
|
|
@@ -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 ? '' : '<p class="hint" style="margin:0 0 8px">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.</p>';
|
|
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>';
|
|
@@ -1013,11 +1031,12 @@ ${consoleShellScript}
|
|
|
1013
1031
|
['Environment name', '<code>' + escapeHtml(d.environment) + '</code> <span class="hint">(LOOPENGINE_ENV)</span>'],
|
|
1014
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>'],
|
|
1015
1033
|
['Scheduled tasks', d.scheduler === 'off' ? 'Off on this server (LOOPENGINE_SCHEDULER=off)' : 'Run by this server'],
|
|
1016
|
-
|
|
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><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>' +
|
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.
|