ai-engineering-loop 1.9.0 → 1.9.3

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/README.md CHANGED
@@ -65,6 +65,8 @@ Workflow Studio makes agent work feel like a product, not a terminal session.
65
65
  - Add the next step directly from any node
66
66
  - Rename nodes in place without breaking their identity
67
67
  - Select, move, duplicate, or delete groups of nodes
68
+ - Turn selected steps into independent Loop Groups
69
+ - Label repeat and continue paths in plain language
68
70
  - Import and export workflow JSON safely
69
71
  - Create your own prompt-powered Agent nodes
70
72
 
@@ -74,12 +76,34 @@ Write the task in plain language, add the outcomes that matter, and **Freeze** t
74
76
 
75
77
  ### Follow every Run
76
78
 
77
- Runs have human-friendly names instead of cryptic hashes. Search previous work, inspect decisions, view evidence, and see exactly where a workflow stopped.
79
+ Runs have human-friendly names instead of cryptic hashes. Search previous work, open any Run as a read-only workflow, and see exactly where it stopped.
80
+
81
+ Select a node to inspect its real **Input**, **Output**, **Evidence**, and timeline. The canvas shows the actual status of every step, so completed work, failures, approvals, and waiting nodes are easy to understand.
82
+
83
+ ### Continue with your AI agent
84
+
85
+ Use **Copy for AI Agent** to create a ready-to-use handoff for the selected Run. The agent continues with the same Goal, workflow, and evidence instead of starting from scratch.
86
+
87
+ If the agent needs clarification, its questions can appear inside Workflow Studio. You answer them there, and the answer stays attached to the Run.
88
+
89
+ ### Repeat only the steps that need another pass
90
+
91
+ Create multiple independent Loop Groups in one workflow:
92
+
93
+ - Select the steps that belong together
94
+ - Choose where the loop starts and where the decision happens
95
+ - Give repeat and continue paths clear labels such as `NO · RETRY` and `YES · CONTINUE`
96
+ - Set a maximum number of passes
97
+ - Follow a separate `Iteration 2 / 3` counter for each group
98
+
99
+ When a loop reaches its limit, Workflow Studio pauses for approval. You can allow one focused extra pass, continue with the current evidence, or stop the Run safely. Nested and overlapping loops stay disabled so the workflow remains easy to read.
78
100
 
79
101
  ### Execute with confidence
80
102
 
81
103
  The Execute button lives beside the workflow trigger. A Run starts only when the Goal, workflow, mode, and safety checks are ready.
82
104
 
105
+ > **New in v1.9.0:** Run Checkout, AI Agent handoff, live Run questions, and Multiple Loop Groups. [See the release](https://github.com/egagofur/ai-engineering-loop/releases/tag/v1.9.0).
106
+
83
107
  ## One workspace from idea to delivery
84
108
 
85
109
  The experience is organized into four simple moments:
@@ -868,8 +868,13 @@ function handleRun() {
868
868
  let mode = modeArg ? normalizeMode(modeArg) : (startsNewRun ? policy.defaultMode : null);
869
869
  let workflow = null;
870
870
  let requestedRunId = null;
871
- if (recipeArg) {
872
- const { recipe } = loadRecipe(CWD, recipeArg);
871
+ const selectedRecipeId = recipeArg || (
872
+ startsNewRun
873
+ ? (mode === RUN_MODES.REPORT_ONLY ? 'audit' : 'default')
874
+ : null
875
+ );
876
+ if (selectedRecipeId) {
877
+ const { recipe } = loadRecipe(CWD, selectedRecipeId);
873
878
  if (!mode && current) mode = current.mode;
874
879
  if (startsNewRun && !modeArg && !recipe.compatibleModes.includes(mode)) {
875
880
  if (recipe.compatibleModes.length !== 1) {
@@ -47,17 +47,29 @@ function publicNode(node, state, index) {
47
47
 
48
48
  function runCheckout(rootDir, runId) {
49
49
  const run = loadRun(rootDir, runId);
50
+ const publicRun = {
51
+ runId: run.runId,
52
+ displayName: run.displayName,
53
+ task: run.task,
54
+ constraints: run.constraints || '',
55
+ state: run.state,
56
+ createdAt: run.createdAt,
57
+ updatedAt: run.updatedAt
58
+ };
59
+ if (!run.workflow) {
60
+ return redactedValue({
61
+ run: publicRun,
62
+ graphHash: null,
63
+ nodes: [],
64
+ edges: [],
65
+ loopGroups: [],
66
+ workflowBound: false,
67
+ readOnly: true
68
+ });
69
+ }
50
70
  const workflow = workflowStatus(rootDir, { runId });
51
71
  return redactedValue({
52
- run: {
53
- runId: run.runId,
54
- displayName: run.displayName,
55
- task: run.task,
56
- constraints: run.constraints || '',
57
- state: run.state,
58
- createdAt: run.createdAt,
59
- updatedAt: run.updatedAt
60
- },
72
+ run: publicRun,
61
73
  graphHash: workflow.plan.graphHash,
62
74
  nodes: workflow.plan.nodes.map((node, index) => publicNode(node, workflow.state, index)),
63
75
  edges: edgesFromPlan(workflow.plan),
@@ -65,6 +77,7 @@ function runCheckout(rootDir, runId) {
65
77
  ...group,
66
78
  runtime: workflow.state.loopGroups[group.id] || null
67
79
  })),
80
+ workflowBound: true,
68
81
  readOnly: true
69
82
  });
70
83
  }
@@ -6,11 +6,17 @@ const {
6
6
  TERMINAL_STATES,
7
7
  createRun,
8
8
  getCurrentRun,
9
+ loadRun,
9
10
  newRunId,
10
- normalizeRunMode
11
+ normalizeRunMode,
12
+ transitionRun
11
13
  } = require('./run-state.js');
12
14
  const { assertModeAllowed } = require('./runtime-policy.js');
13
- const { createWorkflowBundle, startWorkflowExecution } = require('./workflow-runtime.js');
15
+ const {
16
+ cancelWorkflowRun,
17
+ createWorkflowBundle,
18
+ startWorkflowExecution
19
+ } = require('./workflow-runtime.js');
14
20
 
15
21
  function studioRuntimeError(message, code) {
16
22
  const error = new Error(message);
@@ -37,10 +43,18 @@ function createStudioRun(
37
43
  assertModeAllowed(rootDir, normalizedMode);
38
44
  const current = getCurrentRun(rootDir);
39
45
  if (current && !TERMINAL_STATES.has(current.state)) {
40
- throw studioRuntimeError(
46
+ const error = studioRuntimeError(
41
47
  `Run ${current.runId} is already active; finish it before creating a sibling execution`,
42
48
  'ACTIVE_RUN'
43
49
  );
50
+ error.activeRun = {
51
+ runId: current.runId,
52
+ displayName: current.displayName,
53
+ task: current.task,
54
+ state: current.state,
55
+ updatedAt: current.updatedAt
56
+ };
57
+ throw error;
44
58
  }
45
59
  const loaded = loadRecipe(rootDir, recipeId);
46
60
  const plan = compileRecipe(loaded.recipe, { mode: normalizedMode });
@@ -70,4 +84,37 @@ function executeStudioRun(rootDir, runId, { now = new Date() } = {}) {
70
84
  return startWorkflowExecution(rootDir, { runId, now });
71
85
  }
72
86
 
73
- module.exports = { createStudioRun, executeStudioRun };
87
+ function cancelStudioRun(
88
+ rootDir,
89
+ runId,
90
+ { actor = 'human', reason = 'Replaced by a new Goal', now = new Date() } = {}
91
+ ) {
92
+ const run = loadRun(rootDir, runId);
93
+ if (TERMINAL_STATES.has(run.state)) {
94
+ throw studioRuntimeError(`Run ${runId} is already finished`, 'RUN_ALREADY_FINISHED');
95
+ }
96
+ const cleanActor = String(actor || '').trim();
97
+ const cleanReason = String(reason || '').trim();
98
+ if (!/^[A-Za-z0-9@._-]{1,64}$/.test(cleanActor)) {
99
+ throw studioRuntimeError('Cancellation actor must be a short account identifier', 'INVALID_RUN_ACTOR');
100
+ }
101
+ if (!cleanReason || cleanReason.length > 500) {
102
+ throw studioRuntimeError('Cancellation reason must be 1-500 characters', 'INVALID_CANCEL_REASON');
103
+ }
104
+ if (run.workflow) {
105
+ return cancelWorkflowRun(rootDir, {
106
+ runId,
107
+ actor: cleanActor,
108
+ reason: cleanReason,
109
+ now
110
+ }).run;
111
+ }
112
+ return transitionRun(rootDir, runId, 'CANCELLED', {
113
+ gate: 'run-cancelled',
114
+ reason: cleanReason,
115
+ historyMetadata: { actor: cleanActor },
116
+ now
117
+ });
118
+ }
119
+
120
+ module.exports = { cancelStudioRun, createStudioRun, executeStudioRun };
@@ -39,7 +39,7 @@ const {
39
39
  listRunInteractions
40
40
  } = require('./run-interactions.js');
41
41
  const { saveGoalDraft, freezeGoal, unfreezeGoal } = require('./goal-runtime.js');
42
- const { createStudioRun, executeStudioRun } = require('./studio-runtime.js');
42
+ const { cancelStudioRun, createStudioRun, executeStudioRun } = require('./studio-runtime.js');
43
43
  const { createHandoff, handoffBrief, recordDecision } = require('./handoff.js');
44
44
  const { loadStudioLayout, saveStudioLayout } = require('./studio-layout.js');
45
45
  const {
@@ -150,6 +150,7 @@ function createStudioServer(rootDir, { token = crypto.randomBytes(24).toString('
150
150
  const scopedRun = url.pathname.match(/^\/api\/runs\/([^/]+)$/);
151
151
  const scopedArtifact = url.pathname.match(/^\/api\/runs\/([^/]+)\/artifacts$/);
152
152
  const scopedExecute = url.pathname.match(/^\/api\/runs\/([^/]+)\/execute$/);
153
+ const scopedCancel = url.pathname.match(/^\/api\/runs\/([^/]+)\/cancel$/);
153
154
  const scopedGoal = url.pathname.match(/^\/api\/runs\/([^/]+)\/goal$/);
154
155
  const scopedGoalFreeze = url.pathname.match(/^\/api\/runs\/([^/]+)\/goal\/freeze$/);
155
156
  const scopedGoalUnfreeze = url.pathname.match(/^\/api\/runs\/([^/]+)\/goal\/unfreeze$/);
@@ -307,6 +308,13 @@ function createStudioServer(rootDir, { token = crypto.randomBytes(24).toString('
307
308
  const body = await readBody(request);
308
309
  const run = createStudioRun(rootDir, body);
309
310
  json(response, 201, { ok: true, run });
311
+ } else if (request.method === 'POST' && scopedCancel) {
312
+ const body = await readBody(request);
313
+ const run = cancelStudioRun(rootDir, decodeURIComponent(scopedCancel[1]), {
314
+ actor: body.actor || 'human',
315
+ reason: body.reason || 'Replaced by a new Goal'
316
+ });
317
+ json(response, 200, { ok: true, run });
310
318
  } else if (request.method === 'PATCH' && url.pathname === '/api/run/name') {
311
319
  const body = await readBody(request);
312
320
  const run = updateRunDisplayName(rootDir, body.runId, body.displayName, {
@@ -470,7 +478,13 @@ function createStudioServer(rootDir, { token = crypto.randomBytes(24).toString('
470
478
  response.end(fs.readFileSync(path.join(ASSET_DIR, asset)));
471
479
  }
472
480
  } catch (error) {
473
- json(response, 400, { ok: false, code: error.code || 'STUDIO_ERROR', error: error.message, details: error.details || [] });
481
+ json(response, 400, {
482
+ ok: false,
483
+ code: error.code || 'STUDIO_ERROR',
484
+ error: error.message,
485
+ details: error.details || [],
486
+ ...(error.activeRun ? { activeRun: error.activeRun } : {})
487
+ });
474
488
  }
475
489
  });
476
490
  return { server, token };
@@ -974,7 +974,23 @@ function applyWorkflowGate(rootDir, gate, { runId, now = new Date(), transitionO
974
974
  reason: null,
975
975
  activity: null
976
976
  }, now);
977
- if (gate === 'judge' && run.state === RUN_STATES.GOAL_FROZEN) {
977
+ const decisionGroup = gate === 'judge' ? loopForDecision(workflow.plan, node.id) : null;
978
+ const loopChanges = [];
979
+ if (decisionGroup && run.state === RUN_STATES.GOAL_FROZEN) {
980
+ const currentLoop = workflow.state.loopGroups[decisionGroup.id];
981
+ const nextIteration = currentLoop.iteration + 1;
982
+ changes = changes.concat(resetLoopNodes(workflow, decisionGroup, nextIteration, now));
983
+ loopChanges.push(loopChange(workflow, decisionGroup.id, {
984
+ status: 'RUNNING',
985
+ iteration: nextIteration,
986
+ lastOutcome: decisionGroup.repeatOutcome
987
+ }, now));
988
+ } else if (decisionGroup && run.state === RUN_STATES.JUDGED_PASS) {
989
+ loopChanges.push(loopChange(workflow, decisionGroup.id, {
990
+ status: 'EXITED',
991
+ lastOutcome: decisionGroup.exitOutcome
992
+ }, now));
993
+ } else if (gate === 'judge' && run.state === RUN_STATES.GOAL_FROZEN) {
978
994
  const maker = workflow.plan.nodes.find((candidate) => candidate.type === 'maker');
979
995
  for (const resetId of descendants(workflow.plan, maker.id)) {
980
996
  const current = workflow.state.nodes[resetId];
@@ -996,11 +1012,33 @@ function applyWorkflowGate(rootDir, gate, { runId, now = new Date(), transitionO
996
1012
  changes.push({ nodeId: candidate.id, from: current.status, node: replacement });
997
1013
  }
998
1014
  }
1015
+ if (decisionGroup) {
1016
+ loopChanges.push(loopChange(workflow, decisionGroup.id, {
1017
+ status: 'BLOCKED',
1018
+ lastOutcome: 'ESCALATE'
1019
+ }, now));
1020
+ }
999
1021
  }
1000
1022
  if (run.state !== RUN_STATES.ESCALATED) {
1001
1023
  changes = changes.concat(refreshNodes(workflow.plan, workflow.state, run));
1002
1024
  }
1003
- workflow = commitChanges(rootDir, workflow, 'GATE_PASSED', changes, { nodeId: node.id, gate }, now);
1025
+ workflow = commitChanges(
1026
+ rootDir,
1027
+ workflow,
1028
+ 'GATE_PASSED',
1029
+ changes,
1030
+ {
1031
+ nodeId: node.id,
1032
+ gate,
1033
+ ...(decisionGroup ? {
1034
+ groupId: decisionGroup.id,
1035
+ iteration: workflow.state.loopGroups[decisionGroup.id].iteration
1036
+ } : {})
1037
+ },
1038
+ now,
1039
+ false,
1040
+ loopChanges
1041
+ );
1004
1042
  return { run, workflow };
1005
1043
  });
1006
1044
  }
@@ -1009,6 +1047,53 @@ function workflowStatus(rootDir, { runId } = {}) {
1009
1047
  return loadWorkflow(rootDir, resolveRunId(rootDir, runId));
1010
1048
  }
1011
1049
 
1050
+ function cancelWorkflowRun(
1051
+ rootDir,
1052
+ { runId, actor = 'human', reason = 'Replaced by a new Goal', now = new Date() } = {}
1053
+ ) {
1054
+ const resolved = resolveRunId(rootDir, runId);
1055
+ return withWorkflowLock(rootDir, resolved, () => {
1056
+ let workflow = loadWorkflow(rootDir, resolved);
1057
+ if (!/^[A-Za-z0-9@._-]{1,64}$/.test(String(actor))) {
1058
+ throw runtimeError('Cancellation actor must be a short account identifier', 'INVALID_RUN_ACTOR');
1059
+ }
1060
+ const cleanReason = redactSecrets(String(reason || '').trim()).text;
1061
+ if (!cleanReason || cleanReason.length > 500) {
1062
+ throw runtimeError('Cancellation reason must be 1-500 characters', 'INVALID_CANCEL_REASON');
1063
+ }
1064
+ workflow.run = transitionRun(rootDir, resolved, RUN_STATES.CANCELLED, {
1065
+ gate: 'run-cancelled',
1066
+ reason: cleanReason,
1067
+ historyMetadata: { actor: String(actor) },
1068
+ now
1069
+ });
1070
+ const changes = [];
1071
+ for (const node of workflow.plan.nodes) {
1072
+ const current = workflow.state.nodes[node.id];
1073
+ if (!SUCCESS_STATES.has(current.status)) {
1074
+ changes.push(...nodeChanges(workflow, node.id, NODE_STATES.BLOCKED, {
1075
+ reason: cleanReason,
1076
+ activity: null
1077
+ }, now));
1078
+ }
1079
+ }
1080
+ const loopChanges = (workflow.plan.loopGroups || [])
1081
+ .filter((group) => !['EXITED', 'STOPPED'].includes(workflow.state.loopGroups[group.id]?.status))
1082
+ .map((group) => loopChange(workflow, group.id, { status: 'STOPPED' }, now));
1083
+ workflow = commitChanges(
1084
+ rootDir,
1085
+ workflow,
1086
+ 'RUN_CANCELLED',
1087
+ changes,
1088
+ { actor: String(actor), reason: cleanReason },
1089
+ now,
1090
+ false,
1091
+ loopChanges
1092
+ );
1093
+ return { run: workflow.run, workflow };
1094
+ });
1095
+ }
1096
+
1012
1097
  function unfreezeWorkflowGoal(rootDir, { runId, transitionOptions, now = new Date() } = {}) {
1013
1098
  const resolved = resolveRunId(rootDir, runId);
1014
1099
  return withWorkflowLock(rootDir, resolved, () => {
@@ -1085,6 +1170,7 @@ module.exports = {
1085
1170
  createWorkflowBundle,
1086
1171
  loadWorkflow,
1087
1172
  workflowStatus,
1173
+ cancelWorkflowRun,
1088
1174
  unfreezeWorkflowGoal,
1089
1175
  startWorkflowExecution,
1090
1176
  startWorkflowNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-engineering-loop",
3
- "version": "1.9.0",
3
+ "version": "1.9.3",
4
4
  "description": "A visual workspace that helps AI coding agents plan, build, review, and ship reliable software.",
5
5
  "main": "bin/ai-engineering-loop.js",
6
6
  "bin": {
@@ -1,9 +1,25 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "default",
4
- "version": 1,
4
+ "version": 2,
5
5
  "description": "The existing Maker, verification, Devil's Advocate, Judge, and delivery workflow.",
6
6
  "compatibleModes": ["ASSISTED", "UNATTENDED"],
7
+ "loopGroups": [
8
+ {
9
+ "id": "engineering-loop",
10
+ "displayName": "Build, verify, and review",
11
+ "nodeIds": ["maker", "verification", "review", "judge"],
12
+ "entryNodeId": "maker",
13
+ "decisionNodeId": "judge",
14
+ "repeatTargetId": "maker",
15
+ "exitTargetId": "delivery-approval",
16
+ "maxIterations": 3,
17
+ "repeatOutcome": "ITERATE",
18
+ "exitOutcome": "PASS",
19
+ "repeatLabel": "ITERATE · REWORK",
20
+ "exitLabel": "PASS · CONTINUE"
21
+ }
22
+ ],
7
23
  "nodes": [
8
24
  {
9
25
  "id": "goal",
@@ -43,7 +59,7 @@
43
59
  {
44
60
  "id": "delivery",
45
61
  "type": "delivery",
46
- "dependsOn": ["judge", "delivery-approval"]
62
+ "dependsOn": ["delivery-approval"]
47
63
  }
48
64
  ]
49
65
  }
package/studio/app.js CHANGED
@@ -37,6 +37,7 @@ let selectedCheckoutRun;
37
37
 
38
38
  const DISPLAY_NAME_MAX = 80;
39
39
  const ROOT_TYPES = new Set(['goal-contract', 'trigger']);
40
+ const TERMINAL_RUN_STATES = new Set(['DELIVERED', 'REPORTED', 'ESCALATED', 'CANCELLED']);
40
41
 
41
42
  function displayName(item) {
42
43
  return item?.displayName || item?.name || item?.id || 'Untitled';
@@ -1110,21 +1111,61 @@ async function ensureStudioRun() {
1110
1111
  return activeRunId;
1111
1112
  }
1112
1113
  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
- });
1114
+ const request = {
1115
+ task,
1116
+ constraints: byId('goal-constraints').value.trim(),
1117
+ displayName: byId('goal-run-name').value.trim(),
1118
+ recipeId: loadedRecipeId,
1119
+ mode: draft.compatibleModes.includes('ASSISTED') ? 'ASSISTED' : draft.compatibleModes[0]
1120
+ };
1121
+ let created;
1122
+ try {
1123
+ created = await api('/api/runs', {
1124
+ method: 'POST',
1125
+ body: JSON.stringify(request)
1126
+ });
1127
+ } catch (error) {
1128
+ if (error.payload?.code !== 'ACTIVE_RUN' || !error.payload.activeRun) throw error;
1129
+ const action = await resolveActiveRunConflict(error.payload.activeRun);
1130
+ if (action !== 'replace') return null;
1131
+ await api(`/api/runs/${encodeURIComponent(error.payload.activeRun.runId)}/cancel`, {
1132
+ method: 'POST',
1133
+ body: JSON.stringify({
1134
+ actor: 'human',
1135
+ reason: 'Ended in Studio before creating a new Goal'
1136
+ })
1137
+ });
1138
+ created = await api('/api/runs', {
1139
+ method: 'POST',
1140
+ body: JSON.stringify(request)
1141
+ });
1142
+ }
1123
1143
  activeRunId = created.run.runId;
1124
1144
  await refreshLive();
1125
1145
  return activeRunId;
1126
1146
  }
1127
1147
 
1148
+ function resolveActiveRunConflict(run) {
1149
+ return new Promise((resolve) => {
1150
+ const dialog = byId('active-run-dialog');
1151
+ byId('active-run-message').textContent = `${run.displayName || run.runId} · ${run.state}`;
1152
+ byId('continue-active-run').onclick = async () => {
1153
+ dialog.close();
1154
+ activeRunId = run.runId;
1155
+ byId('goal-dialog').close();
1156
+ showWorkspace('runs');
1157
+ await loadRuns();
1158
+ await loadRunDetail(run.runId);
1159
+ resolve('continue');
1160
+ };
1161
+ byId('replace-active-run').onclick = () => {
1162
+ dialog.close();
1163
+ resolve('replace');
1164
+ };
1165
+ dialog.showModal();
1166
+ });
1167
+ }
1168
+
1128
1169
  async function saveGoalFromForm() {
1129
1170
  try {
1130
1171
  const task = byId('goal-task').value.trim();
@@ -1142,6 +1183,7 @@ async function saveGoalFromForm() {
1142
1183
  return null;
1143
1184
  }
1144
1185
  const runId = await ensureStudioRun();
1186
+ if (!runId) return null;
1145
1187
  const contract = goalContractFromForm(runId);
1146
1188
  await api(`/api/runs/${encodeURIComponent(runId)}/goal`, {
1147
1189
  method: 'PUT',
@@ -1283,13 +1325,21 @@ async function loadRuns() {
1283
1325
  if (!runs.length) {
1284
1326
  list.innerHTML = '<div class="empty-state"><h2>No runs found</h2><p>Create a task from the workflow trigger.</p></div>';
1285
1327
  } else {
1286
- list.innerHTML = runs.map((run) => `
1287
- <button class="run-row" data-run-id="${escapeHtml(run.runId)}">
1328
+ const active = runs.find((run) => !TERMINAL_RUN_STATES.has(run.status));
1329
+ const historyRuns = runs.filter((run) => run.runId !== active?.runId);
1330
+ const row = (run, isActive = false) => `
1331
+ <button class="run-row${isActive ? ' active-run-row' : ''}" data-run-id="${escapeHtml(run.runId)}">
1288
1332
  <strong>${escapeHtml(run.displayName)}</strong>
1289
1333
  <span>${escapeHtml(run.status)} · ${escapeHtml(new Date(run.updatedAt).toLocaleString())}</span>
1290
1334
  <small>${escapeHtml(run.task)}</small>
1291
- </button>
1292
- `).join('');
1335
+ </button>`;
1336
+ list.innerHTML = [
1337
+ active ? `<div class="run-list-label"><i></i>Active now</div>${row(active, true)}` : '',
1338
+ `<div class="run-list-label history-label">History</div>`,
1339
+ historyRuns.length
1340
+ ? historyRuns.map((run) => row(run)).join('')
1341
+ : '<p class="muted run-list-empty">Completed Runs will stay here.</p>'
1342
+ ].join('');
1293
1343
  list.querySelectorAll('.run-row').forEach((button) => {
1294
1344
  button.onclick = () => loadRunDetail(button.dataset.runId);
1295
1345
  });
@@ -1302,6 +1352,17 @@ async function loadRuns() {
1302
1352
  }
1303
1353
  }
1304
1354
 
1355
+ function runHistoryMarkup(run) {
1356
+ const history = run.history || [];
1357
+ if (!history.length) return '<p class="muted">Waiting for the first Run event.</p>';
1358
+ return history.map((entry) => `
1359
+ <p>
1360
+ <time>${escapeHtml(new Date(entry.at).toLocaleString())}</time>
1361
+ <span><b>${escapeHtml(entry.to)}</b> · ${escapeHtml(entry.gate || 'run update')}</span>
1362
+ </p>
1363
+ `).join('');
1364
+ }
1365
+
1305
1366
  async function loadRunDetail(runId) {
1306
1367
  try {
1307
1368
  selectedCheckoutRun = runId;
@@ -1331,22 +1392,34 @@ async function loadRunDetail(runId) {
1331
1392
  const top = Math.min(...members.map((node) => node.position.y)) - 36;
1332
1393
  const right = Math.max(...members.map((node) => node.position.x + NODE_WIDTH)) + 28;
1333
1394
  const bottom = Math.max(...members.map((node) => node.position.y + 108)) + 28;
1334
- return `<div class="checkout-loop status-${escapeHtml((group.runtime?.status || 'pending').toLowerCase())}" style="left:${left}px;top:${top}px;width:${right - left}px;height:${bottom - top}px"><b>${escapeHtml(group.displayName)}</b><span>Iteration ${escapeHtml(group.runtime?.iteration || 1)} / ${escapeHtml(group.maxIterations)}</span></div>`;
1395
+ return `<div class="checkout-loop status-${escapeHtml((group.runtime?.status || 'pending').toLowerCase())}" data-checkout-loop="${escapeHtml(group.id)}" style="left:${left}px;top:${top}px;width:${right - left}px;height:${bottom - top}px"><b>${escapeHtml(group.displayName)}</b><span>Iteration ${escapeHtml(group.runtime?.iteration || 1)} / ${escapeHtml(group.maxIterations)}</span></div>`;
1335
1396
  }).join('');
1397
+ const checkoutBody = checkout.workflowBound
1398
+ ? `
1399
+ <section class="checkout-canvas" style="--checkout-width:${maxX}px;--checkout-height:${maxY}px">
1400
+ <svg viewBox="0 0 ${maxX} ${maxY}" aria-hidden="true">${paths}</svg>
1401
+ ${checkoutGroups}
1402
+ ${checkout.nodes.map((node) => `<button class="checkout-node status-${escapeHtml(node.status.toLowerCase())}" data-checkout-node="${escapeHtml(node.id)}" style="left:${node.position.x}px;top:${node.position.y}px">
1403
+ <small>${escapeHtml(node.type)}${node.loopIteration ? ` · LOOP ${escapeHtml(node.loopIteration)}` : ''}</small><strong>${escapeHtml(node.displayName)}</strong><span data-node-status>${escapeHtml(node.status)}</span>
1404
+ </button>`).join('')}
1405
+ </section>
1406
+ <section id="node-io-panel" class="node-io-panel"><div class="empty-state"><h3>Select a node</h3><p>Inspect its real Input, Output, Evidence, and Timeline.</p></div></section>
1407
+ `
1408
+ : `
1409
+ <section class="classic-run">
1410
+ <small>CLASSIC RUN · LIVE TRACKING</small>
1411
+ <h3>This Run started before automatic workflow binding was available.</h3>
1412
+ <p>Goal changes, stage gates, evidence, and Agent questions are still monitored here. New Runs show the full node canvas automatically.</p>
1413
+ <div id="classic-run-timeline" class="timeline">${runHistoryMarkup(run)}</div>
1414
+ </section>
1415
+ `;
1336
1416
  byId('run-detail').innerHTML = `
1337
1417
  <header class="checkout-header">
1338
- <div><button id="checkout-back" class="quiet">← Run History</button><small>READ-ONLY CHECKOUT · ${escapeHtml(run.status)}</small><h2>${escapeHtml(run.displayName)}</h2><p>${escapeHtml(run.task)}</p></div>
1339
- <div class="checkout-actions"><button id="copy-agent-handoff">Copy for AI Agent</button><button id="duplicate-run-workflow" class="primary">Duplicate as Workflow</button></div>
1418
+ <div><button id="checkout-back" class="quiet">← Run History</button><small>READ-ONLY CHECKOUT · <span id="checkout-run-status">${escapeHtml(run.status)}</span></small><h2>${escapeHtml(run.displayName)}</h2><p>${escapeHtml(run.task)}</p></div>
1419
+ <div class="checkout-actions"><button id="copy-agent-handoff">Copy for AI Agent</button>${checkout.workflowBound ? '<button id="duplicate-run-workflow" class="primary">Duplicate as Workflow</button>' : ''}</div>
1340
1420
  </header>
1341
- <div class="checkout-meta"><span>${escapeHtml(run.runId)}</span><span>${run.goalFrozen ? `Goal frozen V${escapeHtml(run.goalVersion)}` : 'Goal draft'}</span><span>Actual node states</span></div>
1342
- <section class="checkout-canvas" style="--checkout-width:${maxX}px;--checkout-height:${maxY}px">
1343
- <svg viewBox="0 0 ${maxX} ${maxY}" aria-hidden="true">${paths}</svg>
1344
- ${checkoutGroups}
1345
- ${checkout.nodes.map((node) => `<button class="checkout-node status-${escapeHtml(node.status.toLowerCase())}" data-checkout-node="${escapeHtml(node.id)}" style="left:${node.position.x}px;top:${node.position.y}px">
1346
- <small>${escapeHtml(node.type)}${node.loopIteration ? ` · LOOP ${escapeHtml(node.loopIteration)}` : ''}</small><strong>${escapeHtml(node.displayName)}</strong><span>${escapeHtml(node.status)}</span>
1347
- </button>`).join('')}
1348
- </section>
1349
- <section id="node-io-panel" class="node-io-panel"><div class="empty-state"><h3>Select a node</h3><p>Inspect its real Input, Output, Evidence, and Timeline.</p></div></section>
1421
+ <div class="checkout-meta"><span>${escapeHtml(run.runId)}</span><span id="checkout-goal-state">${run.goalFrozen ? `Goal frozen V${escapeHtml(run.goalVersion)}` : 'Goal draft'}</span><span>${checkout.workflowBound ? 'Actual node states' : 'Live stage history'}</span></div>
1422
+ ${checkoutBody}
1350
1423
  <section class="agent-interactions"><header><div><small>LIVE AGENT INTERACTIONS</small><h3>Questions from the Agent</h3></div><span>Updates automatically</span></header><div id="interaction-list"></div></section>
1351
1424
  `;
1352
1425
  renderInteractions(interactionResult.interactions);
@@ -1355,7 +1428,7 @@ async function loadRunDetail(runId) {
1355
1428
  byId('run-detail').innerHTML = '<div class="empty-state"><h2>Select a run</h2><p>Open a read-only checkout to inspect actual node evidence.</p></div>';
1356
1429
  };
1357
1430
  byId('copy-agent-handoff').onclick = () => copyAgentHandoff(runId);
1358
- byId('duplicate-run-workflow').onclick = async () => {
1431
+ if (checkout.workflowBound) byId('duplicate-run-workflow').onclick = async () => {
1359
1432
  try {
1360
1433
  const duplicate = await api(`/api/runs/${encodeURIComponent(runId)}/duplicate`, {
1361
1434
  method: 'POST',
@@ -1456,6 +1529,47 @@ async function refreshCheckoutInteractions() {
1456
1529
  }
1457
1530
  }
1458
1531
 
1532
+ async function refreshSelectedCheckout() {
1533
+ const runId = selectedCheckoutRun;
1534
+ if (!runId || !byId('checkout-run-status')) return;
1535
+ try {
1536
+ const [detail, checkoutResult] = await Promise.all([
1537
+ api(`/api/runs/${encodeURIComponent(runId)}`),
1538
+ api(`/api/runs/${encodeURIComponent(runId)}/checkout`)
1539
+ ]);
1540
+ if (selectedCheckoutRun !== runId) return;
1541
+ const run = detail.run;
1542
+ const checkout = checkoutResult.checkout;
1543
+ byId('checkout-run-status').textContent = run.status;
1544
+ byId('checkout-goal-state').textContent = run.goalFrozen
1545
+ ? `Goal frozen V${run.goalVersion}`
1546
+ : 'Goal draft';
1547
+ if (!checkout.workflowBound) {
1548
+ const timeline = byId('classic-run-timeline');
1549
+ if (timeline) timeline.innerHTML = runHistoryMarkup(run);
1550
+ return;
1551
+ }
1552
+ for (const node of checkout.nodes) {
1553
+ const element = document.querySelector(`[data-checkout-node="${CSS.escape(node.id)}"]`);
1554
+ if (!element) continue;
1555
+ for (const status of ['pending', 'ready', 'running', 'passed', 'failed', 'skipped', 'blocked']) {
1556
+ element.classList.remove(`status-${status}`);
1557
+ }
1558
+ element.classList.add(`status-${node.status.toLowerCase()}`);
1559
+ const status = element.querySelector('[data-node-status]');
1560
+ if (status) status.textContent = node.status;
1561
+ }
1562
+ for (const group of checkout.loopGroups || []) {
1563
+ const element = document.querySelector(`[data-checkout-loop="${CSS.escape(group.id)}"]`);
1564
+ if (!element) continue;
1565
+ const counter = element.querySelector('span');
1566
+ if (counter) counter.textContent = `Iteration ${group.runtime?.iteration || 1} / ${group.maxIterations}`;
1567
+ }
1568
+ } catch {
1569
+ // Keep the last valid checkout visible during a transient refresh failure.
1570
+ }
1571
+ }
1572
+
1459
1573
  async function copyAgentHandoff(runId = activeRunId) {
1460
1574
  try {
1461
1575
  if (!runId) await ensureStudioRun();
@@ -1736,7 +1850,9 @@ async function refreshLive() {
1736
1850
  syncGoalFromLive();
1737
1851
  await hydrateGoalFromLive();
1738
1852
  renderLive();
1853
+ await refreshSelectedCheckout();
1739
1854
  await refreshCheckoutInteractions();
1855
+ if (!byId('runs-view').hidden) await loadRuns();
1740
1856
  } catch {
1741
1857
  // A transient refresh failure must not discard the draft.
1742
1858
  }
package/studio/index.html CHANGED
@@ -183,6 +183,15 @@
183
183
  </footer>
184
184
  </form>
185
185
  </dialog>
186
+ <dialog id="active-run-dialog" class="resizable-dialog">
187
+ <header><div><small>ACTIVE RUN</small><h2>A Run is already in progress</h2></div></header>
188
+ <p id="active-run-message"></p>
189
+ <div class="goal-state draft">Starting a new Goal will end the current Run. Its history and evidence will remain available.</div>
190
+ <footer>
191
+ <button type="button" id="continue-active-run">Continue current Run</button>
192
+ <button type="button" id="replace-active-run" class="primary">End Run &amp; create new Goal</button>
193
+ </footer>
194
+ </dialog>
186
195
  <dialog id="loop-dialog" class="resizable-dialog">
187
196
  <form id="loop-form">
188
197
  <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
@@ -41,9 +41,10 @@ dialog{border:1px solid #505057;border-radius:4px;background:var(--panel);color:
41
41
  .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
42
  .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
43
  .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)}
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-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}}
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);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
46
  .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
+ .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}
47
48
  .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)}
48
49
  @media(max-width:900px){.run-summary,.secure,#workflow-settings{display:none}.inspector{width:min(360px,calc(100% - 76px))}.library{width:min(300px,calc(100% - 76px))}.canvas-help{display:none}.runs-header{display:block}.run-filters{flex-wrap:wrap}.run-search{width:100%;flex-basis:100%}.runs-layout{grid-template-columns:1fr}.field-grid,.field-grid.thirds,.io-grid{grid-template-columns:1fr}.workspace-tab{padding-inline:8px}.timeline p{grid-template-columns:1fr}.checkout-header{display:block}.checkout-actions{margin-top:14px}.resizable-dialog{min-width:calc(100vw - 24px)}}
49
50
  @media(prefers-reduced-motion:reduce){.edge.active,.goal-state.frozen::after{animation:none}.library,.inspector,.execution-panel,.node{transition:none}}