@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
package/README.md CHANGED
@@ -1,231 +1,57 @@
1
1
  # Andorra Code
2
2
 
3
- Andorra Code is a **terminal-first coding agent with a configurable graph-based harness** from Andorra Labs.
3
+ Andorra Code is a terminal-first coding agent from Andorra Labs. Run `andorra` in a project folder, describe the work, and watch the agent read the repository, run tools, and make the change, with approvals for anything risky.
4
4
 
5
- Free and signed-out users run a single Software Engineer agent. A free account can build one custom graph of up to 3 nodes in the graph editor; an Andorra paid membership enables more and larger graphs and the Orchestrator. Run `andorra login` (or `/login`) to sign in or create an account; credentials persist securely on this machine. See [accounts, membership and hosted Jev setup](docs/getting-started/accounts.md).
5
+ Work runs on a **graph**: visible stages, decisions and handoffs that you can inspect, edit and rerun, instead of one fixed agent loop. You bring your own models.
6
6
 
7
- The primary product experience is the `andorra` CLI. Running it from a repository opens an interactive TUI in the same general class of workflow as Codex CLI, Claude Code, and Kimi CLI: the user can describe software work, watch tools execute, inspect progress, answer questions, approve gated actions, and continue interacting with the coding agent from the terminal.
7
+ ## Install
8
8
 
9
- The difference is that Andorra Code's coding behavior is not fixed in one hard-coded agent loop. The active coding harness is a graph composed of full autonomous Agent nodes, deterministic actions, conditions, loops, parallel branches, review stages, approvals, and terminal states. Users can use bundled preset graphs or build their own.
9
+ macOS and Linux:
10
10
 
11
- ## Primary experience
12
-
13
- From a project directory:
14
-
15
- ```bash
16
- andorra
17
- ```
18
-
19
- This opens the Andorra Code TUI and loads the currently selected graph for that project/user context. If no custom selection exists, Andorra Code can start with a bundled default software-engineering graph.
20
-
21
- ```text
22
- ┌ Andorra Code · Software Engineer ───────────────────────────────────────────┐
23
- │ cwd ~/code/portal branch feature/auth runtime local · connected │
24
- ├───────────────────────┬─────────────────────────────────────────────────────┤
25
- │ GRAPH │ RUN │
26
- │ │ │
27
- │ ✓ Understand task │ Andorra │
28
- │ ✓ Repository analyst │ I found the authentication flow in src/auth/. │
29
- │ ● Software engineer │ │
30
- │ ○ Tests │ ● shell pnpm test auth │
31
- │ ○ Browser QA │ ● edit src/auth/session.ts │
32
- │ ○ Security review │ │
33
- │ ○ Code review │ │
34
- │ │ │
35
- ├───────────────────────┴─────────────────────────────────────────────────────┤
36
- │ > Add coverage for expired refresh tokens too. │
37
- ├─────────────────────────────────────────────────────────────────────────────┤
38
- │ /graph /node /state /logs /artifacts /pause /help ctrl+c │
39
- └─────────────────────────────────────────────────────────────────────────────┘
40
- ```
41
-
42
- ### Manage harness extensions and sign-in
43
-
44
- Use `/skills` to list, install, enable, disable or remove local/GitHub skills; `/mcp` to add, edit, enable, disable or delete stdio and HTTP servers; and `/plugins` to manage bundles of skills and MCP servers. Files live under `~/.andorracode` (or `ANDORRACODE_HOME`), and changes apply to the next task. `/logout` signs out of your Andorra account (then `/login` to switch accounts); `/logout codex` signs out of Codex and exits while retaining configuration and API-key settings. See [extension management](docs/guides/extensions.md) for formats, authentication, permissions and examples.
45
-
46
- ### Track the task plan
47
-
48
- `/dashboard` opens persistent cards for per-model session tokens, current/latest task timing, todos, and the active graph neighbourhood. Ctrl+B returns to the preserved transcript; Ctrl+N cycles displayed model statistics, and Ctrl+G pages the ASCII graph. Steering, clarification and approvals use the same bottom composer. See [Dashboard](docs/guides/tui.md#dashboard).
49
-
50
- `/browser` opens a local GUI with projects and sessions in a sidebar, conversation and tool activity, and progress. Send prompts, steer or cancel runs, and answer runtime questions and approvals while the CLI remains available. Sessions retain history; settings control the age filter and light/dark appearance. See [Browser workspace](docs/guides/browser.md).
51
-
52
- The Orchestrator creates a shared Todo list at the start of a run. Agent stages update it with `?` pending, `?` in progress, and `?` completed items. Press **Ctrl+T** to expand or collapse the list; **Ctrl+O** toggles tool and approval details. See [Todo progress](docs/guides/tui.md#todo-progress).
53
-
54
- ### Switch harness graphs inside the TUI
55
-
56
- The `/graph` command opens the graph selector:
57
-
58
- ```text
59
- /graph
60
-
61
- Graphs
62
- ● Software Engineer preset
63
- Fast Fix custom
64
- Full SDLC custom
65
- Review Only custom
66
- ```
67
-
68
- The user can switch between bundled presets and graphs they created in the configuration application. A run is always pinned to one immutable graph revision. If work is already executing, changing graphs starts or prepares a new run rather than silently mutating the graph underneath the active run.
69
-
70
- ### Graph editor (implemented)
71
-
72
- ```bash
73
- andorra # Use /providers to add or edit a provider first
74
- andorra graph # Open the bundled browser editor
11
+ ```sh
12
+ curl -fsSL https://updates.andorralabs.com/cli/install.sh | sh
75
13
  ```
76
14
 
77
- The editor ships inside the npm package and runs on localhost. `andorracode --configure` also opens it. Use the searchable Node Library to add your own Agents, import Agents others shared, or insert the built-in Orchestrator, Software Engineer and QA Tester presets. Right-click an Agent to Use, Clone, Share (export as JSON) or Delete it; built-in Agents cannot be deleted. Configure models, capabilities, completion ports, typed inputs/outputs and internal subagent roles in the Inspector. Connect one outcome to several destinations, edit each edge's input mappings, and use Join all/any for explicit synchronization.
78
-
79
- New graphs begin with an optional Orchestrator that researches the codebase and clarifies requirements and design choices with you before routing to Engineering, QA or another configured stage. Delete it to start directly at the first connected successor, falling back to the first remaining node when no successor remains. Saved version 3 graphs retain that start without restoring intake. Its optional subagent maximum is a ceiling, not a target. Ctrl-click matching node types to route a shared outcome to one destination in bulk. See [Graph Builder](docs/guides/graph-builder.md) for editing behavior and [Orchestrator intake and bulk routing](design/decisions/0011-orchestrator-entry-and-bulk-routing.md) for the original design.
80
-
81
- Save immutable revision snapshots, then select a graph with `/graph` in the TUI or `andorra --graph <id>`. Headless `--prompt` runs cannot answer Orchestrator questions and return `needs_clarification`. Existing graphs load without destructive migration. The current top-level scheduler runs ready nodes serially; bounded subagents can run inside an Agent invocation. `andorra graph --no-open` prints the URL without opening a browser; Ctrl+C stops the server. Missing providers produce guidance to run `andorra` and open `/providers`.
82
-
83
- ### Agent MCP server (graph automation and session monitoring)
84
-
85
- Trusted external agents such as Hermes and OpenClaw can launch `andorra mcp-server --stdio` and use MCP tools to create graph drafts, upsert Agent/Condition/Loop/Join nodes, connect outcome ports, configure prompts/providers, validate actionable errors, and publish immutable revisions. The MCP resource `andorra://graph/architecture` teaches agents the graph structure before editing. Other tools query saved sessions by project, status, and last X minutes or identify work needing human feedback. See [agent MCP setup, tool contract and examples](docs/agents/mcp-server.md) and the [QA plan](tests/agent-centric-mcp-test-plan.md). The same server also runs Andorra as a subagent for a host that wants the work done rather than the graph authored; see [subagent mode](docs/agents/subagent-mode.md).
86
-
87
- ### Session debug log
15
+ The script brings its own Node.js 22 runtime into `~/.andorracode`, so the Node.js on your machine (or none at all) does not matter. With Node.js 22.19 or newer already installed, npm works too, and it is the way to install on Windows:
88
16
 
89
- Every conversation already keeps a trajectory journal (shown with `/status` in the interactive TUI, or at startup with `--debug`) with each model request and response — including per-call token usage and duration — plus every runtime event such as tool calls with arguments, outputs and timings. Add `--debug` (`andorra --debug` or `andorra --prompt "task" --debug`) to also record the conversation layer around them: a `session.started` banner with the invocation details (created before the first fallible startup step, so failed invocations still explain themselves), a `session.context` record with the resolved providers and workspace; `command.started` / `command.completed` entries with the wall-clock cost of every prompt and slash command, including commands issued while a run is active (steering messages are marked `command.steer`); `command.error` entries for CLI-level failures that never reach the runtime; and a closing `session.ended` summary with session-wide token totals, written even when startup or a run crashes. Credentials (stored keys and the values of provider-named environment variables, including ones added mid-session through `/providers`) and provider reasoning content are redacted from every record, and in `--json` mode the trajectory path is announced on stderr so stdout stays machine-readable.
90
-
91
- This browser delivery replaces the earlier Electron plan. See [manual Agents, routing and handoffs](design/decisions/0010-manual-agents-routing-handoffs.md) for schema version 2, explicit data mapping, subagent authority/workspace rules and current limitations. The visual editor follows the [AndorraBot V3 baseline](design/gui-design/). Alongside manual editing, Graph Studio offers an AI edit proposal route, and the agent MCP server supports external agent-driven graph authoring.
92
-
93
- ## How the harness works
94
-
95
- A graph is not merely a sequence of LLM calls. Agent nodes are full autonomous tool-using loops that can inspect repositories, run shell commands, edit files, use Git, browse, test, and iterate until their assigned responsibility is complete.
96
-
97
- The default Agent-node executor is a shared **basic ReAct loop**. Each Agent-node invocation has its own role, tools, permissions, and execution counters. Direct handoffs can reuse conversation history with the same provider profile and model; isolation is configurable:
98
-
99
- ```text
100
- model
101
- ↓
102
- tool call → tool result
103
- ↑ ↓
104
- └──── model ──┘
105
- ...
106
- ↓
107
- validated node completion
108
- ↓
109
- graph chooses the next edge/node
110
- ```
111
-
112
- The same `react-basic` executor can power an Orchestrator, Implementer, PR Review Fixer, QA Agent, or Deployment Troubleshooter while each node has its own model, system prompt, tools, permissions, context, and completion contract.
113
-
114
- Edges never own ReAct loops. Deterministic operations such as running a known test command, evaluating a condition, waiting for CI, or deploying a known artifact should normally use deterministic nodes rather than an LLM loop.
115
-
116
- See [`design/architecture/react-agent-loop.md`](design/architecture/react-agent-loop.md) for the implementation contract.
117
-
118
- A full software-development graph may look like:
119
-
120
- ```text
121
- Task
122
- ↓
123
- Understand / Requirements
124
- ↓
125
- Repository Analysis
126
- ↓
127
- Plan
128
- ↓
129
- Software Engineer
130
- ↓
131
- Automated Tests ─────────── fail ─────┐
132
- ↓ pass │
133
- Browser QA ───────────────── fail ────┤
134
- ↓ pass │
135
- Security Review ──────────── fail ────┤
136
- ↓ pass │
137
- Code Review / PR Review ─── issues ───┘
138
- ↓ pass
139
- Deploy / Final Verification
140
- ↓
141
- Done
17
+ ```sh
18
+ npm install -g @andorra-labs/code
142
19
  ```
143
20
 
144
- The graph controls **who works next, what context they receive, what they must produce, how failures route, what tools/models they can use, and what constitutes completion**.
145
-
146
- ## One harness, multiple interfaces
21
+ Either way you get `andorra` and the alias `andorracode`. Keep it current with `andorra update`.
147
22
 
148
- The executable harness is not owned by the TUI or browser frontend.
23
+ ## First run
149
24
 
150
- ```text
151
- Andorra Code TUI ────────────┐
152
- │
153
- Browser Configure app ──────┼──► Andorra Code Runtime ───► Harness revision
154
- Desktop client (app-server) ─┤
155
- │
156
- Headless CLI / SDK (future) ─┘
25
+ ```sh
26
+ cd /path/to/your/project
27
+ andorra
157
28
  ```
158
29
 
159
- All clients operate on the same persisted harness format and runtime semantics. The configuration app may store canvas layout as presentation metadata, but execution never depends on browser state.
160
-
161
- This allows a graph created visually to be selected immediately with `/graph` in the TUI without export or translation.
162
-
163
- The desktop client is a client of the same runtime: it starts `andorra app-server --stdio` and speaks a
164
- line-delimited JSON protocol, so its sessions, run records, configuration, and account are the CLI's own.
165
- See [`docs/guides/desktop-app.md`](docs/guides/desktop-app.md) and [ADR 0014](design/decisions/0014-tauri-desktop-client-and-app-server.md).
30
+ On first launch, type `/providers` to add a model provider: an OpenAI-compatible or Anthropic API key, a ChatGPT subscription (Codex), or a local server such as LM Studio. Keys are stored in your operating system's credential store.
166
31
 
167
- ## Product surfaces
32
+ Useful commands inside the TUI:
168
33
 
169
- - **CLI / TUI** — primary coding-agent experience launched with `andorra`.
170
- - **Graph selector** — `/graph` switches between preset and custom harness graphs.
171
- - **Configure application** — bundled local browser UI launched with `andorra graph` or `andorra --configure`.
172
- - **Graph Builder** — Shopify Flow-like canvas for creating and wiring harness graphs.
173
- - **Node Library** — built-in primitives and reusable user-created nodes.
174
- - **Manual Agent configuration** - editable shared-executor presets, typed handoffs, reusable custom definitions and optional internal subagents.
175
- - **Settings / Providers** — configure hosted providers, provider-supported authentication, and OpenAI-compatible local endpoints; configured models become selectable per Agent node.
176
- - **Headless execution** — machine-readable execution for scripting/CI without requiring the TUI.
177
- - **Subagent mode** — run Andorra from another agent (Claude CLI, Codex CLI) over MCP or the CLI; the host names a provider/model and gets one Software Engineer run back. See [`docs/agents/subagent-mode.md`](docs/agents/subagent-mode.md).
178
- - **Session debug log** — `--debug` adds per-command timing, CLI error records and session token totals to the always-on trajectory journal.
179
- - **Command lessons** — recognizable shell failures leave a short local lesson per repository that later runs receive; see [`docs/concepts/memory.md`](docs/concepts/memory.md).
34
+ | Command | What it does |
35
+ | --- | --- |
36
+ | `/providers`, `/model` | Add providers and pick the model |
37
+ | `/graph` | Choose the graph (harness) a task runs on |
38
+ | `/permissions` | Read Only, Ask for approval (default), Approve for me, or Full Access |
39
+ | `/skills`, `/mcp`, `/plugins` | Manage skills, MCP servers and plugins |
40
+ | `/login`, `/logout` | Sign in to an Andorra account |
41
+ | `/help` | Everything else |
180
42
 
181
- ## Key principles
182
-
183
- 1. **Andorra Code is CLI-first.** `andorra` opens the coding-agent TUI; the browser editor is opened explicitly for configuration.
184
- 2. **The graph is the harness.** The selected graph defines how the coding agent behaves.
185
- 3. **Agent nodes use a shared basic ReAct executor.** One Agent-node attempt owns one independent ReAct loop; graph edges route only after the node returns.
186
- 4. **Agent nodes remain full agents.** Graph orchestration does not replace their inner model/tool autonomy.
187
- 5. **Graphs are swappable.** `/graph` lets users choose preset or custom harnesses without rebuilding the application.
188
- 6. **Runs are revision-pinned.** Switching graphs never silently changes an already-running execution plan.
189
- 7. **Models are configuration, not node identity.** Each Agent node references a configured model profile and can use a different provider/model.
190
- 8. **Verification is independent.** Workers are not trusted simply because they claim success; QA/review/security stages can prove completion.
191
- 9. **State is explicit and durable.** Requirements, findings, diffs, tests, artifacts, approvals, and checkpoints are inspectable and survive client disconnects where configured.
192
- 10. **Permissions follow capabilities.** Nodes receive only the tools, secrets, and destructive permissions they require.
193
- 11. **One runtime, multiple clients.** TUI, browser configuration, headless CLI, and future SDK/API clients use the same harness semantics.
194
-
195
- ## Documentation
196
-
197
- Start at [`docs/README.md`](docs/README.md).
198
-
199
- The CLI uses [hosted Jev decisions](design/decision-engine.md) by default for signed-in free and paid users to select eligible CodeGraph context. Runs using the enabled hosted service send a compact, question-scoped routing snapshot to that service: bounded task/node-instruction excerpts plus only the capability metadata needed by the current Jev questions. Retrieved source and conversation history are excluded. Use `/jev off` before submitting work you do not want sent to Jev, `/jev on` to re-enable it, and `/jev status` to inspect the persisted preference (enabled when omitted). Paid users can also disable Jev per Agent in the graph builder. The shared Jev key stays in AWS; no personal Jev key is required.
200
-
201
- The coding model still implements the task. Authentication, quota, capability restrictions and safe fallback remain enforced; Jev does not change tool permissions or graph edges. Signed-out users retain ordinary retrieval routing unless they configure a local decision service. [QA evidence](tests/default-active-jev-test-plan.md) records a successful live hosted CLI run; prediction quality and token savings have not been measured. Configure a local model under **Settings > Runtime > Jev decisions > Configure decisions**, with its structured decision API URL, model name and optional authentication environment-variable name. CLI, desktop and browser honor the saved `decisions` configuration; global `/jev off` disables both local and hosted calls. Direct Jev supports shadow evaluation and Laya supports shadow/active CodeGraph and memory routing; ordinary OpenAI-compatible chat models are insufficient. Explicit embedded runtimes retain off/none library defaults.
202
-
203
- See [`design/product/tui-design.md`](design/product/tui-design.md) for the primary terminal UX, [`design/product/graph-builder.md`](design/product/graph-builder.md) for the `--configure` graph editor, [`design/architecture/react-agent-loop.md`](design/architecture/react-agent-loop.md) for the default Agent executor, [`design/gui-design/`](design/gui-design/) for the AndorraBot-derived desktop design baseline, and [`design/architecture/overview.md`](design/architecture/overview.md) for the shared runtime architecture.
204
-
205
- ## Status
206
-
207
- Initial executable CLI/runtime is available. See [Getting started](docs/getting-started/README.md) for installation, provider setup, slash commands, headless use and current limitations.
43
+ Run a single task without the TUI:
208
44
 
209
45
  ```sh
210
- npm ci
211
- npm run build
212
- npm start
46
+ andorra --prompt "Add a test for the date parser" --json
213
47
  ```
214
48
 
215
- The current CLI includes `/dashboard`, `/model`, `/providers`, `/graph`, `/usage`, `/yolo`, `/tools`, `/status`, `/clear`, `/help`, and `/exit`. The browser Graph Builder adds editable Agent definitions, typed handoffs, fan-out/Join routing and internal subagents. Broader product-direction examples remain subject to the implementation limits documented in ADR 0010.
216
-
217
- ### Workspace permissions
218
-
219
- Use `/permissions` to choose **Read Only**, **Ask for approval** (default), **Approve for me**, or **Full Access**. Selections persist per canonical workspace directory in your global Andorra configuration. The selector marks the current mode; Escape cancels. `/permissions read-only|ask-for-approval|approve-for-me|full-access` also selects directly.
220
-
221
- Workspace writes are automatic in Ask for approval and Approve for me; Read Only asks before native writes. Native file operations require per-operation approval outside the workspace or for protected repository/runtime metadata, including a custom `CODEX_HOME`. Graph capability limits remain in force.
222
-
223
- Read Only suspends CodeGraph because indexing writes its workspace cache. Switching to Read Only stops active cache writers before saving the mode; if they cannot stop, the change reports an error. Switching back to a writable mode resumes CodeGraph when enabled. Native reads and searches remain available while indexing is suspended.
49
+ `andorra graph` opens the visual graph builder in your browser.
224
50
 
225
- Restricted shell profiles request workspace-only reads, limited runtime reads, workspace writes according to the selected mode, and no network. **Restricted shell execution currently fails closed before spawning any command. Installed Windows Codex CLI 0.160.0 was observed accepting this profile while still reading an owned Documents file outside the workspace and runtime allowances; no backend has been verified to enforce the required read boundary.** Other operating systems are unsupported. Native file tools and remembered permissions still work. Explicit `sandbox_permissions=require_escalated` with a justification can request approval for one host command; no failed command is automatically retried outside the sandbox.
51
+ ## Accounts
226
52
 
227
- Restricted shell launcher discovery accepts standard Codex desktop, global npm, or Cargo installation roots. A nested workspace does not trust executables elsewhere in its parent repository. For a custom installation, set `ANDORRA_CODEX_PATH` to an absolute external native executable or npm shim in your launch environment; this explicitly trusts that installation, and the shim is resolved without executing it. Bare names, relative overrides and repository-controlled targets are rejected. File tools ask before following workspace symlinks or junctions; the grant applies only to that operation. Live shell permission changes are checked again after launcher discovery, immediately before spawn; only explicit per-call host approvals survive a downgrade.
53
+ The coding agent runs on your machine with your providers, and it works signed out. Signing in (`andorra login`) adds custom graphs, and an Andorra membership unlocks larger graphs and the Orchestrator. See [andorracode.com](https://andorracode.com).
228
54
 
229
- Full Access permits host filesystem/network access without prompts while recording automatic authorization events. `/yolo on` and `--yolo` are session-only Full Access overrides; `/yolo off` selects Ask for approval for the session. They do not replace the saved workspace choice. Native reads and writes of protected credential/config roots require approval; recursive searches skip those roots. Restricted Grep uses bounded native file operations without invoking PATH helpers (type, multiline, and only-matching options are unavailable). Git reads and host QA/browser/terminal actions, including QA status probes, require a scoped approval in restricted modes. Each sandbox attempt uses a unique permission profile and a trusted absolute Codex executable outside the workspace; workspace PATH shims cannot supply the launcher. The model provider connection itself is outside the child-command sandbox.
55
+ ## License
230
56
 
231
- See [the permissions QA plan](tests/permissions-test-plan.md) for setup, exact checks, and platform validation limits.
57
+ Proprietary; free to use under the terms in `LICENSE.md`. Third-party notices are in `THIRD_PARTY_NOTICES.md`.
@@ -55,3 +55,33 @@ files from its own origin. The font files are the unmodified `latin` subsets of
55
55
  - Copyright: Copyright 2023 Vercel, made in collaboration with basement.studio
56
56
  - License: SIL Open Font License 1.1
57
57
  - License copy: `licenses/GEIST-OFL-1.1.txt`
58
+
59
+ ## PDFium
60
+
61
+ Read opens PDF files, for the text of each page and for page images, with PDFium compiled to
62
+ WebAssembly (`src/read-document.ts`). It is installed as the npm dependency `@hyzyla/pdfium`
63
+ version 3.0.0; no source from either project is copied into this repository.
64
+
65
+ - Wrapper: https://github.com/hyzyla/pdfium, by Yevhenii Hyzyla
66
+ - Wrapper license: MIT, as shipped in the package's `LICENSE.md`
67
+ - Engine: https://pdfium.googlesource.com/pdfium
68
+ - Engine copyright: Copyright 2014 The PDFium Authors
69
+ - Engine license: BSD 3-Clause and Apache License 2.0, as stated in PDFium's `LICENSE`
70
+
71
+ The WebAssembly build links the libraries PDFium vendors under `third_party`, among them FreeType
72
+ and OpenJPEG, each under its own permissive license recorded in the PDFium source tree.
73
+
74
+ ## ELK (elkjs)
75
+
76
+ The desktop app lays out the diagrams it draws from `mermaid` fences with the Eclipse Layout Kernel
77
+ (`desktop/src/engine/diagram.ts`). It is installed as the npm dependency `elkjs` version 0.9.3,
78
+ through `@mermaid-js/layout-elk` version 0.2.3 (MIT, Copyright (c) 2014 - 2022 Knut Sveidqvist), and
79
+ is bundled into the desktop app unmodified. No source from either project is copied into this
80
+ repository.
81
+
82
+ - Project: https://github.com/kieler/elkjs, compiled from https://github.com/eclipse/elk
83
+ - Copyright: Copyright (c) 2017 Kiel University and others
84
+ - License: Eclipse Public License 2.0
85
+ - License copy: `licenses/ELKJS-EPL-2.0.txt`
86
+ - Source code: elkjs is made available under the EPL-2.0 by its authors. The source of the version
87
+ shipped is at https://github.com/kieler/elkjs/tree/0.9.3 and in the npm package `elkjs@0.9.3`.
@@ -25,13 +25,13 @@ import { createAgentEngine } from './hardened-runtime.js';
25
25
  import { completionTool } from './completion.js';
26
26
  import { DELIVERED_OUTCOME, GRAPH_MANAGER_GRAPH_ID, capabilitySubset, delegatesWriting, effectiveCapabilities, intakeCapabilities, isTestingNode, isWritingRole, laterAgentNodes, permitsBuiltInTool, testerOnEveryRoute } from './graphs.js';
27
27
  import { DELEGATION_DIFF_LIMIT, LandingRestoreError, addChangeWorktree, assertDelegationGit, applyLanding, collectChange, prepareLanding, removeChangeWorktree, repositoryRoot, snapshotWorkspace } from './delegation-changes.js';
28
- import { classifyWorkspaceWrites } from './tools.js';
29
28
  import { stopQaProcessesUnder } from './qa/runtime/ProcessManager.js';
30
29
  import { qaGuidance } from './qa/guidance.js';
31
30
  import { disposePooledPowerShellUnder } from './powershell-pool.js';
32
31
  import { validateValue } from './handoffs.js';
33
32
  import { ArtifactStore } from './artifacts.js';
34
33
  import { approveOperation, capabilityTools, gitReadTool } from './capabilities.js';
34
+ import { removeUntrackedFileTool } from './untracked-file-removal.js';
35
35
  import { permissionMode, serializeApprovals, assertPlanMutationAllowed } from './permissions.js';
36
36
  import { adaptLegacyCodingToolArguments, canonicalToolName, canonicalizeToolList } from './tool-names.js';
37
37
  const exec = promisify(execFile);
@@ -58,7 +58,7 @@ Clarify first on either path: publish the plan with update_todos, research, and
58
58
  Delegate implementation to the writing roles with spawn_subagent, several in parallel when their tasks are independent. Each runs in its own Git worktree started from the working folder as it stands and may run commands and tests there. Give each one a bounded task carrying the confirmed requirements and acceptance criteria, and ask it to report the commands and tests it ran.
59
59
  Each writing spawn returns a change record: an id (use it exactly as returned), the changed files, the diff (the full diff is behind read_artifact when truncated), the worktree path, and the tests report the subagent gave. Review every change: read the diff, read files inside the worktree with your read tools when the diff is not enough, and weigh the tests report; a failure report is grounds for a fix.
60
60
  Decide every change: accept_change with its id lands it in the working folder as uncommitted edits; discard_change drops it. A new subagent starts from the working folder, so it sees landed work only, never a change still waiting for your decision. To build on a change, accept it first and then spawn the follow-up. When work is wrong or incomplete, discard it and spawn a redo whose task carries your review findings, then review the redo. A conflict lands nothing and names the files: the change no longer fits the working folder and accepting it again conflicts again, so discard it, spawn a redo (it starts from the folder as it now stands) and accept the redo.
61
- Complete with "delivered" only when no subagent is still running, at least one change landed, and every change is accepted or discarded. Never write code or run commands yourself: you have no write or shell tools, and the change tools take only an id.`;
61
+ Complete with "delivered" only when no subagent is still running, at least one change landed, and every change is accepted or discarded. Never write code or run commands yourself: you have no write or shell tools, and the change tools take only an id. The one exception is remove_untracked_file, for a stray untracked file left by mistake (such as one named nul or after a sentence); remove it yourself instead of asking the user to.`;
62
62
  /**
63
63
  * Appended to a delegating Orchestrator's instructions when it continues a resumed conversation:
64
64
  * the change registry is per visit and is not restored.
@@ -463,6 +463,13 @@ export async function executeAgentNode(node, options) {
463
463
  }
464
464
  if (codeLedger && codeIntel)
465
465
  tools.push(codeIntel.exploreTool(codeLedger));
466
+ // Project memory is a session facility like update_todos: node allowlists and capability
467
+ // policies do not govern it (it never touches the workspace); contextPolicy.projectMemory
468
+ // false turns it off for a node. Delegated children work from their parent's brief.
469
+ if (options.projectMemory && depth === 0 && configured.contextPolicy?.projectMemory !== false) {
470
+ const present = new Set(tools.map(tool => tool.name));
471
+ tools.push(...options.projectMemory.tools().filter(tool => !present.has(tool.name)));
472
+ }
466
473
  if (orchestrator)
467
474
  for (let index = 0; index < tools.length; index++) {
468
475
  const tool = tools[index];
@@ -504,6 +511,46 @@ export async function executeAgentNode(node, options) {
504
511
  await emit('agent.clarification.answered', { answered: true });
505
512
  return JSON.stringify({ answer, proposedDesign: args.proposedDesign });
506
513
  } });
514
+ // A top-level execution agent asks through the same prompt the Orchestrator's intake uses.
515
+ // Without the tool its only way to ask is prose: a question written beside a tool call pauses
516
+ // nothing, and a reply that is only a question is a stalled turn the runtime sends back, so
517
+ // the user watches the question scroll past while the run keeps working. It is offered only
518
+ // where a person can answer; a headless run keeps the complete_agent handoff, and a delegated
519
+ // child reports to its parent rather than to the user.
520
+ // The one write an Orchestrator makes itself: clearing a stray untracked file, which can be what
521
+ // stops a subagent from starting. It takes a path and nothing else, so it cannot write code.
522
+ if (orchestrator && depth === 0 && effectiveCapabilities(configured).filesystem !== 'none')
523
+ tools.push(removeUntrackedFileTool());
524
+ if (!orchestrator && depth === 0 && options.context.approvalMode !== 'headless' && options.context.askUser)
525
+ tools.push({ name: 'ask_user', executionMode: 'sequential', description: 'Ask the user a question only they can answer and wait for the answer. Use it whenever a choice is theirs to make: a skill or instruction that says to ask, a preference, a missing requirement. A question written in your reply does not pause the run and may go unseen, so never ask that way. Ask one short question per call in plain language; when the options are known give 2-4 short choices, the recommended one first and labelled (Recommended). Do not ask what your tools can find out or what you can reasonably decide yourself. Before asking where something is or what a name refers to, finish a search for it by file name and by content; a search that was cut short or timed out does not count.',
526
+ parameters: { type: 'object', properties: { question: { type: 'string', minLength: 1, maxLength: 500, description: 'One plain-language question.' }, choices: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 200 }, minItems: 2, maxItems: 8, description: 'Short answers the user can pick from; they can always type their own.' } }, required: ['question'], additionalProperties: false },
527
+ execute: async (args, ctx) => {
528
+ ctx.signal.throwIfAborted();
529
+ if (Object.keys(args).some(key => !['question', 'choices'].includes(key)) || typeof args.question !== 'string' || !args.question.trim() || args.question.length > 500)
530
+ throw new Error('Ask one simple question of at most 500 characters in question; put the possible answers in choices.');
531
+ if (args.choices !== undefined && (!Array.isArray(args.choices) || args.choices.length < 2 || args.choices.length > 8 || args.choices.some(item => typeof item !== 'string' || !item.trim() || item.length > 200)))
532
+ throw new Error('Optional choices must be an array of 2-8 nonempty strings, each at most 200 characters.');
533
+ const choices = args.choices === undefined ? undefined : [...args.choices];
534
+ if (ctx.approvalMode === 'headless' || !ctx.askUser)
535
+ throw new Error('No user can answer on this surface. Decide with the recommended option and say so, or hand off with complete_agent and put the question first in the summary.');
536
+ const question = args.question.trim();
537
+ await emit('agent.clarification.requested', { question, ...(choices ? { choices } : {}) });
538
+ const answer = await ctx.askUser(question, ctx.userSignal ?? ctx.signal, choices);
539
+ ctx.signal.throwIfAborted();
540
+ const answered = typeof answer === 'string' && !!answer.trim() && answer.trim().toLowerCase() !== '/cancel';
541
+ await emit('agent.clarification.answered', { answered });
542
+ // The surfaces report two different refusals. No answer at all, or /cancel, is the user
543
+ // cancelling: the terminal's choice is labelled "Cancel this task", so the run stops as it
544
+ // does for an Orchestrator question. An empty answer is the desktop's Skip, which declines
545
+ // this one question and lets the work go on.
546
+ if (typeof answer !== 'string' || answer.trim().toLowerCase() === '/cancel')
547
+ throw new ClarificationRequiredError('Needs clarification: the user cancelled the task at a question. Nothing further was done.');
548
+ if (!answered)
549
+ return JSON.stringify({ answered: false, note: 'The user skipped the question without answering. Do not ask it again: continue with the recommended option and say which one you chose, or hand off with complete_agent if the work cannot continue without their decision.' });
550
+ if (answer.length > 16000)
551
+ throw new Error('The answer exceeds 16000 characters; ask for a shorter decision.');
552
+ return JSON.stringify({ answered: true, answer });
553
+ } });
507
554
  // Plan mode is offered at the run's top level regardless of the mode this attempt composed
508
555
  // under: the mode is the user's pick and can change while the task runs (the live picker or
509
556
  // /permissions plan), and a catalog keyed to the starting mode would leave a switched-in run
@@ -868,6 +915,7 @@ export async function executeAgentNode(node, options) {
868
915
  // workspace, the modes that auto-approve workspace writes land without a prompt and
869
916
  // audit the grant.
870
917
  const files = prepared.landing.files;
918
+ const { classifyWorkspaceWrites } = await import('./tools.js');
871
919
  const { outside, protected: protectedPaths } = await classifyWorkspaceWrites(ctx.workspace, prepared.landing.root, files);
872
920
  const automatic = () => !outside.length && !protectedPaths.length && ['ask-for-approval', 'approve-for-me'].includes(permissionMode(ctx) ?? '');
873
921
  while (!(asked && files.every(file => granted.has(file)))) {
@@ -38,6 +38,11 @@ export const GRAPH_AGENT_GUIDE = [
38
38
  ' For multi-outcome agents supply completion: {mode: "outcomes", outcomes: ["pass", "fail"]}.',
39
39
  ' Every declared outcome must have an outgoing edge unless completion.requireRoutes is explicitly false.',
40
40
  ' Agents created or modified through MCP must set provider; never assume the active provider is inherited.',
41
+ ' subagents {enabled, maxConcurrent, maxTotal, maxDepth, workspace, modelPolicy, toolInheritance, context, roles}:',
42
+ ' workspace is shared-read-only (default; roles only read), shared-write (writes in place; maxConcurrent 1 when roles write)',
43
+ ' or worktree (each child gets its own Git worktree; required for writing roles on an Orchestrator; needs parent git write).',
44
+ ' modelPolicy: inherit | specific | per-role. toolInheritance: restricted | inherit. context: selected | task-only.',
45
+ ' Validation messages name the field and the values to set. This guide and those messages are the whole reference: never search source code for them.',
41
46
  'condition: requires condition {source, path, equals}; ports true and false; source must run before it on every path.',
42
47
  'loop: requires loop {maxIterations}; ports body and done. A body edge may return to the loop.',
43
48
  ' Node visits are unlimited unless the graph sets graph.limits.maxNodeVisits; 0 means unlimited there too.',
@@ -44,7 +44,7 @@ export declare const APP_SERVER_PROTOCOL_VERSION = 2;
44
44
  * one when a client omits it. An engine without it rebuilds a replaced entry from its own field
45
45
  * list, so a save through it silently drops the rename and every surface falls back to the id; a
46
46
  * client that can show the field must refuse the write first. */
47
- export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.name", "providers.claude", "providers.claudeAuth", "providers.grok", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "run.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "browser.view.go", "config.browser", "config.webSearch", "background.tasks", "workspace.warm", "browser.cookies.firefox", "sessions.compact", "sessions.changes"];
47
+ export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.name", "providers.claude", "providers.claudeAuth", "providers.grok", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.detectSignIns", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "run.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.codeIntel", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "browser.view.go", "config.browser", "config.webSearch", "background.tasks", "workspace.warm", "browser.cookies.firefox", "sessions.compact", "sessions.changes"];
48
48
  /** One client call. `params` is omitted only for calls that take no arguments. */
49
49
  export interface AppServerRequest {
50
50
  id: number | string;
@@ -195,6 +195,13 @@ export interface AppServerConfig {
195
195
  jevEnabled?: boolean;
196
196
  decisions?: import('../decision/types.js').DecisionConfig;
197
197
  commandMemory?: boolean;
198
+ /** The saved CodeGraph default and its per-repository overrides. Absent means the default: on. */
199
+ codeIntel?: {
200
+ enabled?: boolean;
201
+ disabledRepos?: string[];
202
+ enabledRepos?: string[];
203
+ };
204
+ projectMemory?: boolean;
198
205
  /**
199
206
  * The anonymous-feedback preference. An absent block means the default: reporting is on.
200
207
  *
@@ -348,6 +355,7 @@ export interface AppServerUsageAnalytics {
348
355
  savedInputEstimate: number;
349
356
  savedOutputEstimate: number;
350
357
  bypassedTurns: number;
358
+ jevCalls: number;
351
359
  unestimatedTurns: number;
352
360
  contextEstimatedTurns: number;
353
361
  jevInputTokens: number;
@@ -130,4 +130,4 @@ export const APP_SERVER_PROTOCOL_VERSION = 2;
130
130
  // carries the pending set, without diffs, whenever it changes. A completed Write or Edit also reports its
131
131
  // own change as `fileDiff` on `node.tool.completed`. An engine without it answers `unknown-method` and sends
132
132
  // neither, so a window on such an engine shows no review bar and no Keep or Undo.
133
- export const APP_SERVER_CAPABILITIES = ['run.start.runPermissions', 'automations', 'providers.models', 'providers.test', 'providers.test.model', 'providers.streamIdleTimeout', 'providers.modelContextWindows', 'providers.name', 'providers.claude', 'providers.claudeAuth', 'providers.grok', 'providers.opencode', 'providers.auth.submit', 'providers.opencodeGo', 'providers.discover.draft', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.resume.model', 'run.steer', 'run.overrideAllNodes', 'run.setModel', 'run.setModel.node', 'run.setPermissions', 'run.start.continueSession', 'run.start.entryHistory', 'remote.owner.projects', 'remote.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', 'extensions.manage', 'extensions.resources', 'skills.invoke', 'mcp.manage', 'mcp.edit', 'mcp.status', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'browser.view.go', 'config.browser', 'config.webSearch', 'background.tasks', 'workspace.warm', 'browser.cookies.firefox', 'sessions.compact', 'sessions.changes'];
133
+ export const APP_SERVER_CAPABILITIES = ['run.start.runPermissions', 'automations', 'providers.models', 'providers.test', 'providers.test.model', 'providers.streamIdleTimeout', 'providers.modelContextWindows', 'providers.name', 'providers.claude', 'providers.claudeAuth', 'providers.grok', 'providers.opencode', 'providers.auth.submit', 'providers.opencodeGo', 'providers.discover.draft', 'providers.detectSignIns', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.resume.model', 'run.steer', 'run.overrideAllNodes', 'run.setModel', 'run.setModel.node', 'run.setPermissions', 'run.start.continueSession', 'run.start.entryHistory', 'remote.owner.projects', 'remote.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', 'extensions.manage', 'extensions.resources', 'skills.invoke', 'mcp.manage', 'mcp.edit', 'mcp.status', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.codeIntel', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'browser.view.go', 'config.browser', 'config.webSearch', 'background.tasks', 'workspace.warm', 'browser.cookies.firefox', 'sessions.compact', 'sessions.changes'];
@@ -3,6 +3,7 @@ import { removeCodexAccount } from './codex-auth.js';
3
3
  import { CodexAccountAuth } from './codex-browser-auth.js';
4
4
  import { AnthropicConsoleAuth } from './anthropic-console-auth.js';
5
5
  import { OpenCodeSignIn } from './managed-sign-in.js';
6
+ import { type SignInProbes } from './sign-in-detection.js';
6
7
  import type { CliSignIn } from './cli-sign-in.js';
7
8
  import { checkGraphModelHealth } from './graph-health.js';
8
9
  import { loadAccessibleGraph } from './membership.js';
@@ -111,6 +112,8 @@ export interface AppServerOptions {
111
112
  grok?: ManagedSignInService;
112
113
  opencode?: OpenCodeSignInService;
113
114
  };
115
+ /** How each vendor CLI is asked whether it is signed in; overridable so a test never spawns one. */
116
+ signInProbes?: Partial<SignInProbes>;
114
117
  /** Overridable so a test can answer `gh` without reaching GitHub. */
115
118
  gh?: GhRunner;
116
119
  /** How often the pull request watcher polls; a test shortens it. */
@@ -138,6 +141,9 @@ export declare class AppServer {
138
141
  private readonly claudeSignIn;
139
142
  private readonly grokSignIn;
140
143
  private readonly openCodeSignIn;
144
+ private readonly signInProbes;
145
+ /** The last detection of each tool: an import names a type and a model, and is checked against this. */
146
+ private readonly detectedSignIns;
141
147
  /** Retires a removed provider's slot home; a seam so a test never has to spawn the Codex CLI. */
142
148
  private readonly retireCodexAccount;
143
149
  /** The `gh` the pull request settings and watcher run through. */
@@ -148,6 +154,14 @@ export declare class AppServer {
148
154
  private readonly sessionChanges;
149
155
  /** The wakes this engine armed for Auto-fix, checked against the PR record again before delivery. */
150
156
  private readonly autoFixWakes;
157
+ /**
158
+ * A run of the session waiting inside the `pull_request` tool's `await_review` for its PR's next review, by
159
+ * session: the review comments the watcher finds go to it instead of to a wake, and it hears when the PR is
160
+ * merged, closed, dismissed or has Auto-fix switched off.
161
+ */
162
+ private readonly reviewWaiters;
163
+ /** Sessions whose review wait is reserved and still being prepared (`awaitReview`). */
164
+ private readonly reviewWaitsStarting;
151
165
  /**
152
166
  * The account's graph sync, so a graph saved on another machine is listed here too. A first pass that
153
167
  * outlasts the listing's bounded wait publishes `graphs.changed`: that listing already answered from
@@ -448,6 +462,15 @@ export declare class AppServer {
448
462
  */
449
463
  private retireSlots;
450
464
  private discoverModels;
465
+ /**
466
+ * Which vendor CLIs on this machine are signed in and have no provider yet.
467
+ *
468
+ * Local-client only, like the sign-ins themselves: these logins belong to this machine. Only display
469
+ * fields and model ids are answered; a probe that fails says nothing rather than surfacing CLI output.
470
+ */
471
+ private detectProviderSignIns;
472
+ /** Add the chosen detected sign-ins as providers; each must name a tool and model the last detection reported. */
473
+ private importProviderSignIns;
451
474
  /** Local-client only. The remote engine relay deliberately does not admit these methods. */
452
475
  private providerAuth;
453
476
  /**
@@ -1061,6 +1084,21 @@ export declare class AppServer {
1061
1084
  private updateSessionSkill;
1062
1085
  /** Say what a session is waiting on. An empty list is a real answer: it is what ends a wait. */
1063
1086
  private emitPullRequest;
1087
+ /**
1088
+ * Hold the calling run until its PR's next review: the comments the watcher finds are handed to it as the Auto-fix
1089
+ * prompt would be, instead of being armed as a wake. A wake already armed for comments it has not delivered is
1090
+ * taken at once. `origin` (the waiting node) becomes the node later Auto-fix wakes go to, since it owns the loop.
1091
+ */
1092
+ private awaitReview;
1093
+ /**
1094
+ * What the session's PR record says a review wait should end with, handed to `deliver`: the PR is gone, finished or
1095
+ * has Auto-fix off, or it holds comments found and not yet carried by a run. Those are taken under the lock, handed
1096
+ * over first and only then marked handled, so a wait that ended meanwhile never loses them. A wake this engine is
1097
+ * delivering now is left to that delivery.
1098
+ */
1099
+ private reviewWaitFromRecord;
1100
+ /** A run now carries the Auto-fix prompt behind `wakeId`: its comments are handled. */
1101
+ private recordAutoFixDelivered;
1064
1102
  /** The pending set as a change left it, without diffs: a client reads those with `sessions.changes.list`. */
1065
1103
  private emitSessionChanges;
1066
1104
  /**
@@ -1080,7 +1118,8 @@ export declare class AppServer {
1080
1118
  /**
1081
1119
  * Hand an Auto-fix prompt to the session through the same wake a `set_timer` arms, under the selections the
1082
1120
  * session's PR was configured from: without them the continuation would run under whatever graph and model
1083
- * the configuration names today, with different tools than the work it is fixing.
1121
+ * the configuration names today, with different tools than the work it is fixing. `origin` addresses the prompt to
1122
+ * the graph node that switched Auto-fix on (`deliverDueTimers`), rather than to the graph's entry node.
1084
1123
  */
1085
1124
  private wakeForPullRequest;
1086
1125
  private emitTimers;
@@ -1112,6 +1151,15 @@ export declare class AppServer {
1112
1151
  * so the reason goes out with `timers.spent` - which a window shows as a notice - and into the log.
1113
1152
  */
1114
1153
  private spendWake;
1154
+ /**
1155
+ * Whether a wake is a `set_timer` reminder a graph node set about the work it was doing. Those belong to that work:
1156
+ * they are read by the node while its attempt runs, and spent once the node or the attempt is done with it.
1157
+ *
1158
+ * An Auto-fix wake also names a node (the one that switched Auto-fix on), but only as its address: review comments
1159
+ * are new work that outlives the attempt that turned Auto-fix on, so they are never spent with it and always wait
1160
+ * for the engine to be free (`deliverDueTimers`).
1161
+ */
1162
+ private nodeReminder;
1115
1163
  /**
1116
1164
  * Spend the session's node-armed wakes that belong to an attempt in `attempts` and satisfy `spent`.
1117
1165
  *