ai-engineering-loop 2.1.0 → 2.2.0
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/CHANGELOG.md +11 -0
- package/core/local-workflow-studio.md +12 -7
- package/lib/node-evidence.js +877 -0
- package/lib/run-checkout.js +8 -13
- package/package.json +1 -1
- package/studio/app.js +734 -132
- package/studio/index.html +13 -4
- package/studio/styles.css +75 -20
package/studio/app.js
CHANGED
|
@@ -4,13 +4,17 @@ const NODE_WIDTH = 104;
|
|
|
4
4
|
const NODE_PORT_Y = 52;
|
|
5
5
|
const NODE_BLOCK_HEIGHT = 152;
|
|
6
6
|
const FIT_PADDING = 48;
|
|
7
|
-
const PANEL_WIDTH =
|
|
7
|
+
const PANEL_WIDTH = 480;
|
|
8
8
|
const TOOLTIP_DELAY_MS = 250;
|
|
9
9
|
const MINIMAP_WIDTH = 180;
|
|
10
10
|
const MINIMAP_HEIGHT = 110;
|
|
11
11
|
const LABEL_BLEED = 36;
|
|
12
12
|
const MIN_ZOOM = 0.2;
|
|
13
13
|
const MAX_ZOOM = 2.5;
|
|
14
|
+
const WHEEL_LINE_PX = 16;
|
|
15
|
+
const WHEEL_PAGE_PX = 800;
|
|
16
|
+
const WHEEL_SPIKE_PX = 240;
|
|
17
|
+
const PAN_THRESHOLD_PX = 4;
|
|
14
18
|
const COLUMN_PITCH = 188;
|
|
15
19
|
const ROW_PITCH = 200;
|
|
16
20
|
const DISPLAY_NAME_MAX = 80;
|
|
@@ -85,11 +89,15 @@ let reconnectTimer = null;
|
|
|
85
89
|
let reconnectAttempt = 0;
|
|
86
90
|
let resumeFallbackUsed = false;
|
|
87
91
|
let panelNodeId = null;
|
|
88
|
-
let panelTab = '
|
|
92
|
+
let panelTab = 'overview';
|
|
89
93
|
let panelRequest = 0;
|
|
90
94
|
let panelView = { status: 'empty' };
|
|
91
95
|
let tooltipTimer = null;
|
|
92
96
|
let suppressNodeClick = false;
|
|
97
|
+
let wheelFrame = null;
|
|
98
|
+
let wheelPending = null;
|
|
99
|
+
let marquee = null;
|
|
100
|
+
let gestureZoom = null;
|
|
93
101
|
let zoomInButton = null;
|
|
94
102
|
let zoomLevelOutput = null;
|
|
95
103
|
let nodeTooltip = null;
|
|
@@ -539,17 +547,109 @@ function nodeIcon(type) {
|
|
|
539
547
|
return `<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">${body}</svg>`;
|
|
540
548
|
}
|
|
541
549
|
|
|
550
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
551
|
+
|
|
542
552
|
function formatDuration(ms) {
|
|
543
|
-
if (!Number.isFinite(ms) || ms
|
|
553
|
+
if (!Number.isFinite(ms) || ms <= 0) return '';
|
|
544
554
|
const totalSeconds = Math.round(ms / 1000);
|
|
555
|
+
if (totalSeconds <= 0) return '';
|
|
545
556
|
const hours = Math.floor(totalSeconds / 3600);
|
|
546
557
|
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
547
558
|
const seconds = totalSeconds % 60;
|
|
548
|
-
if (hours > 0) return
|
|
559
|
+
if (hours > 0) return `${hours}h ${String(minutes).padStart(2, '0')}m`;
|
|
549
560
|
if (minutes > 0) return `${minutes}m ${String(seconds).padStart(2, '0')}s`;
|
|
550
561
|
return `${seconds}s`;
|
|
551
562
|
}
|
|
552
563
|
|
|
564
|
+
function parsedTime(value) {
|
|
565
|
+
const ms = Date.parse(value || '');
|
|
566
|
+
return Number.isFinite(ms) ? ms : null;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function padTime(value) {
|
|
570
|
+
return String(value).padStart(2, '0');
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function clockTime(date, withSeconds = false) {
|
|
574
|
+
const clock = `${padTime(date.getHours())}:${padTime(date.getMinutes())}`;
|
|
575
|
+
return withSeconds ? `${clock}:${padTime(date.getSeconds())}` : clock;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function monthDay(date, withYear) {
|
|
579
|
+
const base = `${MONTHS[date.getMonth()]} ${date.getDate()}`;
|
|
580
|
+
return withYear ? `${base}, ${date.getFullYear()}` : base;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function calendarDayStart(ms) {
|
|
584
|
+
const date = new Date(ms);
|
|
585
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function timeZoneName(date) {
|
|
589
|
+
try {
|
|
590
|
+
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat !== 'function') return '';
|
|
591
|
+
const parts = new Intl.DateTimeFormat('en-US', { timeZoneName: 'short' }).formatToParts(date);
|
|
592
|
+
return parts.find((part) => part.type === 'timeZoneName')?.value || '';
|
|
593
|
+
} catch {
|
|
594
|
+
return '';
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function humanizeTime(value, now = Date.now()) {
|
|
599
|
+
const ms = parsedTime(value);
|
|
600
|
+
if (ms == null) return '';
|
|
601
|
+
const age = Math.max(0, now - ms);
|
|
602
|
+
const date = new Date(ms);
|
|
603
|
+
if (age < 5000) return 'just now';
|
|
604
|
+
if (age < 60000) return `${Math.round(age / 1000)}s ago`;
|
|
605
|
+
if (age < 3600000) return `${Math.round(age / 60000)} min ago`;
|
|
606
|
+
const dayDiff = Math.round((calendarDayStart(now) - calendarDayStart(ms)) / 86400000);
|
|
607
|
+
const hours = Math.floor(age / 3600000);
|
|
608
|
+
if (dayDiff <= 0 && hours < 24) return `${Math.max(hours, 1)} h ago`;
|
|
609
|
+
const absolute = `${monthDay(date, date.getFullYear() !== new Date(now).getFullYear())}, ${clockTime(date)}`;
|
|
610
|
+
if (dayDiff === 1) return `yesterday · ${monthDay(date, false)}, ${clockTime(date)}`;
|
|
611
|
+
if (dayDiff > 1 && dayDiff < 7) return `${dayDiff} days ago · ${monthDay(date, false)}, ${clockTime(date)}`;
|
|
612
|
+
return absolute;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function exactTimeLabel(value) {
|
|
616
|
+
const ms = parsedTime(value);
|
|
617
|
+
if (ms == null) return '';
|
|
618
|
+
const date = new Date(ms);
|
|
619
|
+
const zone = timeZoneName(date);
|
|
620
|
+
return `${monthDay(date, true)} ${clockTime(date, true)}${zone ? ` ${zone}` : ''}`;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function datetimeAttr(value) {
|
|
624
|
+
const ms = parsedTime(value);
|
|
625
|
+
if (ms == null) return '';
|
|
626
|
+
const date = new Date(ms);
|
|
627
|
+
const offset = -date.getTimezoneOffset();
|
|
628
|
+
const sign = offset >= 0 ? '+' : '-';
|
|
629
|
+
const abs = Math.abs(offset);
|
|
630
|
+
return `${date.getFullYear()}-${padTime(date.getMonth() + 1)}-${padTime(date.getDate())}T${clockTime(date, true)}${sign}${padTime(Math.floor(abs / 60))}:${padTime(abs % 60)}`;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function clockTimeLabel(value, now = Date.now()) {
|
|
634
|
+
const ms = parsedTime(value);
|
|
635
|
+
if (ms == null) return '';
|
|
636
|
+
const date = new Date(ms);
|
|
637
|
+
const dayDiff = Math.round((calendarDayStart(now) - calendarDayStart(ms)) / 86400000);
|
|
638
|
+
if (dayDiff <= 0) return clockTime(date);
|
|
639
|
+
if (dayDiff === 1) return `yesterday ${clockTime(date)}`;
|
|
640
|
+
return humanizeTime(value, now);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function timeTag(value, now = Date.now(), mode = 'relative') {
|
|
644
|
+
const label = mode === 'clock' ? clockTimeLabel(value, now) : humanizeTime(value, now);
|
|
645
|
+
if (!label) return '';
|
|
646
|
+
return `<time datetime="${escapeHtml(datetimeAttr(value))}" title="${escapeHtml(exactTimeLabel(value))}">${escapeHtml(label)}</time>`;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function looksLikeIso(value) {
|
|
650
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(String(value || ''));
|
|
651
|
+
}
|
|
652
|
+
|
|
553
653
|
function legacyDurationMs(runtime) {
|
|
554
654
|
if (!runtime || typeof runtime !== 'object') return null;
|
|
555
655
|
if (runtime.durationMs != null && runtime.durationMs !== '') {
|
|
@@ -810,11 +910,69 @@ function beginPan(event) {
|
|
|
810
910
|
startX: event.clientX,
|
|
811
911
|
startY: event.clientY,
|
|
812
912
|
viewportX: viewport.x,
|
|
813
|
-
viewportY: viewport.y
|
|
913
|
+
viewportY: viewport.y,
|
|
914
|
+
panning: false
|
|
814
915
|
};
|
|
815
916
|
byId('canvas').setPointerCapture?.(event.pointerId);
|
|
816
917
|
}
|
|
817
918
|
|
|
919
|
+
function ensureMarquee() {
|
|
920
|
+
if (marquee) return marquee;
|
|
921
|
+
marquee = document.createElement('div');
|
|
922
|
+
marquee.id = 'selection-marquee';
|
|
923
|
+
byId('canvas')?.append(marquee);
|
|
924
|
+
return marquee;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
function beginMarquee(event) {
|
|
928
|
+
event.preventDefault?.();
|
|
929
|
+
ensureMarquee();
|
|
930
|
+
interaction = {
|
|
931
|
+
type: 'marquee',
|
|
932
|
+
pointerId: event.pointerId,
|
|
933
|
+
startX: event.clientX,
|
|
934
|
+
startY: event.clientY,
|
|
935
|
+
clientX: event.clientX,
|
|
936
|
+
clientY: event.clientY,
|
|
937
|
+
armed: false
|
|
938
|
+
};
|
|
939
|
+
byId('canvas').setPointerCapture?.(event.pointerId);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function paintMarquee() {
|
|
943
|
+
const box = ensureMarquee();
|
|
944
|
+
const rect = byId('canvas').getBoundingClientRect();
|
|
945
|
+
const left = Math.min(interaction.startX, interaction.clientX) - rect.left;
|
|
946
|
+
const top = Math.min(interaction.startY, interaction.clientY) - rect.top;
|
|
947
|
+
box.style.display = 'block';
|
|
948
|
+
box.style.left = `${left}px`;
|
|
949
|
+
box.style.top = `${top}px`;
|
|
950
|
+
box.style.width = `${Math.abs(interaction.clientX - interaction.startX)}px`;
|
|
951
|
+
box.style.height = `${Math.abs(interaction.clientY - interaction.startY)}px`;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function finishMarquee() {
|
|
955
|
+
const box = marquee;
|
|
956
|
+
if (box?.style) box.style.display = 'none';
|
|
957
|
+
if (!interaction?.armed || !draft) return;
|
|
958
|
+
const start = screenToWorld(interaction.startX, interaction.startY);
|
|
959
|
+
const end = screenToWorld(interaction.clientX, interaction.clientY);
|
|
960
|
+
const minX = Math.min(start.x, end.x);
|
|
961
|
+
const maxX = Math.max(start.x, end.x);
|
|
962
|
+
const minY = Math.min(start.y, end.y);
|
|
963
|
+
const maxY = Math.max(start.y, end.y);
|
|
964
|
+
const hits = draft.nodes.filter((node) => {
|
|
965
|
+
const pos = positions.get(node.id);
|
|
966
|
+
if (!pos) return false;
|
|
967
|
+
return pos.x < maxX && pos.x + NODE_WIDTH > minX && pos.y < maxY && pos.y + NODE_BLOCK_HEIGHT > minY;
|
|
968
|
+
}).map((node) => node.id);
|
|
969
|
+
selectedIds = new Set(hits);
|
|
970
|
+
selectedId = hits[0] || null;
|
|
971
|
+
selectedEdgeId = null;
|
|
972
|
+
updateSelection();
|
|
973
|
+
renderEdges();
|
|
974
|
+
}
|
|
975
|
+
|
|
818
976
|
function handlePointerMove(event) {
|
|
819
977
|
if (connection) {
|
|
820
978
|
const preview = scenePart('.preview-edge');
|
|
@@ -863,9 +1021,24 @@ function handlePointerMove(event) {
|
|
|
863
1021
|
}
|
|
864
1022
|
});
|
|
865
1023
|
renderEdges();
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
if (interaction.type === 'marquee') {
|
|
1027
|
+
interaction.clientX = event.clientX;
|
|
1028
|
+
interaction.clientY = event.clientY;
|
|
1029
|
+
const distance = Math.hypot(event.clientX - interaction.startX, event.clientY - interaction.startY);
|
|
1030
|
+
if (distance < PAN_THRESHOLD_PX) return;
|
|
1031
|
+
interaction.armed = true;
|
|
1032
|
+
paintMarquee();
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (interaction.type === 'pan') {
|
|
1036
|
+
const dx = event.clientX - interaction.startX;
|
|
1037
|
+
const dy = event.clientY - interaction.startY;
|
|
1038
|
+
if (!interaction.panning && Math.hypot(dx, dy) < PAN_THRESHOLD_PX) return;
|
|
1039
|
+
interaction.panning = true;
|
|
1040
|
+
viewport.x = interaction.viewportX + dx;
|
|
1041
|
+
viewport.y = interaction.viewportY + dy;
|
|
869
1042
|
applyViewport();
|
|
870
1043
|
}
|
|
871
1044
|
}
|
|
@@ -875,11 +1048,15 @@ function finishPointer(event) {
|
|
|
875
1048
|
if (!interaction || interaction.pointerId !== event.pointerId) return;
|
|
876
1049
|
if (interaction.type === 'node') interaction.element.classList.remove('dragging');
|
|
877
1050
|
const moved = interaction.type === 'node' && interaction.moved;
|
|
1051
|
+
const kind = interaction.type;
|
|
1052
|
+
const panned = kind === 'pan' && interaction.panning;
|
|
1053
|
+
if (kind === 'marquee') finishMarquee();
|
|
878
1054
|
interaction = null;
|
|
879
1055
|
if (moved) {
|
|
880
1056
|
suppressNodeClick = true;
|
|
881
1057
|
setTimeout(() => { suppressNodeClick = false; }, 0);
|
|
882
1058
|
}
|
|
1059
|
+
if (kind === 'marquee' || (kind === 'pan' && !panned)) return;
|
|
883
1060
|
saveLayoutSoon();
|
|
884
1061
|
}
|
|
885
1062
|
|
|
@@ -961,14 +1138,56 @@ function worldAtCanvasCenter() {
|
|
|
961
1138
|
return screenToWorld(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
962
1139
|
}
|
|
963
1140
|
|
|
964
|
-
function
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (
|
|
968
|
-
|
|
1141
|
+
function wheelPixels(delta, mode) {
|
|
1142
|
+
const unit = mode === 1 ? WHEEL_LINE_PX : mode === 2 ? WHEEL_PAGE_PX : 1;
|
|
1143
|
+
const pixels = Number(delta) * unit;
|
|
1144
|
+
if (!Number.isFinite(pixels)) return 0;
|
|
1145
|
+
return Math.max(-WHEEL_SPIKE_PX, Math.min(WHEEL_SPIKE_PX, pixels));
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
function canvasGestureIgnored(event) {
|
|
1149
|
+
return Boolean(closestReal(event?.target, '#node-panel, .zoom-controls, .minimap, .canvas-toolbar'));
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
function flushWheel() {
|
|
1153
|
+
const pending = wheelPending;
|
|
1154
|
+
wheelPending = null;
|
|
1155
|
+
if (!pending) return;
|
|
1156
|
+
if (pending.ctrlKey) {
|
|
1157
|
+
zoomAt(viewport.scale * Math.exp(-pending.deltaY * 0.01), pending.clientX, pending.clientY);
|
|
969
1158
|
return;
|
|
970
1159
|
}
|
|
971
|
-
|
|
1160
|
+
viewport.x -= pending.deltaX;
|
|
1161
|
+
viewport.y -= pending.deltaY;
|
|
1162
|
+
applyViewport();
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
function handleWheel(event) {
|
|
1166
|
+
if (canvasGestureIgnored(event)) return;
|
|
1167
|
+
event.preventDefault();
|
|
1168
|
+
const sample = {
|
|
1169
|
+
ctrlKey: Boolean(event.ctrlKey),
|
|
1170
|
+
deltaX: wheelPixels(event.deltaX, event.deltaMode),
|
|
1171
|
+
deltaY: wheelPixels(event.deltaY, event.deltaMode),
|
|
1172
|
+
clientX: event.clientX,
|
|
1173
|
+
clientY: event.clientY
|
|
1174
|
+
};
|
|
1175
|
+
if (wheelPending && wheelPending.ctrlKey !== sample.ctrlKey) flushWheel();
|
|
1176
|
+
if (!wheelPending) {
|
|
1177
|
+
wheelPending = { ctrlKey: sample.ctrlKey, deltaX: 0, deltaY: 0, clientX: sample.clientX, clientY: sample.clientY };
|
|
1178
|
+
}
|
|
1179
|
+
wheelPending.deltaX += sample.deltaX;
|
|
1180
|
+
wheelPending.deltaY += sample.deltaY;
|
|
1181
|
+
wheelPending.clientX = sample.clientX;
|
|
1182
|
+
wheelPending.clientY = sample.clientY;
|
|
1183
|
+
if (wheelFrame != null) return;
|
|
1184
|
+
const schedule = typeof requestAnimationFrame === 'function'
|
|
1185
|
+
? requestAnimationFrame
|
|
1186
|
+
: (callback) => setTimeout(callback, 16);
|
|
1187
|
+
wheelFrame = schedule(() => {
|
|
1188
|
+
wheelFrame = null;
|
|
1189
|
+
flushWheel();
|
|
1190
|
+
});
|
|
972
1191
|
}
|
|
973
1192
|
|
|
974
1193
|
function autoLayout({ record = true } = {}) {
|
|
@@ -1583,7 +1802,7 @@ async function loadRuns() {
|
|
|
1583
1802
|
const row = (run, isActive = false) => `
|
|
1584
1803
|
<button class="run-row${isActive ? ' active-run-row' : ''}" data-run-id="${escapeHtml(run.runId)}">
|
|
1585
1804
|
<strong>${escapeHtml(run.displayName)}</strong>
|
|
1586
|
-
<span>${escapeHtml(run.status)} · ${
|
|
1805
|
+
<span>${escapeHtml(run.status)} · ${timeTag(run.updatedAt) || '—'}</span>
|
|
1587
1806
|
<small>${escapeHtml(run.task)}</small>
|
|
1588
1807
|
</button>`;
|
|
1589
1808
|
list.innerHTML = [
|
|
@@ -1610,13 +1829,9 @@ async function loadRuns() {
|
|
|
1610
1829
|
}
|
|
1611
1830
|
}
|
|
1612
1831
|
|
|
1613
|
-
function heartbeatAge(iso) {
|
|
1832
|
+
function heartbeatAge(iso, now = Date.now()) {
|
|
1614
1833
|
if (!iso) return 'no heartbeat';
|
|
1615
|
-
|
|
1616
|
-
if (!Number.isFinite(age)) return 'no heartbeat';
|
|
1617
|
-
if (age < 2000) return 'just now';
|
|
1618
|
-
if (age < 60000) return `${Math.round(age / 1000)}s ago`;
|
|
1619
|
-
return `${Math.round(age / 60000)}m ago`;
|
|
1834
|
+
return humanizeTime(iso, now) || 'no heartbeat';
|
|
1620
1835
|
}
|
|
1621
1836
|
|
|
1622
1837
|
function currentStageId(live) {
|
|
@@ -1743,6 +1958,252 @@ function tokenLabel(live) {
|
|
|
1743
1958
|
return String(value);
|
|
1744
1959
|
}
|
|
1745
1960
|
|
|
1961
|
+
function tokenBudgetLabel(live) {
|
|
1962
|
+
const tokens = tokenLabel(live);
|
|
1963
|
+
const limit = Number(live?.budget?.perRunTokenLimit);
|
|
1964
|
+
if (Number.isFinite(limit) && limit > 0) return `${tokens} / ${limit}`;
|
|
1965
|
+
return tokens;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
function guardChipValue(summary) {
|
|
1969
|
+
if (!summary || typeof summary !== 'object') return 'unknown';
|
|
1970
|
+
if (summary.warn == null && summary.block == null) return 'unknown';
|
|
1971
|
+
return `${summary.warn || 0} warn · ${summary.block || 0} block`;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
function receiptChipValue(live) {
|
|
1975
|
+
const receipt = live?.artifacts?.['artifact.receipt'];
|
|
1976
|
+
const terminal = live?.run?.state === 'DELIVERED' || live?.run?.state === 'REPORTED';
|
|
1977
|
+
if (receipt?.verified === true && !(receipt.problems || []).length) {
|
|
1978
|
+
return { value: 'verified', title: 'receipt recorded' };
|
|
1979
|
+
}
|
|
1980
|
+
if (receipt && Array.isArray(receipt.problems) && receipt.problems.length) {
|
|
1981
|
+
return { value: 'problems', title: receipt.problems.join(', ') };
|
|
1982
|
+
}
|
|
1983
|
+
if (terminal && (!receipt || receipt.present === false)) {
|
|
1984
|
+
return { value: 'missing', title: 'no receipt: run predates receipts' };
|
|
1985
|
+
}
|
|
1986
|
+
return { value: 'pending', title: 'receipt pending' };
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
function labeledChip(label, value, title) {
|
|
1990
|
+
const titleAttr = title ? ` title="${escapeHtml(title)}"` : '';
|
|
1991
|
+
return `<span class="chip"${titleAttr}><span>${escapeHtml(label)}</span><strong>${escapeHtml(String(value))}</strong></span>`;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
function liveMetaHtml(live) {
|
|
1995
|
+
const run = live?.run || {};
|
|
1996
|
+
const artifacts = live?.artifacts || {};
|
|
1997
|
+
const tokens = tokenLabel(live);
|
|
1998
|
+
const receipt = receiptChipValue(live);
|
|
1999
|
+
const chips = [
|
|
2000
|
+
labeledChip('Mode', run.mode || '—'),
|
|
2001
|
+
labeledChip('Tier', run.tier?.current || run.mode || '—'),
|
|
2002
|
+
labeledChip('Iteration', run.iteration ?? '—'),
|
|
2003
|
+
labeledChip('Tokens', tokenBudgetLabel(live), tokens === 'unknown' ? 'host reports no usage' : ''),
|
|
2004
|
+
labeledChip('Guard', guardChipValue(artifacts['artifact.guard'])),
|
|
2005
|
+
labeledChip('Drift', driftLabel(artifacts['artifact.drift']) || 'unknown'),
|
|
2006
|
+
labeledChip('Receipt', receipt.value, receipt.title)
|
|
2007
|
+
].join('');
|
|
2008
|
+
return `<section class="compliance-card"><h2 class="live-card-title">Compliance & budget</h2><div class="chip-row">${chips}</div>${budgetRow(live)}</section><section class="events-card"><h2 class="live-card-title">Latest events</h2>${latestEventsHtml(live)}</section>`;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
function budgetRow(live) {
|
|
2012
|
+
const tokens = tokenLabel(live);
|
|
2013
|
+
const note = tokens === 'unknown' ? 'host reports no usage' : tokenBudgetLabel(live);
|
|
2014
|
+
return `<div class="budget-row"><span>Budget</span><span class="meter" aria-hidden="true"><i></i></span><span>${escapeHtml(note)}</span></div>`;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
function paintBudget(live) {
|
|
2018
|
+
const bar = byId('live-meta')?.querySelector?.('.meter i');
|
|
2019
|
+
if (!bar?.style) return;
|
|
2020
|
+
const spent = Number(live?.budget?.totalTokens ?? live?.budget?.spentThisRun);
|
|
2021
|
+
const limit = Number(live?.budget?.perRunTokenLimit);
|
|
2022
|
+
const ratio = Number.isFinite(spent) && spent > 0 && Number.isFinite(limit) && limit > 0
|
|
2023
|
+
? Math.max(0, Math.min(1, spent / limit))
|
|
2024
|
+
: 0;
|
|
2025
|
+
bar.style.width = `${Math.round(ratio * 100)}%`;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
function liveEventLabel(event) {
|
|
2029
|
+
if (event?.message) return event.message;
|
|
2030
|
+
const gate = event?.gate;
|
|
2031
|
+
if (event?.type === 'GATE_PASSED') {
|
|
2032
|
+
if (gate === 'goal') return 'Goal frozen';
|
|
2033
|
+
if (gate === 'maker') return 'Maker gate passed';
|
|
2034
|
+
if (gate === 'verification') return 'Verification gate passed';
|
|
2035
|
+
if (gate === 'review') return 'Review gate passed';
|
|
2036
|
+
if (gate === 'judge') return 'Judge gate passed';
|
|
2037
|
+
if (gate === 'delivery') return 'Delivery gate passed';
|
|
2038
|
+
return 'Gate passed';
|
|
2039
|
+
}
|
|
2040
|
+
if (event?.type === 'NODE_APPROVED') return `Approved by ${event.approvedBy || 'human'}`;
|
|
2041
|
+
return String(event?.type || 'event').replaceAll('_', ' ').toLowerCase();
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
function eventActor(event, live) {
|
|
2045
|
+
const plan = live?.plan?.nodes || [];
|
|
2046
|
+
const node = plan.find((item) => item.id === event?.nodeId)
|
|
2047
|
+
|| plan.find((item) => item.legacyGate === event?.gate || item.id === event?.gate);
|
|
2048
|
+
return node?.id || event?.gate || event?.phase || 'run';
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
function recentEvents(live) {
|
|
2052
|
+
const workflow = Array.isArray(live?.events) ? live.events : [];
|
|
2053
|
+
const source = workflow.length ? workflow : lifecycleEvents;
|
|
2054
|
+
return source.slice(-4).reverse();
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
function latestEventsHtml(live) {
|
|
2058
|
+
const events = recentEvents(live);
|
|
2059
|
+
if (!events.length) return '<p class="muted">No events yet.</p>';
|
|
2060
|
+
return events.map((event) => `
|
|
2061
|
+
<p class="event-row">${timeTag(event.at, Date.now(), 'clock') || '—'} <span class="who">${escapeHtml(eventActor(event, live))}</span> <span>${escapeHtml(liveEventLabel(event))}</span></p>
|
|
2062
|
+
`).join('');
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
function stageNodes(stage, live) {
|
|
2066
|
+
return (live?.plan?.nodes || []).filter((node) => stage.types.includes(node.type));
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
function stageState(stage, live) {
|
|
2070
|
+
const statuses = stageNodes(stage, live).map((node) => String(live?.nodes?.[node.id]?.status || '').toUpperCase());
|
|
2071
|
+
if (statuses.includes('RUNNING')) return 'active';
|
|
2072
|
+
if (statuses.includes('FAILED') || statuses.includes('BLOCKED')) return 'failed';
|
|
2073
|
+
if (statuses.length && statuses.every((status) => status === 'PASSED' || status === 'SKIPPED')) return 'passed';
|
|
2074
|
+
return 'pending';
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
function stageDurationLabel(stage, live) {
|
|
2078
|
+
const recipe = draft || live?.plan;
|
|
2079
|
+
let total = 0;
|
|
2080
|
+
for (const node of stageNodes(stage, live)) {
|
|
2081
|
+
const ms = nodeDurationMs(node.id, live, recipe);
|
|
2082
|
+
if (ms > 0) total += ms;
|
|
2083
|
+
}
|
|
2084
|
+
return formatDuration(total) || '—';
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
function progressRailHtml(live) {
|
|
2088
|
+
return STAGES.map((stage) => {
|
|
2089
|
+
const state = live ? stageState(stage, live) : 'pending';
|
|
2090
|
+
const duration = live ? stageDurationLabel(stage, live) : '—';
|
|
2091
|
+
return `<li class="${state}"><strong>${escapeHtml(stage.label)}</strong><span>${escapeHtml(duration)}</span></li>`;
|
|
2092
|
+
}).join('');
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
function focusNodeRecord(live) {
|
|
2096
|
+
const plan = live?.plan?.nodes || [];
|
|
2097
|
+
const nodes = live?.nodes || {};
|
|
2098
|
+
const statusOf = (node) => String(nodes[node.id]?.status || '').toUpperCase();
|
|
2099
|
+
return plan.find((node) => statusOf(node) === 'RUNNING')
|
|
2100
|
+
|| plan.find((node) => {
|
|
2101
|
+
const stage = STAGES.find((item) => item.id === currentStageId(live));
|
|
2102
|
+
return stage?.types.includes(node.type) && !['PASSED', 'SKIPPED', ''].includes(statusOf(node));
|
|
2103
|
+
})
|
|
2104
|
+
|| [...plan].reverse().find((node) => statusOf(node) === 'PASSED')
|
|
2105
|
+
|| null;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
function iterationText(node, live) {
|
|
2109
|
+
const group = (draft?.loopGroups || []).find((item) => (item.nodeIds || []).includes(node?.id));
|
|
2110
|
+
if (!group) return '';
|
|
2111
|
+
const iteration = live?.loopGroups?.[group.id]?.iteration ?? live?.run?.iteration ?? '—';
|
|
2112
|
+
return `iteration ${iteration} / ${group.maxIterations ?? '—'}`;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
function stepEvidenceHtml(live) {
|
|
2116
|
+
const artifacts = live?.artifacts || {};
|
|
2117
|
+
const chips = [];
|
|
2118
|
+
const findings = findingsLabel(artifacts['artifact.findings']);
|
|
2119
|
+
if (findings) chips.push(labeledChip('Findings', findings));
|
|
2120
|
+
const tests = verificationLabel(artifacts['artifact.verification']);
|
|
2121
|
+
if (tests) chips.push(labeledChip('Tests', tests));
|
|
2122
|
+
const drift = driftLabel(artifacts['artifact.drift']);
|
|
2123
|
+
if (drift) chips.push(labeledChip('Scope', drift === 'none' ? 'in map' : drift));
|
|
2124
|
+
return chips.join('');
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
function currentStepHtml(live) {
|
|
2128
|
+
const node = focusNodeRecord(live);
|
|
2129
|
+
if (!node) return '<p class="muted">No step is running.</p>';
|
|
2130
|
+
const plan = live.plan?.nodes || [];
|
|
2131
|
+
const index = Math.max(0, plan.indexOf(node));
|
|
2132
|
+
const runtime = live.nodes?.[node.id] || {};
|
|
2133
|
+
const running = String(runtime.status || '').toUpperCase() === 'RUNNING';
|
|
2134
|
+
const duration = formatDuration(nodeDurationMs(node.id, live, draft || live.plan));
|
|
2135
|
+
const timing = running
|
|
2136
|
+
? (duration ? `running ${duration}` : 'running')
|
|
2137
|
+
: (duration || statusWord(runtime.status));
|
|
2138
|
+
const loop = iterationText(node, live);
|
|
2139
|
+
const activity = runtime.activity || runtime.reason || runtime.summary || 'Waiting for the next persisted event.';
|
|
2140
|
+
const next = plan.slice(index + 1, index + 4).map((item) => displayName(item));
|
|
2141
|
+
return `
|
|
2142
|
+
<h2 class="live-card-title">Current step</h2>
|
|
2143
|
+
<div class="current-head">
|
|
2144
|
+
<span class="node-icon">${nodeIcon(node.type)}</span>
|
|
2145
|
+
<div>
|
|
2146
|
+
<h2>${escapeHtml(displayName(node))} · ${escapeHtml(node.type)}</h2>
|
|
2147
|
+
<p>${escapeHtml([panelSubtitle(node, index).split(' · ').slice(0, 1).join(''), loop, timing].filter(Boolean).join(' · '))}</p>
|
|
2148
|
+
</div>
|
|
2149
|
+
</div>
|
|
2150
|
+
<p class="current-activity"><span class="chip-label">Latest activity</span> ${escapeHtml(activity)}</p>
|
|
2151
|
+
<div class="chip-row">${stepEvidenceHtml(live)}</div>
|
|
2152
|
+
<div class="current-actions">
|
|
2153
|
+
<button type="button" data-open-node="${escapeHtml(node.id)}">Open node details</button>
|
|
2154
|
+
<button type="button" class="primary" data-start-agent>Start with AI Agent</button>
|
|
2155
|
+
</div>
|
|
2156
|
+
${next.length ? `<p class="current-next">Next: ${escapeHtml(next.join(' → '))}</p>` : ''}
|
|
2157
|
+
`;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
function questionBannerHtml(questions) {
|
|
2161
|
+
return (questions || []).map((question) => `
|
|
2162
|
+
<form class="answer-form" data-question-id="${escapeHtml(question.questionId || '')}">
|
|
2163
|
+
<p><span class="chip-label">Question</span> ${escapeHtml(question.message || '')}</p>
|
|
2164
|
+
<textarea name="answer" maxlength="4000" aria-label="Answer" placeholder="Write the answer"></textarea>
|
|
2165
|
+
<button type="submit" class="primary">Answer in Studio</button>
|
|
2166
|
+
</form>
|
|
2167
|
+
`).join('');
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
function journeyStepsHtml(live) {
|
|
2171
|
+
const journeyStatuses = new Set(['pending', 'active', 'complete']);
|
|
2172
|
+
return (live?.journey?.steps || []).map((step) => {
|
|
2173
|
+
const status = String(step?.status || '').toLowerCase();
|
|
2174
|
+
const safeStatus = journeyStatuses.has(status) ? status : 'unknown';
|
|
2175
|
+
const label = String(step?.id || '').replaceAll('_', ' ');
|
|
2176
|
+
const suffix = safeStatus === 'unknown' ? ' (status unavailable)' : '';
|
|
2177
|
+
const blocked = step?.blocked
|
|
2178
|
+
? (live.journey?.pendingQuestions == null
|
|
2179
|
+
? ' · unanswered count unavailable'
|
|
2180
|
+
: ` · ${Number(live.journey.pendingQuestions)} unanswered`)
|
|
2181
|
+
: '';
|
|
2182
|
+
return `<li class="${safeStatus}">${escapeHtml(label + suffix + blocked)}</li>`;
|
|
2183
|
+
}).join('');
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
function groupedTimelineHtml(live) {
|
|
2187
|
+
const workflow = Array.isArray(live?.events) ? live.events : [];
|
|
2188
|
+
const source = workflow.length ? workflow : lifecycleEvents;
|
|
2189
|
+
const groups = [];
|
|
2190
|
+
const seen = new Map();
|
|
2191
|
+
for (const event of source) {
|
|
2192
|
+
const key = eventActor(event, live);
|
|
2193
|
+
if (!seen.has(key)) {
|
|
2194
|
+
seen.set(key, groups.length);
|
|
2195
|
+
groups.push({ key, events: [] });
|
|
2196
|
+
}
|
|
2197
|
+
groups[seen.get(key)].events.push(event);
|
|
2198
|
+
}
|
|
2199
|
+
if (!groups.length) return '';
|
|
2200
|
+
return `<li class="timeline-groups"><div class="timeline-columns">${groups.map((group) => `
|
|
2201
|
+
<section class="step-group">
|
|
2202
|
+
<h3>${escapeHtml(group.key)}</h3>
|
|
2203
|
+
<ul>${group.events.map((event) => `<li>${timeTag(event.at, Date.now(), 'clock') || '—'} ${escapeHtml(liveEventLabel(event))}</li>`).join('')}</ul>
|
|
2204
|
+
</section>`).join('')}</div></li>`;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
1746
2207
|
function renderRunSummary() {
|
|
1747
2208
|
const card = byId('run-summary-card');
|
|
1748
2209
|
if (!card) return;
|
|
@@ -1781,14 +2242,14 @@ function renderLive() {
|
|
|
1781
2242
|
const summary = byId('run-summary');
|
|
1782
2243
|
const rail = byId('stage-rail');
|
|
1783
2244
|
const journey = byId('run-journey');
|
|
1784
|
-
const meta = byId('live-
|
|
1785
|
-
const
|
|
2245
|
+
const meta = byId('live-meta');
|
|
2246
|
+
const current = byId('live-current');
|
|
2247
|
+
const banner = byId('question-banner');
|
|
1786
2248
|
if (!live) {
|
|
1787
2249
|
if (summary) summary.textContent = 'No active run';
|
|
1788
|
-
if (rail)
|
|
1789
|
-
rail.innerHTML = STAGES.map((stage) => `<li class="pending">${escapeHtml(stage.label)}</li>`).join('');
|
|
1790
|
-
}
|
|
2250
|
+
if (rail) rail.innerHTML = progressRailHtml(null);
|
|
1791
2251
|
if (meta) meta.innerHTML = '';
|
|
2252
|
+
if (current) current.innerHTML = '';
|
|
1792
2253
|
if (banner) {
|
|
1793
2254
|
banner.hidden = true;
|
|
1794
2255
|
banner.innerHTML = '';
|
|
@@ -1796,63 +2257,66 @@ function renderLive() {
|
|
|
1796
2257
|
if (journey) journey.innerHTML = '';
|
|
1797
2258
|
return;
|
|
1798
2259
|
}
|
|
1799
|
-
const stageId = currentStageId(live);
|
|
1800
2260
|
const run = live.run || {};
|
|
1801
2261
|
const presence = live.presence || agentPresence;
|
|
1802
2262
|
if (summary) {
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
}).join('');
|
|
1810
|
-
}
|
|
1811
|
-
const artifacts = live.artifacts || liveArtifacts;
|
|
1812
|
-
const guard = artifacts['artifact.guard'] || {};
|
|
1813
|
-
const drift = artifacts['artifact.drift'] || {};
|
|
1814
|
-
const receipt = artifacts['artifact.receipt'] || {};
|
|
2263
|
+
const started = run.createdAt ? `started ${timeTag(run.createdAt)}` : '';
|
|
2264
|
+
const beatAge = heartbeatAge(presence.lastHeartbeatAt);
|
|
2265
|
+
const beat = presence?.lastHeartbeatAt ? `heartbeat ${timeTag(presence.lastHeartbeatAt)}` : escapeHtml(beatAge);
|
|
2266
|
+
summary.innerHTML = `${escapeHtml(run.displayName || run.runId || 'run')} · ${escapeHtml(run.state || '')}${started ? ` · ${started}` : ''} · ${beat}`;
|
|
2267
|
+
}
|
|
2268
|
+
if (rail) rail.innerHTML = progressRailHtml(live);
|
|
1815
2269
|
if (meta) {
|
|
1816
|
-
meta.innerHTML =
|
|
1817
|
-
|
|
1818
|
-
<span>iter ${escapeHtml(String(run.iteration ?? '—'))}</span>
|
|
1819
|
-
<span>${escapeHtml(String(live.budget?.spentThisRun ?? 0))} / ${escapeHtml(String(live.budget?.perRunTokenLimit ?? 0))} tokens</span>
|
|
1820
|
-
<span class="chip">${escapeHtml(String(guard.warn || 0))} warn · ${escapeHtml(String(guard.block || 0))} block</span>
|
|
1821
|
-
<span class="chip">drift ${escapeHtml(String(drift.outOfMapCount || 0))}</span>
|
|
1822
|
-
<span class="chip">${receipt.verified ? 'receipt ok' : 'receipt pending'}</span>
|
|
1823
|
-
`;
|
|
2270
|
+
meta.innerHTML = liveMetaHtml(live);
|
|
2271
|
+
paintBudget(live);
|
|
1824
2272
|
}
|
|
2273
|
+
if (current) current.innerHTML = currentStepHtml(live);
|
|
1825
2274
|
const pending = live.interactions?.pending || [];
|
|
1826
2275
|
if (banner) {
|
|
1827
2276
|
banner.hidden = pending.length === 0;
|
|
1828
|
-
banner.innerHTML = pending
|
|
1829
|
-
`<p><strong>Q${escapeHtml(String(question.number))}</strong> ${escapeHtml(question.message)}</p>`
|
|
1830
|
-
).join('');
|
|
2277
|
+
banner.innerHTML = questionBannerHtml(pending);
|
|
1831
2278
|
}
|
|
1832
|
-
const journeyStatuses = new Set(['pending', 'active', 'complete']);
|
|
1833
2279
|
const degradedSources = live.journey?.degradedSources || [];
|
|
1834
|
-
const timeline = (live.journey?.steps || []).map((step) => {
|
|
1835
|
-
const status = String(step?.status || '').toLowerCase();
|
|
1836
|
-
const safeStatus = journeyStatuses.has(status) ? status : 'unknown';
|
|
1837
|
-
const label = String(step?.id || '').replaceAll('_', ' ');
|
|
1838
|
-
const suffix = safeStatus === 'unknown' ? ' (status unavailable)' : '';
|
|
1839
|
-
const blocked = step?.blocked
|
|
1840
|
-
? (live.journey?.pendingQuestions == null
|
|
1841
|
-
? ' · unanswered count unavailable'
|
|
1842
|
-
: ` · ${Number(live.journey.pendingQuestions)} unanswered`)
|
|
1843
|
-
: '';
|
|
1844
|
-
return `<li class="${safeStatus}">${escapeHtml(label + suffix + blocked)}</li>`;
|
|
1845
|
-
}).join('');
|
|
1846
|
-
const eventsHtml = (lifecycleEvents.slice(-8).reverse().map((event) =>
|
|
1847
|
-
`<li class="event">${escapeHtml(String(event.at || '').slice(11, 19))} · ${escapeHtml(event.type)} · ${escapeHtml(event.message || '')}</li>`
|
|
1848
|
-
).join(''));
|
|
1849
2280
|
if (journey) {
|
|
1850
|
-
journey.innerHTML =
|
|
2281
|
+
journey.innerHTML = journeyStepsHtml(live) + groupedTimelineHtml(live) + (degradedSources.length
|
|
1851
2282
|
? `<li class="unknown">${escapeHtml(`${degradedSources.join(' and ')} unavailable — journey may be incomplete`)}</li>`
|
|
1852
2283
|
: '');
|
|
1853
2284
|
}
|
|
1854
2285
|
}
|
|
1855
2286
|
|
|
2287
|
+
async function submitAnswer(questionId, message) {
|
|
2288
|
+
const runId = followedRunId();
|
|
2289
|
+
const text = String(message || '').trim();
|
|
2290
|
+
if (!runId || !questionId || !text) {
|
|
2291
|
+
notify('Write an answer first.');
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
2294
|
+
await api(`/api/runs/${encodeURIComponent(runId)}/questions/${encodeURIComponent(questionId)}/answer`, {
|
|
2295
|
+
method: 'POST',
|
|
2296
|
+
body: JSON.stringify({ message: text, actor: 'human' })
|
|
2297
|
+
});
|
|
2298
|
+
notify('Answer recorded.');
|
|
2299
|
+
await loadLive(runId);
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
function onLiveClick(event) {
|
|
2303
|
+
const open = closestReal(event.target, '[data-open-node]');
|
|
2304
|
+
if (open?.dataset?.openNode) {
|
|
2305
|
+
showWorkspace('wiring');
|
|
2306
|
+
openNodePanel(open.dataset.openNode);
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
if (closestReal(event.target, '[data-start-agent]')) copyAgentHandoff(followedRunId() || undefined);
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
function onLiveSubmit(event) {
|
|
2313
|
+
const form = event.target;
|
|
2314
|
+
if (!form?.dataset?.questionId) return;
|
|
2315
|
+
event.preventDefault?.();
|
|
2316
|
+
const field = form.querySelector?.('[name="answer"]');
|
|
2317
|
+
submitAnswer(form.dataset.questionId, field?.value || '');
|
|
2318
|
+
}
|
|
2319
|
+
|
|
1856
2320
|
function maybeOpenOnboarding() {
|
|
1857
2321
|
const dialog = byId('goal-dialog');
|
|
1858
2322
|
if (!eventsReady || catalog.live || dialog.open || onboardingDismissed) return;
|
|
@@ -2255,19 +2719,85 @@ function onNodeClick(event) {
|
|
|
2255
2719
|
}
|
|
2256
2720
|
|
|
2257
2721
|
function headerDuration(node, io) {
|
|
2722
|
+
if (io?.durationMs != null && io.durationMs !== '') {
|
|
2723
|
+
const formatted = formatDuration(Number(io.durationMs));
|
|
2724
|
+
if (formatted) return formatted;
|
|
2725
|
+
}
|
|
2258
2726
|
const derived = formatDuration(nodeDurationMs(node?.id, catalog.live, draft));
|
|
2259
2727
|
if (derived) return derived;
|
|
2260
|
-
// Pending/ready nodes have no meaningful duration; never show "0s" for them.
|
|
2261
2728
|
const state = graphStateClass(runtimeFor(node)?.status);
|
|
2262
2729
|
if (state !== 'passed' && state !== 'failed' && state !== 'active') return '';
|
|
2263
|
-
const explicit = Number(io?.durationMs);
|
|
2264
|
-
if (Number.isFinite(explicit) && explicit >= 0) return formatDuration(explicit);
|
|
2265
2730
|
return formatDuration(legacyDurationMs(runtimeFor(node)));
|
|
2266
2731
|
}
|
|
2267
2732
|
|
|
2268
|
-
function tabButton(id, label) {
|
|
2733
|
+
function tabButton(id, label, badge = 0) {
|
|
2269
2734
|
const selected = panelTab === id;
|
|
2270
|
-
|
|
2735
|
+
const count = Number(badge) > 0 ? `<span class="tab-count">${escapeHtml(String(badge))}</span>` : '';
|
|
2736
|
+
return `<button type="button" role="tab" id="node-tab-${id}" class="io-tab" data-tab="${id}" aria-selected="${selected ? 'true' : 'false'}" aria-controls="node-pane-${id}" tabindex="${selected ? '0' : '-1'}">${label}${count}</button>`;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
function evidenceCount(view) {
|
|
2740
|
+
const recorded = Number(view?.io?.nodeEvidence?.count);
|
|
2741
|
+
if (Number.isFinite(recorded) && recorded > 0) return recorded;
|
|
2742
|
+
const cards = view?.io?.nodeEvidence?.cards;
|
|
2743
|
+
return Array.isArray(cards) ? cards.length : 0;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
function nodeLoopGroup(node) {
|
|
2747
|
+
if (!node) return null;
|
|
2748
|
+
return (draft?.loopGroups || []).find((group) =>
|
|
2749
|
+
(group?.nodeIds || []).includes(node.id)
|
|
2750
|
+
|| group?.entryNodeId === node.id
|
|
2751
|
+
|| group?.decisionNodeId === node.id
|
|
2752
|
+
) || null;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
function loopChipValue(node, io) {
|
|
2756
|
+
const group = nodeLoopGroup(node);
|
|
2757
|
+
const groupId = io?.output?.loopGroupId || group?.id;
|
|
2758
|
+
if (!groupId) return '';
|
|
2759
|
+
const iteration = io?.output?.loopIteration ?? io?.loopIteration;
|
|
2760
|
+
const max = group?.maxIterations;
|
|
2761
|
+
if (iteration == null && max == null) return groupId;
|
|
2762
|
+
const step = iteration == null ? '—' : String(iteration);
|
|
2763
|
+
return max ? `${groupId} · ${step}/${max}` : `${groupId} · ${step}`;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
function attemptCount(io) {
|
|
2767
|
+
const groups = io?.timelineGroups;
|
|
2768
|
+
if (!Array.isArray(groups) || !groups.length) return null;
|
|
2769
|
+
return Math.max(...groups.map((group) => Number(group.attempt) || 1));
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
function nodeChip(label, valueHtml) {
|
|
2773
|
+
return `<span class="node-chip"><span class="chip-label">${escapeHtml(label)}</span><strong>${valueHtml}</strong></span>`;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
function panelSubtitle(node, index) {
|
|
2777
|
+
const stage = stageLabel(node, index).toLowerCase().replace(/(^|\s)\w/g, (letter) => letter.toUpperCase());
|
|
2778
|
+
const recipe = draft?.id ? `${draft.id}${draft.version != null ? ` v${draft.version}` : ''}` : '';
|
|
2779
|
+
return [stage, node.type, recipe].filter(Boolean).join(' · ');
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
function nodeChipRow(node, io, runtime) {
|
|
2783
|
+
const status = runtime?.status || io?.output?.status;
|
|
2784
|
+
const state = graphStateClass(status);
|
|
2785
|
+
const chips = [nodeChip('Status', `<span class="status-text status-${state}">${escapeHtml(statusWord(status))}</span>`)];
|
|
2786
|
+
const duration = headerDuration(node, io);
|
|
2787
|
+
if (duration) chips.push(nodeChip('Duration', escapeHtml(duration)));
|
|
2788
|
+
if (io?.finishedAt) {
|
|
2789
|
+
const finished = timeTag(io.finishedAt);
|
|
2790
|
+
if (finished) chips.push(nodeChip('Finished', finished));
|
|
2791
|
+
}
|
|
2792
|
+
const loop = loopChipValue(node, io);
|
|
2793
|
+
if (loop) chips.push(nodeChip('Loop', escapeHtml(loop)));
|
|
2794
|
+
const attempts = attemptCount(io);
|
|
2795
|
+
if (attempts) chips.push(nodeChip('Attempts', escapeHtml(String(attempts))));
|
|
2796
|
+
const reason = io?.output?.reason || runtime?.reason;
|
|
2797
|
+
if (reason && (state === 'failed' || String(status || '').toLowerCase() === 'blocked')) {
|
|
2798
|
+
chips.push(nodeChip('Reason', escapeHtml(reason)));
|
|
2799
|
+
}
|
|
2800
|
+
return `<div class="node-chip-row">${chips.join('')}</div>`;
|
|
2271
2801
|
}
|
|
2272
2802
|
|
|
2273
2803
|
function jsonBlock(value) {
|
|
@@ -2276,17 +2806,55 @@ function jsonBlock(value) {
|
|
|
2276
2806
|
return `<pre>${escapeHtml(text)}</pre>`;
|
|
2277
2807
|
}
|
|
2278
2808
|
|
|
2279
|
-
function
|
|
2280
|
-
if (!artifact) return '
|
|
2281
|
-
if (artifact.unavailable) {
|
|
2282
|
-
return `<p class="muted">Artifact unavailable (${escapeHtml(artifact.code || 'unknown')}).</p>`;
|
|
2283
|
-
}
|
|
2809
|
+
function artifactPreview(artifact) {
|
|
2810
|
+
if (!artifact || artifact.unavailable) return '';
|
|
2284
2811
|
const preview = artifact.preview || artifact;
|
|
2812
|
+
if (!preview.content) return '';
|
|
2285
2813
|
const path = preview.path || artifact.descriptor?.path || '';
|
|
2286
|
-
return
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2814
|
+
return `${path ? `<p class="artifact-path">${escapeHtml(path)}</p>` : ''}<pre>${escapeHtml(preview.content)}</pre>`;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
function fileChipRow(files) {
|
|
2818
|
+
const list = (files || []).filter((file) => file && (file.name || file.path));
|
|
2819
|
+
if (!list.length) return '';
|
|
2820
|
+
return `<div class="artifact-chips">${list.map((file) => {
|
|
2821
|
+
const name = escapeHtml(file.name || file.path);
|
|
2822
|
+
if (!file.path || file.state === 'rejected') return `<span class="artifact-chip">${name}</span>`;
|
|
2823
|
+
return `<button type="button" class="artifact-chip" data-artifact-path="${escapeHtml(file.path)}">${name}</button>`;
|
|
2824
|
+
}).join('')}</div>`;
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
function previewBlock(preview) {
|
|
2828
|
+
if (!preview) return '';
|
|
2829
|
+
if (preview.error) {
|
|
2830
|
+
return `<p class="validation-message">${escapeHtml(preview.path || 'Artifact')}: ${escapeHtml(preview.error)}</p>`;
|
|
2831
|
+
}
|
|
2832
|
+
const content = preview.content || '';
|
|
2833
|
+
if (!content && !preview.path) return '';
|
|
2834
|
+
return `<article class="evidence-card"><p class="artifact-path">${escapeHtml(preview.path || '')}</p>${content ? `<pre>${escapeHtml(content)}</pre>` : '<p class="muted">No preview.</p>'}</article>`;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
function renderEvidenceCard(card) {
|
|
2838
|
+
const lines = (card.lines || []).map((line) => {
|
|
2839
|
+
const raw = line.value == null ? '' : String(line.value);
|
|
2840
|
+
const value = looksLikeIso(raw) ? (timeTag(raw) || escapeHtml(raw)) : escapeHtml(raw);
|
|
2841
|
+
const duration = formatDuration(Number(line.durationMs));
|
|
2842
|
+
const extra = [line.detail, duration].filter(Boolean).join(' · ');
|
|
2843
|
+
return `<li class="evidence-line"><span class="evidence-label">${escapeHtml(line.label || '')}</span><span class="evidence-value">${value}</span>${extra ? `<span class="evidence-detail">${escapeHtml(extra)}</span>` : ''}</li>`;
|
|
2844
|
+
}).join('');
|
|
2845
|
+
return `<article class="evidence-card"><h3>${escapeHtml(card.title || 'Evidence')}</h3>${lines ? `<ul class="evidence-lines">${lines}</ul>` : ''}${card.note ? `<p class="evidence-note">${escapeHtml(card.note)}</p>` : ''}</article>`;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
function evidenceBody(evidence) {
|
|
2849
|
+
const changed = evidence?.status === 'changed' || evidence?.status === 'rejected';
|
|
2850
|
+
const cards = evidence?.cards || [];
|
|
2851
|
+
if (!evidence || (!changed && !cards.length)) {
|
|
2852
|
+
return `<p class="muted">${escapeHtml(evidence?.summary || 'No evidence recorded for this node yet.')}</p>${fileChipRow(evidence?.files)}`;
|
|
2853
|
+
}
|
|
2854
|
+
const banner = changed
|
|
2855
|
+
? `<p class="validation-message">${escapeHtml(evidence.message || 'artifact changed')}</p>`
|
|
2856
|
+
: '';
|
|
2857
|
+
return banner + cards.map(renderEvidenceCard).join('') + fileChipRow(evidence.files);
|
|
2290
2858
|
}
|
|
2291
2859
|
|
|
2292
2860
|
function inputPane(io) {
|
|
@@ -2303,52 +2871,49 @@ function inputPane(io) {
|
|
|
2303
2871
|
`;
|
|
2304
2872
|
}
|
|
2305
2873
|
|
|
2306
|
-
function outputPane(
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
<p>${escapeHtml(output.status || 'Unknown')}</p>
|
|
2311
|
-
${output.reason ? `<h3>Reason</h3><p>${escapeHtml(output.reason)}</p>` : ''}
|
|
2312
|
-
${output.loopGroupId ? `<p class="muted">Loop ${escapeHtml(output.loopGroupId)} · iteration ${escapeHtml(String(output.loopIteration ?? '—'))}</p>` : ''}
|
|
2313
|
-
<h3>Artifact</h3>
|
|
2314
|
-
${artifactBlock(output.artifact)}
|
|
2315
|
-
`;
|
|
2874
|
+
function outputPane(view) {
|
|
2875
|
+
const io = view?.io || {};
|
|
2876
|
+
const summary = io.nodeEvidence?.summary || io.output?.summary || 'No evidence recorded for this node yet.';
|
|
2877
|
+
return `<p class="node-summary">${escapeHtml(summary)}</p>${fileChipRow(io.nodeEvidence?.files)}${artifactPreview(io.output?.artifact)}${previewBlock(view?.preview)}`;
|
|
2316
2878
|
}
|
|
2317
2879
|
|
|
2318
2880
|
function evidencePane(view) {
|
|
2881
|
+
if (view.io?.nodeEvidence) return evidenceBody(view.io.nodeEvidence) + previewBlock(view.preview);
|
|
2319
2882
|
const fetched = view.artifacts || [];
|
|
2320
2883
|
if (fetched.length) {
|
|
2321
2884
|
return fetched.map((artifact) => artifact.error
|
|
2322
2885
|
? `<p class="validation-message">${escapeHtml(artifact.path || 'Artifact')}: ${escapeHtml(artifact.error)}</p>`
|
|
2323
2886
|
: `<article class="evidence-card"><p class="artifact-path">${escapeHtml(artifact.path || '')}</p><pre>${escapeHtml(artifact.content || '')}</pre></article>`
|
|
2324
|
-
).join('');
|
|
2887
|
+
).join('') + previewBlock(view.preview);
|
|
2325
2888
|
}
|
|
2326
|
-
|
|
2327
|
-
return '<p class="muted">No evidence recorded for this node.</p>';
|
|
2889
|
+
return `<p class="muted">No evidence recorded for this node yet.</p>${previewBlock(view.preview)}`;
|
|
2328
2890
|
}
|
|
2329
2891
|
|
|
2330
|
-
function
|
|
2331
|
-
|
|
2332
|
-
return
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2892
|
+
function renderTimelineGroups(groups) {
|
|
2893
|
+
if (!groups.length) return '<p class="muted">No lifecycle events for this node yet.</p>';
|
|
2894
|
+
return groups.map((group) => `
|
|
2895
|
+
<section class="timeline-group">
|
|
2896
|
+
<h3>${escapeHtml(group.label || 'Step')}</h3>
|
|
2897
|
+
<ul class="panel-timeline">${(group.events || []).map((event) => `
|
|
2898
|
+
<li>
|
|
2899
|
+
${timeTag(event.at) || '<span class="muted">—</span>'}
|
|
2900
|
+
<strong>${escapeHtml(event.label || event.type || 'event')}</strong>
|
|
2901
|
+
</li>`).join('')}</ul>
|
|
2902
|
+
</section>`).join('');
|
|
2341
2903
|
}
|
|
2342
2904
|
|
|
2343
2905
|
function timelinePane(view) {
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2906
|
+
if (Array.isArray(view.io?.timelineGroups)) return renderTimelineGroups(view.io.timelineGroups);
|
|
2907
|
+
const node = draft?.nodes?.find((item) => item.id === panelNodeId);
|
|
2908
|
+
const gate = node?.legacyGate;
|
|
2909
|
+
const events = (view.events || []).filter((event) => event?.nodeId === panelNodeId || (gate && event?.gate === gate));
|
|
2910
|
+
return renderTimelineGroups(events.length ? [{
|
|
2911
|
+
label: 'This node',
|
|
2912
|
+
events: events.map((event) => ({
|
|
2913
|
+
at: event.at,
|
|
2914
|
+
label: event.message || String(event.type || 'event').replaceAll('_', ' ').toLowerCase()
|
|
2915
|
+
}))
|
|
2916
|
+
}] : []);
|
|
2352
2917
|
}
|
|
2353
2918
|
|
|
2354
2919
|
function paneBody(view) {
|
|
@@ -2357,7 +2922,7 @@ function paneBody(view) {
|
|
|
2357
2922
|
}
|
|
2358
2923
|
if (view.status === 'loading') return '<p class="muted">Loading node details…</p>';
|
|
2359
2924
|
if (view.status === 'error') return `<p class="validation-message">${escapeHtml(view.message || 'Could not load this node.')}</p>`;
|
|
2360
|
-
if (panelTab === 'output') return outputPane(view
|
|
2925
|
+
if (panelTab === 'output') return outputPane(view);
|
|
2361
2926
|
if (panelTab === 'evidence') return evidencePane(view);
|
|
2362
2927
|
if (panelTab === 'timeline') return timelinePane(view);
|
|
2363
2928
|
return inputPane(view.io);
|
|
@@ -2370,27 +2935,21 @@ function renderNodePanel(next) {
|
|
|
2370
2935
|
if (!panel || !node) return;
|
|
2371
2936
|
const index = draft.nodes.indexOf(node);
|
|
2372
2937
|
const runtime = runtimeFor(node);
|
|
2373
|
-
const duration = headerDuration(node, panelView.io);
|
|
2374
|
-
const state = graphStateClass(runtime?.status || panelView.io?.output?.status);
|
|
2375
|
-
const word = statusWord(runtime?.status || panelView.io?.output?.status);
|
|
2376
2938
|
panel.innerHTML = `
|
|
2377
2939
|
<div class="node-panel-frame">
|
|
2378
2940
|
<header class="node-panel-head">
|
|
2379
2941
|
<span class="node-icon panel-type-icon">${nodeIcon(node.type)}</span>
|
|
2380
2942
|
<div class="node-panel-titles">
|
|
2381
2943
|
<h2>${escapeHtml(displayName(node))}</h2>
|
|
2382
|
-
<p>${escapeHtml(
|
|
2383
|
-
</div>
|
|
2384
|
-
<div class="node-panel-meta">
|
|
2385
|
-
<span class="status-pill status-${state}">${escapeHtml(word)}</span>
|
|
2386
|
-
${duration ? `<span class="status-duration">${escapeHtml(duration)}</span>` : ''}
|
|
2944
|
+
<p>${escapeHtml(panelSubtitle(node, index))}</p>
|
|
2387
2945
|
</div>
|
|
2388
2946
|
<button type="button" class="node-panel-close" aria-label="Close node panel">×</button>
|
|
2389
2947
|
</header>
|
|
2948
|
+
${nodeChipRow(node, panelView.io, runtime)}
|
|
2390
2949
|
<div class="io-tabs" role="tablist" aria-label="Node details">
|
|
2391
|
-
${tabButton('
|
|
2950
|
+
${tabButton('overview', 'Overview')}
|
|
2392
2951
|
${tabButton('output', 'Output')}
|
|
2393
|
-
${tabButton('evidence', 'Evidence')}
|
|
2952
|
+
${tabButton('evidence', 'Evidence', evidenceCount(panelView))}
|
|
2394
2953
|
${tabButton('timeline', 'Timeline')}
|
|
2395
2954
|
</div>
|
|
2396
2955
|
<div class="node-panel-body" role="tabpanel" id="node-pane-${panelTab}" aria-labelledby="node-tab-${panelTab}">
|
|
@@ -2451,7 +3010,7 @@ async function loadPanel(nodeId) {
|
|
|
2451
3010
|
function openNodePanel(nodeId) {
|
|
2452
3011
|
if (!nodeId || !draft?.nodes?.some((node) => node.id === nodeId)) return;
|
|
2453
3012
|
const alreadyOpen = panelIsOpen();
|
|
2454
|
-
if (panelNodeId !== nodeId) panelTab = '
|
|
3013
|
+
if (panelNodeId !== nodeId) panelTab = 'overview';
|
|
2455
3014
|
panelNodeId = nodeId;
|
|
2456
3015
|
selectNode(nodeId);
|
|
2457
3016
|
focusNode(nodeId);
|
|
@@ -2484,11 +3043,31 @@ function panelIsOpen() {
|
|
|
2484
3043
|
return Boolean(panelNodeId && panel && !panel.hidden);
|
|
2485
3044
|
}
|
|
2486
3045
|
|
|
3046
|
+
async function loadArtifactPreview(artifactPath) {
|
|
3047
|
+
const runId = followedRunId();
|
|
3048
|
+
if (!runId || !artifactPath) return;
|
|
3049
|
+
const request = panelRequest;
|
|
3050
|
+
try {
|
|
3051
|
+
const result = await api(`/api/runs/${encodeURIComponent(runId)}/artifacts?path=${encodeURIComponent(artifactPath)}`);
|
|
3052
|
+
if (request !== panelRequest) return;
|
|
3053
|
+
panelView = { ...panelView, preview: result.artifact };
|
|
3054
|
+
} catch (error) {
|
|
3055
|
+
if (request !== panelRequest) return;
|
|
3056
|
+
panelView = { ...panelView, preview: { path: artifactPath, error: error.message } };
|
|
3057
|
+
}
|
|
3058
|
+
renderNodePanel();
|
|
3059
|
+
}
|
|
3060
|
+
|
|
2487
3061
|
function onPanelClick(event) {
|
|
2488
3062
|
if (closestReal(event.target, '.node-panel-close')) {
|
|
2489
3063
|
closeNodePanel();
|
|
2490
3064
|
return;
|
|
2491
3065
|
}
|
|
3066
|
+
const artifact = closestReal(event.target, '[data-artifact-path]');
|
|
3067
|
+
if (artifact?.dataset?.artifactPath) {
|
|
3068
|
+
loadArtifactPreview(artifact.dataset.artifactPath);
|
|
3069
|
+
return;
|
|
3070
|
+
}
|
|
2492
3071
|
const tab = closestReal(event.target, '[role="tab"]');
|
|
2493
3072
|
if (!tab?.dataset?.tab) return;
|
|
2494
3073
|
panelTab = tab.dataset.tab;
|
|
@@ -2686,19 +3265,40 @@ function bindCanvas() {
|
|
|
2686
3265
|
mountCanvasChrome();
|
|
2687
3266
|
canvas.addEventListener('pointerdown', (event) => {
|
|
2688
3267
|
if (closestReal(event.target, '#node-panel, .zoom-controls, .minimap')) return;
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
if (event.button === 1 || spacePressed) beginPan(event);
|
|
3268
|
+
const empty = event.target === canvas || event.target === byId('scene')
|
|
3269
|
+
|| event.target === byId('nodes') || event.target === byId('edges');
|
|
3270
|
+
if (!empty) return;
|
|
3271
|
+
if (event.button === 0 && event.shiftKey) {
|
|
3272
|
+
beginMarquee(event);
|
|
3273
|
+
return;
|
|
2696
3274
|
}
|
|
3275
|
+
selectedId = null;
|
|
3276
|
+
selectedEdgeId = null;
|
|
3277
|
+
if (!event.shiftKey) selectedIds.clear();
|
|
3278
|
+
updateSelection();
|
|
3279
|
+
renderEdges();
|
|
3280
|
+
if (event.button === 0 || event.button === 1 || spacePressed) beginPan(event);
|
|
2697
3281
|
});
|
|
2698
3282
|
canvas.addEventListener('pointermove', handlePointerMove);
|
|
2699
3283
|
canvas.addEventListener('pointerup', finishPointer);
|
|
2700
3284
|
canvas.addEventListener('pointercancel', finishPointer);
|
|
2701
3285
|
canvas.addEventListener('wheel', handleWheel, { passive: false });
|
|
3286
|
+
canvas.addEventListener('gesturestart', (event) => {
|
|
3287
|
+
if (canvasGestureIgnored(event)) return;
|
|
3288
|
+
event.preventDefault();
|
|
3289
|
+
gestureZoom = viewport.scale;
|
|
3290
|
+
}, { passive: false });
|
|
3291
|
+
canvas.addEventListener('gesturechange', (event) => {
|
|
3292
|
+
if (canvasGestureIgnored(event)) return;
|
|
3293
|
+
event.preventDefault();
|
|
3294
|
+
const scale = Number(event.scale);
|
|
3295
|
+
if (!Number.isFinite(scale) || scale <= 0) return;
|
|
3296
|
+
zoomAt((gestureZoom || viewport.scale) * scale, event.clientX, event.clientY);
|
|
3297
|
+
}, { passive: false });
|
|
3298
|
+
canvas.addEventListener('gestureend', (event) => {
|
|
3299
|
+
event.preventDefault?.();
|
|
3300
|
+
gestureZoom = null;
|
|
3301
|
+
}, { passive: false });
|
|
2702
3302
|
}
|
|
2703
3303
|
|
|
2704
3304
|
function editableTarget(target) {
|
|
@@ -2859,6 +3459,8 @@ async function initialize() {
|
|
|
2859
3459
|
byId('confirm-freeze').onclick = freezeGoalFromForm;
|
|
2860
3460
|
byId('unfreeze-goal').onclick = unfreezeGoalFromForm;
|
|
2861
3461
|
byId('retry-live-connection').onclick = resync;
|
|
3462
|
+
byId('live-view').addEventListener('click', onLiveClick);
|
|
3463
|
+
byId('live-view').addEventListener('submit', onLiveSubmit);
|
|
2862
3464
|
document.querySelectorAll?.('[data-close]')?.forEach?.((button) => {
|
|
2863
3465
|
button.onclick = () => byId(button.dataset.close).close();
|
|
2864
3466
|
});
|