@andorra-labs/code 0.1.18 → 0.1.19

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 (277) hide show
  1. package/dist/src/account-jev-savings.d.ts +4 -0
  2. package/dist/src/account-jev-savings.js +92 -0
  3. package/dist/src/acp-agent.js +2 -2
  4. package/dist/src/agent-execution.js +347 -45
  5. package/dist/src/agent-mcp.js +7 -1
  6. package/dist/src/agent-modifiers.js +5 -7
  7. package/dist/src/analytics.d.ts +19 -1
  8. package/dist/src/analytics.js +9 -1
  9. package/dist/src/andorra/entry.js +15 -6
  10. package/dist/src/andorra/hosted.d.ts +8 -0
  11. package/dist/src/andorra/hosted.js +22 -3
  12. package/dist/src/andorra/streams.d.ts +49 -0
  13. package/dist/src/andorra/streams.js +98 -0
  14. package/dist/src/antigravity-acp.d.ts +28 -0
  15. package/dist/src/antigravity-acp.js +150 -0
  16. package/dist/src/antigravity-terminal.d.ts +2 -0
  17. package/dist/src/antigravity-terminal.js +214 -0
  18. package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
  19. package/dist/src/app-server/adaptive-routing-settings.js +69 -0
  20. package/dist/src/app-server/artifact.d.ts +14 -0
  21. package/dist/src/app-server/artifact.js +46 -0
  22. package/dist/src/app-server/legal-protocol.d.ts +33 -0
  23. package/dist/src/app-server/legal-protocol.js +16 -0
  24. package/dist/src/app-server/protocol.d.ts +23 -3
  25. package/dist/src/app-server/protocol.js +3 -1
  26. package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
  27. package/dist/src/app-server/telemetry-protocol.js +2 -0
  28. package/dist/src/app-server/telemetry.d.ts +38 -0
  29. package/dist/src/app-server/telemetry.js +163 -0
  30. package/dist/src/app-server/workspace.d.ts +3 -1
  31. package/dist/src/app-server/workspace.js +39 -8
  32. package/dist/src/app-server.d.ts +50 -25
  33. package/dist/src/app-server.js +1008 -400
  34. package/dist/src/auth/AuthManager.d.ts +11 -2
  35. package/dist/src/auth/AuthManager.js +56 -13
  36. package/dist/src/auth/index.d.ts +5 -1
  37. package/dist/src/auth/index.js +8 -1
  38. package/dist/src/auth/lifecycle.d.ts +13 -0
  39. package/dist/src/auth/lifecycle.js +109 -0
  40. package/dist/src/auth/store.d.ts +1 -0
  41. package/dist/src/auth/store.js +12 -0
  42. package/dist/src/auth/types.d.ts +12 -0
  43. package/dist/src/automation-runner.js +2 -0
  44. package/dist/src/automation-service.js +7 -2
  45. package/dist/src/benchmark-scores.d.ts +88 -0
  46. package/dist/src/benchmark-scores.js +302 -0
  47. package/dist/src/bridge/command.js +4 -1
  48. package/dist/src/bridge/control.js +2 -1
  49. package/dist/src/bridge/engines.d.ts +2 -0
  50. package/dist/src/bridge/engines.js +9 -0
  51. package/dist/src/bridge/host-ops.d.ts +2 -2
  52. package/dist/src/bridge/host-ops.js +4 -2
  53. package/dist/src/bridge/host.d.ts +2 -0
  54. package/dist/src/bridge/host.js +63 -12
  55. package/dist/src/bridge/protocol.d.ts +1 -0
  56. package/dist/src/bridge/protocol.js +1 -0
  57. package/dist/src/browser-panel-tool.d.ts +12 -0
  58. package/dist/src/browser-panel-tool.js +30 -3
  59. package/dist/src/browser-runner.js +53 -62
  60. package/dist/src/browser-server.js +10 -4
  61. package/dist/src/browser-session.d.ts +14 -0
  62. package/dist/src/browser-session.js +57 -12
  63. package/dist/src/browser-view.d.ts +40 -1
  64. package/dist/src/browser-view.js +163 -9
  65. package/dist/src/browser-window-style.d.ts +27 -0
  66. package/dist/src/browser-window-style.js +244 -0
  67. package/dist/src/claude-provider.d.ts +1 -0
  68. package/dist/src/claude-provider.js +77 -36
  69. package/dist/src/cli.js +235 -58
  70. package/dist/src/codex-provider.d.ts +1 -0
  71. package/dist/src/codex-provider.js +43 -7
  72. package/dist/src/coding-tools.d.ts +1 -0
  73. package/dist/src/coding-tools.js +19 -5
  74. package/dist/src/command-screens.d.ts +1 -1
  75. package/dist/src/command-screens.js +2 -2
  76. package/dist/src/commands.d.ts +8 -1
  77. package/dist/src/commands.js +67 -63
  78. package/dist/src/completion.js +5 -3
  79. package/dist/src/config.d.ts +14 -3
  80. package/dist/src/config.js +54 -16
  81. package/dist/src/context-budget.d.ts +11 -2
  82. package/dist/src/context-budget.js +23 -2
  83. package/dist/src/context-compaction.d.ts +10 -8
  84. package/dist/src/context-compaction.js +23 -24
  85. package/dist/src/deadline.js +1 -1
  86. package/dist/src/decision/DecisionManager.d.ts +5 -0
  87. package/dist/src/decision/DecisionManager.js +39 -2
  88. package/dist/src/decision/applyToolMenu.js +6 -2
  89. package/dist/src/decision/hostedPolicy.js +6 -4
  90. package/dist/src/decision/optimizationPolicy.d.ts +10 -0
  91. package/dist/src/decision/optimizationPolicy.js +23 -3
  92. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -1
  93. package/dist/src/decision/providers/AndorraDecisionProvider.js +17 -7
  94. package/dist/src/decision/providers/index.js +1 -1
  95. package/dist/src/decision/toolFamilies.js +1 -1
  96. package/dist/src/decision/types.d.ts +2 -0
  97. package/dist/src/efficiency.d.ts +75 -1
  98. package/dist/src/efficiency.js +114 -3
  99. package/dist/src/extensions.d.ts +2 -0
  100. package/dist/src/extensions.js +30 -20
  101. package/dist/src/github-app/agent-writes.d.ts +1 -1
  102. package/dist/src/github-app/agent-writes.js +1 -1
  103. package/dist/src/github-app/event-source.d.ts +0 -5
  104. package/dist/src/github-app/event-source.js +1 -31
  105. package/dist/src/github-app/metrics.d.ts +2 -5
  106. package/dist/src/github-app/metrics.js +2 -14
  107. package/dist/src/github-app/review-loop.d.ts +5 -5
  108. package/dist/src/github-app/review-loop.js +1 -1
  109. package/dist/src/github-app/review-node.d.ts +2 -2
  110. package/dist/src/github-app/triggers.d.ts +3 -3
  111. package/dist/src/glob-search.d.ts +1 -0
  112. package/dist/src/glob-search.js +3 -0
  113. package/dist/src/google-provider.d.ts +5 -28
  114. package/dist/src/google-provider.js +6 -141
  115. package/dist/src/graph-editor-session.d.ts +1 -0
  116. package/dist/src/graph-editor-session.js +2 -0
  117. package/dist/src/graph-health.js +3 -1
  118. package/dist/src/graph-runner.js +19 -13
  119. package/dist/src/graph-selection.d.ts +3 -1
  120. package/dist/src/graph-selection.js +2 -2
  121. package/dist/src/graph-server.d.ts +8 -1
  122. package/dist/src/graph-server.js +45 -10
  123. package/dist/src/graph-sync.d.ts +2 -1
  124. package/dist/src/graph-sync.js +13 -0
  125. package/dist/src/graph-ui/app.js +19 -8
  126. package/dist/src/graph-ui/index.html +1 -1
  127. package/dist/src/graphs.d.ts +17 -1
  128. package/dist/src/graphs.js +51 -5
  129. package/dist/src/grok-provider.js +17 -14
  130. package/dist/src/hardened-runtime.js +7 -4
  131. package/dist/src/jev-savings.d.ts +4 -0
  132. package/dist/src/jev-savings.js +13 -0
  133. package/dist/src/legal/client.d.ts +25 -0
  134. package/dist/src/legal/client.js +47 -0
  135. package/dist/src/legal/command.d.ts +13 -0
  136. package/dist/src/legal/command.js +98 -0
  137. package/dist/src/legal/documents.d.ts +2 -0
  138. package/dist/src/legal/documents.js +14 -0
  139. package/dist/src/legal/gate.d.ts +13 -0
  140. package/dist/src/legal/gate.js +96 -0
  141. package/dist/src/legal/manifest.d.ts +21 -0
  142. package/dist/src/legal/manifest.js +23 -0
  143. package/dist/src/legal/receipt.d.ts +13 -0
  144. package/dist/src/legal/receipt.js +137 -0
  145. package/dist/src/legal/release.d.ts +27 -0
  146. package/dist/src/legal/release.js +28 -0
  147. package/dist/src/managed-sign-in.d.ts +0 -1
  148. package/dist/src/managed-sign-in.js +0 -13
  149. package/dist/src/membership.d.ts +27 -1
  150. package/dist/src/membership.js +139 -7
  151. package/dist/src/model-metadata.js +3 -7
  152. package/dist/src/model-pool.d.ts +99 -0
  153. package/dist/src/model-pool.js +136 -0
  154. package/dist/src/model-relay/local.js +5 -0
  155. package/dist/src/model-relay/remote.d.ts +2 -0
  156. package/dist/src/model-relay/remote.js +4 -0
  157. package/dist/src/model-tiers.d.ts +13 -1
  158. package/dist/src/model-tiers.js +28 -4
  159. package/dist/src/opencode-cli-provider.js +59 -56
  160. package/dist/src/opencode-provider.js +16 -13
  161. package/dist/src/permissions.d.ts +5 -0
  162. package/dist/src/permissions.js +7 -0
  163. package/dist/src/plan-pass.js +2 -1
  164. package/dist/src/pool-scores.d.ts +45 -0
  165. package/dist/src/pool-scores.js +40 -0
  166. package/dist/src/provider-connection.js +3 -17
  167. package/dist/src/provider-engine.js +42 -12
  168. package/dist/src/provider-request-error.d.ts +8 -0
  169. package/dist/src/provider-request-error.js +12 -0
  170. package/dist/src/provider-settings.d.ts +1 -1
  171. package/dist/src/provider-settings.js +36 -18
  172. package/dist/src/provider-turn-deadline.d.ts +39 -0
  173. package/dist/src/provider-turn-deadline.js +139 -0
  174. package/dist/src/providers.d.ts +3 -9
  175. package/dist/src/providers.js +181 -146
  176. package/dist/src/pull-request-merge.d.ts +1 -8
  177. package/dist/src/pull-request-merge.js +0 -4
  178. package/dist/src/pull-requests.d.ts +82 -66
  179. package/dist/src/pull-requests.js +266 -276
  180. package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
  181. package/dist/src/qa/runtime/ProcessManager.js +9 -3
  182. package/dist/src/react-runtime.js +147 -56
  183. package/dist/src/reasoning-probe-cloud.d.ts +10 -0
  184. package/dist/src/reasoning-probe-cloud.js +209 -0
  185. package/dist/src/remote/engine-pool.d.ts +3 -0
  186. package/dist/src/remote/engine-pool.js +85 -18
  187. package/dist/src/remote/recovery.d.ts +6 -0
  188. package/dist/src/remote/recovery.js +37 -0
  189. package/dist/src/run-records.d.ts +13 -3
  190. package/dist/src/run-records.js +59 -34
  191. package/dist/src/runtime.d.ts +18 -1
  192. package/dist/src/runtime.js +25 -7
  193. package/dist/src/session-summary.d.ts +8 -0
  194. package/dist/src/session-summary.js +34 -0
  195. package/dist/src/sessions.d.ts +8 -0
  196. package/dist/src/sessions.js +12 -3
  197. package/dist/src/shell.js +6 -0
  198. package/dist/src/side-panel.js +36 -2
  199. package/dist/src/sign-in-detection.d.ts +1 -1
  200. package/dist/src/sign-in-detection.js +4 -10
  201. package/dist/src/sign-in-offer.js +1 -1
  202. package/dist/src/skill-commands.js +1 -1
  203. package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
  204. package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
  205. package/dist/src/skills/bundled/provenance.json +2 -2
  206. package/dist/src/subagent-run.js +50 -50
  207. package/dist/src/subscription-usage.d.ts +50 -0
  208. package/dist/src/subscription-usage.js +92 -0
  209. package/dist/src/task-checkout.d.ts +20 -4
  210. package/dist/src/task-checkout.js +78 -8
  211. package/dist/src/telemetry/access.d.ts +18 -0
  212. package/dist/src/telemetry/access.js +43 -0
  213. package/dist/src/telemetry/aggregate.d.ts +18 -2
  214. package/dist/src/telemetry/aggregate.js +22 -9
  215. package/dist/src/telemetry/capture-core.d.ts +33 -14
  216. package/dist/src/telemetry/capture-core.js +124 -25
  217. package/dist/src/telemetry/capture.d.ts +3 -2
  218. package/dist/src/telemetry/capture.js +21 -1
  219. package/dist/src/telemetry/decision-capture.js +4 -0
  220. package/dist/src/telemetry/emitter.d.ts +6 -7
  221. package/dist/src/telemetry/emitter.js +124 -29
  222. package/dist/src/telemetry/gate.d.ts +41 -2
  223. package/dist/src/telemetry/gate.js +89 -4
  224. package/dist/src/telemetry/home.d.ts +1 -0
  225. package/dist/src/telemetry/home.js +20 -0
  226. package/dist/src/telemetry/identity.d.ts +6 -3
  227. package/dist/src/telemetry/identity.js +19 -6
  228. package/dist/src/telemetry/lifecycle.d.ts +8 -0
  229. package/dist/src/telemetry/lifecycle.js +76 -0
  230. package/dist/src/telemetry/outbox.d.ts +13 -8
  231. package/dist/src/telemetry/outbox.js +68 -12
  232. package/dist/src/telemetry/permission-command.d.ts +38 -0
  233. package/dist/src/telemetry/permission-command.js +208 -0
  234. package/dist/src/telemetry/permission.d.ts +168 -0
  235. package/dist/src/telemetry/permission.js +662 -0
  236. package/dist/src/telemetry/record-installation.d.ts +1 -0
  237. package/dist/src/telemetry/record-installation.js +9 -0
  238. package/dist/src/telemetry/region-data.d.ts +12 -0
  239. package/dist/src/telemetry/region-data.js +1314 -0
  240. package/dist/src/telemetry/region.d.ts +34 -0
  241. package/dist/src/telemetry/region.js +87 -0
  242. package/dist/src/telemetry/run-privacy.d.ts +11 -0
  243. package/dist/src/telemetry/run-privacy.js +165 -0
  244. package/dist/src/telemetry/schema.d.ts +27 -6
  245. package/dist/src/telemetry/schema.js +109 -14
  246. package/dist/src/telemetry/state.d.ts +11 -7
  247. package/dist/src/telemetry/state.js +39 -6
  248. package/dist/src/telemetry/surface.d.ts +20 -3
  249. package/dist/src/telemetry/surface.js +71 -15
  250. package/dist/src/telemetry/uploader.d.ts +6 -11
  251. package/dist/src/telemetry/uploader.js +72 -46
  252. package/dist/src/telemetry/uploads.d.ts +5 -1
  253. package/dist/src/telemetry/uploads.js +25 -6
  254. package/dist/src/telemetry/version.d.ts +5 -0
  255. package/dist/src/telemetry/version.js +34 -0
  256. package/dist/src/telemetry/workspace.d.ts +4 -1
  257. package/dist/src/telemetry/workspace.js +18 -3
  258. package/dist/src/terminal-ui.d.ts +3 -0
  259. package/dist/src/terminal-ui.js +48 -6
  260. package/dist/src/thinking-level-detect.d.ts +3 -1
  261. package/dist/src/thinking-level-detect.js +8 -3
  262. package/dist/src/thinking-levels.d.ts +1 -1
  263. package/dist/src/thinking-levels.js +11 -4
  264. package/dist/src/timers.d.ts +2 -0
  265. package/dist/src/todos.d.ts +2 -1
  266. package/dist/src/todos.js +24 -4
  267. package/dist/src/tool-argument-coercion.d.ts +7 -0
  268. package/dist/src/tool-argument-coercion.js +49 -0
  269. package/dist/src/tool-catalog.d.ts +2 -2
  270. package/dist/src/tools.js +67 -22
  271. package/dist/src/transcript.js +2 -1
  272. package/dist/src/types.d.ts +14 -1
  273. package/dist/src/update.js +4 -0
  274. package/dist/src/usage-analytics.d.ts +7 -0
  275. package/dist/src/usage-analytics.js +85 -13
  276. package/dist/telemetry-consent-v1 +1 -0
  277. package/package.json +97 -96
@@ -6,6 +6,9 @@ import { configDirectory } from './config.js';
6
6
  import { writeSessionSnapshot } from './sessions.js';
7
7
  import { ToolFailureTracker } from './tool-failure-tracker.js';
8
8
  import { stopReasonPhrase } from './runtime.js';
9
+ import { withTelemetryAdmission, currentTelemetryAdmission, telemetryLeaseSnapshot } from './telemetry/permission.js';
10
+ import { functionalRunRecord, admittedRunRecord, withRunRecordProjection, withRunFileLock } from './telemetry/run-privacy.js';
11
+ export { scrubRuns, functionalRunRecord } from './telemetry/run-privacy.js';
9
12
  export function runRecordsDirectory(directory = configDirectory()) {
10
13
  return join(directory, 'runs');
11
14
  }
@@ -48,12 +51,23 @@ export async function removeOpenRunRecord(directory, runId) {
48
51
  if (removed)
49
52
  await clearOpenRunClaim(directory, runId);
50
53
  }
51
- export async function writeOpenRunRecord(directory, record) {
54
+ async function writeOpenRunRecordAdmitted(directory, record) {
52
55
  await mkdir(runRecordsDirectory(directory), { recursive: true, mode: 0o700 });
53
56
  await writeOpenRunClaim(directory, { runId: record.id, sessionId: record.sessionId, pid: record.pid });
54
57
  await writeSessionSnapshot(runRecordPath(directory, record.id, 'json'), JSON.stringify(record, null, 2) + '\n');
55
58
  await writeStudioRunSummary(directory, record).catch(() => { });
56
59
  }
60
+ /** Public persistence boundary; blocked/stale writers can save only functional data. */
61
+ export async function writeOpenRunRecord(directory, record, access) {
62
+ await withRunFileLock(directory, runRecordPath(directory, record.id, 'json'), () => withRunRecordProjection(directory, record, projected => writeOpenRunRecordAdmitted(directory, projected), access));
63
+ }
64
+ /** Phase C finalizers must use this instead of raw writeFile/writeSessionSnapshot. */
65
+ export async function writeFinalRunRecord(directory, record, access) {
66
+ await withRunFileLock(directory, runRecordPath(directory, record.id, 'json'), () => withRunRecordProjection(directory, record, async (projected) => {
67
+ await mkdir(runRecordsDirectory(directory), { recursive: true, mode: 0o700 });
68
+ await writeSessionSnapshot(runRecordPath(directory, record.id, 'json'), JSON.stringify(projected, null, 2) + '\n');
69
+ }, access));
70
+ }
57
71
  export function isPidAlive(pid) {
58
72
  if (!Number.isSafeInteger(pid) || pid < 1)
59
73
  return false;
@@ -133,7 +147,8 @@ async function scanFiles(paths, pick, concurrency = 32) {
133
147
  }
134
148
  export async function reconcileInterruptedRuns(directory, onlyRunIds, options) {
135
149
  const recovery = { runs: [], markers: 0, live: [], interrupted: [] };
136
- const swept = await markOpenRunsInterrupted(directory, onlyRunIds, options?.skipOwnProcess === true, options?.includePending === true);
150
+ const sweep = () => markOpenRunsInterrupted(directory, onlyRunIds, options?.skipOwnProcess === true, options?.includePending === true);
151
+ const swept = await sweep(); // functional recovery must never wait for analytics/network admission
137
152
  recovery.runs = swept.ids;
138
153
  recovery.live = swept.live;
139
154
  recovery.interrupted = swept.records;
@@ -159,6 +174,10 @@ async function claimedByThisProcess(directory, runId) {
159
174
  }
160
175
  }
161
176
  async function markOpenRunsInterrupted(directory, onlyRunIds, skipOwnProcess = false, includePending = false) {
177
+ const project = (value) => {
178
+ const lease = telemetryLeaseSnapshot({ home: directory });
179
+ return lease ? admittedRunRecord(value, lease) : functionalRunRecord(value);
180
+ };
162
181
  const runs = runRecordsDirectory(directory);
163
182
  let names;
164
183
  try {
@@ -181,7 +200,7 @@ async function markOpenRunsInterrupted(directory, onlyRunIds, skipOwnProcess = f
181
200
  continue;
182
201
  let value;
183
202
  try {
184
- value = JSON.parse(text);
203
+ value = project(JSON.parse(text));
185
204
  }
186
205
  catch {
187
206
  continue;
@@ -220,28 +239,23 @@ async function markOpenRunsInterrupted(directory, onlyRunIds, skipOwnProcess = f
220
239
  await release();
221
240
  await rm(lockDirectory, { recursive: true, force: true }).catch(() => { });
222
241
  };
223
- let current;
224
- try {
225
- current = JSON.parse(await readFile(path, 'utf8'));
226
- }
227
- catch {
228
- await unlock();
229
- continue;
230
- }
231
- if (!current || typeof current !== 'object' || current.status !== 'running') {
232
- await unlock();
233
- continue;
234
- }
235
- const measured = plainObject(current.usage) ? undefined : await journalRunUsage(directory, runId);
236
- const interrupted = { ...current, status: 'interrupted', telemetryPending: true, reason: 'the engine stopped while this run was active', endedAt: new Date().toISOString(), ...(measured === undefined ? {} : { usage: measured }) };
242
+ let interrupted;
237
243
  try {
238
- await writeSessionSnapshot(path, JSON.stringify(interrupted, null, 2) + '\n');
239
- }
240
- catch {
241
- await unlock();
242
- continue;
244
+ interrupted = await withRunFileLock(directory, path, async () => {
245
+ const current = project(JSON.parse(await readFile(path, 'utf8')));
246
+ if (!current || typeof current !== 'object' || current.status !== 'running')
247
+ return undefined;
248
+ // Privacy cleanup and functional recovery serialize on this file, even while reporting is off.
249
+ const measured = plainObject(current.usage) ? undefined : await journalRunUsage(directory, runId);
250
+ const updated = { ...current, status: 'interrupted', ...(current.telemetry ? { telemetryPending: true } : {}), reason: 'the engine stopped while this run was active', endedAt: new Date().toISOString(), ...(measured === undefined ? {} : { usage: measured }) };
251
+ await writeSessionSnapshot(path, JSON.stringify(updated, null, 2) + '\n');
252
+ return updated;
253
+ });
243
254
  }
255
+ catch { /* A failed functional rewrite is retried by a later recovery. */ }
244
256
  await unlock();
257
+ if (!interrupted)
258
+ continue;
245
259
  const crash = await rememberCrashedClaim(directory, {
246
260
  runId, sessionId: value.sessionId, claimedAt: value.startedAt,
247
261
  });
@@ -742,7 +756,7 @@ function foldRecordUsage(session, usage) {
742
756
  }
743
757
  async function readRunRecord(directory, runId) {
744
758
  try {
745
- return JSON.parse(await readFile(runRecordPath(directory, runId, 'json'), 'utf8'));
759
+ return functionalRunRecord(JSON.parse(await readFile(runRecordPath(directory, runId, 'json'), 'utf8')));
746
760
  }
747
761
  catch {
748
762
  return undefined;
@@ -1084,9 +1098,11 @@ function runCheckpointPath(directory, runId, nodeId) {
1084
1098
  }
1085
1099
  return `${runRecordPath(directory, runId, 'checkpoint')}.${slug}-${(hash >>> 0).toString(36)}`;
1086
1100
  }
1087
- export async function writeRunCheckpoint(directory, runId, checkpoint) {
1088
- await mkdir(runRecordsDirectory(directory), { recursive: true, mode: 0o700 });
1089
- await writeSessionSnapshot(runCheckpointPath(directory, runId, checkpoint.nodeId), JSON.stringify(checkpoint) + '\n');
1101
+ export async function writeRunCheckpoint(directory, runId, checkpoint, access) {
1102
+ await withRunFileLock(directory, runCheckpointPath(directory, runId, checkpoint.nodeId), () => withRunRecordProjection(directory, checkpoint, async (projected) => {
1103
+ await mkdir(runRecordsDirectory(directory), { recursive: true, mode: 0o700 });
1104
+ await writeSessionSnapshot(runCheckpointPath(directory, runId, checkpoint.nodeId), JSON.stringify(projected) + '\n');
1105
+ }, access, true));
1090
1106
  }
1091
1107
  export async function readRunCheckpoint(directory, runId, nodeId) {
1092
1108
  let raw;
@@ -1134,7 +1150,8 @@ function reviveFailures(state) {
1134
1150
  const CHECKPOINT_MESSAGE_ROLES = new Set(['system', 'user', 'assistant', 'tool']);
1135
1151
  function parseRunCheckpoint(raw) {
1136
1152
  try {
1137
- const value = JSON.parse(raw);
1153
+ const parsed = JSON.parse(raw);
1154
+ const value = parsed && functionalRunRecord(parsed, true);
1138
1155
  if (!value || typeof value.nodeId !== 'string' || !Array.isArray(value.messages)
1139
1156
  || typeof value.state !== 'object' || value.state === null
1140
1157
  || typeof value.state.directionRevision !== 'number'
@@ -1374,16 +1391,24 @@ export async function acquireSessionMutationLock(directory, sessionId, options =
1374
1391
  finish();
1375
1392
  };
1376
1393
  }
1377
- export async function clearInterruptedTelemetry(directory, runIds) {
1394
+ async function clearInterruptedTelemetryAdmitted(directory, runIds) {
1378
1395
  for (const runId of runIds) {
1379
1396
  const path = runRecordPath(directory, runId, 'json');
1380
1397
  try {
1381
- const value = JSON.parse(await readFile(path, 'utf8'));
1382
- if (value.status !== 'interrupted' || value.telemetryPending !== true)
1383
- continue;
1384
- delete value.telemetryPending;
1385
- await writeSessionSnapshot(path, JSON.stringify(value, null, 2) + '\n');
1398
+ await withRunFileLock(directory, path, async () => {
1399
+ const admission = currentTelemetryAdmission();
1400
+ if (!admission)
1401
+ return;
1402
+ const value = admittedRunRecord(JSON.parse(await readFile(path, 'utf8')), admission.lease);
1403
+ if (value.status !== 'interrupted' || value.telemetryPending !== true)
1404
+ return;
1405
+ delete value.telemetryPending;
1406
+ await writeSessionSnapshot(path, JSON.stringify(value, null, 2) + '\n');
1407
+ });
1386
1408
  }
1387
- catch { }
1409
+ catch { /* A record that cannot be rewritten is reported again next time; the id is stable. */ }
1388
1410
  }
1389
1411
  }
1412
+ export async function clearInterruptedTelemetry(directory, runIds, access) {
1413
+ await withTelemetryAdmission({ home: directory, signals: access?.signals }, () => clearInterruptedTelemetryAdmitted(directory, runIds), access?.lease);
1414
+ }
@@ -9,6 +9,7 @@ import { type Limits } from './limits.js';
9
9
  import type { DecisionManager } from './decision/DecisionManager.js';
10
10
  import type { DecisionBatch } from './decision/types.js';
11
11
  import type { TaskKind } from './decision/taskKind.js';
12
+ import type { JevOutputBaseline } from './context-budget.js';
12
13
  export declare const DEFAULT_GRAPH: Readonly<{
13
14
  id: "default";
14
15
  name: "Andorra Agent";
@@ -139,6 +140,8 @@ export declare function turnModelTask(turn: {
139
140
  }[];
140
141
  }): string;
141
142
  export interface RunOptions {
143
+ /** Product capture start authority. false/absent in protected mode stays off for the whole run. */
144
+ telemetry?: import('./telemetry/capture.js').TelemetryCaptureInput | false;
142
145
  goalCompletionVerification?: import('./goal-completion-verification.js').GoalCompletionVerificationOptions;
143
146
  decisionManager?: DecisionManager;
144
147
  decisionHints?: DecisionBatch;
@@ -146,16 +149,25 @@ export interface RunOptions {
146
149
  efficiency?: import('./efficiency.js').EfficiencyConfig;
147
150
  attachments?: ResolvedAttachments;
148
151
  recoverTools?: Tool[];
152
+ /** Schemas Jev removed and prompt text it added to enable the routing. */
153
+ jevToolRouting?: {
154
+ omittedTools: readonly Tool[];
155
+ promptAdditions: readonly string[];
156
+ };
157
+ jevOutputBaseline?: JevOutputBaseline;
149
158
  /** `sessionModel` marks a live model that is the run's own selection, as opposed to one node's override. */
150
- getLiveModel?: (nodeId: string | undefined, provider: string, model: string, signal: AbortSignal) => Promise<(ResolvedGraphModel & {
159
+ getLiveModel?: (nodeId: string | undefined, provider: string, model: string, signal: AbortSignal, appliedRevision?: number, hints?: DecisionBatch) => Promise<(ResolvedGraphModel & {
151
160
  provider: string;
152
161
  sessionModel?: boolean;
162
+ selectionRevision?: number;
153
163
  }) | undefined>;
154
164
  task: string;
155
165
  model: string;
156
166
  provider: string;
157
167
  adapter: ModelAdapter;
158
168
  tools: Tool[];
169
+ /** Automatically retrieved reference text, separate from the task and confirmed user requirements. */
170
+ optionalContext?: Partial<Record<NonNullable<Message['optionalContext']>, string>>;
159
171
  contextWindow?: number;
160
172
  context: ToolContext;
161
173
  limits?: Partial<Limits>;
@@ -265,7 +277,12 @@ export interface GraphRunOptions extends RunOptions {
265
277
  id: string;
266
278
  model?: string;
267
279
  models?: readonly string[];
280
+ type?: string;
268
281
  }[];
282
+ /** Reads the account's Andorra stream limit for the `currentAndorraStreams` tool; the router is asked when absent. */
283
+ andorraHostedCheck?: (signal?: AbortSignal) => Promise<import('./andorra/hosted.js').HostedCheck>;
284
+ /** Subscription usage by provider id, for pool routing. Absent, failing or silent on a provider: no known limit. */
285
+ quotaReadings?: (signal: AbortSignal) => Promise<import('./model-pool.js').QuotaReadings | undefined>;
269
286
  workspaceFacts?: import('./workspace-facts.js').WorkspaceFacts;
270
287
  skillInvocationInstruction?: string;
271
288
  suspendMemoryBudget?: () => () => void;
@@ -1,6 +1,6 @@
1
1
  import { attachmentReferenceBlock } from './attachments.js';
2
2
  import { advertiseAvailableTools } from './tool-availability.js';
3
- import { createRunTelemetry, recordErrorOnce, recordModelUse, recordRunError } from './telemetry/capture.js';
3
+ import { bindRunTelemetry, createRunTelemetry, resolveTelemetryCapture, recordErrorOnce, recordModelUse, recordRunError } from './telemetry/capture.js';
4
4
  import { runFailureCode } from './providers.js';
5
5
  import { pricingFor } from './model-tiers.js';
6
6
  import { bucketEndpoint } from './telemetry/schema.js';
@@ -56,6 +56,11 @@ export function turnModelTask(turn) {
56
56
  return turn.attachments?.length ? `${withSteers}\n\n${attachmentReferenceBlock(turn.attachments, { imagesIncluded: false })}` : withSteers;
57
57
  }
58
58
  export async function generateWithUsage(options, result, request) {
59
+ const captureInput = resolveTelemetryCapture(options.telemetry);
60
+ const ensureCapture = () => {
61
+ if (!result.telemetry && captureInput)
62
+ bindRunTelemetry(result, createRunTelemetry(captureInput));
63
+ };
59
64
  let recordedRequests = 0;
60
65
  const localModel = bucketEndpoint(options.telemetryIdentity?.baseUrl) === 'local';
61
66
  const origin = request.context?.invocationId || localModel ? {
@@ -82,7 +87,8 @@ export async function generateWithUsage(options, result, request) {
82
87
  };
83
88
  // Every model request of the run goes through here (agent turns, compaction summaries, auxiliary calls), so this is
84
89
  // where an error the provider recovered from is recorded: before the retry or resend, never only on failure.
85
- const recordError = (code) => { recordRunError(result.telemetry ??= createRunTelemetry(), code ?? 'provider_error'); };
90
+ const recordError = (code) => { ensureCapture(); if (result.telemetry)
91
+ recordRunError(result.telemetry, code ?? 'provider_error'); };
86
92
  const response = await options.adapter.generate({ ...request, onRequest: () => {
87
93
  recordedRequests++;
88
94
  add({ inputTokens: 0, outputTokens: 0, requests: 1 });
@@ -90,22 +96,34 @@ export async function generateWithUsage(options, result, request) {
90
96
  onRecoveredError: code => { recordError(code); request.onRecoveredError?.(code); } }).catch(error => {
91
97
  // The failed request is recorded here, before a caller recovers from it (a verifier's failed verdict, a distiller's
92
98
  // fallback, a compaction or image retry). Handlers further up reuse this record instead of counting it again.
93
- if (!request.signal.aborted)
94
- recordErrorOnce(result.telemetry ??= createRunTelemetry(), error, runFailureCode(error));
99
+ if (!request.signal.aborted) {
100
+ ensureCapture();
101
+ if (result.telemetry)
102
+ recordErrorOnce(result.telemetry, error, runFailureCode(error));
103
+ }
95
104
  if (recordedRequests > 0) {
96
- result.telemetry ??= createRunTelemetry();
105
+ ensureCapture();
97
106
  recordModelUse(result.telemetry, { ...identity, usage: { requests: recordedRequests } });
98
107
  }
99
108
  add({ inputTokens: 0, outputTokens: 0, requests: 0 }, true);
100
109
  throw error;
101
110
  });
111
+ options.jevOutputBaseline?.observe(request.context?.providerId ?? options.provider, request.model, response.usage);
102
112
  add({ inputTokens: response.usage?.inputTokens ?? 0, outputTokens: response.usage?.outputTokens ?? 0,
103
113
  ...(response.usage?.cacheRead === undefined ? {} : { cacheRead: response.usage.cacheRead }),
104
114
  ...(response.usage?.cacheWrite === undefined ? {} : { cacheWrite: response.usage.cacheWrite }),
105
115
  ...(response.usage?.decodeMs === undefined ? {} : { decodeMs: response.usage.decodeMs }),
106
116
  requests: Math.max(0, (response.usage?.requests ?? 1) - recordedRequests) }, true);
107
- result.telemetry ??= createRunTelemetry();
108
- recordModelUse(result.telemetry, { ...identity, usage: response.usage ?? {},
117
+ ensureCapture();
118
+ const attributed = response.servedModel !== undefined || response.authMode !== undefined;
119
+ const requests = Math.max(recordedRequests, response.usage?.requests ?? 1);
120
+ const priorRequests = attributed ? Math.max(0, requests - 1) : 0;
121
+ if (priorRequests)
122
+ recordModelUse(result.telemetry, { ...identity, usage: { requests: priorRequests } });
123
+ const reportedUsage = response.reportedUsage ?? response.usage;
124
+ // The adapters that attach attribution parse usage from the final accepted response, independently of retries.
125
+ recordModelUse(result.telemetry, { ...identity, servedModel: response.servedModel, authMode: response.authMode,
126
+ usage: { ...reportedUsage, requests: attributed ? 1 : requests },
109
127
  ...(options.efficiency?.adaptiveRouting?.pricing ? { pricing: pricingFor(options.efficiency.adaptiveRouting, request.context?.providerId ?? '', request.model) } : {}) });
110
128
  return response;
111
129
  }
@@ -5,4 +5,12 @@ export declare const titleRequestSupported: (provider: Pick<ProviderConfig, "typ
5
5
  export declare const SESSION_SUMMARY_TIMEOUT_MS = 120000;
6
6
  export declare const MAX_SESSION_TITLE_CHARS = 80;
7
7
  export declare function summarizeSessionPrompt(prompt: string, adapter: ModelAdapter, model: string, signal?: AbortSignal): Promise<string>;
8
+ /** The most words a branch name keeps: a task summed up in a few words, not a whole sentence. */
9
+ export declare const MAX_BRANCH_WORDS = 6;
10
+ /**
11
+ * A branch name the model offered, made a safe slug: lower case, at most 6 words, hyphen-chained
12
+ * (`fix-login-redirect-loop`). Nothing usable yields an empty string, so the caller keeps the name it started under.
13
+ */
14
+ export declare function branchFromSummary(text: string): string;
15
+ export declare function summarizeTaskBranch(prompt: string, adapter: ModelAdapter, model: string, signal?: AbortSignal): Promise<string>;
8
16
  export declare function titleFromSummary(text: string): string;
@@ -19,6 +19,40 @@ export async function summarizeSessionPrompt(prompt, adapter, model, signal) {
19
19
  });
20
20
  return titleFromSummary(redactSecrets(response.text));
21
21
  }
22
+ /** The most words a branch name keeps: a task summed up in a few words, not a whole sentence. */
23
+ export const MAX_BRANCH_WORDS = 6;
24
+ const MAX_BRANCH_NAME_CHARS = 40;
25
+ /**
26
+ * A branch name the model offered, made a safe slug: lower case, at most 6 words, hyphen-chained
27
+ * (`fix-login-redirect-loop`). Nothing usable yields an empty string, so the caller keeps the name it started under.
28
+ */
29
+ export function branchFromSummary(text) {
30
+ const firstLine = stripVTControlCharacters(text)
31
+ .replace(/[\x00-\x09\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g, ' ')
32
+ .split('\n').map(line => line.trim()).find(Boolean) ?? '';
33
+ // A model that echoes its own label ("Branch name: fix the loop") keeps the label's words out of the name.
34
+ const bare = firstLine
35
+ .replace(/^[\s>#*_]+/g, '')
36
+ .replace(/^(?:branch name|branch|name)\s*(?:[::]\s*|[\u2014\u2013]\s*|-\s+)[\s*_]*/i, '');
37
+ const words = bare.toLowerCase().normalize('NFKD').replace(/[̀-ͯ]/g, '')
38
+ .replace(/[^a-z0-9]+/g, '-').replace(/^-+/, '').replace(/-+$/, '')
39
+ .split('-').filter(Boolean).slice(0, MAX_BRANCH_WORDS);
40
+ return words.join('-').slice(0, MAX_BRANCH_NAME_CHARS).replace(/-+$/, '');
41
+ }
42
+ export async function summarizeTaskBranch(prompt, adapter, model, signal) {
43
+ const clean = stripVTControlCharacters(prompt).trim();
44
+ if (!clean)
45
+ return '';
46
+ const bounded = signal ? AbortSignal.any([signal, AbortSignal.timeout(SESSION_SUMMARY_TIMEOUT_MS)]) : AbortSignal.timeout(SESSION_SUMMARY_TIMEOUT_MS);
47
+ const response = await adapter.generate({
48
+ model, signal: bounded, tools: [], maxTokens: 512,
49
+ messages: [
50
+ { role: 'system', content: 'You name coding sessions. Answer with a Git branch name only: 5 to 6 lowercase words that sum up what the task does, chained together with hyphens (fix-login-redirect-loop). Lowercase, words joined by hyphens, no spaces, no slashes, no underscores, no other punctuation, no preamble, no quotes. Never include a password, API key, token, or other credential.' },
51
+ { role: 'user', content: `A coding task starts with this prompt. Give it its branch name.\n\n${redactSecrets(clean).slice(0, MAX_PROMPT_CHARS)}` },
52
+ ],
53
+ });
54
+ return branchFromSummary(redactSecrets(response.text));
55
+ }
22
56
  export function titleFromSummary(text) {
23
57
  const firstLine = stripVTControlCharacters(text)
24
58
  .replace(/[\x00-\x09\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g, ' ')
@@ -2,7 +2,11 @@ import type { ConversationTurn } from './commands.js';
2
2
  import { type SessionGoal } from './session-goal.js';
3
3
  import { type SessionCheckout } from './task-checkout.js';
4
4
  import type { Usage } from './types.js';
5
+ /** The most a session's `placeholder` may hold (`validSavedSession`); a prompt-derived name must fit it, too. */
6
+ export declare const MAX_SESSION_NAME_CHARS = 64;
5
7
  export declare const sessionName: (prompt: string) => string;
8
+ /** A random 8-character name (`a92x9dwe`): what a hidden subagent run still starts under. */
9
+ export declare const randomSessionName: () => string;
6
10
  export interface SavedWidget {
7
11
  id: string;
8
12
  name: string;
@@ -24,6 +28,8 @@ export interface SavedSession {
24
28
  usage: Usage;
25
29
  contextHistory?: ConversationTurn[];
26
30
  parentId?: string;
31
+ /** Rail-only link to the chat that proposed this fresh session; never a source of inherited context or usage. */
32
+ handoffParentId?: string;
27
33
  trajectoryId?: string;
28
34
  inheritedUsage?: Usage;
29
35
  ancestors?: string[];
@@ -40,6 +46,8 @@ export interface SavedSession {
40
46
  /** Pinned by the user to the top of its project in the rail. Archiving clears it, and auto-archive leaves a pinned session alone. */
41
47
  pinned?: boolean;
42
48
  renamed?: boolean;
49
+ /** The name the task started under — its prompt's first words — so a delayed title knows the name a real title may replace. */
50
+ placeholder?: string;
43
51
  goal?: SessionGoal;
44
52
  jevEnabled?: boolean;
45
53
  /** Set on a session another part of Andorra started for itself, such as a review run; such a session is kept out of every list. */
@@ -5,10 +5,12 @@ import { join, resolve } from 'node:path';
5
5
  import { stripVTControlCharacters } from 'node:util';
6
6
  import { setTimeout as delay } from 'node:timers/promises';
7
7
  import { validSessionGoal } from './session-goal.js';
8
- import { validCheckout } from './task-checkout.js';
8
+ import { randomTaskName, validCheckout } from './task-checkout.js';
9
9
  import { unverified } from './evidence.js';
10
10
  import { decodeDoubleEscapedSummary, stripEchoedEnvelope } from './completion.js';
11
11
  import { redactSecrets } from './secret-redaction.js';
12
+ /** The most a session's `placeholder` may hold (`validSavedSession`); a prompt-derived name must fit it, too. */
13
+ export const MAX_SESSION_NAME_CHARS = 64;
12
14
  export const sessionName = (prompt) => {
13
15
  const clean = redactSecrets(stripVTControlCharacters(prompt))
14
16
  .replace(/https?:\/\/\S+/gi, ' ')
@@ -20,8 +22,11 @@ export const sessionName = (prompt) => {
20
22
  .replace(/^(?:hi|hello|hey)[!,.: ]+/i, '');
21
23
  const words = focused.match(/[\p{L}\p{N}][\p{L}\p{N}'-]*/gu) ?? [];
22
24
  const useful = words.filter(word => !/^(please|can|could|you|would|the|a|an|my|me|to|i|want|need|inside)$/i.test(word));
23
- return [...(useful.length ? useful : words).slice(0, 5), 'coding', 'task', 'session'].slice(0, Math.max(3, Math.min(5, useful.length || words.length))).map(word => word.slice(0, 32)).join(' ');
25
+ const name = [...(useful.length ? useful : words).slice(0, 5), 'coding', 'task', 'session'].slice(0, Math.max(3, Math.min(5, useful.length || words.length))).map(word => word.slice(0, 32)).join(' ');
26
+ return name.length <= MAX_SESSION_NAME_CHARS ? name : name.slice(0, MAX_SESSION_NAME_CHARS).trim();
24
27
  };
28
+ /** A random 8-character name (`a92x9dwe`): what a hidden subagent run still starts under. */
29
+ export const randomSessionName = () => randomTaskName();
25
30
  /** A session the review loop's reviewer saved: it stays on disk and opens by id, but no task list, search or stats shows it. */
26
31
  export const hiddenSession = (session) => session.origin !== undefined;
27
32
  export const MAX_LINEAGE_ENTRIES = 64;
@@ -77,8 +82,9 @@ export function lineagePoints(parent, parentUsage, parentTurns) {
77
82
  return [...(parent.lineage ?? []), { usage: parentUsage, turns: parentTurns }].slice(-MAX_LINEAGE_ENTRIES);
78
83
  }
79
84
  export function savedSessionFields(session) {
80
- const { version, id, name, workspace, updatedAt, history, usage, contextHistory, parentId, inheritedUsage, inheritedTurns, ancestors, lineage, projectId, trajectoryId, widgets, context, archived, autoArchived, pinned, renamed, goal, jevEnabled, origin, checkout, review } = session;
85
+ const { version, id, name, workspace, updatedAt, history, usage, contextHistory, parentId, handoffParentId, inheritedUsage, inheritedTurns, ancestors, lineage, projectId, trajectoryId, widgets, context, archived, autoArchived, pinned, renamed, placeholder, goal, jevEnabled, origin, checkout, review } = session;
81
86
  return { version, id, name, workspace, updatedAt, history, usage, contextHistory, parentId, projectId, widgets,
87
+ ...(handoffParentId === undefined ? {} : { handoffParentId }),
82
88
  ...(context === undefined ? {} : { context }),
83
89
  ...(inheritedUsage === undefined ? {} : { inheritedUsage }),
84
90
  ...(inheritedTurns === undefined ? {} : { inheritedTurns }),
@@ -88,6 +94,7 @@ export function savedSessionFields(session) {
88
94
  ...(archived === undefined ? {} : { archived }), ...(autoArchived === undefined ? {} : { autoArchived }),
89
95
  ...(pinned === undefined ? {} : { pinned }),
90
96
  ...(renamed === undefined ? {} : { renamed }),
97
+ ...(placeholder === undefined ? {} : { placeholder }),
91
98
  ...(goal === undefined ? {} : { goal }),
92
99
  ...(jevEnabled === undefined ? {} : { jevEnabled }),
93
100
  ...(origin === undefined ? {} : { origin }),
@@ -210,6 +217,7 @@ export function validSavedSession(value) {
210
217
  return session.version === 1 && typeof session.id === 'string' && validId(session.id) && typeof session.name === 'string' && typeof session.workspace === 'string' && Number.isFinite(Date.parse(session.updatedAt)) &&
211
218
  validHistory(session.history) && (session.contextHistory === undefined || validHistory(session.contextHistory)) &&
212
219
  (session.parentId === undefined || typeof session.parentId === 'string') &&
220
+ (session.handoffParentId === undefined || (typeof session.handoffParentId === 'string' && validId(session.handoffParentId) && session.handoffParentId !== session.id)) &&
213
221
  (session.ancestors === undefined || (Array.isArray(session.ancestors) && session.ancestors.length <= MAX_LINEAGE_ENTRIES
214
222
  && session.ancestors.every((entry) => typeof entry === 'string' && validId(entry)))) &&
215
223
  (session.inheritedTurns === undefined || (Number.isSafeInteger(session.inheritedTurns)
@@ -229,6 +237,7 @@ export function validSavedSession(value) {
229
237
  (session.autoArchived === undefined || typeof session.autoArchived === 'boolean') &&
230
238
  (session.pinned === undefined || typeof session.pinned === 'boolean') &&
231
239
  (session.renamed === undefined || typeof session.renamed === 'boolean') &&
240
+ (session.placeholder === undefined || typeof session.placeholder === 'string' && session.placeholder.length <= MAX_SESSION_NAME_CHARS) &&
232
241
  (session.goal === undefined || validSessionGoal(session.goal)) &&
233
242
  (session.jevEnabled === undefined || typeof session.jevEnabled === 'boolean') &&
234
243
  (session.origin === undefined || session.origin === 'andorra-review') &&
package/dist/src/shell.js CHANGED
@@ -255,6 +255,12 @@ export function shellBaseEnv(marker, options = {}) {
255
255
  for (const [key, value] of Object.entries(process.env))
256
256
  if (allowed.has(key.toLowerCase()))
257
257
  env[key] = key.toLowerCase() === 'codex_home' && value ? path.resolve(value) : value;
258
+ // Shell commands find the same node that NativeExec runs. It goes last, so a node the user installed still wins.
259
+ const nodeDirectory = path.dirname(process.execPath);
260
+ const pathKey = Object.keys(env).find(key => key.toLowerCase() === 'path') ?? 'PATH';
261
+ const pathEntries = (env[pathKey] ?? '').split(path.delimiter).filter(Boolean);
262
+ if (!pathEntries.includes(nodeDirectory))
263
+ env[pathKey] = [...pathEntries, nodeDirectory].join(path.delimiter);
258
264
  if (marker !== undefined)
259
265
  env.ANDORRACODE_RUN_ID = marker;
260
266
  // While commits with the wrong git identity are held, every command gets the push hold (git-identity-hold.ts).
@@ -111,10 +111,44 @@ function planSection(data, width, rows) {
111
111
  if (rows < 2 || !data.todos.length)
112
112
  return [];
113
113
  const done = data.todos.filter(todo => todo.status === 'completed').length;
114
+ const budget = rows - 1;
115
+ const title = heading('Plan', width, [{ text: `${done}/${data.todos.length}`, color: GRAY }]);
116
+ if (data.todos.some(todo => todo.parentId !== undefined)) {
117
+ const overflows = data.todos.length > budget;
118
+ const room = overflows && budget > 1 ? budget - 1 : budget;
119
+ const selected = new Set();
120
+ if (overflows) {
121
+ for (const status of ['in_progress', 'pending', 'completed']) {
122
+ const limit = status === 'in_progress' ? budget : room;
123
+ for (const todo of data.todos) {
124
+ if (selected.size >= limit)
125
+ break;
126
+ if (todo.status !== status)
127
+ continue;
128
+ if (todo.parentId !== undefined)
129
+ selected.add(todo.parentId);
130
+ if (selected.size < limit)
131
+ selected.add(todo.id);
132
+ }
133
+ }
134
+ }
135
+ // Preserve the phase and sibling order in the snapshot once the priority pass selects the rows.
136
+ const visible = overflows ? data.todos.filter(todo => selected.has(todo.id)) : data.todos;
137
+ const body = visible.map(todo => {
138
+ const indent = todo.parentId === undefined ? '' : ' ';
139
+ const mark = todo.status === 'completed' ? '✓' : todo.status === 'in_progress' ? '●' : '○';
140
+ const markerColor = todo.status === 'in_progress' ? accentSgr() : SUBTLE;
141
+ const textColor = todo.status === 'in_progress' ? WHITE : GRAY;
142
+ return row({ text: `${indent}${mark} `, color: markerColor }, { text: clip(todo.text, width - indent.length - 2), color: textColor });
143
+ });
144
+ if (body.length < budget && visible.length < data.todos.length) {
145
+ body.push(row({ text: clip(`… ${data.todos.length - visible.length} more`, width), color: FAINT }));
146
+ }
147
+ return [title, ...body];
148
+ }
114
149
  const body = [];
115
150
  const active = data.todos.filter(todo => todo.status === 'in_progress');
116
151
  const pending = data.todos.filter(todo => todo.status === 'pending');
117
- const budget = rows - 1;
118
152
  const doneRow = done ? 1 : 0;
119
153
  const fits = active.length + doneRow + pending.length <= budget;
120
154
  const room = fits ? budget : Math.max(1, budget - 1);
@@ -135,7 +169,7 @@ function planSection(data, width, rows) {
135
169
  body.push(row({ text: clip(`… ${omitted.join(' · ')}`, width), color: FAINT }));
136
170
  if (!body.length)
137
171
  body.push(row({ text: `${done}/${data.todos.length} done`, color: GRAY }));
138
- return [heading('Plan', width, [{ text: `${done}/${data.todos.length}`, color: GRAY }]), ...body.slice(0, budget)];
172
+ return [title, ...body.slice(0, budget)];
139
173
  }
140
174
  export function panelDuration(milliseconds) {
141
175
  return formatHms(milliseconds / 1000);
@@ -1,6 +1,6 @@
1
1
  import type { Config } from './config.js';
2
2
  import type { ProviderConfig } from './providers.js';
3
- export declare const DETECTABLE_SIGN_IN_TYPES: readonly ["claude", "codex", "grok", "opencode", "google"];
3
+ export declare const DETECTABLE_SIGN_IN_TYPES: readonly ["claude", "codex", "grok", "opencode"];
4
4
  export type DetectableSignInType = typeof DETECTABLE_SIGN_IN_TYPES[number];
5
5
  export declare function isDetectableSignInType(value: unknown): value is DetectableSignInType;
6
6
  export interface DetectedSignIn {
@@ -4,20 +4,20 @@ import { resolveCliExecutable } from './cli-executable.js';
4
4
  import { readCodexModels } from './codex-auth.js';
5
5
  import { resolveCodexExecutable } from './codex-executable.js';
6
6
  import { connectCodex } from './codex-rpc.js';
7
- import { GOOGLE_BASE_URL, GOOGLE_EXECUTABLE, readGoogleCatalog } from './google-provider.js';
8
7
  import { GROK_BASE_URL, GROK_EXECUTABLE, readGrokCatalog } from './grok-provider.js';
9
8
  import { OPENCODE_BASE_URL, OPENCODE_EXECUTABLE, readOpenCodeCatalog, sharedOpenCodeServer } from './opencode-cli-provider.js';
10
9
  import { uniqueProviderId } from './provider-import.js';
11
- export const DETECTABLE_SIGN_IN_TYPES = ['claude', 'codex', 'grok', 'opencode', 'google'];
10
+ // A Google subscription starts a dedicated Antigravity session.
11
+ export const DETECTABLE_SIGN_IN_TYPES = ['claude', 'codex', 'grok', 'opencode'];
12
12
  export function isDetectableSignInType(value) {
13
13
  return DETECTABLE_SIGN_IN_TYPES.includes(value);
14
14
  }
15
15
  const SIGNED_OUT = { signedIn: false, models: [] };
16
16
  const MAX_MODELS = 5000;
17
17
  const FIXED_BASE_URL = {
18
- claude: 'https://api.anthropic.com', codex: 'https://chatgpt.com/backend-api/codex', grok: GROK_BASE_URL, opencode: OPENCODE_BASE_URL, google: GOOGLE_BASE_URL,
18
+ claude: 'https://api.anthropic.com', codex: 'https://chatgpt.com/backend-api/codex', grok: GROK_BASE_URL, opencode: OPENCODE_BASE_URL,
19
19
  };
20
- const DISPLAY_NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode', google: 'Google' };
20
+ const DISPLAY_NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode' };
21
21
  export function defaultSignInProbes() {
22
22
  const present = async (resolve) => { try {
23
23
  await resolve();
@@ -60,12 +60,6 @@ export function defaultSignInProbes() {
60
60
  const catalog = await readGrokCatalog(signal);
61
61
  return { signedIn: catalog.signedIn, models: catalog.models, ...(catalog.email ? { email: catalog.email } : {}) };
62
62
  },
63
- google: async (signal) => {
64
- if (!await present(() => resolveCliExecutable(GOOGLE_EXECUTABLE)))
65
- return SIGNED_OUT;
66
- const catalog = await readGoogleCatalog(signal);
67
- return { signedIn: catalog.signedIn, models: catalog.models };
68
- },
69
63
  opencode: async (signal) => {
70
64
  if (!await present(() => resolveCliExecutable(OPENCODE_EXECUTABLE)))
71
65
  return SIGNED_OUT;
@@ -5,7 +5,7 @@ import { changeConfigFile, configDirectory, loadConfig } from './config.js';
5
5
  import { applySignInImports, detectSignIns } from './sign-in-detection.js';
6
6
  const DETECT_TIMEOUT_MS = 8_000;
7
7
  const MAX_ATTEMPTS = 3;
8
- const NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode', google: 'Google' };
8
+ const NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode' };
9
9
  const statePath = (home) => join(home, 'sign-in-offer.json');
10
10
  export async function readSignInOfferState(home = configDirectory()) {
11
11
  try {
@@ -1,5 +1,5 @@
1
1
  const BUILTIN_COMMANDS = new Set([
2
- 'browser', 'session', 'resume', 'login', 'auth', 'model', 'providers', 'subagent', 'reasoning',
2
+ 'browser', 'session', 'resume', 'login', 'auth', 'model', 'providers', 'antigravity', 'subagent', 'reasoning',
3
3
  'graph', 'codegraph', 'dashboard', 'attach', 'usage', 'permissions', 'jev',
4
4
  'feedback', 'yolo', 'tools', 'skill', 'skills', 'plugins', 'mcp', 'logout', 'status',
5
5
  'clear', 'compact', 'goal', 'help', 'exit', 'quit',
@@ -55,8 +55,8 @@ What you need to know:
55
55
  - What each agent may touch (read only, write files, run shell, open pull requests).
56
56
  - What input a run needs beyond the task text.
57
57
  - When the workflow opens, reviews or fixes pull requests: which agent owns the PR and its review comments.
58
- Build it with the "Pull request with review fixes" pattern in `patterns.md`: that agent switches Auto-fix on
59
- itself and loops on the reviews, and the graph's entry stays where it is.
58
+ Use the "Pull request with review fixes" pattern in `patterns.md`. The owner decides when to monitor the
59
+ PR with `await_review` and how to act on review comments and reaction changes. The graph's entry stays where it is.
60
60
 
61
61
  Then sketch the nodes and routes. To show the user a graph, call the `andorra_graph_show` action: with
62
62
  `draftId` for a draft you are building, or with `id` (and `revision`, if not the latest) for a published graph.