ai-engineering-loop 1.9.2 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/studio/app.js CHANGED
@@ -29,14 +29,22 @@ let layoutTimer;
29
29
  let spacePressed = false;
30
30
  let pendingConnectionSource;
31
31
  let runs = [];
32
- let goal = { text: '', version: 1, frozen: false };
32
+ let goal = { text: '', version: 1, frozen: false, draftRevision: 0, draftHash: null };
33
33
  let activeRunId;
34
34
  let pendingImport;
35
35
  let hydratedGoalKey;
36
36
  let selectedCheckoutRun;
37
+ let lifecycleRunId;
38
+ let lifecycleSequence = 0;
39
+ let lifecycleEvents = [];
40
+ let agentPresence = { status: 'UNKNOWN', lastHeartbeatAt: null };
41
+ let followExecution = true;
42
+ let lastFollowedNode;
43
+ let lifecycleStream;
37
44
 
38
45
  const DISPLAY_NAME_MAX = 80;
39
46
  const ROOT_TYPES = new Set(['goal-contract', 'trigger']);
47
+ const TERMINAL_RUN_STATES = new Set(['DELIVERED', 'REPORTED', 'ESCALATED', 'CANCELLED']);
40
48
 
41
49
  function displayName(item) {
42
50
  return item?.displayName || item?.name || item?.id || 'Untitled';
@@ -294,7 +302,16 @@ function renderEdges() {
294
302
  if (!from || !to) return;
295
303
  const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
296
304
  path.setAttribute('d', edgePath(from, to));
297
- path.setAttribute('class', `${catalog.live?.nodes?.[edge.from]?.status === 'RUNNING' ? 'edge active' : 'edge'}${selectedEdgeId === edge.id ? ' selected' : ''}`);
305
+ const fromState = catalog.live?.nodes?.[edge.from]?.status;
306
+ const toState = catalog.live?.nodes?.[edge.to]?.status;
307
+ const liveNodeId = activeLifecycleNodeId();
308
+ const active = liveNodeId === edge.to && ['PASSED', 'SKIPPED'].includes(fromState);
309
+ const completed = ['PASSED', 'SKIPPED'].includes(fromState) &&
310
+ ['PASSED', 'SKIPPED', 'RUNNING'].includes(toState);
311
+ path.setAttribute(
312
+ 'class',
313
+ `edge${active ? ' active' : ''}${completed ? ' completed' : ''}${selectedEdgeId === edge.id ? ' selected' : ''}`
314
+ );
298
315
  path.setAttribute('marker-end', 'url(#arrow)');
299
316
  path.dataset.edgeId = edge.id;
300
317
  group.append(path);
@@ -363,6 +380,9 @@ function renderEdges() {
363
380
 
364
381
  function nodeMarkup(node, index) {
365
382
  const runtimeNode = catalog.live?.nodes?.[node.id];
383
+ const lifecycleActivity = activeLifecycleNodeId() === node.id
384
+ ? activeLifecycleEvent()?.message
385
+ : '';
366
386
  const outgoing = draft.edges.some((edge) => edge.from === node.id);
367
387
  const root = rootCandidates().length === 1 && rootCandidates()[0].id === node.id;
368
388
  return `
@@ -371,13 +391,34 @@ function nodeMarkup(node, index) {
371
391
  <button class="node-title" title="Double-click to edit Display Name">${escapeHtml(displayName(node))}</button>
372
392
  <span class="technical-id">${escapeHtml(node.id)}</span>
373
393
  <span class="status">● ${escapeHtml(runtimeNode?.status || 'DRAFT')}</span>
374
- ${runtimeNode?.activity ? `<p class="node-activity">${escapeHtml(runtimeNode.activity)}</p>` : ''}
394
+ ${runtimeNode?.activity || lifecycleActivity ? `<p class="node-activity">${escapeHtml(runtimeNode?.activity || lifecycleActivity)}</p>` : ''}
375
395
  <button class="port port-out" aria-label="Connect from ${escapeHtml(node.id)}" tabindex="-1"></button>
376
396
  ${outgoing ? '' : `<button class="output-add" title="Add connected node" aria-label="Add node connected after ${escapeHtml(displayName(node))}">+</button>`}
377
397
  ${root ? `<div class="execute-pod"><input class="task-input" aria-label="Task for this run" placeholder="Describe this run’s task" value="${escapeHtml(catalog.live?.run?.task || '')}"><button class="execute-trigger">${goal.frozen ? 'Execute' : 'Set Goal'}</button><span class="execute-hint">${goal.frozen ? 'Local runtime only' : 'Freeze Goal first'}</span></div>` : ''}
378
398
  `;
379
399
  }
380
400
 
401
+ function activeLifecycleEvent() {
402
+ const latest = lifecycleEvents.at(-1) || null;
403
+ if (!latest || ['NODE_COMPLETED', 'RUN_COMPLETED'].includes(latest.type)) return null;
404
+ return latest;
405
+ }
406
+
407
+ function activeLifecycleNodeId() {
408
+ const event = activeLifecycleEvent();
409
+ if (event?.nodeId) return event.nodeId;
410
+ if (event?.phase) {
411
+ const scopedNode = draft?.nodes.find((node) =>
412
+ node.id === event.phase || node.type === event.phase || node.legacyGate === event.phase
413
+ );
414
+ if (scopedNode) return scopedNode.id;
415
+ }
416
+ if (event?.phase === 'goal' || event?.type?.startsWith('GOAL_')) {
417
+ return draft?.nodes.find((node) => node.type === 'goal-contract')?.id || null;
418
+ }
419
+ return null;
420
+ }
421
+
381
422
  function renderGraph() {
382
423
  ensurePositions();
383
424
  renderLoopGroups();
@@ -388,7 +429,9 @@ function renderGraph() {
388
429
  const runtimeNode = catalog.live?.nodes?.[node.id];
389
430
  const element = document.createElement('article');
390
431
  element.dataset.nodeId = node.id;
391
- element.className = `node ${runtimeNode?.status.toLowerCase() || ''} ${selectedIds.has(node.id) ? 'selected' : ''}`;
432
+ const lifecycleActive = activeLifecycleNodeId() === node.id &&
433
+ !['DISCONNECTED', 'UNKNOWN'].includes(agentPresence.status);
434
+ element.className = `node ${runtimeNode?.status.toLowerCase() || ''} ${lifecycleActive ? 'agent-active' : ''} ${selectedIds.has(node.id) ? 'selected' : ''}`;
392
435
  element.style.left = `${position.x}px`;
393
436
  element.style.top = `${position.y}px`;
394
437
  element.innerHTML = nodeMarkup(node, index);
@@ -408,17 +451,27 @@ function updateRuntimePresentation() {
408
451
  for (const element of document.querySelectorAll('.node')) {
409
452
  const nodeId = element.dataset.nodeId;
410
453
  const runtimeNode = catalog.live?.nodes?.[nodeId];
411
- element.classList.remove('running', 'passed', 'failed', 'blocked', 'ready', 'pending', 'skipped');
454
+ element.classList.remove('running', 'passed', 'failed', 'blocked', 'ready', 'pending', 'skipped', 'agent-active', 'agent-idle', 'agent-disconnected');
412
455
  if (runtimeNode?.status) element.classList.add(runtimeNode.status.toLowerCase());
456
+ if (activeLifecycleNodeId() === nodeId) {
457
+ if (agentPresence.status === 'WORKING') element.classList.add('agent-active');
458
+ if (agentPresence.status === 'IDLE') element.classList.add('agent-idle');
459
+ if (agentPresence.status === 'DISCONNECTED') element.classList.add('agent-disconnected');
460
+ }
413
461
  element.querySelector('.status').textContent = `● ${runtimeNode?.status || 'DRAFT'}`;
414
462
  const existingActivity = element.querySelector('.node-activity');
415
- if (runtimeNode?.activity) {
416
- if (existingActivity) existingActivity.textContent = runtimeNode.activity;
417
- else element.querySelector('.status').insertAdjacentHTML('afterend', `<p class="node-activity">${escapeHtml(runtimeNode.activity)}</p>`);
463
+ const lifecycleActivity = activeLifecycleNodeId() === nodeId
464
+ ? activeLifecycleEvent()?.message
465
+ : '';
466
+ const activity = runtimeNode?.activity || lifecycleActivity;
467
+ if (activity) {
468
+ if (existingActivity) existingActivity.textContent = activity;
469
+ else element.querySelector('.status').insertAdjacentHTML('afterend', `<p class="node-activity">${escapeHtml(activity)}</p>`);
418
470
  } else {
419
471
  existingActivity?.remove();
420
472
  }
421
473
  }
474
+ renderLoopGroups();
422
475
  renderEdges();
423
476
  }
424
477
 
@@ -881,6 +934,7 @@ function renderPalette() {
881
934
  function beginNodeInteraction(event) {
882
935
  if (event.button !== 0 || event.target.closest('.port,.output-add,.execute-pod,.node-title,.inline-rename')) return;
883
936
  event.stopPropagation();
937
+ setFollowExecution(false);
884
938
  const element = event.currentTarget;
885
939
  const nodeId = element.dataset.nodeId;
886
940
  if (event.shiftKey) {
@@ -907,6 +961,7 @@ function beginNodeInteraction(event) {
907
961
  function beginPan(event) {
908
962
  if (event.button !== 0 && event.button !== 1) return;
909
963
  event.preventDefault();
964
+ setFollowExecution(false);
910
965
  interaction = {
911
966
  type: 'pan',
912
967
  pointerId: event.pointerId,
@@ -1006,6 +1061,7 @@ function finishConnection(event) {
1006
1061
  }
1007
1062
 
1008
1063
  function beginLasso(event) {
1064
+ setFollowExecution(false);
1009
1065
  const start = screenToWorld(event.clientX, event.clientY);
1010
1066
  interaction = { type: 'lasso', pointerId: event.pointerId, start, current: start, additive: event.shiftKey };
1011
1067
  const marquee = byId('selection-marquee');
@@ -1110,21 +1166,61 @@ async function ensureStudioRun() {
1110
1166
  return activeRunId;
1111
1167
  }
1112
1168
  const task = byId('goal-task').value.trim();
1113
- const created = await api('/api/runs', {
1114
- method: 'POST',
1115
- body: JSON.stringify({
1116
- task,
1117
- constraints: byId('goal-constraints').value.trim(),
1118
- displayName: byId('goal-run-name').value.trim(),
1119
- recipeId: loadedRecipeId,
1120
- mode: draft.compatibleModes.includes('ASSISTED') ? 'ASSISTED' : draft.compatibleModes[0]
1121
- })
1122
- });
1169
+ const request = {
1170
+ task,
1171
+ constraints: byId('goal-constraints').value.trim(),
1172
+ displayName: byId('goal-run-name').value.trim(),
1173
+ recipeId: loadedRecipeId,
1174
+ mode: draft.compatibleModes.includes('ASSISTED') ? 'ASSISTED' : draft.compatibleModes[0]
1175
+ };
1176
+ let created;
1177
+ try {
1178
+ created = await api('/api/runs', {
1179
+ method: 'POST',
1180
+ body: JSON.stringify(request)
1181
+ });
1182
+ } catch (error) {
1183
+ if (error.payload?.code !== 'ACTIVE_RUN' || !error.payload.activeRun) throw error;
1184
+ const action = await resolveActiveRunConflict(error.payload.activeRun);
1185
+ if (action !== 'replace') return null;
1186
+ await api(`/api/runs/${encodeURIComponent(error.payload.activeRun.runId)}/cancel`, {
1187
+ method: 'POST',
1188
+ body: JSON.stringify({
1189
+ actor: 'human',
1190
+ reason: 'Ended in Studio before creating a new Goal'
1191
+ })
1192
+ });
1193
+ created = await api('/api/runs', {
1194
+ method: 'POST',
1195
+ body: JSON.stringify(request)
1196
+ });
1197
+ }
1123
1198
  activeRunId = created.run.runId;
1124
1199
  await refreshLive();
1125
1200
  return activeRunId;
1126
1201
  }
1127
1202
 
1203
+ function resolveActiveRunConflict(run) {
1204
+ return new Promise((resolve) => {
1205
+ const dialog = byId('active-run-dialog');
1206
+ byId('active-run-message').textContent = `${run.displayName || run.runId} · ${run.state}`;
1207
+ byId('continue-active-run').onclick = async () => {
1208
+ dialog.close();
1209
+ activeRunId = run.runId;
1210
+ byId('goal-dialog').close();
1211
+ showWorkspace('runs');
1212
+ await loadRuns();
1213
+ await loadRunDetail(run.runId);
1214
+ resolve('continue');
1215
+ };
1216
+ byId('replace-active-run').onclick = () => {
1217
+ dialog.close();
1218
+ resolve('replace');
1219
+ };
1220
+ dialog.showModal();
1221
+ });
1222
+ }
1223
+
1128
1224
  async function saveGoalFromForm() {
1129
1225
  try {
1130
1226
  const task = byId('goal-task').value.trim();
@@ -1142,12 +1238,24 @@ async function saveGoalFromForm() {
1142
1238
  return null;
1143
1239
  }
1144
1240
  const runId = await ensureStudioRun();
1241
+ if (!runId) return null;
1145
1242
  const contract = goalContractFromForm(runId);
1146
- await api(`/api/runs/${encodeURIComponent(runId)}/goal`, {
1243
+ const saved = await api(`/api/runs/${encodeURIComponent(runId)}/goal`, {
1147
1244
  method: 'PUT',
1148
- body: JSON.stringify({ goal: contract })
1245
+ body: JSON.stringify({
1246
+ goal: contract,
1247
+ actor: 'studio-user',
1248
+ expectedRevision: goal.draftRevision
1249
+ })
1149
1250
  });
1150
- goal = { text: contract.objective, criteria: contract.acceptanceCriteria, version: goal.version, frozen: false };
1251
+ goal = {
1252
+ text: contract.objective,
1253
+ criteria: contract.acceptanceCriteria,
1254
+ version: goal.version,
1255
+ frozen: false,
1256
+ draftRevision: saved.draft.metadata.revision,
1257
+ draftHash: saved.draft.metadata.contentHash
1258
+ };
1151
1259
  byId('goal-validation').textContent = '';
1152
1260
  notify('Goal draft saved. It is not frozen yet.');
1153
1261
  byId('goal-dialog').close();
@@ -1193,7 +1301,11 @@ async function freezeGoalFromForm() {
1193
1301
  try {
1194
1302
  const result = await api(`/api/runs/${encodeURIComponent(activeRunId)}/goal/freeze`, {
1195
1303
  method: 'POST',
1196
- body: JSON.stringify({ actor: 'studio-user' })
1304
+ body: JSON.stringify({
1305
+ actor: 'studio-user',
1306
+ expectedRevision: goal.draftRevision,
1307
+ expectedHash: goal.draftHash
1308
+ })
1197
1309
  });
1198
1310
  catalog.live = catalog.live || {};
1199
1311
  catalog.live.run = result.run;
@@ -1238,8 +1350,16 @@ async function unfreezeGoalFromForm() {
1238
1350
 
1239
1351
  function syncGoalFromLive() {
1240
1352
  const liveGoal = catalog.live?.run?.goal;
1241
- activeRunId = catalog.live?.run?.runId || null;
1242
- if (!liveGoal) return;
1353
+ const nextRunId = catalog.live?.run?.runId || null;
1354
+ if (activeRunId !== nextRunId) {
1355
+ goal = { text: '', version: 1, frozen: false, draftRevision: 0, draftHash: null };
1356
+ hydratedGoalKey = null;
1357
+ }
1358
+ activeRunId = nextRunId;
1359
+ if (!liveGoal) {
1360
+ renderGoalState();
1361
+ return;
1362
+ }
1243
1363
  goal.version = liveGoal.version || 1;
1244
1364
  goal.frozen = liveGoal.frozen === true;
1245
1365
  if (catalog.live.run.task) byId('goal-task').value = catalog.live.run.task;
@@ -1248,6 +1368,100 @@ function syncGoalFromLive() {
1248
1368
  renderGoalState();
1249
1369
  }
1250
1370
 
1371
+ async function refreshGoalDraft(runId) {
1372
+ if (!runId || goal.frozen) return;
1373
+ const result = await api(`/api/runs/${encodeURIComponent(runId)}/goal`);
1374
+ const draftEnvelope = result.draft;
1375
+ if (!draftEnvelope || draftEnvelope.metadata.revision === goal.draftRevision) return;
1376
+ goal.draftRevision = draftEnvelope.metadata.revision;
1377
+ goal.draftHash = draftEnvelope.metadata.contentHash;
1378
+ goal.text = draftEnvelope.contract.objective || '';
1379
+ goal.criteria = draftEnvelope.contract.acceptanceCriteria || [];
1380
+ if (!byId('goal-form').contains(document.activeElement)) {
1381
+ byId('goal-text').value = goal.text;
1382
+ byId('goal-criteria').value = goal.criteria.map((criterion) => (
1383
+ `${criterion.statement} | ${criterion.evidenceRequired} | ${(criterion.failureCases || []).join(' | ')}`
1384
+ )).join('\n');
1385
+ }
1386
+ renderGoalState();
1387
+ }
1388
+
1389
+ async function refreshLifecycle(runId) {
1390
+ if (!runId) {
1391
+ lifecycleStream?.close();
1392
+ lifecycleStream = null;
1393
+ lifecycleRunId = null;
1394
+ lifecycleSequence = 0;
1395
+ lifecycleEvents = [];
1396
+ agentPresence = { status: 'UNKNOWN', lastHeartbeatAt: null };
1397
+ return;
1398
+ }
1399
+ if (lifecycleRunId !== runId) {
1400
+ lifecycleStream?.close();
1401
+ lifecycleStream = null;
1402
+ lifecycleRunId = runId;
1403
+ lifecycleSequence = 0;
1404
+ lifecycleEvents = [];
1405
+ startLifecycleStream(runId);
1406
+ }
1407
+ try {
1408
+ const result = await api(
1409
+ `/api/runs/${encodeURIComponent(runId)}/lifecycle?after=${lifecycleSequence}&limit=100`
1410
+ );
1411
+ lifecycleEvents = lifecycleEvents.concat(
1412
+ result.lifecycle.events.filter((event) => event.sequence > lifecycleSequence)
1413
+ ).slice(-100);
1414
+ lifecycleSequence = result.lifecycle.nextSequence;
1415
+ agentPresence = result.presence;
1416
+ } catch {
1417
+ agentPresence = { status: 'UNKNOWN', lastHeartbeatAt: null };
1418
+ }
1419
+ }
1420
+
1421
+ function startLifecycleStream(runId) {
1422
+ if (!window.EventSource || !runId) return;
1423
+ lifecycleStream = new window.EventSource(
1424
+ `/api/runs/${encodeURIComponent(runId)}/lifecycle/stream?after=${lifecycleSequence}`
1425
+ );
1426
+ lifecycleStream.onmessage = (message) => {
1427
+ try {
1428
+ const result = JSON.parse(message.data);
1429
+ lifecycleEvents = lifecycleEvents.concat(
1430
+ result.lifecycle.events.filter((event) => event.sequence > lifecycleSequence)
1431
+ ).slice(-100);
1432
+ lifecycleSequence = Math.max(lifecycleSequence, result.lifecycle.nextSequence);
1433
+ agentPresence = result.presence;
1434
+ renderLive();
1435
+ } catch {
1436
+ // The regular cursor poll remains the recovery path.
1437
+ }
1438
+ };
1439
+ }
1440
+
1441
+ function setFollowExecution(enabled) {
1442
+ followExecution = enabled;
1443
+ const button = byId('follow-execution');
1444
+ button.classList.toggle('active', enabled);
1445
+ button.setAttribute('aria-pressed', String(enabled));
1446
+ button.textContent = enabled ? 'Following' : 'Follow execution';
1447
+ if (enabled) {
1448
+ lastFollowedNode = null;
1449
+ followActiveNode();
1450
+ }
1451
+ }
1452
+
1453
+ function followActiveNode() {
1454
+ const nodeId = activeLifecycleNodeId();
1455
+ if (!followExecution || !nodeId || nodeId === lastFollowedNode || interaction) return;
1456
+ const position = positions.get(nodeId);
1457
+ if (!position) return;
1458
+ const canvas = byId('canvas').getBoundingClientRect();
1459
+ viewport.x = canvas.width / 2 - (position.x + NODE_WIDTH / 2) * viewport.scale;
1460
+ viewport.y = canvas.height / 2 - (position.y + 54) * viewport.scale;
1461
+ lastFollowedNode = nodeId;
1462
+ applyViewport();
1463
+ }
1464
+
1251
1465
  async function hydrateGoalFromLive() {
1252
1466
  const run = catalog.live?.run;
1253
1467
  const artifactPath = run?.artifacts?.goalContract?.path;
@@ -1283,13 +1497,21 @@ async function loadRuns() {
1283
1497
  if (!runs.length) {
1284
1498
  list.innerHTML = '<div class="empty-state"><h2>No runs found</h2><p>Create a task from the workflow trigger.</p></div>';
1285
1499
  } else {
1286
- list.innerHTML = runs.map((run) => `
1287
- <button class="run-row" data-run-id="${escapeHtml(run.runId)}">
1500
+ const active = runs.find((run) => !TERMINAL_RUN_STATES.has(run.status));
1501
+ const historyRuns = runs.filter((run) => run.runId !== active?.runId);
1502
+ const row = (run, isActive = false) => `
1503
+ <button class="run-row${isActive ? ' active-run-row' : ''}" data-run-id="${escapeHtml(run.runId)}">
1288
1504
  <strong>${escapeHtml(run.displayName)}</strong>
1289
1505
  <span>${escapeHtml(run.status)} · ${escapeHtml(new Date(run.updatedAt).toLocaleString())}</span>
1290
1506
  <small>${escapeHtml(run.task)}</small>
1291
- </button>
1292
- `).join('');
1507
+ </button>`;
1508
+ list.innerHTML = [
1509
+ active ? `<div class="run-list-label"><i></i>Active now</div>${row(active, true)}` : '',
1510
+ `<div class="run-list-label history-label">History</div>`,
1511
+ historyRuns.length
1512
+ ? historyRuns.map((run) => row(run)).join('')
1513
+ : '<p class="muted run-list-empty">Completed Runs will stay here.</p>'
1514
+ ].join('');
1293
1515
  list.querySelectorAll('.run-row').forEach((button) => {
1294
1516
  button.onclick = () => loadRunDetail(button.dataset.runId);
1295
1517
  });
@@ -1656,6 +1878,7 @@ function zoomAt(nextScale, clientX, clientY) {
1656
1878
 
1657
1879
  function handleWheel(event) {
1658
1880
  event.preventDefault();
1881
+ setFollowExecution(false);
1659
1882
  if (event.ctrlKey || event.metaKey) {
1660
1883
  zoomAt(viewport.scale * Math.exp(-event.deltaY * 0.002), event.clientX, event.clientY);
1661
1884
  } else {
@@ -1772,25 +1995,42 @@ function renderLive() {
1772
1995
  byId('events').innerHTML = '';
1773
1996
  byId('budget').textContent = '—';
1774
1997
  byId('meter').style.width = '0';
1998
+ byId('agent-presence').textContent = 'Agent unavailable';
1999
+ byId('agent-presence').className = 'agent-presence unknown';
1775
2000
  updateRuntimePresentation();
1776
2001
  return;
1777
2002
  }
1778
- const active = live.plan.nodes.find((node) => live.nodes[node.id].status === 'RUNNING')
2003
+ const lifecycleNodeId = activeLifecycleNodeId();
2004
+ const active = live.plan.nodes.find((node) => node.id === lifecycleNodeId)
2005
+ || live.plan.nodes.find((node) => live.nodes[node.id].status === 'RUNNING')
1779
2006
  || live.plan.nodes.find((node) => live.nodes[node.id].status === 'READY');
1780
2007
  const runtimeNode = active ? live.nodes[active.id] : null;
2008
+ const lifecycle = activeLifecycleEvent();
1781
2009
  byId('run-summary').textContent = active ? `${active.id} · ${runtimeNode.status}` : `Run ${live.run.state}`;
1782
2010
  byId('active-stage').textContent = active?.id || 'Run complete';
1783
- byId('activity').textContent = active ? runtimeNode.activity || `${runtimeNode.status} · attempt ${runtimeNode.attempts}` : `Final state: ${live.run.state}`;
2011
+ byId('activity').textContent = lifecycle?.message ||
2012
+ (active ? runtimeNode.activity || `${runtimeNode.status} · attempt ${runtimeNode.attempts}` : `Final state: ${live.run.state}`);
2013
+ const presenceLabel = {
2014
+ WORKING: 'Agent working',
2015
+ IDLE: 'Agent appears idle',
2016
+ DISCONNECTED: 'Agent disconnected',
2017
+ UNKNOWN: 'Waiting for Agent'
2018
+ }[agentPresence.status] || 'Waiting for Agent';
2019
+ byId('agent-presence').textContent = presenceLabel;
2020
+ byId('agent-presence').className = `agent-presence ${agentPresence.status.toLowerCase()}`;
1784
2021
  const spent = live.budget.spentThisRun;
1785
2022
  const limit = live.budget.perRunTokenLimit;
1786
2023
  byId('meter').style.width = `${Math.min(100, limit ? (spent / limit) * 100 : 0)}%`;
1787
2024
  byId('budget').textContent = `${spent.toLocaleString()} / ${limit.toLocaleString()} TOKENS`;
1788
- byId('events').innerHTML = live.events.slice(-7).reverse().map((event) => `
2025
+ byId('events').innerHTML = lifecycleEvents.slice(-7).reverse().map((event) => `
1789
2026
  <p class="${event.type === 'NODE_ACTIVITY' || event.type.includes('START') ? 'event-active' : ''}">
1790
- ${escapeHtml(event.at.slice(11, 19))} · ${escapeHtml(event.type)} · ${escapeHtml(event.changedNodes.join(', '))}
2027
+ ${escapeHtml(event.at.slice(11, 19))} · ${escapeHtml(event.type)} · ${escapeHtml(event.message)}
1791
2028
  </p>
2029
+ `).join('') || live.events.slice(-7).reverse().map((event) => `
2030
+ <p>${escapeHtml(event.at.slice(11, 19))} · ${escapeHtml(event.type)}</p>
1792
2031
  `).join('');
1793
2032
  updateRuntimePresentation();
2033
+ followActiveNode();
1794
2034
  }
1795
2035
 
1796
2036
  async function refreshLive() {
@@ -1798,10 +2038,13 @@ async function refreshLive() {
1798
2038
  const result = await api('/api/live');
1799
2039
  catalog.live = result.live;
1800
2040
  syncGoalFromLive();
2041
+ await refreshLifecycle(catalog.live?.run?.runId);
2042
+ await refreshGoalDraft(catalog.live?.run?.runId);
1801
2043
  await hydrateGoalFromLive();
1802
2044
  renderLive();
1803
2045
  await refreshSelectedCheckout();
1804
2046
  await refreshCheckoutInteractions();
2047
+ if (!byId('runs-view').hidden) await loadRuns();
1805
2048
  } catch {
1806
2049
  // A transient refresh failure must not discard the draft.
1807
2050
  }
@@ -1878,6 +2121,8 @@ function bindCanvas() {
1878
2121
  byId('zoom-out').onclick = () => zoomAt(viewport.scale / 1.2);
1879
2122
  byId('undo').onclick = () => restoreHistory(historyIndex - 1);
1880
2123
  byId('redo').onclick = () => restoreHistory(historyIndex + 1);
2124
+ byId('follow-execution').onclick = () => setFollowExecution(!followExecution);
2125
+ setFollowExecution(followExecution);
1881
2126
  }
1882
2127
 
1883
2128
  function editableTarget(target) {
@@ -2104,6 +2349,7 @@ async function initialize() {
2104
2349
  byId('toggle-execution').onclick = () => byId('execution-panel').classList.toggle('open');
2105
2350
  byId('close-execution').onclick = () => byId('execution-panel').classList.remove('open');
2106
2351
  await loadRecipe();
2352
+ await refreshLive();
2107
2353
  clearInterval(liveTimer);
2108
2354
  liveTimer = setInterval(refreshLive, 1800);
2109
2355
  }
package/studio/index.html CHANGED
@@ -105,6 +105,7 @@
105
105
 
106
106
  <aside class="execution-panel" id="execution-panel">
107
107
  <div class="panel-head"><div><small>LIVE EXECUTION</small><h2 id="active-stage">No active run</h2></div><button id="close-execution" aria-label="Close">×</button></div>
108
+ <div class="live-controls"><span id="agent-presence" class="agent-presence unknown">Agent unavailable</span><button id="follow-execution" type="button" aria-pressed="true">Follow execution</button></div>
108
109
  <p id="activity">Waiting for a recipe-bound workflow.</p>
109
110
  <div class="budget-line"><span>Context budget</span><span class="mono" id="budget">—</span></div>
110
111
  <div class="meter"><i id="meter"></i></div>
@@ -183,6 +184,15 @@
183
184
  </footer>
184
185
  </form>
185
186
  </dialog>
187
+ <dialog id="active-run-dialog" class="resizable-dialog">
188
+ <header><div><small>ACTIVE RUN</small><h2>A Run is already in progress</h2></div></header>
189
+ <p id="active-run-message"></p>
190
+ <div class="goal-state draft">Starting a new Goal will end the current Run. Its history and evidence will remain available.</div>
191
+ <footer>
192
+ <button type="button" id="continue-active-run">Continue current Run</button>
193
+ <button type="button" id="replace-active-run" class="primary">End Run &amp; create new Goal</button>
194
+ </footer>
195
+ </dialog>
186
196
  <dialog id="loop-dialog" class="resizable-dialog">
187
197
  <form id="loop-form">
188
198
  <header><div><small>ITERATION LOOP</small><h2>Repeat only the selected steps</h2></div><div class="dialog-actions"><button type="button" class="dialog-maximize" aria-label="Maximize dialog">□</button><button type="button" data-close="loop-dialog" aria-label="Close">×</button></div></header>
package/studio/styles.css CHANGED
@@ -23,14 +23,15 @@ small,label{display:block;color:var(--muted);font-size:11px;margin:4px 0 6px}
23
23
  #palette{padding:10px}.palette-item{display:flex;align-items:center;justify-content:space-between;width:100%;padding:13px;margin:0 0 6px;background:transparent;border-color:transparent;text-align:left}.palette-item:hover{background:var(--raised)}.palette-item b{font-weight:550}.palette-item small{margin:0;font-size:10px}
24
24
  .canvas-toolbar{position:absolute;z-index:10;left:14px;bottom:14px;display:flex;align-items:center;gap:3px;padding:5px;background:#29292edb;border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px #0006}.canvas-toolbar button{border:0;background:transparent;padding:7px 9px}.canvas-toolbar button:hover{background:#3a3a40}.canvas-toolbar span{height:20px;width:1px;background:var(--line);margin:0 4px}.canvas-toolbar output{width:44px;text-align:center;color:var(--muted);font-size:11px}
25
25
  #scene{position:absolute;inset:0;transform-origin:0 0;will-change:transform}#nodes,#edges,#loop-groups{position:absolute;inset:0;width:1px;height:1px;overflow:visible}
26
- .node{position:absolute;width:224px;min-height:104px;padding:16px 18px;background:#303036f5;border:1px solid #4a4a52;border-radius:9px;cursor:grab;z-index:2;user-select:none;box-shadow:0 7px 18px #0005;transition:border-color .12s,box-shadow .12s}.node:hover{border-color:#777781}.node.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent),0 12px 28px #0008}.node.dragging{cursor:grabbing;transition:none}.node.running{border:2px solid var(--accent);box-shadow:0 0 20px #28ad0038}.node.passed{border-left:4px solid var(--ok)}.node.failed{border-color:var(--danger)}.node.blocked{opacity:.58}
26
+ .node{position:absolute;width:224px;min-height:104px;padding:16px 18px;background:#303036f5;border:1px solid #4a4a52;border-radius:9px;cursor:grab;z-index:2;user-select:none;box-shadow:0 7px 18px #0005;transition:border-color .12s,box-shadow .12s}.node:hover{border-color:#777781}.node.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent),0 12px 28px #0008}.node.dragging{cursor:grabbing;transition:none}.node.running,.node.agent-active{border:2px solid var(--accent);box-shadow:0 0 0 4px #28ad0018,0 0 28px #28ad0055;animation:agent-pulse 1.8s ease-in-out infinite}.node.agent-idle{border-color:var(--warning);box-shadow:0 0 0 2px #e4a85322}.node.agent-disconnected{border-color:var(--danger);border-style:dashed}.node.passed{border-left:4px solid var(--ok)}.node.failed{border-color:var(--danger)}.node.blocked{opacity:.58}
27
27
  .node h3{margin:11px 0 9px;font-size:14px}.node small{font-size:9px;margin:0;color:#aaaab3}.status{font:10px ui-monospace,monospace;color:var(--muted)}.running .status{color:var(--accent)}.passed .status{color:var(--ok)}.failed .status{color:var(--danger)}.node-activity{margin:9px 0 0;color:#91dc7c;font:10px/1.4 ui-monospace,monospace}
28
28
  .port{position:absolute;top:31px;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;z-index:8}.port::before{content:"";position:absolute;inset:15px;border:2px solid #8a8a95;border-radius:50%;background:#303036}.port:hover::before,.port:focus-visible::before{border-color:var(--accent);background:var(--accent)}.port-in{left:-23px}.port-out{right:-23px;cursor:crosshair;touch-action:none}.port-out::after{content:"•••";position:absolute;left:13px;top:11px;color:#fff;font-size:6px;letter-spacing:-1px;pointer-events:none}
29
- #edges{pointer-events:none}#arrow path{fill:#777780}.edge{fill:none;stroke:#777780;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer}.edge.active{stroke:var(--accent);stroke-width:3;stroke-dasharray:9 11;animation:flow .8s linear infinite;filter:drop-shadow(0 0 4px var(--accent))}#preview-edge{display:none;fill:none;stroke:var(--accent);stroke-width:2;stroke-dasharray:6 5;vector-effect:non-scaling-stroke}@keyframes flow{to{stroke-dashoffset:-20}}
29
+ #edges{pointer-events:none}#arrow path{fill:#777780}.edge{fill:none;stroke:#777780;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer}.edge.completed{stroke:var(--ok)}.edge.active{stroke:var(--accent);stroke-width:3;stroke-dasharray:9 11;animation:flow .8s linear infinite;filter:drop-shadow(0 0 4px var(--accent))}#preview-edge{display:none;fill:none;stroke:var(--accent);stroke-width:2;stroke-dasharray:6 5;vector-effect:non-scaling-stroke}@keyframes flow{to{stroke-dashoffset:-20}}@keyframes agent-pulse{50%{box-shadow:0 0 0 8px #28ad0008,0 0 38px #28ad0070}}
30
30
  .canvas-help{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);color:#8a8a94;font-size:10px;pointer-events:none}.canvas-help kbd{border:1px solid #505058;border-radius:3px;padding:2px 4px;font:inherit}
31
31
  #details{padding:18px}#details input,#details textarea,#details select,.execution-panel input,.execution-panel textarea{width:100%;padding:10px 11px;margin:0 0 14px;border:1px solid var(--line);border-radius:6px;background:#1d1d21}#details textarea,.execution-panel textarea{min-height:72px;resize:vertical}#details select[multiple]{height:76px}
32
32
  #details details,.execution-panel details{border-top:1px solid var(--line);margin:15px 0;padding-top:14px}summary{cursor:pointer;color:#d5d5da}.settings-body{padding-top:14px}.source-line{display:flex;justify-content:space-between;color:var(--muted);font-size:11px;margin-bottom:16px}.hint{border-left:2px solid var(--accent);padding:8px 10px;color:#b5b5bd;line-height:1.45}.button-row{display:flex;gap:7px}.button-row button{flex:1}.danger{color:#ff9999}
33
33
  .adapter-controls{margin:12px 0}.budget-line{display:flex;justify-content:space-between;margin-top:20px;color:var(--muted)}.meter{height:6px;background:#38383e;border-radius:5px;margin:9px 0 15px}.meter i{display:block;height:100%;width:0;background:var(--accent);border-radius:5px}.mono,#events{font:10px/1.8 ui-monospace,monospace;color:var(--muted)}#events p{margin:2px 0}.event-active{color:var(--accent)}
34
+ .agent-presence{display:inline-flex;align-items:center;gap:7px;margin:8px 0;color:var(--muted);font-size:11px}.agent-presence::before{content:"";width:7px;height:7px;border-radius:50%;background:#777}.agent-presence.working::before{background:var(--accent);box-shadow:0 0 12px var(--accent);animation:presence-pulse 1.2s ease-in-out infinite}.agent-presence.idle::before{background:var(--warning)}.agent-presence.disconnected::before{background:var(--danger)}#follow-execution.active{border-color:var(--accent);background:var(--accent-soft);color:#a7ee93}@keyframes presence-pulse{50%{opacity:.35}}
34
35
  #message{position:absolute;z-index:40;right:20px;bottom:20px;max-width:380px;background:#333339;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:6px;padding:12px 15px;box-shadow:0 12px 36px #0008;display:none}
35
36
  dialog{border:1px solid #505057;border-radius:4px;background:var(--panel);color:var(--text);width:560px;padding:28px;box-shadow:14px 14px 0 #0d0d0f;line-height:1.55}dialog::backdrop{background:#000b}dialog pre{max-height:320px;overflow:auto;background:#161619;padding:16px;border:1px solid var(--line);border-radius:3px;color:#d2d2d7;font-size:12px;line-height:1.65}dialog button{float:right;margin-left:8px}.resizable-dialog{resize:both;overflow:auto;min-width:min(520px,calc(100vw - 24px));min-height:420px;max-width:calc(100vw - 24px);max-height:calc(100vh - 24px)}dialog.maximized{width:calc(100vw - 32px)!important;height:calc(100vh - 32px)!important;max-width:none;max-height:none}.dialog-actions{display:flex;gap:4px}.dialog-actions button{float:none;margin:0}.dialog-maximize{font-size:16px!important}
36
37
  .workspace-tabs{display:flex;gap:2px;margin-left:4px}.workspace-tab{border:0;background:transparent;color:var(--muted)}.workspace-tab.active{background:var(--raised);color:var(--text)}.workflow-context{display:flex;align-items:center;gap:6px}
@@ -38,11 +39,12 @@ dialog{border:1px solid #505057;border-radius:4px;background:var(--panel);color:
38
39
  .output-add{position:absolute;right:-62px;top:39px;width:30px;height:30px;padding:0;border-radius:50%;border-color:var(--accent);background:var(--accent);color:#fff;font-size:20px;opacity:0;z-index:5;transform:scale(.8);transition:.12s}.node:hover .output-add,.output-add:focus{opacity:1;transform:scale(1)}
39
40
  #edge-controls{position:absolute;inset:0;width:1px;height:1px;z-index:5}.edge-delete{position:absolute;width:24px;height:24px;padding:0;transform:translate(-50%,-50%) scale(.75);border-radius:50%;border-color:#696972;background:#29292e;color:#fff;opacity:0;transition:.12s}.edge-delete:hover,.edge-delete.selected,.edge-delete.visible{opacity:1;transform:translate(-50%,-50%) scale(1);border-color:var(--danger);background:var(--danger)}.edge.selected{stroke:var(--accent);stroke-width:3}
40
41
  .execute-pod{position:absolute;left:0;top:calc(100% + 12px);width:224px;padding:8px;background:#25252a;border:1px solid var(--line);border-radius:8px;display:grid;grid-template-columns:1fr auto;gap:6px}.execute-pod input{min-width:0;padding:7px;border:1px solid var(--line);background:#19191c;border-radius:5px}.execute-pod button{background:var(--accent);border-color:var(--accent);color:#fff}.execute-hint{grid-column:1/-1;color:var(--muted);font-size:9px}
42
+ @media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}.edge.active{stroke-dasharray:none}.node.running,.node.agent-active{box-shadow:0 0 0 2px var(--accent)}}
41
43
  .selection-actions{position:absolute;z-index:12;left:50%;top:14px;transform:translateX(-50%);padding:6px;background:#29292e;border:1px solid var(--line);border-radius:8px}.selection-actions span{margin:0 8px;color:var(--muted)}#selection-marquee{position:absolute;display:none;border:1px solid var(--accent);background:#28ad0018;pointer-events:none}
42
44
  .loop-group{position:absolute;z-index:1;border:1px dashed #28ad0099;border-radius:12px;background:#28ad000a;pointer-events:none}.loop-group>header{position:absolute;left:14px;top:-16px;height:31px;display:flex;align-items:center;gap:10px;padding:4px 5px 4px 10px;border:1px solid #28ad006e;border-radius:5px;background:#1b2818;pointer-events:auto}.loop-group header span{display:flex;align-items:center;gap:8px;white-space:nowrap}.loop-group header b{font-size:10px;text-transform:uppercase;letter-spacing:.08em}.loop-group header small{margin:0;color:#91dc7c;font:9px ui-monospace,monospace}.loop-group header button{padding:3px 7px;border:0;background:transparent;color:var(--muted);font-size:9px}.loop-group.blocked{border-color:var(--warning);background:#e4a8530a}.loop-group.exited{opacity:.72}.loop-return{stroke:#28ad00;stroke-dasharray:7 6}.edge-label{position:absolute;z-index:6;transform:translate(-50%,-50%);padding:3px 6px;border:1px solid #4d4d54;border-radius:4px;background:#202024;color:#d6d6da;font:9px ui-monospace,monospace;white-space:nowrap;pointer-events:none}.loop-label{border-color:#28ad007a;color:#91dc7c}
43
45
  .custom-node-action{width:calc(100% - 20px);margin:4px 10px 14px;border-color:var(--accent);color:#91dc7c}
44
- .runs-view{position:absolute;inset:0 0 0 56px;padding:28px 34px;overflow:auto;background:var(--canvas)}.runs-header{display:flex;align-items:end;justify-content:space-between;gap:30px;max-width:1440px;margin:auto}.runs-header h1{margin:5px 0;font-size:32px;letter-spacing:-.04em}.runs-header p{color:var(--muted)}.run-filters{display:flex;align-items:end;gap:7px}.run-filters label{margin:0}.run-filters input,.run-filters select{display:block;max-width:150px;margin-top:6px;padding:10px;border:1px solid var(--line);background:var(--bg);border-radius:3px}.run-search{width:min(300px,32vw)}.run-search input{width:100%;max-width:none}.runs-layout{display:grid;grid-template-columns:310px minmax(0,1fr);gap:16px;max-width:1440px;margin:22px auto}.run-list,.run-detail{min-height:520px;border:1px solid var(--line);border-radius:4px;background:var(--panel);padding:12px}.run-row{display:block;width:100%;margin-bottom:7px;padding:16px;text-align:left;background:transparent;border-color:transparent;border-radius:3px}.run-row:hover{background:var(--raised);border-color:#4d4d54}.run-row strong,.run-row span,.run-row small{display:block}.run-row span{margin:7px 0;color:#91dc7c;font-size:10px;letter-spacing:.04em}.run-row small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.run-detail{padding:24px;overflow:hidden}.run-detail h2{font-size:26px;margin:5px 0;letter-spacing:-.03em}.timeline p{display:grid;grid-template-columns:180px 1fr;gap:12px;border-top:1px solid var(--line);padding:9px 0}.timeline time{color:var(--muted);font:10px ui-monospace,monospace}.empty-state{padding:50px 22px;text-align:center;color:var(--muted)}
45
- .checkout-header{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.checkout-header .quiet{float:none;margin:0 0 14px -10px}.checkout-actions{display:flex;gap:7px;flex-shrink:0}.checkout-meta{display:flex;gap:16px;padding:13px 0;margin:16px 0;border-block:1px solid var(--line);color:var(--muted);font:10px ui-monospace,monospace}.checkout-canvas{position:relative;width:max(100%,var(--checkout-width));height:var(--checkout-height);min-height:330px;margin:20px 0;overflow:auto;background-color:#1e1e21;background-image:radial-gradient(#414147 1px,transparent 1px);background-size:24px 24px;border:1px solid var(--line)}.checkout-canvas svg{position:absolute;inset:0;width:var(--checkout-width);height:var(--checkout-height);pointer-events:none}.checkout-canvas path{fill:none;stroke:#696972;stroke-width:2}.checkout-node{position:absolute;width:224px;min-height:104px;padding:15px 17px;text-align:left;background:#2d2d32;border:1px solid #515158;border-radius:4px;box-shadow:6px 6px 0 #111114}.checkout-node small,.checkout-node strong,.checkout-node span{display:block}.checkout-node strong{margin:13px 0 10px}.checkout-node span{font:10px ui-monospace,monospace;color:var(--muted)}.checkout-node.status-passed{border-left:5px solid var(--ok)}.checkout-node.status-running{border-color:var(--accent)}.checkout-node.status-ready{border-left:5px solid var(--warning)}.checkout-node.status-failed{border-left:5px solid var(--danger)}.checkout-node.status-blocked{opacity:.62}.node-io-panel,.agent-interactions{margin-top:18px;padding:20px;border:1px solid var(--line);background:#1d1d20}.io-grid{display:grid;grid-template-columns:1fr 1fr;gap:1px;background:var(--line)}.io-grid>section{min-width:0;padding:18px;background:#202024}.io-grid h4{margin-top:0;text-transform:uppercase;font-size:10px;letter-spacing:.12em;color:#91dc7c}.io-grid pre{max-height:260px;overflow:auto;white-space:pre-wrap;background:#151518;padding:13px;font-size:11px}.artifact-path{overflow-wrap:anywhere;color:var(--muted);font:10px ui-monospace,monospace}.agent-interactions>header{display:flex;justify-content:space-between}.agent-question{padding:16px 0;border-top:1px solid var(--line)}.agent-question form{display:grid;grid-template-columns:1fr auto;gap:8px}.agent-question textarea{min-height:72px;padding:11px;background:#17171a;border:1px solid var(--line);color:var(--text);resize:vertical}.agent-answer{padding:12px;border-left:3px solid var(--accent);background:var(--accent-soft)}
46
+ .runs-view{position:absolute;inset:0 0 0 56px;padding:28px 34px;overflow:auto;background:var(--canvas)}.runs-header{display:flex;align-items:end;justify-content:space-between;gap:30px;max-width:1440px;margin:auto}.runs-header h1{margin:5px 0;font-size:32px;letter-spacing:-.04em}.runs-header p{color:var(--muted)}.run-filters{display:flex;align-items:end;gap:7px}.run-filters label{margin:0}.run-filters input,.run-filters select{display:block;max-width:150px;margin-top:6px;padding:10px;border:1px solid var(--line);background:var(--bg);border-radius:3px}.run-search{width:min(300px,32vw)}.run-search input{width:100%;max-width:none}.runs-layout{display:grid;grid-template-columns:310px minmax(0,1fr);gap:16px;max-width:1440px;margin:22px auto}.run-list,.run-detail{min-height:520px;border:1px solid var(--line);border-radius:4px;background:var(--panel);padding:12px}.run-list-label{display:flex;align-items:center;gap:8px;margin:8px 7px 10px;color:#91dc7c;font:9px ui-monospace,monospace;text-transform:uppercase;letter-spacing:.12em}.run-list-label i{width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 0 #28ad0066;animation:active-pulse 1.7s ease-out infinite}.run-list-label.history-label{margin-top:22px;color:var(--muted)}.run-list-empty{padding:8px}.run-row{display:block;width:100%;margin-bottom:7px;padding:16px;text-align:left;background:transparent;border-color:transparent;border-radius:3px}.run-row:hover{background:var(--raised);border-color:#4d4d54}.run-row.active-run-row{background:#28ad000d;border-color:#28ad0066}.run-row strong,.run-row span,.run-row small{display:block}.run-row span{margin:7px 0;color:#91dc7c;font-size:10px;letter-spacing:.04em}.run-row small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.run-detail{padding:24px;overflow:hidden}.run-detail h2{font-size:26px;margin:5px 0;letter-spacing:-.03em}.timeline p{display:grid;grid-template-columns:180px 1fr;gap:12px;border-top:1px solid var(--line);padding:9px 0}.timeline time{color:var(--muted);font:10px ui-monospace,monospace}.empty-state{padding:50px 22px;text-align:center;color:var(--muted)}@keyframes active-pulse{70%{box-shadow:0 0 0 8px #28ad0000}100%{box-shadow:0 0 0 0 #28ad0000}}
47
+ .checkout-header{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.checkout-header .quiet{float:none;margin:0 0 14px -10px}.checkout-actions{display:flex;gap:7px;flex-shrink:0}.checkout-meta{display:flex;gap:16px;padding:13px 0;margin:16px 0;border-block:1px solid var(--line);color:var(--muted);font:10px ui-monospace,monospace}.checkout-canvas{position:relative;width:max(100%,var(--checkout-width));height:var(--checkout-height);min-height:330px;margin:20px 0;overflow:auto;background-color:#1e1e21;background-image:radial-gradient(#414147 1px,transparent 1px);background-size:24px 24px;border:1px solid var(--line)}.checkout-canvas svg{position:absolute;inset:0;width:var(--checkout-width);height:var(--checkout-height);pointer-events:none}.checkout-canvas path{fill:none;stroke:#696972;stroke-width:2}.checkout-node{position:absolute;width:224px;min-height:104px;padding:15px 17px;text-align:left;background:#2d2d32;border:1px solid #515158;border-radius:4px;box-shadow:6px 6px 0 #111114}.checkout-node small,.checkout-node strong,.checkout-node span{display:block}.checkout-node strong{margin:13px 0 10px}.checkout-node span{font:10px ui-monospace,monospace;color:var(--muted)}.checkout-node.status-passed{border-left:5px solid var(--ok)}.checkout-node.status-running{border-color:var(--accent);box-shadow:0 0 0 1px #28ad0055,0 0 24px #28ad0026;animation:running-node 1.7s ease-in-out infinite}.checkout-node.status-ready{border-left:5px solid var(--warning)}.checkout-node.status-failed{border-left:5px solid var(--danger)}.checkout-node.status-blocked{opacity:.62}.node-io-panel,.agent-interactions{margin-top:18px;padding:20px;border:1px solid var(--line);background:#1d1d20}.io-grid{display:grid;grid-template-columns:1fr 1fr;gap:1px;background:var(--line)}.io-grid>section{min-width:0;padding:18px;background:#202024}.io-grid h4{margin-top:0;text-transform:uppercase;font-size:10px;letter-spacing:.12em;color:#91dc7c}.io-grid pre{max-height:260px;overflow:auto;white-space:pre-wrap;background:#151518;padding:13px;font-size:11px}.artifact-path{overflow-wrap:anywhere;color:var(--muted);font:10px ui-monospace,monospace}.agent-interactions>header{display:flex;justify-content:space-between}.agent-question{padding:16px 0;border-top:1px solid var(--line)}.agent-question form{display:grid;grid-template-columns:1fr auto;gap:8px}.agent-question textarea{min-height:72px;padding:11px;background:#17171a;border:1px solid var(--line);color:var(--text);resize:vertical}.agent-answer{padding:12px;border-left:3px solid var(--accent);background:var(--accent-soft)}@keyframes running-node{50%{box-shadow:0 0 0 2px #28ad0080,0 0 30px #28ad0040}}
46
48
  .checkout-loop{position:absolute;z-index:0;border:1px dashed #28ad0099;background:#28ad0008;border-radius:8px;pointer-events:none}.checkout-loop b,.checkout-loop span{position:relative;top:-13px;display:inline-block;padding:3px 6px;background:#1b2818;font-size:9px}.checkout-loop span{color:#91dc7c;font-family:ui-monospace,monospace}.checkout-node{z-index:2}
47
49
  .classic-run{margin:20px 0;padding:24px;border:1px solid var(--line);background:#1d1d20}.classic-run h3{margin:8px 0;font-size:18px}.classic-run>p{max-width:720px;color:var(--muted);line-height:1.6}.classic-run .timeline{margin-top:20px}
48
50
  .wide-dialog{width:min(800px,calc(100vw - 40px))}dialog header{display:flex;align-items:flex-start;justify-content:space-between}dialog header h2{margin:4px 0 18px;font-size:24px;letter-spacing:-.03em}dialog header button{border:0;background:transparent;font-size:20px}dialog label{clear:both;font-size:12px;color:#c7c7cd}dialog input,dialog textarea{width:100%;margin:0 0 18px;padding:12px;border:1px solid #4b4b52;border-radius:3px;background:#19191c;font-size:14px;line-height:1.55}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field-grid.thirds{grid-template-columns:repeat(3,1fr)}.criteria-editor{min-height:170px}.advanced-goal{margin:16px 0;padding:16px;border:1px solid var(--line)}.advanced-goal summary{font-weight:650;margin-bottom:12px}.import-preview,.goal-review{margin:14px 0;padding:16px;border:1px solid var(--line);border-radius:3px;background:#1e1e22}.validation-message{color:#ff9999;line-height:1.55}.goal-state{position:relative;overflow:hidden;margin-bottom:18px;padding:12px;border-radius:3px}.goal-state.draft{background:#493817;color:#f4c46b}.goal-state.frozen{background:var(--accent-soft);color:#91dc7c}.goal-state.frozen::after{content:"❄";position:absolute;right:12px;animation:freeze-pop .7s ease-out both}@keyframes freeze-pop{from{opacity:0;transform:scale(2.4) rotate(-25deg)}to{opacity:1;transform:scale(1) rotate(0)}}.muted{color:var(--muted)}