@andorra-labs/code 0.1.17 → 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 (313) 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 +441 -53
  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/errors.js +3 -0
  11. package/dist/src/andorra/hosted.d.ts +8 -0
  12. package/dist/src/andorra/hosted.js +22 -3
  13. package/dist/src/andorra/streams.d.ts +49 -0
  14. package/dist/src/andorra/streams.js +98 -0
  15. package/dist/src/antigravity-acp.d.ts +28 -0
  16. package/dist/src/antigravity-acp.js +150 -0
  17. package/dist/src/antigravity-terminal.d.ts +2 -0
  18. package/dist/src/antigravity-terminal.js +214 -0
  19. package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
  20. package/dist/src/app-server/adaptive-routing-settings.js +69 -0
  21. package/dist/src/app-server/artifact.d.ts +14 -0
  22. package/dist/src/app-server/artifact.js +46 -0
  23. package/dist/src/app-server/legal-protocol.d.ts +33 -0
  24. package/dist/src/app-server/legal-protocol.js +16 -0
  25. package/dist/src/app-server/protocol.d.ts +34 -3
  26. package/dist/src/app-server/protocol.js +3 -1
  27. package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
  28. package/dist/src/app-server/telemetry-protocol.js +2 -0
  29. package/dist/src/app-server/telemetry.d.ts +38 -0
  30. package/dist/src/app-server/telemetry.js +163 -0
  31. package/dist/src/app-server/workspace.d.ts +21 -0
  32. package/dist/src/app-server/workspace.js +192 -10
  33. package/dist/src/app-server.d.ts +82 -26
  34. package/dist/src/app-server.js +1573 -417
  35. package/dist/src/attachments.d.ts +10 -0
  36. package/dist/src/attachments.js +102 -7
  37. package/dist/src/auth/AuthManager.d.ts +11 -2
  38. package/dist/src/auth/AuthManager.js +56 -13
  39. package/dist/src/auth/index.d.ts +5 -1
  40. package/dist/src/auth/index.js +8 -1
  41. package/dist/src/auth/lifecycle.d.ts +13 -0
  42. package/dist/src/auth/lifecycle.js +109 -0
  43. package/dist/src/auth/store.d.ts +1 -0
  44. package/dist/src/auth/store.js +12 -0
  45. package/dist/src/auth/types.d.ts +12 -0
  46. package/dist/src/automation-runner.js +2 -0
  47. package/dist/src/automation-service.js +7 -2
  48. package/dist/src/automation-tool.js +2 -1
  49. package/dist/src/benchmark-scores.d.ts +88 -0
  50. package/dist/src/benchmark-scores.js +302 -0
  51. package/dist/src/bridge/command.js +16 -1
  52. package/dist/src/bridge/control.d.ts +3 -1
  53. package/dist/src/bridge/control.js +9 -3
  54. package/dist/src/bridge/engines.d.ts +2 -0
  55. package/dist/src/bridge/engines.js +9 -0
  56. package/dist/src/bridge/github.d.ts +108 -0
  57. package/dist/src/bridge/github.js +378 -0
  58. package/dist/src/bridge/host-ops.d.ts +3 -3
  59. package/dist/src/bridge/host-ops.js +14 -2
  60. package/dist/src/bridge/host.d.ts +2 -0
  61. package/dist/src/bridge/host.js +70 -16
  62. package/dist/src/bridge/protocol.d.ts +1 -0
  63. package/dist/src/bridge/protocol.js +1 -0
  64. package/dist/src/browser-panel-tool.d.ts +12 -0
  65. package/dist/src/browser-panel-tool.js +30 -3
  66. package/dist/src/browser-runner.js +53 -62
  67. package/dist/src/browser-server.js +10 -4
  68. package/dist/src/browser-session.d.ts +14 -0
  69. package/dist/src/browser-session.js +57 -12
  70. package/dist/src/browser-view.d.ts +40 -1
  71. package/dist/src/browser-view.js +163 -9
  72. package/dist/src/browser-window-style.d.ts +27 -0
  73. package/dist/src/browser-window-style.js +244 -0
  74. package/dist/src/bug-report-attachments.d.ts +48 -0
  75. package/dist/src/bug-report-attachments.js +327 -0
  76. package/dist/src/bug-report.d.ts +23 -3
  77. package/dist/src/bug-report.js +72 -9
  78. package/dist/src/claude-provider.d.ts +1 -0
  79. package/dist/src/claude-provider.js +77 -36
  80. package/dist/src/cli.d.ts +1 -3
  81. package/dist/src/cli.js +245 -62
  82. package/dist/src/codex-provider.d.ts +1 -0
  83. package/dist/src/codex-provider.js +44 -8
  84. package/dist/src/coding-tools.d.ts +1 -0
  85. package/dist/src/coding-tools.js +28 -7
  86. package/dist/src/command-screens.d.ts +1 -1
  87. package/dist/src/command-screens.js +2 -2
  88. package/dist/src/commands.d.ts +9 -2
  89. package/dist/src/commands.js +69 -64
  90. package/dist/src/completion.js +13 -7
  91. package/dist/src/config.d.ts +14 -3
  92. package/dist/src/config.js +57 -17
  93. package/dist/src/context-budget.d.ts +11 -2
  94. package/dist/src/context-budget.js +38 -4
  95. package/dist/src/context-compaction.d.ts +10 -8
  96. package/dist/src/context-compaction.js +23 -24
  97. package/dist/src/deadline.js +1 -1
  98. package/dist/src/decision/DecisionEngine.d.ts +2 -0
  99. package/dist/src/decision/DecisionManager.d.ts +16 -0
  100. package/dist/src/decision/DecisionManager.js +75 -2
  101. package/dist/src/decision/applyTaskKind.d.ts +8 -0
  102. package/dist/src/decision/applyTaskKind.js +53 -0
  103. package/dist/src/decision/applyToolMenu.js +6 -2
  104. package/dist/src/decision/hostedPolicy.js +6 -3
  105. package/dist/src/decision/optimizationPolicy.d.ts +10 -0
  106. package/dist/src/decision/optimizationPolicy.js +23 -3
  107. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +4 -1
  108. package/dist/src/decision/providers/AndorraDecisionProvider.js +29 -7
  109. package/dist/src/decision/providers/index.js +1 -1
  110. package/dist/src/decision/taskKind.d.ts +52 -0
  111. package/dist/src/decision/taskKind.js +76 -0
  112. package/dist/src/decision/toolFamilies.js +1 -1
  113. package/dist/src/decision/types.d.ts +3 -1
  114. package/dist/src/default-graph.js +1 -1
  115. package/dist/src/efficiency.d.ts +80 -1
  116. package/dist/src/efficiency.js +119 -4
  117. package/dist/src/effort-routing.d.ts +27 -0
  118. package/dist/src/effort-routing.js +34 -0
  119. package/dist/src/evidence.d.ts +110 -0
  120. package/dist/src/evidence.js +195 -0
  121. package/dist/src/extensions.d.ts +2 -0
  122. package/dist/src/extensions.js +30 -20
  123. package/dist/src/github-app/agent-writes.d.ts +1 -1
  124. package/dist/src/github-app/agent-writes.js +1 -1
  125. package/dist/src/github-app/client.d.ts +19 -0
  126. package/dist/src/github-app/client.js +21 -1
  127. package/dist/src/github-app/event-source.d.ts +0 -5
  128. package/dist/src/github-app/event-source.js +1 -31
  129. package/dist/src/github-app/metrics.d.ts +2 -5
  130. package/dist/src/github-app/metrics.js +2 -14
  131. package/dist/src/github-app/review-loop.d.ts +5 -5
  132. package/dist/src/github-app/review-loop.js +1 -1
  133. package/dist/src/github-app/review-node.d.ts +2 -2
  134. package/dist/src/github-app/triggers.d.ts +3 -3
  135. package/dist/src/github-names.d.ts +7 -0
  136. package/dist/src/github-names.js +7 -0
  137. package/dist/src/glob-search.d.ts +1 -0
  138. package/dist/src/glob-search.js +3 -0
  139. package/dist/src/google-provider.d.ts +5 -28
  140. package/dist/src/google-provider.js +6 -141
  141. package/dist/src/graph-editor-session.d.ts +1 -0
  142. package/dist/src/graph-editor-session.js +2 -0
  143. package/dist/src/graph-health.js +3 -1
  144. package/dist/src/graph-preview.d.ts +2 -0
  145. package/dist/src/graph-preview.js +1 -0
  146. package/dist/src/graph-runner.js +20 -14
  147. package/dist/src/graph-selection.d.ts +3 -1
  148. package/dist/src/graph-selection.js +2 -2
  149. package/dist/src/graph-server.d.ts +8 -1
  150. package/dist/src/graph-server.js +49 -12
  151. package/dist/src/graph-sync.d.ts +2 -1
  152. package/dist/src/graph-sync.js +13 -0
  153. package/dist/src/graph-ui/app.js +49 -8
  154. package/dist/src/graph-ui/index.html +1 -1
  155. package/dist/src/graphs.d.ts +23 -1
  156. package/dist/src/graphs.js +58 -7
  157. package/dist/src/grok-provider.js +17 -14
  158. package/dist/src/hardened-runtime.js +39 -25
  159. package/dist/src/jev-savings.d.ts +4 -0
  160. package/dist/src/jev-savings.js +13 -0
  161. package/dist/src/legal/client.d.ts +25 -0
  162. package/dist/src/legal/client.js +47 -0
  163. package/dist/src/legal/command.d.ts +13 -0
  164. package/dist/src/legal/command.js +98 -0
  165. package/dist/src/legal/documents.d.ts +2 -0
  166. package/dist/src/legal/documents.js +14 -0
  167. package/dist/src/legal/gate.d.ts +13 -0
  168. package/dist/src/legal/gate.js +96 -0
  169. package/dist/src/legal/manifest.d.ts +21 -0
  170. package/dist/src/legal/manifest.js +23 -0
  171. package/dist/src/legal/receipt.d.ts +13 -0
  172. package/dist/src/legal/receipt.js +137 -0
  173. package/dist/src/legal/release.d.ts +27 -0
  174. package/dist/src/legal/release.js +28 -0
  175. package/dist/src/managed-sign-in.d.ts +0 -1
  176. package/dist/src/managed-sign-in.js +0 -13
  177. package/dist/src/membership.d.ts +27 -1
  178. package/dist/src/membership.js +139 -7
  179. package/dist/src/model-health-cache.js +1 -1
  180. package/dist/src/model-metadata.js +3 -7
  181. package/dist/src/model-override.d.ts +2 -1
  182. package/dist/src/model-override.js +9 -0
  183. package/dist/src/model-pool.d.ts +99 -0
  184. package/dist/src/model-pool.js +136 -0
  185. package/dist/src/model-relay/local.js +5 -0
  186. package/dist/src/model-relay/remote.d.ts +2 -0
  187. package/dist/src/model-relay/remote.js +4 -0
  188. package/dist/src/model-tiers.d.ts +16 -1
  189. package/dist/src/model-tiers.js +31 -7
  190. package/dist/src/opencode-cli-provider.js +59 -56
  191. package/dist/src/opencode-provider.js +16 -13
  192. package/dist/src/permissions.d.ts +5 -0
  193. package/dist/src/permissions.js +7 -0
  194. package/dist/src/plan-pass.js +2 -1
  195. package/dist/src/pool-scores.d.ts +45 -0
  196. package/dist/src/pool-scores.js +40 -0
  197. package/dist/src/provider-connection.js +3 -17
  198. package/dist/src/provider-engine.d.ts +13 -1
  199. package/dist/src/provider-engine.js +116 -12
  200. package/dist/src/provider-request-error.d.ts +8 -0
  201. package/dist/src/provider-request-error.js +12 -0
  202. package/dist/src/provider-settings.d.ts +1 -1
  203. package/dist/src/provider-settings.js +36 -18
  204. package/dist/src/provider-turn-deadline.d.ts +39 -0
  205. package/dist/src/provider-turn-deadline.js +139 -0
  206. package/dist/src/providers.d.ts +8 -9
  207. package/dist/src/providers.js +211 -150
  208. package/dist/src/pull-request-merge.d.ts +1 -8
  209. package/dist/src/pull-request-merge.js +0 -4
  210. package/dist/src/pull-requests.d.ts +83 -57
  211. package/dist/src/pull-requests.js +266 -225
  212. package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
  213. package/dist/src/qa/runtime/ProcessManager.js +9 -3
  214. package/dist/src/react-runtime.js +245 -71
  215. package/dist/src/reasoning-probe-cloud.d.ts +10 -0
  216. package/dist/src/reasoning-probe-cloud.js +209 -0
  217. package/dist/src/remote/engine-pool.d.ts +3 -0
  218. package/dist/src/remote/engine-pool.js +88 -21
  219. package/dist/src/remote/recovery.d.ts +6 -0
  220. package/dist/src/remote/recovery.js +37 -0
  221. package/dist/src/run-records.d.ts +13 -3
  222. package/dist/src/run-records.js +59 -34
  223. package/dist/src/runtime.d.ts +47 -2
  224. package/dist/src/runtime.js +33 -7
  225. package/dist/src/session-summary.d.ts +8 -0
  226. package/dist/src/session-summary.js +34 -0
  227. package/dist/src/sessions.d.ts +32 -0
  228. package/dist/src/sessions.js +65 -3
  229. package/dist/src/shell.js +6 -0
  230. package/dist/src/side-panel.js +36 -2
  231. package/dist/src/sign-in-detection.d.ts +1 -1
  232. package/dist/src/sign-in-detection.js +4 -10
  233. package/dist/src/sign-in-offer.js +1 -1
  234. package/dist/src/skill-commands.js +1 -1
  235. package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
  236. package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
  237. package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
  238. package/dist/src/skills/bundled/provenance.json +3 -3
  239. package/dist/src/subagent-run.js +50 -50
  240. package/dist/src/subscription-usage.d.ts +50 -0
  241. package/dist/src/subscription-usage.js +92 -0
  242. package/dist/src/task-checkout.d.ts +157 -0
  243. package/dist/src/task-checkout.js +628 -0
  244. package/dist/src/telemetry/access.d.ts +18 -0
  245. package/dist/src/telemetry/access.js +43 -0
  246. package/dist/src/telemetry/aggregate.d.ts +18 -2
  247. package/dist/src/telemetry/aggregate.js +22 -9
  248. package/dist/src/telemetry/capture-core.d.ts +33 -14
  249. package/dist/src/telemetry/capture-core.js +124 -25
  250. package/dist/src/telemetry/capture.d.ts +3 -2
  251. package/dist/src/telemetry/capture.js +21 -1
  252. package/dist/src/telemetry/decision-capture.js +4 -0
  253. package/dist/src/telemetry/emitter.d.ts +6 -7
  254. package/dist/src/telemetry/emitter.js +124 -29
  255. package/dist/src/telemetry/gate.d.ts +41 -2
  256. package/dist/src/telemetry/gate.js +89 -4
  257. package/dist/src/telemetry/home.d.ts +1 -0
  258. package/dist/src/telemetry/home.js +20 -0
  259. package/dist/src/telemetry/identity.d.ts +6 -3
  260. package/dist/src/telemetry/identity.js +19 -6
  261. package/dist/src/telemetry/lifecycle.d.ts +8 -0
  262. package/dist/src/telemetry/lifecycle.js +76 -0
  263. package/dist/src/telemetry/outbox.d.ts +13 -8
  264. package/dist/src/telemetry/outbox.js +68 -12
  265. package/dist/src/telemetry/permission-command.d.ts +38 -0
  266. package/dist/src/telemetry/permission-command.js +208 -0
  267. package/dist/src/telemetry/permission.d.ts +168 -0
  268. package/dist/src/telemetry/permission.js +662 -0
  269. package/dist/src/telemetry/record-installation.d.ts +1 -0
  270. package/dist/src/telemetry/record-installation.js +9 -0
  271. package/dist/src/telemetry/region-data.d.ts +12 -0
  272. package/dist/src/telemetry/region-data.js +1314 -0
  273. package/dist/src/telemetry/region.d.ts +34 -0
  274. package/dist/src/telemetry/region.js +87 -0
  275. package/dist/src/telemetry/run-privacy.d.ts +11 -0
  276. package/dist/src/telemetry/run-privacy.js +165 -0
  277. package/dist/src/telemetry/schema.d.ts +27 -6
  278. package/dist/src/telemetry/schema.js +109 -14
  279. package/dist/src/telemetry/state.d.ts +11 -7
  280. package/dist/src/telemetry/state.js +39 -6
  281. package/dist/src/telemetry/surface.d.ts +20 -3
  282. package/dist/src/telemetry/surface.js +71 -15
  283. package/dist/src/telemetry/uploader.d.ts +6 -11
  284. package/dist/src/telemetry/uploader.js +72 -46
  285. package/dist/src/telemetry/uploads.d.ts +5 -1
  286. package/dist/src/telemetry/uploads.js +25 -6
  287. package/dist/src/telemetry/version.d.ts +5 -0
  288. package/dist/src/telemetry/version.js +34 -0
  289. package/dist/src/telemetry/workspace.d.ts +4 -1
  290. package/dist/src/telemetry/workspace.js +18 -3
  291. package/dist/src/terminal-ui.d.ts +3 -0
  292. package/dist/src/terminal-ui.js +48 -6
  293. package/dist/src/test-edit-guard.d.ts +30 -0
  294. package/dist/src/test-edit-guard.js +167 -2
  295. package/dist/src/thinking-level-detect.d.ts +13 -0
  296. package/dist/src/thinking-level-detect.js +52 -0
  297. package/dist/src/thinking-levels.d.ts +30 -0
  298. package/dist/src/thinking-levels.js +131 -0
  299. package/dist/src/timers.d.ts +3 -0
  300. package/dist/src/todos.d.ts +2 -1
  301. package/dist/src/todos.js +24 -4
  302. package/dist/src/tool-argument-coercion.d.ts +7 -0
  303. package/dist/src/tool-argument-coercion.js +49 -0
  304. package/dist/src/tool-catalog.d.ts +2 -2
  305. package/dist/src/tool-catalog.js +1 -1
  306. package/dist/src/tools.js +67 -22
  307. package/dist/src/transcript.js +3 -2
  308. package/dist/src/types.d.ts +48 -1
  309. package/dist/src/update.js +4 -0
  310. package/dist/src/usage-analytics.d.ts +7 -0
  311. package/dist/src/usage-analytics.js +85 -13
  312. package/dist/telemetry-consent-v1 +1 -0
  313. package/package.json +97 -96
@@ -41,7 +41,7 @@ export interface PullRequestMergeContext {
41
41
  canDeleteBranch: boolean;
42
42
  /** The repository deletes head branches itself once they merge. */
43
43
  deletesBranch: boolean;
44
- /** The repository allows auto-merge (Merge When Ready). */
44
+ /** The repository allows GitHub auto-merge. */
45
45
  autoMergeAllowed: boolean;
46
46
  /** Auto-merge already set up on this PR. */
47
47
  autoMerge?: {
@@ -82,13 +82,6 @@ export declare function mergePullRequest(gh: GhRunner, pullRequestId: string, me
82
82
  }): Promise<{
83
83
  mergeCommit?: string;
84
84
  }>;
85
- /** Sets the PR to merge by itself once its requirements pass (GitHub's auto-merge), with the chosen method and message. */
86
- export declare function enableAutoMerge(gh: GhRunner, pullRequestId: string, merge: {
87
- method: PullRequestMergeMethod;
88
- headSha: string;
89
- title?: string;
90
- body?: string;
91
- }): Promise<void>;
92
85
  /** Adds the PR to its base's merge queue at `headSha`, the head the person read; GitHub refuses one that moved. */
93
86
  export declare function enqueue(gh: GhRunner, pullRequestId: string, headSha: string): Promise<{
94
87
  position?: number;
@@ -189,10 +189,6 @@ export async function mergePullRequest(gh, pullRequestId, merge) {
189
189
  const oid = text(record(record(record(data.mergePullRequest).pullRequest).mergeCommit).oid);
190
190
  return oid === undefined ? {} : { mergeCommit: oid };
191
191
  }
192
- /** Sets the PR to merge by itself once its requirements pass (GitHub's auto-merge), with the chosen method and message. */
193
- export async function enableAutoMerge(gh, pullRequestId, merge) {
194
- await mutate(gh, 'mutation($pr: ID!, $method: PullRequestMergeMethod!, $head: GitObjectID, $title: String, $body: String) { enablePullRequestAutoMerge(input: { pullRequestId: $pr, mergeMethod: $method, expectedHeadOid: $head, commitHeadline: $title, commitBody: $body }) { pullRequest { autoMergeRequest { mergeMethod } } } }', { pr: pullRequestId, method: GITHUB_METHOD[merge.method], head: merge.headSha, ...message(merge.method, merge) });
195
- }
196
192
  /** Adds the PR to its base's merge queue at `headSha`, the head the person read; GitHub refuses one that moved. */
197
193
  export async function enqueue(gh, pullRequestId, headSha) {
198
194
  const data = await mutate(gh, 'mutation($pr: ID!, $head: GitObjectID) { enqueuePullRequest(input: { pullRequestId: $pr, expectedHeadOid: $head }) { mergeQueueEntry { position state } } }', { pr: pullRequestId, head: headSha });
@@ -1,5 +1,5 @@
1
1
  import { type PullRequestChecksRollup } from './pull-request-checks.js';
2
- import { botMention, noSelfMention, type FailedCheck } from './pull-request-logs.js';
2
+ import { botMention, noSelfMention } from './pull-request-logs.js';
3
3
  import type { WakeCarry, WakeOrigin } from './timers.js';
4
4
  import type { ReviewLoopEnd } from './github-app/review-post.js';
5
5
  /**
@@ -93,7 +93,7 @@ export interface ReviewLoopState {
93
93
  head: string;
94
94
  };
95
95
  /**
96
- * The fixer's wake, beside Auto-fix's `pendingFix`. `runId` is the turn that took it once it was delivered; `held` says
96
+ * The fixer's wake. `runId` is the turn that took it once it was delivered; `held` says
97
97
  * it went straight into a run waiting in await_review rather than starting a turn; `retried` that it was armed again
98
98
  * once because the turn that took it was interrupted.
99
99
  */
@@ -129,22 +129,19 @@ export interface SessionPullRequest {
129
129
  number: number;
130
130
  title?: string;
131
131
  state: PullRequestState;
132
+ /** Retained for older desktop clients. Automatic fixes are disabled. */
132
133
  autoFix: boolean;
134
+ /** GitHub auto-merge state, possibly configured outside Andorra Code. */
133
135
  mergeWhenReady: boolean;
134
136
  attachedAt: string;
137
+ /** The timestamp of the newest review comment already reported to this task. */
135
138
  handledThrough?: string;
136
- /**
137
- * An Auto-fix wake on its way. `through` is the newest review comment it hands over; `head` the head
138
- * commit whose failed checks it hands over.
139
- */
140
- pendingFix?: {
141
- wakeId: string;
142
- through?: string;
143
- head?: string;
144
- prompt?: string;
145
- };
146
- /** The head commit whose failed checks Auto-fix last handed to the agent; it is not woken for them again. */
147
- checksHandled?: string;
139
+ /** IDs reported at handledThrough, where several comments can have the same GitHub timestamp. */
140
+ handledCommentIds?: string[];
141
+ /** Last complete snapshot of reactions on the PR's main post, for await_review. */
142
+ reviewReactions?: ReviewReaction[];
143
+ /** The head commit whose Codex sign-off the wait last reported. */
144
+ approvalHandled?: string;
148
145
  /** The head commit a review wait last asked Codex to review with an "@codex review" comment; it is not asked for that head again. */
149
146
  reviewBumped?: string;
150
147
  carry?: WakeCarry;
@@ -155,14 +152,18 @@ export interface SessionPullRequest {
155
152
  checks?: PullRequestChecksRollup;
156
153
  /** The Andorra review loop: its settings, and the loop in progress or how the last one ended. */
157
154
  review?: ReviewLoopState;
155
+ /** Pull requests this task had before the current one, newest superseded first; at most ten. */
156
+ previous?: {
157
+ url: string;
158
+ number: number;
159
+ state: PullRequestState;
160
+ updatedAt: string;
161
+ }[];
158
162
  updatedAt: string;
159
163
  }
160
164
  export type PullRequestState = 'open' | 'draft' | 'merged' | 'closed';
161
165
  export declare const isFinishedPullRequest: (state: PullRequestState) => boolean;
162
- export declare function settleFinishedPullRequest(pullRequest: SessionPullRequest): SessionPullRequest;
163
166
  export interface PullRequestSettings {
164
- autoFix?: boolean;
165
- mergeWhenReady?: boolean;
166
167
  draft?: boolean;
167
168
  }
168
169
  export interface PullRequestRef {
@@ -173,6 +174,8 @@ export interface PullRequestRef {
173
174
  }
174
175
  export declare function parsePullRequestUrl(text: string): PullRequestRef | undefined;
175
176
  export declare const pullRequestsDirectory: (home: string) => string;
177
+ /** How many superseded pull requests a task's record keeps. */
178
+ export declare const PREVIOUS_PULL_REQUESTS_MAX = 10;
176
179
  /** The loop state as this engine writes it; anything else is read as no loop. */
177
180
  export declare function validReviewLoop(value: unknown): value is ReviewLoopState;
178
181
  /** A loop is running: switched on, not ended, with an id. */
@@ -240,17 +243,39 @@ export declare function ghFor(gh: GhRunner, pullRequest: {
240
243
  }): GhRunner;
241
244
  export declare const noAccountMessage: (url: string) => string;
242
245
  export declare function newPullRequest(ref: PullRequestRef, now?: Date): SessionPullRequest;
246
+ /**
247
+ * The record for a pull request that replaces a task's previous one: the replaced PR moves into
248
+ * `previous` (newest first, an entry it already had under the new URL goes — that PR is the current
249
+ * one again), at most ten kept. A fresh attach over nothing, or re-attaching the current PR, changes nothing.
250
+ */
251
+ export declare function withSupersededPullRequest(next: SessionPullRequest, replaced: SessionPullRequest | undefined): SessionPullRequest;
252
+ /**
253
+ * A superseded PR's recorded state is only as fresh as the moment it was replaced: the watcher follows
254
+ * the task's current PR, not the ones it replaced. When the current PR's state changes, re-read each
255
+ * remembered PR that is not merged or closed yet (a finished one never changes) and take its newest
256
+ * state. An entry whose state did not change keeps its timestamp, so the refresh cannot make it look
257
+ * more recently worked on than the current PR; a changed one takes the read time, one stamp shared by
258
+ * the whole refresh so read order cannot decide which is newest. A read that fails keeps the stale
259
+ * entry. Nothing to refresh changes nothing.
260
+ */
261
+ export declare function refreshPreviousStates(previous: SessionPullRequest['previous'], gh: GhRunner): Promise<SessionPullRequest['previous']>;
243
262
  export declare function applyPullRequestSettings(gh: GhRunner, current: SessionPullRequest, changes: PullRequestSettings, now?: Date): Promise<SessionPullRequest>;
244
263
  export declare function applyPullRequestSettingsAsReadableAccount(gh: GhRunner, current: SessionPullRequest, changes: PullRequestSettings, now?: Date): Promise<SessionPullRequest>;
245
264
  export type ReviewWait = {
246
265
  kind: 'comments';
247
266
  prompt: string;
267
+ } | {
268
+ kind: 'activity';
269
+ pullRequest: SessionPullRequest;
270
+ comments: ReviewCommentNotice[];
271
+ reactions: ReviewReactionChange[];
248
272
  }
249
273
  /** Codex signed off on the head commit: its thumbs-up on the PR, or a review of that commit with no findings. */
250
274
  | {
251
275
  kind: 'approved';
252
276
  pullRequest: SessionPullRequest;
253
277
  headSha?: string;
278
+ reactions?: ReviewReactionChange[];
254
279
  }
255
280
  /** The Andorra review loop posted its next round: the fixer's wake text. */
256
281
  | {
@@ -266,9 +291,6 @@ export type ReviewWait = {
266
291
  } | {
267
292
  kind: 'finished';
268
293
  pullRequest: SessionPullRequest;
269
- } | {
270
- kind: 'off';
271
- pullRequest: SessionPullRequest;
272
294
  } | {
273
295
  kind: 'none';
274
296
  } | {
@@ -288,6 +310,7 @@ export interface PullRequestControl {
288
310
  */
289
311
  awaitReview?(signal: AbortSignal, timeoutMs: number, origin?: WakeOrigin, options?: {
290
312
  approveBump?(detail: string): Promise<void>;
313
+ invocationId?: string;
291
314
  }): Promise<ReviewWait>;
292
315
  dismiss(): Promise<void>;
293
316
  /**
@@ -337,16 +360,37 @@ export declare const CODE_REVIEWER_LOGINS: readonly string[];
337
360
  export declare function testCodeReviewer(env?: NodeJS.ProcessEnv): string | undefined;
338
361
  /**
339
362
  * The Andorra Code GitHub App's own bots (production and the staging dev App), as REST and webhooks name them
340
- * without `[bot]` and as GraphQL names them. What the agent posts as the bot is never a review to wake Auto-fix
341
- * for, not even when the test-mode reviewer names one of them.
363
+ * without `[bot]` and as GraphQL names them. Their posts are excluded from external review activity even when
364
+ * a test-mode reviewer is set to one of these logins.
342
365
  */
343
366
  export declare const ANDORRA_BOT_LOGINS: readonly string[];
344
367
  export declare function isCodeReviewer(login: string | undefined, env?: NodeJS.ProcessEnv): boolean;
345
- export declare function newReviewComments(gh: GhRunner, pullRequest: SessionPullRequest): Promise<{
368
+ export interface ReviewCommentCandidate {
369
+ id: string;
370
+ source: 'thread' | 'conversation' | 'review';
371
+ author: string;
372
+ body: string;
373
+ url?: string;
374
+ threadId?: string;
375
+ createdAt: string;
376
+ }
377
+ export type ReviewCommentNotice = Pick<ReviewCommentCandidate, 'author' | 'source' | 'url' | 'threadId'> & {
378
+ kind: 'review' | 'approval' | 'unclassified';
379
+ };
380
+ interface ReviewComments {
346
381
  threads: number;
347
382
  comments: number;
348
383
  newest?: string;
349
- }>;
384
+ newestIds?: string[];
385
+ candidates?: ReviewCommentCandidate[];
386
+ }
387
+ /**
388
+ * Counts unread external review comments. Detailed reads also include comments on unresolved threads from
389
+ * human reviewers and submitted review summaries, and return the oldest unread batch with a cursor that preserves comments sharing a timestamp.
390
+ */
391
+ export declare function newReviewComments(gh: GhRunner, pullRequest: SessionPullRequest, options?: {
392
+ includeDetails?: boolean;
393
+ }): Promise<ReviewComments>;
350
394
  /** Codex's login, as GraphQL names it on comments and reviews; on a reaction it carries `[bot]`. */
351
395
  export declare const CODEX_REVIEWER_LOGIN = "chatgpt-codex-connector";
352
396
  /** The PR comment that asks Codex for a review of the current head. */
@@ -355,9 +399,21 @@ export declare const REVIEW_BUMP_COMMENT = "@codex review";
355
399
  export declare const REVIEW_BUMP_DELAY_MS = 30000;
356
400
  /** How often a review wait reads Codex's reactions: GitHub sends no notice for a reaction. */
357
401
  export declare const REVIEW_SIGNAL_INTERVAL_MS = 60000;
402
+ export interface ReviewReaction {
403
+ id: string;
404
+ actor?: string;
405
+ content: string;
406
+ createdAt: string;
407
+ }
408
+ export type ReviewReactionChange = ReviewReaction & {
409
+ kind: 'added' | 'removed';
410
+ };
358
411
  /** What Codex shows on a PR's head commit, as a review wait reads it. */
359
412
  export interface ReviewSignals {
360
413
  headSha?: string;
414
+ state?: PullRequestState;
415
+ /** Complete main-post snapshot. Unavailable on a failed, inconsistent or truncated read. */
416
+ reactions?: ReviewReaction[];
361
417
  /** Open and not a draft: Codex reviews nothing else. */
362
418
  open: boolean;
363
419
  /** Codex signed off on this head: a thumbs-up on the PR newer than the head commit, or a review of it with no findings. */
@@ -381,32 +437,14 @@ export declare function readReviewSignals(gh: GhRunner, pullRequest: SessionPull
381
437
  /** Whether Codex has shown up on any of the repository's 20 newest pull requests: where it never has, nobody asks it for a review. */
382
438
  export declare function codexReviewsRepository(gh: GhRunner, pullRequest: SessionPullRequest, env?: NodeJS.ProcessEnv): Promise<boolean>;
383
439
  /**
384
- * Who the agent's replies and resolves post as, for the Auto-fix prompt: `botWrites` when the PR is covered by
440
+ * Who the agent's replies and resolves post as, for review and mention prompts: `botWrites` when the PR is covered by
385
441
  * the GitHub App and agent writes are set to the bot; `bot` is the bot's login from `GET /v1/github`.
386
442
  */
387
- export interface AutoFixWrites {
443
+ export interface ReviewCommentWrites {
388
444
  botWrites: boolean;
389
445
  bot?: string;
390
446
  }
391
447
  export { botMention, noSelfMention };
392
- export declare function autoFixPrompt(pullRequest: SessionPullRequest, found: {
393
- threads: number;
394
- comments: number;
395
- }, checks?: {
396
- checks: readonly FailedCheck[];
397
- headSha: string;
398
- branch?: string;
399
- }, writes?: AutoFixWrites): string;
400
- /**
401
- * The head commit's failed checks that Auto-fix hands to the agent: the failed **required** checks, or,
402
- * where the base branch requires none, every failed check (otherwise Auto-fix would never act on a
403
- * repository without branch protection). None while the head is one Auto-fix already handed over.
404
- */
405
- export declare function failedChecksToFix(gh: GhRunner, pullRequest: SessionPullRequest): Promise<{
406
- headSha: string;
407
- branch?: string;
408
- checks: FailedCheck[];
409
- } | undefined>;
410
448
  export declare class WatcherLease {
411
449
  private readonly home;
412
450
  private release?;
@@ -421,8 +459,6 @@ export interface PullRequestWatcherOptions {
421
459
  gh: GhRunner;
422
460
  intervalMs?: number;
423
461
  onUpdated: (sessionId: string, pullRequest: SessionPullRequest) => void;
424
- wake: (sessionId: string, prompt: string, carry: WakeCarry | undefined, origin: WakeOrigin | undefined) => string;
425
- wakePending: (id: string) => boolean;
426
462
  log?: (level: 'info' | 'warn', detail: string) => void;
427
463
  claim?: () => Promise<boolean>;
428
464
  /**
@@ -435,8 +471,6 @@ export interface PullRequestWatcherOptions {
435
471
  now?: () => number;
436
472
  /** How long `checkNow` waits, so a burst of notices for one PR costs one read. */
437
473
  checkNowDelayMs?: number;
438
- /** Who the agent's replies post as on this session's PR, for the Auto-fix prompt; without it, the gh form. */
439
- agentWrites?: (sessionId: string) => Promise<AutoFixWrites>;
440
474
  /** Each read that refreshed a session's record, for the Andorra review loop's round conditions. Must not throw. */
441
475
  onRead?: (sessionId: string, pullRequest: SessionPullRequest) => void;
442
476
  }
@@ -465,7 +499,7 @@ export declare class PullRequestWatcher {
465
499
  constructor(options: PullRequestWatcherOptions);
466
500
  start(): void;
467
501
  stop(): Promise<void>;
468
- /** Claims the `.watcher` lease: only the process that holds it reads PRs, wakes Auto-fix and pulls GitHub App notices. */
502
+ /** Claims the `.watcher` lease: only the process that holds it reads PR state and pulls GitHub App notices. */
469
503
  claim(): Promise<boolean>;
470
504
  holdsLease(): boolean;
471
505
  headSha(sessionId: string): string | undefined;
@@ -512,11 +546,3 @@ export declare class PullRequestWatcher {
512
546
  private read;
513
547
  private check;
514
548
  }
515
- export declare function confirmAutoFixWake(home: string, gh: GhRunner, sessionId: string, wakeId: string): Promise<{
516
- deliver: boolean;
517
- pullRequest?: SessionPullRequest;
518
- }>;
519
- /** The record once a pending Auto-fix wake reached the agent: what it handed over counts as handled. */
520
- export declare function handedOver(pullRequest: SessionPullRequest, pending: NonNullable<SessionPullRequest['pendingFix']>): SessionPullRequest;
521
- export declare function withoutPendingFix(pullRequest: SessionPullRequest): SessionPullRequest;
522
- export declare function markAutoFixDelivered(home: string, sessionId: string, wakeId: string): Promise<SessionPullRequest | undefined>;