@andorra-labs/code 0.1.9 → 0.1.11

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 (212) hide show
  1. package/README.md +28 -208
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/agent-execution.js +56 -0
  4. package/dist/src/app-server/protocol.d.ts +109 -1
  5. package/dist/src/app-server/protocol.js +8 -1
  6. package/dist/src/app-server.d.ts +59 -1
  7. package/dist/src/app-server.js +418 -63
  8. package/dist/src/auth/index.d.ts +1 -1
  9. package/dist/src/auth/index.js +1 -1
  10. package/dist/src/auth/store.d.ts +17 -1
  11. package/dist/src/auth/store.js +25 -2
  12. package/dist/src/automation-service.js +1 -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 +255 -33
  16. package/dist/src/browser-ui/index.html +9 -9
  17. package/dist/src/browser-ui/style.css +110 -65
  18. package/dist/src/browser-ui/tokens.css +27 -26
  19. package/dist/src/cli.js +10 -5
  20. package/dist/src/coding-tools.d.ts +24 -0
  21. package/dist/src/coding-tools.js +71 -8
  22. package/dist/src/command-screens.js +1 -1
  23. package/dist/src/commands.d.ts +1 -1
  24. package/dist/src/commands.js +2 -2
  25. package/dist/src/completion-gates.d.ts +42 -7
  26. package/dist/src/completion-gates.js +55 -9
  27. package/dist/src/completion.d.ts +9 -1
  28. package/dist/src/completion.js +20 -2
  29. package/dist/src/dashboard-view.js +2 -2
  30. package/dist/src/deadline.js +4 -0
  31. package/dist/src/decision/checks.js +1 -1
  32. package/dist/src/file-diff.d.ts +105 -0
  33. package/dist/src/file-diff.js +244 -0
  34. package/dist/src/graph-manager-chat.js +4 -4
  35. package/dist/src/graph-runner.js +39 -2
  36. package/dist/src/graph-sync.d.ts +8 -0
  37. package/dist/src/graph-sync.js +54 -3
  38. package/dist/src/graph-tool.js +1 -1
  39. package/dist/src/graph-ui/app.js +303 -129
  40. package/dist/src/graph-ui/controls.css +43 -22
  41. package/dist/src/graph-ui/controls.js +31 -1
  42. package/dist/src/graph-ui/embed.js +56 -7
  43. package/dist/src/graph-ui/icons.js +5 -0
  44. package/dist/src/graph-ui/index.html +3 -3
  45. package/dist/src/graph-ui/manager-state.js +2 -2
  46. package/dist/src/graph-ui/manager.css +19 -18
  47. package/dist/src/graph-ui/manager.js +5 -5
  48. package/dist/src/graph-ui/skill-picker.js +5 -5
  49. package/dist/src/graph-ui/studio-canvas.js +16 -16
  50. package/dist/src/graph-ui/studio.css +18 -15
  51. package/dist/src/graph-ui/studio.js +99 -42
  52. package/dist/src/graph-ui/style.css +125 -80
  53. package/dist/src/graph-ui/theme.js +2 -2
  54. package/dist/src/graph-ui/tokens.css +33 -29
  55. package/dist/src/graphs.d.ts +10 -3
  56. package/dist/src/graphs.js +15 -4
  57. package/dist/src/mcp.d.ts +75 -0
  58. package/dist/src/mcp.js +240 -8
  59. package/dist/src/membership-errors.d.ts +7 -1
  60. package/dist/src/membership-errors.js +9 -3
  61. package/dist/src/provider-keys.d.ts +5 -1
  62. package/dist/src/provider-keys.js +7 -3
  63. package/dist/src/provider-settings.d.ts +4 -1
  64. package/dist/src/provider-settings.js +46 -5
  65. package/dist/src/pull-requests.d.ts +42 -6
  66. package/dist/src/pull-requests.js +11 -3
  67. package/dist/src/qa/guidance.js +6 -19
  68. package/dist/src/qa/index.d.ts +0 -2
  69. package/dist/src/qa/index.js +0 -2
  70. package/dist/src/qa/profile/QaProfile.d.ts +5 -1
  71. package/dist/src/qa/profile/QaProfile.js +6 -2
  72. package/dist/src/qa/tools.d.ts +19 -1
  73. package/dist/src/qa/tools.js +20 -145
  74. package/dist/src/react-runtime.js +134 -16
  75. package/dist/src/read-document-doc.d.ts +20 -0
  76. package/dist/src/read-document-doc.js +524 -0
  77. package/dist/src/read-document-docx.d.ts +21 -0
  78. package/dist/src/read-document-docx.js +584 -0
  79. package/dist/src/read-document-text.d.ts +29 -0
  80. package/dist/src/read-document-text.js +67 -0
  81. package/dist/src/read-document-tool.d.ts +48 -0
  82. package/dist/src/read-document-tool.js +162 -0
  83. package/dist/src/read-document.d.ts +78 -0
  84. package/dist/src/read-document.js +353 -0
  85. package/dist/src/read-image.d.ts +29 -2
  86. package/dist/src/read-image.js +42 -17
  87. package/dist/src/remote/engine-pool.js +18 -6
  88. package/dist/src/runtime.d.ts +19 -0
  89. package/dist/src/runtime.js +10 -1
  90. package/dist/src/screen-selection.d.ts +38 -0
  91. package/dist/src/screen-selection.js +103 -0
  92. package/dist/src/session-changes.d.ts +122 -0
  93. package/dist/src/session-changes.js +804 -0
  94. package/dist/src/side-panel.d.ts +6 -1
  95. package/dist/src/side-panel.js +12 -10
  96. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  97. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  98. package/dist/src/skills/bundled/graph-manager/SKILL.md +37 -3
  99. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  100. package/dist/src/skills/bundled/provenance.json +4 -4
  101. package/dist/src/skills/runtime-skills.js +3 -3
  102. package/dist/src/stall-recovery.d.ts +15 -0
  103. package/dist/src/stall-recovery.js +17 -0
  104. package/dist/src/telemetry/schema.d.ts +1 -1
  105. package/dist/src/telemetry/schema.js +1 -2
  106. package/dist/src/terminal-ui.d.ts +64 -20
  107. package/dist/src/terminal-ui.js +312 -82
  108. package/dist/src/time-limit.d.ts +53 -0
  109. package/dist/src/time-limit.js +79 -0
  110. package/dist/src/tool-diff-stats.d.ts +9 -0
  111. package/dist/src/tool-diff-stats.js +20 -0
  112. package/dist/src/tool-names.d.ts +1 -1
  113. package/dist/src/tool-result-filter.js +1 -1
  114. package/dist/src/tools.js +118 -9
  115. package/dist/src/transcript.d.ts +11 -0
  116. package/dist/src/transcript.js +15 -3
  117. package/dist/src/types.d.ts +12 -0
  118. package/dist/src/usage-analytics.d.ts +3 -1
  119. package/dist/src/usage-analytics.js +16 -2
  120. package/package.json +6 -26
  121. package/dist/src/qa/api/http-runner.d.ts +0 -3
  122. package/dist/src/qa/api/http-runner.js +0 -47
  123. package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
  124. package/dist/src/qa/git/ChangeDetector.js +0 -177
  125. package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
  126. package/dist/src/qa/git/DiffReviewer.js +0 -115
  127. package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
  128. package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
  129. package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
  130. package/dist/src/qa/orchestrator/MergeGate.js +0 -40
  131. package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
  132. package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
  133. package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
  134. package/dist/src/qa/runners/CommandRunner.js +0 -96
  135. package/dist/src/qa/runners/TestRunner.d.ts +0 -21
  136. package/dist/src/qa/runners/TestRunner.js +0 -66
  137. package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
  138. package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
  139. package/dist/src/qa/runtime-detect.d.ts +0 -10
  140. package/dist/src/qa/runtime-detect.js +0 -72
  141. package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
  142. package/dist/src/qa/security/DependencyScanner.js +0 -167
  143. package/dist/src/qa/security/SecretScanner.d.ts +0 -3
  144. package/dist/src/qa/security/SecretScanner.js +0 -55
  145. package/docs/README.md +0 -36
  146. package/docs/agents/README.md +0 -62
  147. package/docs/agents/install-for-agents.md +0 -56
  148. package/docs/agents/mcp-server.md +0 -212
  149. package/docs/agents/subagent-mode.md +0 -149
  150. package/docs/concepts/README.md +0 -47
  151. package/docs/concepts/jev-actionable-routing.md +0 -113
  152. package/docs/concepts/jev-decision-thresholds.md +0 -412
  153. package/docs/concepts/jev-efficiency.md +0 -217
  154. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  155. package/docs/concepts/limits.md +0 -52
  156. package/docs/concepts/memory.md +0 -10
  157. package/docs/concepts/security.md +0 -50
  158. package/docs/concepts/workspace-instructions.md +0 -29
  159. package/docs/getting-started/README.md +0 -82
  160. package/docs/getting-started/accounts.md +0 -78
  161. package/docs/getting-started/configure-providers.md +0 -132
  162. package/docs/guides/README.md +0 -13
  163. package/docs/guides/browser.md +0 -39
  164. package/docs/guides/desktop-app.md +0 -414
  165. package/docs/guides/extensions.md +0 -102
  166. package/docs/guides/graph-builder.md +0 -116
  167. package/docs/guides/headless.md +0 -46
  168. package/docs/guides/tui.md +0 -75
  169. package/docs/guides/update.md +0 -70
  170. package/docs/guides/web-search.md +0 -51
  171. package/docs/guides/windows-code-signing.md +0 -319
  172. package/docs/llms.txt +0 -45
  173. package/docs/reference/README.md +0 -7
  174. package/docs/reference/cli.md +0 -76
  175. package/docs/reference/config.md +0 -91
  176. package/docs/reference/slash-commands.md +0 -59
  177. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  178. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  179. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  180. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  181. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  182. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  183. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  184. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  185. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  186. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  187. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  188. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  189. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  190. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  191. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  192. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  193. package/scripts/jev-efficiency-eval.mjs +0 -187
  194. package/scripts/jev-efficiency-live.mjs +0 -193
  195. package/scripts/zcode-engine-replay.mjs +0 -223
  196. package/tests/agent-centric-mcp-test-plan.md +0 -208
  197. package/tests/analytics-settings-test-plan.md +0 -165
  198. package/tests/browser-cli-smoke.mjs +0 -276
  199. package/tests/browser-test-plan.md +0 -280
  200. package/tests/chat-side-panel-test-plan.md +0 -309
  201. package/tests/decision-engine-test-plan.md +0 -163
  202. package/tests/default-active-jev-test-plan.md +0 -85
  203. package/tests/harness-extensions-test-plan.md +0 -113
  204. package/tests/jev-all-decisions-test-plan.md +0 -156
  205. package/tests/jev-efficiency/criteria.json +0 -158
  206. package/tests/jev-efficiency/workloads.mjs +0 -242
  207. package/tests/jev-efficiency-test-plan.md +0 -198
  208. package/tests/permissions-sandbox-probe.mjs +0 -74
  209. package/tests/permissions-test-plan.md +0 -191
  210. package/tests/product-telemetry-test-plan.md +0 -536
  211. package/tests/thinking-stream-preview-test-plan.md +0 -136
  212. package/tests/zcode-react-engine-test-plan.md +0 -396
package/README.md CHANGED
@@ -1,231 +1,51 @@
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
+ Requires Node.js 22.19 or newer.
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
75
- ```
76
-
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
88
-
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
11
+ ```sh
12
+ npm install -g @andorra-labs/code
142
13
  ```
143
14
 
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
15
+ This installs `andorra` and the alias `andorracode`. Keep it current with `andorra update`.
147
16
 
148
- The executable harness is not owned by the TUI or browser frontend.
17
+ ## First run
149
18
 
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) ─┘
19
+ ```sh
20
+ cd /path/to/your/project
21
+ andorra
157
22
  ```
158
23
 
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.
24
+ 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.
162
25
 
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).
26
+ Useful commands inside the TUI:
166
27
 
167
- ## Product surfaces
28
+ | Command | What it does |
29
+ | --- | --- |
30
+ | `/providers`, `/model` | Add providers and pick the model |
31
+ | `/graph` | Choose the graph (harness) a task runs on |
32
+ | `/permissions` | Read Only, Ask for approval (default), Approve for me, or Full Access |
33
+ | `/skills`, `/mcp`, `/plugins` | Manage skills, MCP servers and plugins |
34
+ | `/login`, `/logout` | Sign in to an Andorra account |
35
+ | `/help` | Everything else |
168
36
 
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).
180
-
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.
37
+ Run a single task without the TUI:
208
38
 
209
39
  ```sh
210
- npm ci
211
- npm run build
212
- npm start
40
+ andorra --prompt "Add a test for the date parser" --json
213
41
  ```
214
42
 
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.
43
+ `andorra graph` opens the visual graph builder in your browser.
224
44
 
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.
45
+ ## Accounts
226
46
 
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.
47
+ 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
48
 
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.
49
+ ## License
230
50
 
231
- See [the permissions QA plan](tests/permissions-test-plan.md) for setup, exact checks, and platform validation limits.
51
+ Proprietary; free to use under the terms in `LICENSE.md`. Third-party notices are in `THIRD_PARTY_NOTICES.md`.
@@ -55,3 +55,18 @@ 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.
@@ -504,6 +504,42 @@ export async function executeAgentNode(node, options) {
504
504
  await emit('agent.clarification.answered', { answered: true });
505
505
  return JSON.stringify({ answer, proposedDesign: args.proposedDesign });
506
506
  } });
507
+ // A top-level execution agent asks through the same prompt the Orchestrator's intake uses.
508
+ // Without the tool its only way to ask is prose: a question written beside a tool call pauses
509
+ // nothing, and a reply that is only a question is a stalled turn the runtime sends back, so
510
+ // the user watches the question scroll past while the run keeps working. It is offered only
511
+ // where a person can answer; a headless run keeps the complete_agent handoff, and a delegated
512
+ // child reports to its parent rather than to the user.
513
+ if (!orchestrator && depth === 0 && options.context.approvalMode !== 'headless' && options.context.askUser)
514
+ 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.',
515
+ 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 },
516
+ execute: async (args, ctx) => {
517
+ ctx.signal.throwIfAborted();
518
+ if (Object.keys(args).some(key => !['question', 'choices'].includes(key)) || typeof args.question !== 'string' || !args.question.trim() || args.question.length > 500)
519
+ throw new Error('Ask one simple question of at most 500 characters in question; put the possible answers in choices.');
520
+ 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)))
521
+ throw new Error('Optional choices must be an array of 2-8 nonempty strings, each at most 200 characters.');
522
+ const choices = args.choices === undefined ? undefined : [...args.choices];
523
+ if (ctx.approvalMode === 'headless' || !ctx.askUser)
524
+ 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.');
525
+ const question = args.question.trim();
526
+ await emit('agent.clarification.requested', { question, ...(choices ? { choices } : {}) });
527
+ const answer = await ctx.askUser(question, ctx.userSignal ?? ctx.signal, choices);
528
+ ctx.signal.throwIfAborted();
529
+ const answered = typeof answer === 'string' && !!answer.trim() && answer.trim().toLowerCase() !== '/cancel';
530
+ await emit('agent.clarification.answered', { answered });
531
+ // The surfaces report two different refusals. No answer at all, or /cancel, is the user
532
+ // cancelling: the terminal's choice is labelled "Cancel this task", so the run stops as it
533
+ // does for an Orchestrator question. An empty answer is the desktop's Skip, which declines
534
+ // this one question and lets the work go on.
535
+ if (typeof answer !== 'string' || answer.trim().toLowerCase() === '/cancel')
536
+ throw new ClarificationRequiredError('Needs clarification: the user cancelled the task at a question. Nothing further was done.');
537
+ if (!answered)
538
+ 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.' });
539
+ if (answer.length > 16000)
540
+ throw new Error('The answer exceeds 16000 characters; ask for a shorter decision.');
541
+ return JSON.stringify({ answered: true, answer });
542
+ } });
507
543
  // Plan mode is offered at the run's top level regardless of the mode this attempt composed
508
544
  // under: the mode is the user's pick and can change while the task runs (the live picker or
509
545
  // /permissions plan), and a catalog keyed to the starting mode would leave a switched-in run
@@ -890,13 +926,33 @@ export async function executeAgentNode(node, options) {
890
926
  }
891
927
  ctx.signal.throwIfAborted();
892
928
  assertPlanMutationAllowed(ctx);
929
+ // The review record (Keep / Undo) keeps what each landed path holds before the patch writes or
930
+ // removes it, the same way an Edit's write is recorded, and holds its lock while the patch is applied
931
+ // so an Undo cannot interleave with the landing. A landing that does not land records nothing.
932
+ const recording = ctx.fileChanges ? await ctx.fileChanges.beforeWrite(files.map(file => join(prepared.landing.root, ...file.split('/')))).catch(() => undefined) : undefined;
933
+ const locked = recording ? await recording.begin().then(() => true, () => false) : false;
934
+ // The lock can wait behind an Undo; a stop or a switch to Plan mode in that wait still decides, and
935
+ // is refused exactly as it is just above, with the lock given back.
936
+ try {
937
+ ctx.signal.throwIfAborted();
938
+ assertPlanMutationAllowed(ctx);
939
+ }
940
+ catch (error) {
941
+ if (locked)
942
+ await recording.abort().catch(() => { });
943
+ throw error;
944
+ }
893
945
  let result;
894
946
  try {
895
947
  result = await applyLanding(prepared.landing, ctx.signal);
896
948
  }
897
949
  catch (error) {
950
+ if (locked)
951
+ await recording.abort().catch(() => { });
898
952
  return failed(error);
899
953
  }
954
+ if (locked)
955
+ await (result.landed ? recording.commit() : recording.abort()).catch(() => { });
900
956
  if (result.landed) {
901
957
  change.state = 'landed';
902
958
  change.landedFiles = result.files;
@@ -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", "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"];
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"];
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;
@@ -348,6 +348,7 @@ export interface AppServerUsageAnalytics {
348
348
  savedInputEstimate: number;
349
349
  savedOutputEstimate: number;
350
350
  bypassedTurns: number;
351
+ jevCalls: number;
351
352
  unestimatedTurns: number;
352
353
  contextEstimatedTurns: number;
353
354
  jevInputTokens: number;
@@ -357,6 +358,113 @@ export interface AppServerUsageAnalytics {
357
358
  filesScanned: number;
358
359
  windowDays: number;
359
360
  }
361
+ /**
362
+ * A file's change as a diff with line numbers on both sides (see `src/file-diff.ts`). The hunk counts
363
+ * describe the whole hunk; when the bound cut the diff, `lines` stops short and `hiddenLines` says how
364
+ * many diff lines were left out.
365
+ */
366
+ export interface AppServerFileDiffLine {
367
+ kind: 'context' | 'add' | 'del';
368
+ text: string;
369
+ oldLine?: number;
370
+ newLine?: number;
371
+ noNewline?: true;
372
+ clipped?: true;
373
+ }
374
+ export interface AppServerFileDiffHunk {
375
+ oldStart: number;
376
+ oldLines: number;
377
+ newStart: number;
378
+ newLines: number;
379
+ lines: AppServerFileDiffLine[];
380
+ }
381
+ export interface AppServerFileDiff {
382
+ hunks: AppServerFileDiffHunk[];
383
+ hiddenLines: number;
384
+ }
385
+ /**
386
+ * One file the agent changed in a session since the person last reviewed it (`sessions.changes.*`).
387
+ *
388
+ * The change is measured from the content the file held before the first unreviewed agent write to the
389
+ * file as it is now, so it is the file's real change, every edit of it together — not one call's
390
+ * request. `path` is relative to the session's workspace, with `/` separators.
391
+ */
392
+ export interface AppServerSessionFileChange {
393
+ path: string;
394
+ status: 'added' | 'modified' | 'deleted';
395
+ linesAdded: number;
396
+ linesRemoved: number;
397
+ /** Either side is not UTF-8 text: there is no line diff, and the counts are 0. */
398
+ binary?: true;
399
+ /** A side is too large to line-diff; the counts are a coarse measure. */
400
+ tooLarge?: true;
401
+ /**
402
+ * The permission bits changed, as three octal digits (`"644"` → `"755"`): a landing can change only a
403
+ * file's executable bit, which then is the whole change and its diff has no hunks. Never on Windows,
404
+ * where the mode stands for nothing the tools change, and never for an added or deleted file.
405
+ */
406
+ modeChange?: {
407
+ from: string;
408
+ to: string;
409
+ };
410
+ /**
411
+ * The line terminators changed (`lf`, `crlf`, or `mixed` for both). A diff line drops its terminator, so a
412
+ * converted line reads as removed and added with the same text; this says why.
413
+ */
414
+ lineEndings?: {
415
+ from: 'lf' | 'crlf' | 'mixed';
416
+ to: 'lf' | 'crlf' | 'mixed';
417
+ };
418
+ /**
419
+ * The file changed on disk after the agent last wrote it — another program, or the person. Undo then
420
+ * refuses the file unless asked with `force`. Only `list` and `get` read the disk for it; an event
421
+ * describes the file as the agent's last write left it.
422
+ */
423
+ changedOnDisk?: true;
424
+ /** Whether Undo can restore the file: false when its earlier content was too large to keep. */
425
+ undoable: boolean;
426
+ /**
427
+ * The session revision of the write that last changed this file's entry, so it rises with every change and
428
+ * never repeats for a path, even after the file was kept or undone and changed again: a client tells a diff
429
+ * it holds is out of date by comparing it.
430
+ */
431
+ version: number;
432
+ firstChangedAt: string;
433
+ updatedAt: string;
434
+ /**
435
+ * `list` and `get` only: the diff from the earlier content to the file as it is now, or `null` for a
436
+ * binary or too-large file. Absent from the event, which carries the summary alone. A diff with no hunks
437
+ * is a change no line shows: an empty file created or deleted, or only `modeChange`.
438
+ */
439
+ diff?: AppServerFileDiff | null;
440
+ }
441
+ /** A session's pending set, as `sessions.changes.list` answers it and `session.changes.updated` reports it. */
442
+ export interface AppServerSessionChanges {
443
+ sessionId: string;
444
+ /** Raised by every change to the pending set, in every engine that shares the home: newer is larger. */
445
+ revision: number;
446
+ changes: AppServerSessionFileChange[];
447
+ }
448
+ /** Why Undo left a file as it is. `changed-on-disk` yields to `force`; `no-baseline` never does. */
449
+ export interface AppServerSessionChangeConflict {
450
+ path: string;
451
+ reason: 'changed-on-disk' | 'no-baseline';
452
+ message: string;
453
+ }
454
+ export interface AppServerSessionChangesKept extends AppServerSessionChanges {
455
+ kept: string[];
456
+ }
457
+ export interface AppServerSessionChangesUndone extends AppServerSessionChanges {
458
+ /** Files restored to their earlier content (a file the agent created is removed, one it deleted recreated). */
459
+ reverted: string[];
460
+ /** Files Undo refused. Without `force`, one `changed-on-disk` conflict means nothing was reverted. */
461
+ conflicts: AppServerSessionChangeConflict[];
462
+ /** Files whose restore failed on disk; they stay pending. */
463
+ failed: {
464
+ path: string;
465
+ message: string;
466
+ }[];
467
+ }
360
468
  export interface AppServerSessionSummary {
361
469
  id: string;
362
470
  name: string;
@@ -123,4 +123,11 @@ export const APP_SERVER_PROTOCOL_VERSION = 2;
123
123
  // `background.tasks`: `background.list` answers the AsyncProcess jobs and qa.terminal sessions this
124
124
  // engine holds, `background.stop` ends one, and `background.updated` carries the whole list whenever
125
125
  // it changes. An engine without it answers `unknown-method` and sends no such event.
126
- 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', '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'];
126
+ // `sessions.changes`: the engine keeps each session's agent file writes for review since the person last
127
+ // reviewed them. `sessions.changes.list` answers the pending files with their diffs, `sessions.changes.get`
128
+ // one file's whole diff, `sessions.changes.keep` accepts files and `sessions.changes.undo` restores them
129
+ // (refusing a file changed on disk since the agent's write unless `force`), and `session.changes.updated`
130
+ // carries the pending set, without diffs, whenever it changes. A completed Write or Edit also reports its
131
+ // own change as `fileDiff` on `node.tool.completed`. An engine without it answers `unknown-method` and sends
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'];
@@ -144,8 +144,18 @@ export declare class AppServer {
144
144
  private readonly gh;
145
145
  /** Polls the PRs whose sessions asked for Auto-fix; one engine per home actually polls. */
146
146
  private readonly pullRequestWatcher;
147
+ /** The files each session's agent changed since the person last reviewed them (Keep / Undo). */
148
+ private readonly sessionChanges;
147
149
  /** The wakes this engine armed for Auto-fix, checked against the PR record again before delivery. */
148
150
  private readonly autoFixWakes;
151
+ /**
152
+ * A run of the session waiting inside the `pull_request` tool's `await_review` for its PR's next review, by
153
+ * session: the review comments the watcher finds go to it instead of to a wake, and it hears when the PR is
154
+ * merged, closed, dismissed or has Auto-fix switched off.
155
+ */
156
+ private readonly reviewWaiters;
157
+ /** Sessions whose review wait is reserved and still being prepared (`awaitReview`). */
158
+ private readonly reviewWaitsStarting;
149
159
  /**
150
160
  * The account's graph sync, so a graph saved on another machine is listed here too. A first pass that
151
161
  * outlasts the listing's bounded wait publishes `graphs.changed`: that listing already answered from
@@ -396,6 +406,27 @@ export declare class AppServer {
396
406
  private setExtensionEnabled;
397
407
  /** Preserve MCP credentials when toggling or deleting an existing entry. */
398
408
  private mutateMcp;
409
+ /**
410
+ * One configured MCP server as an edit form can show it: the command and its arguments, or the
411
+ * endpoint, and the *names* of its environment variables and headers. Their values are secrets
412
+ * the engine never returns; an edit keeps a saved value by naming it (see mergeMcpEdit). The
413
+ * endpoint is returned without its query string, which can hold a credential.
414
+ */
415
+ private mcpServerView;
416
+ /**
417
+ * Check one configured MCP server, on the person's explicit request ("Check Connection"): start
418
+ * it, ask for its tools, stop it, and record the answer beside the ones tasks record. A server that
419
+ * is turned off is reported off without being started. A stdio server starts in the workspace the
420
+ * caller names, as it would for a task there, or the home folder. A page never calls this on its
421
+ * own: a task asks before it connects a server, and opening Settings is not that consent.
422
+ */
423
+ private mcpStatus;
424
+ /**
425
+ * What each configured server last answered, without starting anything: the status a task's
426
+ * connection or an explicit check recorded, while it still describes the server's current
427
+ * definition. An edited server, and one never connected, has none ("Not checked").
428
+ */
429
+ private mcpStatuses;
399
430
  /**
400
431
  * Apply one provider change inside the serialized configuration transaction.
401
432
  *
@@ -1038,6 +1069,23 @@ export declare class AppServer {
1038
1069
  private updateSessionSkill;
1039
1070
  /** Say what a session is waiting on. An empty list is a real answer: it is what ends a wait. */
1040
1071
  private emitPullRequest;
1072
+ /**
1073
+ * Hold the calling run until its PR's next review: the comments the watcher finds are handed to it as the Auto-fix
1074
+ * prompt would be, instead of being armed as a wake. A wake already armed for comments it has not delivered is
1075
+ * taken at once. `origin` (the waiting node) becomes the node later Auto-fix wakes go to, since it owns the loop.
1076
+ */
1077
+ private awaitReview;
1078
+ /**
1079
+ * What the session's PR record says a review wait should end with, handed to `deliver`: the PR is gone, finished or
1080
+ * has Auto-fix off, or it holds comments found and not yet carried by a run. Those are taken under the lock, handed
1081
+ * over first and only then marked handled, so a wait that ended meanwhile never loses them. A wake this engine is
1082
+ * delivering now is left to that delivery.
1083
+ */
1084
+ private reviewWaitFromRecord;
1085
+ /** A run now carries the Auto-fix prompt behind `wakeId`: its comments are handled. */
1086
+ private recordAutoFixDelivered;
1087
+ /** The pending set as a change left it, without diffs: a client reads those with `sessions.changes.list`. */
1088
+ private emitSessionChanges;
1041
1089
  /**
1042
1090
  * Start tracking `ref` for the session. A PR already tracked under the same URL keeps its settings, so a
1043
1091
  * repeated `gh pr create` (which reports the existing PR) never switches off what the user turned on.
@@ -1055,7 +1103,8 @@ export declare class AppServer {
1055
1103
  /**
1056
1104
  * Hand an Auto-fix prompt to the session through the same wake a `set_timer` arms, under the selections the
1057
1105
  * session's PR was configured from: without them the continuation would run under whatever graph and model
1058
- * the configuration names today, with different tools than the work it is fixing.
1106
+ * the configuration names today, with different tools than the work it is fixing. `origin` addresses the prompt to
1107
+ * the graph node that switched Auto-fix on (`deliverDueTimers`), rather than to the graph's entry node.
1059
1108
  */
1060
1109
  private wakeForPullRequest;
1061
1110
  private emitTimers;
@@ -1087,6 +1136,15 @@ export declare class AppServer {
1087
1136
  * so the reason goes out with `timers.spent` - which a window shows as a notice - and into the log.
1088
1137
  */
1089
1138
  private spendWake;
1139
+ /**
1140
+ * Whether a wake is a `set_timer` reminder a graph node set about the work it was doing. Those belong to that work:
1141
+ * they are read by the node while its attempt runs, and spent once the node or the attempt is done with it.
1142
+ *
1143
+ * An Auto-fix wake also names a node (the one that switched Auto-fix on), but only as its address: review comments
1144
+ * are new work that outlives the attempt that turned Auto-fix on, so they are never spent with it and always wait
1145
+ * for the engine to be free (`deliverDueTimers`).
1146
+ */
1147
+ private nodeReminder;
1090
1148
  /**
1091
1149
  * Spend the session's node-armed wakes that belong to an attempt in `attempts` and satisfy `spent`.
1092
1150
  *