@andorra-labs/code 0.1.16 → 0.1.18

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 (236) hide show
  1. package/dist/src/acp-agent.d.ts +6 -0
  2. package/dist/src/acp-agent.js +15 -4
  3. package/dist/src/agent-execution.js +108 -19
  4. package/dist/src/agent-mcp-catalog.js +1 -0
  5. package/dist/src/agent-mcp.d.ts +3 -0
  6. package/dist/src/agent-mcp.js +33 -1
  7. package/dist/src/andorra/entry.d.ts +10 -0
  8. package/dist/src/andorra/entry.js +18 -4
  9. package/dist/src/andorra/errors.js +3 -0
  10. package/dist/src/andorra/hosted.d.ts +2 -1
  11. package/dist/src/andorra/hosted.js +2 -1
  12. package/dist/src/andorra/notices.d.ts +5 -0
  13. package/dist/src/andorra/notices.js +7 -0
  14. package/dist/src/andorra/state.d.ts +3 -2
  15. package/dist/src/andorra/state.js +4 -4
  16. package/dist/src/andorra/terminal.js +7 -2
  17. package/dist/src/anthropic-credentials.js +2 -0
  18. package/dist/src/app-server/error.d.ts +5 -0
  19. package/dist/src/app-server/error.js +7 -0
  20. package/dist/src/app-server/protocol.d.ts +30 -44
  21. package/dist/src/app-server/protocol.js +5 -1
  22. package/dist/src/app-server/workspace.d.ts +108 -0
  23. package/dist/src/app-server/workspace.js +608 -11
  24. package/dist/src/app-server.d.ts +390 -33
  25. package/dist/src/app-server.js +3033 -565
  26. package/dist/src/attachments.d.ts +10 -0
  27. package/dist/src/attachments.js +102 -7
  28. package/dist/src/automation-tool.js +2 -1
  29. package/dist/src/bridge/cloud.d.ts +27 -0
  30. package/dist/src/bridge/cloud.js +187 -0
  31. package/dist/src/bridge/command.d.ts +30 -0
  32. package/dist/src/bridge/command.js +359 -0
  33. package/dist/src/bridge/control.d.ts +70 -0
  34. package/dist/src/bridge/control.js +238 -0
  35. package/dist/src/bridge/engines.d.ts +90 -0
  36. package/dist/src/bridge/engines.js +601 -0
  37. package/dist/src/bridge/github.d.ts +108 -0
  38. package/dist/src/bridge/github.js +378 -0
  39. package/dist/src/bridge/host-ops.d.ts +9 -0
  40. package/dist/src/bridge/host-ops.js +139 -0
  41. package/dist/src/bridge/host.d.ts +47 -0
  42. package/dist/src/bridge/host.js +543 -0
  43. package/dist/src/bridge/link.d.ts +38 -0
  44. package/dist/src/bridge/link.js +508 -0
  45. package/dist/src/bridge/login-link.d.ts +29 -0
  46. package/dist/src/bridge/login-link.js +54 -0
  47. package/dist/src/bridge/protocol.d.ts +136 -0
  48. package/dist/src/bridge/protocol.js +11 -0
  49. package/dist/src/bridge/store.d.ts +12 -0
  50. package/dist/src/bridge/store.js +61 -0
  51. package/dist/src/bridge/wording.d.ts +6 -0
  52. package/dist/src/bridge/wording.js +10 -0
  53. package/dist/src/browser-server.js +7 -1
  54. package/dist/src/browser-ui/tokens.css +1 -1
  55. package/dist/src/bug-report-attachments.d.ts +48 -0
  56. package/dist/src/bug-report-attachments.js +327 -0
  57. package/dist/src/bug-report.d.ts +23 -3
  58. package/dist/src/bug-report.js +72 -9
  59. package/dist/src/change-authors.d.ts +41 -0
  60. package/dist/src/change-authors.js +146 -0
  61. package/dist/src/cli.d.ts +1 -3
  62. package/dist/src/cli.js +191 -35
  63. package/dist/src/codex-provider.js +1 -1
  64. package/dist/src/coding-tools.js +24 -17
  65. package/dist/src/command-screens.d.ts +6 -0
  66. package/dist/src/command-screens.js +14 -11
  67. package/dist/src/commands.d.ts +15 -3
  68. package/dist/src/commands.js +2 -1
  69. package/dist/src/compaction-phrases.js +1 -1
  70. package/dist/src/completion.js +89 -8
  71. package/dist/src/config.d.ts +71 -3
  72. package/dist/src/config.js +205 -78
  73. package/dist/src/context-budget.js +15 -2
  74. package/dist/src/deadline.js +13 -1
  75. package/dist/src/decision/DecisionEngine.d.ts +2 -0
  76. package/dist/src/decision/DecisionManager.d.ts +11 -0
  77. package/dist/src/decision/DecisionManager.js +36 -0
  78. package/dist/src/decision/applyTaskKind.d.ts +8 -0
  79. package/dist/src/decision/applyTaskKind.js +53 -0
  80. package/dist/src/decision/checks.js +1 -1
  81. package/dist/src/decision/hostedPolicy.js +2 -1
  82. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -0
  83. package/dist/src/decision/providers/AndorraDecisionProvider.js +12 -0
  84. package/dist/src/decision/requestPhrases.js +0 -1
  85. package/dist/src/decision/taskKind.d.ts +52 -0
  86. package/dist/src/decision/taskKind.js +76 -0
  87. package/dist/src/decision/types.d.ts +1 -1
  88. package/dist/src/default-graph.js +1 -1
  89. package/dist/src/efficiency.d.ts +5 -0
  90. package/dist/src/efficiency.js +5 -1
  91. package/dist/src/effort-routing.d.ts +27 -0
  92. package/dist/src/effort-routing.js +34 -0
  93. package/dist/src/evidence.d.ts +110 -0
  94. package/dist/src/evidence.js +195 -0
  95. package/dist/src/file-diff.d.ts +4 -0
  96. package/dist/src/file-diff.js +2 -1
  97. package/dist/src/github-app/agent-writes.d.ts +102 -0
  98. package/dist/src/github-app/agent-writes.js +320 -0
  99. package/dist/src/github-app/client.d.ts +368 -0
  100. package/dist/src/github-app/client.js +830 -0
  101. package/dist/src/github-app/event-source.d.ts +208 -0
  102. package/dist/src/github-app/event-source.js +684 -0
  103. package/dist/src/github-app/metrics.d.ts +32 -0
  104. package/dist/src/github-app/metrics.js +49 -0
  105. package/dist/src/github-app/review-loop.d.ts +274 -0
  106. package/dist/src/github-app/review-loop.js +1177 -0
  107. package/dist/src/github-app/review-node.d.ts +81 -0
  108. package/dist/src/github-app/review-node.js +205 -0
  109. package/dist/src/github-app/review-post.d.ts +73 -0
  110. package/dist/src/github-app/review-post.js +139 -0
  111. package/dist/src/github-app/review-text.d.ts +107 -0
  112. package/dist/src/github-app/review-text.js +1133 -0
  113. package/dist/src/github-app/review-threads.d.ts +47 -0
  114. package/dist/src/github-app/review-threads.js +107 -0
  115. package/dist/src/github-app/reviewer.d.ts +121 -0
  116. package/dist/src/github-app/reviewer.js +598 -0
  117. package/dist/src/github-app/store.d.ts +59 -0
  118. package/dist/src/github-app/store.js +148 -0
  119. package/dist/src/github-app/triggers.d.ts +141 -0
  120. package/dist/src/github-app/triggers.js +441 -0
  121. package/dist/src/github-names.d.ts +15 -0
  122. package/dist/src/github-names.js +15 -0
  123. package/dist/src/glob-search.d.ts +61 -0
  124. package/dist/src/glob-search.js +180 -0
  125. package/dist/src/graph-health.js +6 -1
  126. package/dist/src/graph-manager-chat.js +1 -1
  127. package/dist/src/graph-preview.d.ts +48 -0
  128. package/dist/src/graph-preview.js +56 -0
  129. package/dist/src/graph-provider-portability.js +2 -1
  130. package/dist/src/graph-runner.js +65 -4
  131. package/dist/src/graph-server.js +7 -5
  132. package/dist/src/graph-sync.js +3 -3
  133. package/dist/src/graph-ui/app.js +121 -7
  134. package/dist/src/graph-ui/icons.js +2 -1
  135. package/dist/src/graph-ui/studio.js +15 -1
  136. package/dist/src/graph-ui/tokens.css +1 -1
  137. package/dist/src/graphs.d.ts +40 -1
  138. package/dist/src/graphs.js +164 -15
  139. package/dist/src/hardened-runtime.js +32 -21
  140. package/dist/src/image-input.d.ts +16 -0
  141. package/dist/src/image-input.js +41 -0
  142. package/dist/src/membership.d.ts +10 -0
  143. package/dist/src/membership.js +19 -4
  144. package/dist/src/model-health-cache.js +1 -1
  145. package/dist/src/model-metadata.d.ts +6 -0
  146. package/dist/src/model-metadata.js +35 -15
  147. package/dist/src/model-override.d.ts +2 -1
  148. package/dist/src/model-override.js +9 -0
  149. package/dist/src/model-relay/local.d.ts +116 -0
  150. package/dist/src/model-relay/local.js +468 -0
  151. package/dist/src/model-relay/remote.d.ts +129 -0
  152. package/dist/src/model-relay/remote.js +252 -0
  153. package/dist/src/model-relay/runs.d.ts +34 -0
  154. package/dist/src/model-relay/runs.js +146 -0
  155. package/dist/src/model-relay/wire.d.ts +5 -0
  156. package/dist/src/model-relay/wire.js +5 -0
  157. package/dist/src/model-tiers.d.ts +3 -0
  158. package/dist/src/model-tiers.js +3 -3
  159. package/dist/src/project-registry.d.ts +21 -0
  160. package/dist/src/project-registry.js +74 -0
  161. package/dist/src/provider-engine.d.ts +13 -1
  162. package/dist/src/provider-engine.js +74 -0
  163. package/dist/src/provider-import.d.ts +0 -12
  164. package/dist/src/provider-import.js +7 -195
  165. package/dist/src/providers.d.ts +28 -2
  166. package/dist/src/providers.js +59 -12
  167. package/dist/src/pull-request-logs.d.ts +12 -1
  168. package/dist/src/pull-request-logs.js +14 -3
  169. package/dist/src/pull-requests.d.ts +338 -8
  170. package/dist/src/pull-requests.js +482 -53
  171. package/dist/src/react-runtime.js +99 -16
  172. package/dist/src/remote/engine-pool.d.ts +88 -4
  173. package/dist/src/remote/engine-pool.js +367 -90
  174. package/dist/src/remote/roots.d.ts +19 -0
  175. package/dist/src/remote/roots.js +45 -7
  176. package/dist/src/remote/types.d.ts +0 -44
  177. package/dist/src/run-control.d.ts +7 -0
  178. package/dist/src/run-control.js +23 -0
  179. package/dist/src/run-records.d.ts +7 -2
  180. package/dist/src/run-records.js +71 -6
  181. package/dist/src/runtime.d.ts +34 -2
  182. package/dist/src/runtime.js +18 -2
  183. package/dist/src/session-changes.d.ts +35 -0
  184. package/dist/src/session-changes.js +194 -6
  185. package/dist/src/session-monitor.js +2 -1
  186. package/dist/src/session-reaper.d.ts +1 -1
  187. package/dist/src/session-reaper.js +6 -1
  188. package/dist/src/session-summary.d.ts +2 -1
  189. package/dist/src/session-summary.js +2 -1
  190. package/dist/src/sessions.d.ts +35 -1
  191. package/dist/src/sessions.js +70 -4
  192. package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
  193. package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
  194. package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
  195. package/dist/src/skills/bundled/provenance.json +3 -3
  196. package/dist/src/skills/runtime-skills.js +1 -1
  197. package/dist/src/task-checkout.d.ts +141 -0
  198. package/dist/src/task-checkout.js +558 -0
  199. package/dist/src/telemetry/emitter.d.ts +15 -0
  200. package/dist/src/telemetry/emitter.js +35 -1
  201. package/dist/src/telemetry/schema.d.ts +25 -2
  202. package/dist/src/telemetry/schema.js +52 -4
  203. package/dist/src/telemetry/surface.d.ts +2 -1
  204. package/dist/src/telemetry/surface.js +4 -1
  205. package/dist/src/terminal-ui.d.ts +1 -0
  206. package/dist/src/terminal-ui.js +10 -3
  207. package/dist/src/test-edit-guard.d.ts +37 -0
  208. package/dist/src/test-edit-guard.js +216 -3
  209. package/dist/src/thinking-level-detect.d.ts +11 -0
  210. package/dist/src/thinking-level-detect.js +47 -0
  211. package/dist/src/thinking-levels.d.ts +30 -0
  212. package/dist/src/thinking-levels.js +124 -0
  213. package/dist/src/timers.d.ts +3 -0
  214. package/dist/src/tool-catalog.js +1 -1
  215. package/dist/src/tools.js +59 -9
  216. package/dist/src/transcript.js +1 -1
  217. package/dist/src/types.d.ts +34 -0
  218. package/package.json +6 -1
  219. package/dist/src/remote/cert.d.ts +0 -11
  220. package/dist/src/remote/cert.js +0 -87
  221. package/dist/src/remote/client.d.ts +0 -119
  222. package/dist/src/remote/client.js +0 -544
  223. package/dist/src/remote/command.d.ts +0 -4
  224. package/dist/src/remote/command.js +0 -194
  225. package/dist/src/remote/errors.d.ts +0 -11
  226. package/dist/src/remote/errors.js +0 -14
  227. package/dist/src/remote/network.d.ts +0 -22
  228. package/dist/src/remote/network.js +0 -102
  229. package/dist/src/remote/pairing.d.ts +0 -63
  230. package/dist/src/remote/pairing.js +0 -299
  231. package/dist/src/remote/pem.d.ts +0 -2
  232. package/dist/src/remote/pem.js +0 -7
  233. package/dist/src/remote/serve.d.ts +0 -68
  234. package/dist/src/remote/serve.js +0 -244
  235. package/dist/src/remote/server.d.ts +0 -21
  236. package/dist/src/remote/server.js +0 -406
@@ -0,0 +1,180 @@
1
+ import { spawn } from 'node:child_process';
2
+ import path from 'node:path';
3
+ import { StringDecoder } from 'node:string_decoder';
4
+ export const GLOB_LIST_LIMIT = 400_000;
5
+ export const GLOB_WALK_ENTRY_LIMIT = 200_000;
6
+ export const GLOB_TIME_MS = 20_000;
7
+ const MAGIC = /[*?[\]{}()!]/;
8
+ /**
9
+ * Splits a pattern into the directory its matches must lie in and the rest. `src/**\/*.ts` can only
10
+ * match under `src`, so the listing starts there instead of at the workspace root. A pattern with no
11
+ * slash matches a file name at any depth and has no such directory.
12
+ */
13
+ export function splitGlobPrefix(pattern) {
14
+ const normal = (process.platform === 'win32' ? pattern.replace(/\\/g, '/') : pattern).replace(/^(?:\.\/)+/, '');
15
+ if (!normal.includes('/'))
16
+ return { prefix: '', rest: normal, anyDepth: true };
17
+ const segments = normal.split('/');
18
+ let literal = 0;
19
+ while (literal < segments.length - 1 && !MAGIC.test(segments[literal]))
20
+ literal++;
21
+ const prefix = segments.slice(0, literal).join('/') || (normal.startsWith('/') && literal > 0 ? '/' : '');
22
+ return { prefix, rest: segments.slice(literal).join('/'), anyDepth: false };
23
+ }
24
+ function listWithRipgrep(rg, cwd, includeIgnored, accept, input) {
25
+ return new Promise((resolve, reject) => {
26
+ // NUL-separated output: a file name may hold a newline or end in a carriage return.
27
+ // --no-config: a filter in the user's own ripgrep configuration would hide files with no notice.
28
+ const args = [...(input.rgPrefix ?? []), '--no-config', '--files', '--null', '--hidden', '--no-require-git', '--sort', 'path', '--glob', '!.git', '--glob', '!node_modules', '--glob', '!.andorracode'];
29
+ if (includeIgnored)
30
+ args.push('--no-ignore');
31
+ const child = spawn(rg, args, { cwd, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
32
+ const decoder = new StringDecoder('utf8');
33
+ const listing = { matches: [], more: false };
34
+ let listed = 0, settled = false, stopped = false, pending = '';
35
+ const stop = () => { stopped = true; if (child.exitCode === null)
36
+ child.kill(); };
37
+ const timer = setTimeout(() => { listing.incomplete = `stopped after ${(input.timeMs ?? GLOB_TIME_MS) / 1000} seconds with ${listed.toLocaleString('en-US')} files listed`; stop(); }, input.timeMs ?? GLOB_TIME_MS);
38
+ const onAbort = () => stop();
39
+ input.signal.addEventListener('abort', onAbort, { once: true });
40
+ const finish = (run) => {
41
+ if (settled)
42
+ return;
43
+ settled = true;
44
+ clearTimeout(timer);
45
+ input.signal.removeEventListener('abort', onAbort);
46
+ run();
47
+ };
48
+ const take = (name) => {
49
+ if (stopped || !name)
50
+ return;
51
+ const relative = name.split(path.sep).join('/').replace(/^\.\//, '');
52
+ if (++listed > (input.listLimit ?? GLOB_LIST_LIMIT)) {
53
+ listing.incomplete = `stopped at the ${(input.listLimit ?? GLOB_LIST_LIMIT).toLocaleString('en-US')}-file listing limit`;
54
+ stop();
55
+ return;
56
+ }
57
+ if (!accept(relative) || (input.keep && !input.keep([relative], cwd).length))
58
+ return;
59
+ listing.matches.push(path.join(cwd, relative));
60
+ if (listing.matches.length >= input.limit) {
61
+ listing.more = true;
62
+ stop();
63
+ }
64
+ };
65
+ child.stdout.on('data', (chunk) => {
66
+ const parts = (pending + decoder.write(chunk)).split('\0');
67
+ pending = parts.pop() ?? '';
68
+ for (const part of parts)
69
+ take(part);
70
+ });
71
+ child.once('error', () => finish(() => resolve({ matches: [], more: false, failed: true })));
72
+ child.once('close', code => finish(() => {
73
+ if (input.signal.aborted) {
74
+ reject(input.signal.reason instanceof Error ? input.signal.reason : new Error('Operation aborted'));
75
+ return;
76
+ }
77
+ if (!stopped && code !== 0 && code !== 1) {
78
+ // Exit 2 covers a directory ripgrep could not read. Nothing listed means it did not run usefully;
79
+ // otherwise what it listed is good, but the part it skipped may hold the file.
80
+ if (!listed) {
81
+ resolve({ matches: [], more: false, failed: true });
82
+ return;
83
+ }
84
+ listing.incomplete ??= 'ripgrep could not read part of the directory tree';
85
+ }
86
+ resolve(listing);
87
+ }));
88
+ });
89
+ }
90
+ async function listWithWalk(cwd, accept, input) {
91
+ const listing = { matches: [], more: false };
92
+ const deadline = Date.now() + (input.timeMs ?? GLOB_TIME_MS);
93
+ const budget = { entries: 0, limit: GLOB_WALK_ENTRY_LIMIT };
94
+ try {
95
+ for await (const name of input.walk(cwd, budget)) {
96
+ input.signal.throwIfAborted();
97
+ if (Date.now() > deadline) {
98
+ listing.incomplete = `stopped after ${(input.timeMs ?? GLOB_TIME_MS) / 1000} seconds with ${budget.entries.toLocaleString('en-US')} entries scanned`;
99
+ break;
100
+ }
101
+ const relative = path.relative(cwd, name).split(path.sep).join('/');
102
+ if (!accept(relative))
103
+ continue;
104
+ listing.matches.push(name);
105
+ if (listing.matches.length >= input.limit) {
106
+ listing.more = true;
107
+ break;
108
+ }
109
+ }
110
+ }
111
+ catch (error) {
112
+ input.signal.throwIfAborted();
113
+ if (!(error instanceof Error) || !/^Directory scan limit reached/.test(error.message))
114
+ throw error;
115
+ listing.incomplete = `stopped at the ${GLOB_WALK_ENTRY_LIMIT.toLocaleString('en-US')}-entry directory scan limit`;
116
+ }
117
+ return listing;
118
+ }
119
+ /**
120
+ * Finds files by glob. The listing starts in the directory the pattern names, leaves out what ignore
121
+ * rules exclude, and falls back to ignored files when nothing else matches, so a miss means the file
122
+ * is absent rather than hidden. A listing that stops early returns what it found and says so.
123
+ */
124
+ export async function globSearch(input) {
125
+ input.signal.throwIfAborted();
126
+ const { prefix, rest, anyDepth } = splitGlobPrefix(input.pattern);
127
+ let cwd = input.root;
128
+ if (prefix) {
129
+ try {
130
+ cwd = await input.resolve(path.resolve(input.root, prefix));
131
+ }
132
+ catch (error) {
133
+ input.signal.throwIfAborted();
134
+ if (error?.code === 'ENOENT' || /ENOENT|no such file or directory/i.test(error instanceof Error ? error.message : '')) {
135
+ return { matches: [], more: false, ignoredOnly: false, searchedIgnored: true };
136
+ }
137
+ throw error;
138
+ }
139
+ }
140
+ const accept = (relative) => path.matchesGlob(relative, rest) || (anyDepth && path.matchesGlob(path.posix.basename(relative), rest));
141
+ if (input.rg) {
142
+ const tracked = await listWithRipgrep(input.rg, cwd, false, accept, input);
143
+ if (!tracked.failed) {
144
+ if (tracked.matches.length)
145
+ return { matches: tracked.matches, more: tracked.more, ...(tracked.incomplete ? { incomplete: tracked.incomplete } : {}), ignoredOnly: false, searchedIgnored: false };
146
+ const everything = await listWithRipgrep(input.rg, cwd, true, accept, input);
147
+ if (!everything.failed) {
148
+ const incomplete = everything.incomplete ?? tracked.incomplete;
149
+ return { matches: everything.matches, more: everything.more, ...(incomplete ? { incomplete } : {}), ignoredOnly: everything.matches.length > 0, searchedIgnored: true };
150
+ }
151
+ }
152
+ }
153
+ const walked = await listWithWalk(cwd, accept, input);
154
+ return { matches: walked.matches, more: walked.more, ...(walked.incomplete ? { incomplete: walked.incomplete } : {}), ignoredOnly: false, searchedIgnored: true };
155
+ }
156
+ /** The text a model reads for a search: paths relative to root, then what it must know about their coverage. */
157
+ export function formatGlobResult(result, root, limit) {
158
+ const shown = result.matches.map(match => path.relative(root, match).split(path.sep).join('/') || path.basename(match));
159
+ const notices = [];
160
+ if (result.more)
161
+ notices.push(`[${limit} results limit reached: raise head_limit or narrow the pattern]`);
162
+ if (result.ignoredOnly)
163
+ notices.push('[Only ignored files match: nothing else in the search matched, so these come from paths that .gitignore or similar rules exclude.]');
164
+ if (result.incomplete)
165
+ notices.push(`[INCOMPLETE SEARCH: ${result.incomplete}. Files that were not listed may match, so this result does not show that the file is absent. Narrow it with path, or start the pattern with a directory.]`);
166
+ const body = shown.length ? shown.join('\n')
167
+ : result.incomplete ? 'No files found in the part that was listed before the search stopped.'
168
+ : `No files found matching pattern${result.searchedIgnored ? '' : ' outside ignored paths'}`;
169
+ return notices.length ? `${body}\n\n${notices.join('\n')}` : body;
170
+ }
171
+ /**
172
+ * The matches of a search for a caller that can only show a plain list of paths. Such a caller has nowhere to
173
+ * say that the listing stopped early, so an unfinished search fails, carrying what was found, instead of
174
+ * passing for a complete answer.
175
+ */
176
+ export function completeGlobMatches(result, root, limit) {
177
+ if (result.incomplete)
178
+ throw new Error(formatGlobResult(result, root, limit));
179
+ return result.matches;
180
+ }
@@ -115,6 +115,11 @@ export async function checkGraphModelHealth(graph, config, signal, dependencies
115
115
  failures[index] = { ...reference, reason: 'Provider is not configured.' };
116
116
  continue;
117
117
  }
118
+ // A relayed model is on the desktop: no probe is sent there, and its first real request shows its health.
119
+ if (provider.type === 'relayed') {
120
+ answered[index] = true;
121
+ continue;
122
+ }
118
123
  if (provider.type === 'andorra') {
119
124
  // The client has the router's fresh answer (or asks it once now): no model request is sent to learn it again.
120
125
  const known = await Promise.resolve(dependencies.andorra?.()).catch(() => undefined);
@@ -218,7 +223,7 @@ export async function checkSessionModelHealth(config, signal, dependencies = {})
218
223
  const model = provider?.model ?? '(default model)';
219
224
  if (!provider)
220
225
  return { healthy: false, failures: [{ provider: config.provider, model, nodes, reason: 'Provider is not configured.' }] };
221
- if (dependencies.verified?.has(provider, model))
226
+ if (provider.type === 'relayed' || dependencies.verified?.has(provider, model))
222
227
  return { healthy: true, failures: [] };
223
228
  const timeoutMs = dependencies.timeoutMs ?? 30_000;
224
229
  // Andorra is asked once, by the probe: its refusals are sentences a model listing would not carry.
@@ -114,7 +114,7 @@ const GRAPH_ACTION_VERBS = {
114
114
  andorra_graph_node_upsert: 'Set step', andorra_graph_node_patch: 'Edit step', andorra_graph_node_remove: 'Remove step',
115
115
  andorra_graph_edge_upsert: 'Connect', andorra_graph_edge_remove: 'Remove connection', andorra_graph_patch: 'Edit graph',
116
116
  andorra_graph_validate: 'Validate draft', andorra_graph_publish: 'Save version', andorra_graph_discard: 'Discard draft',
117
- andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph',
117
+ andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph', andorra_graph_show: 'Show graph',
118
118
  };
119
119
  export function managerToolParts(name, value, openGraphId) {
120
120
  const args = toolArguments(value);
@@ -0,0 +1,48 @@
1
+ import { type Graph, type GraphNode } from './graphs.js';
2
+ /**
3
+ * What the desktop app needs to draw a graph in a chat reply the way the Graph Editor draws it: each step's
4
+ * card (name, kind, model line, outcome ports, position) and each route. Instructions, schemas and every other
5
+ * setting stay out, so the preview stays small enough to travel in a tool reply.
6
+ */
7
+ export interface GraphPreviewNode {
8
+ name: string;
9
+ type: GraphNode['type'];
10
+ agentRole?: 'orchestrator';
11
+ provider?: string;
12
+ model?: string;
13
+ /** The step's own thinking level, when it sets one: a level, or 'auto' for Jev to pick. */
14
+ reasoningEffort?: string;
15
+ /** Omitted when it is exactly ['completed'], the usual single port, to keep large previews small. */
16
+ outcomes?: string[];
17
+ /** An Action's kind, which names it on its card (Run command, Run tests, Git operation). */
18
+ action?: 'command' | 'tests' | 'git';
19
+ position?: {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ }
24
+ export interface GraphPreview {
25
+ id: string;
26
+ name: string;
27
+ /** 'draft' for an unpublished draft, otherwise the published revision shown. */
28
+ revision: number | 'draft';
29
+ /** A soft-deleted graph's revision, shown read-only. */
30
+ deleted?: true;
31
+ entry: string;
32
+ nodes: Record<string, GraphPreviewNode>;
33
+ edges: {
34
+ source: string;
35
+ outcome: string;
36
+ target: string;
37
+ }[];
38
+ }
39
+ /** The ports a step's card shows, as the editor lists them (src/graph-ui/app.js `outcomes`): an Action always shows its failed port. */
40
+ export declare function previewOutcomes(node: GraphNode): string[];
41
+ /**
42
+ * `modelOf` names a provider's default model; called with undefined for a step that names no provider, it answers
43
+ * for the active one, as the editor's card does (app.js `nodeModelLabel`). A step's own provider is kept only when
44
+ * no model could be named, since the card shows one or the other.
45
+ */
46
+ export declare function graphPreview(graph: Graph, revision: number | 'draft', modelOf?: (provider: string | undefined) => string | undefined): GraphPreview;
47
+ /** The same graph as plain text, for a host that cannot draw it: one line per route, the entry first. */
48
+ export declare function graphSketch(preview: GraphPreview): string;
@@ -0,0 +1,56 @@
1
+ import { nodeOutcomes, optionalOutcomes } from './graphs.js';
2
+ /** The ports a step's card shows, as the editor lists them (src/graph-ui/app.js `outcomes`): an Action always shows its failed port. */
3
+ export function previewOutcomes(node) {
4
+ const outcomes = nodeOutcomes(node);
5
+ return [...outcomes, ...optionalOutcomes(node).filter(outcome => !outcomes.includes(outcome))];
6
+ }
7
+ /**
8
+ * `modelOf` names a provider's default model; called with undefined for a step that names no provider, it answers
9
+ * for the active one, as the editor's card does (app.js `nodeModelLabel`). A step's own provider is kept only when
10
+ * no model could be named, since the card shows one or the other.
11
+ */
12
+ export function graphPreview(graph, revision, modelOf = () => undefined) {
13
+ const nodes = {};
14
+ for (const [id, node] of Object.entries(graph.nodes)) {
15
+ const model = node.type === 'agent' ? node.model ?? modelOf(node.provider) : undefined;
16
+ const outcomes = previewOutcomes(node);
17
+ nodes[id] = {
18
+ name: node.name || id,
19
+ type: node.type,
20
+ ...(node.agentRole === 'orchestrator' ? { agentRole: 'orchestrator' } : {}),
21
+ ...(node.type === 'agent' && node.provider && !model ? { provider: node.provider } : {}),
22
+ ...(model ? { model } : {}),
23
+ ...(node.type === 'agent' && node.reasoningEffort ? { reasoningEffort: node.reasoningEffort } : {}),
24
+ ...(outcomes.length === 1 && outcomes[0] === 'completed' ? {} : { outcomes }),
25
+ ...(node.type === 'action' && node.action?.kind ? { action: node.action.kind } : {}),
26
+ ...(node.position && Number.isFinite(node.position.x) && Number.isFinite(node.position.y) ? { position: { x: node.position.x, y: node.position.y } } : {}),
27
+ };
28
+ }
29
+ return {
30
+ id: graph.id, name: graph.name, revision, entry: graph.entry, nodes,
31
+ edges: graph.edges.filter(edge => Object.hasOwn(nodes, edge.source) && Object.hasOwn(nodes, edge.target))
32
+ .map(edge => ({ source: edge.source, outcome: edge.outcome ?? 'completed', target: edge.target })),
33
+ };
34
+ }
35
+ /** The same graph as plain text, for a host that cannot draw it: one line per route, the entry first. */
36
+ export function graphSketch(preview) {
37
+ const label = (id) => {
38
+ const node = preview.nodes[id];
39
+ if (!node)
40
+ return id;
41
+ const kind = node.agentRole === 'orchestrator' ? 'orchestrator' : node.type;
42
+ const detail = node.model ?? node.provider;
43
+ return `${id} (${kind}${detail ? `, ${detail}` : ''})`;
44
+ };
45
+ const order = [preview.entry, ...Object.keys(preview.nodes).filter(id => id !== preview.entry)];
46
+ const lines = [`${preview.name} (${preview.id}, ${preview.revision === 'draft' ? 'draft' : `revision ${preview.revision}`}${preview.deleted ? ', deleted' : ''}), starts at ${preview.entry || '(no entry)'}`];
47
+ for (const id of order) {
48
+ for (const edge of preview.edges.filter(item => item.source === id))
49
+ lines.push(`${label(edge.source)} --${edge.outcome}--> ${label(edge.target)}`);
50
+ }
51
+ const routed = new Set(preview.edges.flatMap(edge => [edge.source, edge.target]));
52
+ for (const id of order)
53
+ if (!routed.has(id))
54
+ lines.push(`${label(id)} (no routes)`);
55
+ return lines.join('\n');
56
+ }
@@ -136,7 +136,8 @@ export function bindPortableGraphProviders(graph, config) {
136
136
  const explicitModels = [...required.models];
137
137
  const requiredModels = original && required.inheritsRecordedModel ? [...explicitModels, original.model] : explicitModels;
138
138
  const offers = (provider, models) => models.every(model => providerModelId(provider, model) !== undefined);
139
- const sameType = (provider) => !original || provider.type === original.type;
139
+ // A relayed provider is the desktop's own entry under its own id, whatever type the desktop saved it as.
140
+ const sameType = (provider) => !original || provider.type === 'relayed' || provider.type === original.type;
140
141
  const exact = findProviderById(config.providers, originalId);
141
142
  let resolved = exact && sameType(exact) && offers(exact, explicitModels) ? exact : undefined;
142
143
  const exactResolved = resolved !== undefined;
@@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
4
4
  import { TodoStore } from './todos.js';
5
5
  import { WidgetStore } from './widgets.js';
6
6
  import { isDeepStrictEqual } from 'node:util';
7
- import { validateGraph, nodeOutcomes, maxNodeVisitsOf, ACTION_FAILED_OUTCOME } from './graphs.js';
7
+ import { validateGraph, nodeOutcomes, maxNodeVisitsOf, ACTION_FAILED_OUTCOME, isolatedGraph } from './graphs.js';
8
8
  import { CommandExitError } from './tool-errors.js';
9
9
  import { executeModifiedAgent, matchesOutput } from './agent-modifiers.js';
10
10
  import { GOAL_NEEDS_AGENT, graphCanCheckGoal } from './session-goal.js';
@@ -27,6 +27,7 @@ import { toolBoundaryOpen } from './run-progress.js';
27
27
  import { createRunTelemetry, mergeRunTelemetry, recordAttempt, recordErrorOnce, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
28
28
  import { ProviderRequestError, runFailureCode } from './providers.js';
29
29
  import { isTestCommandLine } from './telemetry/classify.js';
30
+ import { reviewNodeUnavailable } from './github-app/review-node.js';
30
31
  function absorbTelemetry(result, outcome) {
31
32
  // Every branch's errors are kept; why the run stopped is taken from the one outcome it ends on (endOn).
32
33
  if (outcome.telemetry)
@@ -62,7 +63,24 @@ function mergeInputs(target, incoming, nodeId) {
62
63
  target[key] = value;
63
64
  }
64
65
  }
66
+ /**
67
+ * The options of an isolated graph's run (the review loop's reviewer): its output is posted publicly, so none of the
68
+ * person's private context reaches it, whatever the surface that started it passed in. Gone are the persistent, command
69
+ * and project memories (with their distillation and tools), the project and user instructions and the skill catalog,
70
+ * the skills a session carries, the session history, CodeGraph and Jev. The efficiency settings fall back to their
71
+ * defaults too, so the reviewer gets exactly its own tools and the model the loop chose.
72
+ */
73
+ async function isolatedRunOptions(options) {
74
+ const { memory: _memory, commandMemory: _commandMemory, projectMemory: _projectMemory, instructions: _instructions, skillInvocationInstruction: _skillInstruction, history: _history, codeIntel: _codeIntel, decisionPreflight: _preflight, goalCompletionVerification: _goal, efficiency: _efficiency, ...rest } = options;
75
+ return {
76
+ ...rest, inheritedSkills: [], entryHistory: false, decisionNodeOptIn: true,
77
+ decisionManager: new DecisionManager({ config: { mode: 'off', provider: 'none' } }),
78
+ memory: await MemoryManager.create({ config: { enabled: false }, workspace: options.context.workspace, onEvent: options.onEvent }),
79
+ };
80
+ }
65
81
  export async function runGraph(graph, options) {
82
+ if (isolatedGraph(graph.id))
83
+ options = await isolatedRunOptions(options);
66
84
  if (options.goalCompletionVerification && !graphCanCheckGoal(graph))
67
85
  throw new Error(GOAL_NEEDS_AGENT);
68
86
  const removedMemorySettings = [];
@@ -534,7 +552,7 @@ export async function runGraph(graph, options) {
534
552
  ...options,
535
553
  ...(activation.routedModel ? { modelPinned: true } : {}),
536
554
  adapter: instrument(options.provider, { model: options.model, adapter: options.adapter }).adapter,
537
- ...(options.resolveModel ? { resolveModel: async (provider, model, signal) => instrument(provider, await options.resolveModel(provider, model, signal)) } : {}),
555
+ ...(options.resolveModel ? { resolveModel: async (provider, model, signal, reasoningEffort) => instrument(provider, await options.resolveModel(provider, model, signal, reasoningEffort)) } : {}),
538
556
  ...(options.getLiveModel ? { getLiveModel: async (id, provider, model, signal) => {
539
557
  const live = await options.getLiveModel(id, provider, model, signal);
540
558
  return live ? { ...instrument(live.provider, live), provider: live.provider } : undefined;
@@ -930,13 +948,49 @@ export async function runGraph(graph, options) {
930
948
  if (!interrupted && !exitFailure)
931
949
  await emit('node.tool.completed', { nodeId, name: shellName, toolCallId, durationMs, output });
932
950
  }
951
+ else if (node.type === 'review') {
952
+ // An Andorra review round: the service runs it on the task's PR (src/github-app/review-node.ts). A run without one,
953
+ // such as a preview, leaves through `stopped`.
954
+ const reviewSignal = context.runControl ? AbortSignal.any([signal, context.runControl.signal]) : signal;
955
+ const answer = options.reviewNode
956
+ ? await options.reviewNode.round({
957
+ nodeId, name: node.name, settings: node.review, signal: reviewSignal,
958
+ approve: async (question) => {
959
+ if (context.runControl?.yolo ?? context.yolo)
960
+ return true;
961
+ if (context.approvalMode === 'headless')
962
+ return false;
963
+ for (;;) {
964
+ await context.runControl?.wait(signal);
965
+ const promptSignal = context.runControl ? AbortSignal.any([context.userSignal ?? signal, context.runControl.signal]) : context.userSignal ?? signal;
966
+ try {
967
+ const answer = await context.approve('graph.review', { nodeId, name: node.name, question }, promptSignal);
968
+ if (answer === 'policy-changed')
969
+ continue;
970
+ if (promptSignal.aborted && !signal.aborted)
971
+ continue;
972
+ return answer === true;
973
+ }
974
+ catch (error) {
975
+ if (!promptSignal.aborted || signal.aborted)
976
+ throw error;
977
+ }
978
+ }
979
+ },
980
+ emit: (type, data) => emit(type, { nodeId, ...data }),
981
+ })
982
+ : reviewNodeUnavailable(node.review);
983
+ signal.throwIfAborted();
984
+ completion = { ...completion, outcome: answer.outcome, output: { ...answer.output }, summary: answer.summary };
985
+ }
933
986
  else if (node.type === 'parallel' || node.type === 'join')
934
987
  completion.output = activation.inputs;
935
988
  if (nodeOutputSchema(node))
936
989
  validateValue(nodeOutputSchema(node), completion.output, `Node ${nodeId} output`);
937
990
  signal.throwIfAborted();
938
991
  result.nodeResults[nodeId] = completion;
939
- if (node.type !== 'end')
992
+ // A review node's line is not the run's answer: the engineer's summary and tests stay the run's.
993
+ if (node.type !== 'end' && node.type !== 'review')
940
994
  lastCompletion = completion;
941
995
  if (!prefetchedCompleted.has(activation))
942
996
  await emit('graph.node.completed', { nodeId, completion });
@@ -958,8 +1012,15 @@ export async function runGraph(graph, options) {
958
1012
  continue;
959
1013
  const inputs = resolveMapping(edge.inputMapping, { source: completion, run: { input: runInput, state: runState, loop: { iteration: count } } }, target.inputSchema);
960
1014
  const incoming = { ...(node.modifiers?.parallel?.mode === 'branches' ? { parallelGroup: `${nodeId}:${activation.generation}:${count}`, concurrency: node.modifiers.parallel.maxConcurrent } : {}), nodeId: edge.target, generation, path, inputs, source: completion, predecessors: { [nodeId]: completion } };
961
- if (node.type === 'agent' && target.type === 'agent' && node.contextPolicy?.conversation !== 'isolate')
1015
+ if (node.type === 'agent' && (target.type === 'agent' || target.type === 'review') && node.contextPolicy?.conversation !== 'isolate') {
962
1016
  incoming.conversation = conversations.get(activation);
1017
+ if (target.type === 'review')
1018
+ incoming.conversationOwner = nodeId;
1019
+ }
1020
+ // The fixer a review node hands its findings to continues its own context: the conversation goes back only to the
1021
+ // agent it came from (that agent's own isolate policy still wins where it runs).
1022
+ if (node.type === 'review' && target.type === 'agent' && activation.conversation !== undefined && activation.conversationOwner === edge.target)
1023
+ incoming.conversation = activation.conversation;
963
1024
  if (target.type === 'join' && target.join?.mode !== 'any' && !edge.bootstrap) {
964
1025
  const pending = pendingJoins.get(targetKey) ?? new Map();
965
1026
  pending.set(edgeIndex, incoming);
@@ -6,12 +6,12 @@ import { execFile } from 'node:child_process';
6
6
  import { changeConfigFile, configDirectory, loadConfig, validateConfig } from './config.js';
7
7
  import { stampGraphProviderProfiles } from './graph-provider-portability.js';
8
8
  import { resetDeletedGraphSelection } from './graph-selection.js';
9
- import { listGraphs, loadGraph, saveGraphOrder, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, GRAPH_MANAGER_GRAPH_ID, reservedGraphId } from './graphs.js';
9
+ import { listGraphs, loadGraph, saveGraphOrder, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, isReservedGraphId, reservedGraphId } from './graphs.js';
10
10
  import { createTools } from './tools.js';
11
11
  import { AutomationStore } from './automations.js';
12
12
  import { deleteAgentDefinition, exportAgentDefinition, importAgentDefinition, listAgentDefinitions, readAgentDefinition, saveAgentDefinition, validateAgentDefinition } from './agent-definitions.js';
13
13
  import { discoverModelMetadata, resolveModelContext } from './model-metadata.js';
14
- import { MODEL_LISTING_TIMEOUT_MS, providerLabel, providerModels, recordProviderModel } from './providers.js';
14
+ import { MODEL_LISTING_TIMEOUT_MS, providerLabel, providerModels, recordProviderModel, supportsReasoningEffort } from './providers.js';
15
15
  import { PaidMembershipRequiredError, readGraphMembership } from './membership.js';
16
16
  import { getGraphMembership } from './membership.js';
17
17
  import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_NODE_LIMIT, FreeTierLimitError, notePremiumGraphAccount, readGraphQuota, saveFreeTierGraph, savePremiumGraph } from './graph-quota.js';
@@ -186,7 +186,9 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
186
186
  res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
187
187
  res.end(JSON.stringify(value));
188
188
  };
189
- const providerRegistryPayload = (providers) => providers.map(provider => ({ id: provider.id, model: provider.model, models: provider.models, type: provider.type, baseUrl: provider.baseUrl, label: providerLabel(provider, providers) }));
189
+ const providerRegistryPayload = (providers) => providers.map(provider => ({ id: provider.id, model: provider.model, models: provider.models, type: provider.type, baseUrl: provider.baseUrl, label: providerLabel(provider, providers),
190
+ // The editor offers a node only the thinking levels its model has enabled on this machine.
191
+ thinksAtLevels: supportsReasoningEffort(provider.type), ...(provider.thinkingLevels ? { thinkingLevels: provider.thinkingLevels } : {}) }));
190
192
  const liveEditorState = async () => {
191
193
  const [{ pid: _pid, ...status }, config] = await Promise.all([readActivity(directory), editorConfig(directory)]);
192
194
  return {
@@ -504,7 +506,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
504
506
  reply(res, 400, { error: 'The bundled default graph cannot be deleted.' });
505
507
  return;
506
508
  }
507
- if (id === GRAPH_MANAGER_GRAPH_ID) {
509
+ if (isReservedGraphId(id)) {
508
510
  reply(res, 400, { error: reservedGraphId(id).message });
509
511
  return;
510
512
  }
@@ -631,7 +633,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
631
633
  } };
632
634
  }
633
635
  export async function deleteGraphWithTombstone(id, graphDirectory, directory, subject, sync) {
634
- if (id === GRAPH_MANAGER_GRAPH_ID)
636
+ if (isReservedGraphId(id))
635
637
  throw reservedGraphId(id);
636
638
  const users = (await new AutomationStore(directory).list()).filter(job => job.execution?.graph === id);
637
639
  if (users.length)
@@ -4,7 +4,7 @@ import { setTimeout as delay } from 'node:timers/promises';
4
4
  import { join, relative } from 'node:path';
5
5
  import { AUTH_REFRESH_BUDGET_MS, getAccessToken, getAuthConfiguration, getAuthStatus } from './auth/index.js';
6
6
  import { decodeJwt } from 'jose';
7
- import { GRAPH_MANAGER_GRAPH_ID, GraphConflictError, reservedGraphId, restoreGraphRevision, validateGraph } from './graphs.js';
7
+ import { GraphConflictError, isReservedGraphId, reservedGraphId, restoreGraphRevision, validateGraph } from './graphs.js';
8
8
  import { acquireSaveLock, removeLockedFolder, SaveLockBusyError } from './save-lock.js';
9
9
  import { readGraphQuota } from './graph-quota.js';
10
10
  const MAX_BYTES = 600 * 1024;
@@ -307,7 +307,7 @@ export class GraphSync {
307
307
  async forgetGraph(id) {
308
308
  if (!safeId(id) || id === 'default')
309
309
  throw new Error('Invalid graph id');
310
- if (id === GRAPH_MANAGER_GRAPH_ID)
310
+ if (isReservedGraphId(id))
311
311
  throw reservedGraphId(id);
312
312
  await mkdir(this.folder, { recursive: true });
313
313
  const folder = join(this.directory, 'graphs', id);
@@ -383,7 +383,7 @@ export class GraphSync {
383
383
  this.lastDraft.delete(id);
384
384
  }
385
385
  async reviveGraph(id) {
386
- if (!safeId(id) || id === 'default' || id === GRAPH_MANAGER_GRAPH_ID)
386
+ if (!safeId(id) || id === 'default' || isReservedGraphId(id))
387
387
  return;
388
388
  await this.updateDeletionState((deleted, _floors, pending) => {
389
389
  const changed = deleted.delete(id) || Object.hasOwn(pending, id);