@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
@@ -1,398 +0,0 @@
1
- # Workflow pane Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** Turn the session's plan card into a live workflow visualizer (graph node visits with their subagents nested, then the plan checklist) that can be expanded, with a morph animation, into the right-hand pane the browser uses, with only one of the two panes open at a time.
6
-
7
- **Architecture:** The desktop fold records node visits and stamps each subagent with the visit that started it. A pure module groups them into phases. One `WorkflowView` component renders the phases in a `card` and a `pane` size. `PlanWidget` hosts the card, and a new `WorkflowPane` hosts the pane, which `SessionView` portals into the slot `SessionBrowserLayout` owns. The browser pane store keeps both panes' state per session, so one update enforces the exclusion.
8
-
9
- **Tech Stack:** React 19, zustand, TypeScript, vitest (`renderToStaticMarkup` for component tests), the Web Animations API for the morph.
10
-
11
- Spec: `docs/superpowers/specs/2026-11-02-workflow-pane-design.md`.
12
-
13
- All commands run from `desktop/` in the worktree `../Andorra-Code-workflow-pane` (branch `feat/workflow-pane`).
14
-
15
- ---
16
-
17
- ## File structure
18
-
19
- | File | Responsibility |
20
- |---|---|
21
- | `desktop/src/engine/rows.ts` (modify) | `NodeVisit`, `FoldState.visits`, `SubagentItem.visit`/`endTime`; record, settle and resume visits; stamp subagents. |
22
- | `desktop/src/engine/bridge.ts` (modify) | Carry `visits` across the record reload, the way `subagents` is carried. |
23
- | `desktop/src/engine/workflow.ts` (create) | Pure: `subagentLabels`, `subagentStatusLabel` (moved from PlanWidget), `workflowPhases`, `splitOverflow`, `spanLabel`. |
24
- | `desktop/src/engine/browserState.ts` (modify) | `workflow?`/`workflowWidth?` on `BrowserPaneState`, `WORKFLOW_DEFAULT_WIDTH`, parsing. |
25
- | `desktop/src/engine/browserStore.ts` (modify) | `openWorkflow`, `closeWorkflow`, `resizeWorkflow`; the browser-opening actions close the workflow pane. |
26
- | `desktop/src/components/workflowMorph.ts` (create) | The pending morph hand-off and the morph box animation. |
27
- | `desktop/src/components/WorkflowView.tsx` (create) | Phases, agent rows, overflow, plan checklist, widgets, PR section. |
28
- | `desktop/src/components/WorkflowPane.tsx` (create) | Pane chrome, empty state, `WorkflowPaneSlot` context, the morph on mount. |
29
- | `desktop/src/components/PlanWidget.tsx` (modify) | Card chrome around `WorkflowView`, Expand button, `away` while the pane is open, the reverse morph. |
30
- | `desktop/src/components/SessionBrowserLayout.tsx` (modify) | One slot for either pane, the divider resizing whichever is open, the slot context. |
31
- | `desktop/src/components/SessionView.tsx` (modify) | Wire the store, the card's expand, and the portal. |
32
- | `desktop/src/styles/app.css` (modify) | Workflow, pane and morph styles; drop the old subagent-count line. |
33
- | `tests/desktop-workflow-pane-test-plan.md` (create) | QA plan. |
34
-
35
- ---
36
-
37
- ### Task 1: Record node visits in the fold
38
-
39
- **Files:** Modify `desktop/src/engine/rows.ts`, `desktop/src/engine/bridge.ts`. Test `desktop/src/engine/rows.test.ts`.
40
-
41
- - [ ] **Step 1: Write the failing tests** (append to the `folding subagents` describe in `rows.test.ts`)
42
-
43
- ```ts
44
- it('records each node visit, settles it, and wakes it again on a resume', () => {
45
- const state = feed(emptyFold(), clock(), [
46
- event('graph.started', { graph: { name: 'Flow' } }, 0),
47
- event('graph.node.started', { nodeId: 'plan', nodeName: 'Planner', visit: 1 }, 1),
48
- event('graph.node.completed', { nodeId: 'plan', completion: {} }, 2),
49
- event('graph.node.started', { nodeId: 'build', nodeName: 'Builder', visit: 1 }, 3),
50
- event('graph.node.started', { nodeId: 'plan', nodeName: 'Planner', visit: 2 }, 4),
51
- ]);
52
- expect(state.visits.map(visit => [visit.key, visit.name, visit.status])).toEqual([
53
- ['plan#1', 'Planner', 'completed'], ['build#1', 'Builder', 'running'], ['plan#2', 'Planner', 'running'],
54
- ]);
55
- expect(state.visits[0].endTime).toBe(at(2));
56
- feed(state, clock(), [
57
- event('graph.node.completed', { nodeId: 'plan', completion: {} }, 5),
58
- event('graph.finalization.resumed', { nodeId: 'plan' }, 6),
59
- ]);
60
- expect(state.visits[2].status).toBe('running');
61
- expect(state.visits[2].endTime).toBeUndefined();
62
- });
63
-
64
- it('does not duplicate a visit whose start a journal replays, and numbers a start without a visit', () => {
65
- const state = feed(emptyFold(), clock(), [
66
- event('graph.node.started', { nodeId: 'plan', visit: 1 }, 1),
67
- event('graph.node.started', { nodeId: 'plan', visit: 1 }, 2),
68
- event('graph.node.completed', { nodeId: 'plan', completion: {} }, 3),
69
- event('graph.node.started', { nodeId: 'plan' }, 4),
70
- ]);
71
- expect(state.visits.map(visit => visit.key)).toEqual(['plan#1', 'plan#2']);
72
- expect(state.visits[0].time).toBe(at(1));
73
- });
74
-
75
- it('stamps a subagent with the visit that started it, the newest open visit, or none', () => {
76
- const state = feed(emptyFold(), clock(), [
77
- event('subagent.started', { nodeId: 'plan', subagentId: 'early', role: 'scout' }, 0),
78
- event('graph.node.started', { nodeId: 'plan', visit: 1 }, 1),
79
- event('graph.node.started', { nodeId: 'build', visit: 1 }, 2),
80
- event('subagent.started', { nodeId: 'plan', subagentId: 'a', role: 'scout' }, 3),
81
- event('subagent.started', { nodeId: 'reviewer-role', subagentId: 'b', role: 'scout' }, 4),
82
- event('subagent.completed', { nodeId: 'plan', subagentId: 'a', status: 'succeeded' }, 5),
83
- ]);
84
- expect(state.subagents.map(item => [item.id, item.visit])).toEqual([['early', undefined], ['a', 'plan#1'], ['b', 'build#1']]);
85
- expect(state.subagents[1].endTime).toBe(at(5));
86
- });
87
-
88
- it('starts every run with no visits', () => {
89
- const state = feed(emptyFold(), clock(), [event('graph.node.started', { nodeId: 'plan', visit: 1 }, 1)]);
90
- feed(state, clock(), [event('graph.started', { graph: { name: 'Flow' } }, 2)]);
91
- expect(state.visits).toEqual([]);
92
- });
93
- ```
94
-
95
- - [ ] **Step 2: Run them to see them fail**
96
-
97
- Run: `npx vitest run src/engine/rows.test.ts -t "visit"`
98
- Expected: FAIL (`state.visits` is undefined).
99
-
100
- - [ ] **Step 3: Implement**
101
-
102
- In `rows.ts`:
103
-
104
- ```ts
105
- /**
106
- * One visit the run made to a graph node: a phase of the workflow view, with the subagents started
107
- * during it nested under it. A node the graph routes back to is visited again, so one id can appear
108
- * more than once; the key tells its visits apart.
109
- */
110
- export interface NodeVisit {
111
- /** `${nodeId}#${visit}`: unique within the run, and the same when a journal replays the start. */
112
- key: string;
113
- nodeId: string;
114
- name: string;
115
- status: 'running' | 'completed';
116
- time: string;
117
- endTime?: string;
118
- }
119
- ```
120
-
121
- - `SubagentItem` gains `visit?: string` (the key of the visit that started it) and `endTime?: string`.
122
- - `FoldState` gains `visits: NodeVisit[]`, and `emptyFold()` gains `visits: []`.
123
- - `graph.started` sets `state.visits = []` beside `state.subagents = []`.
124
- - `graph.node.started`, inside the `nodeId` branch after `nodeNames` is set: `openVisit(state, data.nodeId, typeof data.visit === 'number' ? data.visit : undefined, time);`
125
- - `graph.node.completed`: `settleVisit(state, data.nodeId, time)` when `nodeId` is a string.
126
- - `graph.finalization.resumed`: `resumeVisit(state, data.nodeId)` when `nodeId` is a non-empty string.
127
- - `subagent.started`: `visit: visitFor(state.visits, data.nodeId) ?? previous?.visit`, where `previous` is the entry a replayed start replaces.
128
- - `subagent.completed`: `endTime: time` on the settled entry, and on the entry built for an unknown child (which also gets `visitFor`).
129
-
130
- ```ts
131
- function runningVisit(visits: readonly NodeVisit[], nodeId?: string): number {
132
- for (let index = visits.length - 1; index >= 0; index -= 1) {
133
- if (visits[index].status === 'running' && (nodeId === undefined || visits[index].nodeId === nodeId)) return index;
134
- }
135
- return -1;
136
- }
137
-
138
- function openVisit(state: FoldState, nodeId: string, visit: number | undefined, time: string): void {
139
- const number = visit ?? state.visits.filter(item => item.nodeId === nodeId).length + 1;
140
- const key = `${nodeId}#${number}`;
141
- const index = state.visits.findIndex(item => item.key === key);
142
- const entry: NodeVisit = { key, nodeId, name: state.nodeNames[nodeId] ?? nodeId, status: 'running', time: index >= 0 ? state.visits[index].time : time };
143
- state.visits = index >= 0 ? state.visits.map((item, i) => i === index ? entry : item) : [...state.visits, entry];
144
- }
145
-
146
- function settleVisit(state: FoldState, nodeId: string, time: string): void {
147
- const index = runningVisit(state.visits, nodeId);
148
- if (index < 0) return;
149
- state.visits = state.visits.map((item, i) => i === index ? { ...item, status: 'completed', endTime: time } : item);
150
- }
151
-
152
- function resumeVisit(state: FoldState, nodeId: string): void {
153
- const index = state.visits.findLastIndex(item => item.nodeId === nodeId);
154
- if (index < 0) return;
155
- state.visits = state.visits.map((item, i) => {
156
- if (i !== index) return item;
157
- const { endTime: _ended, ...open } = item;
158
- return { ...open, status: 'running' };
159
- });
160
- }
161
-
162
- function visitFor(visits: readonly NodeVisit[], nodeId: unknown): string | undefined {
163
- const own = typeof nodeId === 'string' && nodeId ? runningVisit(visits, nodeId) : -1;
164
- const index = own >= 0 ? own : runningVisit(visits);
165
- return index >= 0 ? visits[index].key : undefined;
166
- }
167
- ```
168
-
169
- In `bridge.ts`, after the `fold.subagents = ...` carry: `fold.visits = previous.visits;`.
170
-
171
- - [ ] **Step 4: Run the fold suite**
172
-
173
- Run: `npx vitest run src/engine/rows.test.ts`
174
- Expected: PASS, with no other test changed.
175
-
176
- - [ ] **Step 5: Commit** — `git commit -m "Record graph node visits and stamp subagents with them"`
177
-
178
- ### Task 2: Group visits and subagents into phases
179
-
180
- **Files:** Create `desktop/src/engine/workflow.ts` and `desktop/src/engine/workflow.test.ts`. Modify `desktop/src/components/PlanWidget.tsx` so it re-exports the moved label helpers.
181
-
182
- - [ ] **Step 1: Write the failing tests**
183
-
184
- ```ts
185
- import { describe, expect, it } from 'vitest';
186
- import type { NodeVisit, SubagentItem } from './rows';
187
- import { OTHER_AGENTS, PHASE_VISIBLE_AGENTS, spanLabel, splitOverflow, workflowPhases } from './workflow';
188
-
189
- const visit = (key: string, status: NodeVisit['status']): NodeVisit => ({ key, nodeId: key.split('#')[0], name: key, status, time: '2026-11-02T00:00:00.000Z' });
190
- const agent = (id: string, status: string, visitKey?: string): SubagentItem => ({ id, role: 'file-analyzer', status, time: '', ...(visitKey ? { visit: visitKey } : {}) });
191
-
192
- describe('workflow phases', () => {
193
- it('nests each subagent under its visit and keeps the unclaimed ones in a last group', () => {
194
- const phases = workflowPhases([visit('plan#1', 'completed'), visit('build#1', 'running')],
195
- [agent('a', 'succeeded', 'plan#1'), agent('b', 'running', 'build#1'), agent('c', 'running'), agent('d', 'failed', 'gone#1')], true);
196
- expect(phases.map(phase => [phase.key, phase.status, phase.agents.map(item => item.item.id), phase.settled])).toEqual([
197
- ['plan#1', 'completed', ['a'], 1], ['build#1', 'running', ['b'], 0], [OTHER_AGENTS, 'running', ['c', 'd'], 1],
198
- ]);
199
- expect(phases[0].agents[0].label).toBe('File analyzer 1');
200
- });
201
-
202
- it('reads a visit and its agents as stopped once the run is over', () => {
203
- const [phase] = workflowPhases([visit('build#1', 'running')], [agent('b', 'running', 'build#1')], false);
204
- expect(phase.status).toBe('stopped');
205
- expect(phase.agents[0].active).toBe(false);
206
- expect(phase.settled).toBe(1);
207
- });
208
-
209
- it('folds a long list after the first rows and keeps a short one whole', () => {
210
- const many = Array.from({ length: 51 }, (_, index) => index);
211
- expect(splitOverflow(many).shown).toHaveLength(PHASE_VISIBLE_AGENTS);
212
- expect(splitOverflow(many).folded).toHaveLength(51 - PHASE_VISIBLE_AGENTS);
213
- expect(splitOverflow(many.slice(0, PHASE_VISIBLE_AGENTS + 1)).folded).toEqual([]);
214
- });
215
-
216
- it('measures a span only when both ends are known', () => {
217
- expect(spanLabel('2026-11-02T00:00:00.000Z', '2026-11-02T00:01:05.000Z')).toBe('1m05s');
218
- expect(spanLabel('2026-11-02T00:00:00.000Z', undefined, Date.parse('2026-11-02T00:00:03.000Z'))).toBe('3s');
219
- expect(spanLabel('2026-11-02T00:00:00.000Z')).toBeUndefined();
220
- expect(spanLabel('')).toBeUndefined();
221
- });
222
- });
223
- ```
224
-
225
- - [ ] **Step 2: Run them to see them fail**
226
-
227
- Run: `npx vitest run src/engine/workflow.test.ts`
228
- Expected: FAIL (module not found).
229
-
230
- - [ ] **Step 3: Implement `workflow.ts`**
231
-
232
- - Move `subagentLabels` and `subagentStatusLabel` here unchanged, and have `PlanWidget.tsx` re-export them: `export { subagentLabels, subagentStatusLabel } from '../engine/workflow';`
233
- - `WorkflowAgent { item; label; active }`, where `active` means running in a live run.
234
- - `WorkflowPhase { key; name; status: 'running' | 'completed' | 'stopped'; time?; endTime?; agents; settled }`.
235
- - `workflowPhases(visits, subagents, live)` builds one phase per visit, in order. A visit's status is `completed`, otherwise `running` while live and `stopped` once the run is over. Agents whose `visit` names no listed visit go into a final `OTHER_AGENTS` group named `Other agents`, which is `running` while any of its agents is active.
236
- - `splitOverflow` shows every row up to `PHASE_VISIBLE_AGENTS + 1` (6). Beyond that it shows the first 5 and folds the rest.
237
- - `spanLabel(time, endTime?, now?)` gives `formatDuration(end - start)`, where the end is `endTime`, else `now`. It is `undefined` when either end is unknown or the span is negative.
238
-
239
- - [ ] **Step 4: Run** `npx vitest run src/engine/workflow.test.ts src/components/PlanWidget.test.ts`. Expected: PASS.
240
-
241
- - [ ] **Step 5: Commit** — `git commit -m "Group node visits and subagents into workflow phases"`
242
-
243
- ### Task 3: One right-hand pane at a time
244
-
245
- **Files:** Modify `desktop/src/engine/browserState.ts` and `desktop/src/engine/browserStore.ts`. Test `browserState.test.ts` and `browserStore.test.ts`.
246
-
247
- - [ ] **Step 1: Write the failing tests** (`browserStore.test.ts`)
248
-
249
- ```ts
250
- describe('one right-hand pane at a time', () => {
251
- beforeEach(() => useBrowserStore.setState({ ...useBrowserStore.getState(), sessions: {} }));
252
- const pane = (scope: string) => useBrowserStore.getState().sessions[scope];
253
-
254
- it('opening the workflow pane collapses the browser, and the browser takes the slot back', () => {
255
- const store = useBrowserStore.getState();
256
- store.expand('local:s1');
257
- store.openWorkflow('local:s1');
258
- expect([pane('local:s1').expanded, pane('local:s1').workflow]).toEqual([false, true]);
259
- store.toggle('local:s1');
260
- expect([pane('local:s1').expanded, pane('local:s1').workflow]).toEqual([true, false]);
261
- store.openWorkflow('local:s1');
262
- store.reportHeadlessOpen('local:s1', 'agent-page');
263
- expect([pane('local:s1').expanded, pane('local:s1').workflow]).toEqual([true, false]);
264
- });
265
-
266
- it('closing either pane leaves the other alone, and the workflow width is its own', () => {
267
- const store = useBrowserStore.getState();
268
- store.openWorkflow('local:s1');
269
- store.collapse('local:s1');
270
- expect(pane('local:s1').workflow).toBe(true);
271
- store.resizeWorkflow('local:s1', 510);
272
- store.closeWorkflow('local:s1');
273
- expect([pane('local:s1').workflow, pane('local:s1').workflowWidth, pane('local:s1').preferredWidth]).toEqual([false, 510, 470]);
274
- expect(pane('remote:mac:s1')).toBeUndefined();
275
- });
276
- });
277
- ```
278
-
279
- And in `browserState.test.ts`, under `persisted browser pane state`:
280
-
281
- ```ts
282
- it('restores the workflow pane and its width, and reads older entries as closed', () => {
283
- expect(parseBrowserPaneState({ expanded: false, preferredWidth: 470, workflow: true, workflowWidth: 500 }))
284
- .toEqual({ expanded: false, preferredWidth: 470, mode: 'desktop', workflow: true, workflowWidth: 500 });
285
- expect(parseBrowserPaneState({ expanded: false, preferredWidth: 470, workflowWidth: 5 })).toEqual({ expanded: false, preferredWidth: 470, mode: 'desktop' });
286
- });
287
- ```
288
-
289
- - [ ] **Step 2: Run** `npx vitest run src/engine/browserStore.test.ts src/engine/browserState.test.ts`. Expected: FAIL.
290
-
291
- - [ ] **Step 3: Implement**
292
-
293
- - `BrowserPaneState` gains `workflow?: boolean` and `workflowWidth?: number`.
294
- - `export const WORKFLOW_DEFAULT_WIDTH = 420;`
295
- - The parser keeps `workflow` only when it is `true`, and keeps `workflowWidth` only when it is a finite number in [100, 10000].
296
- - Store actions:
297
- - `toggle` that opens the browser, `expand` and `reportHeadlessOpen` write `expanded: true` and, only if the workflow pane was open, `workflow: false`.
298
- - `openWorkflow` writes `{ expanded: false, workflow: true }`.
299
- - `closeWorkflow` writes `{ workflow: false }`.
300
- - `resizeWorkflow` writes `{ workflowWidth }`.
301
-
302
- - [ ] **Step 4: Run the two suites again.** Expected: PASS.
303
-
304
- - [ ] **Step 5: Commit** — `git commit -m "Keep the browser and the workflow pane in one right-hand slot"`
305
-
306
- ### Task 4: The morph hand-off
307
-
308
- **Files:** Create `desktop/src/components/workflowMorph.ts` and `workflowMorph.test.ts`.
309
-
310
- - [ ] **Step 1: Test** that `takeWorkflowMorph('pane')` returns the rectangle `beginWorkflowMorph(rect, 'pane')` stored exactly once, that `takeWorkflowMorph('card')` does not consume a pane morph, and that `playWorkflowMorph` returns without throwing when `document` is undefined (the server render).
311
-
312
- - [ ] **Step 2: Run** `npx vitest run src/components/workflowMorph.test.ts`. Expected: FAIL.
313
-
314
- - [ ] **Step 3: Implement**
315
-
316
- - `beginWorkflowMorph(from, target)` stores a copy of the rectangle. Two animation frames later it drops the entry if nothing took it.
317
- - `takeWorkflowMorph(target)` returns and clears the entry only when its target matches.
318
- - `playWorkflowMorph(from, to, content, target)` does nothing under reduced motion, without `Element.animate`, or when the target rectangle is empty. Otherwise it appends a fixed `.workflow-morph` box to `document.body` and runs:
319
- - geometry, from `from` to the target's rectangle, over 220 ms with `cubic-bezier(0.2, 0, 0, 1)`; the radius goes 12 px → 0 toward the pane and 0 → 12 px toward the card
320
- - a 90 ms fade-out of the box, starting 30 ms before the geometry ends
321
- - a fade-in of `content` that holds at 0 for the first 60%
322
-
323
- It removes the box when the fade finishes or is cancelled.
324
-
325
- - [ ] **Step 4: Run again.** Expected: PASS.
326
-
327
- - [ ] **Step 5: Commit** — `git commit -m "Add the card-to-pane morph hand-off"`
328
-
329
- ### Task 5: `WorkflowView`, the card, and the pane
330
-
331
- **Files:** Create `WorkflowView.tsx`, `WorkflowPane.tsx` and `WorkflowView.test.ts`. Modify `PlanWidget.tsx`, `PlanWidget.test.ts`, `SessionBrowserLayout.tsx`, `SessionView.tsx`, `styles/app.css` and `styles/layout.test.ts` (when its selectors move).
332
-
333
- - [ ] **Step 1: Write the failing render tests** (`WorkflowView.test.ts`)
334
- - A card with two visits and seven agents renders `workflow-phase` rows with `data-status`, the count `1/7`, five agent rows, a `2 more · 1 running` button with `aria-expanded="false"`, and the plan checklist after the phases.
335
- - The pane variant renders `data-variant="pane"`.
336
- - No markup contains `avatar`, an inline `style="background`, or a colour class per agent.
337
- - `PlanWidget` with `onExpand` renders a button labelled `Open workflow pane`.
338
- - `PlanWidget` with `away` renders nothing.
339
- - `WorkflowPane` renders `Collapse workflow pane` and, with no content, the empty state.
340
-
341
- In `PlanWidget.test.ts`, replace the two tests for the count line with ring with these: the card shows a running phase while live and a stopped one after the run.
342
-
343
- - [ ] **Step 2: Run** `npx vitest run src/components`. Expected: the new tests FAIL.
344
-
345
- - [ ] **Step 3: Implement**
346
- - `WorkflowView({ variant, visits, subagents, todos, widgets, pullRequest, pullRequestActions, live, openSubagent, onOpenSubagent })` renders:
347
- - an `ol.workflow-phases` of phases, each with a head button that folds its agents and an agent list with the overflow row
348
- - the checklist, with the same `ul.todos.plan-widget-items` markup the card has today, under a `Plan` heading when phases exist
349
- - the widget sections
350
- - the pull request section
351
-
352
- While anything is running it ticks once a second.
353
- - `PlanWidget`:
354
- - title `Workflow` when there are visits or subagents, otherwise `Plan`
355
- - an Expand button `#session-workflow-expand` (`PanelRightOpen`) when `onExpand` is given
356
- - `away` renders `null` and reports the card hidden
357
- - when the card mounts again it takes the `card` morph and plays it, then focuses the Expand button
358
- - `planHasContent` gains `visits` and counts them once the run has visited more than one node.
359
- - `WorkflowPane({ onCollapse, ...view })`:
360
- - toolbar with `Workflow`, the progress, and `#session-workflow-collapse` (`PanelRightClose`)
361
- - body `WorkflowView variant="pane"`, or the empty state
362
- - before the paint it takes the `pane` morph, plays it, and focuses the collapse button
363
- - exports `WorkflowPaneSlot = createContext<HTMLElement | null>(null)`
364
- - `SessionBrowserLayout`:
365
- - `browserOpen = entry.expanded`; `workflowOpen = !browserOpen && entry.workflow`
366
- - one pane element with `ref={setSlot}` holding either `BrowserPanel` or nothing
367
- - the divider's label, width and commits follow the open pane
368
- - the chat is wrapped in `WorkflowPaneSlot.Provider value={workflowOpen ? slot : null}`
369
- - `SessionView`:
370
- - reads `workflowOpen` from the store
371
- - passes `visits`, `away={workflowOpen}` and `onExpand` (begin the `pane` morph, then `openWorkflow`) to `PlanWidget`
372
- - portals `WorkflowPane` into the slot, whose `onCollapse` begins the `card` morph and then calls `closeWorkflow`
373
- - CSS:
374
- - `.workflow` phases, a timeline line, dots per status (pulsing accent while running, `--ok` filled when completed, hollow when stopped), monochrome agent rows, and the overflow button
375
- - the folded agents in a two-column grid in the pane
376
- - `.workflow-pane` with `.workflow-pane-body`, which scrolls
377
- - `.workflow-morph`
378
- - remove the unused `.plan-widget-subagent*` and `.subagent-count*` rules
379
- - under reduced motion the dot does not pulse
380
-
381
- - [ ] **Step 4: Run** `npx vitest run src/components src/styles src/engine` and `npx tsc --noEmit -p .`. Expected: PASS. Compare any failure against the clean-main baseline (memory: desktop suite baseline failures).
382
-
383
- - [ ] **Step 5: Commit** — `git commit -m "Draw the plan card as a workflow and expand it into the side pane"`
384
-
385
- ### Task 6: QA plan and run verification
386
-
387
- - [ ] **Step 1:** Write `tests/desktop-workflow-pane-test-plan.md`, covering the scope, how to use the feature, test cases with expected results, edge cases, gaps and evidence.
388
- - [ ] **Step 2:** `npm run build` at the root, then build and run the dev desktop app. Drive it over CDP through a run that spawns subagents and moves between nodes. Check:
389
- - phases and nesting
390
- - the morph both ways
391
- - the Browser button taking the slot
392
- - divider resizing
393
- - the overflow
394
- - reduced motion
395
-
396
- Capture screenshots and commands for the PR.
397
- - [ ] **Step 3: Commit** — `git commit -m "Add the workflow pane QA plan"`
398
- - [ ] **Step 4:** Push, open a ready PR to `main` with the template, and work the Codex review loop.
@@ -1,125 +0,0 @@
1
- # Graph soft delete Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** The graph MCP server can soft-delete and restore a graph; a deleted graph is hidden from every listing and refused for new runs, while sessions that already ran it keep resuming.
6
-
7
- **Architecture:** A deletion is a new immutable revision whose `metadata.deletedAt` is set (Part 1 of `docs/superpowers/specs/2026-11-06-bundled-skills-design.md`). `isDeletedGraph` in `src/graphs.ts` is the one test. Listing surfaces filter deleted graphs after quota is computed (the quota keeps counting them, matching the hosted free-graph pin). `loadAccessibleGraph` refuses a deleted graph unless the caller is resuming.
8
-
9
- **Tech Stack:** TypeScript (Node 22), `node:test`, the MCP SDK server in `src/agent-mcp.ts`.
10
-
11
- ---
12
-
13
- ## File map
14
-
15
- - `src/graphs.ts` — `isDeletedGraph`, `withoutDeletedGraphs`, `GraphDeletedError`.
16
- - `src/agent-mcp.ts` — `andorra_graph_delete`, `andorra_graph_restore`, `includeDeleted` on `andorra_graphs_list`, `deletedAt` on `andorra_graph_get`, `GRAPH_DELETED` on `andorra_graph_begin mode=edit`, guide text.
17
- - `src/membership.ts` — `loadAccessibleGraph` option `allowDeleted`, refusal otherwise.
18
- - `src/app-server.ts` — resume passes `allowDeleted`; `graphs.list` hides deleted graphs and reports `default` as selected when the saved one is deleted.
19
- - `src/cli.ts` — `GraphDeletedError` falls back to Default with a notice, like a membership refusal.
20
- - `src/command-screens.ts`, `src/graph-server.ts` — hide deleted graphs.
21
- - `test/graph-soft-delete.test.ts` — new tests for all of the above.
22
- - `tests/graph-soft-delete-test-plan.md` — QA plan.
23
- - `docs/agents/mcp-server.md` — document the two tools.
24
-
25
- Quota note: `readGraphQuota(directory, graphs)` callers pass the full `listGraphs` result. Filtering happens after that call at each surface, so `listGraphs` itself is unchanged.
26
-
27
- ### Task 1: Deleted-graph helpers
28
-
29
- **Files:** Modify `src/graphs.ts` (after `GraphConflictError`); Test `test/graph-soft-delete.test.ts`
30
-
31
- - [ ] **Step 1: Write the failing test**
32
-
33
- ```ts
34
- import assert from 'node:assert/strict';
35
- import test from 'node:test';
36
- import { isDeletedGraph, withoutDeletedGraphs, GraphDeletedError, type Graph } from '../src/graphs.js';
37
-
38
- const graph = (id: string, deletedAt?: string): Graph => ({ schemaVersion: 3, id, name: id, revision: 1, entry: 'a',
39
- nodes: { a: { id: 'a', name: 'A', type: 'end' } as Graph['nodes'][string] }, edges: [],
40
- ...(deletedAt ? { metadata: { deletedAt } } : {}) });
41
-
42
- test('isDeletedGraph reads only a nonempty metadata.deletedAt string', () => {
43
- assert.equal(isDeletedGraph(graph('x')), false);
44
- assert.equal(isDeletedGraph(graph('x', '2026-11-06T00:00:00.000Z')), true);
45
- assert.equal(isDeletedGraph({ ...graph('x'), metadata: { deletedAt: '' } }), false);
46
- assert.deepEqual(withoutDeletedGraphs([graph('a'), graph('b', '2026-11-06T00:00:00.000Z')]).map(g => g.id), ['a']);
47
- assert.match(new GraphDeletedError('Review loop').message, /Graph Review loop was deleted\. Restore it before running it\./);
48
- });
49
- ```
50
-
51
- - [ ] **Step 2: Run it and see it fail** — `npm run build && node scripts/run-tests.mjs dist/test/graph-soft-delete.test.js` → fails: `isDeletedGraph` is not exported.
52
- - [ ] **Step 3: Implement**
53
-
54
- ```ts
55
- /** A soft-deleted graph: its latest revision carries `metadata.deletedAt`. Every revision stays stored. */
56
- export function isDeletedGraph(graph: Pick<Graph, 'metadata'>): boolean {
57
- return typeof graph.metadata?.deletedAt === 'string' && graph.metadata.deletedAt.length > 0;
58
- }
59
- export function withoutDeletedGraphs<T extends Pick<Graph, 'metadata'>>(graphs: T[]): T[] { return graphs.filter(graph => !isDeletedGraph(graph)); }
60
- /** A new run named a deleted graph. Resuming a session that already ran it is still allowed. */
61
- export class GraphDeletedError extends Error {
62
- readonly code = 'GRAPH_DELETED';
63
- constructor(name: string) { super(`Graph ${name} was deleted. Restore it before running it.`); this.name = 'GraphDeletedError'; }
64
- }
65
- ```
66
-
67
- - [ ] **Step 4: Run the test; it passes.**
68
- - [ ] **Step 5: Commit** — `git commit -m "Add the deleted-graph marker helpers"`
69
-
70
- ### Task 2: `andorra_graph_delete` and `andorra_graph_restore`
71
-
72
- **Files:** Modify `src/agent-mcp.ts` (dispatch after `andorra_graph_get`; catalog; guide); Test `test/graph-soft-delete.test.ts`
73
-
74
- Both tools: require `id` (safe id), `expectedRevision` (positive integer); refuse `default` (`DEFAULT_GRAPH`) and any id containing `:`; read latest with `readGraph`; `expectedRevision !== latest.revision` → `GraphConflictError` (the server already maps it); then `sync()`, re-check access like publish, and save `{ ...latest, metadata }` through `saveFreeTierGraph` (free) or `saveGraph` with `expectedRevision = latest.revision`; then `void this.sync?.sync()`.
75
-
76
- Delete only: `confirm !== id` → `CONFIRMATION_MISMATCH`; already deleted → `GRAPH_DELETED`; automations from `new AutomationStore(this.directory).list()` whose `execution?.graph === id` → `GRAPH_IN_USE` with `automations: [{ id, name }]`; delete every draft whose `graph.id === id` and `directory === access.directory`; reply `{ id, revision, deletedAt, note }` where the note says cloud sync may be pending and, for a free account, that the deleted graph still holds the free allowance and can be restored.
77
-
78
- Restore only: not deleted → `GRAPH_NOT_DELETED`; save with `deletedAt` removed; reply `{ id, revision }`.
79
-
80
- `andorra_graphs_list { includeDeleted?: boolean }`: filter with `withoutDeletedGraphs` unless `includeDeleted === true`; listed entries add `deleted: true, deletedAt` when deleted. `andorra_graph_begin mode=edit` on a deleted graph → `GRAPH_DELETED` naming `andorra_graph_restore`.
81
-
82
- - [ ] **Step 1: Write the failing tests** (in `test/graph-soft-delete.test.ts`, reusing the `fixture` shape from `test/agent-mcp.test.ts`: a temp home, `saveConfig` with one `local` provider, `new AgentMcpBackend({ directory: home, graphAccess: async () => ({ directory: home }) })`, and a published two-node graph `review-loop`):
83
- - delete refuses `default` (`DEFAULT_GRAPH`), a wrong `confirm` (`CONFIRMATION_MISMATCH`), a stale `expectedRevision` (conflict), and a graph an automation names (`GRAPH_IN_USE`, listing it);
84
- - delete succeeds: reply revision is 2, `loadGraph('review-loop')` has `metadata.deletedAt`, revision 1 still loads, `andorra_graphs_list` omits it, `includeDeleted: true` lists it with `deleted: true`, an open draft of it is gone (`DRAFT_NOT_FOUND`), and `andorra_graph_begin mode=edit` answers `GRAPH_DELETED`;
85
- - deleting twice answers `GRAPH_DELETED`; restoring a live graph answers `GRAPH_NOT_DELETED`;
86
- - restore succeeds: revision 3 without `deletedAt`, listed again.
87
- - [ ] **Step 2: Run; they fail with `UNKNOWN_TOOL`.**
88
- - [ ] **Step 3: Implement** the dispatch branches, catalog entries and guide lines:
89
-
90
- ```ts
91
- { name: 'andorra_graph_delete', description: 'Soft-delete a graph after the user confirms in chat: publishes a revision marked deleted, hides it from listings and new runs, keeps every revision. confirm must repeat the id.', inputSchema: obj({ id: str, expectedRevision: { type: 'integer', minimum: 1 }, confirm: str }, ['id','expectedRevision','confirm']) },
92
- { name: 'andorra_graph_restore', description: 'Restore a soft-deleted graph by publishing a revision without the deleted marker.', inputSchema: obj({ id: str, expectedRevision: { type: 'integer', minimum: 1 } }, ['id','expectedRevision']) },
93
- ```
94
-
95
- Guide section `## Deleting and restoring` names both tools, the five codes and the free-allowance note.
96
- - [ ] **Step 4: Run; they pass. Run `dist/test/agent-mcp.test.js` too; it still passes.**
97
- - [ ] **Step 5: Commit** — `git commit -m "Soft-delete and restore graphs through the graph MCP server"`
98
-
99
- ### Task 3: Refuse new runs, allow resume
100
-
101
- **Files:** Modify `src/membership.ts` (`loadAccessibleGraph`), `src/app-server.ts` (resume load), `src/cli.ts` (`graphFallbackReason` and both fallback sites); Test `test/graph-soft-delete.test.ts`
102
-
103
- - [ ] **Step 1: Failing tests** — `loadAccessibleGraph('review-loop', undefined, async () => ({ paid: true, subject: 'sub-1' }))` on a deleted graph rejects with `GraphDeletedError`; with `{ allowDeleted: true }` it resolves. (Point `ANDORRACODE_HOME` at the temp home for this test and restore it in `t.after`.)
104
- - [ ] **Step 2: Run; fails.**
105
- - [ ] **Step 3: Implement** — options become `{ bindProviders?: boolean; allowDeleted?: boolean }`; after loading, `if (!options.allowDeleted && isDeletedGraph(graph)) throw new GraphDeletedError(graph.name);`. In `app-server.ts` the resume load (`resumedFrom !== undefined` branch) passes `allowDeleted: true`. In `cli.ts`, `graphFallbackReason` returns `${error.message} Starting with the local Default graph.` for `GraphDeletedError`, and both fallback conditions accept `error instanceof GraphDeletedError` alongside `PaidMembershipRequiredError` (an explicit `--graph` still fails).
106
- - [ ] **Step 4: Run; passes.**
107
- - [ ] **Step 5: Commit** — `git commit -m "Refuse new runs of a deleted graph and keep resuming the ones that ran it"`
108
-
109
- ### Task 4: Hide deleted graphs from listings
110
-
111
- **Files:** Modify `src/app-server.ts` (`listGraphs`), `src/command-screens.ts` (`/graph`), `src/graph-server.ts` (`/api/bootstrap`); Test `test/graph-soft-delete.test.ts`
112
-
113
- - [ ] **Step 1: Failing test** — an `AppServer` `graphs.list` over a home with one live and one deleted graph lists only the live one, and `selected` is `default` when the saved selection names the deleted graph. (Use the app-server test harness pattern from `test/app-server.test.ts`.)
114
- - [ ] **Step 2: Run; fails.**
115
- - [ ] **Step 3: Implement** — each surface keeps passing the full list to `readGraphQuota`, and iterates `withoutDeletedGraphs(saved)` for what it shows. `graphs.list` computes `selected` and replaces it with `'default'` when it names a deleted graph.
116
- - [ ] **Step 4: Run; passes.**
117
- - [ ] **Step 5: Commit** — `git commit -m "Hide deleted graphs from the desktop, /graph and the graph editor"`
118
-
119
- ### Task 5: Docs, QA plan, verification
120
-
121
- - [ ] Document both tools in `docs/agents/mcp-server.md`.
122
- - [ ] Write `tests/graph-soft-delete-test-plan.md` (scope, how to use, cases with expected results, edge cases, gaps, evidence).
123
- - [ ] Run the touched suites: `node scripts/run-tests.mjs dist/test/graph-soft-delete.test.js dist/test/agent-mcp.test.js dist/test/graphs.test.js dist/test/graph-quota.test.js dist/test/membership.test.js`.
124
- - [ ] Run verification: build, then drive `node dist/src/cli.js mcp-server --stdio` over stdin with a throwaway `ANDORRACODE_HOME` (create, publish, delete, list, restore) and record the replies.
125
- - [ ] Commit, push, open the PR from `.github/PULL_REQUEST_TEMPLATE.md`, then run the Codex review loop and merge once Codex signs off on the current head.