loopengine 0.3.77 → 0.3.78

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.
@@ -76,12 +76,6 @@ export const agentsConfigPageHtml = `<!doctype html>
76
76
  .wf-card-title { min-width: 0; }
77
77
  .wf-card-title h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
78
78
  .wf-card-title p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-muted); }
79
- .wf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
80
- .wf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font-size: 12px; font-weight: 550; line-height: 1.5; }
81
- .wf-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
82
- .wf-chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
83
- .wf-chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
84
- .wf-chip.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
85
79
  .wf-card-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 50%; }
86
80
  .wf-card-actions button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
87
81
  .wf-card-actions .workflow-edit { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
@@ -103,7 +97,7 @@ export const agentsConfigPageHtml = `<!doctype html>
103
97
  .wf-row.is-open .wf-row-caret { transform: rotate(45deg); }
104
98
  .wf-row-main { min-width: 0; display: grid; gap: 2px; }
105
99
  .wf-row-main strong { font-size: 14px; font-weight: 650; color: var(--ink); }
106
- .wf-row-desc { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
100
+ .wf-desc { margin: 0; max-width: 72ch; font-size: 13.5px; line-height: 1.55; color: var(--ink-muted); overflow-wrap: anywhere; }
107
101
  .wf-row-starts { display: grid; gap: 2px; font-size: 12.5px; color: var(--ink-muted); min-width: 0; }
108
102
  .wf-start-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
109
103
  .wf-start-state { font-size: 11px; font-weight: 700; padding: 0 6px; margin-left: 2px; border-radius: 999px; }
@@ -113,12 +107,14 @@ export const agentsConfigPageHtml = `<!doctype html>
113
107
  .wf-start-state.warn { background: var(--warn-soft); color: var(--warn); }
114
108
  .wf-row-last { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; white-space: nowrap; }
115
109
  .wf-row-last .hint { white-space: nowrap; }
110
+ /* The row's grey notes ("Run now or API", "Last run …", "No runs yet",
111
+ "+2 more schedules") at the same size as its schedule lines. */
112
+ .wf-row-starts .hint, .wf-row-last .hint { font-size: 12.5px; }
116
113
  .wf-row-actions { display: flex; gap: 6px; }
117
114
  .wf-row-actions button, .wf-row-foot button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
118
115
  .wf-row-actions button:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
119
116
  .wf-row-body { padding: 4px 16px 16px 44px; display: grid; gap: 12px; }
120
117
  .wf-row-body[hidden], .wf-panel[hidden] { display: none; }
121
- .wf-row-body .wf-chips { margin-top: 0; }
122
118
  .wf-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
123
119
  .wf-tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 10px; margin-bottom: -1px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
124
120
  .wf-tab:hover:not(:disabled) { background: none; color: var(--ink); }
@@ -140,7 +136,9 @@ export const agentsConfigPageHtml = `<!doctype html>
140
136
  .wf-cb-decision.ask { background: var(--warn-soft); color: var(--warn); }
141
137
  .wf-cb-decision.deny { background: var(--bad-soft); color: var(--bad); }
142
138
  @media (max-width: 520px) { .wf-cb { grid-template-columns: minmax(0, 1fr); gap: 2px; } .wf-cb-v { margin-bottom: 8px; } }
143
- .wf-trigger { gap: 6px; }
139
+ .wf-triggers { display: grid; gap: 8px; }
140
+ .wf-triggers .wf-sub:first-child { margin-top: 0; }
141
+ .wf-trigger { display: grid; gap: 8px; }
144
142
  .wf-trigger-item { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
145
143
  .wf-trigger-item button, .wf-trigger-add button, .wf-trigger .workflow-hook button { padding: 2px 10px; font-size: 12px; }
146
144
  .wf-trigger .workflow-hooks:empty { display: none; }
@@ -177,8 +175,8 @@ export const agentsConfigPageHtml = `<!doctype html>
177
175
  .wp-mono { font-family: var(--font-mono); font-size: 12.5px; }
178
176
  @media (max-width: 640px) { .wf-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
179
177
  .wf-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
180
- .wf-row-actions .wf-remove { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
181
- .wf-row-actions .wf-remove:hover:not(:disabled) { background: var(--bad); color: var(--bg); }
178
+ .wf-row-foot .wf-remove { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
179
+ .wf-row-foot .wf-remove:hover:not(:disabled) { background: var(--bad); color: var(--bg); }
182
180
  @media (max-width: 760px) {
183
181
  .wf-row-head { grid-template-columns: 14px minmax(0, 1fr) auto; row-gap: 6px; }
184
182
  .wf-row-starts, .wf-row-last { white-space: normal; }
@@ -1016,27 +1014,7 @@ ${consoleShellScript}
1016
1014
  '</details>';
1017
1015
  }
1018
1016
 
1019
- // What starts a workflow and what it's doing, as chips under its title:
1020
- // each schedule, then its webhooks; one line when nothing starts it.
1021
- function workflowStatusChips(w) {
1022
- var chips = [];
1023
- var cap = function (t) { return t ? t.charAt(0).toUpperCase() + t.slice(1) : t; };
1024
- var when = function (iso) { return new Date(iso).toLocaleString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); };
1025
- var DOT = ' ' + String.fromCharCode(183) + ' ';
1026
- (w.schedules || []).forEach(function (x) {
1027
- var what = escapeHtml(cap(x.describe));
1028
- if (x.waiting) chips.push('<span class="wf-chip warn">' + what + DOT + 'waiting for a decision</span>');
1029
- else if (x.status === 'running') chips.push('<span class="wf-chip accent">' + what + DOT + 'running</span>');
1030
- else if (x.status === 'paused') chips.push('<span class="wf-chip warn">' + what + DOT + 'paused</span>');
1031
- else chips.push('<span class="wf-chip good">' + what + (x.nextRunAt ? DOT + 'next ' + escapeHtml(when(x.nextRunAt)) : '') + '</span>');
1032
- });
1033
- var n = function (count, one, many) { return count === 1 ? one : count + ' ' + many; };
1034
- if (w.webhooks) chips.push('<span class="wf-chip good">' + n(w.webhooks, 'Webhook on', 'webhooks on') + '</span>');
1035
- if (w.webhooksWaiting) chips.push('<span class="wf-chip warn">' + n(w.webhooksWaiting, 'Webhook needs its signing secret', 'webhooks need their signing secrets') + '</span>');
1036
- if (w.webhooksOff) chips.push('<span class="wf-chip">' + n(w.webhooksOff, 'Webhook off', 'webhooks off') + '</span>');
1037
- if (!chips.length) chips.push('<span class="wf-chip">Runs when you start it: Run now, the API or Chat</span>');
1038
- return chips.join('');
1039
- }
1017
+
1040
1018
 
1041
1019
  // Which workflow is open in the list, and each one's chosen tab: kept
1042
1020
  // across redraws (a running run's refresh, a save), and in the URL.
@@ -1142,29 +1120,37 @@ ${consoleShellScript}
1142
1120
  function contractLinesHtml(lines) {
1143
1121
  return lines.map(function (l) { return '<div class="wf-cb-line">' + l + '</div>'; }).join('');
1144
1122
  }
1145
- function workflowContractHtml(w, name, params) {
1146
- // The trigger row is where its triggers are managed: each schedule
1147
- // and webhook with its controls, a way to add either, and the other
1148
- // ways any workflow starts (Run now above the tabs, the API call).
1123
+ // Its Triggers tab: Run now, its schedules and webhooks with their
1124
+ // controls, a way to add either, and the call an app makes.
1125
+ function workflowTriggersHtml(w, name, params) {
1149
1126
  var schedules = workflowScheduleItemsHtml(w, name);
1150
- // Its webhooks as the contract says them, until the full rows (with
1151
- // deliveries and setup steps) load into the same box.
1152
- var hookLines = [];
1127
+ return '<div class="wf-triggers">' +
1128
+ '<h4 class="wf-sub">Run now</h4>' + workflowRunBarHtml(w, params) +
1129
+ '<h4 class="wf-sub">Schedules and webhooks</h4>' +
1130
+ '<div class="wf-trigger">' + schedules +
1131
+ '<div class="workflow-hooks"></div>' +
1132
+ (!schedules && !(w.webhooks || w.webhooksWaiting || w.webhooksOff) ? '<p class="hint wf-trigger-none" style="margin:0">None yet: it runs only when started by hand or from an app.</p>' : '') +
1133
+ '<div class="wf-trigger-add"><button type="button" class="workflow-add-schedule">+ Schedule</button>' +
1134
+ '<span class="workflow-hooks-add"' + (w.webhooksWaiting ? ' hidden' : '') + '><button type="button" class="workflow-hooks-btn">+ Webhook</button></span></div>' +
1135
+ '</div>' +
1136
+ '<h4 class="wf-sub">API</h4>' + workflowApiHtml(w, name) +
1137
+ '</div>';
1138
+ }
1139
+
1140
+ function workflowContractHtml(w, name, params) {
1141
+ // What starts it, as the contract says it; they're set up in Triggers.
1142
+ var trigger = [];
1143
+ (w.schedules || []).filter(function (x) { return x.status !== 'cancelled'; }).forEach(function (x) {
1144
+ trigger.push('schedule, ' + escapeHtml(x.describe) + (x.status === 'paused' ? ' <span class="le-pill warn">Paused</span>' : ''));
1145
+ });
1153
1146
  (w.triggers || []).forEach(function (t) {
1154
- hookLines.push(escapeHtml(SENDER_LABELS[t.sender] || t.sender) + ' webhook' + (t.filter ? ', <code>' + escapeHtml(t.filter.values.join(' | ')) + '</code>' : '') +
1147
+ trigger.push(escapeHtml(SENDER_LABELS[t.sender] || t.sender) + ' webhook' + (t.filter ? ', <code>' + escapeHtml(t.filter.values.join(' | ')) + '</code>' : '') +
1155
1148
  (t.waiting ? ' <span class="le-pill ask">Needs its signing secret</span>' : !t.enabled ? ' <span class="le-pill warn">Off</span>' : ''));
1156
- Object.keys(t.mapping || {}).forEach(function (param) { hookLines.push('<span class="wf-cb-indent"><code>' + escapeHtml(param) + '</code> ' + ARROW_L + ' <code>' + escapeHtml(t.mapping[param]) + '</code></span>'); });
1149
+ 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>'); });
1157
1150
  });
1158
- var hasHooks = Boolean(w.webhooks || w.webhooksWaiting || w.webhooksOff || (w.triggers || []).length);
1159
- var hasTrigger = Boolean(schedules) || hasHooks;
1160
- var triggerHtml = schedules +
1161
- '<div class="workflow-hooks">' + contractLinesHtml(hookLines) + '</div>' +
1162
- '<div class="wf-cb-line"><span class="hint">' + (hasTrigger
1163
- ? 'also by hand (Run now) or from an app (API)'
1164
- : 'it runs when started by hand (Run now) or from an app (API), or set up a schedule or webhook') + '</span></div>' +
1165
- '<div class="wf-trigger-add"><button type="button" class="workflow-add-schedule">+ Schedule</button>' +
1166
- '<span class="workflow-hooks-add"' + (w.webhooksWaiting ? ' hidden' : '') + '><button type="button" class="workflow-hooks-btn">+ Webhook</button></span></div>' +
1167
- workflowApiHtml(w, name);
1151
+ trigger.push('<span class="hint">' + (trigger.length
1152
+ ? 'also by hand (Run now) or from an app (API); set them up in Triggers'
1153
+ : 'it runs when started by hand (Run now) or from an app (API), or set up a schedule or webhook in Triggers') + '</span>');
1168
1154
  var names = Object.keys(w.parameters || {});
1169
1155
  var inputs = names.length ? names.map(function (n) {
1170
1156
  var spec = w.parameters[n];
@@ -1186,7 +1172,7 @@ ${consoleShellScript}
1186
1172
  if ((w.triggers || []).some(function (t) { return t.callback; })) result.push('posted to the webhook' + RSQ + 's callback address');
1187
1173
  var model = w.model ? escapeHtml(w.model.provider + ' ' + w.model.model) : escapeHtml(workflowsMeta.agentModel || 'the agent' + RSQ + 's') + ' <span class="hint">(the agent' + RSQ + 's model)</span>';
1188
1174
  var row = function (k, lines) { return '<div class="wf-cb-k">' + k + '</div><div class="wf-cb-v">' + contractLinesHtml(lines) + '</div>'; };
1189
- return '<div class="wf-cb">' + '<div class="wf-cb-k">trigger</div><div class="wf-cb-v wf-trigger">' + triggerHtml + '</div>' + row('inputs', inputs) + row('tools', tools) + row('result', result) + row('model', [model]) + '</div>' +
1175
+ return '<div class="wf-cb">' + row('trigger', trigger) + row('inputs', inputs) + row('tools', tools) + row('result', result) + row('model', [model]) + '</div>' +
1190
1176
  '<p class="hint" style="margin:0">Change the inputs, result and model with Edit, and what tools may do in Permissions.</p>';
1191
1177
  }
1192
1178
 
@@ -1294,20 +1280,21 @@ ${consoleShellScript}
1294
1280
  return '<article class="workflow-card wf-row' + (open ? ' is-open' : '') + '" data-workflow="' + escapeHtml(w.id) + '">' +
1295
1281
  '<div class="wf-row-head" role="button" tabindex="0" aria-expanded="' + open + '">' +
1296
1282
  '<span class="wf-row-caret" aria-hidden="true"></span>' +
1297
- '<div class="wf-row-main"><strong>' + escapeHtml(w.title) + '</strong>' + (w.description ? '<span class="wf-row-desc">' + escapeHtml(w.description) + '</span>' : '') + '</div>' +
1283
+ '<div class="wf-row-main"><strong>' + escapeHtml(w.title) + '</strong></div>' +
1298
1284
  '<span class="wf-row-starts">' + workflowStartsSummary(w) + '</span>' +
1299
1285
  '<span class="wf-row-last">' + workflowLastRunHtml(last) + '</span>' +
1300
- '<span class="wf-row-actions"><button type="button" class="workflow-edit">Edit</button><button type="button" class="wf-remove workflow-forget" title="Its schedules and webhooks go; its instructions stay as a skill for Chat">Remove</button></span>' +
1286
+ '<span class="wf-row-actions"><button type="button" class="workflow-triggers-open">Triggers</button><button type="button" class="workflow-edit">Edit</button></span>' +
1301
1287
  '</div>' +
1302
1288
  '<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
1303
- '<div class="wf-chips">' + workflowStatusChips(w) + '</div>' +
1304
- workflowRunBarHtml(w, params) +
1305
- '<div class="wf-tabs" role="tablist">' + tabBtn('contract', 'Contract') + tabBtn('brief', 'Brief') + tabBtn('evidence', 'Evidence' + (runs ? ' <span class="wf-tab-count">' + w.recentRuns.length + '</span>' : '')) + '</div>' +
1289
+ // What it does, in full, once it's open (the row shows just its name).
1290
+ (w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
1291
+ '<div class="wf-tabs" role="tablist">' + tabBtn('contract', 'Contract') + tabBtn('triggers', 'Triggers') + tabBtn('brief', 'Brief') + tabBtn('evidence', 'Evidence' + (runs ? ' <span class="wf-tab-count">' + w.recentRuns.length + '</span>' : '')) + '</div>' +
1306
1292
  panel('contract', workflowContractHtml(w, name, params)) +
1293
+ panel('triggers', workflowTriggersHtml(w, name, params)) +
1307
1294
  panel('brief', workflowBriefHtml(w)) +
1308
1295
  panel('evidence', workflowEvidenceHtml(w, runs)) +
1309
1296
  '<div class="hint workflow-result"></div>' +
1310
- '<div class="wf-row-foot"><span class="hint">Skill <code>' + escapeHtml(w.id) + '</code></span></div>' +
1297
+ '<div class="wf-row-foot"><span class="hint">Skill <code>' + escapeHtml(w.id) + '</code></span><button type="button" class="wf-remove workflow-forget" title="Its schedules and webhooks go; its instructions stay as a skill for Chat">Remove</button></div>' +
1311
1298
  '</div>' +
1312
1299
  '</article>';
1313
1300
  }).join('') + '</div>';
@@ -1766,8 +1753,6 @@ ${consoleShellScript}
1766
1753
  w.webhooks = list.filter(function (t) { return t.enabled; }).length;
1767
1754
  w.webhooksWaiting = list.filter(function (t) { return !t.enabled && t.verify && !t.verify.secret_set; }).length;
1768
1755
  w.webhooksOff = list.length - w.webhooks - w.webhooksWaiting;
1769
- var chips = card.querySelector('.wf-chips');
1770
- if (chips) chips.innerHTML = workflowStatusChips(w);
1771
1756
  var startsCell = card.querySelector('.wf-row-starts');
1772
1757
  if (startsCell) startsCell.innerHTML = workflowStartsSummary(w);
1773
1758
  // One waiting for its secret, or just made: open the Run options
@@ -1846,6 +1831,11 @@ ${consoleShellScript}
1846
1831
  var tabs = card.querySelectorAll('.wf-tab');
1847
1832
  for (var t = 0; t < tabs.length; t++) tabs[t].addEventListener('click', function (ev) { showWorkflowTab(card, ev.currentTarget.dataset.tab); });
1848
1833
  card.querySelector('.workflow-edit').addEventListener('click', function () { openWorkflowEditor(name, card); });
1834
+ // Opens the row (if it's closed) on its Triggers tab.
1835
+ card.querySelector('.workflow-triggers-open').addEventListener('click', function () {
1836
+ if (!card.classList.contains('is-open')) setWorkflowOpen(card, true);
1837
+ showWorkflowTab(card, 'triggers');
1838
+ });
1849
1839
  // Evidence: save a run as an eval case, change or remove a case, run them.
1850
1840
  card.querySelector('.wf-row-body').addEventListener('click', function (ev) {
1851
1841
  var btn = ev.target.closest('.wf-save-case, .wf-case-remove, .wf-case-save, .wf-evals-run');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.3.77",
3
+ "version": "0.3.78",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",