@andorra-labs/code 0.1.8 → 0.1.10

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.
Files changed (187) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -1
  2. package/dist/src/account-presentation.d.ts +11 -0
  3. package/dist/src/account-presentation.js +29 -2
  4. package/dist/src/agent-execution.js +57 -4
  5. package/dist/src/agent-mcp.d.ts +12 -0
  6. package/dist/src/agent-mcp.js +81 -2
  7. package/dist/src/app-server/protocol.d.ts +120 -1
  8. package/dist/src/app-server/protocol.js +8 -1
  9. package/dist/src/app-server/reasoning.d.ts +0 -8
  10. package/dist/src/app-server/reasoning.js +15 -28
  11. package/dist/src/app-server.d.ts +32 -0
  12. package/dist/src/app-server.js +214 -21
  13. package/dist/src/auth/AuthManager.d.ts +15 -0
  14. package/dist/src/auth/AuthManager.js +66 -7
  15. package/dist/src/auth/index.d.ts +1 -1
  16. package/dist/src/auth/index.js +1 -1
  17. package/dist/src/auth/store.d.ts +17 -1
  18. package/dist/src/auth/store.js +25 -2
  19. package/dist/src/browser-runner.js +1 -2
  20. package/dist/src/browser-server.js +10 -2
  21. package/dist/src/browser-session.js +6 -2
  22. package/dist/src/browser-stealth.d.ts +29 -0
  23. package/dist/src/browser-stealth.js +166 -0
  24. package/dist/src/browser-ui/app.js +123 -28
  25. package/dist/src/browser-ui/icons/chevron-right.svg +8 -0
  26. package/dist/src/browser-ui/index.html +8 -8
  27. package/dist/src/browser-ui/style.css +199 -171
  28. package/dist/src/browser-ui/tokens.css +198 -0
  29. package/dist/src/browser-view.d.ts +57 -9
  30. package/dist/src/browser-view.js +187 -36
  31. package/dist/src/cli.js +31 -9
  32. package/dist/src/coding-tools.js +9 -5
  33. package/dist/src/command-screens.js +4 -4
  34. package/dist/src/commands.d.ts +1 -1
  35. package/dist/src/commands.js +3 -2
  36. package/dist/src/completion-gates.d.ts +35 -0
  37. package/dist/src/completion-gates.js +25 -0
  38. package/dist/src/completion.d.ts +7 -1
  39. package/dist/src/completion.js +37 -4
  40. package/dist/src/config.d.ts +1 -1
  41. package/dist/src/config.js +2 -2
  42. package/dist/src/context-budget.d.ts +11 -0
  43. package/dist/src/context-budget.js +13 -0
  44. package/dist/src/decision/DecisionEngine.d.ts +5 -1
  45. package/dist/src/decision/DecisionManager.d.ts +1 -0
  46. package/dist/src/decision/DecisionManager.js +14 -3
  47. package/dist/src/decision/FactContinuations.d.ts +6 -0
  48. package/dist/src/decision/FactContinuations.js +9 -1
  49. package/dist/src/decision/FactServiceGate.js +1 -1
  50. package/dist/src/decision/checks.js +1 -1
  51. package/dist/src/decision/hostedSkills.d.ts +37 -0
  52. package/dist/src/decision/hostedSkills.js +64 -0
  53. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +10 -2
  54. package/dist/src/decision/providers/AndorraDecisionProvider.js +121 -10
  55. package/dist/src/default-graph.d.ts +11 -0
  56. package/dist/src/default-graph.js +20 -0
  57. package/dist/src/duration.d.ts +13 -2
  58. package/dist/src/duration.js +27 -3
  59. package/dist/src/file-diff.d.ts +105 -0
  60. package/dist/src/file-diff.js +244 -0
  61. package/dist/src/graph-manager-chat.d.ts +302 -0
  62. package/dist/src/graph-manager-chat.js +940 -0
  63. package/dist/src/graph-runner.js +6 -0
  64. package/dist/src/graph-server.d.ts +9 -0
  65. package/dist/src/graph-server.js +171 -20
  66. package/dist/src/graph-studio-features.js +2 -2
  67. package/dist/src/graph-sync.js +5 -2
  68. package/dist/src/graph-ui/app.js +369 -183
  69. package/dist/src/graph-ui/controls.css +55 -32
  70. package/dist/src/graph-ui/controls.js +85 -9
  71. package/dist/src/graph-ui/edge-router.js +114 -13
  72. package/dist/src/graph-ui/embed.js +32 -17
  73. package/dist/src/graph-ui/icons.js +1 -0
  74. package/dist/src/graph-ui/index.html +4 -4
  75. package/dist/src/graph-ui/library.css +4 -10
  76. package/dist/src/graph-ui/manager-markdown.js +155 -0
  77. package/dist/src/graph-ui/manager-state.js +191 -0
  78. package/dist/src/graph-ui/manager.css +161 -0
  79. package/dist/src/graph-ui/manager.js +700 -0
  80. package/dist/src/graph-ui/skill-picker.js +6 -6
  81. package/dist/src/graph-ui/studio-canvas.js +17 -15
  82. package/dist/src/graph-ui/studio.css +24 -23
  83. package/dist/src/graph-ui/studio.js +69 -48
  84. package/dist/src/graph-ui/style.css +128 -93
  85. package/dist/src/graph-ui/theme.js +2 -2
  86. package/dist/src/graph-ui/tokens.css +217 -151
  87. package/dist/src/graphs.d.ts +76 -2
  88. package/dist/src/graphs.js +172 -9
  89. package/dist/src/hardened-runtime.js +8 -2
  90. package/dist/src/mcp.d.ts +75 -0
  91. package/dist/src/mcp.js +240 -8
  92. package/dist/src/membership-errors.d.ts +14 -0
  93. package/dist/src/membership-errors.js +24 -1
  94. package/dist/src/membership.d.ts +20 -0
  95. package/dist/src/membership.js +45 -16
  96. package/dist/src/palette.d.ts +25 -8
  97. package/dist/src/palette.js +26 -8
  98. package/dist/src/provider-engine.d.ts +4 -4
  99. package/dist/src/provider-engine.js +39 -22
  100. package/dist/src/provider-keys.d.ts +5 -1
  101. package/dist/src/provider-keys.js +7 -3
  102. package/dist/src/provider-settings.d.ts +4 -1
  103. package/dist/src/provider-settings.js +46 -5
  104. package/dist/src/providers.d.ts +24 -0
  105. package/dist/src/providers.js +47 -2
  106. package/dist/src/qa/guidance.d.ts +26 -0
  107. package/dist/src/qa/guidance.js +46 -0
  108. package/dist/src/qa/index.d.ts +1 -8
  109. package/dist/src/qa/index.js +1 -16
  110. package/dist/src/qa/profile/QaProfile.d.ts +5 -1
  111. package/dist/src/qa/profile/QaProfile.js +6 -2
  112. package/dist/src/qa/runtime/ProcessManager.d.ts +20 -2
  113. package/dist/src/qa/runtime/ProcessManager.js +69 -13
  114. package/dist/src/qa/tools.d.ts +19 -1
  115. package/dist/src/qa/tools.js +20 -145
  116. package/dist/src/react-runtime.d.ts +11 -0
  117. package/dist/src/react-runtime.js +203 -53
  118. package/dist/src/remote/engine-pool.js +21 -6
  119. package/dist/src/run-progress.d.ts +6 -0
  120. package/dist/src/run-progress.js +7 -0
  121. package/dist/src/runtime.d.ts +8 -0
  122. package/dist/src/screen-selection.d.ts +38 -0
  123. package/dist/src/screen-selection.js +103 -0
  124. package/dist/src/session-changes.d.ts +117 -0
  125. package/dist/src/session-changes.js +796 -0
  126. package/dist/src/session-skills.d.ts +75 -0
  127. package/dist/src/session-skills.js +151 -0
  128. package/dist/src/side-panel.d.ts +1 -1
  129. package/dist/src/side-panel.js +6 -12
  130. package/dist/src/skill-commands.js +1 -1
  131. package/dist/src/skills/bundled/control-browser/SKILL.md +9 -1
  132. package/dist/src/skills/bundled/graph-manager/SKILL.md +8 -0
  133. package/dist/src/skills/bundled/provenance.json +3 -3
  134. package/dist/src/skills/bundled/web-gui-tester/SKILL.md +1 -1
  135. package/dist/src/stall-recovery.d.ts +33 -0
  136. package/dist/src/stall-recovery.js +83 -0
  137. package/dist/src/subagent-run.js +1 -2
  138. package/dist/src/telemetry/schema.d.ts +1 -1
  139. package/dist/src/telemetry/schema.js +1 -2
  140. package/dist/src/terminal-ui.d.ts +66 -22
  141. package/dist/src/terminal-ui.js +327 -92
  142. package/dist/src/tool-diff-stats.d.ts +9 -0
  143. package/dist/src/tool-diff-stats.js +20 -0
  144. package/dist/src/tool-names.d.ts +1 -1
  145. package/dist/src/tool-result-filter.js +1 -1
  146. package/dist/src/tools.js +26 -2
  147. package/dist/src/transcript.d.ts +11 -0
  148. package/dist/src/transcript.js +23 -3
  149. package/dist/src/types.d.ts +24 -4
  150. package/dist/src/usage-analytics.d.ts +7 -0
  151. package/dist/src/usage-analytics.js +55 -15
  152. package/docs/concepts/README.md +1 -1
  153. package/docs/concepts/limits.md +9 -0
  154. package/docs/guides/desktop-app.md +1 -1
  155. package/docs/guides/graph-builder.md +16 -1
  156. package/docs/guides/tui.md +9 -9
  157. package/docs/reference/slash-commands.md +2 -1
  158. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +203 -0
  159. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +79 -0
  160. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +182 -0
  161. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +156 -0
  162. package/package.json +1 -1
  163. package/tests/chat-side-panel-test-plan.md +1 -1
  164. package/dist/src/qa/api/http-runner.d.ts +0 -3
  165. package/dist/src/qa/api/http-runner.js +0 -47
  166. package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
  167. package/dist/src/qa/git/ChangeDetector.js +0 -177
  168. package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
  169. package/dist/src/qa/git/DiffReviewer.js +0 -115
  170. package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
  171. package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
  172. package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
  173. package/dist/src/qa/orchestrator/MergeGate.js +0 -40
  174. package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
  175. package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
  176. package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
  177. package/dist/src/qa/runners/CommandRunner.js +0 -96
  178. package/dist/src/qa/runners/TestRunner.d.ts +0 -21
  179. package/dist/src/qa/runners/TestRunner.js +0 -66
  180. package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
  181. package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
  182. package/dist/src/qa/runtime-detect.d.ts +0 -10
  183. package/dist/src/qa/runtime-detect.js +0 -72
  184. package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
  185. package/dist/src/qa/security/DependencyScanner.js +0 -167
  186. package/dist/src/qa/security/SecretScanner.d.ts +0 -3
  187. package/dist/src/qa/security/SecretScanner.js +0 -55
@@ -72,9 +72,9 @@
72
72
  }
73
73
 
74
74
  function problemText({ name, state }) {
75
- if (state === 'disabled') return `/${name} is turned off in Skills settings. The node still runs, without it.`;
76
- if (state === 'unavailable') return `/${name} is installed but cannot be loaded; repair it in Skills settings. The node still runs, without it.`;
77
- return `Skill /${name} not found on this machine. The node still runs, without it.`;
75
+ if (state === 'disabled') return `/${name} is turned off in Skills settings. The step still runs, without it.`;
76
+ if (state === 'unavailable') return `/${name} is installed but cannot be loaded; repair it in Skills settings. The step still runs, without it.`;
77
+ return `Skill /${name} not found on this machine. The step still runs, without it.`;
78
78
  }
79
79
 
80
80
  function matching(skills, query) {
@@ -123,7 +123,7 @@
123
123
  warnings.replaceChildren();
124
124
  for (const problem of problems(textarea.value, value)) {
125
125
  const row = el('p', undefined, 'skill-warning');
126
- row.title = 'A skill in a project\'s .agents/skills folder is found when the graph runs in that project. Install or turn on skills in Settings > Skills.';
126
+ row.title = 'A skill in a project\'s .agents/skills folder is found when the workflow runs in that project. Install or turn on skills in Settings > Skills.';
127
127
  const glyph = icon('warning'); if (glyph) row.append(glyph);
128
128
  row.append(el('span', problemText(problem)));
129
129
  warnings.append(row);
@@ -201,8 +201,8 @@
201
201
  }
202
202
  if (!found.length) {
203
203
  const text = !value ? `Skills could not be loaded${cache.error ? `: ${cache.error}` : ''}. A /name you type still runs.`
204
- : !value.skills.length ? 'No skills are installed on this machine. A /name you type is kept, and the node runs without a skill it cannot find.'
205
- : `No skill on this machine matches /${query.text}. You can keep it; the node runs without a skill it cannot find.`;
204
+ : !value.skills.length ? 'No skills are installed on this machine. A /name you type is kept, and the step runs without a skill it cannot find.'
205
+ : `No skill on this machine matches /${query.text}. You can keep it; the step runs without a skill it cannot find.`;
206
206
  list.append(el('p', text, 'help skill-picker-empty'));
207
207
  }
208
208
  panel.append(el('div', found.length ? 'Up/Down to choose, Enter to insert, Esc to close' : 'Esc to close', 'skill-picker-hint'));
@@ -39,7 +39,7 @@
39
39
  Object.assign(box.style, { left: x + 'px', top: y + 'px', width: w + 'px', height: h + 'px' });
40
40
  const title = make('button', group.name, 'studio-group-title');
41
41
  title.type = 'button';
42
- title.title = 'Select the nodes in this layout group';
42
+ title.title = 'Select the steps in this layout group';
43
43
  title.onclick = event => {
44
44
  event.stopPropagation();
45
45
  clearSelection(); state.selectedIds = nodes.map(node => node.id); state.selected = state.selectedIds.at(-1);
@@ -47,7 +47,7 @@
47
47
  };
48
48
  const remove = make('button', '×', 'studio-group-remove');
49
49
  remove.type = 'button';
50
- remove.title = 'Remove group, keeping its nodes';
50
+ remove.title = 'Remove group, keeping its steps';
51
51
  remove.onclick = event => {
52
52
  event.stopPropagation();
53
53
  mutate(() => { state.graph.metadata.studioLayoutGroupsV1 = state.graph.metadata.studioLayoutGroupsV1.filter(item => item.id !== group.id); }, true);
@@ -175,11 +175,11 @@
175
175
  const targetNode = document.elementFromPoint(e.clientX, e.clientY)?.closest('.node');
176
176
  const targetId = targetNode?.getAttribute('data-node-id');
177
177
  if (!targetId || targetId === sourceId || state.graph?.nodes[targetId]?.agentRole === 'orchestrator') {
178
- status('Drop a connection on a different destination node (not the Orchestrator).', true); return;
178
+ status('Drop a connection on a different destination step (not the Orchestrator).', true); return;
179
179
  }
180
180
  if (!state.graph?.nodes[sourceId] || !outcomes(state.graph.nodes[sourceId]).includes(outcome)) return;
181
181
  if (state.graph.edges.some(edge => edge.source === sourceId && edge.target === targetId && (edge.outcome || 'completed') === outcome)) {
182
- status('This connection already exists. Click its line to configure the handoff.'); return;
182
+ status('This connection already exists. Click its line to edit it.'); return;
183
183
  }
184
184
  mutate(() => {
185
185
  const edge = { id: 'edge-' + crypto.randomUUID().slice(0, 8), source: sourceId, target: targetId, outcome };
@@ -187,7 +187,7 @@
187
187
  clearSelection(); state.selectedEdge = edge;
188
188
  }, true);
189
189
  showInspector();
190
- status('Connection added. Configure its input handoff and save the graph.');
190
+ status('Connection added. Set its inputs and save the workflow.');
191
191
  };
192
192
  const cancel = e => {
193
193
  if (!active || !matchesPointer(e)) return;
@@ -278,7 +278,7 @@
278
278
  copied = { graphId: state.graph.id, nodes: snapshots, edges: copy(state.graph.edges.filter(edge => ids.has(edge.source) && ids.has(edge.target))),
279
279
  pendingProviderIds: selected.filter(node => state.pendingProviderNodes?.has(node.id)).map(node => node.id) };
280
280
  pasteOffset = 0;
281
- status('Copied ' + selected.length + ' nodes. Ctrl/Cmd+V pastes them.');
281
+ status('Copied ' + selected.length + ' steps. Ctrl/Cmd+V pastes them.');
282
282
  return true;
283
283
  }
284
284
  function pasteNodes() {
@@ -292,14 +292,14 @@
292
292
  // the same ID), or if the source was removed in the current graph.
293
293
  if (externalSources.length && (copied.graphId !== state.graph.id ||
294
294
  externalSources.some(source => !Object.hasOwn(state.graph.nodes, source)))) {
295
- status('Copy Condition nodes with their source nodes before pasting into another graph.', true);
295
+ status('Copy Condition steps with their source steps before pasting into another workflow.', true);
296
296
  return;
297
297
  }
298
298
  // The free-tier rules live in app.js; a page or harness without them has no allowance to apply.
299
299
  const freeRefusal = typeof freeNodeRefusal === 'function' ? freeNodeRefusal(copied.nodes) : undefined;
300
300
  if (freeRefusal) { status(freeRefusal, true); return; }
301
301
  if (Object.keys(state.graph.nodes).length + copied.nodes.length > nodeLimit(state.graph)) {
302
- status('Graph node limit reached. Remove nodes before pasting.', true); return;
302
+ status('Workflow step limit reached. Remove steps before pasting.', true); return;
303
303
  }
304
304
  pasteOffset += 40;
305
305
  const positions = copied.nodes.map(node => node.position || { x: 120, y: 120 });
@@ -315,7 +315,7 @@
315
315
  };
316
316
  const dx = shift('x'), dy = shift('y');
317
317
  if (dx === null || dy === null) {
318
- status('The selected node positions are outside the supported canvas bounds.', true); return;
318
+ status('The selected step positions are outside the supported canvas bounds.', true); return;
319
319
  }
320
320
  mutate(() => {
321
321
  const ids = new Map();
@@ -348,7 +348,7 @@
348
348
  clearSelection();
349
349
  state.selectedIds = [...ids.values()]; state.selected = state.selectedIds.at(-1);
350
350
  }, true);
351
- showInspector(); status('Pasted ' + copied.nodes.length + ' nodes and their internal connections.');
351
+ showInspector(); status('Pasted ' + copied.nodes.length + ' steps and their internal connections.');
352
352
  }
353
353
  function installKeyboard() {
354
354
  window.addEventListener('keydown', event => {
@@ -386,18 +386,18 @@
386
386
  * Keys are drawn as keycaps; a pointer gesture is said in words beside them.
387
387
  */
388
388
  const SHORTCUTS = [
389
- { keys: ['Ctrl/Cmd', 'C'], action: 'Copy nodes' }, { keys: ['Ctrl/Cmd', 'V'], action: 'Paste nodes' },
389
+ { keys: ['Ctrl/Cmd', 'C'], action: 'Copy steps' }, { keys: ['Ctrl/Cmd', 'V'], action: 'Paste steps' },
390
390
  { keys: ['Ctrl/Cmd', 'D'], action: 'Duplicate' }, { keys: ['Ctrl/Cmd', 'A'], action: 'Select all' },
391
391
  { keys: ['Ctrl/Cmd', 'G'], action: 'Group' }, { keys: ['Ctrl/Cmd', 'Z'], action: 'Undo' }, { keys: ['Ctrl/Cmd', 'Y'], action: 'Redo' },
392
392
  { keys: ['Shift'], gesture: 'drag the background', action: 'Marquee select' },
393
- { keys: [], gesture: 'Drag an output port to a node', action: 'Connect' },
393
+ { keys: [], gesture: 'Drag an output port to a step', action: 'Connect' },
394
394
  { keys: ['Delete'], action: 'Remove selection' },
395
395
  ];
396
396
  const shortcutText = item => [item.keys.join('+'), item.gesture].filter(Boolean).join(item.keys.length ? ' + ' : '');
397
397
  function showShortcuts() {
398
398
  const controls = globalThis.AndorraControls;
399
399
  if (typeof controls?.alert !== 'function') {
400
- alert('Graph Studio shortcuts:\n' + SHORTCUTS.map(item => shortcutText(item) + ': ' + item.action).join('\n'));
400
+ alert('Workflow Editor shortcuts:\n' + SHORTCUTS.map(item => shortcutText(item) + ': ' + item.action).join('\n'));
401
401
  return;
402
402
  }
403
403
  const list = document.createElement('dl');
@@ -415,7 +415,7 @@
415
415
  description.textContent = item.action;
416
416
  list.append(term, description);
417
417
  }
418
- void controls.alert({ title: 'Graph Studio shortcuts', content: list });
418
+ void controls.alert({ title: 'Workflow Editor shortcuts', content: list });
419
419
  }
420
420
 
421
421
  function installToolbar() {
@@ -436,7 +436,7 @@
436
436
  const canvas = byId('canvas');
437
437
  const map = svg('svg');
438
438
  map.id = 'studio-minimap'; map.setAttribute('viewBox', '0 0 160 100');
439
- map.setAttribute('role', 'img'); map.setAttribute('aria-label', 'Graph minimap. Click to center on an area.');
439
+ map.setAttribute('role', 'img'); map.setAttribute('aria-label', 'Workflow minimap. Click to center on an area.');
440
440
  canvas.append(map);
441
441
  }
442
442
  function refreshSnap() {
@@ -447,6 +447,8 @@
447
447
  }
448
448
  const previous = studio.canvas;
449
449
  studio.canvas = () => { previous?.(); makeGroups(); installPortDragging(); minimap(); };
450
+ // A dragged card carries its layout group's frame with it; the minimap follows on release.
451
+ studio.dragged = () => { makeGroups(); };
450
452
  installToolbar();
451
453
  marquee();
452
454
  installKeyboard();
@@ -5,11 +5,11 @@
5
5
  */
6
6
 
7
7
  /* Test and Runs: the two secondary actions that stay in the toolbar. */
8
- .studio-secondary[aria-pressed="true"] { background: var(--accent-soft); }
8
+ .studio-secondary[aria-pressed="true"] { background: var(--selected, var(--accent-soft)); }
9
9
 
10
10
  .studio-dialog {
11
11
  width: min(620px, calc(100vw - 40px)); max-height: min(84dvh, 860px);
12
- border: 1px solid var(--border); border-radius: var(--card-radius); padding: 0;
12
+ border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0;
13
13
  background: var(--bg-input); color: var(--text); box-shadow: var(--shadow-menu);
14
14
  }
15
15
  .studio-dialog.wide { width: min(840px, calc(100vw - 40px)); }
@@ -24,14 +24,14 @@
24
24
 
25
25
  .studio-code {
26
26
  margin: 8px 0 0; width: 100%; padding: 12px; border: 1px solid var(--border);
27
- background: var(--bg-card); border-radius: 8px; color: var(--text);
27
+ background: var(--bg-card); border-radius: var(--radius-md); color: var(--text);
28
28
  font-size: var(--type-xs); line-height: 1.5; font-family: var(--font-mono); white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; max-height: 380px;
29
29
  }
30
30
 
31
31
  .studio-template { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
32
32
  .studio-template > button { min-width: 132px; text-align: left; }
33
33
  .studio-template p { margin: 0; color: var(--text-2); line-height: 1.45; }
34
- .studio-history-row { padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
34
+ .studio-history-row { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); }
35
35
  .studio-history-row > strong { display: block; margin-bottom: 4px; }
36
36
  .studio-history-row .help { margin: 4px 0 10px; }
37
37
  .studio-history-row > button { margin-right: 8px; }
@@ -51,25 +51,25 @@
51
51
  .studio-run-log { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: stretch; padding: 5px 14px 12px; }
52
52
  .studio-run-event {
53
53
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; text-align: left; padding: 6px 8px;
54
- font-family: var(--font-mono); font-size: var(--type-xs); line-height: 1.4; white-space: normal; background: transparent; color: var(--text-2);
54
+ font-family: var(--font-mono); font-size: var(--type-xs); font-weight: var(--weight-regular); line-height: 1.4; white-space: normal; background: transparent; color: var(--text-2);
55
55
  }
56
- .studio-run-event:hover { background: var(--bg-card); }
56
+ .studio-run-event:hover:not(:disabled) { background: var(--hover, var(--bg-card)); }
57
57
 
58
58
  #canvas .studio-group-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 0; }
59
59
  #canvas .studio-group {
60
60
  position: absolute; background: var(--accent-soft); border: 1px dashed var(--border-strong);
61
- border-radius: 14px; pointer-events: none;
61
+ border-radius: var(--radius-lg); pointer-events: none;
62
62
  }
63
63
  #canvas .studio-group-title {
64
64
  position: absolute; top: 5px; left: 8px; border: 0; background: var(--bg-input);
65
- color: var(--text-2); padding: 2px var(--space-2); min-height: 0; border-radius: var(--row-radius); font-size: var(--type-label); pointer-events: auto;
65
+ color: var(--text-2); padding: 2px var(--space-2); min-height: 0; border-radius: var(--radius-xs); font-size: var(--type-label); pointer-events: auto;
66
66
  }
67
67
  #canvas .studio-group-remove {
68
68
  position: absolute; top: 5px; right: 8px; border: 0; background: var(--bg-input);
69
- color: var(--text-2); padding: 1px var(--space-2); min-height: 0; border-radius: var(--row-radius); pointer-events: auto;
69
+ color: var(--text-2); padding: 1px var(--space-2); min-height: 0; border-radius: var(--radius-xs); pointer-events: auto;
70
70
  }
71
71
  #canvas .studio-wire-preview { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 7; }
72
- #canvas .studio-marquee { position: absolute; border: 1px solid var(--accent); background: var(--accent-soft); pointer-events: none; z-index: 7; }
72
+ #canvas .studio-marquee { position: absolute; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-xs); pointer-events: none; z-index: 7; }
73
73
 
74
74
  #studio-minimap {
75
75
  position: absolute; bottom: var(--space-4); right: var(--space-4); width: 160px; height: 100px;
@@ -77,21 +77,20 @@
77
77
  box-shadow: var(--shadow-menu); z-index: 4; cursor: crosshair; overflow: hidden;
78
78
  }
79
79
  /* The map is a sketch of the canvas: nodes are quiet blocks in the card's own outline colour, so
80
- the viewport's frame is the brightest thing on it. */
80
+ the viewport's frame is the brightest thing on it. Like the cards, an end carries no hue. */
81
81
  #studio-minimap .studio-minimap-node { fill: var(--border-strong); stroke: none; rx: 2px; }
82
- #studio-minimap .studio-minimap-end { fill: var(--ok); stroke: none; rx: 2px; opacity: .8; }
82
+ #studio-minimap .studio-minimap-end { fill: var(--text-3); stroke: none; rx: 2px; opacity: .6; }
83
83
  /* The viewport is a faint wash. A webview without `color-mix()` keeps the fallback, which leaves
84
84
  the rectangle unfilled rather than drawing it as a solid block. */
85
85
  #studio-minimap .studio-minimap-viewport { fill: transparent; fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--border-strong); stroke-width: 1; rx: 3px; vector-effect: non-scaling-stroke; pointer-events: none; }
86
86
 
87
- /* Node run states. The live state is the register's own "alive" colour; the settled states are
88
- the two colours the chrome allows, done and error. */
89
- .node.studio-node-preview { box-shadow: 0 0 0 2px var(--warn); }
90
- .node.studio-node-running { box-shadow: 0 0 0 2px var(--accent); animation: studio-pulse 1.5s ease-in-out infinite; }
91
- .node.studio-node-complete { box-shadow: 0 0 0 2px var(--ok); }
92
- .node.studio-node-failed { box-shadow: 0 0 0 2px var(--err); }
93
- .node.studio-node-cancelled { box-shadow: 0 0 0 2px var(--text-3); }
94
- @keyframes studio-pulse { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }
87
+ /* Node run states: a steady 2px ring, with no glow and nothing that loops. The live state is the
88
+ ink accent; the settled states are the two colours the chrome allows, done and error. */
89
+ .node.studio-node-preview { box-shadow: var(--lift-2), 0 0 0 2px var(--warn); }
90
+ .node.studio-node-running { box-shadow: var(--lift-2), 0 0 0 2px var(--accent); }
91
+ .node.studio-node-complete { box-shadow: var(--lift-2), 0 0 0 2px var(--ok); }
92
+ .node.studio-node-failed { box-shadow: var(--lift-2), 0 0 0 2px var(--err); }
93
+ .node.studio-node-cancelled { box-shadow: var(--lift-2), 0 0 0 2px var(--text-3); }
95
94
 
96
95
  #inspector .studio-code { max-height: 280px; }
97
96
  #inspector-body > .section button { white-space: normal; }
@@ -106,7 +105,9 @@
106
105
  .studio-run-panel { flex-basis: 180px; height: 180px; }
107
106
  .studio-dialog-body { padding: var(--space-3); }
108
107
  }
109
- @media (prefers-reduced-motion: reduce) { .node.studio-node-running, .node.node-error-pulse { animation: none; } }
108
+ @media (prefers-reduced-motion: reduce) { .node.node-error-pulse { animation: none; } }
110
109
 
111
- /* The route a run has already taken is drawn in the accent, like the traced connection. */
112
- #edges path.studio-route-visited { stroke: var(--accent); stroke-width: 3; opacity: 1; }
110
+ /* The route a run has already taken is drawn in the accent, like the traced connection; the route
111
+ into a node that failed is the one connection drawn in red. */
112
+ #edges path.studio-route-visited { stroke: var(--accent); stroke-width: 2; opacity: 1; }
113
+ #edges path.studio-route-visited.studio-route-failed { stroke: var(--err); }
@@ -2,6 +2,10 @@
2
2
  (() => {
3
3
  'use strict';
4
4
  const $studio = id => document.getElementById(id);
5
+ // A dialog or menu leaves the way it came (controls.js); a page without that layer (a harness)
6
+ // closes it at once.
7
+ const shut = dialog => (typeof globalThis.AndorraControls?.closeDialog === 'function' ? globalThis.AndorraControls.closeDialog(dialog) : dialog.close());
8
+ const leave = (layer, done) => (typeof globalThis.AndorraControls?.leave === 'function' ? globalThis.AndorraControls.leave(layer, done) : (done(), () => {}));
5
9
  const element = (tag, content, className) => {
6
10
  const node = document.createElement(tag);
7
11
  if (content !== undefined) node.textContent = String(content);
@@ -22,7 +26,7 @@
22
26
  function modal(title, build, wide = false) {
23
27
  const dialog = element('dialog', undefined, 'studio-dialog' + (wide ? ' wide' : ''));
24
28
  const head = element('header', undefined, 'studio-dialog-head');
25
- head.append(element('strong', title), action('Close', () => dialog.close()));
29
+ head.append(element('strong', title), action('Close', () => shut(dialog)));
26
30
  const body = element('div', undefined, 'studio-dialog-body');
27
31
  dialog.append(head, body);
28
32
  document.body.append(dialog);
@@ -102,12 +106,12 @@
102
106
  }
103
107
  function describeDiff(before, after) {
104
108
  const delta = diffGraph(before, after);
105
- return 'Added nodes: ' + (delta.added.join(', ') || 'none') +
106
- '\nRemoved nodes: ' + (delta.removed.join(', ') || 'none') +
107
- '\nChanged nodes: ' + (delta.changed.join(', ') || 'none') +
109
+ return 'Added steps: ' + (delta.added.join(', ') || 'none') +
110
+ '\nRemoved steps: ' + (delta.removed.join(', ') || 'none') +
111
+ '\nChanged steps: ' + (delta.changed.join(', ') || 'none') +
108
112
  '\nConnections added: ' + delta.edgesAdded +
109
113
  '\nConnections removed: ' + delta.edgesRemoved +
110
- '\nGraph settings changed: ' + (JSON.stringify({
114
+ '\nWorkflow settings changed: ' + (JSON.stringify({
111
115
  name: before.name, entry: before.entry, limits: before.limits, widgets: before.widgets,
112
116
  inputSchema: before.inputSchema, stateSchema: before.stateSchema, metadata: before.metadata
113
117
  }) !== JSON.stringify({
@@ -129,7 +133,7 @@
129
133
  state.pendingProviderNodes = null;
130
134
  install?.();
131
135
  render(); fit();
132
- status(message || 'Draft loaded. Save a revision to publish it.');
136
+ status(message || 'Draft loaded. Save it to publish it.');
133
137
  return true;
134
138
  }
135
139
 
@@ -139,7 +143,7 @@
139
143
  async function importGraphJson(data) {
140
144
  if (typeof canCreateGraph === 'function' && !canCreateGraph()) throw new Error(FREE_CREATE_TIP);
141
145
  if (!data || typeof data !== 'object' || Array.isArray(data) || !data.nodes || typeof data.nodes !== 'object'
142
- || Array.isArray(data.nodes) || !Array.isArray(data.edges)) throw new Error('The file is not an Andorra graph.');
146
+ || Array.isArray(data.nodes) || !Array.isArray(data.edges)) throw new Error('The file is not an Andorra workflow.');
143
147
  const next = { ...data, id: newId(), revision: 0 };
144
148
  delete next.editorMigration;
145
149
  delete next.pendingProviderNodes; // a shared file never carries this editor's draft marker
@@ -154,42 +158,45 @@
154
158
  const pending = Object.values(validated.graph.nodes)
155
159
  .filter(node => node.type === 'agent' && !node.provider).map(node => node.id);
156
160
  if (await applyDraft(validated.graph, pending.length
157
- ? 'Imported graph. Assign a model profile to every outlined node, then save.'
158
- : 'Imported graph validated. Save its first revision.',
161
+ ? 'Imported workflow. Assign a model profile to every outlined step, then save.'
162
+ : 'Imported workflow validated. Save it to keep it.',
159
163
  // The install runs after applyDraft's marker-stripping copy, so the requirements are
160
164
  // mirrored onto the live draft here — that mirror is what an autosave persists and a
161
165
  // later draft recovery restores.
162
- () => { state.pendingProviderNodes = new Set(pending); if (typeof syncImportRequirementsMarker === 'function') syncImportRequirementsMarker(); })) return true;
166
+ () => { state.pendingProviderNodes = new Set(pending); if (typeof syncImportRequirementsMarker === 'function') syncImportRequirementsMarker(); })) {
167
+ if (typeof graphOpened === 'function') graphOpened('import');
168
+ return true;
169
+ }
163
170
  return false;
164
171
  }
165
172
  async function importGraphFile(file) {
166
173
  if (!file) throw new Error('Choose a JSON file first.');
167
- if (file.size > 450 * 1024) throw new Error('The JSON file exceeds the graph size limit.');
174
+ if (file.size > 450 * 1024) throw new Error('The JSON file exceeds the workflow size limit.');
168
175
  return importGraphJson(JSON.parse(await file.text()));
169
176
  }
170
177
 
171
178
  function openImport() {
172
- modal('Import graph JSON', body => {
173
- paragraph(body, 'Import creates a new graph ID and never overwrites the original graph. Only validated graph JSON is accepted.');
179
+ modal('Import workflow JSON', body => {
180
+ paragraph(body, 'Import creates a new workflow ID and never overwrites the original workflow. Only validated workflow JSON is accepted.');
174
181
  // The app's drop zone and Browse button; the platform's bare file input only where that
175
182
  // layer is absent.
176
183
  const picker = typeof globalThis.AndorraControls?.filePicker === 'function'
177
- ? globalThis.AndorraControls.filePicker({ accept: '.json,application/json', label: 'Choose a graph JSON file', hint: 'or drop it here · up to 450 KB' })
184
+ ? globalThis.AndorraControls.filePicker({ accept: '.json,application/json', label: 'Choose a workflow JSON file', hint: 'or drop it here · up to 450 KB' })
178
185
  : (() => {
179
186
  const input = element('input');
180
187
  input.type = 'file';
181
188
  input.accept = '.json,application/json';
182
- input.setAttribute('aria-label', 'Choose graph JSON');
189
+ input.setAttribute('aria-label', 'Choose workflow JSON');
183
190
  return { element: input, file: () => input.files?.[0] };
184
191
  })();
185
192
  const feedback = element('p', '', 'help');
186
193
  feedback.setAttribute('role', 'status');
187
194
  body.append(picker.element, feedback);
188
- body.append(action('Import as new graph', async () => {
195
+ body.append(action('Import as New Workflow', async () => {
189
196
  const chosen = picker.file();
190
197
  if (!chosen) throw new Error('Choose a JSON file first.');
191
198
  if (await importGraphFile(chosen)) {
192
- feedback.textContent = 'Import complete: new unsaved graph ready.';
199
+ feedback.textContent = 'Import complete: new unsaved workflow ready.';
193
200
  }
194
201
  }, 'primary'));
195
202
  });
@@ -241,7 +248,7 @@
241
248
  } else base.name = 'QA Gate';
242
249
  }
243
250
  const validated = await api('/api/validate', { graph: base });
244
- await applyDraft(validated.graph, 'Template created. Review permissions and save a revision.');
251
+ await applyDraft(validated.graph, 'Template created. Review permissions and save.');
245
252
  }
246
253
 
247
254
  function openTemplates() {
@@ -269,17 +276,17 @@
269
276
  const rows = await api('/api/graphs/' + encodeURIComponent(graphId) + '/revisions');
270
277
  // A different graph may have been opened before the revision list loaded.
271
278
  if (state.graph !== graphAtOpen || graphFingerprint() !== fingerprint) return;
272
- modal('Saved revision history', (body, dialog) => {
279
+ modal('Version history', (body, dialog) => {
273
280
  const controller = new AbortController();
274
281
  dialog.addEventListener('close', () => controller.abort(), { once: true });
275
282
  const current = () => !controller.signal.aborted && dialog.open &&
276
283
  state.graph === graphAtOpen && graphFingerprint() === fingerprint;
277
- paragraph(body, 'Snapshots are immutable. Restoring a past revision opens a draft; saving creates a new revision.');
278
- if (!rows.length) { paragraph(body, 'No saved revisions. Save this graph first.'); return; }
284
+ paragraph(body, 'Snapshots are immutable. Restoring a past version opens a draft; saving creates a new version.');
285
+ if (!rows.length) { paragraph(body, 'No saved versions. Save this workflow first.'); return; }
279
286
  for (const row of rows) {
280
287
  const item = element('section', undefined, 'studio-history-row');
281
- item.append(element('strong', 'Revision ' + row.revision + ' · ' + row.name));
282
- paragraph(item, row.nodeCount + ' nodes · ' + row.edgeCount + ' connections' +
288
+ item.append(element('strong', 'Version ' + row.revision + ' · ' + row.name));
289
+ paragraph(item, row.nodeCount + ' steps · ' + row.edgeCount + ' connections' +
283
290
  (row.updatedAt ? ' · ' + new Date(row.updatedAt).toLocaleString() : ''));
284
291
  const detail = element('pre', '', 'studio-code');
285
292
  const fetchRevision = async () => {
@@ -292,14 +299,14 @@
292
299
  if (!snapshot || !current()) return;
293
300
  detail.textContent = describeDiff(snapshot, graphAtOpen);
294
301
  }));
295
- item.append(action('Restore as draft', async () => {
302
+ item.append(action('Restore as Draft', async () => {
296
303
  if (!current()) return;
297
304
  const snapshot = await fetchRevision();
298
305
  if (!snapshot || !current()) return;
299
306
  const next = { ...snapshot, id: graphId === 'default' ? newId() : graphId,
300
307
  revision: graphId === 'default' ? 0 : baseRevision };
301
- if (await applyDraft(next, 'Restored revision ' + row.revision + ' into a draft. Save to publish it.')) {
302
- dialog.close();
308
+ if (await applyDraft(next, 'Restored version ' + row.revision + ' into a draft. Save to publish it.')) {
309
+ shut(dialog);
303
310
  }
304
311
  }, 'primary'));
305
312
  item.append(detail);
@@ -335,7 +342,7 @@
335
342
  body.append(row);
336
343
  }
337
344
  const results = element('pre', '', 'studio-code');
338
- body.append(action('Preview routing', async () => {
345
+ body.append(action('Preview Routing', async () => {
339
346
  const choices = {};
340
347
  for (const [id, select] of inputs) choices[id] = select.value ? { outcome: select.value } : {};
341
348
  for (const [id, input] of mockOutputs) {
@@ -349,7 +356,7 @@
349
356
  const fingerprint = graphFingerprint();
350
357
  const candidate = await api('/api/preview', { graph: state.graph, choices });
351
358
  if (!acceptPreviewIfCurrent(candidate, fingerprint)) {
352
- results.textContent = 'Graph changed during preview. Run the preview again against the updated draft.';
359
+ results.textContent = 'Workflow changed during preview. Run the preview again against the updated draft.';
353
360
  return;
354
361
  }
355
362
  const steps = preview.steps.map((step, i) => (i + 1) + '. ' + step.nodeName + ' → ' + step.outcome +
@@ -362,8 +369,8 @@
362
369
  renderCanvas();
363
370
  }, 'primary'));
364
371
  body.append(results);
365
- body.append(action('How to run live', () => {
366
- paragraph(body, 'Open Andorra Code in your project, select the saved graph using /graph, then enter your task. The CLI retains its normal permission and approval gates. Save the draft first.');
372
+ body.append(action('How to Run Live', () => {
373
+ paragraph(body, 'Open Andorra Code in your project, select the saved workflow using /graph, then enter your task. The CLI retains its normal permission and approval gates. Save the draft first.');
367
374
  }));
368
375
  }, true);
369
376
  }
@@ -392,16 +399,16 @@
392
399
  if (node?.type === 'agent') {
393
400
  const region = section(parent, 'Context preview');
394
401
  paragraph(region, 'Inspect configured instructions, context sharing, permissions, and approximate prompt size. Runtime messages may differ.');
395
- region.append(action('Preview effective settings', () => {
402
+ region.append(action('Preview Effective Settings', () => {
396
403
  const pre = element('pre', contextPreview(node), 'studio-code');
397
404
  region.replaceChildren(pre);
398
- region.prepend(action('Refresh preview', () => { pre.textContent = contextPreview(node); }));
405
+ region.prepend(action('Refresh Preview', () => { pre.textContent = contextPreview(node); }));
399
406
  }));
400
407
  }
401
408
  if (node && liveEvents.length && runMatchesCanvas()) {
402
409
  const events = liveEvents.filter(event => event.nodeId === node.id);
403
410
  if (events.length) {
404
- const region = section(parent, 'Selected run — node activity');
411
+ const region = section(parent, 'Selected run — step activity');
405
412
  const totals = nodeActivityTotals(events);
406
413
  const completion = events.filter(event => event.type === 'graph.node.completed').at(-1);
407
414
  paragraph(region, 'Latest outcome: ' + (completion?.outcome || 'pending') +
@@ -425,7 +432,7 @@
425
432
  for (const key of targets) { const opt = element('option', key); opt.value = key; dest.append(opt); }
426
433
  for (const key of sources) { const opt = element('option', key); opt.value = key; source.append(opt); }
427
434
  region.append(element('span', 'Destination field'), dest, element('span', 'Source output field'), source);
428
- region.append(action('Create mapping', () => {
435
+ region.append(action('Create Mapping', () => {
429
436
  mutate(() => { edge.inputMapping ||= {}; edge.inputMapping[dest.value] = '$source.output.' + source.value; }, true);
430
437
  renderInspector();
431
438
  }, 'primary'));
@@ -433,7 +440,7 @@
433
440
  }
434
441
  if (selectedNodes().length > 1) {
435
442
  const region = section(parent, 'Layout group');
436
- region.append(action('Group selected nodes (Ctrl/Cmd+G)', createGroup));
443
+ region.append(action('Group Selected Steps (Ctrl/Cmd+G)', createGroup));
437
444
  }
438
445
  }
439
446
 
@@ -445,13 +452,13 @@
445
452
 
446
453
  async function createGroup() {
447
454
  const nodes = selectedNodes().filter(node => node.agentRole !== 'orchestrator');
448
- if (nodes.length < 2) { status('Select at least two nodes to group.', true); return; }
455
+ if (nodes.length < 2) { status('Select at least two steps to group.', true); return; }
449
456
  const ids = new Set(nodes.map(node => node.id));
450
457
  if (!canCreateLayoutGroup(state.graph?.metadata?.studioLayoutGroupsV1 || [], ids)) {
451
- status('A graph supports at most 50 layout groups. Remove or merge a group before creating another.', true);
458
+ status('A workflow supports at most 50 layout groups. Remove or merge a group before creating another.', true);
452
459
  return;
453
460
  }
454
- const name = await askText({ title: 'Name this layout group', label: 'Layout group name', value: 'New group', confirmLabel: 'Create group', maxLength: 80 });
461
+ const name = await askText({ title: 'Name this layout group', label: 'Layout group name', value: 'New group', confirmLabel: 'Create Group', maxLength: 80 });
455
462
  if (!name) return;
456
463
  if (!name.trim() || name.length > 80) { status('Group names must contain 1–80 characters.', true); return; }
457
464
  mutate(() => {
@@ -462,7 +469,7 @@
462
469
  id: 'group-' + crypto.randomUUID().slice(0, 8), name: name.trim(), nodeIds: [...ids],
463
470
  }];
464
471
  }, true);
465
- status('Layout group created. Groups are saved with the graph.');
472
+ status('Layout group created. Groups are saved with the workflow.');
466
473
  }
467
474
 
468
475
  function renderDebugger() {
@@ -472,16 +479,16 @@
472
479
  const log = $studio('studio-run-log');
473
480
  if (!debuggerOpen || !log) return;
474
481
  log.replaceChildren();
475
- if (!selectedRun) { paragraph(log, 'Select a saved run to inspect its node transitions.'); return; }
482
+ if (!selectedRun) { paragraph(log, 'Select a saved run to inspect its step transitions.'); return; }
476
483
  const matchesCanvas = runMatchesCanvas();
477
484
  if (!matchesCanvas && liveEvents.length) {
478
- paragraph(log, 'Historical run differs from the current graph revision or unsaved draft. Canvas overlays and node navigation are disabled.');
485
+ paragraph(log, 'Historical run differs from the current workflow version or unsaved draft. Canvas overlays and step navigation are disabled.');
479
486
  }
480
487
  for (const event of liveEvents.slice(-100).reverse()) {
481
488
  const item = element('button', undefined, 'studio-run-event');
482
489
  const focusId = event.nodeId || event.source;
483
490
  const name = (matchesCanvas ? state.graph?.nodes[focusId]?.name : undefined)
484
- || focusId || 'Graph';
491
+ || focusId || 'Workflow';
485
492
  item.textContent = (event.time ? new Date(event.time).toLocaleTimeString() + ' · ' : '') +
486
493
  name + ' · ' + event.type +
487
494
  (event.outcome ? ' (' + event.outcome + ')' : '') +
@@ -573,13 +580,22 @@
573
580
  const more = $studio('more'), menu = $studio('more-menu'), wrap = $studio('more-wrap');
574
581
  if (!more || !menu) return;
575
582
  const items = () => [...menu.querySelectorAll('[role="menuitem"]')].filter(item => !item.disabled && !item.hidden);
583
+ // The menu leaves the way it came and is hidden once its exit has played; reopening it during
584
+ // the exit keeps it where it is.
585
+ let leaving = null;
586
+ const isOpen = () => !menu.hidden && !leaving;
576
587
  const close = (focus = false) => {
577
- if (menu.hidden) return;
578
- menu.hidden = true; more.setAttribute('aria-expanded', 'false');
588
+ if (!isOpen()) return;
589
+ more.setAttribute('aria-expanded', 'false');
590
+ const keep = leave(menu, () => { leaving = null; menu.hidden = true; });
591
+ if (!menu.hidden) leaving = keep;
579
592
  if (focus) more.focus();
580
593
  };
581
- const open = () => { menu.hidden = false; more.setAttribute('aria-expanded', 'true'); items()[0]?.focus(); };
582
- more.onclick = event => { event.stopPropagation(); if (menu.hidden) open(); else close(); };
594
+ const open = () => {
595
+ leaving?.(); leaving = null;
596
+ menu.hidden = false; more.setAttribute('aria-expanded', 'true'); items()[0]?.focus();
597
+ };
598
+ more.onclick = event => { event.stopPropagation(); if (isOpen()) close(); else open(); };
583
599
  more.addEventListener('keydown', event => {
584
600
  if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') { event.preventDefault(); open(); }
585
601
  });
@@ -650,7 +666,7 @@
650
666
  const panel = element('section', undefined, 'studio-run-panel');
651
667
  panel.id = 'studio-run-panel'; panel.hidden = true;
652
668
  const head = element('div', undefined, 'studio-run-head');
653
- head.append(element('strong', 'Graph execution timeline'));
669
+ head.append(element('strong', 'Workflow execution timeline'));
654
670
  const select = element('select'); select.id = 'studio-run-select';
655
671
  select.setAttribute('aria-label', 'Choose saved run');
656
672
  select.onchange = async () => {
@@ -705,7 +721,12 @@
705
721
  const activeRoutes = new Set((runMatchesCanvas() ? liveEvents : []).filter(event => event.type === 'graph.edge.activated')
706
722
  .map(event => JSON.stringify([event.source, event.outcome || 'completed', event.target])));
707
723
  for (const route of $studio('edges')?.querySelectorAll('path[data-route]') || []) {
708
- route.classList.toggle('studio-route-visited', activeRoutes.has(route.getAttribute('data-route')));
724
+ const visited = activeRoutes.has(route.getAttribute('data-route'));
725
+ route.classList.toggle('studio-route-visited', visited);
726
+ // The one red line on the canvas: the route a run took into the node where it failed.
727
+ let target = '';
728
+ try { target = JSON.parse(route.getAttribute('data-route'))?.[2] ?? ''; } catch { /* Not a route. */ }
729
+ route.classList.toggle('studio-route-failed', visited && executed.get(target) === 'studio-node-failed');
709
730
  }
710
731
  for (const node of $studio('nodes')?.children || []) {
711
732
  const id = node.getAttribute('data-node-id');