@aviaratech/ai-delivery 0.3.35 → 0.3.36

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 (297) hide show
  1. package/CONTRIBUTING.md +12 -206
  2. package/README.md +57 -554
  3. package/dist/agent.d.ts +0 -2
  4. package/dist/agent.js +76 -16
  5. package/dist/agent.js.map +7 -1
  6. package/dist/agentReadiness.test.js +73 -67
  7. package/dist/agentReadiness.test.js.map +7 -1
  8. package/dist/boardReconcile.test.js +1651 -1590
  9. package/dist/boardReconcile.test.js.map +7 -1
  10. package/dist/build.test.js +130 -0
  11. package/dist/build.test.js.map +7 -0
  12. package/dist/callerErrors.test.js +105 -0
  13. package/dist/callerErrors.test.js.map +7 -0
  14. package/dist/cli.js +402 -515
  15. package/dist/cli.js.map +7 -1
  16. package/dist/cliResult.d.ts +2 -2
  17. package/dist/cliResult.js +42 -45
  18. package/dist/cliResult.js.map +7 -1
  19. package/dist/cliResult.test.js +424 -369
  20. package/dist/cliResult.test.js.map +7 -1
  21. package/dist/config/deliveryConfig.d.ts +288 -14
  22. package/dist/config/deliveryConfig.js +472 -390
  23. package/dist/config/deliveryConfig.js.map +7 -1
  24. package/dist/config/deliveryConfig.test.js +773 -649
  25. package/dist/config/deliveryConfig.test.js.map +7 -1
  26. package/dist/contributorChecks.test.js +1694 -916
  27. package/dist/contributorChecks.test.js.map +7 -1
  28. package/dist/currentConsumer.test.js +819 -737
  29. package/dist/currentConsumer.test.js.map +7 -1
  30. package/dist/currentTrackingScenario.test.js +499 -479
  31. package/dist/currentTrackingScenario.test.js.map +7 -1
  32. package/dist/delivery/common.js +160 -172
  33. package/dist/delivery/common.js.map +7 -1
  34. package/dist/delivery/delivery.test.js +509 -431
  35. package/dist/delivery/delivery.test.js.map +7 -1
  36. package/dist/delivery/evidence.d.ts +2 -2
  37. package/dist/delivery/evidence.js +133 -120
  38. package/dist/delivery/evidence.js.map +7 -1
  39. package/dist/delivery/index.js +7 -2
  40. package/dist/delivery/index.js.map +7 -1
  41. package/dist/delivery/legacy.js +65 -5
  42. package/dist/delivery/legacy.js.map +7 -1
  43. package/dist/delivery/policy.d.ts +10 -10
  44. package/dist/delivery/policy.js +211 -238
  45. package/dist/delivery/policy.js.map +7 -1
  46. package/dist/delivery/stage.d.ts +18 -18
  47. package/dist/delivery/stage.js +220 -235
  48. package/dist/delivery/stage.js.map +7 -1
  49. package/dist/deliveryBoard.d.ts +74 -0
  50. package/dist/deliveryBoard.js +644 -0
  51. package/dist/deliveryBoard.js.map +7 -0
  52. package/dist/deliveryBoard.test.js +649 -0
  53. package/dist/deliveryBoard.test.js.map +7 -0
  54. package/dist/deliveryHealth.test.js +179 -155
  55. package/dist/deliveryHealth.test.js.map +7 -1
  56. package/dist/dependencyCompatibility.test.js +154 -140
  57. package/dist/dependencyCompatibility.test.js.map +7 -1
  58. package/dist/directoryIndependent.test.js +417 -383
  59. package/dist/directoryIndependent.test.js.map +7 -1
  60. package/dist/dispatch.d.ts +16 -11
  61. package/dist/dispatch.js +329 -353
  62. package/dist/dispatch.js.map +7 -1
  63. package/dist/errors.d.ts +3 -3
  64. package/dist/errors.js +103 -96
  65. package/dist/errors.js.map +7 -1
  66. package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
  67. package/dist/fixtures/deliveryBoardReplay.js +617 -0
  68. package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
  69. package/dist/fixtures/discovery.d.ts +59 -19
  70. package/dist/fixtures/discovery.js +96 -90
  71. package/dist/fixtures/discovery.js.map +7 -1
  72. package/dist/fixtures/inertEntrypointChild.js +57 -56
  73. package/dist/fixtures/inertEntrypointChild.js.map +7 -1
  74. package/dist/fixtures/inertEntrypoints.d.ts +1 -1
  75. package/dist/fixtures/inertEntrypoints.js +321 -276
  76. package/dist/fixtures/inertEntrypoints.js.map +7 -1
  77. package/dist/fixtures/inertTarget.d.ts +78 -7
  78. package/dist/fixtures/inertTarget.js +769 -691
  79. package/dist/fixtures/inertTarget.js.map +7 -1
  80. package/dist/fixtures/issue63.d.ts +4 -3
  81. package/dist/fixtures/issue63.js +260 -274
  82. package/dist/fixtures/issue63.js.map +7 -1
  83. package/dist/fixtures/issueProjectItems.d.ts +20 -0
  84. package/dist/fixtures/issueProjectItems.js +15 -0
  85. package/dist/fixtures/issueProjectItems.js.map +7 -0
  86. package/dist/fixtures/readView.d.ts +120 -0
  87. package/dist/fixtures/readView.js +172 -0
  88. package/dist/fixtures/readView.js.map +7 -0
  89. package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
  90. package/dist/fixtures/recordedGitHubFlows.js +109 -0
  91. package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
  92. package/dist/genericCompatibility.test.js +64 -55
  93. package/dist/genericCompatibility.test.js.map +7 -1
  94. package/dist/git.js +73 -67
  95. package/dist/git.js.map +7 -1
  96. package/dist/gitProcess.d.ts +1 -1
  97. package/dist/gitProcess.js +58 -53
  98. package/dist/gitProcess.js.map +7 -1
  99. package/dist/github/client.d.ts +2 -2
  100. package/dist/github/client.js +484 -379
  101. package/dist/github/client.js.map +7 -1
  102. package/dist/github/commandIdentityPolicy.js +44 -52
  103. package/dist/github/commandIdentityPolicy.js.map +7 -1
  104. package/dist/github/discovery.d.ts +1 -0
  105. package/dist/github/discovery.js +197 -215
  106. package/dist/github/discovery.js.map +7 -1
  107. package/dist/github/discovery.test.js +223 -177
  108. package/dist/github/discovery.test.js.map +7 -1
  109. package/dist/github/issueHistory.d.ts +2 -2
  110. package/dist/github/issueHistory.js +117 -125
  111. package/dist/github/issueHistory.js.map +7 -1
  112. package/dist/github/machineAuth.d.ts +1 -1
  113. package/dist/github/machineAuth.js +126 -117
  114. package/dist/github/machineAuth.js.map +7 -1
  115. package/dist/github/machineAuth.test.js +755 -639
  116. package/dist/github/machineAuth.test.js.map +7 -1
  117. package/dist/github/nativeIssueMetadata.js +286 -273
  118. package/dist/github/nativeIssueMetadata.js.map +7 -1
  119. package/dist/github/projectDelivery.d.ts +18 -2
  120. package/dist/github/projectDelivery.js +615 -557
  121. package/dist/github/projectDelivery.js.map +7 -1
  122. package/dist/github/relationships.js +433 -389
  123. package/dist/github/relationships.js.map +7 -1
  124. package/dist/github/repo.d.ts +1 -0
  125. package/dist/github/repo.js +123 -96
  126. package/dist/github/repo.js.map +7 -1
  127. package/dist/index.js +3 -3
  128. package/dist/index.js.map +7 -1
  129. package/dist/issue.d.ts +40 -9
  130. package/dist/issue.js +2102 -1742
  131. package/dist/issue.js.map +7 -1
  132. package/dist/issue63History.test.js +40 -42
  133. package/dist/issue63History.test.js.map +7 -1
  134. package/dist/issue63Routes.test.js +154 -143
  135. package/dist/issue63Routes.test.js.map +7 -1
  136. package/dist/issueBatchUpdate.test.js +989 -885
  137. package/dist/issueBatchUpdate.test.js.map +7 -1
  138. package/dist/issueBlockerGuard.test.js +262 -226
  139. package/dist/issueBlockerGuard.test.js.map +7 -1
  140. package/dist/issueContract.d.ts +23 -4
  141. package/dist/issueContract.js +416 -395
  142. package/dist/issueContract.js.map +7 -1
  143. package/dist/issueContract.test.d.ts +4 -3
  144. package/dist/issueContract.test.js +358 -321
  145. package/dist/issueContract.test.js.map +7 -1
  146. package/dist/issueDates.test.js +235 -233
  147. package/dist/issueDates.test.js.map +7 -1
  148. package/dist/issueInfoReadback.test.js +304 -190
  149. package/dist/issueInfoReadback.test.js.map +7 -1
  150. package/dist/issueIntake.test.js +1945 -1732
  151. package/dist/issueIntake.test.js.map +7 -1
  152. package/dist/issueJournal.d.ts +40 -19
  153. package/dist/issueJournal.js +229 -138
  154. package/dist/issueJournal.js.map +7 -1
  155. package/dist/issueJournal.test.js +605 -422
  156. package/dist/issueJournal.test.js.map +7 -1
  157. package/dist/issueRollup.test.d.ts +1 -0
  158. package/dist/issueRollup.test.js +476 -0
  159. package/dist/issueRollup.test.js.map +7 -0
  160. package/dist/issueTracking.test.js +1059 -989
  161. package/dist/issueTracking.test.js.map +7 -1
  162. package/dist/issueWriteRecovery.test.d.ts +1 -0
  163. package/dist/issueWriteRecovery.test.js +260 -0
  164. package/dist/issueWriteRecovery.test.js.map +7 -0
  165. package/dist/lifecycle.test.js +112 -441
  166. package/dist/lifecycle.test.js.map +7 -1
  167. package/dist/logger.js +80 -74
  168. package/dist/logger.js.map +7 -1
  169. package/dist/mcp/index.js +116 -94
  170. package/dist/mcp/index.js.map +7 -1
  171. package/dist/mcp/tools.d.ts +264 -286
  172. package/dist/mcp/tools.js +267 -340
  173. package/dist/mcp/tools.js.map +7 -1
  174. package/dist/pluginAuthProbe.js +63 -52
  175. package/dist/pluginAuthProbe.js.map +7 -1
  176. package/dist/pluginAuthProbe.test.js +85 -62
  177. package/dist/pluginAuthProbe.test.js.map +7 -1
  178. package/dist/pluginCredentials.test.js +282 -259
  179. package/dist/pluginCredentials.test.js.map +7 -1
  180. package/dist/pluginDoctor.test.js +653 -588
  181. package/dist/pluginDoctor.test.js.map +7 -1
  182. package/dist/pluginInstaller.d.ts +7 -5
  183. package/dist/pluginInstaller.js +1173 -1229
  184. package/dist/pluginInstaller.js.map +7 -1
  185. package/dist/pluginInstaller.test.js +1842 -1423
  186. package/dist/pluginInstaller.test.js.map +7 -1
  187. package/dist/pluginPackaging.test.js +460 -409
  188. package/dist/pluginPackaging.test.js.map +7 -1
  189. package/dist/pr.d.ts +132 -94
  190. package/dist/pr.js +1521 -1323
  191. package/dist/pr.js.map +7 -1
  192. package/dist/pr.test.js +1678 -632
  193. package/dist/pr.test.js.map +7 -1
  194. package/dist/prAssociation.test.js +2419 -1788
  195. package/dist/prAssociation.test.js.map +7 -1
  196. package/dist/prDispatch.test.js +150 -89
  197. package/dist/prDispatch.test.js.map +7 -1
  198. package/dist/readView.d.ts +183 -0
  199. package/dist/readView.js +217 -0
  200. package/dist/readView.js.map +7 -0
  201. package/dist/readView.test.d.ts +1 -0
  202. package/dist/readView.test.js +119 -0
  203. package/dist/readView.test.js.map +7 -0
  204. package/dist/releaseReconciliation.test.js +267 -288
  205. package/dist/releaseReconciliation.test.js.map +7 -1
  206. package/dist/releaseWorkflow.test.js +2493 -422
  207. package/dist/releaseWorkflow.test.js.map +7 -1
  208. package/dist/review.d.ts +738 -2
  209. package/dist/review.js +601 -348
  210. package/dist/review.js.map +7 -1
  211. package/dist/review.test.js +1218 -812
  212. package/dist/review.test.js.map +7 -1
  213. package/dist/reviewSubmit.test.d.ts +1 -0
  214. package/dist/reviewSubmit.test.js +747 -0
  215. package/dist/reviewSubmit.test.js.map +7 -0
  216. package/dist/services/agentReadinessService.js +42 -37
  217. package/dist/services/agentReadinessService.js.map +7 -1
  218. package/dist/services/blockerGuardService.js +188 -188
  219. package/dist/services/blockerGuardService.js.map +7 -1
  220. package/dist/services/boardReconcileService.d.ts +125 -125
  221. package/dist/services/boardReconcileService.js +1295 -1421
  222. package/dist/services/boardReconcileService.js.map +7 -1
  223. package/dist/services/deliveryAdmission.js +131 -154
  224. package/dist/services/deliveryAdmission.js.map +7 -1
  225. package/dist/services/deliveryHealthService.js +197 -199
  226. package/dist/services/deliveryHealthService.js.map +7 -1
  227. package/dist/services/legacyIssueMigration.js +263 -277
  228. package/dist/services/legacyIssueMigration.js.map +7 -1
  229. package/dist/services/worktreeRegistry.d.ts +27 -119
  230. package/dist/services/worktreeRegistry.js +765 -1182
  231. package/dist/services/worktreeRegistry.js.map +7 -1
  232. package/dist/stagedChecks.test.js +396 -194
  233. package/dist/stagedChecks.test.js.map +7 -1
  234. package/dist/start.test.js +99 -95
  235. package/dist/start.test.js.map +7 -1
  236. package/dist/stdoutRegression.test.js +353 -352
  237. package/dist/stdoutRegression.test.js.map +7 -1
  238. package/dist/targetPolicyDiscovery.test.js +141 -143
  239. package/dist/targetPolicyDiscovery.test.js.map +7 -1
  240. package/dist/targetPolicyEntrypoints.test.js +308 -269
  241. package/dist/targetPolicyEntrypoints.test.js.map +7 -1
  242. package/dist/targetPolicyLocal.test.js +580 -1051
  243. package/dist/targetPolicyLocal.test.js.map +7 -1
  244. package/dist/targetPolicyRoutes.test.js +305 -281
  245. package/dist/targetPolicyRoutes.test.js.map +7 -1
  246. package/dist/targetRepositoryExecution.test.d.ts +1 -0
  247. package/dist/targetRepositoryExecution.test.js +463 -0
  248. package/dist/targetRepositoryExecution.test.js.map +7 -0
  249. package/dist/terminalMessages.js +41 -35
  250. package/dist/terminalMessages.js.map +7 -1
  251. package/dist/toolOutput.d.ts +2 -0
  252. package/dist/toolOutput.js +36 -0
  253. package/dist/toolOutput.js.map +7 -0
  254. package/dist/toolOutput.test.d.ts +1 -0
  255. package/dist/toolOutput.test.js +240 -0
  256. package/dist/toolOutput.test.js.map +7 -0
  257. package/dist/utils/atomicJson.js +84 -76
  258. package/dist/utils/atomicJson.js.map +7 -1
  259. package/dist/utils/filesystem.js +15 -18
  260. package/dist/utils/filesystem.js.map +7 -1
  261. package/dist/utils/lockfile.js +68 -71
  262. package/dist/utils/lockfile.js.map +7 -1
  263. package/dist/verification.d.ts +1 -19
  264. package/dist/verification.js +1020 -1939
  265. package/dist/verification.js.map +7 -1
  266. package/dist/verificationGate.test.js +127 -117
  267. package/dist/verificationGate.test.js.map +7 -1
  268. package/dist/version.js +23 -24
  269. package/dist/version.js.map +7 -1
  270. package/dist/worktree.d.ts +3 -15
  271. package/dist/worktree.js +97 -177
  272. package/dist/worktree.js.map +7 -1
  273. package/package.json +9 -8
  274. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  275. package/plugins/ai-delivery/README.md +47 -156
  276. package/plugins/ai-delivery/plugin.json +1 -1
  277. package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +238 -44
  278. package/plugins/ai-delivery/runtime/dist/cli.js +358 -115
  279. package/plugins/ai-delivery/runtime/package.json +1 -1
  280. package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
  281. package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
  282. package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
  283. package/dist/investigationCompletion.test.js +0 -728
  284. package/dist/investigationCompletion.test.js.map +0 -1
  285. package/dist/setup.d.ts +0 -60
  286. package/dist/setup.js +0 -585
  287. package/dist/setup.js.map +0 -1
  288. package/dist/setup.test.js +0 -3329
  289. package/dist/setup.test.js.map +0 -1
  290. package/dist/worktreeTransition.d.ts +0 -211
  291. package/dist/worktreeTransition.js +0 -1037
  292. package/dist/worktreeTransition.js.map +0 -1
  293. package/dist/worktreeTransition.test.js +0 -1191
  294. package/dist/worktreeTransition.test.js.map +0 -1
  295. /package/dist/{investigationCompletion.test.d.ts → build.test.d.ts} +0 -0
  296. /package/dist/{setup.test.d.ts → callerErrors.test.d.ts} +0 -0
  297. /package/dist/{worktreeTransition.test.d.ts → deliveryBoard.test.d.ts} +0 -0
package/dist/review.js CHANGED
@@ -1,379 +1,632 @@
1
- import { join } from 'node:path';
2
- import { z } from 'zod';
3
- import { assertPrivateFile } from './delivery/common.js';
4
- import { digestValue, RepositoryApprovalBindingSchema, } from './delivery/legacy.js';
5
- import { DeliveryError } from './errors.js';
6
- import { gitCommonDir } from './git.js';
7
- import { writePrivateJsonFileAtomically } from './utils/atomicJson.js';
1
+ import { basename, join } from "node:path";
2
+ import { execFileSync } from "node:child_process";
3
+ import { z } from "zod";
4
+ import { assertPrivateFile } from "./delivery/common.js";
5
+ import {
6
+ digestValue,
7
+ RepositoryApprovalBindingSchema
8
+ } from "./delivery/legacy.js";
9
+ import { DeliveryError } from "./errors.js";
10
+ import { git, gitCommonDir, gitExitCode } from "./git.js";
11
+ import { GIT_EXECUTABLE, gitEnvironment, inertGitArguments } from "./gitProcess.js";
12
+ import { writePrivateJsonFileAtomically } from "./utils/atomicJson.js";
8
13
  const Sha = z.string().regex(/^[a-f0-9]{40}$/u);
9
14
  const Digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
10
- export const ReviewArtifactSchema = z
11
- .object({
15
+ const Text = z.string().trim().min(1);
16
+ const Effort = z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra", "inherited"]);
17
+ const ReviewBase = z.strictObject({ baseSha: Sha, mergeBaseSha: Sha });
18
+ const Reuse = z.strictObject({ fromReviewId: z.number().int().positive(), verificationResultPath: Text });
19
+ const ReviewVerdictSchema = z.strictObject({
20
+ schemaVersion: z.literal("ai-delivery.review-verdict@1"),
21
+ verdict: z.enum(["approve", "request-changes"]),
22
+ summary: Text,
23
+ issueNumber: z.number().int().positive(),
24
+ scope: z.strictObject({
25
+ headSha: Sha,
26
+ headTree: Sha,
27
+ changedPaths: z.array(
28
+ z.string().min(1).refine((path) => !path.includes("\0"), "Paths cannot contain NUL.")
29
+ ).transform((paths) => [...new Set(paths)].sort())
30
+ }),
31
+ verificationReproduced: z.array(Text).min(1),
32
+ requestedModel: Text,
33
+ requestedEffort: Effort.default("inherited"),
34
+ effectiveModel: Text,
35
+ effectiveEffort: Effort.default("inherited"),
36
+ elapsedMs: z.number().int().nonnegative(),
37
+ findings: z.array(Text),
38
+ readOnly: z.literal(true),
39
+ nonClosing: z.boolean().optional(),
40
+ reuse: Reuse.optional()
41
+ });
42
+ function parseReviewVerdict(raw) {
43
+ let value;
44
+ try {
45
+ value = typeof raw === "string" ? JSON.parse(raw) : raw;
46
+ } catch {
47
+ throw new DeliveryError("verdict: Invalid JSON.");
48
+ }
49
+ const result = ReviewVerdictSchema.safeParse(value);
50
+ if (!result.success)
51
+ throw new DeliveryError(
52
+ result.error.issues.map((issue) => `${issue.path.join(".") || "verdict"}: ${issue.message}`).join("; ")
53
+ );
54
+ return result.data;
55
+ }
56
+ function buildReviewArtifact(input) {
57
+ const verdict = parseReviewVerdict(input.verdict);
58
+ if (!Digest.safeParse(input.verdictFileSha256).success)
59
+ throw new DeliveryError("verdictFileSha256: Expected the exact verdict-file SHA256.");
60
+ if (input.identity.toLowerCase() === input.authorIdentity.toLowerCase())
61
+ throw new DeliveryError("identity: Reviewer and author must be distinct.");
62
+ assertReviewVerdictTarget(verdict, input.provider, input.expectedHead);
63
+ const content = {
64
+ schemaVersion: "ai-delivery.review-artifact@1",
65
+ verdictFileSha256: input.verdictFileSha256,
66
+ authorIdentity: input.authorIdentity,
67
+ reviewerIdentity: input.identity,
68
+ head: { sha: verdict.scope.headSha, tree: verdict.scope.headTree },
69
+ issueNumber: verdict.issueNumber,
70
+ prNumber: input.prNumber,
71
+ diffScopeHash: digestValue(verdict.scope.changedPaths),
72
+ changedPaths: verdict.scope.changedPaths,
73
+ ...input.reviewBase === void 0 ? {} : { reviewBase: input.reviewBase },
74
+ ...verdict.reuse === void 0 ? {} : { reuse: verdict.reuse },
75
+ checks: verdict.verificationReproduced,
76
+ elapsedMs: verdict.elapsedMs,
77
+ findings: verdict.findings,
78
+ readOnly: verdict.readOnly,
79
+ requestedModel: verdict.requestedModel,
80
+ requestedEffort: verdict.requestedEffort,
81
+ effectiveModel: verdict.effectiveModel,
82
+ effectiveEffort: verdict.effectiveEffort,
83
+ summary: verdict.summary,
84
+ verdict: verdict.verdict
85
+ };
86
+ const artifact = ReviewArtifactSchema.parse({ ...content, artifactId: digestValue(content) });
87
+ githubReviewBody(artifact);
88
+ return artifact;
89
+ }
90
+ function assertReviewVerdictTarget(verdict, selectedProvider, expectedHead) {
91
+ const provider = (model) => /^(?:gpt-|o[134](?:-|$))/u.test(model) ? "openai" : model.startsWith("claude-") ? "anthropic" : model.startsWith("gemini-") ? "google" : /^qwen[\d.-]/iu.test(model) ? "qwen" : null;
92
+ if (provider(verdict.requestedModel) === null || provider(verdict.requestedModel) !== selectedProvider || provider(verdict.effectiveModel) !== selectedProvider)
93
+ throw new DeliveryError(
94
+ "identity: Configured reviewer provider must match both requestedModel and effectiveModel families."
95
+ );
96
+ if (!Sha.safeParse(expectedHead).success || expectedHead !== verdict.scope.headSha)
97
+ throw new DeliveryError("scope.headSha: Verdict and requested exact head differ.");
98
+ }
99
+ const ReviewArtifactSchema = z.object({
100
+ artifactId: Digest,
101
+ verdictFileSha256: Digest.optional(),
102
+ authorIdentity: z.string().min(1),
103
+ checks: z.array(z.string().min(1)).min(1),
104
+ diffScopeHash: Digest,
105
+ deliveryMetrics: z.object({ blockerTimeMs: z.number().int().nonnegative().nullable(), reviewRound: z.number().int().positive() }).strict().optional(),
106
+ elapsedMs: z.number().int().nonnegative(),
107
+ findings: z.array(z.string()),
108
+ head: z.object({ sha: Sha, tree: Sha }).strict(),
109
+ reviewBase: ReviewBase.optional(),
110
+ reuse: Reuse.optional(),
111
+ reusedFrom: z.strictObject({
112
+ reviewId: z.number().int().positive(),
12
113
  artifactId: Digest,
13
- authorIdentity: z.string().min(1),
14
- checks: z.array(z.string().min(1)).min(1),
15
- diffScopeHash: Digest,
16
- deliveryMetrics: z
17
- .object({ blockerTimeMs: z.number().int().nonnegative().nullable(), reviewRound: z.number().int().positive() })
18
- .strict()
19
- .optional(),
20
- elapsedMs: z.number().int().nonnegative(),
21
- findings: z.array(z.string()),
22
- head: z.object({ sha: Sha, tree: Sha }).strict(),
23
- issueNumber: z.number().int().positive(),
24
- prNumber: z.number().int().positive().nullable(),
25
- readOnly: z.literal(true),
26
- requestedEffort: z.string().min(1),
27
- requestedModel: z.string().min(1),
28
- effectiveEffort: z.string().min(1),
29
- effectiveModel: z.string().min(1),
30
- reviewerIdentity: z.string().min(1),
31
- schemaVersion: z.literal('ai-delivery.review-artifact@1'),
32
- summary: z.string().min(1),
33
- verdict: z.enum(['approve', 'request-changes']),
34
- })
35
- .strict()
36
- .superRefine((artifact, ctx) => {
37
- const { artifactId, ...content } = artifact;
38
- if (artifactId !== digestValue(content) || artifact.authorIdentity === artifact.reviewerIdentity) {
39
- ctx.addIssue({ code: 'custom', message: 'Review artifact identity or role separation is invalid.' });
40
- }
114
+ oldHead: Sha,
115
+ newHead: Sha,
116
+ reason: Text
117
+ }).optional(),
118
+ changedPaths: z.array(
119
+ z.string().min(1).refine((path) => !path.includes("\0"))
120
+ ).optional(),
121
+ issueNumber: z.number().int().positive(),
122
+ prNumber: z.number().int().positive().nullable(),
123
+ readOnly: z.literal(true),
124
+ requestedEffort: z.string().min(1),
125
+ requestedModel: z.string().min(1),
126
+ effectiveEffort: z.string().min(1),
127
+ effectiveModel: z.string().min(1),
128
+ reviewerIdentity: z.string().min(1),
129
+ schemaVersion: z.literal("ai-delivery.review-artifact@1"),
130
+ summary: z.string().min(1),
131
+ verdict: z.enum(["approve", "request-changes"])
132
+ }).strict().superRefine((artifact, ctx) => {
133
+ const { artifactId, ...content } = artifact;
134
+ if (artifactId !== digestValue(content) || artifact.authorIdentity === artifact.reviewerIdentity || artifact.changedPaths !== void 0 && artifact.diffScopeHash !== digestValue(artifact.changedPaths)) {
135
+ ctx.addIssue({ code: "custom", message: "Review artifact identity or role separation is invalid." });
136
+ }
41
137
  });
42
- export const SubmittedReviewReceiptSchema = z
43
- .object({
44
- artifact: ReviewArtifactSchema,
45
- completedAt: z.iso.datetime(),
46
- githubReviewId: z.number().int().positive(),
47
- githubReviewUrl: z.url(),
48
- headSha: Sha,
49
- login: z.string().min(1),
50
- prNumber: z.number().int().positive(),
51
- publicationEvidenceId: Digest,
52
- receiptId: Digest,
53
- schemaVersion: z.literal('ai-delivery.review-receipt@1'),
54
- state: z.literal('APPROVED'),
55
- })
56
- .strict()
57
- .superRefine((receipt, ctx) => {
58
- const { receiptId, ...content } = receipt;
59
- if (receiptId !== digestValue(content) ||
60
- receipt.headSha !== receipt.artifact.head.sha ||
61
- (receipt.artifact.prNumber !== null && receipt.artifact.prNumber !== receipt.prNumber)) {
62
- ctx.addIssue({ code: 'custom', message: 'Submitted review receipt is not bound to its artifact.' });
63
- }
138
+ const SubmittedReviewReceiptSchema = z.object({
139
+ artifact: ReviewArtifactSchema,
140
+ completedAt: z.iso.datetime(),
141
+ githubReviewId: z.number().int().positive(),
142
+ githubReviewUrl: z.url(),
143
+ headSha: Sha,
144
+ login: z.string().min(1),
145
+ prNumber: z.number().int().positive(),
146
+ publicationEvidenceId: Digest,
147
+ receiptId: Digest,
148
+ schemaVersion: z.literal("ai-delivery.review-receipt@1"),
149
+ state: z.literal("APPROVED")
150
+ }).strict().superRefine((receipt, ctx) => {
151
+ const { receiptId, ...content } = receipt;
152
+ if (receiptId !== digestValue(content) || receipt.headSha !== receipt.artifact.head.sha || receipt.artifact.prNumber !== null && receipt.artifact.prNumber !== receipt.prNumber) {
153
+ ctx.addIssue({ code: "custom", message: "Submitted review receipt is not bound to its artifact." });
154
+ }
64
155
  });
65
- /** GitHub's PR decision is the live requirement state, not the state of one submitted review. */
66
- export async function readRequiredReviewState(context, prNumber, expectedHead, submittedReview) {
67
- let response;
156
+ async function readRequiredReviewState(context, prNumber, expectedHead, submittedReview) {
157
+ let response;
158
+ try {
159
+ response = await context.clients.graphql(
160
+ "query DeliveryReviewDecision($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { headRefOid reviewDecision } } }",
161
+ { owner: context.repo.owner, name: context.repo.repo, number: prNumber }
162
+ );
163
+ } catch {
164
+ return {
165
+ observed: false,
166
+ reviewDecision: null,
167
+ submittedReviewAuthorCanPushToRepository: null,
168
+ status: "unknown",
169
+ nextAction: "Inspect the PR review requirement in GitHub before merge; review decision readback is unavailable."
170
+ };
171
+ }
172
+ const pr = response.repository?.pullRequest;
173
+ if (!pr) {
174
+ return {
175
+ observed: false,
176
+ reviewDecision: null,
177
+ submittedReviewAuthorCanPushToRepository: null,
178
+ status: "unknown",
179
+ nextAction: "Inspect the PR review requirement in GitHub before merge; PR decision readback is unavailable."
180
+ };
181
+ }
182
+ if (pr.headRefOid !== expectedHead) {
183
+ throw new DeliveryError("GitHub review decision does not match the exact PR head.");
184
+ }
185
+ if (pr.reviewDecision !== null && pr.reviewDecision !== "APPROVED" && pr.reviewDecision !== "REVIEW_REQUIRED" && pr.reviewDecision !== "CHANGES_REQUESTED") {
186
+ return {
187
+ observed: false,
188
+ reviewDecision: null,
189
+ submittedReviewAuthorCanPushToRepository: null,
190
+ status: "unknown",
191
+ nextAction: "Inspect the PR review requirement in GitHub before merge; review decision readback is malformed."
192
+ };
193
+ }
194
+ let submittedReviewAuthorCanPushToRepository = null;
195
+ if (submittedReview) {
68
196
  try {
69
- response = await context.clients.graphql('query DeliveryReviewDecision($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { headRefOid reviewDecision } } }', { owner: context.repo.owner, name: context.repo.repo, number: prNumber });
70
- }
71
- catch {
72
- return {
73
- observed: false,
74
- reviewDecision: null,
75
- submittedReviewAuthorCanPushToRepository: null,
76
- status: 'unknown',
77
- nextAction: 'Inspect the PR review requirement in GitHub before merge; review decision readback is unavailable.',
78
- };
79
- }
80
- const pr = response.repository?.pullRequest;
81
- if (!pr) {
82
- return {
83
- observed: false,
84
- reviewDecision: null,
85
- submittedReviewAuthorCanPushToRepository: null,
86
- status: 'unknown',
87
- nextAction: 'Inspect the PR review requirement in GitHub before merge; PR decision readback is unavailable.',
88
- };
89
- }
90
- if (pr.headRefOid !== expectedHead) {
91
- throw new DeliveryError('GitHub review decision does not match the exact PR head.');
92
- }
93
- if (pr.reviewDecision !== null &&
94
- pr.reviewDecision !== 'APPROVED' &&
95
- pr.reviewDecision !== 'REVIEW_REQUIRED' &&
96
- pr.reviewDecision !== 'CHANGES_REQUESTED') {
97
- return {
98
- observed: false,
99
- reviewDecision: null,
100
- submittedReviewAuthorCanPushToRepository: null,
101
- status: 'unknown',
102
- nextAction: 'Inspect the PR review requirement in GitHub before merge; review decision readback is malformed.',
103
- };
104
- }
105
- let submittedReviewAuthorCanPushToRepository = null;
106
- if (submittedReview) {
107
- try {
108
- const access = await context.clients.graphql('query DeliveryReviewAccess($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { reviews(last: 100) { nodes { fullDatabaseId author { login } authorCanPushToRepository commit { oid } state } } } } }', { owner: context.repo.owner, name: context.repo.repo, number: prNumber });
109
- // REST review receipts include [bot], while GraphQL may omit it for the same App actor.
110
- const submittedActor = submittedReview.login.toLowerCase().replace(/\[bot\]$/u, '');
111
- const exact = access.repository?.pullRequest?.reviews.nodes.find((review) => review !== null &&
112
- String(review.fullDatabaseId) === String(submittedReview.id) &&
113
- review.author?.login.toLowerCase().replace(/\[bot\]$/u, '') === submittedActor &&
114
- review.commit?.oid === expectedHead &&
115
- review.state === 'APPROVED');
116
- if (typeof exact?.authorCanPushToRepository === 'boolean') {
117
- submittedReviewAuthorCanPushToRepository = exact.authorCanPushToRepository;
118
- }
119
- }
120
- catch {
121
- // A review access read failure does not erase the live PR decision.
122
- }
123
- }
124
- if (pr.reviewDecision === 'APPROVED') {
125
- return {
126
- observed: true,
127
- reviewDecision: 'APPROVED',
128
- submittedReviewAuthorCanPushToRepository,
129
- status: 'satisfied',
130
- nextAction: 'Continue only after required checks pass.',
131
- };
132
- }
133
- if (pr.reviewDecision === 'REVIEW_REQUIRED') {
134
- return {
135
- observed: true,
136
- reviewDecision: 'REVIEW_REQUIRED',
137
- submittedReviewAuthorCanPushToRepository,
138
- status: 'still-required',
139
- nextAction: submittedReviewAuthorCanPushToRepository === false
140
- ? 'GitHub still requires a qualifying approval; the submitted reviewer App review has no repository write access. Inspect the active rule and the App installation Contents grant, then obtain approval from an eligible independent reviewer.'
141
- : 'GitHub still requires a qualifying approval. Inspect the active rule and obtain approval from an eligible independent reviewer; do not change actors or protections automatically.',
142
- };
143
- }
144
- if (pr.reviewDecision === 'CHANGES_REQUESTED') {
145
- return {
146
- observed: true,
147
- reviewDecision: 'CHANGES_REQUESTED',
148
- submittedReviewAuthorCanPushToRepository,
149
- status: 'changes-requested',
150
- nextAction: 'Resolve the blocking review and obtain a fresh exact-head independent approval.',
151
- };
197
+ const access = await context.clients.graphql(
198
+ "query DeliveryReviewAccess($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { reviews(last: 100) { nodes { fullDatabaseId author { login } authorCanPushToRepository commit { oid } state } } } } }",
199
+ { owner: context.repo.owner, name: context.repo.repo, number: prNumber }
200
+ );
201
+ const submittedActor = submittedReview.login.toLowerCase().replace(/\[bot\]$/u, "");
202
+ const exact = access.repository?.pullRequest?.reviews.nodes.find(
203
+ (review) => review !== null && String(review.fullDatabaseId) === String(submittedReview.id) && review.author?.login.toLowerCase().replace(/\[bot\]$/u, "") === submittedActor && review.commit?.oid === expectedHead && review.state === (submittedReview.state ?? "APPROVED")
204
+ );
205
+ if (typeof exact?.authorCanPushToRepository === "boolean") {
206
+ submittedReviewAuthorCanPushToRepository = exact.authorCanPushToRepository;
207
+ }
208
+ } catch {
152
209
  }
210
+ }
211
+ if (pr.reviewDecision === "APPROVED") {
212
+ return {
213
+ observed: true,
214
+ reviewDecision: "APPROVED",
215
+ submittedReviewAuthorCanPushToRepository,
216
+ status: "satisfied",
217
+ nextAction: "Continue only after required checks pass."
218
+ };
219
+ }
220
+ if (pr.reviewDecision === "REVIEW_REQUIRED") {
221
+ return {
222
+ observed: true,
223
+ reviewDecision: "REVIEW_REQUIRED",
224
+ submittedReviewAuthorCanPushToRepository,
225
+ status: "still-required",
226
+ nextAction: submittedReviewAuthorCanPushToRepository === false ? "GitHub still requires a qualifying approval; the submitted reviewer App review has no repository write access. Inspect the active rule and the App installation Contents grant, then obtain approval from an eligible independent reviewer." : "GitHub still requires a qualifying approval. Inspect the active rule and obtain approval from an eligible independent reviewer; do not change actors or protections automatically."
227
+ };
228
+ }
229
+ if (pr.reviewDecision === "CHANGES_REQUESTED") {
153
230
  return {
154
- observed: true,
155
- reviewDecision: null,
156
- submittedReviewAuthorCanPushToRepository,
157
- status: 'unknown',
158
- nextAction: 'Inspect the PR review requirement in GitHub before merge; no required-review decision was exposed.',
231
+ observed: true,
232
+ reviewDecision: "CHANGES_REQUESTED",
233
+ submittedReviewAuthorCanPushToRepository,
234
+ status: "changes-requested",
235
+ nextAction: "Resolve the blocking review and obtain a fresh exact-head independent approval."
159
236
  };
237
+ }
238
+ return {
239
+ observed: true,
240
+ reviewDecision: null,
241
+ submittedReviewAuthorCanPushToRepository,
242
+ status: "unknown",
243
+ nextAction: "Inspect the PR review requirement in GitHub before merge; no required-review decision was exposed."
244
+ };
160
245
  }
161
- export function parseReviewArtifact(raw) {
162
- const value = typeof raw === 'string' ? JSON.parse(raw) : raw;
163
- return ReviewArtifactSchema.parse(value);
246
+ function parseReviewArtifact(raw) {
247
+ const value = typeof raw === "string" ? JSON.parse(raw) : raw;
248
+ return ReviewArtifactSchema.parse(value);
164
249
  }
165
- /** Preserve the original binding: GitHub can remap a review's commit_id after a rebase. */
166
- export function parseGitHubReviewArtifact(body) {
167
- try {
168
- if (typeof body !== 'string' || Buffer.byteLength(body, 'utf8') > 64 * 1024)
169
- throw new Error('Invalid size.');
170
- const markers = body.match(/<!-- ai-delivery-review-artifact:[\s\S]*?-->/gu) ?? [];
171
- const payloads = body.match(/<!-- ai-delivery-review-artifact-data:[\s\S]*?-->/gu) ?? [];
172
- if (markers.length !== 1 || payloads.length !== 1)
173
- throw new Error('Ambiguous binding.');
174
- const id = markers[0].match(/^<!-- ai-delivery-review-artifact: (sha256:[a-f0-9]{64}) -->$/u)?.[1];
175
- const encoded = payloads[0].match(/^<!-- ai-delivery-review-artifact-data: ([A-Za-z0-9_-]+) -->$/u)?.[1];
176
- if (!id || !encoded)
177
- throw new Error('Invalid binding.');
178
- const bytes = Buffer.from(encoded, 'base64url');
179
- const json = bytes.toString('utf8');
180
- if (bytes.toString('base64url') !== encoded || !Buffer.from(json, 'utf8').equals(bytes))
181
- throw new Error('Invalid encoding.');
182
- const artifact = parseReviewArtifact(json);
183
- if (artifact.artifactId !== id)
184
- throw new Error('Artifact identity differs.');
185
- return artifact;
186
- }
187
- catch {
188
- throw new DeliveryError('GitHub review artifact binding is missing, invalid or ambiguous; obtain a fresh review.');
189
- }
250
+ function parseGitHubReviewArtifact(body) {
251
+ try {
252
+ if (typeof body !== "string" || Buffer.byteLength(body, "utf8") > 64 * 1024) throw new Error("Invalid size.");
253
+ const markers = body.match(/<!-- ai-delivery-review-artifact:[\s\S]*?-->/gu) ?? [];
254
+ const payloads = body.match(/<!-- ai-delivery-review-artifact-data:[\s\S]*?-->/gu) ?? [];
255
+ if (markers.length !== 1 || payloads.length !== 1) throw new Error("Ambiguous binding.");
256
+ const id = markers[0].match(/^<!-- ai-delivery-review-artifact: (sha256:[a-f0-9]{64}) -->$/u)?.[1];
257
+ const encoded = payloads[0].match(/^<!-- ai-delivery-review-artifact-data: ([A-Za-z0-9_-]+) -->$/u)?.[1];
258
+ if (!id || !encoded) throw new Error("Invalid binding.");
259
+ const bytes = Buffer.from(encoded, "base64url");
260
+ const json = bytes.toString("utf8");
261
+ if (bytes.toString("base64url") !== encoded || !Buffer.from(json, "utf8").equals(bytes))
262
+ throw new Error("Invalid encoding.");
263
+ const artifact = parseReviewArtifact(json);
264
+ if (artifact.artifactId !== id) throw new Error("Artifact identity differs.");
265
+ return artifact;
266
+ } catch {
267
+ throw new DeliveryError("GitHub review artifact binding is missing, invalid or ambiguous; obtain a fresh review.");
268
+ }
190
269
  }
191
270
  function githubReviewBody(artifact) {
192
- ReviewArtifactSchema.parse(artifact);
193
- const body = `${artifact.summary}\n\n<!-- ai-delivery-review-artifact: ${artifact.artifactId} -->\n<!-- ai-delivery-review-artifact-data: ${Buffer.from(JSON.stringify(artifact)).toString('base64url')} -->`;
194
- parseGitHubReviewArtifact(body);
195
- return body;
271
+ ReviewArtifactSchema.parse(artifact);
272
+ const metadata = artifact.verdictFileSha256 === void 0 ? "" : `
273
+
274
+ Verdict: ${artifact.verdict}
275
+ Requested model/effort: ${artifact.requestedModel} / ${artifact.requestedEffort}
276
+ Effective model/effort: ${artifact.effectiveModel} / ${artifact.effectiveEffort}
277
+ Elapsed milliseconds: ${artifact.elapsedMs}
278
+ Verdict-file SHA256: ${artifact.verdictFileSha256}
279
+ Findings: ${artifact.findings.length ? artifact.findings.join("; ") : "none"}`;
280
+ const body = `${artifact.summary}${metadata}
281
+
282
+ <!-- ai-delivery-review-artifact: ${artifact.artifactId} -->
283
+ <!-- ai-delivery-review-artifact-data: ${Buffer.from(JSON.stringify(artifact)).toString("base64url")} -->`;
284
+ if (Buffer.byteLength(body) > 64 * 1024)
285
+ throw new DeliveryError("Review body exceeds the 64 KiB publication limit; provide a concise verdict.");
286
+ parseGitHubReviewArtifact(body);
287
+ return body;
196
288
  }
197
- export async function readGitHubPrScopeHash(context, prNumber, changedFiles) {
198
- const files = [];
199
- for (let page = 1; page <= 30; page++) {
200
- const batch = (await context.clients.rest.pulls.listFiles({ ...context.repo, pull_number: prNumber, page, per_page: 100 })).data;
201
- files.push(...batch.map((file) => file.filename));
202
- if (batch.length < 100)
203
- break;
204
- }
205
- if (!Number.isSafeInteger(changedFiles) || files.length !== changedFiles || new Set(files).size !== files.length)
206
- throw new DeliveryError('Independent review scope is incomplete or differs from the remote PR diff.');
207
- return digestValue(files.sort());
289
+ async function readGitHubPrPaths(context, prNumber, changedFiles, claimed) {
290
+ const files = [];
291
+ const renamed = /* @__PURE__ */ new Set();
292
+ for (let page = 1; page <= 30; page++) {
293
+ const batch = (await context.clients.rest.pulls.listFiles({ ...context.repo, pull_number: prNumber, page, per_page: 100 })).data;
294
+ files.push(...batch.map((file) => file.filename));
295
+ for (const file of batch)
296
+ if (file.status === "renamed" && file.previous_filename) renamed.add(file.previous_filename);
297
+ if (batch.length < 100) break;
298
+ }
299
+ if (!Number.isSafeInteger(changedFiles) || files.length !== changedFiles || new Set(files).size !== files.length)
300
+ throw new DeliveryError("Independent review scope is incomplete or differs from the remote PR diff.");
301
+ const current = new Set(files);
302
+ if (claimed && digestValue([...new Set(claimed.filter((path) => current.has(path) || !renamed.has(path)))].sort()) !== digestValue(files.sort()))
303
+ throw new DeliveryError("Independent review scope differs from the canonical remote rename inventory.");
304
+ return files.sort();
208
305
  }
209
- export function reviewArtifactApproval(input) {
210
- const { artifact, classification, config } = input;
211
- ReviewArtifactSchema.parse(artifact);
212
- if (artifact.verdict !== 'approve' ||
213
- artifact.issueNumber !== input.issueNumber ||
214
- artifact.authorIdentity !== config.roles.author.identity ||
215
- artifact.reviewerIdentity !== config.roles.reviewer.identity ||
216
- artifact.head.sha !== classification.head.sha ||
217
- artifact.head.tree !== classification.head.tree ||
218
- artifact.diffScopeHash !== digestValue(classification.changedPaths) ||
219
- (input.prNumber !== undefined && artifact.prNumber !== null && artifact.prNumber !== input.prNumber)) {
220
- throw new DeliveryError('Independent review artifact is stale, foreign, rejected, or covers another scope.');
221
- }
222
- return RepositoryApprovalBindingSchema.parse({
223
- authorIdentity: artifact.authorIdentity,
224
- diffScopeHash: artifact.diffScopeHash,
225
- head: artifact.head,
226
- result: 'approved',
227
- reviewerIdentity: artifact.reviewerIdentity,
228
- reviewReceiptId: artifact.artifactId,
229
- });
306
+ async function readGitHubPrScopeHash(context, prNumber, changedFiles) {
307
+ return digestValue(await readGitHubPrPaths(context, prNumber, changedFiles));
308
+ }
309
+ async function readGitHubReviewBase(context, prNumber, expectedHead) {
310
+ const pr = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
311
+ if (pr.number !== prNumber || pr.state !== "open" || pr.head.sha !== expectedHead || !Sha.safeParse(pr.base.sha).success)
312
+ throw new DeliveryError("Review comparison changed; obtain a fresh review.");
313
+ const comparison = (await context.clients.rest.repos.compareCommitsWithBasehead({
314
+ ...context.repo,
315
+ basehead: `${pr.base.sha}...${expectedHead}`,
316
+ per_page: 1
317
+ })).data;
318
+ return ReviewBase.parse({ baseSha: pr.base.sha, mergeBaseSha: comparison.merge_base_commit.sha });
319
+ }
320
+ function reviewArtifactApproval(input) {
321
+ const { artifact, classification, config } = input;
322
+ ReviewArtifactSchema.parse(artifact);
323
+ if (artifact.verdict !== "approve" || artifact.issueNumber !== input.issueNumber || artifact.authorIdentity !== config.roles.author.identity || artifact.reviewerIdentity !== config.roles.reviewer.identity || artifact.head.sha !== classification.head.sha || artifact.head.tree !== classification.head.tree || artifact.diffScopeHash !== digestValue(classification.changedPaths) || input.prNumber !== void 0 && artifact.prNumber !== null && artifact.prNumber !== input.prNumber) {
324
+ throw new DeliveryError("Independent review artifact is stale, foreign, rejected, or covers another scope.");
325
+ }
326
+ return RepositoryApprovalBindingSchema.parse({
327
+ authorIdentity: artifact.authorIdentity,
328
+ diffScopeHash: artifact.diffScopeHash,
329
+ head: artifact.head,
330
+ result: "approved",
331
+ reviewerIdentity: artifact.reviewerIdentity,
332
+ reviewReceiptId: artifact.artifactId
333
+ });
230
334
  }
231
335
  function receiptPath(repoRoot, issueNumber, headSha) {
232
- return join(gitCommonDir(repoRoot), 'ai-delivery', 'reviews', String(issueNumber), `${headSha}.json`);
336
+ return join(gitCommonDir(repoRoot), "ai-delivery", "reviews", String(issueNumber), `${headSha}.json`);
233
337
  }
234
338
  function prepublicationPath(repoRoot, issueNumber, headSha) {
235
- return join(gitCommonDir(repoRoot), 'ai-delivery', 'reviews', String(issueNumber), `${headSha}.prepublication.json`);
339
+ return join(gitCommonDir(repoRoot), "ai-delivery", "reviews", String(issueNumber), `${headSha}.prepublication.json`);
236
340
  }
237
- export function savePrepublicationArtifact(input) {
238
- if (input.artifact.prNumber !== null)
239
- throw new DeliveryError('Prepublication review must have a null PR number.');
240
- reviewArtifactApproval(input);
241
- writePrivateJsonFileAtomically(prepublicationPath(input.repoRoot, input.issueNumber, input.artifact.head.sha), input.artifact);
341
+ function savePrepublicationArtifact(input) {
342
+ if (input.artifact.prNumber !== null) throw new DeliveryError("Prepublication review must have a null PR number.");
343
+ reviewArtifactApproval(input);
344
+ writePrivateJsonFileAtomically(
345
+ prepublicationPath(input.repoRoot, input.issueNumber, input.artifact.head.sha),
346
+ input.artifact
347
+ );
242
348
  }
243
- export function loadPrepublicationArtifact(repoRoot, issueNumber, headSha) {
244
- let raw;
245
- try {
246
- raw = JSON.parse(assertPrivateFile(prepublicationPath(repoRoot, issueNumber, headSha)).toString('utf8'));
247
- }
248
- catch (error) {
249
- if (error.code === 'ENOENT')
250
- return null;
251
- throw new DeliveryError('Stored prepublication review is unreadable.');
252
- }
253
- return ReviewArtifactSchema.parse(raw);
349
+ function loadPrepublicationArtifact(repoRoot, issueNumber, headSha) {
350
+ let raw;
351
+ try {
352
+ raw = JSON.parse(assertPrivateFile(prepublicationPath(repoRoot, issueNumber, headSha)).toString("utf8"));
353
+ } catch (error) {
354
+ if (error.code === "ENOENT") return null;
355
+ throw new DeliveryError("Stored prepublication review is unreadable.");
356
+ }
357
+ return ReviewArtifactSchema.parse(raw);
254
358
  }
255
359
  async function listAllReviews(context, prNumber) {
256
- const reviews = [];
257
- for (let page = 1; page <= 20; page += 1) {
258
- const result = await context.clients.rest.pulls.listReviews({
259
- ...context.repo,
260
- pull_number: prNumber,
261
- per_page: 100,
262
- page,
263
- });
264
- reviews.push(...result.data);
265
- if (result.data.length < 100)
266
- return reviews;
267
- }
268
- throw new DeliveryError('Review history exceeds the bounded readback window.');
360
+ const reviews = [];
361
+ for (let page = 1; page <= 20; page += 1) {
362
+ const result = await context.clients.rest.pulls.listReviews({
363
+ ...context.repo,
364
+ pull_number: prNumber,
365
+ per_page: 100,
366
+ page
367
+ });
368
+ reviews.push(...result.data);
369
+ if (result.data.length < 100) return reviews;
370
+ }
371
+ throw new DeliveryError("Review history exceeds the bounded readback window.");
372
+ }
373
+ class ReviewSubmissionError extends DeliveryError {
374
+ constructor(message, submission) {
375
+ super(`${message} Reconcile this artifact's remote review before retrying; no automatic retry was attempted.`);
376
+ this.submission = submission;
377
+ }
378
+ submission;
379
+ }
380
+ async function validateReviewTarget(context, artifact, prNumber) {
381
+ const pr = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
382
+ if (pr.number !== prNumber || pr.head.sha !== artifact.head.sha || pr.state !== "open" || pr.base.repo?.full_name.toLowerCase() !== context.config.repository.toLowerCase() || pr.head.repo?.full_name.toLowerCase() !== context.config.repository.toLowerCase())
383
+ throw new DeliveryError("PR identity or head changed before formal review.");
384
+ const commit = (await context.clients.rest.git.getCommit({ ...context.repo, commit_sha: artifact.head.sha })).data;
385
+ if (commit.sha !== artifact.head.sha || commit.tree.sha !== artifact.head.tree)
386
+ throw new DeliveryError("Independent review tree differs from the remote commit.");
387
+ const reviewPaths = await readGitHubPrPaths(context, prNumber, pr.changed_files, artifact.changedPaths);
388
+ if (artifact.changedPaths === void 0 && artifact.diffScopeHash !== digestValue(reviewPaths))
389
+ throw new DeliveryError("Independent review scope is incomplete or differs from the remote PR diff.");
390
+ if (artifact.reviewBase && digestValue(artifact.reviewBase) !== digestValue(await readGitHubReviewBase(context, prNumber, artifact.head.sha)))
391
+ throw new DeliveryError("Review comparison changed; obtain a fresh review.");
392
+ return { ...pr, reviewPaths };
393
+ }
394
+ async function qualifyReviewReuse(context, artifact, prNumber, actor) {
395
+ try {
396
+ const request = artifact.reuse;
397
+ if (basename(request.verificationResultPath) !== "result.json") throw new Error("Verification is not finalized.");
398
+ const review = (await context.clients.rest.pulls.getReview({
399
+ ...context.repo,
400
+ pull_number: prNumber,
401
+ review_id: request.fromReviewId
402
+ })).data;
403
+ const original = parseGitHubReviewArtifact(review.body);
404
+ if (review.id !== request.fromReviewId || review.state !== "APPROVED" || review.commit_id !== original.head.sha || review.user?.login.toLowerCase() !== actor.toLowerCase() || original.verdict !== "approve" || artifact.verdict !== "approve" || original.prNumber !== prNumber || original.issueNumber !== artifact.issueNumber || original.authorIdentity !== artifact.authorIdentity || original.reviewerIdentity !== artifact.reviewerIdentity || !original.reviewBase || !artifact.reviewBase || original.head.sha === artifact.head.sha)
405
+ throw new Error("Original comparison unavailable.");
406
+ const root = context.root;
407
+ const base = original.reviewBase;
408
+ const next = artifact.reviewBase;
409
+ const mergeBase = (baseSha, headSha) => {
410
+ const sha = git(root, "merge-base", "--all", baseSha, headSha);
411
+ return Sha.parse(sha);
412
+ };
413
+ if (mergeBase(base.baseSha, original.head.sha) !== base.mergeBaseSha || mergeBase(next.baseSha, artifact.head.sha) !== next.mergeBaseSha || gitExitCode(root, "merge-base", "--is-ancestor", base.baseSha, next.baseSha) !== 0 || gitExitCode(root, "merge-base", "--is-ancestor", base.mergeBaseSha, next.mergeBaseSha) !== 0 || git(root, "rev-parse", `${original.head.sha}^{tree}`) !== original.head.tree)
414
+ throw new Error("History differs.");
415
+ const run = (args, input) => execFileSync(GIT_EXECUTABLE, [...inertGitArguments(root), ...args], {
416
+ cwd: root,
417
+ env: gitEnvironment(),
418
+ input,
419
+ timeout: 1e4,
420
+ maxBuffer: 4 * 1024 * 1024,
421
+ stdio: ["pipe", "pipe", "pipe"]
422
+ });
423
+ const diff = (from, to) => run([
424
+ "diff",
425
+ "--no-ext-diff",
426
+ "--no-textconv",
427
+ "--no-color",
428
+ "--no-renames",
429
+ "--no-relative",
430
+ "--src-prefix=a/",
431
+ "--dst-prefix=b/",
432
+ "--ignore-submodules=none",
433
+ "--binary",
434
+ "--full-index",
435
+ from,
436
+ to,
437
+ "--"
438
+ ]);
439
+ const before = diff(base.mergeBaseSha, original.head.sha);
440
+ const after = diff(next.mergeBaseSha, artifact.head.sha);
441
+ const patch = run(["patch-id", "--stable"], before);
442
+ if (!before.length || !before.equals(after) || !patch.equals(run(["patch-id", "--stable"], after)) || !Sha.safeParse(patch.toString("utf8").split(/\s/u)[0]).success)
443
+ throw new Error("Patch differs.");
444
+ const paths = [
445
+ ...new Set(
446
+ [
447
+ [base.mergeBaseSha, original.head.sha],
448
+ [next.mergeBaseSha, artifact.head.sha]
449
+ ].flatMap(
450
+ ([from, to]) => run(["diff", "--no-ext-diff", "--no-textconv", "--no-renames", "--name-only", "-z", from, to, "--"]).toString("utf8").split("\0").filter(Boolean)
451
+ )
452
+ )
453
+ ];
454
+ const touched = (from, to) => run([
455
+ "--literal-pathspecs",
456
+ "log",
457
+ "--format=",
458
+ "--name-only",
459
+ "-z",
460
+ "--full-history",
461
+ "--diff-merges=separate",
462
+ `${from}..${to}`,
463
+ "--",
464
+ ...paths
465
+ ]).length !== 0;
466
+ if (touched(base.mergeBaseSha, next.mergeBaseSha) || touched(base.baseSha, next.baseSha))
467
+ throw new Error("Base touched review paths.");
468
+ const gates = ["format", "lint", "types", "build", "tests", "inventory"];
469
+ const report = z.object({
470
+ schemaVersion: z.literal("contributor-checks@1"),
471
+ scope: z.literal("full"),
472
+ status: z.literal("passed"),
473
+ exitCode: z.literal(0),
474
+ fullSuccess: z.literal(true),
475
+ omitted: z.array(Text).length(0),
476
+ completedAt: z.iso.datetime(),
477
+ verifiedHead: z.strictObject({ sha: Sha, tree: Sha }),
478
+ gates: z.array(Text),
479
+ commands: z.array(
480
+ z.object({
481
+ stage: Text,
482
+ status: z.literal("passed"),
483
+ exitCode: z.literal(0),
484
+ cleanupConfirmed: z.literal(true)
485
+ })
486
+ )
487
+ }).parse(
488
+ JSON.parse(assertPrivateFile(request.verificationResultPath, { maxBytes: 4 * 1024 * 1024 }).toString("utf8"))
489
+ );
490
+ if (digestValue(report.gates) !== digestValue(gates) || digestValue(report.commands.map((command) => command.stage)) !== digestValue(gates) || digestValue(report.verifiedHead) !== digestValue(artifact.head) || git(root, "rev-parse", "HEAD") !== artifact.head.sha || git(root, "rev-parse", "HEAD^{tree}") !== artifact.head.tree || git(root, "status", "--porcelain", "--untracked-files=all") !== "")
491
+ throw new Error("Exact-head required verification unavailable.");
492
+ return {
493
+ reviewId: review.id,
494
+ artifactId: original.artifactId,
495
+ oldHead: original.head.sha,
496
+ newHead: artifact.head.sha,
497
+ reason: "Exact patch, untouched base paths and successful exact-head required verification."
498
+ };
499
+ } catch {
500
+ throw new DeliveryError(
501
+ "Clean-rebase reuse lacks complete unchanged-content and verification proof; obtain a fresh review."
502
+ );
503
+ }
269
504
  }
270
- export async function submitReview(input) {
271
- const { artifact, context, issueNumber, prNumber } = input;
272
- ReviewArtifactSchema.parse(artifact);
273
- if (artifact.verdict !== 'approve' ||
274
- artifact.issueNumber !== issueNumber ||
275
- artifact.authorIdentity !== context.config.roles.author.identity ||
276
- artifact.reviewerIdentity !== context.config.roles.reviewer.identity ||
277
- (artifact.prNumber !== null && artifact.prNumber !== prNumber))
278
- throw new DeliveryError('Independent review artifact is foreign or rejected.');
279
- if (context.clients.authSource !== 'app' || context.clients.role !== 'reviewer' || !context.clients.appActorLogin)
280
- throw new DeliveryError('Formal review requires the independent reviewer GitHub App role.');
281
- const pr = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
282
- if (pr.number !== prNumber ||
283
- pr.head.sha !== artifact.head.sha ||
284
- pr.state !== 'open' ||
285
- pr.base.repo?.full_name.toLowerCase() !== context.config.repository.toLowerCase() ||
286
- pr.head.repo?.full_name.toLowerCase() !== context.config.repository.toLowerCase())
287
- throw new DeliveryError('PR identity or head changed before formal review.');
288
- const actor = await context.clients.appActorLogin();
289
- if (!actor || !pr.user?.login || actor.toLowerCase() === pr.user.login.toLowerCase())
290
- throw new DeliveryError('Reviewer GitHub actor must differ from PR author.');
291
- const commit = (await context.clients.rest.git.getCommit({ ...context.repo, commit_sha: artifact.head.sha })).data;
292
- if (commit.sha !== artifact.head.sha || commit.tree.sha !== artifact.head.tree)
293
- throw new DeliveryError('Independent review tree differs from the remote commit.');
294
- if (artifact.diffScopeHash !== (await readGitHubPrScopeHash(context, prNumber, pr.changed_files)))
295
- throw new DeliveryError('Independent review scope is incomplete or differs from the remote PR diff.');
296
- const body = githubReviewBody(artifact);
297
- const marker = `<!-- ai-delivery-review-artifact: ${artifact.artifactId} -->`;
298
- const history = await listAllReviews(context, prNumber);
299
- const matches = history.filter((review) => review.body?.includes(marker));
300
- if (matches.length > 1)
301
- throw new DeliveryError('Conflicting GitHub reviews claim the same artifact identity.');
302
- const prior = matches[0];
303
- if (prior &&
304
- (prior.state !== 'APPROVED' ||
305
- prior.commit_id !== artifact.head.sha ||
306
- prior.user?.login.toLowerCase() !== actor.toLowerCase() ||
307
- !prior.html_url ||
308
- parseGitHubReviewArtifact(prior.body).artifactId !== artifact.artifactId))
309
- throw new DeliveryError('Prior GitHub review marker conflicts with exact-head approval.');
310
- const fresh = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
311
- if (fresh.head.sha !== artifact.head.sha || fresh.base.sha !== pr.base.sha || fresh.state !== 'open')
312
- throw new DeliveryError('PR moved during independent review validation.');
313
- if (input.dryRun)
314
- return { dryRun: true, artifactId: artifact.artifactId, headSha: artifact.head.sha };
315
- const submitted = prior ??
316
- (await context.clients.rest.pulls.createReview({
317
- ...context.repo,
318
- pull_number: prNumber,
319
- commit_id: artifact.head.sha,
320
- body,
321
- event: 'APPROVE',
322
- })).data;
323
- if (!submitted.id ||
324
- submitted.state !== 'APPROVED' ||
325
- submitted.commit_id !== artifact.head.sha ||
326
- submitted.user?.login.toLowerCase() !== actor.toLowerCase() ||
327
- !submitted.html_url)
328
- throw new DeliveryError('GitHub did not return complete exact-head independent approval.');
329
- const content = {
330
- artifact,
331
- repository: context.config.repository,
332
- baseSha: pr.base.sha,
333
- headSha: artifact.head.sha,
334
- githubReviewId: submitted.id,
335
- githubReviewUrl: submitted.html_url,
336
- login: submitted.user.login,
337
- prNumber,
338
- schemaVersion: 'ai-delivery.github-review@1',
339
- state: 'APPROVED',
505
+ async function submitReview(input) {
506
+ const { context, issueNumber, prNumber } = input;
507
+ let artifact = input.artifact;
508
+ ReviewArtifactSchema.parse(artifact);
509
+ if (artifact.issueNumber !== issueNumber || artifact.authorIdentity !== context.config.roles.author.identity || artifact.reviewerIdentity !== context.config.roles.reviewer.identity || artifact.prNumber !== null && artifact.prNumber !== prNumber)
510
+ throw new DeliveryError("Independent review artifact is foreign or rejected.");
511
+ if (context.clients.authSource !== "app" || context.clients.role !== "reviewer" || !context.clients.appActorLogin)
512
+ throw new DeliveryError("Formal review requires the independent reviewer GitHub App role.");
513
+ const pr = await validateReviewTarget(context, artifact, prNumber);
514
+ const actor = await context.clients.appActorLogin();
515
+ if (!actor || !pr.user?.login || actor.toLowerCase() === pr.user.login.toLowerCase())
516
+ throw new DeliveryError("Reviewer GitHub actor must differ from PR author.");
517
+ if (artifact.reusedFrom) throw new DeliveryError("Reuse requires current comparison proof; obtain a fresh review.");
518
+ const { artifactId: _artifactId, reuse, ...content } = artifact;
519
+ const canonical = {
520
+ ...content,
521
+ ...artifact.changedPaths === void 0 ? {} : { changedPaths: pr.reviewPaths, diffScopeHash: digestValue(pr.reviewPaths) },
522
+ ...reuse === void 0 ? {} : { reusedFrom: await qualifyReviewReuse(context, artifact, prNumber, actor) }
523
+ };
524
+ artifact = ReviewArtifactSchema.parse({ ...canonical, artifactId: digestValue(canonical) });
525
+ const body = githubReviewBody(artifact);
526
+ const expectedState = artifact.verdict === "approve" ? "APPROVED" : "CHANGES_REQUESTED";
527
+ const event = artifact.verdict === "approve" ? "APPROVE" : "REQUEST_CHANGES";
528
+ const marker = `<!-- ai-delivery-review-artifact: ${artifact.artifactId} -->`;
529
+ const history = await listAllReviews(context, prNumber);
530
+ const matches = history.filter((review) => review.body?.includes(marker));
531
+ if (matches.length > 1) throw new DeliveryError("Conflicting GitHub reviews claim the same artifact identity.");
532
+ const prior = matches[0];
533
+ if (prior && (prior.state !== expectedState || prior.commit_id !== artifact.head.sha || prior.user?.login.toLowerCase() !== actor.toLowerCase() || !prior.html_url || parseGitHubReviewArtifact(prior.body).artifactId !== artifact.artifactId))
534
+ throw new DeliveryError("Prior GitHub review marker conflicts with exact-head approval.");
535
+ const fresh = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
536
+ if (fresh.head.sha !== artifact.head.sha || fresh.base.sha !== pr.base.sha || fresh.state !== "open")
537
+ throw new DeliveryError("PR moved during independent review validation.");
538
+ if (input.dryRun) return { dryRun: true, artifactId: artifact.artifactId, headSha: artifact.head.sha };
539
+ const pending = {
540
+ artifactId: artifact.artifactId,
541
+ repository: context.config.repository,
542
+ headSha: artifact.head.sha,
543
+ prNumber
544
+ };
545
+ let submitted;
546
+ try {
547
+ submitted = prior ?? (await context.clients.rest.pulls.createReview({
548
+ ...context.repo,
549
+ pull_number: prNumber,
550
+ commit_id: artifact.head.sha,
551
+ body,
552
+ event
553
+ })).data;
554
+ } catch {
555
+ throw new ReviewSubmissionError("Review submission acknowledgement is unknown.", pending);
556
+ }
557
+ const known = {
558
+ ...pending,
559
+ ...submitted.id ? { githubReviewId: submitted.id } : {},
560
+ ...submitted.html_url ? { githubReviewUrl: submitted.html_url } : {}
561
+ };
562
+ try {
563
+ if (!submitted.id || submitted.state !== expectedState || submitted.commit_id !== artifact.head.sha || submitted.user?.login.toLowerCase() !== actor.toLowerCase() || !submitted.html_url)
564
+ throw new DeliveryError("GitHub did not return complete exact-head independent approval.");
565
+ const content2 = {
566
+ artifact,
567
+ repository: context.config.repository,
568
+ baseSha: pr.base.sha,
569
+ headSha: artifact.head.sha,
570
+ githubReviewId: submitted.id,
571
+ githubReviewUrl: submitted.html_url,
572
+ login: submitted.user.login,
573
+ prNumber,
574
+ schemaVersion: "ai-delivery.github-review@1",
575
+ state: expectedState
340
576
  };
341
- const receipt = { ...content, receiptId: digestValue(content) };
577
+ const receipt = { ...content2, receiptId: digestValue(content2) };
342
578
  const readback = (await context.clients.rest.pulls.getReview({ ...context.repo, pull_number: prNumber, review_id: submitted.id })).data;
343
- if (readback.id !== receipt.githubReviewId ||
344
- readback.html_url !== receipt.githubReviewUrl ||
345
- readback.state !== 'APPROVED' ||
346
- readback.commit_id !== receipt.headSha ||
347
- readback.user?.login !== receipt.login ||
348
- parseGitHubReviewArtifact(readback.body).artifactId !== artifact.artifactId)
349
- throw new DeliveryError('GitHub exact-head App review readback disagrees.');
579
+ if (readback.id !== receipt.githubReviewId || readback.html_url !== receipt.githubReviewUrl || readback.state !== expectedState || readback.commit_id !== receipt.headSha || readback.user?.login !== receipt.login || parseGitHubReviewArtifact(readback.body).artifactId !== artifact.artifactId)
580
+ throw new DeliveryError("GitHub exact-head App review readback disagrees.");
350
581
  const current = (await context.clients.rest.pulls.get({ ...context.repo, pull_number: prNumber })).data;
351
- if (current.head.sha !== artifact.head.sha || current.base.sha !== pr.base.sha || current.state !== 'open')
352
- throw new DeliveryError('PR moved during independent review submission; approval is not current.');
582
+ if (current.head.sha !== artifact.head.sha || current.base.sha !== pr.base.sha || current.state !== "open")
583
+ throw new DeliveryError("PR moved during independent review submission; approval is not current.");
353
584
  return receipt;
585
+ } catch (error) {
586
+ throw new ReviewSubmissionError(
587
+ error instanceof DeliveryError ? error.message : "Review post-submission readback is unavailable.",
588
+ known
589
+ );
590
+ }
354
591
  }
355
- export function loadSubmittedReview(repoRoot, issueNumber, headSha) {
356
- let raw;
357
- try {
358
- raw = JSON.parse(assertPrivateFile(receiptPath(repoRoot, issueNumber, headSha)).toString('utf8'));
359
- }
360
- catch (error) {
361
- if (error.code === 'ENOENT')
362
- return null;
363
- throw new DeliveryError('Stored review receipt is unreadable.');
364
- }
365
- return SubmittedReviewReceiptSchema.parse(raw);
592
+ function loadSubmittedReview(repoRoot, issueNumber, headSha) {
593
+ let raw;
594
+ try {
595
+ raw = JSON.parse(assertPrivateFile(receiptPath(repoRoot, issueNumber, headSha)).toString("utf8"));
596
+ } catch (error) {
597
+ if (error.code === "ENOENT") return null;
598
+ throw new DeliveryError("Stored review receipt is unreadable.");
599
+ }
600
+ return SubmittedReviewReceiptSchema.parse(raw);
366
601
  }
367
- export async function assertSubmittedReviewCurrent(context, receipt) {
368
- SubmittedReviewReceiptSchema.parse(receipt);
369
- const review = (await listAllReviews(context, receipt.prNumber)).find((candidate) => candidate.id === receipt.githubReviewId);
370
- if (!review ||
371
- review.state !== 'APPROVED' ||
372
- review.commit_id !== receipt.headSha ||
373
- review.user?.login !== receipt.login ||
374
- review.html_url !== receipt.githubReviewUrl ||
375
- parseGitHubReviewArtifact(review.body).artifactId !== receipt.artifact.artifactId) {
376
- throw new DeliveryError('GitHub exact-head review no longer matches the stored receipt.');
377
- }
602
+ async function assertSubmittedReviewCurrent(context, receipt) {
603
+ SubmittedReviewReceiptSchema.parse(receipt);
604
+ const review = (await listAllReviews(context, receipt.prNumber)).find(
605
+ (candidate) => candidate.id === receipt.githubReviewId
606
+ );
607
+ if (!review || review.state !== "APPROVED" || review.commit_id !== receipt.headSha || review.user?.login !== receipt.login || review.html_url !== receipt.githubReviewUrl || parseGitHubReviewArtifact(review.body).artifactId !== receipt.artifact.artifactId) {
608
+ throw new DeliveryError("GitHub exact-head review no longer matches the stored receipt.");
609
+ }
378
610
  }
379
- //# sourceMappingURL=review.js.map
611
+ export {
612
+ ReviewArtifactSchema,
613
+ ReviewSubmissionError,
614
+ ReviewVerdictSchema,
615
+ SubmittedReviewReceiptSchema,
616
+ assertReviewVerdictTarget,
617
+ assertSubmittedReviewCurrent,
618
+ buildReviewArtifact,
619
+ loadPrepublicationArtifact,
620
+ loadSubmittedReview,
621
+ parseGitHubReviewArtifact,
622
+ parseReviewArtifact,
623
+ parseReviewVerdict,
624
+ readGitHubPrScopeHash,
625
+ readGitHubReviewBase,
626
+ readRequiredReviewState,
627
+ reviewArtifactApproval,
628
+ savePrepublicationArtifact,
629
+ submitReview,
630
+ validateReviewTarget
631
+ };
632
+ //# sourceMappingURL=review.js.map