@andorra-labs/code 0.1.9 → 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 (96) hide show
  1. package/dist/src/agent-execution.js +20 -0
  2. package/dist/src/app-server/protocol.d.ts +108 -1
  3. package/dist/src/app-server/protocol.js +8 -1
  4. package/dist/src/app-server.d.ts +25 -0
  5. package/dist/src/app-server.js +156 -11
  6. package/dist/src/auth/index.d.ts +1 -1
  7. package/dist/src/auth/index.js +1 -1
  8. package/dist/src/auth/store.d.ts +17 -1
  9. package/dist/src/auth/store.js +25 -2
  10. package/dist/src/browser-ui/app.js +19 -19
  11. package/dist/src/browser-ui/index.html +7 -7
  12. package/dist/src/cli.js +10 -5
  13. package/dist/src/commands.d.ts +1 -1
  14. package/dist/src/commands.js +1 -1
  15. package/dist/src/completion-gates.js +1 -1
  16. package/dist/src/completion.d.ts +1 -1
  17. package/dist/src/completion.js +1 -1
  18. package/dist/src/decision/checks.js +1 -1
  19. package/dist/src/file-diff.d.ts +105 -0
  20. package/dist/src/file-diff.js +244 -0
  21. package/dist/src/graph-manager-chat.js +15 -15
  22. package/dist/src/graph-server.js +9 -9
  23. package/dist/src/graph-ui/app.js +123 -118
  24. package/dist/src/graph-ui/embed.js +9 -9
  25. package/dist/src/graph-ui/icons.js +1 -0
  26. package/dist/src/graph-ui/index.html +3 -3
  27. package/dist/src/graph-ui/manager-state.js +3 -3
  28. package/dist/src/graph-ui/manager.js +14 -14
  29. package/dist/src/graph-ui/skill-picker.js +6 -6
  30. package/dist/src/graph-ui/studio-canvas.js +15 -15
  31. package/dist/src/graph-ui/studio.js +40 -40
  32. package/dist/src/graph-ui/style.css +3 -1
  33. package/dist/src/graph-ui/theme.js +2 -2
  34. package/dist/src/graphs.d.ts +7 -1
  35. package/dist/src/graphs.js +12 -2
  36. package/dist/src/mcp.d.ts +75 -0
  37. package/dist/src/mcp.js +240 -8
  38. package/dist/src/membership-errors.js +1 -1
  39. package/dist/src/provider-keys.d.ts +5 -1
  40. package/dist/src/provider-keys.js +7 -3
  41. package/dist/src/provider-settings.d.ts +4 -1
  42. package/dist/src/provider-settings.js +46 -5
  43. package/dist/src/qa/guidance.js +6 -19
  44. package/dist/src/qa/index.d.ts +0 -2
  45. package/dist/src/qa/index.js +0 -2
  46. package/dist/src/qa/profile/QaProfile.d.ts +5 -1
  47. package/dist/src/qa/profile/QaProfile.js +6 -2
  48. package/dist/src/qa/tools.d.ts +19 -1
  49. package/dist/src/qa/tools.js +20 -145
  50. package/dist/src/react-runtime.js +13 -2
  51. package/dist/src/remote/engine-pool.js +18 -6
  52. package/dist/src/screen-selection.d.ts +38 -0
  53. package/dist/src/screen-selection.js +103 -0
  54. package/dist/src/session-changes.d.ts +117 -0
  55. package/dist/src/session-changes.js +796 -0
  56. package/dist/src/stall-recovery.d.ts +11 -0
  57. package/dist/src/stall-recovery.js +12 -0
  58. package/dist/src/telemetry/schema.d.ts +1 -1
  59. package/dist/src/telemetry/schema.js +1 -2
  60. package/dist/src/terminal-ui.d.ts +64 -20
  61. package/dist/src/terminal-ui.js +310 -80
  62. package/dist/src/tool-diff-stats.d.ts +9 -0
  63. package/dist/src/tool-diff-stats.js +20 -0
  64. package/dist/src/tool-names.d.ts +1 -1
  65. package/dist/src/tool-result-filter.js +1 -1
  66. package/dist/src/tools.js +26 -2
  67. package/dist/src/transcript.d.ts +11 -0
  68. package/dist/src/transcript.js +14 -2
  69. package/dist/src/types.d.ts +6 -0
  70. package/docs/guides/desktop-app.md +1 -1
  71. package/docs/guides/tui.md +9 -9
  72. package/package.json +1 -1
  73. package/dist/src/qa/api/http-runner.d.ts +0 -3
  74. package/dist/src/qa/api/http-runner.js +0 -47
  75. package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
  76. package/dist/src/qa/git/ChangeDetector.js +0 -177
  77. package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
  78. package/dist/src/qa/git/DiffReviewer.js +0 -115
  79. package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
  80. package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
  81. package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
  82. package/dist/src/qa/orchestrator/MergeGate.js +0 -40
  83. package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
  84. package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
  85. package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
  86. package/dist/src/qa/runners/CommandRunner.js +0 -96
  87. package/dist/src/qa/runners/TestRunner.d.ts +0 -21
  88. package/dist/src/qa/runners/TestRunner.js +0 -66
  89. package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
  90. package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
  91. package/dist/src/qa/runtime-detect.d.ts +0 -10
  92. package/dist/src/qa/runtime-detect.js +0 -72
  93. package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
  94. package/dist/src/qa/security/DependencyScanner.js +0 -167
  95. package/dist/src/qa/security/SecretScanner.d.ts +0 -3
  96. package/dist/src/qa/security/SecretScanner.js +0 -55
@@ -53,15 +53,15 @@ function closeDialog(dialog) {
53
53
  const controls = globalThis.AndorraControls;
54
54
  if (typeof controls?.closeDialog === 'function') controls.closeDialog(dialog); else dialog.close();
55
55
  }
56
- const DISCARD_QUESTION = { title: 'Discard unsaved changes?', message: 'Edits to this graph since its last revision are lost. Recoverable drafts stay in draft history.', confirmLabel: 'Discard', tone: 'danger' };
56
+ const DISCARD_QUESTION = { title: 'Discard unsaved changes?', message: 'Edits to this workflow since its last version are lost. Recoverable drafts stay in draft history.', confirmLabel: 'Discard', tone: 'danger' };
57
57
  function status(message, error = false) { $('status').textContent = message; $('status').parentElement.classList.toggle('error', error); }
58
58
  // The free tier keeps one custom graph of up to three nodes (Done does not count) and leaves the
59
59
  // Orchestrator to Premium. The server enforces the same rules on save; these keep the editor honest
60
60
  // about them before the user builds something it cannot save.
61
- const FREE_CREATE_TIP = 'Free tier includes 1 custom graph. Upgrade to Premium for more graphs.';
62
- const FREE_ORCHESTRATOR_TIP = 'The Orchestrator is a Premium feature. Free tier graphs can use the other agent nodes.';
61
+ const FREE_CREATE_TIP = 'Free tier includes 1 custom workflow. Upgrade to Premium for more workflows.';
62
+ const FREE_ORCHESTRATOR_TIP = 'The Orchestrator is a Premium feature. Free tier workflows can use the other agents.';
63
63
  function freeTier() { return state.plan?.paid === false; }
64
- function freeNodeTip() { return `Free tier graphs can have up to ${state.plan.nodeLimit} nodes, not counting Done. Upgrade to Premium for larger graphs.`; }
64
+ function freeNodeTip() { return `Free tier workflows can have up to ${state.plan.nodeLimit} steps, not counting Done. Upgrade to Premium for larger workflows.`; }
65
65
  function countedNodes(graph) { return Object.values(graph.nodes).filter(node => node.type !== 'end').length; }
66
66
  function canCreateGraph() { return !freeTier() || state.graphs.filter(graph => graph.id !== 'default').length < state.plan.customGraphLimit; }
67
67
  /** Whether a free account may save this graph: its kept graph, or a new one while it has none. */
@@ -136,8 +136,8 @@ function restoreImportRequirements(graph) {
136
136
  return owed.size ? owed : null;
137
137
  }
138
138
  async function openDraft(snapshot) {
139
- if (state.dirty && !await askConfirm({ title: 'Open the saved draft?', message: 'Current edits are retained in draft history.', confirmLabel: 'Open draft' })) return;
140
- try { const graph = foldGraphSubagentCaps(await api(`/api/drafts/${snapshot}`)); const owed = restoreImportRequirements(graph); state.graph = graph; state.dirty = true; clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = owed; render(); fit(); status(owed ? 'Recovered imported draft. Assign a model profile to every outlined node, then save.' : 'Recovered draft. Save a revision when valid, or duplicate if its base revision changed.'); graphOpened('open'); }
139
+ if (state.dirty && !await askConfirm({ title: 'Open the saved draft?', message: 'Current edits are retained in draft history.', confirmLabel: 'Open Draft' })) return;
140
+ try { const graph = foldGraphSubagentCaps(await api(`/api/drafts/${snapshot}`)); const owed = restoreImportRequirements(graph); state.graph = graph; state.dirty = true; clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = owed; render(); fit(); status(owed ? 'Recovered imported draft. Assign a model profile to every outlined step, then save.' : 'Recovered draft. Save when valid, or duplicate if its base version changed.'); graphOpened('open'); }
141
141
  catch (error) { status(error.message, true); }
142
142
  }
143
143
  function mutate(action, inspector = false) { if (!state.graph) return; checkpoint(); action(); changed(); if (inspector) renderInspector(); }
@@ -268,36 +268,36 @@ function selectNode(node, event = {}) {
268
268
  } else state.selectedIds = [node.id];
269
269
  state.selected = state.selectedIds.at(-1) || null; state.selectedEdge = null; state.bulkOutcome = null;
270
270
  renderCanvas(); renderInspector(); showInspector();
271
- if (mixed) status('Selection restarted. Use Ctrl/Cmd-click to select nodes of the same type.');
271
+ if (mixed) status('Selection restarted. Use Ctrl/Cmd-click to select steps of the same type.');
272
272
  }
273
273
  function routeSelectionTo(targetId) {
274
274
  const pick = state.routePick, target = state.graph?.nodes[targetId];
275
275
  if (!pick || !target) return;
276
276
  if (pick.sources.includes(targetId) || target.agentRole === 'orchestrator') { status('Choose a destination outside the selection. The Orchestrator cannot have incoming connections.', true); return; }
277
277
  const sources = pick.sources.map(id => state.graph.nodes[id]);
278
- if (sources.some(node => !node || !outcomes(node).includes(pick.outcome)) || sources.some(node => selectionType(node) !== selectionType(sources[0]))) { state.routePick=null; renderInspector(); status('The selection changed. Select matching nodes and choose an outcome again.',true); return; }
278
+ if (sources.some(node => !node || !outcomes(node).includes(pick.outcome)) || sources.some(node => selectionType(node) !== selectionType(sources[0]))) { state.routePick=null; renderInspector(); status('The selection changed. Select matching steps and choose an outcome again.',true); return; }
279
279
  mutate(() => {
280
280
  const existing = state.graph.edges;
281
281
  const replacements = sources.map(node => existing.find(edge => edge.source === node.id && edgeOutcome(edge) === pick.outcome && edge.target === targetId) || {id:`edge-${crypto.randomUUID().slice(0,8)}`,source:node.id,target:targetId,outcome:pick.outcome});
282
282
  state.graph.edges = [...existing.filter(edge => !pick.sources.includes(edge.source) || edgeOutcome(edge) !== pick.outcome),...replacements];
283
283
  state.routePick = null;
284
284
  },true);
285
- status(`Routed ${sources.length} nodes to ${target.name}. Existing matching handoffs were kept; configure and validate new input mappings below.`);
285
+ status(`Routed ${sources.length} steps to ${target.name}. Existing matching connections were kept; set the inputs of new ones below.`);
286
286
  }
287
287
  function renderBulkInspector(parent, nodes) {
288
- $('inspector-title').textContent = `${nodes.length} nodes selected`;
288
+ $('inspector-title').textContent = `${nodes.length} steps selected`;
289
289
  parent.append(el('p',nodes.map(node=>node.name).join(', '),'help'));
290
- const group = section(parent,'Output Node');
290
+ const group = section(parent,'Output step');
291
291
  const shared = outcomes(nodes[0]).filter(outcome => nodes.every(node => outcomes(node).includes(outcome)));
292
- if (!shared.length) {group.append(el('p','These nodes have no shared outcome. Give them a matching completion outcome before routing together.','help'));return;}
292
+ if (!shared.length) {group.append(el('p','These steps have no shared outcome. Give them a matching completion outcome before routing together.','help'));return;}
293
293
  if (!shared.includes(state.bulkOutcome)) state.bulkOutcome=shared[0];
294
294
  const selector=choice(group,'Shared outcome',state.bulkOutcome,shared,()=>{});selector.onchange=()=>{state.bulkOutcome=selector.value;state.routePick=null;renderCanvas();renderInspector();};
295
- group.append(el('p','This replaces only the chosen outcome routes. Other outcomes stay connected. Existing handoffs to the chosen destination are retained; new destinations start without mappings.','help'));
296
- const route=el('button',state.routePick?'Click a destination on the canvas':`Route all ${nodes.length} to...`,'primary');
297
- route.onclick=()=>{state.routePick={sources:nodes.map(node=>node.id),outcome:state.bulkOutcome};renderCanvas();renderInspector();status('Click the destination node. Press Escape to cancel.');};group.append(route);
298
- if(state.routePick){const cancel=el('button','Cancel destination selection');cancel.onclick=cancelRoutePick;group.append(cancel);}
299
- const connections=section(group,'Handoff mappings');
300
- for(const node of nodes) for(const edge of state.graph.edges.filter(edge=>edge.source===node.id&&edgeOutcome(edge)===state.bulkOutcome)) {const edit=el('button',`${node.name} -> ${state.graph.nodes[edge.target]?.name} (${Object.keys(edge.inputMapping||{}).length} mappings)`,'graph-row');edit.onclick=()=>{clearSelection();state.selectedEdge=edge;renderCanvas();renderInspector();};connections.append(edit);}
295
+ group.append(el('p','This replaces only the chosen outcome routes. Other outcomes stay connected. Existing connections to the chosen destination are kept; new destinations start without inputs.','help'));
296
+ const route=el('button',state.routePick?'Click a destination on the canvas':`Route all ${nodes.length} to…`,'primary');
297
+ route.onclick=()=>{state.routePick={sources:nodes.map(node=>node.id),outcome:state.bulkOutcome};renderCanvas();renderInspector();status('Click the destination step. Press Escape to cancel.');};group.append(route);
298
+ if(state.routePick){const cancel=el('button','Cancel Selection');cancel.onclick=cancelRoutePick;group.append(cancel);}
299
+ const connections=section(group,'Connection inputs');
300
+ for(const node of nodes) for(const edge of state.graph.edges.filter(edge=>edge.source===node.id&&edgeOutcome(edge)===state.bulkOutcome)) {const edit=el('button',`${node.name} → ${state.graph.nodes[edge.target]?.name} (${Object.keys(edge.inputMapping||{}).length} mappings)`,'graph-row');edit.onclick=()=>{clearSelection();state.selectedEdge=edge;renderCanvas();renderInspector();};connections.append(edit);}
301
301
  }
302
302
  function cancelRoutePick() { state.routePick=null;renderCanvas();renderInspector();status('Destination selection cancelled. No connections changed.'); }
303
303
  /** One validation problem: the message shown to the reader, and the node it blames. Errors that
@@ -305,15 +305,15 @@ function cancelRoutePick() { state.routePick=null;renderCanvas();renderInspector
305
305
  function issues() {
306
306
  const graph = state.graph; if (!graph) return [];
307
307
  const result = [], nodes = Object.values(graph.nodes);
308
- if (nodes.length < 2 || nodes.length > nodeLimit(graph)) result.push({ message: `Use between 2 and ${nodeLimit(graph)} nodes; remove extra nodes before saving.` });
308
+ if (nodes.length < 2 || nodes.length > nodeLimit(graph)) result.push({ message: `Use between 2 and ${nodeLimit(graph)} steps; remove extra steps before saving.` });
309
309
  if (freeTier()) {
310
- if (!freeGraphEditable(graph)) result.push({ message: graph.revision ? 'On the free tier only your first custom graph can be changed. Upgrade to Premium to edit this graph.' : FREE_CREATE_TIP });
310
+ if (!freeGraphEditable(graph)) result.push({ message: graph.revision ? 'On the free tier only your first custom workflow can be changed. Upgrade to Premium to edit this workflow.' : FREE_CREATE_TIP });
311
311
  if (nodes.some(node => node.agentRole === 'orchestrator')) result.push({ message: FREE_ORCHESTRATOR_TIP });
312
312
  if (countedNodes(graph) > state.plan.nodeLimit) result.push({ message: freeNodeTip() });
313
313
  }
314
- if (new TextEncoder().encode(JSON.stringify(graph)).byteLength > 512 * 1024) result.push({ message: 'Graph exceeds 512 KiB; shorten instructions or remove nodes before saving.' });
315
- if (!graph.name.trim()) result.push({ message: 'Give this graph a name.' });
316
- if (graph.name.length > 200) result.push({ message: 'Keep the graph name to 200 characters or fewer.' });
314
+ if (new TextEncoder().encode(JSON.stringify(graph)).byteLength > 512 * 1024) result.push({ message: 'Workflow exceeds 512 KiB; shorten instructions or remove steps before saving.' });
315
+ if (!graph.name.trim()) result.push({ message: 'Give this workflow a name.' });
316
+ if (graph.name.length > 200) result.push({ message: 'Keep the workflow name to 200 characters or fewer.' });
317
317
  if (graph.metadata?.description?.length > 2000) result.push({ message: 'Keep the description to 2000 characters or fewer.' });
318
318
  if (Array.isArray(graph.widgets) && graph.widgets.length > 5) result.push({ message: 'Use at most 5 widgets.' });
319
319
  const widgetIds = new Set();
@@ -324,18 +324,18 @@ function issues() {
324
324
  if (widgetIds.has(widget.id)) result.push({ message: `${label}: duplicate widget id; remove and re-add this widget.` });
325
325
  widgetIds.add(widget.id);
326
326
  }
327
- if (!graph.nodes[graph.entry]) result.push({ message: 'Choose an existing entry node.' });
327
+ if (!graph.nodes[graph.entry]) result.push({ message: 'Choose an existing entry step.' });
328
328
  for (const node of nodes) {
329
329
  const blame = message => result.push({ message, nodeId: node.id });
330
- if (node.jevEnabled !== undefined && (node.type !== 'agent' || typeof node.jevEnabled !== 'boolean')) blame(`${node.name}: Jev decisions must be a boolean on an Agent node.`);
330
+ if (node.jevEnabled !== undefined && (node.type !== 'agent' || typeof node.jevEnabled !== 'boolean')) blame(`${node.name}: Jev decisions must be a boolean on an Agent step.`);
331
331
  for (const outcome of outcomes(node)) if (typeof outcome !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9_ -]{0,79}$/.test(outcome) || outcome.endsWith(' ') || outcome.includes(' ') || ['constructor', 'prototype', '__proto__'].includes(outcome)) blame(`${node.name}: Use outcome names of 1-80 characters starting with a letter or number and containing only letters, numbers, single spaces, underscores or hyphens. Avoid reserved names constructor, prototype and __proto__.`);
332
332
  if (!node.name.trim()) blame(`${node.id}: Add a name.`);
333
- if (node.name.length > 200) blame(`${node.id}: Keep the node name to 200 characters or fewer.`);
333
+ if (node.name.length > 200) blame(`${node.id}: Keep the step name to 200 characters or fewer.`);
334
334
  if (node.position !== undefined && (!Number.isFinite(node.position?.x) || !Number.isFinite(node.position?.y) || Math.abs(node.position.x) > 100000 || Math.abs(node.position.y) > 100000)) blame(`${node.name}: Set finite X and Y coordinates between -100000 and 100000.`);
335
335
  if (node.type === 'agent') {
336
336
  // An imported graph must not drift onto the machine default provider unnoticed: nodes
337
337
  // that arrived without a usable provider stay pinned to this list until one is chosen.
338
- if (state.pendingProviderNodes?.has(node.id) && !node.provider) blame(`${node.name}: choose a model profile for this imported node before saving.`);
338
+ if (state.pendingProviderNodes?.has(node.id) && !node.provider) blame(`${node.name}: choose a model profile for this imported step before saving.`);
339
339
  // Missing provider profiles remain editable; the inspector labels them unavailable.
340
340
  // Run-time preflight, not graph storage, enforces local provider availability.
341
341
  for (const key of ['instruction', 'systemPrompt']) if (node[key] !== undefined && (typeof node[key] !== 'string' || node[key].length > 100000)) blame(`${node.name}: Keep ${key} to 100000 characters or fewer.`);
@@ -357,8 +357,8 @@ function scheduleValidation() {
357
357
  }, 350);
358
358
  }
359
359
  function renderHeading() {
360
- $('graph-title').textContent = state.graph?.name || 'Graph studio';
361
- $('revision').textContent = state.graph ? `${state.graph.revision ? `Revision ${state.graph.revision}` : 'New graph'}${state.dirty ? ' · Unsaved' : ''}` : '';
360
+ $('graph-title').textContent = state.graph?.name || 'Workflow Editor';
361
+ $('revision').textContent = state.graph ? `${state.graph.revision ? `Version ${state.graph.revision}` : 'New workflow'}${state.dirty ? ' · Unsaved' : ''}` : '';
362
362
  $('save').disabled = state.saving || !state.graph || !state.dirty || state.graph.id === 'default';
363
363
  $('save').title = state.graph?.id === 'default' ? 'Duplicate the preset to save your customization' : '';
364
364
  $('undo').disabled = !state.undo.length; $('redo').disabled = !state.redo.length;
@@ -373,7 +373,7 @@ function renderHeading() {
373
373
  function graphOpened(reason) { state.openReason = reason; globalThis.AndorraManager?.graphOpened(reason); }
374
374
  function renderList() {
375
375
  $('new-graph').disabled = state.saving || !canCreateGraph();
376
- $('new-graph').title = canCreateGraph() ? 'Create graph' : FREE_CREATE_TIP;
376
+ $('new-graph').title = canCreateGraph() ? 'Create workflow' : FREE_CREATE_TIP;
377
377
  $('duplicate').disabled = state.saving || !state.graph || !canCreateGraph();
378
378
  $('duplicate').title = canCreateGraph() ? '' : FREE_CREATE_TIP;
379
379
  $('graphs').replaceChildren();
@@ -413,8 +413,13 @@ function renderList() {
413
413
  $('graphs').append(button);
414
414
  }
415
415
  if (state.showDraftHistory || matching.length > current.length) {
416
- const history = el('button', state.showDraftHistory ? 'Show latest drafts' : `Show draft history (${matching.length})`, 'graph-drafts-toggle');
416
+ // A disclosure, as the desktop's Disclosure is: the chevron turns, the words stay (D13).
417
+ const history = el('button', undefined, 'graph-drafts-toggle');
417
418
  history.type = 'button';
419
+ history.setAttribute('aria-expanded', String(Boolean(state.showDraftHistory)));
420
+ const chevron = globalThis.AndorraIcons?.icon?.('chevron-right', 12);
421
+ if (chevron) history.append(chevron);
422
+ history.append(el('span', state.showDraftHistory ? 'Draft history' : `Draft history (${matching.length})`));
418
423
  history.onclick = () => { state.showDraftHistory = !state.showDraftHistory; renderList(); }; $('graphs').append(history);
419
424
  }
420
425
  }
@@ -424,7 +429,7 @@ async function clearDrafts(drafts, all = false) {
424
429
  const graphIds = [...new Set(drafts.map(draft => draft.graphId))];
425
430
  if (!graphIds.length) return;
426
431
  const one = graphIds.length === 1 && !all;
427
- if (!await askConfirm({ title: one ? `Clear the draft of "${drafts[0].name}"?` : $('search').value ? 'Clear the matching drafts?' : 'Clear all drafts?', message: 'Cleared drafts leave this list, with their history. Saved graphs and their revisions are not affected.', confirmLabel: 'Clear', tone: 'danger' })) return;
432
+ if (!await askConfirm({ title: one ? `Clear the draft of "${drafts[0].name}"?` : $('search').value ? 'Clear the matching drafts?' : 'Clear all drafts?', message: 'Cleared drafts leave this list, with their history. Saved workflows and their versions are not affected.', confirmLabel: 'Clear', tone: 'danger' })) return;
428
433
  try { state.drafts = await api('/api/drafts/clear', { graphIds }); if (!state.drafts.length) state.showDraftHistory = false; renderList(); status(one ? 'Draft cleared' : 'Drafts cleared'); }
429
434
  catch (error) { status('Drafts not cleared: ' + error.message, true); }
430
435
  }
@@ -491,9 +496,9 @@ function showGraphMenu(graph, x, y) {
491
496
  showMenuAt(x, y, `${graph.name} actions`, items);
492
497
  }
493
498
  function showNewGraphMenu(x, y) {
494
- showMenuAt(x, y, 'Create a graph', [
495
- { label: 'New Graph', icon: 'plus', run: () => newGraph() },
496
- { label: 'Import Graph', icon: 'upload', run: () => { if (window.AndorraStudio?.openImport) window.AndorraStudio.openImport(); else status('The import dialog is still loading. Try again in a moment.', true); } },
499
+ showMenuAt(x, y, 'Create a workflow', [
500
+ { label: 'New Workflow', icon: 'plus', run: () => newGraph() },
501
+ { label: 'Import Workflow', icon: 'upload', run: () => { if (window.AndorraStudio?.openImport) window.AndorraStudio.openImport(); else status('The import dialog is still loading. Try again in a moment.', true); } },
497
502
  ]);
498
503
  }
499
504
  // The saved revision a row names is what a friend receives: the open draft's unsaved edits are
@@ -501,7 +506,7 @@ function showNewGraphMenu(x, y) {
501
506
  // the file itself; a plain browser downloads the fetched revision directly.
502
507
  async function exportGraph(graph) {
503
508
  if (window.AndorraEmbed?.hostChrome?.() && window.AndorraEmbed.exportGraph) { window.AndorraEmbed.exportGraph(graph.id); return; }
504
- if (state.saving) { status('Wait for the current save before exporting a graph.'); return; }
509
+ if (state.saving) { status('Wait for the current save before exporting a workflow.'); return; }
505
510
  downloadGraph(dropLegacyTokenFields(await api(`/api/graphs/${encodeURIComponent(graph.id)}`)));
506
511
  }
507
512
  function exportFileName(graph) {
@@ -515,14 +520,14 @@ function downloadJson(value, stem) {
515
520
  setTimeout(() => URL.revokeObjectURL(url), 1000);
516
521
  }
517
522
  async function duplicateGraph(source) {
518
- if (state.saving) { status('Wait for the current save before duplicating a graph.'); return; }
523
+ if (state.saving) { status('Wait for the current save before duplicating a workflow.'); return; }
519
524
  state.saving = true; renderHeading(); renderList();
520
525
  let created;
521
526
  try {
522
527
  const saved = dropLegacyTokenFields(await api(`/api/graphs/${encodeURIComponent(source.id)}`));
523
528
  // validateGraph caps names at 200 characters, so a near-limit source name must make room
524
529
  // for the suffix or the save would be rejected with no way to rename the invisible copy.
525
- const suffix = ' (Copy)', base = saved.name || 'Untitled graph';
530
+ const suffix = ' (Copy)', base = saved.name || 'Untitled workflow';
526
531
  const name = base.length + suffix.length > 200 ? base.slice(0, 200 - suffix.length).trimEnd() + suffix : base + suffix;
527
532
  const duplicate = { ...saved, id: newId(), name, revision: 0 };
528
533
  const stored = await api('/api/graphs', duplicate);
@@ -536,13 +541,13 @@ async function duplicateGraph(source) {
536
541
  if (!created) return;
537
542
  if (state.dirty) { status(`Created "${created.name}". Open it from the list to rename it.`); return; }
538
543
  await openGraph(created.id, { reason: 'duplicate' });
539
- if (state.graph?.id === created.id) status(`Duplicated "${source.name}" - Rename it in Graph settings.`);
544
+ if (state.graph?.id === created.id) status(`Duplicated "${source.name}". Rename it in Workflow settings.`);
540
545
  }
541
546
  // Deleting removes the graph, its revisions and its draft history from this machine, and for a
542
547
  // signed-in account the cloud copies stop restoring it. The confirm names that loss: there is no undo.
543
548
  async function deleteGraph(graph) {
544
- if (state.saving) { status('Wait for the current save before deleting a graph.'); return; }
545
- if (!confirm(`Delete "${graph.name}"? Its revisions and drafts are removed from this machine.`)) return;
549
+ if (state.saving) { status('Wait for the current save before deleting a workflow.'); return; }
550
+ if (!confirm(`Delete "${graph.name}"? Its versions and drafts are removed from this machine.`)) return;
546
551
  state.saving = true; renderHeading(); renderList();
547
552
  // The confirm accepted the loss of unsaved edits of the deleted graph, so no draft of it may
548
553
  // outlive it: stop its queued write, and let an in-flight one land before the deletion's
@@ -624,14 +629,14 @@ function nodeSubtitle(node) {
624
629
  const model = nodeModelLabel(node);
625
630
  return node.agentRole === 'orchestrator' ? `Orchestrator${model ? ' · ' + model : ''}` : model;
626
631
  }
627
- if (node.type === 'end') return 'Graph complete';
632
+ if (node.type === 'end') return 'Workflow complete';
628
633
  if (node.type === 'action') return node.action?.kind === 'tests' ? 'Run tests' : node.action?.kind === 'git' ? 'Git operation' : 'Run command';
629
634
  return { join: 'Wait for branches', loop: 'Bounded repetition', condition: 'Branch on run state', parallel: 'Fan out', approval: 'Human approval' }[node.type] || 'Flow control';
630
635
  }
631
636
  const nodeIconElement = node => globalThis.AndorraIcons?.icon?.(globalThis.AndorraIcons.nodeIcon(node));
632
637
  function renderCanvas() {
633
638
  $('nodes').replaceChildren(); $('edges').replaceChildren(); $('canvas').classList.toggle('picking-destination',!!state.routePick);
634
- const hintText = state.routePick ? 'Click a destination node · Escape cancels' : 'Ctrl/Cmd-click same-type nodes to select together · Drag or scroll to pan · Pinch or Ctrl/Cmd+scroll to zoom';
639
+ const hintText = state.routePick ? 'Click a destination step · Escape cancels' : 'Ctrl/Cmd-click same-type steps to select together · Drag or scroll to pan · Pinch or Ctrl/Cmd+scroll to zoom';
635
640
  $('canvas-hint-text').textContent = hintText; $('canvas-hint').hidden = !state.routePick && canvasHintDismissed(); $('canvas-hint-close').hidden = !!state.routePick;
636
641
  $('empty').hidden = !!state.graph;
637
642
  if (!state.graph) return;
@@ -649,7 +654,7 @@ function renderCanvas() {
649
654
  button.append(title);
650
655
  const subtitle = nodeSubtitle(node);
651
656
  if (subtitle) { const line = el('small', subtitle); line.title = subtitle; button.append(line); }
652
- for (const outcome of outcomes(node)) { const port = el('button', outcome, 'output-port'); port.setAttribute('aria-label', `Connect ${node.name}: ${outcome}`); port.title = `${outcome} - drag to a node to connect`; if (connected.has(JSON.stringify([node.id, outcome]))) port.setAttribute('data-connected', 'true'); port.onpointerdown = event => event.stopPropagation(); port.onclick = event => { event.stopPropagation(); if(state.routePick || event.ctrlKey || event.metaKey) {selectNode(node,event);return;} clearSelection(); state.selectedIds=[node.id]; state.selected = node.id; state.inspectorTab = 'behavior'; renderCanvas(); renderInspector(); $('inspector').classList.remove('hidden'); $('toggle-inspector').setAttribute('aria-expanded','true'); document.getElementById(`route-${outcome}`)?.scrollIntoView({block: 'nearest'}); }; button.append(port); }
657
+ for (const outcome of outcomes(node)) { const port = el('button', outcome, 'output-port'); port.setAttribute('aria-label', `Connect ${node.name}: ${outcome}`); port.title = `${outcome} · drag to a step to connect`; if (connected.has(JSON.stringify([node.id, outcome]))) port.setAttribute('data-connected', 'true'); port.onpointerdown = event => event.stopPropagation(); port.onclick = event => { event.stopPropagation(); if(state.routePick || event.ctrlKey || event.metaKey) {selectNode(node,event);return;} clearSelection(); state.selectedIds=[node.id]; state.selected = node.id; state.inspectorTab = 'behavior'; renderCanvas(); renderInspector(); $('inspector').classList.remove('hidden'); $('toggle-inspector').setAttribute('aria-expanded','true'); document.getElementById(`route-${outcome}`)?.scrollIntoView({block: 'nearest'}); }; button.append(port); }
653
658
  button.onkeydown = event => { if ((event.key === 'Enter' || event.key === ' ') && event.target === button) {event.preventDefault(); selectNode(node,event);} };
654
659
  button.onclick = event => selectNode(node,event);
655
660
  button.onpointerdown = event => {
@@ -770,7 +775,7 @@ function renderEdges() {
770
775
  element.classList.toggle('edge-target',Boolean(active && id===active.target));
771
776
  }
772
777
  const item=rendered.find(item=>item.edge===active);
773
- caption.textContent=item?`${edgeOutcome(item.edge)} -> ${state.graph.nodes[item.edge.target].name}`:'';
778
+ caption.textContent=item?`${edgeOutcome(item.edge)} → ${state.graph.nodes[item.edge.target].name}`:'';
774
779
  if(item){caption.setAttribute('x',String(item.from.x));caption.setAttribute('y',String(item.from.y-14));caption.setAttribute('fill',palette.active);}
775
780
  };
776
781
  // Draw a selected connection last so crossings cannot obscure its direction.
@@ -784,11 +789,11 @@ function renderEdges() {
784
789
  arrow.setAttribute('d','M 0 0 L 10 5 L 0 10 z');arrow.setAttribute('fill',palette.line);arrow.style.pointerEvents='none';marker.append(arrow);defs.append(marker);
785
790
  halo.setAttribute('d',d);halo.setAttribute('stroke',palette.halo);halo.setAttribute('stroke-width','6');halo.setAttribute('fill','none');halo.style.pointerEvents='none';
786
791
  path.setAttribute('d',d);path.setAttribute('data-route',JSON.stringify([edge.source,edgeOutcome(edge),edge.target]));path.setAttribute('stroke',palette.line);path.setAttribute('stroke-width',EDGE_WIDTH);path.setAttribute('fill','none');path.setAttribute('stroke-linejoin','round');path.setAttribute('marker-end',`url(#edge-arrow-${index})`);path.style.pointerEvents='none';
787
- hit.setAttribute('d',d);hit.setAttribute('stroke','transparent');hit.setAttribute('stroke-width','14');hit.setAttribute('fill','none');hit.style.pointerEvents='stroke';hit.style.cursor='pointer';hit.setAttribute('tabindex','0');hit.setAttribute('role','button');hit.setAttribute('aria-label',`Configure handoff from ${state.graph.nodes[edge.source].name}, ${edgeOutcome(edge)}, to ${state.graph.nodes[edge.target].name}`);
792
+ hit.setAttribute('d',d);hit.setAttribute('stroke','transparent');hit.setAttribute('stroke-width','14');hit.setAttribute('fill','none');hit.style.pointerEvents='stroke';hit.style.cursor='pointer';hit.setAttribute('tabindex','0');hit.setAttribute('role','button');hit.setAttribute('aria-label',`Edit connection from ${state.graph.nodes[edge.source].name}, ${edgeOutcome(edge)}, to ${state.graph.nodes[edge.target].name}`);
788
793
  hit.onclick=event=>{event.stopPropagation();clearSelection();state.selectedEdge=edge;renderInspector();renderCanvas();showInspector();};
789
794
  hit.onkeydown=event=>{if(event.key==='Enter'||event.key===' '){event.preventDefault();hit.onclick(event);}};
790
795
  // The connection's hint is the app's tooltip (an SVG title would be the platform's).
791
- hit.setAttribute('data-tip',`${state.graph.nodes[edge.source].name}: ${outcome} -> ${state.graph.nodes[edge.target].name}`);
796
+ hit.setAttribute('data-tip',`${state.graph.nodes[edge.source].name}: ${outcome} → ${state.graph.nodes[edge.target].name}`);
792
797
  hit.onpointerenter=hit.onfocus=()=>emphasize(edge);
793
798
  hit.onpointerleave=hit.onblur=()=>emphasize(state.selectedEdge);
794
799
  const entry={edge,path,halo,arrow,from,pill:null};rendered.push(entry);
@@ -821,7 +826,7 @@ function renderEdges() {
821
826
  function removeNodes(ids) {
822
827
  const graph = state.graph;
823
828
  const remaining = Object.keys(graph.nodes).filter(id => !ids.has(id));
824
- if (!remaining.length) { status('Keep at least one node as the graph start. Add a replacement before deleting all nodes.', true); return; }
829
+ if (!remaining.length) { status('Keep at least one step as the workflow start. Add a replacement before deleting all steps.', true); return; }
825
830
  const nextEntry = ids.has(graph.entry)
826
831
  ? graph.edges.find(edge => edge.source === graph.entry && !ids.has(edge.target) && graph.nodes[edge.target])?.target ?? remaining[0]
827
832
  : graph.entry;
@@ -834,7 +839,7 @@ function removeNodes(ids) {
834
839
  graph.schemaVersion = 3;
835
840
  clearSelection();
836
841
  }, true);
837
- status(`Deleted ${ids.size} node${ids.size === 1 ? '' : 's'} and their connections. Start: ${graph.nodes[nextEntry].name}. Undo restores them.`);
842
+ status(`Deleted ${ids.size} step${ids.size === 1 ? '' : 's'} and their connections. Start: ${graph.nodes[nextEntry].name}. Undo restores them.`);
838
843
  }
839
844
  function deleteSelection() {
840
845
  if(!state.graph)return;
@@ -872,8 +877,8 @@ function nodeErrorIds() {
872
877
  }
873
878
  function renderValidation() {
874
879
  const container=$('validation');if(!container)return;container.replaceChildren();const errors=[...issues(),...state.validationErrors].map(errorEntry);
875
- if(!errors.length)container.append(el('p',state.validated?'Validated · Ready to save':'Checking graph…',state.validated?'valid ok':'valid'));
876
- else {const list=el('ul',undefined,'validation');errors.forEach(({message,nodeId})=>{ const row=el('li',message); row.tabIndex=0; row.title='Click to focus the affected node'; row.onclick=()=>{if(nodeId){clearSelection();state.selected=nodeId;state.selectedIds=[nodeId];renderCanvas();renderInspector();}};row.onkeydown=e=>{if(e.key==='Enter'||e.key===' ')row.click();};list.append(row);});container.append(list);}
880
+ if(!errors.length)container.append(el('p',state.validated?'Validated · Ready to save':'Checking workflow…',state.validated?'valid ok':'valid'));
881
+ else {const list=el('ul',undefined,'validation');errors.forEach(({message,nodeId})=>{ const row=el('li',message); row.tabIndex=0; row.title='Click to focus the affected step'; row.onclick=()=>{if(nodeId){clearSelection();state.selected=nodeId;state.selectedIds=[nodeId];renderCanvas();renderInspector();}};row.onkeydown=e=>{if(e.key==='Enter'||e.key===' ')row.click();};list.append(row);});container.append(list);}
877
882
  }
878
883
  function disclosure(parent, title, open = false) { const item = el('details', undefined, 'section disclosure'); const key = `${state.selectedEdge?.id || state.selected || 'graph'}:${title}`; item.open = state.disclosures[key] ?? open; item.ontoggle = () => {state.disclosures[key] = item.open;}; item.append(el('summary', title)); const body = el('div'); item.append(body); parent.append(item); return body; }
879
884
  function check(parent, label, value, update) { const wrapper = el('label', undefined, 'tool-label'), input = el('input'); input.type = 'checkbox'; input.checked = value; input.onchange = () => mutate(() => update(input.checked), true); wrapper.append(input, el('span', label)); parent.append(wrapper); return input; }
@@ -1001,7 +1006,7 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1001
1006
  // model made the provider list read as the whole model list.
1002
1007
  const providers = state.providers.map(p => ({value: idFor(p), label: titleFor(p)}));
1003
1008
  if (target.provider && !providers.some(p => p.value === target.provider)) providers.push({value: target.provider, label: target.provider + ' (unavailable)'});
1004
- const defaultProviderLabel = inheritedProvider ? `Same as parent node (${inheritedProvider})` : state.defaultProvider ? `Use configured default (${state.defaultProvider})` : 'Use configured default';
1009
+ const defaultProviderLabel = inheritedProvider ? `Same as parent agent (${inheritedProvider})` : state.defaultProvider ? `Use configured default (${state.defaultProvider})` : 'Use configured default';
1005
1010
  choice(parent, 'Provider', target.provider || '', [{value:'', label: defaultProviderLabel}, ...providers], value => update({ ...target, provider: value || undefined, model: undefined }));
1006
1011
  if (target.provider && !state.providers.some(p => idFor(p) === target.provider)) providerWarning(parent, target.provider);
1007
1012
  // A providerless subagent child inherits the parent node's provider at execution
@@ -1080,21 +1085,21 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1080
1085
  const typeMismatch = claimed && !!recorded?.type && claimedProvider.type !== recorded.type;
1081
1086
  const matches = !claimed && recorded?.type === 'codex' ? state.providers.filter(p => p.type === 'codex' && offers(p, requiredModels)) : [];
1082
1087
  const refusalHint = typeMismatch
1083
- ? `Provider "${originalId}" is configured locally with type "${claimedProvider.type}", but this graph was published with type "${recorded.type}". Execution will refuse this graph; reconnect a provider of the recorded type.`
1084
- : `Provider "${originalId}" is configured locally but does not offer ${requiredModels.join(', ')}. Execution will refuse this graph until that provider is configured with the model; another profile is never used as a substitute.`;
1088
+ ? `Provider "${originalId}" is configured locally with type "${claimedProvider.type}", but this workflow was published with type "${recorded.type}". Execution will refuse this workflow; reconnect a provider of the recorded type.`
1089
+ : `Provider "${originalId}" is configured locally but does not offer ${requiredModels.join(', ')}. Execution will refuse this workflow until that provider is configured with the model; another profile is never used as a substitute.`;
1085
1090
  const hint = matches.length === 1
1086
1091
  ? `Will use local Codex OAuth profile "${idFor(matches[0])}" (${requiredModels.join(', ') || 'all referenced models'}). The OAuth connection is verified before execution.`
1087
1092
  : matches.length > 1
1088
- ? `Multiple local Codex OAuth profiles (${matches.map(idFor).join(', ')}) each satisfy this graph's requirements for "${originalId}". Execution needs exactly one; configure the original provider ID or keep a single compatible profile.`
1093
+ ? `Multiple local Codex OAuth profiles (${matches.map(idFor).join(', ')}) each satisfy this workflow's requirements for "${originalId}". Execution needs exactly one; configure the original provider ID or keep a single compatible profile.`
1089
1094
  : claimed
1090
1095
  ? refusalHint
1091
- : `Provider "${originalId}"${requiredModels.length ? ` / ${requiredModels.join(', ')}` : ''} is not configured on this machine. This graph can be saved, but execution requires a compatible provider.`;
1096
+ : `Provider "${originalId}"${requiredModels.length ? ` / ${requiredModels.join(', ')}` : ''} is not configured on this machine. This workflow can be saved, but execution requires a compatible provider.`;
1092
1097
  parent.append(el('p', hint, 'help'));
1093
1098
  } else if (followsProvider && recorded?.model && recorded.model !== exact.model) {
1094
1099
  parent.append(el('p', `This selection follows "${originalId}"'s current model, ${exact.model}.`, 'help'));
1095
1100
  }
1096
1101
  }
1097
- const info = el('p', 'Context window: detecting from model...', 'help model-context'); parent.append(info);
1102
+ const info = el('p', 'Context window: detecting from model…', 'help model-context'); parent.append(info);
1098
1103
  const key = JSON.stringify([target.provider || '', target.model || '', provider?.model || '']);
1099
1104
  // Capture the registry generation before any discovery request starts: a callback resolving
1100
1105
  // after a registry change describes the previous endpoint and must discard itself.
@@ -1243,7 +1248,7 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1243
1248
  function renderCompletion(parent, node) {
1244
1249
  const graph = state.graph, routing = node.agentRole === 'orchestrator';
1245
1250
  const behavior = choice(parent, routing ? 'Routing behavior' : 'Completion behavior', node.completion?.mode || 'single', [
1246
- {value:'single',label:routing ? 'Continue to connected nodes' : 'Continue when complete'},
1251
+ {value:'single',label:routing ? 'Continue to connected steps' : 'Continue when complete'},
1247
1252
  {value:'outcomes',label:'Choose outcome using written criteria'},
1248
1253
  ], mode => {
1249
1254
  node.completion = mode === 'single' ? {mode,outcome:'completed'} : {mode,outcomes:routing ? ['frontend','backend','devops'] : ['pass','fail','blocked']};
@@ -1252,7 +1257,7 @@ function renderCompletion(parent, node) {
1252
1257
  explain(behavior, 'Outcome names are short phrases such as DONE, PASS, FAILED TESTING or BLOCKED. Describe when the agent should choose each one; for a single outcome, describe when the work is considered achieved, for example "This is considered DONE when xyz is finished". The agent evaluates these written criteria using its evidence; they are not automatic checks. Connect outcomes to destinations under Connections.');
1253
1258
  // The server refuses written criteria on a delegating Orchestrator, so the option is withheld
1254
1259
  // rather than offered and then rejected on save.
1255
- if (delegatesWriting(node) && node.completion?.mode !== 'outcomes') { for (const option of behavior.options) option.disabled = option.value === 'outcomes'; parent.append(el('p', 'An Orchestrator with a writing role keeps a single outcome: it completes with a handoff, or delivers landed changes through its delivered port.', 'help')); }
1260
+ if (delegatesWriting(node) && node.completion?.mode !== 'outcomes') { for (const option of behavior.options) option.disabled = option.value === 'outcomes'; parent.append(el('p', 'An Orchestrator with a writing role keeps a single outcome: it completes by passing work on, or delivers landed changes through its delivered port.', 'help')); }
1256
1261
  if (node.completion?.mode === 'outcomes') {
1257
1262
  parent.append(el('p', 'Criteria are optional; blank rows use the agent prompt. Removing or renaming an outcome removes its old routes. Undo restores routes and criteria.', 'help'));
1258
1263
  if (node.modifiers?.condition || node.modifiers?.loop?.until.outcome !== undefined) parent.append(el('p', 'Modifiers control the final connections: a Condition routes to true/false; an outcome Loop exposes its exit outcome.', 'help'));
@@ -1292,7 +1297,7 @@ function renderCompletion(parent, node) {
1292
1297
  }, true);
1293
1298
  row.append(remove);
1294
1299
  });
1295
- const add = el('button', 'Add outcome');
1300
+ const add = el('button', 'Add Outcome');
1296
1301
  add.disabled = completion.outcomes.length >= 20;
1297
1302
  add.title = 'Up to 20 outcomes per agent';
1298
1303
  add.onclick = () => mutate(() => {
@@ -1323,14 +1328,14 @@ function routes(parent, node) {
1323
1328
  for (const destination of Object.values(state.graph.nodes).filter(n => n.id !== node.id && n.agentRole !== 'orchestrator')) {
1324
1329
  const edge = state.graph.edges.find(e => e.source === node.id && edgeOutcome(e) === outcome && e.target === destination.id);
1325
1330
  check(row, destination.name, !!edge, enabled => { if (enabled) state.graph.edges.push({id: `edge-${crypto.randomUUID().slice(0,8)}`, source: node.id, target: destination.id, outcome}); else state.graph.edges = state.graph.edges.filter(e => e !== edge); });
1326
- if (edge) { const edit = el('button', 'Configure handoff', 'link-button'); edit.onclick = () => { state.selectedEdge = edge; state.selected = null; renderInspector(); renderCanvas(); }; row.append(edit); }
1331
+ if (edge) { const edit = el('button', 'Edit Connection', 'link-button'); edit.onclick = () => { state.selectedEdge = edge; state.selected = null; renderInspector(); renderCanvas(); }; row.append(edit); }
1327
1332
  }
1328
1333
  }
1329
1334
  }
1330
1335
  function renderEdgeInspector(parent, edge) {
1331
- $('inspector-title').textContent = 'Connection handoff';
1336
+ $('inspector-title').textContent = 'Connection';
1332
1337
  parent.append(el('h3', `${state.graph.nodes[edge.source]?.name} - ${edgeOutcome(edge)}`), el('p', `To: ${state.graph.nodes[edge.target]?.name}`, 'help'));
1333
- if (edge.bootstrap) parent.append(el('p', 'Initial handoff: starts this upgraded graph at its original Join. Later loop iterations wait for the other incoming branches. Removing this connection removes that initial-start behavior.', 'help'));
1338
+ if (edge.bootstrap) parent.append(el('p', 'Initial connection: starts this updated workflow at its original Join. Later loop iterations wait for the other incoming branches. Removing this connection removes that initial-start behavior.', 'help'));
1334
1339
  const mappings = section(parent, 'Input mapping'); mappings.append(el('p', 'Map validated outputs or run context into the destination named inputs. Constants must be valid JSON.', 'help'));
1335
1340
  const targetSchema=state.graph.nodes[edge.target]?.inputSchema, sourceSchema=state.graph.nodes[edge.source]?.modifiers?.parallel?.mode === 'copies' ? {properties:{results:{type:'array'}}} : state.graph.nodes[edge.source]?.outputSchema; const targetKeys = Object.keys(targetSchema?.properties || {}), sourceKeys = Object.keys(sourceSchema?.properties || {}); if(targetKeys.length)mappings.append(el('p',`Destination inputs: ${targetKeys.map(key=>key+(targetSchema.required?.includes(key)?' (required)':'')).join(', ')}`,'help'));if(sourceKeys.length)mappings.append(el('p',`Available source outputs: ${sourceKeys.join(', ')}`,'help'));
1336
1341
  for (const [key, value] of Object.entries(edge.inputMapping || {})) {
@@ -1341,11 +1346,11 @@ function renderEdgeInspector(parent, edge) {
1341
1346
  choice(row, 'Source', kind, [{value:'$source.output', label:'Source output field'}, {value:'$run.input', label:'Run input field'}, {value:'$run.state', label:'Run state field'}, {value:'$run.loop.iteration', label:'Loop iteration'}, {value:'$source.artifacts', label:'Source artifacts'}, {value:'constant', label:'Constant'}], next => set(next === 'constant' ? {constant: ''} : ['$source.output','$run.input','$run.state'].includes(next) ? `${next}.${next === '$source.output' ? sourceKeys[0] || 'result' : 'task'}` : next));
1342
1347
  if (kind === 'constant') jsonField(row, 'Constant value', value.constant, next => set({constant:next}));
1343
1348
  else if (['$source.output','$run.input','$run.state'].includes(kind)) { const input = field(row, 'Field / path', value.slice(kind.length + 1), next => set(`${kind}.${next}`)); const availableKeys = kind === '$source.output' ? sourceKeys : Object.keys((kind === '$run.input' ? state.graph.inputSchema : state.graph.stateSchema)?.properties || {}); if (availableKeys.length) { const list = el('datalist'); list.id = `mapping-${crypto.randomUUID()}`; availableKeys.forEach(key => { const option = el('option'); option.value = key; list.append(option); }); input.setAttribute('list', list.id); row.append(list); } }
1344
- const remove = el('button', 'Remove mapping'); remove.onclick = () => mutate(() => { delete edge.inputMapping[key]; }, true); row.append(remove);
1349
+ const remove = el('button', 'Remove Mapping'); remove.onclick = () => mutate(() => { delete edge.inputMapping[key]; }, true); row.append(remove);
1345
1350
  }
1346
- const add = el('button', 'Add mapping'); add.onclick = () => mutate(() => { edge.inputMapping ||= {}; let key = targetKeys.find(k => !Object.hasOwn(edge.inputMapping,k)) || 'input'; while (Object.hasOwn(edge.inputMapping,key)) key += '_'; edge.inputMapping[key] = {constant:''}; }, true);
1347
- const suggest = el('button', 'Suggest matching fields'); suggest.onclick = () => mutate(() => { edge.inputMapping ||= {}; for (const key of targetKeys.filter(k => sourceKeys.includes(k))) if (!Object.hasOwn(edge.inputMapping,key)) edge.inputMapping[key] = `$source.output.${key}`; }, true); mappings.append(add, suggest);
1348
- const remove = el('button', 'Remove connection', 'danger'); remove.onclick = () => mutate(() => { state.graph.edges = state.graph.edges.filter(e => e !== edge); state.selectedEdge = null; }, true); parent.append(remove);
1351
+ const add = el('button', 'Add Mapping'); add.onclick = () => mutate(() => { edge.inputMapping ||= {}; let key = targetKeys.find(k => !Object.hasOwn(edge.inputMapping,k)) || 'input'; while (Object.hasOwn(edge.inputMapping,key)) key += '_'; edge.inputMapping[key] = {constant:''}; }, true);
1352
+ const suggest = el('button', 'Suggest Matching Fields'); suggest.onclick = () => mutate(() => { edge.inputMapping ||= {}; for (const key of targetKeys.filter(k => sourceKeys.includes(k))) if (!Object.hasOwn(edge.inputMapping,key)) edge.inputMapping[key] = `$source.output.${key}`; }, true); mappings.append(add, suggest);
1353
+ const remove = el('button', 'Remove Connection', 'danger'); remove.onclick = () => mutate(() => { state.graph.edges = state.graph.edges.filter(e => e !== edge); state.selectedEdge = null; }, true); parent.append(remove);
1349
1354
  }
1350
1355
  function effectiveCaps(node = {}) { return node.capabilities || {filesystem:'read-write',shell:'allowed',git:'write',github:'none',browser:'playwright',deployment:'none'}; }
1351
1356
  // Browser copy of src/tool-names.ts. The server treats these spellings as aliases of the canonical
@@ -1370,7 +1375,7 @@ function canonicalToolName(name) { const d = displayToolName(name); return SHELL
1370
1375
  // Browser copy of permitsBuiltInTool in src/graphs.ts for a delegated worktree child, the one
1371
1376
  // kind of subagent that runs commands. The server validates a writing role's tools with that rule,
1372
1377
  // so a tool offered here that it refuses could be ticked and then fail validation.
1373
- const QA_TOOL_NAMES = ['qa.inspect_project', 'qa.status', 'qa.fast', 'qa.deep', 'qa.test', 'qa.terminal', 'qa.security', 'qa.browser'];
1378
+ const QA_TOOL_NAMES = ['qa.terminal', 'qa.browser'];
1374
1379
  function delegatedRolePermits(caps, name) {
1375
1380
  const display = displayToolName(name);
1376
1381
  // Mirrors canRunCommands in src/graphs.ts: the shell setting alone grants commands.
@@ -1410,12 +1415,12 @@ function renderSubagents(parent, node) {
1410
1415
  const delegating = delegatesWriting(node);
1411
1416
  explain(check(parent,'Allow subagents',policy.enabled,value=>{set({enabled:value});pruneRoutes(node);}), delegating
1412
1417
  ? 'Writing roles of an Orchestrator run in their own Git worktree with a shell. The shell is not sandboxed and follows your permission mode. The Orchestrator reviews each change and lands the ones it accepts into your working folder; it never writes code itself.'
1413
- : 'Internal delegation returns observations to this Agent. Only this parent chooses its graph outcome. Active children finish or cancel before the parent can complete. Subagents of ordinary agents never receive the unsandboxed host shell. Read-only roles use filesystem tools and supported Git read operations.');
1418
+ : 'Internal delegation returns observations to this Agent. Only this parent chooses its workflow outcome. Active children finish or cancel before the parent can complete. Subagents of ordinary agents never receive the unsandboxed host shell. Read-only roles use filesystem tools and supported Git read operations.');
1414
1419
  if (!policy.enabled) return;
1415
1420
  // The server refuses writing roles on an Orchestrator outside separate worktrees, so the
1416
1421
  // editor moves the policy there as soon as a role may write.
1417
1422
  const requireWorktree = () => { if (node.agentRole === 'orchestrator' && (policy.roles || []).some(isWritingRole)) set({workspace:'worktree'}); };
1418
- for (const [key,label,fallback] of [['maxConcurrent','Max concurrent',3],['maxTotal','Max total per node run',8],['maxDepth','Max nesting depth',1]]) field(parent,label,policy[key]??fallback,value=>set({[key]:value}),{type:'number',min:1,max:key==='maxDepth'?3:key==='maxConcurrent'?16:1000});
1423
+ for (const [key,label,fallback] of [['maxConcurrent','Max concurrent',3],['maxTotal','Max total per agent run',8],['maxDepth','Max nesting depth',1]]) field(parent,label,policy[key]??fallback,value=>set({[key]:value}),{type:'number',min:1,max:key==='maxDepth'?3:key==='maxConcurrent'?16:1000});
1419
1424
  choice(parent,'Model policy',policy.modelPolicy||'inherit',[{value:'inherit',label:'Inherit parent model'},{value:'specific',label:'Use specific model'},{value:'per-role',label:'Per-role model'}],value=>set({modelPolicy:value}));
1420
1425
  // Mirrors bindPortableGraphProviders: enabled retry attempts may spawn providerless children on
1421
1426
  // the fallback provider, so a discovered child pick must be recorded there as well.
@@ -1447,20 +1452,20 @@ function renderSubagents(parent, node) {
1447
1452
  check(allowedTools,available?name:`${name} (unavailable — remove to repair)`,toolOptions.selected.includes(name),enabled=>{role.tools=enabled?[...new Set([...toolOptions.selected,name])]:toolOptions.selected.filter(t=>t!==name);if(!toolOptions.delegated)policy.toolInheritance='restricted';});
1448
1453
  }
1449
1454
  const contracts=disclosure(body,'Role contracts');jsonField(contracts,'Input schema',role.inputSchema,value=>{role.inputSchema=value;});jsonField(contracts,'Output schema',role.outputSchema,value=>{role.outputSchema=value;});
1450
- const remove=el('button','Remove role');remove.onclick=()=>mutate(()=>{set({roles:policy.roles.filter(r=>r!==role)});pruneRoutes(node);},true);body.append(remove);
1455
+ const remove=el('button','Remove Role');remove.onclick=()=>mutate(()=>{set({roles:policy.roles.filter(r=>r!==role)});pruneRoutes(node);},true);body.append(remove);
1451
1456
  }
1452
- const add=el('button','Add role');add.onclick=()=>mutate(()=>{set({roles:[...(policy.roles||[]),{id:`role-${crypto.randomUUID().slice(0,8)}`,name:'Repository Researcher',instruction:'Research the bounded task and return findings.',capabilities:{...effectiveCaps(node),filesystem:effectiveCaps(node).filesystem==='none'?'none':'read',shell:effectiveCaps(node).shell==='disabled'?'disabled':'read-only',git:effectiveCaps(node).git==='none'?'none':'read'}}]});requireWorktree();},true);roles.append(add);
1457
+ const add=el('button','Add Role');add.onclick=()=>mutate(()=>{set({roles:[...(policy.roles||[]),{id:`role-${crypto.randomUUID().slice(0,8)}`,name:'Repository Researcher',instruction:'Research the bounded task and return findings.',capabilities:{...effectiveCaps(node),filesystem:effectiveCaps(node).filesystem==='none'?'none':'read',shell:effectiveCaps(node).shell==='disabled'?'disabled':'read-only',git:effectiveCaps(node).git==='none'?'none':'read'}}]});requireWorktree();},true);roles.append(add);
1453
1458
  }
1454
1459
  function renderControlInspector(parent,node) {
1455
1460
  if(node.type==='join')choice(parent,'Wait for branches',node.join?.mode||'all',['all','any'],value=>{node.join={mode:value};});
1456
1461
  if(node.type==='loop')field(parent,'Maximum loop iterations',node.loop?.maxIterations??3,value=>{node.loop={maxIterations:value};},{type:'number',min:1});
1457
1462
  if(node.type==='condition') {
1458
- choice(parent,'Source node',node.condition?.source||'', [{value:'',label:'Choose a predecessor'},...Object.values(state.graph.nodes).filter(n=>n.id!==node.id).map(n=>({value:n.id,label:n.name}))],value=>{node.condition={path:'',equals:true,...node.condition,source:value};});
1463
+ choice(parent,'Source step',node.condition?.source||'', [{value:'',label:'Choose a predecessor'},...Object.values(state.graph.nodes).filter(n=>n.id!==node.id).map(n=>({value:n.id,label:n.name}))],value=>{node.condition={path:'',equals:true,...node.condition,source:value};});
1459
1464
  field(parent,'Output field path',node.condition?.path||'',value=>{node.condition={source:'',equals:true,...node.condition,path:value};});
1460
1465
  jsonField(parent,'Equals',node.condition?.equals??true,value=>{node.condition={source:'',path:'',...node.condition,equals:value};});
1461
1466
  }
1462
1467
  if(node.type==='action') {choice(parent,'Action',node.action?.kind||'command',['command','tests','git'],value=>{node.action={command:'',...node.action,kind:value};});field(parent,'Command',node.action?.command||'',value=>{node.action={kind:'command',...node.action,command:value};},{multiline:true,maxLength:100000});}
1463
- if(node.type==='parallel')parent.append(el('p','All completed connections become ready. A Parallel node is optional for ordinary outcome fan-out.', 'help'));
1468
+ if(node.type==='parallel')parent.append(el('p','All completed connections become ready. A Parallel step is optional for ordinary outcome fan-out.', 'help'));
1464
1469
  if(node.type==='approval')parent.append(el('p','The CLI asks for approval. Route approved and rejected separately.', 'help'));
1465
1470
  }
1466
1471
  function setAgentModifier(node, kind, value) {
@@ -1490,7 +1495,7 @@ function scalarField(parent, label, value, update) {
1490
1495
  function renderModifiers(parent, node) {
1491
1496
  if (node.agentRole === 'orchestrator') return;
1492
1497
  const group = disclosure(parent, 'Modifiers', Boolean(node.modifiers && Object.keys(node.modifiers).length));
1493
- group.append(el('p','Add behavior to this agent without extra control nodes.','help'));
1498
+ group.append(el('p','Add behavior to this agent without extra control steps.','help'));
1494
1499
  check(group, 'Condition modifier', Boolean(node.modifiers?.condition), enabled => setAgentModifier(node,'condition',enabled ? {path:'approved',equals:true} : undefined));
1495
1500
  if (node.modifiers?.condition) {
1496
1501
  const config = node.modifiers.condition;
@@ -1501,11 +1506,11 @@ function renderModifiers(parent, node) {
1501
1506
  check(group, 'Loop modifier', Boolean(node.modifiers?.loop), enabled => setAgentModifier(node,'loop',enabled ? {maxIterations:3,until:{outcome:node.completion?.mode==='outcomes' ? node.completion.outcomes[0] : node.completion?.outcome || 'completed'}} : undefined));
1502
1507
  if (node.modifiers?.loop) {
1503
1508
  const config = node.modifiers.loop;
1504
- field(group,'Maximum attempts',config.maxIterations,value=>{config.maxIterations=value;},{type:'number',min:1,max:100});
1509
+ field(group,'Maximum tries',config.maxIterations,value=>{config.maxIterations=value;},{type:'number',min:1,max:100});
1505
1510
  choice(group,'Exit when',config.until.outcome!==undefined?'outcome':'output',[{value:'outcome',label:'Agent returns an outcome'},{value:'output',label:'Output field matches a value'}],value=>{setAgentModifier(node,'loop',{...config,until:value==='outcome'?{outcome:node.completion?.mode==='outcomes'?node.completion.outcomes[0]:node.completion?.outcome||'completed'}:{path:'finished',equals:true}});});
1506
1511
  if (config.until.outcome !== undefined) choice(group,'Exit outcome',config.until.outcome,node.completion?.mode==='outcomes'?node.completion.outcomes:[node.completion?.outcome||'completed'],value=>{setAgentModifier(node,'loop',{...config,until:{outcome:value}});});
1507
1512
  else { field(group,'Exit output field',config.until.path,value=>{config.until.path=value.trim();}); scalarField(group,'Exit value (JSON)',config.until.equals,value=>{config.until.equals=value;}); }
1508
- group.append(el('p','Repeat this agent until the exit condition matches. If the attempt limit is reached, stop with an exhausted result instead of continuing as if successful.','help'));
1513
+ group.append(el('p','Repeat this agent until the exit condition matches. If the try limit is reached, stop with an exhausted result instead of continuing as if successful.','help'));
1509
1514
  }
1510
1515
  choice(group,'Parallel modifier',node.modifiers?.parallel?.mode||'off',[{value:'off',label:'Off'},{value:'branches',label:'Connected downstream agents'},{value:'copies',label:'Copies of this agent'}],mode=>setAgentModifier(node,'parallel',mode==='off'?undefined:{mode,maxConcurrent:2,...(mode==='copies'?{copies:2}:{})}));
1511
1516
  if (node.modifiers?.parallel) {
@@ -1529,29 +1534,29 @@ function hasRetryCycle(graph) {
1529
1534
  function retryLimitHelp(parent, graph) {
1530
1535
  if (!hasRetryCycle(graph) || graph.limits?.maxNodeVisits || graph.limits?.wallTimeMs) return;
1531
1536
  const box = el('div', undefined, 'cycle-help');
1532
- box.append(el('strong', 'This graph includes a retry cycle'), el('p', 'A return connection can run the same agents repeatedly, so the run needs a ceiling: set a maximum number of visits per node, or give the run a wall clock. Without one the cycle never ends.'));
1533
- const fix = el('button', 'Limit each node to 3 visits');
1537
+ box.append(el('strong', 'This workflow includes a retry cycle'), el('p', 'A return connection can run the same agents repeatedly, so the run needs a ceiling: set a maximum number of visits per step, or give the run a wall clock. Without one the cycle never ends.'));
1538
+ const fix = el('button', 'Limit Each Step to 3 Visits');
1534
1539
  fix.onclick = () => mutate(() => { graph.limits = {...graph.limits, maxNodeVisits:3}; }, true);
1535
- const clock = el('button', 'Give the run 30 minutes');
1540
+ const clock = el('button', 'Give the Run 30 Minutes');
1536
1541
  clock.onclick = () => mutate(() => { graph.limits = {...graph.limits, wallTimeMs:30 * 60_000}; }, true);
1537
1542
  box.append(fix, clock); parent.append(box);
1538
1543
  }
1539
1544
  function renderInspector() {
1540
1545
  // A redraw replaces a full-screen prompt editor, so its backdrop goes with it.
1541
1546
  document.body?.classList?.remove?.('prompt-fullscreen'); for (const backdrop of document.querySelectorAll?.('.prompt-backdrop') ?? []) backdrop.remove();
1542
- const parent = $('inspector-body'); parent.replaceChildren(); const graph = state.graph; if (!graph) { parent.append(el('p', 'Create a graph or choose a preset.', 'help')); return; }
1547
+ const parent = $('inspector-body'); parent.replaceChildren(); const graph = state.graph; if (!graph) { parent.append(el('p', 'Create a workflow or choose a preset.', 'help')); return; }
1543
1548
  if (state.selectedEdge && !graph.edges.includes(state.selectedEdge)) state.selectedEdge = null;
1544
- const node = graph.nodes[state.selected]; $('inspector-title').textContent = node ? 'Node settings' : 'Graph settings';
1549
+ const node = graph.nodes[state.selected]; $('inspector-title').textContent = node ? 'Step settings' : 'Workflow settings';
1545
1550
  $('graph-settings').hidden = !node && !state.selectedEdge && selectedNodes().length <= 1;
1546
1551
  retryLimitHelp(parent, graph);
1547
1552
  if (state.selectedEdge) renderEdgeInspector(parent, state.selectedEdge);
1548
1553
  else if (selectedNodes().length > 1) renderBulkInspector(parent,selectedNodes());
1549
1554
  else if (!node) {
1550
1555
  const panels = inspectorTabs(parent, ['general', 'behavior', 'advanced']); const general = panels.general;
1551
- field(general, 'Graph name', graph.name, value => { graph.name = value; renderList(); }, {maxLength:200});
1552
- const meta = el('p', `${graph.id} · Revision ${graph.revision}`, 'mono graph-meta'); meta.title = graph.id; general.append(meta);
1556
+ field(general, 'Workflow name', graph.name, value => { graph.name = value; renderList(); }, {maxLength:200});
1557
+ const meta = el('p', `${graph.id} · Version ${graph.revision}`, 'mono graph-meta'); meta.title = graph.id; general.append(meta);
1553
1558
  if (graph.id === 'default') general.append(el('p', 'Duplicate this bundled preset to save your customization.', 'help'));
1554
- const start = field(general,'Starting node',graph.nodes[graph.entry]?.name || '',()=>{}); start.disabled=true; explain(start,'The Orchestrator is optional. Deleting the starting node promotes its first remaining connected successor, or the first remaining node if none is connected.');
1559
+ const start = field(general,'Starting step',graph.nodes[graph.entry]?.name || '',()=>{}); start.disabled=true; explain(start,'The Orchestrator is optional. Deleting the starting step promotes its first remaining connected successor, or the first remaining step if none is connected.');
1555
1560
  field(general, 'Description', graph.metadata?.description, value => {graph.metadata={...graph.metadata,description:value};}, {multiline:true,maxLength:2000});
1556
1561
  const widgetGroup = disclosure(panels.behavior, 'Widgets', true);
1557
1562
  widgetGroup.append(el('p','Widgets appear as sections beside the run plan. Each description tells the agents what belongs in the widget; during runs the agents keep its value current.','help'));
@@ -1559,18 +1564,18 @@ function renderInspector() {
1559
1564
  const label = `Widget ${index + 1} name`;
1560
1565
  field(widgetGroup, label, widget.name, value => { widget.name = value; }, {maxLength:80,refresh:true});
1561
1566
  field(widgetGroup, `Widget ${index + 1} description`, widget.description, value => { widget.description = value; }, {multiline:true,maxLength:1000});
1562
- const remove = el('button','Remove widget','danger');
1567
+ const remove = el('button','Remove Widget','danger');
1563
1568
  remove.onclick = () => mutate(() => { graph.widgets = (graph.widgets ?? []).filter(item => item !== widget); if (!graph.widgets.length) delete graph.widgets; }, true);
1564
1569
  widgetGroup.append(remove);
1565
1570
  }
1566
1571
  if ((graph.widgets ?? []).length < 5) {
1567
- const add = el('button','Add widget');
1572
+ const add = el('button','Add Widget');
1568
1573
  add.onclick = () => mutate(() => { graph.widgets = [...(graph.widgets ?? []), { id: `widget-${crypto.randomUUID().slice(0,8)}`, name: '', description: '' }]; }, true);
1569
1574
  widgetGroup.append(add);
1570
- widgetGroup.append(el('p','Up to 5 widgets per graph. Names and descriptions are required before saving.','help'));
1575
+ widgetGroup.append(el('p','Up to 5 widgets per workflow. Names and descriptions are required before saving.','help'));
1571
1576
  } else widgetGroup.append(el('p','Widget limit reached (5).','help'));
1572
- const visits = field(panels.behavior, 'Maximum visits per node', graph.limits?.maxNodeVisits ?? 0, value => {graph.limits={...graph.limits}; if(value===undefined || value===0) delete graph.limits.maxNodeVisits; else graph.limits.maxNodeVisits=value;}, {type:'number',optional:true,min:0,max:100,refresh:true});
1573
- explain(visits,'0 means unlimited, which is the default. A return connection repeats a node, so a graph with one needs a ceiling: a visit limit, or a wall clock. An agent Loop modifier has its own attempt limit.');
1577
+ const visits = field(panels.behavior, 'Maximum visits per step', graph.limits?.maxNodeVisits ?? 0, value => {graph.limits={...graph.limits}; if(value===undefined || value===0) delete graph.limits.maxNodeVisits; else graph.limits.maxNodeVisits=value;}, {type:'number',optional:true,min:0,max:100,refresh:true});
1578
+ explain(visits,'0 means unlimited, which is the default. A return connection repeats a step, so a workflow with one needs a ceiling: a visit limit, or a wall clock. An agent Loop modifier has its own try limit.');
1574
1579
  // Per-graph desktop settings render here; a browser-launched studio has no host bridge and skips them.
1575
1580
  window.AndorraEmbed?.inspector?.(general);
1576
1581
  const advanced = panels.advanced; jsonField(advanced, 'Run limits', graph.limits, value => {graph.limits=value;}); jsonField(advanced,'Run input schema',graph.inputSchema,value=>{graph.inputSchema=value;}); jsonField(advanced,'Run state schema',graph.stateSchema,value=>{graph.stateSchema=value;});
@@ -1578,16 +1583,16 @@ function renderInspector() {
1578
1583
  const panels = inspectorTabs(parent, node.type === 'agent' ? ['general', 'model', 'behavior', 'advanced'] : outcomes(node).length ? ['general', 'behavior', 'advanced'] : ['general', 'advanced']);
1579
1584
  const general = panels.general; field(general, 'Name', node.name, value => {node.name=value;}, {maxLength:200});
1580
1585
  if (node.type === 'agent') {
1581
- if(node.agentRole==='orchestrator'){general.append(el('p','Orchestrator - optional starting Agent for research, clarification and handoff. Remove it to start directly at the next node.','help'));}
1586
+ if(node.agentRole==='orchestrator'){general.append(el('p','Orchestrator: optional starting Agent for research, clarification and handing work on. Remove it to start directly at the next step.','help'));}
1582
1587
  const prompt = promptField(general, 'Prompt', node.instruction ?? node.prompt ?? '', value => {node.instruction=value; delete node.prompt;}, { placeholder: 'Type / to add a skill' });
1583
- explain(prompt, 'Edit the instructions for this agent. Save the graph to use this prompt in future runs. This replaces this node\'s instructions; project guidance, advanced system instructions and runtime permissions still apply. Type / to add a skill: the node loads every /skill its prompt names when it runs. A skill this machine does not have is flagged here and skipped at run time; it never stops the graph.');
1588
+ explain(prompt, 'Edit the instructions for this agent. Save the workflow to use this prompt in future runs. This replaces this step\'s instructions; project guidance, advanced system instructions and runtime permissions still apply. Type / to add a skill: the step loads every /skill its prompt names when it runs. A skill this machine does not have is flagged here and skipped at run time; it never stops the workflow.');
1584
1589
  explain(check(general, 'Jev decisions', node.jevEnabled === true, value => { if (value) node.jevEnabled = true; else delete node.jevEnabled; }), 'Off unless ticked. When Jev is on, it assists this agent with routing decisions. The coding model still implements the task; sign-in, quota and runtime permissions apply.');
1585
1590
  const model = panels.model;
1586
1591
  modelFields(model, node, value => {node.provider=value.provider; node.model=value.model;});
1587
1592
  const conversation = choice(model, 'Conversation', node.contextPolicy?.conversation ?? 'reuse', [{value:'reuse',label:'Reuse with the same provider and model'}, {value:'isolate',label:'Start an isolated conversation'}], value => {node.contextPolicy={...node.contextPolicy,conversation:value};});
1588
- explain(conversation, 'Reuse continues from the preceding Agent with this node\'s instructions and permissions. Different providers or models start fresh. Branches receive separate copies of their shared history. Provider caching and token savings depend on the model service.');
1593
+ explain(conversation, 'Reuse continues from the preceding Agent with this step\'s instructions and permissions. Different providers or models start fresh. Branches receive separate copies of their shared history. Provider caching and token savings depend on the model service.');
1589
1594
  const skills = choice(model, 'Skill inheritance', node.contextPolicy?.skillInheritance ?? 'inherit', [{value:'inherit',label:'Inherit active workflow skills'}, {value:'none',label:'Do not inherit skills'}], value => {node.contextPolicy={...node.contextPolicy,skillInheritance:value};});
1590
- explain(skills, 'Inherits skills activated earlier in this graph, even when the conversation is isolated or the model changes. Each Agent loads the skill for its own role. Opting out also isolates predecessor conversation text to avoid leaking loaded skills; it never changes tool or approval permissions.');
1595
+ explain(skills, 'Inherits skills activated earlier in this workflow, even when the conversation is isolated or the model changes. Each Agent loads the skill for its own role. Opting out also isolates predecessor conversation text to avoid leaking loaded skills; it never changes tool or approval permissions.');
1591
1596
  renderCompletion(section(panels.behavior, node.agentRole === 'orchestrator' ? 'Routing' : 'Outcomes and conditions'), node);
1592
1597
  renderModifiers(panels.behavior, node);
1593
1598
  const advanced = panels.advanced;
@@ -1595,7 +1600,7 @@ function renderInspector() {
1595
1600
  const context = disclosure(advanced, 'Context sharing'); check(context,'Include previous task summaries',node.contextPolicy?.history??false,value=>{node.contextPolicy={...node.contextPolicy,history:value};}); choice(context,'Visible predecessor state',node.contextPolicy?.predecessors||'none',['none','direct','all'],value=>{node.contextPolicy={...node.contextPolicy,predecessors:value};}); field(context,'Maximum context characters',node.contextPolicy?.maxChars??32000,value=>{node.contextPolicy={...node.contextPolicy,maxChars:value};},{type:'number',min:1}); jsonField(context, 'Input mapping', node.inputs, value=>{node.inputs=value;});
1596
1601
  renderSubagents(disclosure(advanced,'Subagents'),node);
1597
1602
  const limits = disclosure(advanced,'Execution limits');
1598
- for (const [key,label,defaultValue] of [['maxContextChars','Context characters',120000],['maxCompletionRepairs','Completion repair attempts',2]]) field(limits,label,node.limits?.[key] ?? defaultValue,value=>{node.limits={...node.limits,[key]:value}; delete node.limits.maxTokens;},{type:'number',min:key==='maxCompletionRepairs'?0:1});
1603
+ for (const [key,label,defaultValue] of [['maxContextChars','Context characters',120000],['maxCompletionRepairs','Completion repair tries',2]]) field(limits,label,node.limits?.[key] ?? defaultValue,value=>{node.limits={...node.limits,[key]:value}; delete node.limits.maxTokens;},{type:'number',min:key==='maxCompletionRepairs'?0:1});
1599
1604
  // Iterations and wall time default to blank, and blank means unlimited. The editor must
1600
1605
  // not invent a bound the author never chose: a task that legitimately runs for hours
1601
1606
  // should not be cut short, and a person answering a question is never on the clock.
@@ -1606,15 +1611,15 @@ function renderInspector() {
1606
1611
  // Tool calls default to blank, and blank means unlimited: an absent limit is only
1607
1612
  // written when the field is cleared, so a node keeps its ceiling once one is set.
1608
1613
  field(limits,'Tool calls (blank = unlimited)',node.limits?.maxToolCalls,value=>{node.limits={...node.limits,maxToolCalls:value}; if(value===undefined)delete node.limits.maxToolCalls;},{type:'number',min:0,optional:true,placeholder:'Unlimited'});
1609
- skillPrompt(field(advanced,'System prompt',node.systemPrompt ?? node.prompt,value=>{node.systemPrompt=value; delete node.prompt;},{multiline:true,maxLength:100000})); jsonField(advanced,'Input schema (JSON Schema)',node.inputSchema,value=>{node.inputSchema=value;}); jsonField(advanced,'Output schema (JSON Schema)',node.outputSchema,value=>{node.outputSchema=value;}); field(advanced,'Retry attempts',node.retry?.maxAttempts??1,value=>{node.retry={...node.retry,maxAttempts:value};},{type:'number',min:1}); const fallback=disclosure(advanced,'Fallback model'); modelFields(fallback,node.retry?.fallback||{},value=>{node.retry={maxAttempts:1,...node.retry,fallback:value.provider?{provider:value.provider,model:value.model}:undefined};});
1614
+ skillPrompt(field(advanced,'System prompt',node.systemPrompt ?? node.prompt,value=>{node.systemPrompt=value; delete node.prompt;},{multiline:true,maxLength:100000})); jsonField(advanced,'Input schema (JSON Schema)',node.inputSchema,value=>{node.inputSchema=value;}); jsonField(advanced,'Output schema (JSON Schema)',node.outputSchema,value=>{node.outputSchema=value;}); field(advanced,'Retries',node.retry?.maxAttempts??1,value=>{node.retry={...node.retry,maxAttempts:value};},{type:'number',min:1}); const fallback=disclosure(advanced,'Fallback model'); modelFields(fallback,node.retry?.fallback||{},value=>{node.retry={maxAttempts:1,...node.retry,fallback:value.provider?{provider:value.provider,model:value.model}:undefined};});
1610
1615
  field(advanced,'Executor','react-basic',()=>{}).disabled=true;
1611
1616
  const tools = disclosure(advanced,'Tool allowlist');
1612
1617
  for (const name of [...new Set([...state.tools.map(t=>typeof t==='string'?t:t.name||t.id),...(node.tools||[])])]) check(tools,name,node.tools===undefined||node.tools.includes(name),enabled=>{const all=state.tools.map(t=>typeof t==='string'?t:t.name||t.id); node.tools=enabled?[...new Set([...(node.tools??all),name])]:(node.tools??all).filter(t=>t!==name);});
1613
- const saveDefinition = el('button','Save agent variant'); saveDefinition.onclick=()=>saveAgentVariant(node); general.append(saveDefinition);
1614
- } else { general.append(el('p', 'This control node does not call a model and has no agent prompt.', 'help')); renderControlInspector(general,node); }
1618
+ const saveDefinition = el('button','Save to Library'); saveDefinition.onclick=()=>saveAgentVariant(node); general.append(saveDefinition);
1619
+ } else { general.append(el('p', 'This control step does not call a model and has no agent prompt.', 'help')); renderControlInspector(general,node); }
1615
1620
  if (panels.behavior) routes(panels.behavior,node);
1616
1621
  const layout = disclosure(panels.advanced,'Position'); const p=position(node,Object.keys(graph.nodes).indexOf(node.id)); field(layout,'X',p.x,value=>{node.position={...p,x:value};},{type:'number',min:-100000,max:100000,refresh:true});field(layout,'Y',p.y,value=>{node.position={...p,y:value};},{type:'number',min:-100000,max:100000,refresh:true});
1617
- const remove=el('button','Remove node','danger');remove.disabled=Object.keys(graph.nodes).length===1;remove.onclick=()=>{void askConfirm({title:`Remove ${node.name}?`,message:'The node and its connections are removed from this graph. Undo brings them back.',confirmLabel:'Remove node',tone:'danger'}).then(confirmed=>{if(confirmed&&state.graph?.nodes?.[node.id])removeNodes(new Set([node.id]));});};panels.advanced.append(remove);
1622
+ const remove=el('button','Remove Step','danger');remove.disabled=Object.keys(graph.nodes).length===1;remove.onclick=()=>{void askConfirm({title:`Remove ${node.name}?`,message:'The step and its connections are removed from this workflow. Undo brings them back.',confirmLabel:'Remove Step',tone:'danger'}).then(confirmed=>{if(confirmed&&state.graph?.nodes?.[node.id])removeNodes(new Set([node.id]));});};panels.advanced.append(remove);
1618
1623
  }
1619
1624
  const validation=section(parent,'Validation');validation.id='validation';renderValidation();
1620
1625
  window.AndorraStudio?.inspector?.(parent, node);
@@ -1624,14 +1629,14 @@ function render() { renderHeading(); renderList(); renderLibrary(); renderCanvas
1624
1629
  // established that loading loses nothing, or the user has asked for the load. Resolves to whether
1625
1630
  // the graph was opened.
1626
1631
  async function openGraph(id, options = {}) {
1627
- if (state.saving) { status('Wait for the current save before opening another graph.'); return false; }
1632
+ if (state.saving) { status('Wait for the current save before opening another workflow.'); return false; }
1628
1633
  if (state.dirty && !options.discard && !await askConfirm(DISCARD_QUESTION)) return false;
1629
1634
  // A caller that already holds the graph (`options.fetched`) is applied without a request, so nothing can change the canvas between its own checks and this replacement.
1630
- try { const opened = options.fetched === undefined ? await api(`/api/graphs/${encodeURIComponent(id)}`) : options.fetched; const capMoved = hasSubagentCap(opened); state.graph = dropLegacyTokenFields(opened); const migrated = state.graph.editorMigration === true; state.dirty = migrated || capMoved; delete state.graph.editorMigration; clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = null; render(); fit(); status(migrated ? 'Legacy graph upgraded in editor - Save to persist a new revision' : capMoved ? 'Orchestrator Max subagents moved to Advanced > Subagents - Save to persist a new revision' : 'Graph loaded'); graphOpened(options.reason || 'open'); return true; } catch (error) { status(error.message, true); return false; }
1635
+ try { const opened = options.fetched === undefined ? await api(`/api/graphs/${encodeURIComponent(id)}`) : options.fetched; const capMoved = hasSubagentCap(opened); state.graph = dropLegacyTokenFields(opened); const migrated = state.graph.editorMigration === true; state.dirty = migrated || capMoved; delete state.graph.editorMigration; clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = null; render(); fit(); status(migrated ? 'This workflow was updated to the current format. Save to keep it.' : capMoved ? 'Orchestrator Max subagents moved to Advanced > Subagents. Save to keep it.' : 'Workflow loaded'); graphOpened(options.reason || 'open'); return true; } catch (error) { status(error.message, true); return false; }
1631
1636
  }
1632
1637
  function newId() { return `graph-${crypto.randomUUID()}`; }
1633
1638
  function newGraph(duplicate = false, discarded = false) {
1634
- if (state.saving) { status('Wait for the current save before creating another graph.'); return; }
1639
+ if (state.saving) { status('Wait for the current save before creating another workflow.'); return; }
1635
1640
  if (!canCreateGraph()) { status(FREE_CREATE_TIP, true); return; }
1636
1641
  // Unsaved edits are asked about first; a clean graph is replaced at once.
1637
1642
  if (state.dirty && !discarded) { void askConfirm(DISCARD_QUESTION).then(discard => { if (discard) newGraph(duplicate, true); }); return; }
@@ -1639,25 +1644,25 @@ function newGraph(duplicate = false, discarded = false) {
1639
1644
  else if (freeTier()) {
1640
1645
  // A free graph starts from the Software Engineer alone: the Orchestrator is a Premium node.
1641
1646
  const engineerPreset=state.definitions.find(definition=>definition.id==='software-engineer')?.node;
1642
- if(!engineerPreset){status('Starting presets are unavailable. Reload the Graph Builder and try again.',true);return;}
1643
- state.graph={schemaVersion:3,id:newId(),name:'Untitled graph',revision:0,entry:'engineer',nodes:{engineer:{...copy(engineerPreset),id:'engineer',position:{x:0,y:0}},done:{id:'done',name:'Done',type:'end',position:{x:320,y:0}}},edges:[{id:'engineer-done',source:'engineer',target:'done',outcome:'completed'}]};
1647
+ if(!engineerPreset){status('Starting presets are unavailable. Reload the Workflow Editor and try again.',true);return;}
1648
+ state.graph={schemaVersion:3,id:newId(),name:'Untitled workflow',revision:0,entry:'engineer',nodes:{engineer:{...copy(engineerPreset),id:'engineer',position:{x:0,y:0}},done:{id:'done',name:'Done',type:'end',position:{x:320,y:0}}},edges:[{id:'engineer-done',source:'engineer',target:'done',outcome:'completed'}]};
1644
1649
  }
1645
1650
  else {
1646
1651
  const orchestratorPreset=state.definitions.find(definition=>definition.node.agentRole==='orchestrator')?.node;
1647
1652
  const engineerPreset=state.definitions.find(definition=>definition.id==='software-engineer')?.node;
1648
- if(!orchestratorPreset || !engineerPreset){status('Starting presets are unavailable. Reload the Graph Builder and try again.',true);return;}
1653
+ if(!orchestratorPreset || !engineerPreset){status('Starting presets are unavailable. Reload the Workflow Editor and try again.',true);return;}
1649
1654
  const orchestrator={...copy(orchestratorPreset),id:'orchestrator',position:{x:0,y:0}};
1650
1655
  const engineer={...copy(engineerPreset),id:'engineer',position:{x:320,y:0}};
1651
1656
  const inputMapping={originalTask:'$run.input.task'};
1652
1657
  for(const key of ['taskInstruction','requirements','acceptanceCriteria','designConsiderations','codebaseFindings']) inputMapping[key]=`$source.output.${key}`;
1653
- state.graph={schemaVersion:3,id:newId(),name:'Untitled graph',revision:0,entry:'orchestrator',nodes:{orchestrator,engineer,done:{id:'done',name:'Done',type:'end',position:{x:640,y:0}}},edges:[{id:'orchestrator-engineer',source:'orchestrator',target:'engineer',outcome:'completed',inputMapping},{id:'engineer-done',source:'engineer',target:'done',outcome:'completed'}]};
1658
+ state.graph={schemaVersion:3,id:newId(),name:'Untitled workflow',revision:0,entry:'orchestrator',nodes:{orchestrator,engineer,done:{id:'done',name:'Done',type:'end',position:{x:640,y:0}}},edges:[{id:'orchestrator-engineer',source:'orchestrator',target:'engineer',outcome:'completed',inputMapping},{id:'engineer-done',source:'engineer',target:'done',outcome:'completed'}]};
1654
1659
  }
1655
1660
  // A duplicate copies the open graph, providerless nodes included, so its unmet provider
1656
1661
  // requirements travel with it; an unrelated new graph starts without any.
1657
1662
  state.dirty = true; clearSelection(); state.undo = []; state.redo = [];
1658
1663
  state.untouched = JSON.stringify(state.graph);
1659
1664
  state.pendingProviderNodes = duplicate ? new Set(state.pendingProviderNodes ?? []) : null;
1660
- render(); fit(); status('New graph - Customize your agent and save your first revision');
1665
+ render(); fit(); status('New workflow · Customize your agent, then save');
1661
1666
  graphOpened(duplicate ? 'duplicate' : 'new');
1662
1667
  }
1663
1668
  // The settings a new Agent starts from, whether it is dropped on the canvas or added to the list.
@@ -1677,7 +1682,7 @@ function addNode(type, definition, dropPosition) {
1677
1682
  const canResearch = definition.capabilities?.filesystem !== 'none' &&
1678
1683
  (definition.tools === undefined || ['Read','Glob','Grep','repo_explore'].some(tool => researchTools.includes(tool)));
1679
1684
  if (!canResearch) {
1680
- status('Cannot apply this Orchestrator variant: enable filesystem read access and at least one research tool (Read, Glob, Grep, or repo_explore), then save the variant again. Choose another Orchestrator variant to continue.', true);
1685
+ status('Cannot apply this saved Orchestrator: enable filesystem read access and at least one research tool (Read, Glob, Grep, or repo_explore), then save it again. Choose another saved Orchestrator to continue.', true);
1681
1686
  return;
1682
1687
  }
1683
1688
  // Saved definitions can predate intake's required research and clarification.
@@ -1703,7 +1708,7 @@ function addNode(type, definition, dropPosition) {
1703
1708
  clearSelection(); state.selected = existing.id; state.selectedIds = [existing.id];
1704
1709
  }, true);
1705
1710
  showInspector();
1706
- status('Starting Orchestrator definition applied. Matching routes and handoffs were kept; validate mappings before saving. Undo restores the previous definition.');
1711
+ status('Saved Orchestrator applied. Matching routes and connections were kept; check their inputs before saving. Undo restores the previous definition.');
1707
1712
  return;
1708
1713
  }
1709
1714
  }
@@ -1766,9 +1771,9 @@ function requireAgentName(input) {
1766
1771
  function saveAgentVariant(node) {
1767
1772
  const name = el('input'); name.value = node.name; name.required = true; name.maxLength = 200;
1768
1773
  const snapshot = copy(node), id = `definition-${crypto.randomUUID()}`;
1769
- libraryDialog('Save Agent variant', [['Variant name', name]], async () => {
1774
+ libraryDialog('Save agent to library', [['Name', name]], async () => {
1770
1775
  const agentName = requireAgentName(name);
1771
- await writeDefinition({schemaVersion:2, id, name:agentName, description:'', revision:0, node:{...snapshot,name:agentName}}, 'Agent variant saved');
1776
+ await writeDefinition({schemaVersion:2, id, name:agentName, description:'', revision:0, node:{...snapshot,name:agentName}}, 'Saved to library');
1772
1777
  });
1773
1778
  }
1774
1779
  // Truncation counts the field's own unit (UTF-16 code units) but must not cut between the two
@@ -1854,7 +1859,7 @@ async function shareAgent(definition) {
1854
1859
  // Built-in Agents have no Delete. Graphs that already use a deleted Agent keep their own copy.
1855
1860
  async function deleteAgent(definition) {
1856
1861
  if (definition.preset) return;
1857
- if (!confirm(`Delete the Agent "${definition.name}"? Graphs that already use it keep their own copy. This cannot be undone.`)) return;
1862
+ if (!confirm(`Delete the Agent "${definition.name}"? Workflows that already use it keep their own copy. This cannot be undone.`)) return;
1858
1863
  try { await api(`/api/definitions/${encodeURIComponent(definition.id)}`, undefined, { method: 'DELETE' }); }
1859
1864
  catch (error) {
1860
1865
  // A lost response can still have deleted it, so the refreshed list decides what is reported.
@@ -1898,7 +1903,7 @@ async function writeDefinition(payload, saved) {
1898
1903
  function renderLibrary() {
1899
1904
  const container = $('node-library'); container.replaceChildren();
1900
1905
  const query = $('node-search').value.toLowerCase();
1901
- const definitionItem = d => ({name:d.name,type:'agent',description:d.preset ? 'Editable Agent preset' : `Saved variant - r${d.revision}`,node:d.node,definition:d});
1906
+ const definitionItem = d => ({name:d.name,type:'agent',description:d.preset ? 'Editable Agent preset' : `Saved agent · version ${d.revision}`,node:d.node,definition:d});
1902
1907
  const addItem = (parent, item) => {
1903
1908
  // A library item drags onto the canvas; a click, Enter or Space adds it, so the library stays
1904
1909
  // usable without a pointer. The type icon is placed first by the stylesheet's grid.
@@ -1921,7 +1926,7 @@ function renderLibrary() {
1921
1926
  const freeRefusal = freeNodeRefusal([{ type: item.type, agentRole: item.node?.agentRole }]);
1922
1927
  if (freeRefusal) button.title = freeRefusal;
1923
1928
  button.disabled = cannotAdd && !item.definition; button.draggable = !button.disabled && !freeRefusal;
1924
- button.onclick = () => { if (cannotAdd) { status(state.graph ? 'Graph node limit reached.' : 'Open a graph to add this Agent.', true); return; } addNode(item.type, item.node); };
1929
+ button.onclick = () => { if (cannotAdd) { status(state.graph ? 'Workflow step limit reached.' : 'Open a workflow to add this Agent.', true); return; } addNode(item.type, item.node); };
1925
1930
  button.ondragstart = event => { event.dataTransfer.setData('application/andorra-node', JSON.stringify({name:item.name,type:item.type,node:item.node})); event.dataTransfer.effectAllowed = 'copy'; };
1926
1931
  row.append(button);
1927
1932
  // An Agent's actions are secondary, so they open from a right-click on the row (which the
@@ -1964,7 +1969,7 @@ function renderLibrary() {
1964
1969
  if (agents) agents.append(el('p','Select an Agent to configure Condition, Loop, and Parallel modifiers.','help'));
1965
1970
  section(container,'control','Control',['join'].map(type=>({name:type.charAt(0).toUpperCase()+type.slice(1),type,description:{condition:'Branch on run state',loop:'Bounded repetition',parallel:'Explicit fan-out',join:'Wait for all or any branches'}[type]})));
1966
1971
  section(container,'actions','Actions',[{name:'Run command',type:'action',node:{name:'Run command',action:{kind:'command',command:''}},description:'Execute a shell command'},{name:'Run tests',type:'action',node:{name:'Run tests',action:{kind:'tests',command:'npm test'}},description:'Execute project tests'},{name:'Git operation',type:'action',node:{name:'Git operation',action:{kind:'git',command:'git status'}},description:'Run a Git operation'}]);
1967
- section(container,'flow','Flow',[{name:'Human approval',type:'approval',description:'Pause for a decision'},{name:'End',type:'end',description:'Finish this graph path'}]);
1972
+ section(container,'flow','Flow',[{name:'Human approval',type:'approval',description:'Pause for a decision'},{name:'End',type:'end',description:'Finish this workflow path'}]);
1968
1973
  }
1969
1974
  // Fit, Arrange and the zoom buttons ease the view to where it is going, over --dur-3 on an ease-in-out
1970
1975
  // with no overshoot, so the eye can follow the cards. A gesture (pan, pinch, wheel) stops the ease and
@@ -2044,7 +2049,7 @@ $('save').onclick = async () => {
2044
2049
  try { const submitted = dropLegacyTokenFields(copy(state.graph)); const graph = await api('/api/graphs', submitted); if (state.graph.id === submitted.id) {
2045
2050
  // The draft marker is editor state, not graph content, so a difference in it alone is not an edit.
2046
2051
  const liveView = { ...state.graph }; delete liveView.pendingProviderNodes;
2047
- const edited = JSON.stringify(liveView) !== JSON.stringify(submitted); if (edited) { state.graph.revision = graph.revision; state.undo = []; state.redo = []; } else { state.graph = graph; state.dirty = false; state.undo = []; state.redo = []; } retireSatisfiedProviderRequirements(); } const index = state.graphs.findIndex(g => g.id === graph.id); const summary = { id: graph.id, name: graph.name, revision: graph.revision }; if (index >= 0) state.graphs[index] = summary; else state.graphs.push(summary); render(); status(`Saved revision ${graph.revision}${state.dirty ? ' - You have newer unsaved changes' : ''}`); } catch (error) { status(error.message, true); } finally { state.saving = false; renderHeading(); renderList(); }
2052
+ const edited = JSON.stringify(liveView) !== JSON.stringify(submitted); if (edited) { state.graph.revision = graph.revision; state.undo = []; state.redo = []; } else { state.graph = graph; state.dirty = false; state.undo = []; state.redo = []; } retireSatisfiedProviderRequirements(); } const index = state.graphs.findIndex(g => g.id === graph.id); const summary = { id: graph.id, name: graph.name, revision: graph.revision }; if (index >= 0) state.graphs[index] = summary; else state.graphs.push(summary); render(); status(`Saved version ${graph.revision}${state.dirty ? ' · You have newer unsaved changes' : ''}`); } catch (error) { status(error.message, true); } finally { state.saving = false; renderHeading(); renderList(); }
2048
2053
  };
2049
2054
  $('canvas-hint-close').onclick = dismissCanvasHint;
2050
2055
  $('fit').onclick = () => fit(true); $('zoom-in').onclick = () => zoomBy(1.2); $('zoom-out').onclick = () => zoomBy(1 / 1.2);
@@ -2118,7 +2123,7 @@ if (token) setTimeout(refreshCloudState, 1000);
2118
2123
  entry point is feature-detected because this module also loads into partial-DOM harnesses.
2119
2124
  The idle favicon is the published Andorra Labs logo; the two busy states are status markers
2120
2125
  rather than the brand, so they keep their own artwork. */
2121
- const baseTitle = document.title || 'Graph studio - Andorra Code';
2126
+ const baseTitle = document.title || 'Workflow Editor · Andorra Code';
2122
2127
  const faviconHref = svg => 'data:image/svg+xml,' + encodeURIComponent(svg);
2123
2128
  const FAVICONS = {
2124
2129
  idle: '/andorra-logo.png',
@@ -2203,4 +2208,4 @@ setFavicon('idle');
2203
2208
  if (token) watchActivity();
2204
2209
  try { if ((!window.parent || window.parent === window) && typeof Notification === 'function' && Notification.permission === 'default') { window.addEventListener('pointerdown', requestActivityNotifications); window.addEventListener('keydown', requestActivityNotifications); } } catch { /* Partial DOM. */ }
2205
2210
 
2206
- (async () => { renderHeading(); if (!token) { status('Session token missing. Open this app using andorra graph.', true); return; } try { const data = await api('/api/bootstrap'); state.plan = data.plan; state.graphs = data.graphs; applyProviderRegistry(data); state.tools = data.tools || []; state.definitions = foldDefinitionCaps(data.definitions); renderLibrary(); renderList(); const wantsNew = new URLSearchParams(location.search).get('new') === '1'; if (wantsNew && canCreateGraph()) newGraph(); else if (state.graphs.length) { await openGraph((freeTier() && state.plan.freeGraphId) || state.graphs[0].id); if (wantsNew) status(FREE_CREATE_TIP, true); } else { render(); status('Create your first graph'); } window.AndorraEmbed?.ready?.(); if (data.graphMigrationErrors?.length) status('Some saved graphs could not be opened: ' + data.graphMigrationErrors.map(item => item.name + ' (' + item.id + '): ' + item.error).join('; ') + '. Their saved revisions are unchanged.', true); } catch (error) { status(error.message, true); } })();
2211
+ (async () => { renderHeading(); if (!token) { status('The sign-in token is missing. Open this app with the andorra graph command.', true); return; } try { const data = await api('/api/bootstrap'); state.plan = data.plan; state.graphs = data.graphs; applyProviderRegistry(data); state.tools = data.tools || []; state.definitions = foldDefinitionCaps(data.definitions); renderLibrary(); renderList(); const wantsNew = new URLSearchParams(location.search).get('new') === '1'; if (wantsNew && canCreateGraph()) newGraph(); else if (state.graphs.length) { await openGraph((freeTier() && state.plan.freeGraphId) || state.graphs[0].id); if (wantsNew) status(FREE_CREATE_TIP, true); } else { render(); status('Create your first workflow'); } window.AndorraEmbed?.ready?.(); if (data.graphMigrationErrors?.length) status('Some saved workflows could not be opened: ' + data.graphMigrationErrors.map(item => item.name + ' (' + item.id + '): ' + item.error).join('; ') + '. Their saved versions are unchanged.', true); } catch (error) { status(error.message, true); } })();