@andorra-labs/code 0.1.4 → 0.1.6

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 (171) hide show
  1. package/dist/src/account-presentation.js +3 -3
  2. package/dist/src/agent-execution.d.ts +2 -0
  3. package/dist/src/agent-execution.js +126 -20
  4. package/dist/src/agent-mcp.d.ts +18 -1
  5. package/dist/src/agent-mcp.js +103 -8
  6. package/dist/src/app-server/protocol.d.ts +33 -3
  7. package/dist/src/app-server/protocol.js +14 -1
  8. package/dist/src/app-server/workspace.d.ts +1 -0
  9. package/dist/src/app-server/workspace.js +7 -1
  10. package/dist/src/app-server.d.ts +115 -41
  11. package/dist/src/app-server.js +1229 -219
  12. package/dist/src/automation-runner.d.ts +9 -0
  13. package/dist/src/automation-runner.js +22 -1
  14. package/dist/src/automation-tool.js +8 -1
  15. package/dist/src/automations.js +1 -1
  16. package/dist/src/browser-captcha-tool.d.ts +54 -0
  17. package/dist/src/browser-captcha-tool.js +374 -0
  18. package/dist/src/browser-panel-tool.d.ts +7 -0
  19. package/dist/src/browser-panel-tool.js +74 -3
  20. package/dist/src/browser-runner.js +19 -4
  21. package/dist/src/browser-server.js +21 -1
  22. package/dist/src/browser-session.d.ts +16 -0
  23. package/dist/src/browser-session.js +35 -0
  24. package/dist/src/browser-ui/app.js +193 -3
  25. package/dist/src/browser-ui/style.css +15 -1
  26. package/dist/src/browser-view.d.ts +72 -4
  27. package/dist/src/browser-view.js +229 -17
  28. package/dist/src/capabilities.js +13 -2
  29. package/dist/src/capsolver.d.ts +60 -0
  30. package/dist/src/capsolver.js +101 -0
  31. package/dist/src/claude-provider.d.ts +6 -0
  32. package/dist/src/claude-provider.js +34 -3
  33. package/dist/src/cli-executable.d.ts +33 -0
  34. package/dist/src/cli-executable.js +64 -0
  35. package/dist/src/cli-process.d.ts +47 -0
  36. package/dist/src/cli-process.js +113 -0
  37. package/dist/src/cli-sign-in.d.ts +68 -0
  38. package/dist/src/cli-sign-in.js +224 -0
  39. package/dist/src/cli.js +54 -23
  40. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
  41. package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
  42. package/dist/src/coding-tools.js +44 -5
  43. package/dist/src/command-output-tap.d.ts +16 -0
  44. package/dist/src/command-output-tap.js +45 -0
  45. package/dist/src/command-screens.js +3 -3
  46. package/dist/src/commands.d.ts +10 -1
  47. package/dist/src/commands.js +7 -7
  48. package/dist/src/completion.d.ts +23 -5
  49. package/dist/src/completion.js +334 -17
  50. package/dist/src/config.d.ts +13 -0
  51. package/dist/src/config.js +28 -2
  52. package/dist/src/deadline.js +6 -0
  53. package/dist/src/extensions.d.ts +1 -0
  54. package/dist/src/extensions.js +16 -3
  55. package/dist/src/graph-provider-portability.js +2 -2
  56. package/dist/src/graph-quota.d.ts +1 -1
  57. package/dist/src/graph-quota.js +1 -1
  58. package/dist/src/graph-runner.js +35 -21
  59. package/dist/src/graph-selection.d.ts +6 -0
  60. package/dist/src/graph-selection.js +10 -0
  61. package/dist/src/graph-server.d.ts +7 -0
  62. package/dist/src/graph-server.js +61 -3
  63. package/dist/src/graph-sync.d.ts +50 -0
  64. package/dist/src/graph-sync.js +383 -12
  65. package/dist/src/graph-ui/app.js +61 -8
  66. package/dist/src/graph-ui/icons.js +1 -0
  67. package/dist/src/graph-ui/index.html +1 -1
  68. package/dist/src/graph-ui/skill-picker.js +242 -0
  69. package/dist/src/graph-ui/style.css +19 -0
  70. package/dist/src/graphs.d.ts +46 -4
  71. package/dist/src/graphs.js +152 -27
  72. package/dist/src/grok-provider.d.ts +50 -0
  73. package/dist/src/grok-provider.js +186 -0
  74. package/dist/src/handoffs.d.ts +13 -0
  75. package/dist/src/handoffs.js +31 -1
  76. package/dist/src/managed-sign-in.d.ts +38 -0
  77. package/dist/src/managed-sign-in.js +169 -0
  78. package/dist/src/markdown.d.ts +5 -0
  79. package/dist/src/markdown.js +5 -2
  80. package/dist/src/mcp.js +11 -0
  81. package/dist/src/membership.d.ts +8 -1
  82. package/dist/src/membership.js +15 -5
  83. package/dist/src/model-metadata.js +14 -2
  84. package/dist/src/model-override.d.ts +10 -0
  85. package/dist/src/model-override.js +20 -0
  86. package/dist/src/opencode-cli-provider.d.ts +122 -0
  87. package/dist/src/opencode-cli-provider.js +415 -0
  88. package/dist/src/opencode-provider.js +23 -8
  89. package/dist/src/palette.d.ts +2 -0
  90. package/dist/src/palette.js +2 -0
  91. package/dist/src/permissions.d.ts +19 -1
  92. package/dist/src/permissions.js +30 -1
  93. package/dist/src/powershell-pool.d.ts +2 -2
  94. package/dist/src/powershell-pool.js +18 -5
  95. package/dist/src/provider-connection.js +36 -0
  96. package/dist/src/provider-engine.d.ts +2 -1
  97. package/dist/src/provider-engine.js +64 -13
  98. package/dist/src/provider-import.js +6 -1
  99. package/dist/src/provider-settings.js +22 -3
  100. package/dist/src/providers.d.ts +12 -1
  101. package/dist/src/providers.js +27 -8
  102. package/dist/src/pull-requests.d.ts +111 -17
  103. package/dist/src/pull-requests.js +308 -76
  104. package/dist/src/qa/qa-authorize.js +9 -1
  105. package/dist/src/react-runtime.js +76 -5
  106. package/dist/src/remote/engine-pool.js +1 -1
  107. package/dist/src/run-progress.js +6 -1
  108. package/dist/src/run-records.d.ts +133 -27
  109. package/dist/src/run-records.js +320 -40
  110. package/dist/src/runtime.d.ts +38 -1
  111. package/dist/src/runtime.js +27 -4
  112. package/dist/src/save-lock.d.ts +11 -0
  113. package/dist/src/save-lock.js +29 -2
  114. package/dist/src/sessions.js +4 -1
  115. package/dist/src/shell.js +4 -1
  116. package/dist/src/side-panel.d.ts +1 -1
  117. package/dist/src/side-panel.js +1 -1
  118. package/dist/src/skill-commands.d.ts +2 -0
  119. package/dist/src/skill-commands.js +2 -0
  120. package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
  121. package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
  122. package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
  123. package/dist/src/skills/bundled/graph-manager/SKILL.md +97 -0
  124. package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
  125. package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
  126. package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
  127. package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
  128. package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
  129. package/dist/src/skills/bundled/provenance.json +50 -0
  130. package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
  131. package/dist/src/skills/invocable-skills.d.ts +41 -0
  132. package/dist/src/skills/invocable-skills.js +49 -0
  133. package/dist/src/skills/prompt-skills.d.ts +1 -0
  134. package/dist/src/skills/prompt-skills.js +33 -0
  135. package/dist/src/skills/runtime-skills.d.ts +4 -0
  136. package/dist/src/skills/runtime-skills.js +21 -0
  137. package/dist/src/structured-step.d.ts +55 -0
  138. package/dist/src/structured-step.js +85 -0
  139. package/dist/src/subagent-run.d.ts +1 -1
  140. package/dist/src/subagent-run.js +29 -33
  141. package/dist/src/telemetry/schema.d.ts +2 -2
  142. package/dist/src/telemetry/schema.js +3 -2
  143. package/dist/src/terminal-ui.d.ts +29 -0
  144. package/dist/src/terminal-ui.js +112 -28
  145. package/dist/src/timers.d.ts +21 -2
  146. package/dist/src/timers.js +12 -4
  147. package/dist/src/tool-names.d.ts +18 -0
  148. package/dist/src/tool-names.js +26 -0
  149. package/dist/src/tools.js +45 -11
  150. package/dist/src/trajectory.js +32 -12
  151. package/dist/src/types.d.ts +23 -0
  152. package/dist/src/update.d.ts +26 -16
  153. package/dist/src/update.js +232 -275
  154. package/docs/agents/install-for-agents.md +15 -24
  155. package/docs/agents/mcp-server.md +13 -1
  156. package/docs/agents/subagent-mode.md +7 -4
  157. package/docs/concepts/security.md +2 -0
  158. package/docs/getting-started/README.md +14 -6
  159. package/docs/getting-started/configure-providers.md +29 -2
  160. package/docs/guides/README.md +1 -1
  161. package/docs/guides/browser.md +12 -0
  162. package/docs/guides/desktop-app.md +45 -9
  163. package/docs/guides/graph-builder.md +8 -0
  164. package/docs/guides/update.md +37 -16
  165. package/docs/reference/cli.md +1 -1
  166. package/docs/reference/config.md +2 -2
  167. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
  168. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
  169. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
  170. package/package.json +1 -1
  171. package/tests/permissions-test-plan.md +2 -1
@@ -0,0 +1,125 @@
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.
@@ -2,6 +2,13 @@
2
2
 
3
3
  Status: approved 2026-11-01.
4
4
 
5
+ Amended 2026-11-07: **Auto-archive on merge or close was removed**, from the menu, the protocol and the
6
+ `pull_request` tool (the engine still sends `autoArchive: false` so older desktops keep showing the section).
7
+ **Auto-fix now stops with the PR**: it switches itself off once the PR is merged or closed, and the engine reads
8
+ the PR from GitHub right before each Auto-fix prompt is delivered, so a PR merged by hand since the last poll gets
9
+ no prompt. The Auto-archive parts below describe the original design; `tests/pr-section-test-plan.md` describes
10
+ the current behavior.
11
+
5
12
  ## Goal
6
13
 
7
14
  After the agent opens a pull request, the session's Plan card shows a **Pull request** section with the PR's link
@@ -0,0 +1,206 @@
1
+ # Bundled skills, skill commands and graph soft delete
2
+
3
+ Status: draft for review, 2026-11-06.
4
+
5
+ ## Goal
6
+
7
+ Andorra ships its own skills: instructions written for the agent, which the agent loads when a request
8
+ matches a skill's description, and which a person can also start by typing `/name`. A skill picked in the
9
+ composer shows as a bold, accent-coloured chip that Backspace removes in one keystroke, in the desktop app and
10
+ in the terminal. A `graph-manager` skill adds, edits and removes graphs through the existing graph MCP server,
11
+ which gains a soft delete and a restore.
12
+
13
+ ## Delivery
14
+
15
+ Three pull requests, each with its own QA plan under `tests/`:
16
+
17
+ | PR | Scope | Depends on |
18
+ | --- | --- | --- |
19
+ | 1 | Graph soft delete: two MCP tools, deleted graphs hidden everywhere | — |
20
+ | 2 | Skill commands: one invocable-skill list, built-in skills typeable as `/name`, desktop and terminal chips | — |
21
+ | 3 | Seven bundled skills | 1 (graph-manager removes graphs), 2 (typing `/name`) |
22
+
23
+ PRs 1 and 2 touch different files and can be built in parallel. PR 3 starts once both have merged.
24
+
25
+ ## Part 1 — Graph soft delete (PR 1)
26
+
27
+ ### Why soft
28
+
29
+ Cloud sync uploads local graphs and restores everything the account holds (`src/graph-account.ts`), and the
30
+ hosted service has only `GET /v1/graphs`, `PUT /v1/graphs/{snapshot}` and `GET /v1/graphs/{snapshot}`
31
+ (`infra/andorra-auth/graph_storage.py`). Removing a graph's files would be undone by the next sync pass, and
32
+ another machine would upload its copy again. A free account's allowance is pinned permanently to the first
33
+ graph it stores. A deletion is therefore a new revision that carries a marker; the existing sync carries it to
34
+ every machine and the hosted service needs no change.
35
+
36
+ ### Data
37
+
38
+ - A deleted graph's latest revision has `metadata.deletedAt` set to an ISO 8601 timestamp and is otherwise
39
+ identical to the revision before it. Graph validation already preserves unknown metadata keys
40
+ (`src/graphs.ts`), and the hosted service stores snapshot content as given.
41
+ - Restoring publishes the next revision with `metadata.deletedAt` removed.
42
+ - No file is removed. Every earlier revision stays on disk and in the cloud.
43
+ - `isDeletedGraph(graph)` in `src/graphs.ts` is the single test every caller uses.
44
+
45
+ ### MCP tools (`src/agent-mcp.ts`)
46
+
47
+ `andorra_graph_delete { id, expectedRevision, confirm }`
48
+
49
+ - Refuses `default` and the Andorra preset.
50
+ - `expectedRevision` must equal the latest revision, so the caller deletes the version it looked at; a newer
51
+ revision is the existing conflict error.
52
+ - `confirm` must equal `id`. The skill has the agent ask the person in chat before it calls the tool; the
53
+ argument makes a deletion a deliberate call rather than a slip of an argument.
54
+ - Refuses while any automation's `execution.graph` names the graph, and lists those automations by name.
55
+ - Refuses a graph that is already deleted.
56
+ - Discards any open MCP draft of the graph.
57
+ - Publishes through the same path as `andorra_graph_publish`, so free-tier and membership rules apply
58
+ unchanged, and returns `{ id, revision, deletedAt }`.
59
+
60
+ `andorra_graph_restore { id, expectedRevision }`
61
+
62
+ - Refuses a graph that is not deleted; otherwise the same revision check and save path as delete.
63
+ - Returns `{ id, revision }`.
64
+
65
+ `andorra_graphs_list` gains `includeDeleted` (default `false`); listed deleted graphs carry `deleted: true` and
66
+ `deletedAt`. `andorra_graph_get` keeps reading any graph and reports `deletedAt` when set.
67
+ `andorra_graph_begin` with `mode=edit` refuses a deleted graph and names the restore tool.
68
+
69
+ Each refusal uses a named error code in the server's existing style: `DEFAULT_GRAPH`, `CONFIRMATION_MISMATCH`,
70
+ `GRAPH_IN_USE`, `GRAPH_DELETED`, `GRAPH_NOT_DELETED`. The architecture guide the server returns
71
+ (`andorra_graph_guide`) describes both tools and the codes.
72
+
73
+ ### Where a deleted graph disappears
74
+
75
+ - Each listing surface shows `withoutDeletedGraphs(saved)`: the desktop (`graphs.list` in the app server),
76
+ `/graph` in the terminal, the graph editor's list and the MCP listing. `listGraphs` itself still returns
77
+ every graph, because the quota is computed from its full result.
78
+ - Graph quota counts deleted graphs, matching the hosted service's permanent free-graph pin. A free account
79
+ that deletes its one graph can restore it but cannot create a different one; that limit is stated in the
80
+ delete tool's success message.
81
+ - New runs: `loadAccessibleGraph` refuses a deleted graph with "Graph <name> was deleted. Restore it before
82
+ running it." This is the gate for `andorra --graph`, the terminal, the desktop and automations.
83
+ - A saved selection (`config.graphSelections`) that names a deleted graph falls back to the default graph with
84
+ a one-line notice. The saved selection is left unchanged, so restoring the graph brings it back.
85
+ - A session that already ran the graph must keep resuming. The deleted check applies to starting a new run,
86
+ not to resuming one, and every revision the session may name is still on disk.
87
+ - The graph editor (`andorra graph`) hides deleted graphs. It has no restore control in this change; restoring
88
+ is done through the MCP tool, which `graph-manager` drives.
89
+
90
+ ### Out of scope
91
+
92
+ A true delete: a hosted delete route, a tombstone that sync honours in both directions, freeing a free
93
+ account's pin, and the service deployment.
94
+
95
+ ## Part 2 — Skill commands (PR 2)
96
+
97
+ ### One invocable-skill list
98
+
99
+ `listInvocableSkills(config, signal, directory)` returns every skill a person can type, each with `id`, `name`,
100
+ `command` (`/<directory name>`), `description`, `source` (`installed` or `built-in`) and an `unavailable`
101
+ reason when the skill cannot run here (for example a browser skill with the browser disabled).
102
+
103
+ - Installed skills: the enabled ones `listBundles('skills')` returns today.
104
+ - Built-in skills: the `andorra:*` entries registered in `src/skills/runtime-skills.ts`.
105
+ - Built-in commands keep their meaning (`BUILTIN_COMMANDS` in `src/skill-commands.ts`); a skill whose name
106
+ matches one stays reachable by its full id. Two skills with the same short name keep today's ambiguity
107
+ error, which names both full ids.
108
+
109
+ Three places use the list:
110
+
111
+ 1. `resolveSkillInvocation` (`src/extensions.ts`), so `/manage-mcp` resolves to `andorra:manage-mcp`; the task
112
+ text it builds is unchanged.
113
+ 2. The desktop slash menu, where built-in skills show with the source "Built-in". Settings → Skills is
114
+ unchanged: built-in skills are not listed there and cannot be turned off.
115
+ 3. The terminal's `/` list.
116
+
117
+ ### Desktop chip
118
+
119
+ Both composers (`NewTaskView`, `SessionView`) keep their `<textarea>`; `useSlashSkillSuggestions` adds the chip
120
+ so both get it.
121
+
122
+ - A layer behind the textarea draws the same text with the same font, padding, width and wrapping; the
123
+ textarea's text is transparent and its caret visible. The layer follows the textarea's scroll position.
124
+ - The chip is the leading `/command` when it exactly matches an available skill and is followed by whitespace
125
+ or the end of the draft, whether it was picked from the menu or typed in full. `skillChipRange(value,
126
+ commands)` in `desktop/src/engine/slashSuggestions.ts` finds it.
127
+ - Look: accent colour, a tinted pill drawn without horizontal padding, and bold drawn with
128
+ `-webkit-text-stroke` so every glyph keeps its width and the caret stays aligned. Light and dark themes use
129
+ the existing tokens.
130
+ - Backspace with the caret at the chip's end, or right after its trailing space, deletes the chip and that
131
+ space. Delete with the caret at the chip's start deletes the chip and its trailing space.
132
+ - A selection that partly covers the chip grows to cover all of it before it is deleted or replaced.
133
+ - A click or arrow key that would put the caret inside the chip moves it to the nearer edge.
134
+ - Deletions go through the browser's editing commands so Ctrl+Z restores the chip; where those are unavailable
135
+ the edit falls back to `setRangeText`.
136
+ - Editing the text so it no longer names a skill turns it back into plain text.
137
+ - Screen readers read the textarea's plain text (`/manage-mcp …`) as before.
138
+
139
+ ### Terminal chip (`src/terminal-ui.ts`)
140
+
141
+ - The `/` popup lists available skills after the built-in commands, each with its description. The list is
142
+ read at startup and again after `/skills` or `/plugins` changes something.
143
+ - Accepting a skill with Enter or Tab replaces the typed query with one skill token and a space. The token is
144
+ one code point in the composer's private-use range, in a sub-range separate from attachment tokens; input
145
+ cleanup already strips that range from typed and pasted text, so only the composer can create one.
146
+ - The token renders as `/name` in bold with the Andorra accent (`accentPaint`).
147
+ - Backspace, Delete, the arrow keys and selections treat the token as one unit, as they already treat
148
+ attachment tokens.
149
+ - Typing an exact skill command followed by a space converts it to a token. Recalling a sent message from
150
+ history converts its leading skill command to a token.
151
+ - On send the token expands to `/name`, so the existing submit path (`src/cli.ts`) resolves it unchanged.
152
+
153
+ ## Part 3 — Bundled skills (PR 3)
154
+
155
+ Seven skills under `src/skills/bundled/<name>/`, registered in `src/skills/runtime-skills.ts` as
156
+ `andorra:<name>`. Each `SKILL.md` is written for the agent: frontmatter with a description that says when the
157
+ skill applies, the steps, the rules, and what to report back. Skills that change Andorra's configuration edit
158
+ `config.json` in the Andorra home, which is outside the workspace and goes through the normal approval rules,
159
+ and they validate the result before reporting success. The exact commands each skill uses are settled in PR 3's
160
+ plan against the code at that time.
161
+
162
+ 1. **manage-mcp** — add, edit, test, turn off or remove an MCP server in `mcpServers`: validate the entry,
163
+ connect and list its tools, keep secrets as environment references and never echo them.
164
+ 2. **create-skill** — scaffold `.andorra/skills/<name>/SKILL.md` or an installed skill: a description that
165
+ triggers correctly, within the 300-character description, 16 KB file and 16-skill limits, then confirm
166
+ discovery lists it.
167
+ 3. **manage-skills** — list, install, turn on or off and remove skills and plugins.
168
+ 4. **create-agent** — write a saved agent definition (schema 2) and validate it.
169
+ 5. **doctor** — check version and update readiness, sign-in, providers, MCP servers and free disk space, and
170
+ list fixes in dependency order.
171
+ 6. **write-instructions** — create or tighten `ANDORRA.md` or `AGENTS.md` within the workspace-instructions
172
+ size limit.
173
+ 7. **graph-manager** — add, edit and remove graphs through the graph MCP tools:
174
+ 1. Check that the `andorra_graph_*` tools are available; if not, offer to connect `andorra mcp-server
175
+ --stdio` through manage-mcp, with the person's consent.
176
+ 2. Read `andorra_graph_guide` first; the skill points to it rather than copying it.
177
+ 3. Gather requirements, draw a text sketch of nodes and routes, and get the person's approval before
178
+ building.
179
+ 4. Use provider ids from `andorra_providers_list`; check free-tier limits (one custom graph, up to three
180
+ nodes, no Orchestrator) before starting.
181
+ 5. Create or edit through a draft; never edit `default` (copy it first); loops need a visit or time limit.
182
+ 6. Validate until clean, show a summary of the change, then publish; on a conflict, reopen the latest
183
+ revision and reapply.
184
+ 7. Remove with `andorra_graph_delete` only after the person confirms in chat; restore with
185
+ `andorra_graph_restore`.
186
+ 8. Report the id, revision, what changed, how to run it, and that cloud sync is not yet confirmed; discard
187
+ the draft when the person stops partway.
188
+
189
+ Two resources load on demand: `patterns.md` (plan → build → review loop; frontend, backend and DevOps
190
+ routing; parallel read-only reviewers; a QA retry loop) and `errors.md` (each validation and refusal code
191
+ and its fix).
192
+
193
+ A test checks that every `andorra_graph_*` name the graph-manager files mention exists in the MCP server's tool
194
+ list, so a renamed tool fails a test instead of leaving the skill stale.
195
+
196
+ ## Testing
197
+
198
+ - PR 1: unit tests for delete and restore (refusals, revision check, automation check, draft discard),
199
+ `listGraphs` filtering, quota counting, `loadAccessibleGraph` refusal, selection fallback and resume of a
200
+ session on a deleted graph. Run verification drives `andorra mcp-server --stdio` against a throwaway
201
+ `ANDORRACODE_HOME`.
202
+ - PR 2: unit tests for `listInvocableSkills`, built-in resolution and name clashes, `skillChipRange`, and the
203
+ chip's Backspace, Delete, selection and caret rules in both composers. Run verification drives the terminal
204
+ through node-pty and the desktop renderer headless.
205
+ - PR 3: each skill registers, loads and passes the tool-name check; one real run loads a skill both ways, by
206
+ `/name` and by a matching request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andorra-labs/code",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Terminal-first coding agent with a ReAct graph runtime",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
@@ -15,7 +15,7 @@ Use a disposable directory with `inside.txt`, a sibling `outside.txt`, and a dis
15
15
  3. Check the footer and `/status` show the selection.
16
16
  4. Exit and restart from the same workspace. The mode must be restored. Start in a different workspace: default Ask for approval applies.
17
17
  5. `/permissions read-only|ask-for-approval|approve-for-me|full-access` selects directly and persists. `/yolo on` and `--yolo` grant Full Access for the current session only; `/yolo off` selects Ask for approval for the current session without changing the saved choice.
18
- 6. Shell calls (canonical PowerShell on Windows) refuse execution in restricted modes at the Andorra wrapper before spawn. A shell tool requesting `sandbox_permissions: require_escalated` must provide `justification`; approval grants only that invocation host/network access. Failure never triggers an automatic unsandboxed retry.
18
+ 6. Shell calls (canonical PowerShell on Windows) refuse execution in restricted modes at the Andorra wrapper before spawn. A shell tool requesting `sandbox_permissions: require_escalated` must provide `justification`; approval grants only that invocation host/network access. An escalation whose prompt was settled by a live switch to Full Access is a journaled yolo-policy decision and keeps host access while Full Access is still in force at spawn; a sandboxed (`use_default`) call never widens on a later switch. Failure never triggers an automatic unsandboxed retry.
19
19
  7. QA calls that execute host commands/browser or mutate terminals request a scoped UNSANDBOXED QA approval in restricted modes. Denying prevents that call; approving never changes the workspace mode. QA status runs Git/runtime probes and requires scoped approval too; existing-terminal read/status/wait/resize remain usable without host execution approval. Kill requires scoped host approval because process-tree termination can launch host helpers. Git reads also require a scoped UNSANDBOXED host-process approval.
20
20
  8. Restore the desired mode before exiting. Remove disposable directories and the isolated config after QA; leave the installation checkout on main.
21
21
 
@@ -49,6 +49,7 @@ Use a disposable directory with `inside.txt`, a sibling `outside.txt`, and a dis
49
49
  - PERM-23 live permissions: while a task is Working (not paused), submit `/permissions read-only`, `/permissions full-access`, and `/permissions`. Each must reach the live command handler without the stop-task hint or being queued as model steering; direct changes retain existing persistence and live-control behavior.
50
50
  - PERM-24 startup helpers: prepend owned workspace Git/ps shims to PATH. Starting/refreshing the CLI branch display must launch no child process. The bounded native display shows local HEAD branches or detached HEAD, reports No Git branch for invalid or outside-workspace metadata, and does not report dirty state. Denied/headless terminal kill must never reach process-tree helpers; approval remains scoped to one kill call.
51
51
  - PERM-25 startup metadata: use disposable Git repositories with existing and missing `.git/info/exclude`. Opening existing or new CodeGraph sessions must preserve existing bytes and must not create missing exclude/info paths. CodeGraph no longer automatically adds its cache directory to Git excludes; configure ignores manually outside the agent session if desired.
52
+ - PERM-38 live change from the desktop or the protocol: `run.setPermissions` changes a running task's mode, re-decides its pending and queued approvals, and journals `run.permissions.changed`. Cases, edge cases and evidence live in `tests/live-permission-change-test-plan.md`.
52
53
  - PERM-27 ordered live changes: while Working, submit `/permissions full-access` immediately followed by `/permissions read-only`, then `/status`. Repeat with `/yolo off` and bare `/yolo` as the second command. Delay the first config save in the automated CLI fixture: no later save may begin until it settles, and commands must use the latest committed state. The final live mode is Read Only or Ask for approval respectively; persisted mode is Read Only for the second permissions command and Full Access for session-only YOLO changes. A failed first save must leave the queue usable. End the task while the save is delayed: idle command handling must wait for accepted live changes to finish, then report the final mode.
53
54
  - PERM-28 Windows cleanup trust: prepend a disposable workspace containing `taskkill.exe` to PATH and run an owned long-lived shell/child fixture. Timeout and cancellation must execute only the validated absolute `SystemRoot/System32/taskkill.exe`, terminating the owned descendants without launching the workspace helper. For restricted launch instrumentation, change SystemRoot after spawn: cleanup must retain the prevalidated path. Missing, relative, remote/device, workspace-contained or redirected helper paths must fail before sandbox launch with no PATH fallback. Run `node --test dist/test/shell-cleanup-permissions.test.js`; restricted timeout/abort wiring is instrumented because the installed backend cannot run a strict sandbox, while the host-shell process-tree checks execute real Windows processes.
54
55
  - PERM-12 compatibility: `/yolo`, autocomplete, `/status`, `/tools`, `/help`, existing selection screens and usage counters remain usable. Invalid mode strings and malformed persisted maps are rejected.