loopengine 0.5.10 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/agents-config-page.js +339 -131
- package/dist/web/agents-list-page.js +167 -127
- package/dist/web/audit-page.js +59 -40
- package/dist/web/console-shell.js +9 -5
- package/dist/web/dev-ui-styles.js +21 -5
- package/dist/web/goals-page.js +483 -372
- package/dist/web/inbox-page.js +38 -40
- package/dist/web/workflows-overview-page.js +102 -74
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ import { devUiCss } from './dev-ui-styles.js';
|
|
|
30
30
|
import { MESSAGING_ICONS } from './messaging-icons.js';
|
|
31
31
|
import { renderMarkdownScript } from './markdown-script.js';
|
|
32
32
|
import { consoleShellScript, consoleSidebarHtml } from './console-shell.js';
|
|
33
|
+
import { MASCOT_CSS, mascotSvg } from './mascot.js';
|
|
33
34
|
import { REASONING_PROVIDERS } from './agent-file-admin.js';
|
|
34
35
|
export const agentsConfigPageHtml = `<!doctype html>
|
|
35
36
|
<html lang="en">
|
|
@@ -37,7 +38,7 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
37
38
|
<meta charset="utf-8">
|
|
38
39
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
39
40
|
<title>LoopEngine Console</title>
|
|
40
|
-
<style>${devUiCss}
|
|
41
|
+
<style>${devUiCss}${MASCOT_CSS}
|
|
41
42
|
/* Each tab panel is a .le-page column inside the shell's scrolling
|
|
42
43
|
main area (see web/console-shell.ts); everything below styles the
|
|
43
44
|
panels' own content. */
|
|
@@ -71,19 +72,27 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
71
72
|
/* A workflow's own page: the agent's header and list intro give way to it. */
|
|
72
73
|
.wf-page-mode > .le-head, .wf-page-mode .wf-tab-head { display: none; }
|
|
73
74
|
.wf-page { display: grid; gap: 20px; }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.wf-page-
|
|
78
|
-
.wf-page-
|
|
79
|
-
.wf-page-
|
|
80
|
-
|
|
81
|
-
.wf-page-
|
|
82
|
-
.wf-page
|
|
83
|
-
.wf-page-
|
|
84
|
-
.wf-page-
|
|
75
|
+
/* Its header, in the other pages' style: a top bar (Workflows / its
|
|
76
|
+
agent / its name, and Edit workflow), then a big, light title, what
|
|
77
|
+
it does and its facts as chips. */
|
|
78
|
+
.wf-page-head { display: grid; gap: 0; }
|
|
79
|
+
.wf-page-crumb-row { display: flex; align-items: center; gap: 12px; margin: -28px -32px 28px; padding: 10px 20px; min-height: 58px; box-sizing: border-box; border-bottom: 1px solid var(--line); }
|
|
80
|
+
.wf-page-crumb-row .le-crumb { flex: 1; }
|
|
81
|
+
/* The top bar spans the page; the rest keeps the page's width. */
|
|
82
|
+
.wf-page-mode .le-page { max-width: none; }
|
|
83
|
+
.wf-page > :not(.wf-page-head), .wf-page-hero { max-width: 1076px; }
|
|
84
|
+
.wf-page-crumb-row .wf-row-actions .le-btn-dark:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); }
|
|
85
|
+
.wf-page-hero { display: grid; gap: 12px; padding: 32px 32px 26px; border: 1px solid var(--line); }
|
|
86
|
+
.wf-page-hero h1 { margin: 0; font-size: 36px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
|
|
87
|
+
.wf-page-desc { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-muted); max-width: 80ch; }
|
|
88
|
+
.wf-page-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; margin-top: 4px; }
|
|
89
|
+
.wf-page-meta-item { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 7px; min-width: 0; color: var(--ink); }
|
|
90
|
+
.wf-page-meta-k { font-size: 12px; font-weight: 400; color: var(--ink-faint); }
|
|
91
|
+
.wf-page-meta-item a { color: var(--ink); font-weight: 600; text-decoration: none; }
|
|
92
|
+
.wf-page-meta-item a:hover { text-decoration: underline; }
|
|
93
|
+
@media (max-width: 860px) { .wf-page-crumb-row { margin: -28px -16px 20px; } .wf-page-hero { padding: 22px 18px; } .wf-page-hero h1 { font-size: 28px; } }
|
|
85
94
|
.wf-page .wf-page-body { padding: 0; gap: 16px; }
|
|
86
|
-
.wf-page-starts { display:
|
|
95
|
+
.wf-page-starts { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; color: var(--ink); }
|
|
87
96
|
.wf-page-last { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
|
|
88
97
|
.wf-list-box.wf-page-box { border: 0; border-radius: 0; background: none; overflow: visible; }
|
|
89
98
|
.wf-page .workflow-steps-text { margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--surface); font-size: 13.5px; line-height: 1.6; max-height: 480px; overflow: auto; white-space: pre-wrap; }
|
|
@@ -99,8 +108,8 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
99
108
|
.wf-card-title p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-muted); }
|
|
100
109
|
.wf-card-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 50%; }
|
|
101
110
|
.wf-card-actions button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
|
|
102
|
-
.wf-card-actions .workflow-edit { border-color: var(--
|
|
103
|
-
.wf-card-actions .workflow-edit:hover:not(:disabled) { background: var(--
|
|
111
|
+
.wf-card-actions .workflow-edit { border-color: var(--line); background: var(--bg); color: var(--ink); font-weight: 600; }
|
|
112
|
+
.wf-card-actions .workflow-edit:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
|
|
104
113
|
.wf-card-actions .wf-remove { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); font-weight: 600; }
|
|
105
114
|
.wf-card-actions .wf-remove:hover:not(:disabled) { background: var(--bad); color: var(--bg); }
|
|
106
115
|
.wf-card-actions .wf-remove[data-confirming="1"] { height: auto; min-height: 32px; padding: 6px 12px; text-align: left; white-space: normal; }
|
|
@@ -108,7 +117,7 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
108
117
|
.wf-card > .workflow-result:empty { display: none; }
|
|
109
118
|
.wf-card > .workflow-result { padding: 10px 20px; border-top: 1px solid var(--line); }
|
|
110
119
|
/* The list: one row per workflow; a row opens to its tabs. */
|
|
111
|
-
.wf-list-box { border: 1px solid var(--line); border-radius:
|
|
120
|
+
.wf-list-box { border: 1px solid var(--line); border-radius: 0; background: var(--bg); overflow: hidden; }
|
|
112
121
|
.wf-row + .wf-row { border-top: 1px solid var(--line); }
|
|
113
122
|
.wf-row.workflow-focus { box-shadow: inset 3px 0 0 var(--accent); }
|
|
114
123
|
.wf-row-head { display: grid; grid-template-columns: 14px minmax(0, 1fr) 210px 200px auto; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer; }
|
|
@@ -134,14 +143,16 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
134
143
|
"+2 more schedules") at the same size as its schedule lines. */
|
|
135
144
|
.wf-row-starts .hint, .wf-row-last .hint { font-size: 12.5px; }
|
|
136
145
|
.wf-row-actions { display: flex; gap: 6px; }
|
|
137
|
-
.wf-row-actions button, .wf-row-foot button { height: 30px; padding: 0 12px; border-radius:
|
|
138
|
-
.wf-row-actions button:hover:not(:disabled) { background: var(--
|
|
146
|
+
.wf-row-actions button, .wf-row-foot button { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
|
|
147
|
+
.wf-row-actions button:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
|
|
139
148
|
.wf-row-body { padding: 4px 16px 16px 44px; display: grid; gap: 12px; }
|
|
140
149
|
.wf-row-body[hidden], .wf-panel[hidden] { display: none; }
|
|
141
|
-
|
|
142
|
-
.wf-
|
|
150
|
+
/* Its tabs, as the segmented control the other pages use. */
|
|
151
|
+
.wf-tabs { display: flex; gap: 2px; width: fit-content; max-width: 100%; padding: 3px; border-radius: 10px; background: var(--surface); overflow-x: auto; scrollbar-width: none; }
|
|
152
|
+
.wf-tab { border: 0; border-radius: 8px; background: none; height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--ink-muted); white-space: nowrap; }
|
|
143
153
|
.wf-tab:hover:not(:disabled) { background: none; color: var(--ink); }
|
|
144
|
-
.wf-tab[aria-selected="true"] { color: var(--
|
|
154
|
+
.wf-tab[aria-selected="true"] { color: var(--ink); background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
|
|
155
|
+
.wf-tab[aria-selected="true"]:hover:not(:disabled) { background: var(--bg); }
|
|
145
156
|
.wf-msg-form { display: flex; flex-direction: column; gap: 14px; }
|
|
146
157
|
.wf-draft-note { margin: 0; display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--ink-muted); }
|
|
147
158
|
.wf-msg-dests { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
|
|
@@ -183,10 +194,10 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
183
194
|
.wf-cb-decision.ask { background: var(--warn-soft); color: var(--warn); }
|
|
184
195
|
.wf-cb-decision.deny { background: var(--bad-soft); color: var(--bad); }
|
|
185
196
|
@media (max-width: 520px) { .wf-cb { grid-template-columns: minmax(0, 1fr); gap: 2px; } .wf-cb-v { margin-bottom: 8px; } }
|
|
186
|
-
.wf-ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:
|
|
197
|
+
.wf-ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
|
|
187
198
|
@media (max-width: 900px) { .wf-ways { grid-template-columns: minmax(0, 1fr); } }
|
|
188
|
-
.wf-way { margin: 0; display: grid; gap:
|
|
189
|
-
.wf-way h4 { margin: 0; font-size:
|
|
199
|
+
.wf-way { margin: 0; display: grid; gap: 10px; align-content: start; padding: 20px 22px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: var(--bg); min-width: 0; font-size: 13px; }
|
|
200
|
+
.wf-way h4 { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
|
|
190
201
|
.wf-way-what { margin: 0; font-size: 12.5px; color: var(--ink-muted); }
|
|
191
202
|
.wf-way .hint[hidden], .wf-way [hidden] { display: none; }
|
|
192
203
|
.wf-way .workflow-hooks:empty { display: none; }
|
|
@@ -199,11 +210,12 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
199
210
|
.wf-run-bar { display: grid; gap: 10px; }
|
|
200
211
|
.wf-run-bar .workflow-params { margin: 0; }
|
|
201
212
|
.wf-run-bar-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
|
|
202
|
-
.wf-sub { margin: 6px 0 0; font-size:
|
|
203
|
-
|
|
204
|
-
.wf-
|
|
205
|
-
.wf-score
|
|
206
|
-
.wf-score-
|
|
213
|
+
.wf-sub { margin: 6px 0 0; font-size: 18px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
|
|
214
|
+
/* Its numbers, in a hairline grid of cells. */
|
|
215
|
+
.wf-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
|
|
216
|
+
.wf-score { display: grid; gap: 2px; align-content: start; padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
|
|
217
|
+
.wf-score-k { font-size: 12.5px; font-weight: 400; color: var(--ink-muted); }
|
|
218
|
+
.wf-score-v { font-size: 28px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
|
|
207
219
|
.wf-evals-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
|
|
208
220
|
.wf-evals-bar button, .wf-case-actions 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); }
|
|
209
221
|
.wf-crits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
|
|
@@ -293,13 +305,16 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
293
305
|
.wf-sub-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
|
|
294
306
|
.wf-act-main[hidden], .wf-trace[hidden] { display: none; }
|
|
295
307
|
.wf-act-main > .wf-section + .wf-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
|
|
296
|
-
|
|
297
|
-
.wf-run-
|
|
298
|
-
.wf-run-card
|
|
308
|
+
/* Runs, as rows sharing their lines. */
|
|
309
|
+
.wf-run-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border: 1px solid var(--line); }
|
|
310
|
+
.wf-run-card { display: grid; gap: 6px; padding: 14px 18px; border: 0; border-radius: 0; background: var(--bg); min-width: 0; font-size: 13px; }
|
|
311
|
+
.wf-run-card + .wf-run-card { border-top: 1px solid var(--line); }
|
|
312
|
+
.wf-run-card:hover { background: var(--surface); }
|
|
313
|
+
.wf-run-card.is-failed { box-shadow: inset 3px 0 0 var(--bad); }
|
|
299
314
|
.wf-run-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
|
|
300
315
|
.wf-run-card-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
|
|
301
|
-
.wf-run-card-actions .wf-run-trace { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--
|
|
302
|
-
.wf-run-card-actions .wf-run-trace:hover { background: var(--
|
|
316
|
+
.wf-run-card-actions .wf-run-trace { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
|
|
317
|
+
.wf-run-card-actions .wf-run-trace:hover { background: var(--surface); color: var(--ink); }
|
|
303
318
|
.wf-run-version { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); }
|
|
304
319
|
.wf-run-card-inputs { color: var(--ink-muted); overflow-wrap: anywhere; }
|
|
305
320
|
.wf-run-card-out { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
@@ -598,6 +613,21 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
598
613
|
form.add-source.env-inline textarea { flex: 1 1 100%; }
|
|
599
614
|
form.add-source.env-inline button { padding: 4px 10px; }
|
|
600
615
|
.tab-panel .le-table-wrap table { border: 0; border-radius: 0; }
|
|
616
|
+
/* Overview, in the other pages' style: a big title with the agent's
|
|
617
|
+
instructions and the mascot, its parts in a hairline grid of cards,
|
|
618
|
+
then its settings in another. */
|
|
619
|
+
.ov-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 36px 32px 28px; border: 1px solid var(--line); border-bottom: 0; }
|
|
620
|
+
.ov-hero .le-mascot { flex: none; margin-bottom: -6px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .12)); }
|
|
621
|
+
.ov-hero-text { display: grid; gap: 10px; min-width: 0; }
|
|
622
|
+
.ov-hero-sub { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-muted); max-width: 72ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
|
623
|
+
.ov-section-title { margin: 0; padding: 30px 32px 16px; font-size: 22px; font-weight: 400; letter-spacing: -0.02em; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
|
|
624
|
+
.ov-cards.le-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
625
|
+
.ov-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
626
|
+
.ov-settings > section { margin: 0; padding: 20px 22px; background: var(--bg); min-width: 0; }
|
|
627
|
+
.ov-settings > section.ov-wide { grid-column: 1 / -1; }
|
|
628
|
+
.ov-settings pre { margin: 0; }
|
|
629
|
+
@media (max-width: 1100px) { .ov-cards.le-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
630
|
+
@media (max-width: 860px) { .ov-hero { padding: 24px 18px 20px; } .ov-hero .le-mascot { display: none; } .ov-settings, .ov-cards.le-grid { grid-template-columns: minmax(0, 1fr); } .ov-section-title { padding: 24px 18px 14px; } }
|
|
601
631
|
section { margin-bottom: 28px; }
|
|
602
632
|
section h3 {
|
|
603
633
|
font-size: 15px;
|
|
@@ -872,9 +902,102 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
872
902
|
.app-pick-tool code { overflow-wrap: anywhere; }
|
|
873
903
|
.app-pick-tool select { font: inherit; font-size: 11.5px; padding: 1px 4px; }
|
|
874
904
|
.app-pick-desc { display: block; }
|
|
905
|
+
|
|
906
|
+
/* ---------- the new style, across the tabs ----------
|
|
907
|
+
Headings in the big, light type; boxes square, and side by side or
|
|
908
|
+
one under another they share their lines; the teal-tinted buttons
|
|
909
|
+
plain, as on the other pages. */
|
|
910
|
+
.tab-panel:not([data-tab-panel="overview"]) section h3 { font-size: 20px; font-weight: 400; letter-spacing: -0.01em; }
|
|
911
|
+
.advanced-part { font-size: 22px; font-weight: 400; letter-spacing: -0.02em; }
|
|
912
|
+
/* Side by side: a hairline grid. */
|
|
913
|
+
.wf-msg-dests, .wf-fb-stats, .wf-fb-ways { gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
|
|
914
|
+
.wf-msg-dest, .wf-fb-stat, .wf-fb-way { border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; }
|
|
915
|
+
.wf-fb-stat strong, .wf-fb-stat b { font-weight: 400; }
|
|
916
|
+
/* One under another: rows sharing their lines. */
|
|
917
|
+
.wf-crits, .wf-fb-list, .msg-conns, .wf-version-cards { gap: 0; border: 1px solid var(--line); }
|
|
918
|
+
.wf-crit, .wf-fb-item, .msg-conn, .wf-version-card { border: 0; border-radius: 0; }
|
|
919
|
+
.wf-crit + .wf-crit, .wf-fb-item + .wf-fb-item, .msg-conn + .msg-conn, .wf-version-card + .wf-version-card { border-top: 1px solid var(--line); }
|
|
920
|
+
.wf-fb-item, .wf-version-card { padding: 14px 18px; }
|
|
921
|
+
.msg-conn { background: var(--bg); }
|
|
922
|
+
.wf-version-card { background: var(--bg); }
|
|
923
|
+
.wf-version-card.is-current { box-shadow: inset 3px 0 0 var(--accent); }
|
|
924
|
+
.wf-version-cards { list-style: none; margin: 0; padding: 0; display: grid; }
|
|
925
|
+
/* Boxes on their own: square. */
|
|
926
|
+
.wf-cb, .wf-fb-improve, .approvals-nudge, .le-table-wrap, .source, .workflow-steps-text, .wf-run-lines, .wf-cand-list, .tab-panel form.add-source, .tab-panel table { border-radius: 0; }
|
|
927
|
+
.wf-fb-improve { background: var(--surface); }
|
|
928
|
+
/* Plain buttons, as on the other pages. */
|
|
929
|
+
.wf-evals-bar button, .wf-case-actions button, .wf-crit-bar button, .wf-crit-edit { border-color: var(--line); background: var(--bg); color: var(--ink); }
|
|
930
|
+
.wf-evals-bar button:hover:not(:disabled), .wf-case-actions button:hover:not(:disabled), .wf-crit-bar button:hover:not(:disabled), .wf-crit-edit:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
|
|
931
|
+
|
|
932
|
+
/* The Schedules tab: + Add schedule, and its dialog, like Create
|
|
933
|
+
schedule on the Schedules page. */
|
|
934
|
+
.sched-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
|
|
935
|
+
.sched-top .le-btn-dark { flex: none; }
|
|
936
|
+
.sched-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .22); overflow: hidden; }
|
|
937
|
+
.sched-dialog::backdrop { background: rgba(20, 24, 25, .35); backdrop-filter: blur(3px); }
|
|
938
|
+
.sched-dialog form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 50px); margin: 0; }
|
|
939
|
+
.sched-dlg-head { display: flex; align-items: center; gap: 8px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
|
|
940
|
+
.sched-dlg-head h2 { margin: 0 auto 0 0; font-size: 18px; font-weight: 500; }
|
|
941
|
+
.sched-dlg-head button { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; }
|
|
942
|
+
.sched-dlg-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: auto; }
|
|
943
|
+
.sched-dlg-col { display: grid; align-content: start; }
|
|
944
|
+
.sched-dlg-col + .sched-dlg-col { border-left: 1px solid var(--line); background: var(--surface); }
|
|
945
|
+
.sched-field { display: grid; gap: 9px; padding: 16px 22px; border-bottom: 1px solid var(--line); font-size: 13px; }
|
|
946
|
+
.sched-field[hidden] { display: none; }
|
|
947
|
+
.sched-field-k { font-size: 14px; font-weight: 500; color: var(--ink); }
|
|
948
|
+
.sched-field textarea { min-height: 90px; border-radius: 9px; }
|
|
949
|
+
.sched-field input:not([type="radio"]):not([type="checkbox"]), .sched-field select { height: 36px; border-radius: 9px; }
|
|
950
|
+
.sched-field .le-seg { display: flex; }
|
|
951
|
+
.sched-field .le-seg button { flex: 1; justify-content: center; }
|
|
952
|
+
.sched-field .le-seg[hidden], .sched-row[hidden], .sched-field select[hidden] { display: none; }
|
|
953
|
+
.sched-row { display: flex; gap: 8px; }
|
|
954
|
+
.sched-message { display: grid; gap: 6px; }
|
|
955
|
+
.sched-message[hidden] { display: none; }
|
|
956
|
+
.sched-row > * { flex: 1; min-width: 0; }
|
|
957
|
+
.sched-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
958
|
+
.sched-dlg-foot { padding: 12px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); min-height: 46px; display: flex; align-items: center; }
|
|
959
|
+
.sched-dlg-foot:has(#scheduleResult:empty) { display: none; }
|
|
960
|
+
@media (max-width: 760px) { .sched-dlg-body { grid-template-columns: minmax(0, 1fr); } .sched-dlg-col + .sched-dlg-col { border-left: 0; border-top: 1px solid var(--line); } .sched-top { flex-direction: column; } }
|
|
961
|
+
|
|
962
|
+
/* Its schedules, as cards like the Schedules page's. */
|
|
963
|
+
.sched-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
964
|
+
.sched-card { display: grid; gap: 14px; align-content: start; padding: 20px 22px; background: var(--bg); min-width: 0; }
|
|
965
|
+
.sched-card.is-off .sched-card-text { opacity: .55; }
|
|
966
|
+
.sched-card.schedule-focus { background: var(--accent-soft); }
|
|
967
|
+
.sched-card-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 12px; align-items: start; }
|
|
968
|
+
.sched-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-muted); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
|
|
969
|
+
.sched-icon svg { width: 16px; height: 16px; }
|
|
970
|
+
.sched-card-text { display: grid; gap: 3px; min-width: 0; }
|
|
971
|
+
.sched-card-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
|
|
972
|
+
.sched-card-desc { font-size: 13px; color: var(--ink-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
973
|
+
.sched-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
974
|
+
.sched-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); white-space: nowrap; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
975
|
+
.sched-chip.strong { background: var(--surface); border-color: transparent; color: var(--ink); font-weight: 500; }
|
|
976
|
+
.sched-chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); font-weight: 600; }
|
|
977
|
+
.sched-chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
|
|
978
|
+
a.sched-chip:hover { color: var(--ink); border-color: var(--ink-faint); }
|
|
979
|
+
.sched-chip input { margin: 0; }
|
|
980
|
+
.sched-next { font-size: 12px; color: var(--ink-faint); margin-left: 4px; white-space: nowrap; }
|
|
981
|
+
.sched-last { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
|
|
982
|
+
.sched-last-k { font-size: 12.5px; color: var(--ink-muted); margin-right: 2px; }
|
|
983
|
+
.sched-last .schedule-result { flex-basis: 100%; font-size: 13px; color: var(--ink); max-height: 4.5em; overflow: hidden; }
|
|
984
|
+
.sched-history summary { cursor: pointer; }
|
|
985
|
+
.sched-menu { position: relative; }
|
|
986
|
+
.sched-menu summary { list-style: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; cursor: pointer; color: var(--ink-muted); }
|
|
987
|
+
.sched-menu summary::-webkit-details-marker { display: none; }
|
|
988
|
+
.sched-menu summary:hover { background: var(--surface); color: var(--ink); }
|
|
989
|
+
.sched-menu[open] .sched-menu-list { display: grid; }
|
|
990
|
+
.sched-menu-list { display: none; position: absolute; right: 0; top: 32px; z-index: 20; min-width: 180px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
|
|
991
|
+
.sched-menu-list a, .sched-menu-list button { display: block; width: 100%; text-align: left; height: auto; padding: 7px 10px; border: 0; border-radius: 7px; background: none; font-size: 13px; font-weight: 400; color: var(--ink); text-decoration: none; cursor: pointer; }
|
|
992
|
+
.sched-menu-list a:hover, .sched-menu-list button:hover:not(:disabled) { background: var(--surface); }
|
|
993
|
+
.sched-menu-list .delete-btn { color: var(--bad); }
|
|
994
|
+
.sched-ended { margin-top: 18px; }
|
|
995
|
+
.sched-ended summary { cursor: pointer; margin-bottom: 12px; }
|
|
996
|
+
@media (max-width: 860px) { .sched-cards { grid-template-columns: minmax(0, 1fr); } }
|
|
875
997
|
</style>
|
|
876
998
|
</head>
|
|
877
999
|
<body data-le-page="agent-config">
|
|
1000
|
+
<template id="ovMascot">${mascotSvg(92)}</template>
|
|
878
1001
|
<div class="le-app">
|
|
879
1002
|
${consoleSidebarHtml}
|
|
880
1003
|
<main class="le-main">
|
|
@@ -1084,7 +1207,7 @@ ${renderMarkdownScript}
|
|
|
1084
1207
|
? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '">' + inner + '</a>'
|
|
1085
1208
|
: '<div class="le-card">' + inner + '</div>';
|
|
1086
1209
|
}
|
|
1087
|
-
return '<div class="le-cards
|
|
1210
|
+
return '<div class="le-cards le-grid ov-cards">' +
|
|
1088
1211
|
card(null, 'Model', escapeHtml(modelValue), escapeHtml(modelDetail)) +
|
|
1089
1212
|
(cfg.abilityCount != null
|
|
1090
1213
|
? card('abilities', 'Apps', String(cfg.abilityCount), cfg.abilityCount ? 'Apps and abilities added to this agent' : 'Add apps and abilities, with the tools you choose')
|
|
@@ -2143,19 +2266,20 @@ ${renderMarkdownScript}
|
|
|
2143
2266
|
document.title = w.title + ' ' + String.fromCharCode(183) + ' ' + agentLabel;
|
|
2144
2267
|
return '<article class="workflow-card wf-page is-open" data-workflow="' + escapeHtml(w.id) + '">' +
|
|
2145
2268
|
'<header class="wf-page-head">' +
|
|
2269
|
+
// A top bar like the other pages': where you are, and Edit.
|
|
2146
2270
|
'<div class="wf-page-crumb-row"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>' +
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2271
|
+
'<div class="le-crumb"><a href="/workflows">Workflows</a><span class="le-crumb-sep" aria-hidden="true">/</span><a href="/agents/config?agent=' + encodeURIComponent(name) + '&tab=workflows">' + escapeHtml(agentLabel) + '</a><span class="le-crumb-sep" aria-hidden="true">/</span><span class="le-crumb-here">' + escapeHtml(w.title) + '</span></div>' +
|
|
2272
|
+
'<span class="wf-row-actions"><button type="button" class="workflow-edit le-btn-dark">Edit workflow</button></span></div>' +
|
|
2273
|
+
'<div class="wf-page-hero"><h1>' + escapeHtml(w.title) + '</h1>' +
|
|
2150
2274
|
(w.description && w.description !== w.title ? '<p class="wf-page-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
2151
2275
|
'<div class="wf-page-meta">' +
|
|
2152
2276
|
'<span class="wf-page-meta-item"><span class="wf-page-meta-k">Agent</span><a href="/agents/config?agent=' + encodeURIComponent(name) + '">' + escapeHtml(agentLabel) + '</a></span>' +
|
|
2153
2277
|
'<span class="wf-page-meta-item"><span class="wf-page-meta-k">Starts</span><span class="wf-page-starts">' + workflowStartsSummary(w) + '</span></span>' +
|
|
2154
|
-
'<span class="wf-page-meta-item"><span class="wf-page-
|
|
2278
|
+
'<span class="wf-page-meta-item"><span class="wf-page-last">' + workflowLastRunHtml(last) + '</span></span>' +
|
|
2155
2279
|
// Filled by loadWorkflowVersions.
|
|
2156
2280
|
'<span class="wf-page-meta-item wf-page-version-item" hidden><span class="wf-page-meta-k">Version</span><span class="wf-page-version"></span></span>' +
|
|
2157
2281
|
(w.jobs && w.jobs.length ? '<span class="wf-page-meta-item"><span class="wf-page-meta-k">For goal</span><span>' + w.jobs.map(function (j) { return '<a href="/goals?goal=' + encodeURIComponent(j.id) + '">' + escapeHtml(j.title) + '</a>'; }).join(', ') + '</span></span>' : '') +
|
|
2158
|
-
'</div>' +
|
|
2282
|
+
'</div></div>' +
|
|
2159
2283
|
'</header>' +
|
|
2160
2284
|
workflowDraftBannerHtml(w) +
|
|
2161
2285
|
'<div class="wf-row-body wf-page-body">' +
|
|
@@ -3827,11 +3951,16 @@ ${renderMarkdownScript}
|
|
|
3827
3951
|
'</form>');
|
|
3828
3952
|
}
|
|
3829
3953
|
|
|
3830
|
-
|
|
3954
|
+
var mascotTpl = document.getElementById('ovMascot');
|
|
3955
|
+
return '<div class="ov-hero"><div class="ov-hero-text"><h2 class="le-display">' + escapeHtml(cfg.displayName || cfg.name) + '</h2>' +
|
|
3956
|
+
(cfg.systemPrompt ? '<p class="ov-hero-sub">' + escapeHtml(cfg.systemPrompt) + '</p>' : '') + '</div>' + (mascotTpl ? mascotTpl.innerHTML : '') + '</div>' +
|
|
3957
|
+
renderOverviewCards(cfg) +
|
|
3958
|
+
'<h3 class="ov-section-title">Settings</h3>' +
|
|
3959
|
+
'<div class="le-grid ov-settings">' +
|
|
3831
3960
|
'<section>' + nameSection + '</section>' +
|
|
3832
|
-
'<section>' + systemPromptSection + '</section>' +
|
|
3833
3961
|
'<section>' + modelSection + '</section>' +
|
|
3834
|
-
'<section
|
|
3962
|
+
'<section class="ov-wide">' + systemPromptSection + '</section>' +
|
|
3963
|
+
'<section class="ov-wide"><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3835
3964
|
'<dl class="kv kv-wide" id="limitsDisplay">' +
|
|
3836
3965
|
'<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
|
|
3837
3966
|
'<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
|
|
@@ -3851,7 +3980,7 @@ ${renderMarkdownScript}
|
|
|
3851
3980
|
'<div class="error" id="limitsError"></div>' +
|
|
3852
3981
|
'<div class="ed-actions"><button type="button" id="cancelLimitsBtn" data-dialog-cancel>Cancel</button><button type="submit" class="primary">Save</button></div>' +
|
|
3853
3982
|
'</form>') +
|
|
3854
|
-
'</section>';
|
|
3983
|
+
'</section></div>';
|
|
3855
3984
|
}
|
|
3856
3985
|
|
|
3857
3986
|
// Wires the Instructions / Model / Limits Edit buttons rendered by
|
|
@@ -4996,83 +5125,127 @@ ${renderMarkdownScript}
|
|
|
4996
5125
|
return s.run_at ? 'Once, ' + escapeHtml(fmtScheduleTime(s.run_at)) : 'Every ' + escapeHtml(s.every) + (s.anchor ? '<div class="hint">from ' + escapeHtml(fmtScheduleTime(s.anchor)) + '</div>' : '');
|
|
4997
5126
|
}
|
|
4998
5127
|
|
|
5128
|
+
// How often, in words, as the Schedules page says it: Daily at 09:00,
|
|
5129
|
+
// Weekly on Friday at 10:30, Every 6 hours, Once, Nov 27, 09:00.
|
|
5130
|
+
function scheduleClock(ms) {
|
|
5131
|
+
try { return new Date(ms).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', timeZone: schedulesTimeZone || undefined }); }
|
|
5132
|
+
catch (e) { return new Date(ms).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' }); }
|
|
5133
|
+
}
|
|
5134
|
+
function describeSchedule(t) {
|
|
5135
|
+
var s = t.schedule || {};
|
|
5136
|
+
if (s.run_at) return 'Once, ' + fmtScheduleTime(s.run_at);
|
|
5137
|
+
var m = String(s.every || '').match(/^([0-9]+)([smhd])$/);
|
|
5138
|
+
if (!m) return String(s.every || '');
|
|
5139
|
+
var n = Number(m[1]);
|
|
5140
|
+
var at = t.next_run_at ? Date.parse(t.next_run_at) : (s.anchor ? Date.parse(s.anchor) : 0);
|
|
5141
|
+
var weekday = function (ms) { try { return new Date(ms).toLocaleDateString('en-US', { weekday: 'long', timeZone: schedulesTimeZone || undefined }); } catch (e) { return ''; } };
|
|
5142
|
+
if (m[2] === 'd' && n === 1 && at) return 'Daily at ' + scheduleClock(at);
|
|
5143
|
+
if (m[2] === 'd' && n === 7 && at) return 'Weekly on ' + weekday(at) + ' at ' + scheduleClock(at);
|
|
5144
|
+
if (m[2] === 'd') return 'Every ' + n + ' days' + (at ? ' at ' + scheduleClock(at) : '');
|
|
5145
|
+
var unit = { s: 'second', m: 'minute', h: 'hour' }[m[2]];
|
|
5146
|
+
return n === 1 ? 'Every ' + unit : 'Every ' + n + ' ' + unit + 's';
|
|
5147
|
+
}
|
|
5148
|
+
function scheduleUntil(iso) {
|
|
5149
|
+
var ms = Date.parse(iso) - Date.now();
|
|
5150
|
+
if (!(ms > 0)) return 'any moment';
|
|
5151
|
+
var min = Math.round(ms / 60000);
|
|
5152
|
+
if (min < 60) return 'in ' + min + 'm';
|
|
5153
|
+
var h = Math.floor(min / 60);
|
|
5154
|
+
if (h < 48) return 'in ' + h + 'h ' + (min % 60) + 'm';
|
|
5155
|
+
return 'in ' + Math.round(h / 24) + ' days';
|
|
5156
|
+
}
|
|
5157
|
+
var SCHED_ICON_REPEAT = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 0 1-15.5 6.2"/><path d="M3 12A9 9 0 0 1 18.5 5.8"/><path d="M18 2v4h-4"/><path d="M6 22v-4h4"/></svg>';
|
|
5158
|
+
var SCHED_ICON_ONCE = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M16 3v4"/><path d="M8 3v4"/><path d="M3 11h18"/></svg>';
|
|
5159
|
+
var SCHED_ICON_DOTS = '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="5" r="1.7"/><circle cx="12" cy="12" r="1.7"/><circle cx="12" cy="19" r="1.7"/></svg>';
|
|
5160
|
+
|
|
5161
|
+
// A schedule as a card, as on the Schedules page: what it runs, a switch
|
|
5162
|
+
// to pause or resume it, Run now and the rest in its menu; how often, its
|
|
5163
|
+
// state and next run as chips; then its last run and history.
|
|
4999
5164
|
function renderScheduleRow(t) {
|
|
5000
|
-
var
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5165
|
+
var ended = t.status === 'cancelled' || t.status === 'done';
|
|
5166
|
+
var on = t.status !== 'paused';
|
|
5167
|
+
var title = t.task_name || (t.workflow && t.workflow.title) || String(t.message || '').split(String.fromCharCode(10))[0] || 'Untitled';
|
|
5168
|
+
var desc = t.workflow ? (t.workflow.description || t.workflow.start_message || '') : t.workflow_missing ? '' : (t.task_name ? t.message : '');
|
|
5169
|
+
var params = t.params ? Object.keys(t.params).map(function (k) { return escapeHtml(k) + ': ' + escapeHtml(t.params[k]); }).join(' ' + String.fromCharCode(183) + ' ') : '';
|
|
5170
|
+
var menu = [];
|
|
5171
|
+
if (t.status !== 'running' && t.status !== 'awaiting_approval' && !ended) menu.push('<button type="button" class="schedule-action" data-id="' + escapeHtml(t.task_id) + '" data-action="run">Run now</button>');
|
|
5172
|
+
if (t.workflow) menu.push('<a href="' + escapeHtml(workflowPageHref(currentName, t.workflow.id)) + '">Open its workflow</a>');
|
|
5173
|
+
menu.push(ended
|
|
5174
|
+
? '<button type="button" class="schedule-action delete-btn" data-id="' + escapeHtml(t.task_id) + '" data-action="delete">Delete</button>'
|
|
5175
|
+
: '<button type="button" class="schedule-action delete-btn" data-id="' + escapeHtml(t.task_id) + '" data-action="cancel">Remove</button>');
|
|
5176
|
+
var state = t.status === 'awaiting_approval' ? '<a href="#" class="sched-chip warn schedule-to-approvals">Waiting for approval</a>'
|
|
5177
|
+
: t.status === 'running' ? '<span class="sched-chip strong">Running now</span>'
|
|
5178
|
+
: t.status === 'done' ? '<span class="sched-chip">Done</span>'
|
|
5179
|
+
: t.status === 'cancelled' ? '<span class="sched-chip">Removed</span>'
|
|
5180
|
+
: t.last_status === 'error' ? '<span class="sched-chip bad">Last run failed</span>' : '';
|
|
5181
|
+
var next = ended ? '' : !on ? 'Paused' : t.next_run_at ? 'Next run ' + scheduleUntil(t.next_run_at) : '';
|
|
5006
5182
|
var lastOutcome = t.last_status === 'ok' ? (t.last_result || '') : (t.last_error || '');
|
|
5007
5183
|
var last = t.last_run_at
|
|
5008
|
-
? '<span class="le-pill ' + (t.last_status === 'ok' ? 'good' : 'bad') + '">' + escapeHtml(t.last_status) + '</span> ' +
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
: '<span class="hint">not run yet</span>';
|
|
5184
|
+
? '<div class="sched-last"><span class="sched-last-k">Last run</span><span class="le-pill ' + (t.last_status === 'ok' ? 'good' : 'bad') + '">' + escapeHtml(t.last_status === 'ok' ? 'done' : t.last_status) + '</span> <span class="hint">' + escapeHtml(fmtScheduleTime(t.last_run_at)) + '</span>' +
|
|
5185
|
+
(lastOutcome ? '<div class="schedule-result workflow-markdown">' + renderMarkdownPreview(lastOutcome) + '</div>' : '') + '</div>'
|
|
5186
|
+
: '';
|
|
5012
5187
|
var history = (t.history || []).slice().reverse().map(function (h) {
|
|
5013
5188
|
var outcome = h.status === 'ok' ? (h.result || '') : (h.error || '');
|
|
5014
5189
|
return '<li><span class="le-pill ' + (h.status === 'ok' ? 'good' : 'bad') + '">' + escapeHtml(h.status) + '</span> <span class="hint">' + escapeHtml(fmtScheduleTime(h.ran_at)) + '</span>' +
|
|
5015
5190
|
(outcome ? '<div class="schedule-result workflow-markdown">' + renderMarkdownPreview(outcome) + '</div>' : '') + '</li>';
|
|
5016
5191
|
}).join('');
|
|
5017
|
-
return '<
|
|
5018
|
-
'<
|
|
5019
|
-
(
|
|
5020
|
-
? '<
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
// A workflow's
|
|
5027
|
-
|
|
5028
|
-
(
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
'<td><span class="le-pill ' + (SCHEDULE_PILLS[t.status] || 'neutral') + '">' + escapeHtml(SCHEDULE_LABELS[t.status] || t.status) + '</span>' +
|
|
5033
|
-
(t.status === 'awaiting_approval' ? '<div class="hint"><a href="#" class="schedule-to-approvals">Decide in Messaging</a></div>' : '') + '</td>' +
|
|
5034
|
-
'<td style="min-width:200px">' + last + (history ? '<details><summary class="hint">History (' + (t.history || []).length + ')</summary><ul class="schedule-history">' + history + '</ul></details>' : '') + '</td>' +
|
|
5035
|
-
'<td><div style="display:flex;gap:6px;flex-wrap:wrap">' + actions.map(function (a) {
|
|
5036
|
-
return '<button type="button" class="schedule-action' + (a[0] === 'run' ? ' primary' : '') + (a[0] === 'cancel' || a[0] === 'delete' ? ' delete-btn' : '') + '" data-id="' + escapeHtml(t.task_id) + '" data-action="' + a[0] + '"' + (t.workflow_id ? ' data-workflow="' + escapeHtml(t.workflow_id) + '"' : '') + '>' + a[1] + '</button>';
|
|
5037
|
-
}).join('') + '</div></td></tr>';
|
|
5192
|
+
return '<div class="sched-card' + (on && !ended ? '' : ' is-off') + '" id="schedule-' + escapeHtml(t.task_id) + '">' +
|
|
5193
|
+
'<div class="sched-card-head"><span class="sched-icon">' + (t.schedule && t.schedule.run_at ? SCHED_ICON_ONCE : SCHED_ICON_REPEAT) + '</span>' +
|
|
5194
|
+
'<span class="sched-card-text"><span class="sched-card-title">' + escapeHtml(title) + '</span>' +
|
|
5195
|
+
(t.workflow_missing ? '<span class="le-pill bad" style="justify-self:start">Its workflow was removed</span>' : desc ? '<span class="sched-card-desc">' + escapeHtml(desc) + '</span>' : '') +
|
|
5196
|
+
(params ? '<span class="hint">' + params + '</span>' : '') + '</span>' +
|
|
5197
|
+
(ended ? '<span></span>' : '<button type="button" class="le-switch schedule-action" role="switch" aria-checked="' + on + '" aria-label="' + (on ? 'Pause ' : 'Resume ') + escapeHtml(title) + '" data-id="' + escapeHtml(t.task_id) + '" data-action="' + (on ? 'pause' : 'resume') + '"' + (t.status === 'running' || t.status === 'awaiting_approval' ? ' disabled' : '') + '></button>') +
|
|
5198
|
+
'<details class="sched-menu"><summary aria-label="More">' + SCHED_ICON_DOTS + '</summary><div class="sched-menu-list">' + menu.join('') + '</div></details></div>' +
|
|
5199
|
+
'<div class="sched-chips"><span class="sched-chip strong">' + escapeHtml(describeSchedule(t)) + '</span>' +
|
|
5200
|
+
(t.workflow ? '<a class="sched-chip" href="' + escapeHtml(workflowPageHref(currentName, t.workflow.id)) + '">Workflow: ' + escapeHtml(t.workflow.title) + '</a>' : !t.workflow_id ? '<span class="sched-chip">Message</span>' : '') +
|
|
5201
|
+
// A message's result to chat, switched here; a workflow's follows its Messaging tab.
|
|
5202
|
+
(!ended && !t.workflow_id ? '<label class="sched-chip"><input type="checkbox" class="schedule-notify-toggle" data-id="' + escapeHtml(t.task_id) + '"' + (t.notify ? ' checked' : '') + '> Result to chat</label>' : '') +
|
|
5203
|
+
state + (next ? '<span class="sched-next">' + escapeHtml(next) + '</span>' : '') + '</div>' +
|
|
5204
|
+
last +
|
|
5205
|
+
(history ? '<details class="sched-history"><summary class="hint">History (' + (t.history || []).length + ')</summary><ul class="schedule-history">' + history + '</ul></details>' : '') +
|
|
5206
|
+
'</div>';
|
|
5038
5207
|
}
|
|
5039
5208
|
|
|
5040
5209
|
function renderSchedulesHtml(tasks) {
|
|
5041
5210
|
var active = tasks.filter(function (t) { return t.status !== 'cancelled' && t.status !== 'done'; });
|
|
5042
|
-
var
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5211
|
+
var ended = tasks.filter(function (t) { return t.status === 'cancelled' || t.status === 'done'; });
|
|
5212
|
+
var grid = function (list) { return '<div class="le-grid sched-cards">' + list.map(renderScheduleRow).join('') + (list.length % 2 ? '<div class="sched-card" aria-hidden="true"></div>' : '') + '</div>'; };
|
|
5213
|
+
var list = (active.length ? grid(active) : '<p class="hint">Nothing scheduled yet. Add one with + Add schedule.</p>') +
|
|
5214
|
+
(ended.length ? '<details class="sched-ended"><summary class="hint">Ended (' + ended.length + ')</summary>' + grid(ended) + '</details>' : '');
|
|
5215
|
+
return '<div class="sched-top"><p class="muted" style="margin:0">Workflows and messages this agent runs on a timer, like a cron job. A workflow schedule runs the workflow's instructions as they are at each run. Each run works like an app calling it over HTTP: an approval goes wherever the Messaging Apps tab sends it, and with nowhere set, a call that needs approval is denied. The agent can also schedule its own tasks when asked in Chat (“remind me tomorrow at 9”); they appear here too.</p><button type="button" class="le-btn-dark" id="scheduleAddBtn">+ Add schedule</button></div>' +
|
|
5046
5216
|
'<section><h3>Scheduled (' + active.length + ' active)</h3>' + list + '</section>' +
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
'</
|
|
5059
|
-
: '') +
|
|
5060
|
-
|
|
5061
|
-
'<div class="body-field">When' +
|
|
5062
|
-
'<div class="schedule-when"><input type="radio" name="when" value="every" id="whenEvery" checked><label for="whenEvery">Every</label>' +
|
|
5063
|
-
'<input type="number" name="everyN" value="1" min="1" aria-label="How many">' +
|
|
5064
|
-
'<select name="everyUnit" aria-label="Unit"><option value="m">minutes</option><option value="h" selected>hours</option><option value="d">days</option><option value="w">weeks</option></select>' +
|
|
5065
|
-
'<label for="everyStart">starting</label><input type="datetime-local" name="everyStart" id="everyStart" aria-label="First run"></div>' +
|
|
5066
|
-
'<p class="hint" style="margin:0 0 4px 22px">Optional. The first run, which sets the time of day (and the weekday, for weeks) every later run keeps, e.g. every 1 day starting tomorrow 09:00. Without it, the first run is one interval from now.' +
|
|
5067
|
-
(schedulesTimeZone ? ' Times are in ' + escapeHtml(schedulesTimeZone.replace(/_/g, ' ')) + ' (<a href="/config?section=settings">change</a>).' : '') + '</p>' +
|
|
5068
|
-
'<div class="schedule-when"><input type="radio" name="when" value="once" id="whenOnce"><label for="whenOnce">Once at</label>' +
|
|
5069
|
-
'<input type="datetime-local" name="runAt" aria-label="Date and time"></div>' +
|
|
5217
|
+
// + Add schedule opens this, like Create schedule on the Schedules page.
|
|
5218
|
+
'<dialog class="sched-dialog" id="scheduleDialog" aria-labelledby="scheduleDlgTitle">' +
|
|
5219
|
+
'<form id="scheduleForm">' +
|
|
5220
|
+
'<div class="sched-dlg-head"><h2 id="scheduleDlgTitle">Create schedule</h2><button type="button" id="scheduleCancel">Cancel</button><button type="submit" class="primary">Save</button></div>' +
|
|
5221
|
+
// The same settings as Create schedule on the Schedules page, and
|
|
5222
|
+
// here a message can run instead of a workflow.
|
|
5223
|
+
'<div class="sched-dlg-body"><div class="sched-dlg-col">' +
|
|
5224
|
+
'<div class="sched-field"><span class="sched-field-k">Runs</span>' +
|
|
5225
|
+
'<input type="hidden" name="runs" value="' + (schedulesWorkflows.length ? 'workflow' : 'message') + '">' +
|
|
5226
|
+
(schedulesWorkflows.length ? '<span class="le-seg" id="scheduleRuns"><button type="button" data-runs="workflow" aria-pressed="true">A workflow</button><button type="button" data-runs="message" aria-pressed="false">A message</button></span>' : '') +
|
|
5227
|
+
(schedulesWorkflows.length ? '<select name="workflow_id" aria-label="Workflow" id="scheduleWorkflowField">' + schedulesWorkflows.map(function (w) {
|
|
5228
|
+
return '<option value="' + escapeHtml(w.id) + '">' + escapeHtml(w.title) + '</option>';
|
|
5229
|
+
}).join('') + '</select>' : '') +
|
|
5230
|
+
'<div id="scheduleMessageField" class="sched-message"' + (schedulesWorkflows.length ? ' hidden' : '') + '><textarea name="message" placeholder="Summarize yesterday's support tickets and post the summary."></textarea><span class="hint">What the agent receives each time, as if someone typed it.</span></div>' +
|
|
5070
5231
|
'</div>' +
|
|
5071
|
-
'<label>Name <span class="hint">(optional)</span><input name="task_name" placeholder="
|
|
5072
|
-
'<
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5232
|
+
'<label class="sched-field"><span class="sched-field-k">Name <span class="hint">(optional)</span></span><input name="task_name" maxlength="80" placeholder="e.g. Monday sales summary"></label>' +
|
|
5233
|
+
'<div class="sched-field"><span class="sched-field-k">Schedule</span>' +
|
|
5234
|
+
'<span class="le-seg" id="scheduleKind"><button type="button" data-skind="repeat" aria-pressed="true">Recurring</button><button type="button" data-skind="once" aria-pressed="false">One time</button></span>' +
|
|
5235
|
+
'<span class="le-seg" id="scheduleFreq"><button type="button" data-sfreq="interval" aria-pressed="false">Interval</button><button type="button" data-sfreq="daily" aria-pressed="true">Daily</button><button type="button" data-sfreq="weekly" aria-pressed="false">Weekly</button></span>' +
|
|
5236
|
+
'<div class="sched-row" data-swhen="interval" hidden><input type="number" name="everyN" min="1" step="1" value="1" aria-label="Every"><select name="everyUnit" aria-label="Unit"><option value="m">minutes</option><option value="h" selected>hours</option><option value="d">days</option></select></div>' +
|
|
5237
|
+
'<div class="sched-row" data-swhen="daily"><input type="time" name="dailyAt" value="09:00" aria-label="At"></div>' +
|
|
5238
|
+
'<div class="sched-row" data-swhen="weekly" hidden><select name="weekday" aria-label="On">' + ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'].map(function (d) { return '<option value="' + d + '">' + d.charAt(0).toUpperCase() + d.slice(1) + '</option>'; }).join('') + '</select><input type="time" name="weeklyAt" value="09:00" aria-label="At"></div>' +
|
|
5239
|
+
'<div class="sched-row" data-swhen="once" hidden><input type="date" name="onceDate" aria-label="Date"><input type="time" name="onceAt" value="09:00" aria-label="At"></div>' +
|
|
5240
|
+
(schedulesTimeZone ? '<p class="hint" style="margin:0">Times are in ' + escapeHtml(schedulesTimeZone.replace(/_/g, ' ')) + ', the workspace' + String.fromCharCode(8217) + 's time zone (<a href="/config?section=settings">change</a>).</p>' : '') +
|
|
5241
|
+
'</div>' +
|
|
5242
|
+
'</div><div class="sched-dlg-col">' +
|
|
5243
|
+
(schedulesWorkflows.length ? '<div class="sched-field" id="scheduleInputsField"><span class="sched-field-k">Inputs for every run</span><div class="workflow-params" id="scheduleParams"></div><p class="hint" style="margin:0">Each run follows the workflow's instructions as they are then, so changing the workflow changes what runs.</p></div>' : '') +
|
|
5244
|
+
'<div class="sched-field" id="scheduleNotifyField"' + (schedulesWorkflows.length ? ' hidden' : '') + '><div class="sched-switch-row"><span class="sched-field-k">Send each result to chat</span><input type="checkbox" name="notify" aria-label="Send each result to chat"></div><p class="hint" style="margin:0">After every run, its result goes to the agent's messaging app (Slack, Telegram, Lark or email), if it has one. A workflow's results go where its Messaging tab says.</p></div>' +
|
|
5245
|
+
'<div class="sched-field"><span class="sched-field-k">When it starts</span><p class="hint" style="margin:0">Right away: the first run is at the next time you chose. Pause or remove it from the list.</p></div>' +
|
|
5246
|
+
'</div></div>' +
|
|
5247
|
+
'<div class="sched-dlg-foot"><span id="scheduleResult"></span></div>' +
|
|
5248
|
+
'</form></dialog>';
|
|
5076
5249
|
}
|
|
5077
5250
|
|
|
5078
5251
|
// The New schedule form's parameter fields ("param:<name>"), filled ones only.
|
|
@@ -5101,7 +5274,7 @@ ${renderMarkdownScript}
|
|
|
5101
5274
|
var action = btn.dataset.action;
|
|
5102
5275
|
if ((action === 'cancel' || action === 'delete') && btn.dataset.confirming !== '1') {
|
|
5103
5276
|
btn.dataset.confirming = '1';
|
|
5104
|
-
btn.textContent = 'Click again to '
|
|
5277
|
+
btn.textContent = action === 'cancel' ? 'Click again to remove' : 'Click again to delete';
|
|
5105
5278
|
return;
|
|
5106
5279
|
}
|
|
5107
5280
|
btn.disabled = true;
|
|
@@ -5131,7 +5304,6 @@ ${renderMarkdownScript}
|
|
|
5131
5304
|
var form = content.querySelector('#scheduleForm');
|
|
5132
5305
|
var result = content.querySelector('#scheduleResult');
|
|
5133
5306
|
var messageField = content.querySelector('#scheduleMessageField');
|
|
5134
|
-
var runsRadios = content.querySelectorAll('input[name="runs"]');
|
|
5135
5307
|
var paramsBox = content.querySelector('#scheduleParams');
|
|
5136
5308
|
var workflowSelect = form.querySelector('select[name="workflow_id"]');
|
|
5137
5309
|
// One field per parameter of the chosen workflow.
|
|
@@ -5144,42 +5316,74 @@ ${renderMarkdownScript}
|
|
|
5144
5316
|
inputControlHtml('param:' + p, parameters[p], false) + '</label>';
|
|
5145
5317
|
}).join('');
|
|
5146
5318
|
}
|
|
5319
|
+
// + Add schedule opens the form in a dialog.
|
|
5320
|
+
var dialog = content.querySelector('#scheduleDialog');
|
|
5321
|
+
var openDialog = function () { result.textContent = ''; if (!dialog.open) dialog.showModal(); };
|
|
5322
|
+
content.querySelector('#scheduleAddBtn').addEventListener('click', openDialog);
|
|
5323
|
+
content.querySelector('#scheduleCancel').addEventListener('click', function () { dialog.close(); });
|
|
5324
|
+
dialog.addEventListener('click', function (ev) { if (ev.target === dialog) dialog.close(); });
|
|
5147
5325
|
// Opened from a workflow's "Add a schedule": that workflow, chosen.
|
|
5148
5326
|
if (pendingScheduleWorkflow && workflowSelect) {
|
|
5149
5327
|
workflowSelect.value = pendingScheduleWorkflow;
|
|
5150
|
-
|
|
5151
|
-
if (runsWorkflowRadio) runsWorkflowRadio.checked = true;
|
|
5152
|
-
form.scrollIntoView({ block: 'start' });
|
|
5328
|
+
openDialog();
|
|
5153
5329
|
}
|
|
5154
5330
|
pendingScheduleWorkflow = null;
|
|
5155
5331
|
focusScheduleRow();
|
|
5156
5332
|
renderScheduleParams();
|
|
5157
5333
|
if (workflowSelect) workflowSelect.addEventListener('change', renderScheduleParams);
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5334
|
+
// A workflow or a message; Recurring (an interval, daily or weekly) or
|
|
5335
|
+
// one time: segmented controls, as on the Schedules page.
|
|
5336
|
+
var press = function (box, attr, value) {
|
|
5337
|
+
var bs = box ? box.querySelectorAll('[' + attr + ']') : [];
|
|
5338
|
+
for (var q = 0; q < bs.length; q++) bs[q].setAttribute('aria-pressed', String(bs[q].getAttribute(attr) === value));
|
|
5339
|
+
};
|
|
5340
|
+
var runsBox = form.querySelector('#scheduleRuns');
|
|
5341
|
+
if (runsBox) runsBox.addEventListener('click', function (ev) {
|
|
5342
|
+
var bt = ev.target.closest('[data-runs]');
|
|
5343
|
+
if (!bt) return;
|
|
5344
|
+
var byMessage = bt.getAttribute('data-runs') === 'message';
|
|
5345
|
+
form.runs.value = byMessage ? 'message' : 'workflow';
|
|
5346
|
+
press(runsBox, 'data-runs', form.runs.value);
|
|
5347
|
+
messageField.hidden = byMessage ? false : true;
|
|
5348
|
+
if (workflowSelect) workflowSelect.hidden = byMessage;
|
|
5349
|
+
var inputs = form.querySelector('#scheduleInputsField');
|
|
5350
|
+
if (inputs) inputs.hidden = byMessage;
|
|
5351
|
+
// A workflow's result goes where its Messaging tab says.
|
|
5352
|
+
form.querySelector('#scheduleNotifyField').hidden = !byMessage;
|
|
5353
|
+
});
|
|
5354
|
+
var skind = 'repeat', sfreq = 'daily';
|
|
5355
|
+
var showWhen = function () {
|
|
5356
|
+
form.querySelector('#scheduleFreq').hidden = skind !== 'repeat';
|
|
5357
|
+
var rows = form.querySelectorAll('[data-swhen]');
|
|
5358
|
+
for (var q = 0; q < rows.length; q++) rows[q].hidden = rows[q].getAttribute('data-swhen') !== (skind === 'once' ? 'once' : sfreq);
|
|
5359
|
+
};
|
|
5360
|
+
form.querySelector('#scheduleKind').addEventListener('click', function (ev) {
|
|
5361
|
+
var bt = ev.target.closest('[data-skind]');
|
|
5362
|
+
if (!bt) return;
|
|
5363
|
+
skind = bt.getAttribute('data-skind'); press(form.querySelector('#scheduleKind'), 'data-skind', skind); showWhen();
|
|
5364
|
+
});
|
|
5365
|
+
form.querySelector('#scheduleFreq').addEventListener('click', function (ev) {
|
|
5366
|
+
var bt = ev.target.closest('[data-sfreq]');
|
|
5367
|
+
if (!bt) return;
|
|
5368
|
+
sfreq = bt.getAttribute('data-sfreq'); press(form.querySelector('#scheduleFreq'), 'data-sfreq', sfreq); showWhen();
|
|
5369
|
+
});
|
|
5370
|
+
var tomorrow = new Date(Date.now() + 86400000);
|
|
5371
|
+
form.onceDate.value = tomorrow.getFullYear() + '-' + String(tomorrow.getMonth() + 1).padStart(2, '0') + '-' + String(tomorrow.getDate()).padStart(2, '0');
|
|
5168
5372
|
form.addEventListener('submit', function (ev) {
|
|
5169
5373
|
ev.preventDefault();
|
|
5170
5374
|
var data = new FormData(form);
|
|
5171
5375
|
var runsWorkflow = data.get('runs') === 'workflow';
|
|
5172
5376
|
if (!runsWorkflow && !String(data.get('message') || '').trim()) { result.textContent = 'Write the message the agent receives.'; return; }
|
|
5173
5377
|
var schedule;
|
|
5174
|
-
if (
|
|
5175
|
-
if (!data.get('
|
|
5176
|
-
schedule = { run_at: scheduleFormTime(data.get('
|
|
5378
|
+
if (skind === 'once') {
|
|
5379
|
+
if (!data.get('onceDate') || !data.get('onceAt')) { result.textContent = 'Pick a date and time.'; return; }
|
|
5380
|
+
schedule = { run_at: scheduleFormTime(data.get('onceDate') + 'T' + data.get('onceAt')) };
|
|
5381
|
+
} else if (sfreq === 'interval') {
|
|
5382
|
+
schedule = { every: String(Math.max(1, Number(data.get('everyN')) || 1)) + data.get('everyUnit') };
|
|
5383
|
+
} else if (sfreq === 'weekly') {
|
|
5384
|
+
schedule = { every: '7d', at: data.get('weeklyAt') || '09:00', weekday: data.get('weekday') };
|
|
5177
5385
|
} else {
|
|
5178
|
-
|
|
5179
|
-
var unit = data.get('everyUnit');
|
|
5180
|
-
var n = Number(data.get('everyN')) || 1;
|
|
5181
|
-
schedule = { every: unit === 'w' ? String(n * 7) + 'd' : String(n) + unit };
|
|
5182
|
-
if (data.get('everyStart')) schedule.start_at = scheduleFormTime(data.get('everyStart'));
|
|
5386
|
+
schedule = { every: '1d', at: data.get('dailyAt') || '09:00' };
|
|
5183
5387
|
}
|
|
5184
5388
|
result.textContent = 'Scheduling' + String.fromCharCode(8230);
|
|
5185
5389
|
// Live at once, a workflow's schedule too (it's how the workflow
|
|
@@ -5192,7 +5396,8 @@ ${renderMarkdownScript}
|
|
|
5192
5396
|
{ schedule: schedule, task_name: data.get('task_name'), result_to_chat: !runsWorkflow && data.get('notify') === 'on' }
|
|
5193
5397
|
)),
|
|
5194
5398
|
}).then(function (r) {
|
|
5195
|
-
if (!r.ok) { result.
|
|
5399
|
+
if (!r.ok) { result.innerHTML = '<span class="error">' + escapeHtml(r.body.error || 'Could not schedule') + '</span>'; return; }
|
|
5400
|
+
dialog.close();
|
|
5196
5401
|
loadSchedulesTab(name);
|
|
5197
5402
|
});
|
|
5198
5403
|
});
|
|
@@ -5202,6 +5407,9 @@ ${renderMarkdownScript}
|
|
|
5202
5407
|
var content = schedulesContentEl();
|
|
5203
5408
|
if (!content) return;
|
|
5204
5409
|
if (schedulesRefreshTimer) { clearTimeout(schedulesRefreshTimer); schedulesRefreshTimer = null; }
|
|
5410
|
+
// Not while someone is filling in Create schedule: try again shortly.
|
|
5411
|
+
var openDlg = content.querySelector('#scheduleDialog');
|
|
5412
|
+
if (openDlg && openDlg.open) { schedulesRefreshTimer = setTimeout(function () { loadSchedulesTab(name); }, 3000); return; }
|
|
5205
5413
|
fetchJsonRetryOnce('/agents/' + encodeURIComponent(name) + '/schedules').then(function (r) {
|
|
5206
5414
|
if (currentName !== name) return;
|
|
5207
5415
|
if (!r.ok) throw new Error(r.body.error || 'request failed');
|