loopengine 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ export async function handleJobMessage(message, deps) {
43
43
  const threadTs = message.threadTs ?? message.ts;
44
44
  const say = (text) => connector.postInThread(message.conversation, threadTs, text);
45
45
  if (deps.plan === 'free') {
46
- await say(`Starting jobs from ${connector.name} needs LoopEngine Pro.`);
46
+ await say(`Starting runs from ${connector.name} needs LoopEngine Pro.`);
47
47
  return;
48
48
  }
49
49
  const gate = deps.allowed(message);
package/dist/index.d.ts CHANGED
@@ -147,6 +147,7 @@ export { compressResponses, serveConsoleAsset } from './web/response-compression
147
147
  export { workflowsOverviewPageHtml } from './web/workflows-overview-page.js';
148
148
  export { homeOverview, workflowsOverview, startsOf, type HomeOverview, type WorkflowsOverview, type WorkflowOverviewRow } from './web/workflows-overview.js';
149
149
  export { homePageHtml } from './web/home-page.js';
150
+ export { schedulesPageHtml } from './web/schedules-page.js';
150
151
  export { listInbox, getInboxCase, timelineOf, RECENT_DAYS, INBOX_VIEWS, type InboxView, type InboxDeps, type InboxItem, type InboxCase, type InboxPending, type InboxStep, type InboxState, type InboxArchived } from './web/inbox-admin.js';
151
152
  export { readArchived, setArchived } from './web/inbox-archive.js';
152
153
  export { startTurnTrace, type TurnTrace } from './core/trace.js';
package/dist/index.js CHANGED
@@ -138,6 +138,7 @@ export { compressResponses, serveConsoleAsset } from './web/response-compression
138
138
  export { workflowsOverviewPageHtml } from './web/workflows-overview-page.js';
139
139
  export { homeOverview, workflowsOverview, startsOf } from './web/workflows-overview.js';
140
140
  export { homePageHtml } from './web/home-page.js';
141
+ export { schedulesPageHtml } from './web/schedules-page.js';
141
142
  export { listInbox, getInboxCase, timelineOf, RECENT_DAYS, INBOX_VIEWS } from './web/inbox-admin.js';
142
143
  export { readArchived, setArchived } from './web/inbox-archive.js';
143
144
  export { startTurnTrace } from './core/trace.js';
@@ -90,7 +90,7 @@ export const agentsConfigPageHtml = `<!doctype html>
90
90
  .wf-page .workflow-result:empty { display: none; }
91
91
  .wf-tab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
92
92
  .wf-tab-head p { margin: 0; max-width: 72ch; }
93
- .wf-new-btn { flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
93
+ .wf-new-btn { flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
94
94
  .wf-new-btn:hover { filter: brightness(1.08); }
95
95
  .wf-card { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); overflow: hidden; }
96
96
  .wf-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px 16px; }
@@ -238,7 +238,7 @@ export const agentsConfigPageHtml = `<!doctype html>
238
238
  .wf-health-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
239
239
  .wf-audit-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
240
240
  .wf-audit-tools a { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
241
- .wf-audit-tools a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
241
+ .wf-audit-tools a.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
242
242
  .wf-health-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
243
243
  .wf-health-more .wf-health-table { margin-top: 8px; }
244
244
  .wf-sub-sub { font-size: 12px; font-weight: 700; color: var(--ink-muted); margin-top: 6px; }
@@ -388,6 +388,8 @@ export const agentsConfigPageHtml = `<!doctype html>
388
388
  @media (max-width: 640px) { .wf-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
389
389
  .wf-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
390
390
  /* Triggers in the pink of .delete-btn, apart from Edit's accent. */
391
+ .wf-page .wf-row-actions .workflow-edit { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
392
+ .wf-page .wf-row-actions .workflow-edit:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); opacity: 0.88; }
391
393
  .wf-row-actions .workflow-triggers-open { border-color: var(--line); background: var(--bg); color: var(--ink); }
392
394
  .wf-row-actions .workflow-triggers-open:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
393
395
  .wf-row-foot .wf-remove { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
@@ -1007,8 +1009,9 @@ ${renderMarkdownScript}
1007
1009
  var inner = '<span class="le-card-label"><span>' + label + '</span>' + (tab ? '<span aria-hidden="true">&rarr;</span>' : '') + '</span>' +
1008
1010
  '<span class="le-card-value">' + value + '</span>' +
1009
1011
  '<span class="le-card-detail">' + detailText + '</span>';
1012
+ var adv = ['tools', 'env'].indexOf(tab) !== -1 ? ' data-advanced' : '';
1010
1013
  return tab
1011
- ? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '">' + inner + '</a>'
1014
+ ? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '"' + adv + '>' + inner + '</a>'
1012
1015
  : '<div class="le-card">' + inner + '</div>';
1013
1016
  }
1014
1017
  return '<div class="le-cards" style="margin-bottom:28px">' +
@@ -1395,7 +1398,7 @@ ${renderMarkdownScript}
1395
1398
  var schedules = workflowScheduleItemsHtml(w, name);
1396
1399
  var hasHooks = Boolean(w.webhooks || w.webhooksWaiting || w.webhooksOff);
1397
1400
  var way = function (key, title, what, body) {
1398
- return '<section class="wf-way wf-way-' + key + '"><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
1401
+ return '<section class="wf-way wf-way-' + key + '"' + (key === 'api' ? ' data-advanced' : '') + '><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
1399
1402
  };
1400
1403
  return '<div class="wf-ways">' +
1401
1404
  way('run', 'Run now', 'Starts a run right away, from here. Follow it in Activity.', workflowRunBarHtml(w, params)) +
@@ -1971,7 +1974,7 @@ ${renderMarkdownScript}
1971
1974
  return '<section class="wf-section">' + critSection + '</section>' +
1972
1975
  '<section class="wf-section"><h4 class="wf-sub">Eval cases' + (evals.cases.length ? ' (' + evals.cases.length + ')' : '') + '</h4>' +
1973
1976
  '<p class="hint" style="margin:0">Real runs saved to check every change against.</p>' +
1974
- (cases ? '<ul class="wf-cases">' + cases + '</ul>' : '<p class="hint" style="margin:0">None yet: add suggested ones below, or save any run from its case page.</p>') +
1977
+ (cases ? '<ul class="wf-cases">' + cases + '</ul>' : '<p class="hint" style="margin:0">None yet: add suggested ones below, or save any run from its trace (Activity).</p>') +
1975
1978
  '<div class="wf-evals-bar"><button type="button" class="wf-evals-run"' + (!evals.cases.length || running ? ' disabled' : '') + '>' + (running ? 'Evaluating ' + running.done + ' of ' + running.total + String.fromCharCode(8230) : 'Evaluate') + '</button>' +
1976
1979
  '<span class="hint">Runs every eval case again with the current instructions and checks each result against the success criteria. Nothing is sent, refunded or submitted.</span></div>' +
1977
1980
  lastLine + '</section>' +
@@ -2023,6 +2026,10 @@ ${renderMarkdownScript}
2023
2026
  return parts.length ? '<div class="wf-run-evidence">' + parts.join('') + '</div>' : '';
2024
2027
  }
2025
2028
 
2029
+ // A workflow's tabs for Advanced view only: for whoever builds and
2030
+ // audits it, not the operator who runs it.
2031
+ var WORKFLOW_ADVANCED_TABS = ['evaluation', 'contract', 'versions'];
2032
+
2026
2033
  function renderWorkflowsHtml(name, workflows) {
2027
2034
  if (workflowPageId) {
2028
2035
  var page = workflows.filter(function (x) { return x.id === workflowPageId; });
@@ -2061,10 +2068,10 @@ ${renderMarkdownScript}
2061
2068
  runEvidenceHtml(w, r) + '</li>';
2062
2069
  }).join('');
2063
2070
  var last = workflowLastRun(w);
2064
- var tab = workflowTabs[w.id] || 'brief';
2071
+ var tab = workflowTabs[w.id] || 'activity';
2065
2072
  var open = openWorkflowId === w.id;
2066
2073
  var panel = function (key, html) { return '<div class="wf-panel" data-panel="' + key + '"' + (tab === key ? '' : ' hidden') + '>' + html + '</div>'; };
2067
- var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '" aria-selected="' + (tab === key) + '">' + label + '</button>'; };
2074
+ var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '"' + (WORKFLOW_ADVANCED_TABS.indexOf(key) !== -1 ? ' data-advanced' : '') + ' aria-selected="' + (tab === key) + '">' + label + '</button>'; };
2068
2075
  if (workflowPageId) {
2069
2076
  var agentLabel = currentCfg && currentCfg.displayName ? currentCfg.displayName : name;
2070
2077
  document.title = w.title + ' ' + String.fromCharCode(183) + ' ' + agentLabel;
@@ -2086,7 +2093,7 @@ ${renderMarkdownScript}
2086
2093
  '</header>' +
2087
2094
  workflowDraftBannerHtml(w) +
2088
2095
  '<div class="wf-row-body wf-page-body">' +
2089
- '<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Prompt') + tabBtn('activity', 'Activity') + tabBtn('evaluation', 'Evaluation') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
2096
+ '<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
2090
2097
  panel('brief', workflowBriefHtml(w)) +
2091
2098
  panel('activity', workflowActivityHtml(w, runs, name)) +
2092
2099
  panel('evaluation', workflowEvaluationHtml(w)) +
@@ -2112,7 +2119,7 @@ ${renderMarkdownScript}
2112
2119
  '<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
2113
2120
  // What it does, in full, once it's open (the row shows just its name).
2114
2121
  (w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
2115
- '<div class="wf-tabs" role="tablist">' + tabBtn('brief', 'Prompt') + tabBtn('activity', 'Activity') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + '</div>' +
2122
+ '<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
2116
2123
  panel('contract', workflowContractHtml(w, name, params)) +
2117
2124
  panel('versions', workflowVersionsHtml()) +
2118
2125
  panel('triggers', workflowTriggersHtml(w, name, params)) +
@@ -3486,7 +3493,7 @@ ${renderMarkdownScript}
3486
3493
  var nameSection =
3487
3494
  '<h3>Name <button type="button" class="edit-btn" id="editDisplayNameBtn">Edit</button></h3>' +
3488
3495
  '<p class="ov-name"><span id="displayNameDisplay">' + escapeHtml(cfg.displayName || cfg.name) + '</span>' +
3489
- ' <span class="muted">&middot; id <code>' + escapeHtml(cfg.name) + '</code></span></p>' +
3496
+ ' <span class="muted" data-advanced>&middot; id <code>' + escapeHtml(cfg.name) + '</code></span></p>' +
3490
3497
  editDialogHtml('<h3>Edit name</h3>', '<p>The name shown in the sidebar and at the top of its pages. Its id, <code>' + escapeHtml(cfg.name) + '</code>, stays the same: its API address and saved runs use it.</p>',
3491
3498
  '<form class="add-source" id="displayNameForm" style="display:none">' +
3492
3499
  '<label>Name<input type="text" name="displayName" maxlength="60" placeholder="' + escapeHtml(cfg.name) + '" value="' + escapeHtml(cfg.displayName || '') + '"></label>' +
@@ -3555,8 +3562,8 @@ ${renderMarkdownScript}
3555
3562
  return renderOverviewCards(cfg) +
3556
3563
  '<section>' + nameSection + '</section>' +
3557
3564
  '<section>' + systemPromptSection + '</section>' +
3558
- '<section>' + modelSection + '</section>' +
3559
- '<section><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
3565
+ '<section data-advanced>' + modelSection + '</section>' +
3566
+ '<section data-advanced><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
3560
3567
  '<dl class="kv kv-wide" id="limitsDisplay">' +
3561
3568
  '<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
3562
3569
  '<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
@@ -4108,12 +4115,12 @@ ${renderMarkdownScript}
4108
4115
  var free = n.plan === 'free';
4109
4116
  var on = !free && f.jobs === true;
4110
4117
  var how = app === 'telegram'
4111
- ? 'A private chat with the bot, or @mentioning it in a group, runs the agent on that message, and it answers with a reply. Replying to its answer carries the job on. In a group the bot only sees mentions when it&#39;s an admin or its privacy mode is off (@BotFather, /setprivacy); replies to its messages always reach it.'
4112
- : 'A DM to the bot, or @mentioning it in a channel, runs the agent on that message, and it answers in a thread. Replies in the thread carry the job on.';
4118
+ ? 'A private chat with the bot, or @mentioning it in a group, runs the agent on that message, and it answers with a reply. Replying to its answer carries the run on. In a group the bot only sees mentions when it&#39;s an admin or its privacy mode is off (@BotFather, /setprivacy); replies to its messages always reach it.'
4119
+ : 'A DM to the bot, or @mentioning it in a channel, runs the agent on that message, and it answers in a thread. Replies in the thread carry the run on.';
4113
4120
  return '<div class="body-field" style="margin:4px 0 0">' +
4114
4121
  '<label class="tool-picker-item" style="border:0;padding:0;justify-content:flex-start"><input type="checkbox" name="jobs" id="' + app + 'Jobs"' + (on ? ' checked' : '') + (free ? ' disabled' : '') + '> ' +
4115
- 'Start jobs from messages' + (free ? ' <span class="le-pill accent">Pro</span>' : '') + '</label>' +
4116
- '<p class="hint" style="margin:2px 0 0">' + (free ? 'Starting jobs from ' + CHANNEL_TITLES[app] + ' needs LoopEngine Pro.' : how + ' Only approvers (below) can give it jobs; with none listed, anyone in its ' + (app === 'telegram' ? 'chat' : 'channel') + ' can, but not by direct message. A request it needs approved waits in the same thread.') + '</p></div>';
4122
+ 'Start runs from messages' + (free ? ' <span class="le-pill accent">Pro</span>' : '') + '</label>' +
4123
+ '<p class="hint" style="margin:2px 0 0">' + (free ? 'Starting runs from ' + CHANNEL_TITLES[app] + ' needs LoopEngine Pro.' : how + ' Only approvers (below) can start runs; with none listed, anyone in its ' + (app === 'telegram' ? 'chat' : 'channel') + ' can, but not by direct message. A request it needs approved waits in the same thread.') + '</p></div>';
4117
4124
  }
4118
4125
 
4119
4126
  // A secret's state at a glance: a pill by the label, and a placeholder
@@ -4276,7 +4283,7 @@ ${renderMarkdownScript}
4276
4283
  }
4277
4284
 
4278
4285
  function renderConnectionsHtml(n) {
4279
- return (n.canSave === false ? '<p class="error" style="margin:0 0 12px">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.</p>' : '') +
4286
+ return (n.canSave === false ? leShell.adminNote('Saving needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server, because this stores a secret. Add <code>LOOPENGINE_ADMIN_AUTH=user:pass</code> to <code>.env</code> and restart.') : '') +
4280
4287
  '<div class="msg-conns">' + (n.channels || ['slack', 'telegram', 'lark', 'email', 'webhook']).map(function (c) { return renderConnectionSection(n, c); }).join('') + '</div>';
4281
4288
  }
4282
4289
 
@@ -4328,13 +4335,13 @@ ${renderMarkdownScript}
4328
4335
  }).join('');
4329
4336
  var where = app === 'telegram' ? 'by replying to it' : 'by replying in its thread';
4330
4337
  return '<section class="approvers-section" data-app="' + app + '" style="max-width:560px;margin-top:18px;padding-top:14px;border-top:1px solid var(--le-line, #e5e7eb)"><h4 style="margin:0 0 6px">Approvers</h4>' +
4331
- (n.primary !== app ? '<p class="hint" style="margin:0 0 8px">' + title + ' isn&#39;t primary, so requests aren&#39;t sent there until it is. Jobs started there still use this list.</p>' : '') +
4338
+ (n.primary !== app ? '<p class="hint" style="margin:0 0 8px">' + title + ' isn&#39;t primary, so requests aren&#39;t sent there until it is. Runs started there still use this list.</p>' : '') +
4332
4339
  '<p class="muted" style="margin:0 0 10px">People who can approve, deny, change or answer a request ' + where + ', like &ldquo;yes, go ahead&rdquo; or &ldquo;make it $40&rdquo;. A plain &ldquo;yes&rdquo; runs it; a reply that&#39;s less clear (&ldquo;sure, send it&rdquo;, &ldquo;yes but check the amount&rdquo;) shows exactly what will run with a Confirm button first, and a change is shown to approve first. Once anyone is listed, only approvers&#39; button clicks count, and only approvers can give the agent jobs. Anyone can still ask about a request.</p>' +
4333
4340
  (approvers.length
4334
4341
  ? '<div class="le-table-wrap" style="max-width:560px"><table><thead><tr><th>Name</th><th>' + title + ' ID</th><th></th></tr></thead><tbody>' + rows + '</tbody></table></div>'
4335
4342
  : '<p class="hint">No approvers yet. Until you add someone, anyone can use the buttons, and deciding by reply is off.</p>') +
4336
4343
  (n.canSave === false
4337
- ? '<p class="hint">Changing approvers needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server.</p>'
4344
+ ? leShell.adminNote('Changing approvers needs <code>LOOPENGINE_ADMIN_AUTH</code> set on the server.')
4338
4345
  : '<p style="margin:10px 0 0"><button type="button" class="approvers-load">' + (app === 'telegram' ? 'Add people who messaged the bot' : 'Add people from the channel') + '</button></p>' +
4339
4346
  (app === 'telegram' ? '<p class="hint" style="margin:6px 0 0">Telegram can&#39;t list a chat&#39;s members, so people show up here once they&#39;ve written to the bot (a private message to it is enough), or add someone by their numeric user id:</p>' +
4340
4347
  '<span style="display:flex;gap:6px;max-width:560px;margin-top:6px"><input class="approver-manual-id" placeholder="User id, like 123456789" style="flex:1;min-width:0"><input class="approver-manual-name" placeholder="Name" style="flex:1;min-width:0"><button type="button" class="approver-manual-add">Add</button></span>' : '') +
@@ -5811,7 +5818,7 @@ ${renderMarkdownScript}
5811
5818
  '</span></label>';
5812
5819
  }).join('') + '</div>' +
5813
5820
  '<div class="app-pick-bar"><button type="button" class="app-pick-save" data-ability="' + escapeHtml(ability) + '"' + (chosen && !p.busy && agentApps.canChange ? '' : ' disabled') + '>' + (p.installed ? 'Save' : 'Add with ' + chosen + ' tool' + (chosen === 1 ? '' : 's')) + '</button>' +
5814
- (agentApps.canChange ? '' : '<span class="error">Changing an agent' + String.fromCharCode(8217) + 's tools needs LOOPENGINE_ADMIN_AUTH set.</span>') +
5821
+ (agentApps.canChange ? '' : leShell.adminNote('Changing an agent' + String.fromCharCode(8217) + 's tools needs <code>LOOPENGINE_ADMIN_AUTH</code> set.')) +
5815
5822
  (p.message ? '<span class="' + (p.messageBad ? 'error' : 'hint') + '">' + escapeHtml(p.message) + '</span>' : '') + '</div>' +
5816
5823
  '</div>';
5817
5824
  }
@@ -18,10 +18,13 @@ 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: 13px; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
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
- .agent-card .links a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
27
+ .agent-card .links a.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
25
28
  #empty { color: var(--ink-muted); }
26
29
  .hint { font-size: 12px; color: var(--ink-muted); }
27
30
  .error { font-size: 13px; color: var(--bad); }
@@ -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 { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[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 + '">Configure</a>' +
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';
@@ -69,7 +69,7 @@ export function eventAction(e, names = PLAIN_NAMES) {
69
69
  const was = Array.isArray(d.changes) ? d.changes.find((c) => c.field === 'title')?.from : undefined;
70
70
  return names.workflowTitle(agent, id) || str(d.title) || (was && was !== '(none)' ? was : '') || id;
71
71
  };
72
- const run = { type: 'Run', name: e.workflow_id ? workflowName(e.agent, e.workflow_id) : 'One-off job', agent: e.agent, ...(e.workflow_id ? { workflowId: e.workflow_id } : {}), ...(e.run_id ? { runId: e.run_id } : {}) };
72
+ const run = { type: 'Run', name: e.workflow_id ? workflowName(e.agent, e.workflow_id) : 'One-off run', agent: e.agent, ...(e.workflow_id ? { workflowId: e.workflow_id } : {}), ...(e.run_id ? { runId: e.run_id } : {}) };
73
73
  if (e.kind === 'decision')
74
74
  return { action: d.approved ? (d.edited ? 'Tool call approved with changes' : 'Tool call approved') : 'Tool call denied', resource: run };
75
75
  if (e.kind === 'answer')
@@ -104,7 +104,7 @@ export function eventAction(e, names = PLAIN_NAMES) {
104
104
  return { action: label, resource: { type: 'Agent', name: names.agentLabel(e.agent), agent: e.agent } };
105
105
  return { action: label, resource: { type: 'Workspace', name: 'Settings' } };
106
106
  }
107
- const CSV_COLUMNS = ['When (UTC)', 'Person', 'Action', 'Resource type', 'Resource', 'Kind', 'Agent', 'Workflow', 'What', 'Detail', 'Case', 'Event', 'Hash'];
107
+ const CSV_COLUMNS = ['When (UTC)', 'Person', 'Action', 'Resource type', 'Resource', 'Kind', 'Agent', 'Workflow', 'What', 'Detail', 'Run', 'Event', 'Hash'];
108
108
  function csvCell(value) {
109
109
  // A leading = + - @ would run as a formula in a spreadsheet.
110
110
  const safe = /^[=+\-@]/.test(value) ? `'${value}` : value;
@@ -126,7 +126,7 @@ export function caseRow(run, workflowTitle, evalCase = false) {
126
126
  id: run.run_id,
127
127
  agent: run.agent,
128
128
  workflowId: run.workflow_id,
129
- workflowTitle: workflowTitle ?? (run.workflow_id || 'One-off job'),
129
+ workflowTitle: workflowTitle ?? (run.workflow_id || 'One-off run'),
130
130
  inputs: short(inputs, 160),
131
131
  status: run.status,
132
132
  startedAt: run.started_at,
@@ -39,7 +39,7 @@ export const auditPageHtml = `<!doctype html>
39
39
  .au-summary ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.5; }
40
40
  .au-summary-tools { display: flex; gap: 8px; flex-wrap: wrap; }
41
41
  .au-summary-tools a { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
42
- .au-summary-tools a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
42
+ .au-summary-tools a.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
43
43
  .au-export { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
44
44
  .au-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
45
45
  .au-row, .au-head { display: grid; grid-template-columns: 136px minmax(0, 170px) minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
@@ -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,8 @@ 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 SCHEDULES_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="9"/><path d="M12 7v5l3 2"/></svg>';
51
+ 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
52
  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
53
  // Two columns: the sections (Inbox, Goals, Agents, Workflows, Audit,
42
54
  // Settings), and beside them what's in the current one. A goal holds the
@@ -51,8 +63,10 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
51
63
  <a class="le-rail-item" href="/goals" data-le-nav-head="goals" data-le-section="goals">${GOALS_ICON}<span>Goals</span></a>
52
64
  <a class="le-rail-item" href="/agents" data-le-nav-head="agents" data-le-section="agents">${AGENTS_ICON}<span>Agents</span></a>
53
65
  <a class="le-rail-item" href="/workflows" data-le-nav-head="workflows" data-le-section="workflows">${WORKFLOWS_ICON}<span>Workflows</span></a>
66
+ <a class="le-rail-item" href="/schedules" data-le-nav-head="schedules" data-le-section="schedules">${SCHEDULES_ICON}<span>Schedules</span></a>
54
67
  <a class="le-rail-item" href="/audit" data-le-nav-head="audit" data-le-section="audit">${AUDIT_ICON}<span>Audit</span></a>
55
68
  <span class="le-rail-gap"></span>
69
+ <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
70
  <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
71
  <div class="le-who" id="leWho" hidden></div>
58
72
  </nav>
@@ -75,7 +89,7 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
75
89
  <nav class="le-settings-menu" aria-label="Settings">
76
90
  <a href="/config?section=models" data-le-nav="models">Models</a>
77
91
  <a href="/config?section=apps" data-le-nav="apps">Apps</a>
78
- <a href="/config?section=abilities" data-le-nav="abilities">Abilities</a>
92
+ <a href="/config?section=abilities" data-le-nav="abilities" data-advanced>Abilities</a>
79
93
  <a href="/config?section=settings" data-le-nav="settings">General settings</a>
80
94
  </nav>
81
95
  </section>
@@ -83,6 +97,26 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
83
97
  </aside>`;
84
98
  export const consoleShellScript = `<script>
85
99
  (function () {
100
+ // Simple view unless this person turned Advanced on.
101
+ var advancedOn = false;
102
+ try { advancedOn = localStorage.getItem('le-advanced') === '1'; } catch (e) {}
103
+ document.documentElement.classList.toggle('le-simple', !advancedOn);
104
+ var advToggle = document.getElementById('leAdvToggle');
105
+ if (advToggle) {
106
+ advToggle.setAttribute('aria-pressed', String(advancedOn));
107
+ advToggle.addEventListener('click', function () {
108
+ advancedOn = !advancedOn;
109
+ try { localStorage.setItem('le-advanced', advancedOn ? '1' : '0'); } catch (e) {}
110
+ document.documentElement.classList.toggle('le-simple', !advancedOn);
111
+ advToggle.setAttribute('aria-pressed', String(advancedOn));
112
+ document.dispatchEvent(new CustomEvent('le-advanced', { detail: advancedOn }));
113
+ });
114
+ }
115
+ // A setting only the workspace's admin can change: said plainly, with
116
+ // the technical how-to for Advanced view.
117
+ function adminNote(tech) {
118
+ return '<p class="hint le-admin-note"><span data-simple>Only your workspace admin can change this.</span><span data-advanced>' + tech + '</span></p>';
119
+ }
86
120
  var page = document.body.getAttribute('data-le-page') || '';
87
121
  var params = new URLSearchParams(location.search);
88
122
  var app = document.querySelector('.le-app');
@@ -103,6 +137,9 @@ export const consoleShellScript = `<script>
103
137
  ['schedules', 'Schedules'], ['chat', 'Chat'], ['actauth', 'Permissions'], ['env', 'Environment'], ['advanced', 'Advanced']
104
138
  ];
105
139
 
140
+ // The agent tabs for Advanced view only.
141
+ var ADVANCED_TABS = ['env', 'advanced'];
142
+
106
143
  function esc(s) {
107
144
  return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
108
145
  return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c];
@@ -314,12 +351,12 @@ export const consoleShellScript = `<script>
314
351
  var count = t[0] === 'env'
315
352
  ? '<span data-le-env-count="' + esc(opts.name) + '">' + envCountHtml(opts.name) + '</span>'
316
353
  : (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>';
354
+ 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
355
  }).join('');
319
356
  return '<div class="le-head"><div class="le-head-row">' +
320
357
  '<div class="le-title"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">&#9776;</button>' +
321
358
  '<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>' +
359
+ '<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
360
  '<div class="le-chips">' + chips + '</div></div>' +
324
361
  '<nav class="le-tabs" aria-label="Agent sections">' + tabs + '</nav></div>';
325
362
  }
@@ -374,8 +411,8 @@ export const consoleShellScript = `<script>
374
411
  : page === 'config' ? 'settings'
375
412
  : page === 'inbox' ? 'inbox'
376
413
  : page === 'audit' ? 'audit'
377
- // A case, in the section it was opened from.
378
- : page === 'case' ? ((params.get('back') || '').indexOf('/audit') === 0 ? 'audit' : (params.get('back') || '').indexOf('/agents') === 0 ? 'workflows' : 'inbox') : '';
414
+ : page === 'schedules' ? 'schedules'
415
+ : '';
379
416
  var railItems = document.querySelectorAll('[data-le-section]');
380
417
  for (var ri = 0; ri < railItems.length; ri++) {
381
418
  if (railItems[ri].getAttribute('data-le-section') === section0) railItems[ri].classList.add('is-current');
@@ -671,6 +708,6 @@ export const consoleShellScript = `<script>
671
708
  }
672
709
 
673
710
 
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 };
711
+ 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
712
  })();
676
713
  </script>`;