@andorra-labs/code 0.1.10 → 0.1.12

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 (238) hide show
  1. package/README.md +31 -205
  2. package/THIRD_PARTY_NOTICES.md +30 -0
  3. package/dist/src/agent-execution.js +50 -2
  4. package/dist/src/agent-mcp.js +5 -0
  5. package/dist/src/app-server/protocol.d.ts +9 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +49 -1
  8. package/dist/src/app-server.js +353 -64
  9. package/dist/src/automation-service.js +1 -1
  10. package/dist/src/browser-panel-tool.d.ts +24 -3
  11. package/dist/src/browser-panel-tool.js +80 -6
  12. package/dist/src/browser-runner.js +3 -1
  13. package/dist/src/browser-session.d.ts +8 -0
  14. package/dist/src/browser-session.js +27 -1
  15. package/dist/src/browser-ui/app.js +237 -15
  16. package/dist/src/browser-ui/index.html +5 -5
  17. package/dist/src/browser-ui/style.css +110 -65
  18. package/dist/src/browser-ui/tokens.css +27 -26
  19. package/dist/src/browser-view.d.ts +16 -0
  20. package/dist/src/browser-view.js +38 -2
  21. package/dist/src/claude-provider.js +15 -2
  22. package/dist/src/cli.d.ts +2 -1
  23. package/dist/src/cli.js +175 -43
  24. package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
  25. package/dist/src/codex-provider.js +6 -3
  26. package/dist/src/coding-tools.d.ts +26 -1
  27. package/dist/src/coding-tools.js +104 -33
  28. package/dist/src/command-screens.js +1 -1
  29. package/dist/src/commands.js +1 -1
  30. package/dist/src/completion-gates.d.ts +42 -7
  31. package/dist/src/completion-gates.js +55 -9
  32. package/dist/src/completion.d.ts +51 -1
  33. package/dist/src/completion.js +164 -5
  34. package/dist/src/config.d.ts +1 -0
  35. package/dist/src/config.js +2 -0
  36. package/dist/src/dashboard-view.js +2 -2
  37. package/dist/src/deadline.js +4 -0
  38. package/dist/src/decision/PreparedSteps.js +1 -1
  39. package/dist/src/delegation-changes.js +19 -2
  40. package/dist/src/diff-preview.d.ts +1 -0
  41. package/dist/src/diff-preview.js +12 -3
  42. package/dist/src/engine-streams.d.ts +22 -0
  43. package/dist/src/engine-streams.js +16 -0
  44. package/dist/src/extensions.js +17 -6
  45. package/dist/src/file-read-key.d.ts +8 -0
  46. package/dist/src/file-read-key.js +12 -0
  47. package/dist/src/graph-editor-session.js +2 -1
  48. package/dist/src/graph-health.d.ts +21 -0
  49. package/dist/src/graph-health.js +46 -0
  50. package/dist/src/graph-manager-chat.d.ts +52 -3
  51. package/dist/src/graph-manager-chat.js +62 -17
  52. package/dist/src/graph-runner.js +62 -5
  53. package/dist/src/graph-server.d.ts +1 -1
  54. package/dist/src/graph-server.js +48 -27
  55. package/dist/src/graph-sync.d.ts +8 -0
  56. package/dist/src/graph-sync.js +54 -3
  57. package/dist/src/graph-tool.js +1 -1
  58. package/dist/src/graph-ui/app.js +362 -123
  59. package/dist/src/graph-ui/controls.css +95 -22
  60. package/dist/src/graph-ui/controls.js +31 -1
  61. package/dist/src/graph-ui/embed.js +62 -13
  62. package/dist/src/graph-ui/icons.js +7 -0
  63. package/dist/src/graph-ui/index.html +4 -4
  64. package/dist/src/graph-ui/manager-state.js +143 -5
  65. package/dist/src/graph-ui/manager.css +21 -20
  66. package/dist/src/graph-ui/manager.js +337 -75
  67. package/dist/src/graph-ui/model-picker.js +279 -0
  68. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  69. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  70. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  71. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  72. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  73. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  74. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  75. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  76. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  77. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  78. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  79. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  80. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  81. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  82. package/dist/src/graph-ui/skill-picker.js +1 -1
  83. package/dist/src/graph-ui/studio-canvas.js +8 -8
  84. package/dist/src/graph-ui/studio.css +18 -15
  85. package/dist/src/graph-ui/studio.js +92 -35
  86. package/dist/src/graph-ui/style.css +122 -79
  87. package/dist/src/graph-ui/theme.js +2 -2
  88. package/dist/src/graph-ui/tokens.css +33 -29
  89. package/dist/src/graphs.d.ts +5 -2
  90. package/dist/src/graphs.js +10 -9
  91. package/dist/src/mcp.d.ts +52 -14
  92. package/dist/src/mcp.js +285 -128
  93. package/dist/src/membership-errors.d.ts +7 -1
  94. package/dist/src/membership-errors.js +9 -3
  95. package/dist/src/memory/ProjectMemory.d.ts +77 -0
  96. package/dist/src/memory/ProjectMemory.js +310 -0
  97. package/dist/src/memory/index.d.ts +1 -0
  98. package/dist/src/memory/index.js +1 -0
  99. package/dist/src/opencode-provider.js +5 -6
  100. package/dist/src/package-name.d.ts +3 -0
  101. package/dist/src/package-name.js +3 -0
  102. package/dist/src/provider-engine.js +2 -2
  103. package/dist/src/pull-requests.d.ts +42 -6
  104. package/dist/src/pull-requests.js +11 -3
  105. package/dist/src/qa/runtime/PtyManager.js +2 -1
  106. package/dist/src/react-runtime.js +137 -22
  107. package/dist/src/read-document-doc.d.ts +20 -0
  108. package/dist/src/read-document-doc.js +524 -0
  109. package/dist/src/read-document-docx.d.ts +21 -0
  110. package/dist/src/read-document-docx.js +584 -0
  111. package/dist/src/read-document-text.d.ts +29 -0
  112. package/dist/src/read-document-text.js +67 -0
  113. package/dist/src/read-document-tool.d.ts +48 -0
  114. package/dist/src/read-document-tool.js +162 -0
  115. package/dist/src/read-document.d.ts +78 -0
  116. package/dist/src/read-document.js +353 -0
  117. package/dist/src/read-image.d.ts +29 -2
  118. package/dist/src/read-image.js +42 -17
  119. package/dist/src/remote/cert.d.ts +1 -1
  120. package/dist/src/remote/cert.js +2 -7
  121. package/dist/src/remote/client.js +1 -1
  122. package/dist/src/remote/pem.d.ts +6 -0
  123. package/dist/src/remote/pem.js +11 -0
  124. package/dist/src/run-records.js +49 -10
  125. package/dist/src/runtime.d.ts +21 -0
  126. package/dist/src/runtime.js +10 -1
  127. package/dist/src/session-changes.d.ts +6 -1
  128. package/dist/src/session-changes.js +13 -5
  129. package/dist/src/sessions.d.ts +3 -1
  130. package/dist/src/sessions.js +5 -3
  131. package/dist/src/side-panel.d.ts +6 -1
  132. package/dist/src/side-panel.js +12 -10
  133. package/dist/src/sign-in-detection.d.ts +82 -0
  134. package/dist/src/sign-in-detection.js +197 -0
  135. package/dist/src/sign-in-offer.d.ts +35 -0
  136. package/dist/src/sign-in-offer.js +116 -0
  137. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  138. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  139. package/dist/src/skills/bundled/graph-manager/SKILL.md +59 -7
  140. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  141. package/dist/src/skills/bundled/provenance.json +4 -4
  142. package/dist/src/skills/runtime-skills.d.ts +6 -0
  143. package/dist/src/skills/runtime-skills.js +16 -3
  144. package/dist/src/stall-recovery.d.ts +6 -2
  145. package/dist/src/stall-recovery.js +7 -2
  146. package/dist/src/stray-files.d.ts +14 -0
  147. package/dist/src/stray-files.js +81 -0
  148. package/dist/src/subagent-run.js +6 -1
  149. package/dist/src/terminal-ui.d.ts +1 -1
  150. package/dist/src/terminal-ui.js +11 -5
  151. package/dist/src/time-limit.d.ts +53 -0
  152. package/dist/src/time-limit.js +79 -0
  153. package/dist/src/tool-activity.js +1 -1
  154. package/dist/src/tool-schema-compatibility.d.ts +7 -2
  155. package/dist/src/tool-schema-compatibility.js +8 -4
  156. package/dist/src/tools.js +92 -7
  157. package/dist/src/transcript.d.ts +5 -0
  158. package/dist/src/transcript.js +12 -4
  159. package/dist/src/types.d.ts +8 -0
  160. package/dist/src/untracked-file-removal.d.ts +3 -0
  161. package/dist/src/untracked-file-removal.js +125 -0
  162. package/dist/src/update-check.js +1 -1
  163. package/dist/src/update.d.ts +11 -1
  164. package/dist/src/update.js +27 -5
  165. package/dist/src/usage-analytics.d.ts +3 -1
  166. package/dist/src/usage-analytics.js +16 -2
  167. package/dist/src/workspace-git-metadata.d.ts +15 -0
  168. package/dist/src/workspace-git-metadata.js +50 -1
  169. package/dist/src/workspace-instructions.js +1 -1
  170. package/package.json +6 -26
  171. package/docs/README.md +0 -36
  172. package/docs/agents/README.md +0 -62
  173. package/docs/agents/install-for-agents.md +0 -56
  174. package/docs/agents/mcp-server.md +0 -212
  175. package/docs/agents/subagent-mode.md +0 -149
  176. package/docs/concepts/README.md +0 -47
  177. package/docs/concepts/jev-actionable-routing.md +0 -113
  178. package/docs/concepts/jev-decision-thresholds.md +0 -412
  179. package/docs/concepts/jev-efficiency.md +0 -217
  180. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  181. package/docs/concepts/limits.md +0 -52
  182. package/docs/concepts/memory.md +0 -10
  183. package/docs/concepts/security.md +0 -50
  184. package/docs/concepts/workspace-instructions.md +0 -29
  185. package/docs/getting-started/README.md +0 -82
  186. package/docs/getting-started/accounts.md +0 -78
  187. package/docs/getting-started/configure-providers.md +0 -132
  188. package/docs/guides/README.md +0 -13
  189. package/docs/guides/browser.md +0 -39
  190. package/docs/guides/desktop-app.md +0 -414
  191. package/docs/guides/extensions.md +0 -102
  192. package/docs/guides/graph-builder.md +0 -116
  193. package/docs/guides/headless.md +0 -46
  194. package/docs/guides/tui.md +0 -75
  195. package/docs/guides/update.md +0 -70
  196. package/docs/guides/web-search.md +0 -51
  197. package/docs/guides/windows-code-signing.md +0 -319
  198. package/docs/llms.txt +0 -45
  199. package/docs/reference/README.md +0 -7
  200. package/docs/reference/cli.md +0 -76
  201. package/docs/reference/config.md +0 -91
  202. package/docs/reference/slash-commands.md +0 -59
  203. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  204. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  205. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  206. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  207. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  208. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  209. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  210. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  211. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  212. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  213. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  214. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  215. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  216. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  217. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  218. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  219. package/scripts/jev-efficiency-eval.mjs +0 -187
  220. package/scripts/jev-efficiency-live.mjs +0 -193
  221. package/scripts/zcode-engine-replay.mjs +0 -223
  222. package/tests/agent-centric-mcp-test-plan.md +0 -208
  223. package/tests/analytics-settings-test-plan.md +0 -165
  224. package/tests/browser-cli-smoke.mjs +0 -276
  225. package/tests/browser-test-plan.md +0 -280
  226. package/tests/chat-side-panel-test-plan.md +0 -309
  227. package/tests/decision-engine-test-plan.md +0 -163
  228. package/tests/default-active-jev-test-plan.md +0 -85
  229. package/tests/harness-extensions-test-plan.md +0 -113
  230. package/tests/jev-all-decisions-test-plan.md +0 -156
  231. package/tests/jev-efficiency/criteria.json +0 -158
  232. package/tests/jev-efficiency/workloads.mjs +0 -242
  233. package/tests/jev-efficiency-test-plan.md +0 -198
  234. package/tests/permissions-sandbox-probe.mjs +0 -74
  235. package/tests/permissions-test-plan.md +0 -191
  236. package/tests/product-telemetry-test-plan.md +0 -536
  237. package/tests/thinking-stream-preview-test-plan.md +0 -136
  238. package/tests/zcode-react-engine-test-plan.md +0 -396
@@ -87,6 +87,61 @@
87
87
  }
88
88
  let inspectorContextId = '';
89
89
 
90
+ // The run log in words (D13): the journal's event types, a run's status, a duration and a count
91
+ // as a person reads them, never the engine's identifiers ("graph.node.completed", "failed",
92
+ // "90000ms"). An event this table does not know yet is named from its last words, without the
93
+ // engine's prefixes.
94
+ const EVENT_WORDS = {
95
+ 'graph.started': 'Run started', 'graph.completed': 'Run finished', 'graph.stopped': 'Run stopped',
96
+ 'graph.paused': 'Run paused', 'graph.resumed': 'Run resumed', 'graph.finalization.resumed': 'Finishing resumed',
97
+ 'graph.node.started': 'Step started', 'graph.node.completed': 'Step finished', 'graph.edge.activated': 'Route taken',
98
+ 'graph.approval': 'Approval requested', 'approval.requested': 'Approval requested',
99
+ 'approval.approved': 'Approved', 'approval.denied': 'Denied',
100
+ 'graph.todos.updated': 'To-dos updated', 'graph.widgets.updated': 'Widgets updated',
101
+ 'graph.skill.activated': 'Skill used', 'graph.skill.missing': 'Skill missing',
102
+ 'node.tool.started': 'Tool started', 'node.tool.completed': 'Tool finished', 'node.tool.failed': 'Tool failed',
103
+ 'node.model.response': 'Model response', 'agent.model.completed': 'Model response',
104
+ };
105
+ function eventWords(type) {
106
+ if (Object.hasOwn(EVENT_WORDS, type)) return EVENT_WORDS[type];
107
+ const words = String(type || '').split('.').filter(part => !['graph', 'node', 'agent'].includes(part))
108
+ .join(' ').replace(/[_-]+/g, ' ').trim();
109
+ return words ? words.charAt(0).toUpperCase() + words.slice(1) : 'Event';
110
+ }
111
+ /** How a run ended or stands, the desktop's words (RunsView runStatusLabel): one word per state, so a
112
+ * stop the person asked for is Stopped, a run that ended on a question needs your input, and every
113
+ * failure is Failed (P-ATN-07). `test/graph-studio-review-regressions.test.ts` holds the two lists to
114
+ * each other. */
115
+ function runStatusWords(status) {
116
+ return {
117
+ succeeded: 'Succeeded', running: 'Running', interrupted: 'Interrupted', cancelled: 'Stopped',
118
+ needs_clarification: 'Needs your input', infrastructure_error: 'Failed',
119
+ unknown: 'Unknown',
120
+ }[status] || 'Failed';
121
+ }
122
+ /** A duration the way the desktop's metrics read it: tenths under a minute, then "1m 30s". */
123
+ function durationWords(ms) {
124
+ if (!Number.isFinite(ms) || ms < 0) return '';
125
+ const tenths = Math.round(ms / 100) / 10;
126
+ if (tenths < 60) return tenths + 's';
127
+ const total = Math.round(ms / 1000), hours = Math.floor(total / 3600), minutes = Math.floor((total % 3600) / 60), seconds = total % 60;
128
+ return hours ? hours + 'h ' + minutes + 'm ' + seconds + 's' : minutes + 'm ' + seconds + 's';
129
+ }
130
+ const countWords = value => (Number.isFinite(value) ? value : 0).toLocaleString('en-US');
131
+ /** What a marquee selected, with the noun agreeing: "Selected 1 step." / "Selected 7 steps." */
132
+ const selectedStepsText = count => 'Selected ' + count + (count === 1 ? ' step.' : ' steps.');
133
+ /** One line of the run log: when, which step, what happened, how long, what it used. */
134
+ function runEventLine(event, name) {
135
+ const parts = [];
136
+ if (event.time) parts.push(new Date(event.time).toLocaleTimeString());
137
+ parts.push(name, eventWords(event.type) + (event.outcome ? ' (' + event.outcome + ')' : ''));
138
+ // How a stopped run ended, unless the event's own words already say it ("Run stopped" for a stop).
139
+ if (event.type === 'graph.stopped' && event.status && !['succeeded', 'cancelled'].includes(event.status)) parts.push(runStatusWords(event.status));
140
+ if (event.durationMs !== null && event.durationMs !== undefined) { const took = durationWords(event.durationMs); if (took) parts.push(took); }
141
+ if (event.usage) parts.push(countWords(event.usage.inputTokens) + ' in / ' + countWords(event.usage.outputTokens) + ' out');
142
+ return parts.join(' · ');
143
+ }
144
+
90
145
  function diffGraph(before, after) {
91
146
  const a = before.nodes || {}, b = after.nodes || {};
92
147
  const add = Object.keys(b).filter(id => !Object.hasOwn(a, id));
@@ -111,7 +166,7 @@
111
166
  '\nChanged steps: ' + (delta.changed.join(', ') || 'none') +
112
167
  '\nConnections added: ' + delta.edgesAdded +
113
168
  '\nConnections removed: ' + delta.edgesRemoved +
114
- '\nWorkflow settings changed: ' + (JSON.stringify({
169
+ '\nGraph settings changed: ' + (JSON.stringify({
115
170
  name: before.name, entry: before.entry, limits: before.limits, widgets: before.widgets,
116
171
  inputSchema: before.inputSchema, stateSchema: before.stateSchema, metadata: before.metadata
117
172
  }) !== JSON.stringify({
@@ -123,6 +178,8 @@
123
178
  if (state.dirty && !await askConfirm({ title: 'Replace your unsaved edits?', message: 'Recoverable drafts are saved separately.', confirmLabel: 'Replace', tone: 'danger' })) return false;
124
179
  clearSelection();
125
180
  state.graph = dropLegacyTokenFields(copy(next));
181
+ // A replacement has no saved form on the canvas to return to, so it stays unsaved until saved.
182
+ state.savedKey = null;
126
183
  state.dirty = true;
127
184
  state.undo = [];
128
185
  state.redo = [];
@@ -143,7 +200,7 @@
143
200
  async function importGraphJson(data) {
144
201
  if (typeof canCreateGraph === 'function' && !canCreateGraph()) throw new Error(FREE_CREATE_TIP);
145
202
  if (!data || typeof data !== 'object' || Array.isArray(data) || !data.nodes || typeof data.nodes !== 'object'
146
- || Array.isArray(data.nodes) || !Array.isArray(data.edges)) throw new Error('The file is not an Andorra workflow.');
203
+ || Array.isArray(data.nodes) || !Array.isArray(data.edges)) throw new Error('The file is not an Andorra graph.');
147
204
  const next = { ...data, id: newId(), revision: 0 };
148
205
  delete next.editorMigration;
149
206
  delete next.pendingProviderNodes; // a shared file never carries this editor's draft marker
@@ -158,8 +215,8 @@
158
215
  const pending = Object.values(validated.graph.nodes)
159
216
  .filter(node => node.type === 'agent' && !node.provider).map(node => node.id);
160
217
  if (await applyDraft(validated.graph, pending.length
161
- ? 'Imported workflow. Assign a model profile to every outlined step, then save.'
162
- : 'Imported workflow validated. Save it to keep it.',
218
+ ? 'Imported graph. Assign a model profile to every outlined step, then save.'
219
+ : 'Imported graph validated. Save it to keep it.',
163
220
  // The install runs after applyDraft's marker-stripping copy, so the requirements are
164
221
  // mirrored onto the live draft here — that mirror is what an autosave persists and a
165
222
  // later draft recovery restores.
@@ -171,32 +228,32 @@
171
228
  }
172
229
  async function importGraphFile(file) {
173
230
  if (!file) throw new Error('Choose a JSON file first.');
174
- if (file.size > 450 * 1024) throw new Error('The JSON file exceeds the workflow size limit.');
231
+ if (file.size > 450 * 1024) throw new Error('The JSON file exceeds the graph size limit.');
175
232
  return importGraphJson(JSON.parse(await file.text()));
176
233
  }
177
234
 
178
235
  function openImport() {
179
- modal('Import workflow JSON', body => {
180
- paragraph(body, 'Import creates a new workflow ID and never overwrites the original workflow. Only validated workflow JSON is accepted.');
236
+ modal('Import graph JSON', body => {
237
+ paragraph(body, 'Import creates a new graph ID and never overwrites the original graph. Only validated graph JSON is accepted.');
181
238
  // The app's drop zone and Browse button; the platform's bare file input only where that
182
239
  // layer is absent.
183
240
  const picker = typeof globalThis.AndorraControls?.filePicker === 'function'
184
- ? globalThis.AndorraControls.filePicker({ accept: '.json,application/json', label: 'Choose a workflow JSON file', hint: 'or drop it here · up to 450 KB' })
241
+ ? globalThis.AndorraControls.filePicker({ accept: '.json,application/json', label: 'Choose a graph JSON file', hint: 'or drop it here · up to 450 KB' })
185
242
  : (() => {
186
243
  const input = element('input');
187
244
  input.type = 'file';
188
245
  input.accept = '.json,application/json';
189
- input.setAttribute('aria-label', 'Choose workflow JSON');
246
+ input.setAttribute('aria-label', 'Choose graph JSON');
190
247
  return { element: input, file: () => input.files?.[0] };
191
248
  })();
192
249
  const feedback = element('p', '', 'help');
193
250
  feedback.setAttribute('role', 'status');
194
251
  body.append(picker.element, feedback);
195
- body.append(action('Import as New Workflow', async () => {
252
+ body.append(action('Import as New Graph', async () => {
196
253
  const chosen = picker.file();
197
254
  if (!chosen) throw new Error('Choose a JSON file first.');
198
255
  if (await importGraphFile(chosen)) {
199
- feedback.textContent = 'Import complete: new unsaved workflow ready.';
256
+ feedback.textContent = 'Import complete: new unsaved graph ready.';
200
257
  }
201
258
  }, 'primary'));
202
259
  });
@@ -252,15 +309,17 @@
252
309
  }
253
310
 
254
311
  function openTemplates() {
255
- modal('Start from a workflow template', body => {
312
+ modal('Start from a graph template', body => {
256
313
  paragraph(body, 'Templates are editable local drafts. They never run or save automatically.');
257
314
  for (const [id, name, desc] of [
258
315
  ['fast', 'Fast Fix', 'Direct coding-agent flow without an intake Orchestrator'],
259
316
  ['review', 'Review and Repair', 'Implement, review, then retry defects for as long as the run clock allows'],
260
317
  ['qa', 'QA Gate', 'Research, implement, and pass through an independent read-only QA Agent'],
261
318
  ]) {
319
+ // Every row is one choice among equals, so none takes the blue fill: that marks a screen's
320
+ // one action (A1), and three of them stacked named none.
262
321
  const row = element('div', undefined, 'studio-template');
263
- row.append(action(name, () => newTemplate(id), 'primary'));
322
+ row.append(action(name, () => newTemplate(id), 'btn-small'));
264
323
  paragraph(row, desc);
265
324
  body.append(row);
266
325
  }
@@ -282,7 +341,7 @@
282
341
  const current = () => !controller.signal.aborted && dialog.open &&
283
342
  state.graph === graphAtOpen && graphFingerprint() === fingerprint;
284
343
  paragraph(body, 'Snapshots are immutable. Restoring a past version opens a draft; saving creates a new version.');
285
- if (!rows.length) { paragraph(body, 'No saved versions. Save this workflow first.'); return; }
344
+ if (!rows.length) { paragraph(body, 'No saved versions. Save this graph first.'); return; }
286
345
  for (const row of rows) {
287
346
  const item = element('section', undefined, 'studio-history-row');
288
347
  item.append(element('strong', 'Version ' + row.revision + ' · ' + row.name));
@@ -293,12 +352,13 @@
293
352
  try { return await api('/api/graphs/' + encodeURIComponent(graphId) + '/revisions/' + row.revision, undefined, { signal: controller.signal }); }
294
353
  catch (error) { if (controller.signal.aborted || !current()) return null; throw error; }
295
354
  };
355
+ // Each version offers the same two actions, so neither is the screen's primary (A1).
296
356
  item.append(action('Compare', async () => {
297
357
  if (!current()) return;
298
358
  const snapshot = await fetchRevision();
299
359
  if (!snapshot || !current()) return;
300
360
  detail.textContent = describeDiff(snapshot, graphAtOpen);
301
- }));
361
+ }, 'btn-small'));
302
362
  item.append(action('Restore as Draft', async () => {
303
363
  if (!current()) return;
304
364
  const snapshot = await fetchRevision();
@@ -308,7 +368,7 @@
308
368
  if (await applyDraft(next, 'Restored version ' + row.revision + ' into a draft. Save to publish it.')) {
309
369
  shut(dialog);
310
370
  }
311
- }, 'primary'));
371
+ }, 'btn-small'));
312
372
  item.append(detail);
313
373
  body.append(item);
314
374
  }
@@ -356,7 +416,7 @@
356
416
  const fingerprint = graphFingerprint();
357
417
  const candidate = await api('/api/preview', { graph: state.graph, choices });
358
418
  if (!acceptPreviewIfCurrent(candidate, fingerprint)) {
359
- results.textContent = 'Workflow changed during preview. Run the preview again against the updated draft.';
419
+ results.textContent = 'Graph changed during preview. Run the preview again against the updated draft.';
360
420
  return;
361
421
  }
362
422
  const steps = preview.steps.map((step, i) => (i + 1) + '. ' + step.nodeName + ' → ' + step.outcome +
@@ -370,7 +430,7 @@
370
430
  }, 'primary'));
371
431
  body.append(results);
372
432
  body.append(action('How to Run Live', () => {
373
- paragraph(body, 'Open Andorra Code in your project, select the saved workflow using /graph, then enter your task. The CLI retains its normal permission and approval gates. Save the draft first.');
433
+ paragraph(body, 'Open Andorra Code in your project, select the saved graph using /graph, then enter your task. The CLI retains its normal permission and approval gates. Save the draft first.');
374
434
  }));
375
435
  }, true);
376
436
  }
@@ -455,7 +515,7 @@
455
515
  if (nodes.length < 2) { status('Select at least two steps to group.', true); return; }
456
516
  const ids = new Set(nodes.map(node => node.id));
457
517
  if (!canCreateLayoutGroup(state.graph?.metadata?.studioLayoutGroupsV1 || [], ids)) {
458
- status('A workflow supports at most 50 layout groups. Remove or merge a group before creating another.', true);
518
+ status('A graph supports at most 50 layout groups. Remove or merge a group before creating another.', true);
459
519
  return;
460
520
  }
461
521
  const name = await askText({ title: 'Name this layout group', label: 'Layout group name', value: 'New group', confirmLabel: 'Create Group', maxLength: 80 });
@@ -469,7 +529,7 @@
469
529
  id: 'group-' + crypto.randomUUID().slice(0, 8), name: name.trim(), nodeIds: [...ids],
470
530
  }];
471
531
  }, true);
472
- status('Layout group created. Groups are saved with the workflow.');
532
+ status('Layout group created. Groups are saved with the graph.');
473
533
  }
474
534
 
475
535
  function renderDebugger() {
@@ -482,18 +542,14 @@
482
542
  if (!selectedRun) { paragraph(log, 'Select a saved run to inspect its step transitions.'); return; }
483
543
  const matchesCanvas = runMatchesCanvas();
484
544
  if (!matchesCanvas && liveEvents.length) {
485
- paragraph(log, 'Historical run differs from the current workflow version or unsaved draft. Canvas overlays and step navigation are disabled.');
545
+ paragraph(log, 'Historical run differs from the current graph version or unsaved draft. Canvas overlays and step navigation are disabled.');
486
546
  }
487
547
  for (const event of liveEvents.slice(-100).reverse()) {
488
548
  const item = element('button', undefined, 'studio-run-event');
489
549
  const focusId = event.nodeId || event.source;
490
550
  const name = (matchesCanvas ? state.graph?.nodes[focusId]?.name : undefined)
491
- || focusId || 'Workflow';
492
- item.textContent = (event.time ? new Date(event.time).toLocaleTimeString() + ' · ' : '') +
493
- name + ' · ' + event.type +
494
- (event.outcome ? ' (' + event.outcome + ')' : '') +
495
- (event.durationMs !== null ? ' · ' + event.durationMs + 'ms' : '') +
496
- (event.usage ? ' · ' + event.usage.inputTokens + ' in / ' + event.usage.outputTokens + ' out' : '');
551
+ || focusId || 'Graph';
552
+ item.textContent = runEventLine(event, name);
497
553
  item.disabled = !matchesCanvas || !state.graph?.nodes[focusId];
498
554
  item.onclick = () => {
499
555
  if (runMatchesCanvas() && focusId && state.graph?.nodes[focusId]) {
@@ -518,8 +574,9 @@
518
574
  if (!select) return;
519
575
  select.replaceChildren(new Option('Choose a run…', ''));
520
576
  for (const run of runs) {
577
+ // A version is "v3" in a picker and "Version 3" in prose (D13).
521
578
  const option = new Option((run.startedAt ? new Date(run.startedAt).toLocaleString() + ' · ' : '') +
522
- run.status + (run.graphRevision !== null ? ' · r' + run.graphRevision : ''), run.id);
579
+ runStatusWords(run.status) + (Number.isInteger(run.graphRevision) ? ' · v' + run.graphRevision : ''), run.id);
523
580
  select.append(option);
524
581
  }
525
582
  if (!runs.some(run => run.id === selectedRun)) selectedRun = runs[0]?.id || '';
@@ -538,7 +595,7 @@
538
595
  event.type === 'graph.started' && Number.isInteger(event.graphRevision))?.graphRevision;
539
596
  inspectedRevision = Number.isInteger(summary?.graphRevision) ? summary.graphRevision
540
597
  : (Number.isInteger(startedRevision) ? startedRevision : null);
541
- if (note) note.textContent = 'Status: ' + response.status +
598
+ if (note) note.textContent = runStatusWords(response.status) +
542
599
  (response.truncated ? ' · Showing recent events only' : '');
543
600
  } else {
544
601
  liveEvents = [];
@@ -574,8 +631,9 @@
574
631
  let runsButton, hostMenuGroup;
575
632
 
576
633
  // The toolbar's overflow menu: the actions used now and then, behind one "More actions" button.
577
- // It follows the menu-button pattern: arrows move between items, Escape and Tab close it, and
578
- // a click outside dismisses it.
634
+ // It follows the menu-button pattern: arrows move between items, Escape and Tab close it and hand
635
+ // focus back to the button (the menu is hiding, so the browser's own Tab would drop focus to the
636
+ // page), and a click outside dismisses it.
579
637
  function installMenu() {
580
638
  const more = $studio('more'), menu = $studio('more-menu'), wrap = $studio('more-wrap');
581
639
  if (!more || !menu) return;
@@ -606,8 +664,7 @@
606
664
  list[(index + (event.key === 'ArrowDown' ? 1 : -1) + list.length) % list.length]?.focus();
607
665
  } else if (event.key === 'Home') { event.preventDefault(); list[0]?.focus(); }
608
666
  else if (event.key === 'End') { event.preventDefault(); list.at(-1)?.focus(); }
609
- else if (event.key === 'Escape') { event.preventDefault(); close(true); }
610
- else if (event.key === 'Tab') close();
667
+ else if (event.key === 'Escape' || event.key === 'Tab') { event.preventDefault(); close(true); }
611
668
  });
612
669
  // Choosing an item closes the menu before the item's own work begins.
613
670
  menu.addEventListener('click', event => { if (event.target.closest?.('[role="menuitem"]')) close(); });
@@ -666,7 +723,7 @@
666
723
  const panel = element('section', undefined, 'studio-run-panel');
667
724
  panel.id = 'studio-run-panel'; panel.hidden = true;
668
725
  const head = element('div', undefined, 'studio-run-head');
669
- head.append(element('strong', 'Workflow execution timeline'));
726
+ head.append(element('strong', 'Graph execution timeline'));
670
727
  const select = element('select'); select.id = 'studio-run-select';
671
728
  select.setAttribute('aria-label', 'Choose saved run');
672
729
  select.onchange = async () => {
@@ -736,6 +793,6 @@
736
793
  }
737
794
  }
738
795
 
739
- window.AndorraStudio = { heading, canvas, inspector: enhanceInspector, createGroup, canCreateLayoutGroup, describeDiff, nodeStatuses, nodeActivityTotals, representableSourceField, refreshRunList, toggleDebugger, runMatchesCanvas, setHostMenu, previewMatchesDraft, acceptPreviewIfCurrent, openHistory, openImport, importGraphJson, importGraphFile };
796
+ window.AndorraStudio = { selectedStepsText, eventWords, runStatusWords, durationWords, runEventLine, heading, canvas, inspector: enhanceInspector, createGroup, canCreateLayoutGroup, describeDiff, nodeStatuses, nodeActivityTotals, representableSourceField, refreshRunList, toggleDebugger, runMatchesCanvas, setHostMenu, previewMatchesDraft, acceptPreviewIfCurrent, openHistory, openImport, importGraphJson, importGraphFile };
740
797
  initialize();
741
798
  })();