@loopover/engine 1.0.0

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 (272) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +661 -0
  3. package/README.md +676 -0
  4. package/dist/advisory/gate-advisory.d.ts +151 -0
  5. package/dist/advisory/gate-advisory.js +512 -0
  6. package/dist/ai-policy-map.d.ts +97 -0
  7. package/dist/ai-policy-map.js +377 -0
  8. package/dist/ams-policy-spec.d.ts +56 -0
  9. package/dist/ams-policy-spec.js +165 -0
  10. package/dist/calibration-dashboard.d.ts +23 -0
  11. package/dist/calibration-dashboard.js +65 -0
  12. package/dist/calibration-trend.d.ts +40 -0
  13. package/dist/calibration-trend.js +60 -0
  14. package/dist/contributor-fit.d.ts +24 -0
  15. package/dist/contributor-fit.js +50 -0
  16. package/dist/discovery-index-contract.d.ts +74 -0
  17. package/dist/discovery-index-contract.js +184 -0
  18. package/dist/discovery-soft-claim.d.ts +35 -0
  19. package/dist/discovery-soft-claim.js +50 -0
  20. package/dist/duplicate-winner.d.ts +57 -0
  21. package/dist/duplicate-winner.js +98 -0
  22. package/dist/feasibility.d.ts +27 -0
  23. package/dist/feasibility.js +86 -0
  24. package/dist/finding-severity-calibration.d.ts +116 -0
  25. package/dist/finding-severity-calibration.js +457 -0
  26. package/dist/fleet-run-manifest.d.ts +41 -0
  27. package/dist/fleet-run-manifest.js +151 -0
  28. package/dist/focus-manifest/guidance.d.ts +21 -0
  29. package/dist/focus-manifest/guidance.js +222 -0
  30. package/dist/focus-manifest.d.ts +826 -0
  31. package/dist/focus-manifest.js +2730 -0
  32. package/dist/gate-verdict-calibration.d.ts +111 -0
  33. package/dist/gate-verdict-calibration.js +411 -0
  34. package/dist/github/constants.d.ts +1 -0
  35. package/dist/github/constants.js +1 -0
  36. package/dist/github/sanitize-public-comment.d.ts +1 -0
  37. package/dist/github/sanitize-public-comment.js +26 -0
  38. package/dist/goal-model.d.ts +7 -0
  39. package/dist/goal-model.js +87 -0
  40. package/dist/governor/action-mode.d.ts +55 -0
  41. package/dist/governor/action-mode.js +74 -0
  42. package/dist/governor/budget-cap.d.ts +49 -0
  43. package/dist/governor/budget-cap.js +34 -0
  44. package/dist/governor/chokepoint.d.ts +58 -0
  45. package/dist/governor/chokepoint.js +269 -0
  46. package/dist/governor/kill-switch.d.ts +38 -0
  47. package/dist/governor/kill-switch.js +62 -0
  48. package/dist/governor/rate-limit.d.ts +40 -0
  49. package/dist/governor/rate-limit.js +63 -0
  50. package/dist/governor/reputation-throttle.d.ts +50 -0
  51. package/dist/governor/reputation-throttle.js +94 -0
  52. package/dist/governor/run-halt.d.ts +39 -0
  53. package/dist/governor/run-halt.js +83 -0
  54. package/dist/governor/self-plagiarism.d.ts +47 -0
  55. package/dist/governor/self-plagiarism.js +200 -0
  56. package/dist/governor/write-rate-limit.d.ts +52 -0
  57. package/dist/governor/write-rate-limit.js +132 -0
  58. package/dist/governor-ledger.d.ts +25 -0
  59. package/dist/governor-ledger.js +91 -0
  60. package/dist/index.d.ts +99 -0
  61. package/dist/index.js +120 -0
  62. package/dist/issue-plan-decomposition.d.ts +18 -0
  63. package/dist/issue-plan-decomposition.js +56 -0
  64. package/dist/issue-rag-query.d.ts +12 -0
  65. package/dist/issue-rag-query.js +35 -0
  66. package/dist/local-scorer.d.ts +34 -0
  67. package/dist/local-scorer.js +36 -0
  68. package/dist/metadata-best-min-score.d.ts +9 -0
  69. package/dist/metadata-best-min-score.js +9 -0
  70. package/dist/metadata-best-pick.d.ts +9 -0
  71. package/dist/metadata-best-pick.js +9 -0
  72. package/dist/metadata-min-score.d.ts +9 -0
  73. package/dist/metadata-min-score.js +13 -0
  74. package/dist/metadata-top-min-score.d.ts +9 -0
  75. package/dist/metadata-top-min-score.js +13 -0
  76. package/dist/metadata-top-pick.d.ts +9 -0
  77. package/dist/metadata-top-pick.js +13 -0
  78. package/dist/miner/acceptance-criteria.d.ts +43 -0
  79. package/dist/miner/acceptance-criteria.js +77 -0
  80. package/dist/miner/agent-sdk-driver.d.ts +39 -0
  81. package/dist/miner/agent-sdk-driver.js +162 -0
  82. package/dist/miner/attempt-log.d.ts +29 -0
  83. package/dist/miner/attempt-log.js +100 -0
  84. package/dist/miner/attempt-metering.d.ts +39 -0
  85. package/dist/miner/attempt-metering.js +67 -0
  86. package/dist/miner/cli-subprocess-driver.d.ts +68 -0
  87. package/dist/miner/cli-subprocess-driver.js +272 -0
  88. package/dist/miner/coding-agent-driver.d.ts +33 -0
  89. package/dist/miner/coding-agent-driver.js +36 -0
  90. package/dist/miner/coding-agent-invoke.d.ts +11 -0
  91. package/dist/miner/coding-agent-invoke.js +80 -0
  92. package/dist/miner/coding-agent-mode.d.ts +25 -0
  93. package/dist/miner/coding-agent-mode.js +43 -0
  94. package/dist/miner/driver-factory.d.ts +82 -0
  95. package/dist/miner/driver-factory.js +169 -0
  96. package/dist/miner/harness-submission-trigger.d.ts +37 -0
  97. package/dist/miner/harness-submission-trigger.js +46 -0
  98. package/dist/miner/iterate-loop.d.ts +97 -0
  99. package/dist/miner/iterate-loop.js +278 -0
  100. package/dist/miner/iterate-policy.d.ts +98 -0
  101. package/dist/miner/iterate-policy.js +98 -0
  102. package/dist/miner/lint-guard.d.ts +50 -0
  103. package/dist/miner/lint-guard.js +68 -0
  104. package/dist/miner/local-write-tools.d.ts +81 -0
  105. package/dist/miner/local-write-tools.js +113 -0
  106. package/dist/miner/loop-reentry-policy.d.ts +36 -0
  107. package/dist/miner/loop-reentry-policy.js +53 -0
  108. package/dist/miner/repo-map.d.ts +51 -0
  109. package/dist/miner/repo-map.js +268 -0
  110. package/dist/miner/self-review-adapter.d.ts +106 -0
  111. package/dist/miner/self-review-adapter.js +83 -0
  112. package/dist/miner/submission-gate.d.ts +40 -0
  113. package/dist/miner/submission-gate.js +89 -0
  114. package/dist/miner/worktree-allocator.d.ts +59 -0
  115. package/dist/miner/worktree-allocator.js +60 -0
  116. package/dist/miner/worktree-pool.d.ts +55 -0
  117. package/dist/miner/worktree-pool.js +65 -0
  118. package/dist/miner-goal-lane-fit.d.ts +18 -0
  119. package/dist/miner-goal-lane-fit.js +76 -0
  120. package/dist/miner-goal-spec.d.ts +139 -0
  121. package/dist/miner-goal-spec.js +281 -0
  122. package/dist/miner-prediction-metrics.d.ts +16 -0
  123. package/dist/miner-prediction-metrics.js +61 -0
  124. package/dist/miner-telemetry.d.ts +32 -0
  125. package/dist/miner-telemetry.js +87 -0
  126. package/dist/objective-anchor.d.ts +125 -0
  127. package/dist/objective-anchor.js +401 -0
  128. package/dist/opportunity-competition.d.ts +6 -0
  129. package/dist/opportunity-competition.js +29 -0
  130. package/dist/opportunity-freshness.d.ts +18 -0
  131. package/dist/opportunity-freshness.js +55 -0
  132. package/dist/opportunity-metadata.d.ts +53 -0
  133. package/dist/opportunity-metadata.js +204 -0
  134. package/dist/opportunity-ranker.d.ts +46 -0
  135. package/dist/opportunity-ranker.js +74 -0
  136. package/dist/pairwise-calibration.d.ts +49 -0
  137. package/dist/pairwise-calibration.js +106 -0
  138. package/dist/phase7-calibration-loop.d.ts +136 -0
  139. package/dist/phase7-calibration-loop.js +437 -0
  140. package/dist/plan-blocked.d.ts +6 -0
  141. package/dist/plan-blocked.js +24 -0
  142. package/dist/plan-completed.d.ts +5 -0
  143. package/dist/plan-completed.js +6 -0
  144. package/dist/plan-completion.d.ts +6 -0
  145. package/dist/plan-completion.js +7 -0
  146. package/dist/plan-empty.d.ts +5 -0
  147. package/dist/plan-empty.js +6 -0
  148. package/dist/plan-export.d.ts +27 -0
  149. package/dist/plan-export.js +86 -0
  150. package/dist/plan-failure.d.ts +5 -0
  151. package/dist/plan-failure.js +6 -0
  152. package/dist/plan-overall-status.d.ts +6 -0
  153. package/dist/plan-overall-status.js +25 -0
  154. package/dist/plan-pending.d.ts +5 -0
  155. package/dist/plan-pending.js +6 -0
  156. package/dist/plan-progress-complete.d.ts +7 -0
  157. package/dist/plan-progress-complete.js +10 -0
  158. package/dist/plan-ready.d.ts +6 -0
  159. package/dist/plan-ready.js +12 -0
  160. package/dist/plan-running.d.ts +5 -0
  161. package/dist/plan-running.js +6 -0
  162. package/dist/plan-skipped.d.ts +5 -0
  163. package/dist/plan-skipped.js +6 -0
  164. package/dist/plan-step-count.d.ts +5 -0
  165. package/dist/plan-step-count.js +6 -0
  166. package/dist/plan-step-stats.d.ts +5 -0
  167. package/dist/plan-step-stats.js +6 -0
  168. package/dist/plan-templates.d.ts +25 -0
  169. package/dist/plan-templates.js +107 -0
  170. package/dist/plan-terminated.d.ts +6 -0
  171. package/dist/plan-terminated.js +9 -0
  172. package/dist/portfolio/non-convergence.d.ts +37 -0
  173. package/dist/portfolio/non-convergence.js +57 -0
  174. package/dist/portfolio/queue.d.ts +30 -0
  175. package/dist/portfolio/queue.js +150 -0
  176. package/dist/predicted-gate.d.ts +103 -0
  177. package/dist/predicted-gate.js +218 -0
  178. package/dist/prompt-packet.d.ts +11 -0
  179. package/dist/prompt-packet.js +34 -0
  180. package/dist/ranked-opportunity-best-min-score.d.ts +8 -0
  181. package/dist/ranked-opportunity-best-min-score.js +9 -0
  182. package/dist/ranked-opportunity-best-pick.d.ts +8 -0
  183. package/dist/ranked-opportunity-best-pick.js +9 -0
  184. package/dist/ranked-opportunity-min-score.d.ts +8 -0
  185. package/dist/ranked-opportunity-min-score.js +13 -0
  186. package/dist/ranked-opportunity-top-min-score.d.ts +8 -0
  187. package/dist/ranked-opportunity-top-min-score.js +13 -0
  188. package/dist/review/advisory-ai-routing-config.d.ts +8 -0
  189. package/dist/review/advisory-ai-routing-config.js +40 -0
  190. package/dist/review/check-names.d.ts +1 -0
  191. package/dist/review/check-names.js +1 -0
  192. package/dist/review/cla-check.d.ts +49 -0
  193. package/dist/review/cla-check.js +71 -0
  194. package/dist/review/diff-file-priority.d.ts +1 -0
  195. package/dist/review/diff-file-priority.js +12 -0
  196. package/dist/review/enrichment-analyzer-names.d.ts +3 -0
  197. package/dist/review/enrichment-analyzer-names.js +63 -0
  198. package/dist/review/guardrail-config.d.ts +10 -0
  199. package/dist/review/guardrail-config.js +62 -0
  200. package/dist/review/linked-issue-hard-rules-config.d.ts +4 -0
  201. package/dist/review/linked-issue-hard-rules-config.js +79 -0
  202. package/dist/review/linked-issue-label-propagation.d.ts +9 -0
  203. package/dist/review/linked-issue-label-propagation.js +114 -0
  204. package/dist/review/pre-merge-checks.d.ts +28 -0
  205. package/dist/review/pre-merge-checks.js +66 -0
  206. package/dist/review/review-thread-findings.d.ts +1 -0
  207. package/dist/review/review-thread-findings.js +1 -0
  208. package/dist/review/safe-url.d.ts +5 -0
  209. package/dist/review/safe-url.js +137 -0
  210. package/dist/review/screenshot-table-gate.d.ts +87 -0
  211. package/dist/review/screenshot-table-gate.js +340 -0
  212. package/dist/review/unlinked-issue-guardrail-config.d.ts +9 -0
  213. package/dist/review/unlinked-issue-guardrail-config.js +44 -0
  214. package/dist/reviewer-consensus-calibration.d.ts +113 -0
  215. package/dist/reviewer-consensus-calibration.js +493 -0
  216. package/dist/reward-risk.d.ts +223 -0
  217. package/dist/reward-risk.js +618 -0
  218. package/dist/scoring/label-match.d.ts +4 -0
  219. package/dist/scoring/label-match.js +145 -0
  220. package/dist/scoring/model.d.ts +31 -0
  221. package/dist/scoring/model.js +157 -0
  222. package/dist/scoring/pending-pr-scenarios.d.ts +44 -0
  223. package/dist/scoring/pending-pr-scenarios.js +145 -0
  224. package/dist/scoring/preview.d.ts +246 -0
  225. package/dist/scoring/preview.js +1108 -0
  226. package/dist/scoring/types.d.ts +131 -0
  227. package/dist/scoring/types.js +7 -0
  228. package/dist/settings/auto-close-exempt.d.ts +10 -0
  229. package/dist/settings/auto-close-exempt.js +58 -0
  230. package/dist/settings/autonomy.d.ts +33 -0
  231. package/dist/settings/autonomy.js +80 -0
  232. package/dist/settings/command-authorization.d.ts +49 -0
  233. package/dist/settings/command-authorization.js +222 -0
  234. package/dist/settings/contributor-blacklist.d.ts +17 -0
  235. package/dist/settings/contributor-blacklist.js +86 -0
  236. package/dist/settings/moderation-rules.d.ts +51 -0
  237. package/dist/settings/moderation-rules.js +104 -0
  238. package/dist/settings/pr-type-label.d.ts +70 -0
  239. package/dist/settings/pr-type-label.js +149 -0
  240. package/dist/signals/change-guardrail.d.ts +49 -0
  241. package/dist/signals/change-guardrail.js +164 -0
  242. package/dist/signals/check-summary.d.ts +9 -0
  243. package/dist/signals/check-summary.js +12 -0
  244. package/dist/signals/contributor-calibration.d.ts +23 -0
  245. package/dist/signals/contributor-calibration.js +47 -0
  246. package/dist/signals/duplicate-winner.d.ts +9 -0
  247. package/dist/signals/duplicate-winner.js +9 -0
  248. package/dist/signals/path-matchers.d.ts +36 -0
  249. package/dist/signals/path-matchers.js +371 -0
  250. package/dist/signals/predicted-gate-engine.d.ts +62 -0
  251. package/dist/signals/predicted-gate-engine.js +895 -0
  252. package/dist/signals/preflight-limits.d.ts +14 -0
  253. package/dist/signals/preflight-limits.js +14 -0
  254. package/dist/signals/slop.d.ts +56 -0
  255. package/dist/signals/slop.js +324 -0
  256. package/dist/signals/test-evidence.d.ts +25 -0
  257. package/dist/signals/test-evidence.js +108 -0
  258. package/dist/subprocess-env.d.ts +23 -0
  259. package/dist/subprocess-env.js +74 -0
  260. package/dist/track-record-summary.d.ts +92 -0
  261. package/dist/track-record-summary.js +301 -0
  262. package/dist/types/manifest-deps-types.d.ts +514 -0
  263. package/dist/types/manifest-deps-types.js +4 -0
  264. package/dist/types/predicted-gate-types.d.ts +338 -0
  265. package/dist/types/predicted-gate-types.js +3 -0
  266. package/dist/types/reward-risk-types.d.ts +319 -0
  267. package/dist/types/reward-risk-types.js +11 -0
  268. package/dist/utils/json.d.ts +1 -0
  269. package/dist/utils/json.js +3 -0
  270. package/dist/version.d.ts +2 -0
  271. package/dist/version.js +3 -0
  272. package/package.json +80 -0
@@ -0,0 +1,151 @@
1
+ import type { Advisory, AdvisoryConclusion, AdvisoryFinding, AdvisorySeverity, GateRuleMode, PullRequestRecord, RepositoryRecord } from "../types/predicted-gate-types.js";
2
+ import type { GuardrailPathMatch } from "../signals/change-guardrail.js";
3
+ export type GateCheckConclusion = "success" | "failure" | "action_required" | "neutral" | "skipped";
4
+ export type GateCheckPolicy = {
5
+ linkedIssueGateMode?: GateRuleMode | undefined;
6
+ duplicatePrGateMode?: GateRuleMode | undefined;
7
+ /** Historical readiness-score mode. Retained for config compatibility, but readiness is informational only:
8
+ * a low readiness score may be surfaced as an advisory warning and must never fail the Gate check. */
9
+ qualityGateMode?: GateRuleMode | undefined;
10
+ qualityGateMinScore?: number | null | undefined;
11
+ /** When `block`, a dual-model AI consensus defect (`ai_consensus_defect` finding) becomes a hard
12
+ * blocker. Defaults to advisory — AI never blocks unless the maintainer opts in. */
13
+ aiReviewGateMode?: GateRuleMode | undefined;
14
+ /** Minimum calibrated confidence (0-1) configured for AI close calibration. AI defect findings still BLOCK the
15
+ * gate under `aiReviewGateMode: block` even when below this floor — the floor never turns a real defect into a
16
+ * non-blocker on its own. What varies below the floor is {@link aiReviewLowConfidenceDisposition}. `null`/
17
+ * undefined ⇒ the 0.93 default. */
18
+ aiReviewCloseConfidence?: number | null | undefined;
19
+ /** Disposition for a sub-floor `ai_consensus_defect`/`ai_review_split` finding (#4603) — see the host copy's
20
+ * doc comment (`src/rules/advisory.ts` / `src/types.ts`) for the full semantics. `null`/undefined ⇒
21
+ * `hold_for_review` (the shipped default). Only `advisory_only` changes what `isConfiguredGateBlocker` returns
22
+ * for these codes here; `one_shot`/`hold_for_review` are indistinguishable to this predictor (the
23
+ * `hold_for_review` vs `one_shot` difference is a disposition-planner concern this predictor doesn't model). */
24
+ aiReviewLowConfidenceDisposition?: "one_shot" | "hold_for_review" | "advisory_only" | undefined;
25
+ readinessScore?: number | null | undefined;
26
+ /** When `block`, the deterministic slop score becomes a hard blocker once `slopRisk >= slopGateMinScore`
27
+ * (default threshold 60, the `high` band). Defaults to off/advisory — slop never blocks unless opted in. */
28
+ slopGateMode?: GateRuleMode | undefined;
29
+ slopGateMinScore?: number | null | undefined;
30
+ slopRisk?: number | null | undefined;
31
+ /** Master "merge-readiness" composite (#551). When set (advisory/block) it OVERRIDES all four sub-gates —
32
+ * linked-issue, duplicate, quality/readiness, slop — to its mode, so a maintainer flips ONE switch instead
33
+ * of four and the review-agent check stays the single required check. `off` = sub-gates use their own modes. */
34
+ mergeReadinessGateMode?: GateRuleMode | undefined;
35
+ /** Focus-manifest policy gate (#555). When `block`, linked-issue/test policy findings become hard blockers.
36
+ * Path-based manual-review holds are configured only with `settings.hardGuardrailGlobs`.
37
+ * An INDEPENDENT dimension, deliberately NOT folded into the merge-readiness composite so #555 stays focused.
38
+ * `off`/`advisory` = the findings stay advisory (never block). Default off. */
39
+ manifestPolicyGateMode?: GateRuleMode | undefined;
40
+ /** Self-authored linked-issue gate. When `block`, a `self_authored_linked_issue` finding — raised when
41
+ * the PR author also filed the linked issue — becomes a hard blocker. Defaults to `advisory` — the
42
+ * finding is surfaced but never blocks unless the maintainer opts in. */
43
+ selfAuthoredLinkedIssueGateMode?: GateRuleMode | undefined;
44
+ /** CLA / license-compatibility gate (#2564). When `block`, a `cla_consent_missing` finding — raised when
45
+ * neither configured detection method (a consent phrase in the PR body, or a named CLA-bot check-run
46
+ * conclusion) confirms consent — becomes a hard blocker. `off` (default) = no finding at all; `advisory` =
47
+ * the finding surfaces but never blocks. Independent of every other gate dimension, like manifestPolicy. */
48
+ claGateMode?: GateRuleMode | undefined;
49
+ /** First-time-contributor grace (#552). RESERVED / currently INERT (#2266): threaded through from config,
50
+ * but evaluateGateCheckCore never reads it (see the removal note below) — a would-be blocker gates a
51
+ * genuine newcomer exactly like a repeat contributor. Kept for potential future use. */
52
+ firstTimeContributorGrace?: boolean | undefined;
53
+ /** The PR author's merged PR count in THIS repo. RESERVED / currently INERT (#2266) alongside
54
+ * firstTimeContributorGrace above — populated but never read by the gate evaluator today. */
55
+ authorMergedPrCount?: number | undefined;
56
+ /** The PR author's closed-unmerged PR count in THIS repo. RESERVED / currently INERT (#2266) alongside
57
+ * firstTimeContributorGrace above — populated but never read by the gate evaluator today. */
58
+ authorClosedUnmergedPrCount?: number | undefined;
59
+ /** The PR author's confirmed-Gittensor status. Carried for context/telemetry only — it no longer
60
+ * changes the gate verdict (every author is gated identically; a configured blocker fails the gate
61
+ * regardless of confirmed status, which now affects only on-chain scoring). `undefined` = unresolved.
62
+ * (#gate-nonconfirmed) */
63
+ confirmedContributor?: boolean | undefined;
64
+ /** PR-size HOLD (#gate-size). When set (advisory/block), a PR with >= sizeGateMaxFiles changed files OR
65
+ * >= sizeGateMaxLines changed (added+deleted) lines that would OTHERWISE pass is HELD for manual review — a
66
+ * neutral gate → "manual" verdict, never auto-merged and never a hard failure. Defaults off; thresholds default
67
+ * to 10 files / 1000 lines. This is a HOLD (advisory dry-run friendly), not a close. */
68
+ sizeGateMode?: GateRuleMode | undefined;
69
+ /** Lockfile-tamper-risk gate (#2563). When `block`, a `lockfile_tamper_risk` finding (produced by
70
+ * review/lockfile-tamper.ts when a changed package-lock.json's resolved/integrity value changed without a
71
+ * matching package.json version bump, or points off the npm registry) becomes a hard blocker. Defaults to
72
+ * `off` — the finding is never produced when off, and never blocks under `advisory`. */
73
+ lockfileIntegrityGateMode?: GateRuleMode | undefined;
74
+ /** Aggregate change size, threaded from the resolved file list (changedLineCount = additions + deletions). */
75
+ changedFileCount?: number | null | undefined;
76
+ changedLineCount?: number | null | undefined;
77
+ /** True when the PR's diff trips a configured hard guardrail path.
78
+ * A guardrail hit HOLDS an otherwise-passing gate for manual review (neutral → "manual"), never auto-merged.
79
+ * Empty/absent guardrail globs disable this path. (#gate-guardrail) */
80
+ guardrailHit?: boolean | undefined;
81
+ /** Matched changed paths/globs for the guardrail hold. Empty when the caller only knows "unknown path set"
82
+ * (fail-safe guardrail hit) rather than exact paths. */
83
+ guardrailMatches?: GuardrailPathMatch[] | undefined;
84
+ /** Dry-run disposition (#gate-dryrun). When true, the gate ALSO computes the would-be conclusion with every
85
+ * `advisory` sub-gate promoted to `block` and exposes it as `displayConclusion` (the rendered merge/close/manual
86
+ * verdict), WITHOUT changing the posted, non-enforcing `conclusion`. Lets advisory mode show exactly what it WOULD
87
+ * do (close/merge/manual) before the maintainer flips to real enforcement. Default off. */
88
+ dryRun?: boolean | undefined;
89
+ };
90
+ export type GateCheckEvaluation = {
91
+ enabled: boolean;
92
+ conclusion: GateCheckConclusion;
93
+ /** Dry-run only (#gate-dryrun): the would-be conclusion (advisory sub-gates promoted to block) used to render the
94
+ * merge/close/manual verdict. Absent ⇒ the renderer falls back to `conclusion`. Never affects what is posted. */
95
+ displayConclusion?: GateCheckConclusion | undefined;
96
+ title: string;
97
+ summary: string;
98
+ blockers: AdvisoryFinding[];
99
+ warnings: AdvisoryFinding[];
100
+ };
101
+ export declare function buildPullRequestAdvisory(repo: RepositoryRecord | null, pr: PullRequestRecord | null, context?: {
102
+ otherOpenPullRequests?: PullRequestRecord[];
103
+ requireLinkedIssue?: boolean;
104
+ /** Duplicate-winner adjudication (#dup-winner). When true AND this PR is the cluster winner (the lowest
105
+ * open sibling number), the `duplicate_pr_risk` finding is suppressed so the winner is not gate-blocked /
106
+ * closed as a duplicate. Default/false ⇒ every duplicate sibling keeps the finding (byte-identical). The
107
+ * caller sets this to `env.GITTENSORY_DUPLICATE_WINNER === "true"`. */
108
+ duplicateWinnerEnabled?: boolean;
109
+ /** Author logins of the linked issues (one entry per resolved issue, may be null when unknown). Used to
110
+ * surface a `self_authored_linked_issue` finding when the PR author also opened the linked issue. Absent
111
+ * or empty ⇒ the finding is never raised (fail-open: unknown issue authorship stays advisory-only). */
112
+ linkedIssueAuthorLogins?: (string | null | undefined)[];
113
+ /** Same-account issue-avoidance countermeasure (#unlinked-issue-guardrail-followup): `pr.linkedIssues` is
114
+ * populated by a pure body-text regex that never checks whether the cited issue is actually OPEN, so a
115
+ * contributor can satisfy `linkedIssueGateMode: "block"` by citing an already-CLOSED (or fabricated)
116
+ * issue number. When the caller has live-verified that NONE of this PR's linked issue numbers resolve to
117
+ * a confirmed-open issue, it sets this true and `missing_linked_issue` fires exactly as if nothing were
118
+ * linked at all. Absent/false ⇒ byte-identical to today (presence alone still satisfies the requirement)
119
+ * — this is fail-open by construction: the caller only ever sets it true after a live check confirms
120
+ * every reference is dead, never on ambiguity. */
121
+ confirmedNoOpenLinkedIssue?: boolean;
122
+ }): Advisory;
123
+ declare function advisory(targetType: Advisory["targetType"], targetKey: string, repoFullName: string, findings: AdvisoryFinding[], fallbackSummary: string, pullNumber?: number, issueNumber?: number, headSha?: string): Advisory;
124
+ declare function highestSeverity(findings: AdvisoryFinding[]): AdvisorySeverity;
125
+ declare function conclusionForSeverity(severity: AdvisorySeverity, findings: AdvisoryFinding[]): AdvisoryConclusion;
126
+ /** Oversized-PR manual-review HOLD finding (#gate-size), or null when the size gate is off or the PR is within both
127
+ * thresholds. A HOLD (→ neutral gate → "manual" verdict), never a hard blocker, so it is dry-run/advisory friendly. */
128
+ declare function buildSizeHoldFinding(policy: GateCheckPolicy): AdvisoryFinding | null;
129
+ declare function buildGuardrailHoldFinding(matches?: GuardrailPathMatch[]): AdvisoryFinding;
130
+ declare function promoteAdvisoryToBlock(policy: GateCheckPolicy): GateCheckPolicy;
131
+ export declare function evaluateGateCheck(advisoryResult: Advisory, policy?: GateCheckPolicy): GateCheckEvaluation;
132
+ declare function gatePolicyBlocks(mode: GateRuleMode | undefined, defaultMode: GateRuleMode): boolean;
133
+ declare function isConfiguredGateBlocker(finding: AdvisoryFinding, policy: GateCheckPolicy): boolean;
134
+ declare function buildQualityGateWarning(policy: GateCheckPolicy): AdvisoryFinding | null;
135
+ declare function buildSlopGateBlocker(policy: GateCheckPolicy): AdvisoryFinding | null;
136
+ declare function gateMode(value: GateRuleMode | null | undefined): GateRuleMode;
137
+ /** @internal Exported for unit tests of advisory severity wiring. */
138
+ export declare const gateAdvisoryInternals: {
139
+ advisory: typeof advisory;
140
+ highestSeverity: typeof highestSeverity;
141
+ conclusionForSeverity: typeof conclusionForSeverity;
142
+ buildSizeHoldFinding: typeof buildSizeHoldFinding;
143
+ buildGuardrailHoldFinding: typeof buildGuardrailHoldFinding;
144
+ promoteAdvisoryToBlock: typeof promoteAdvisoryToBlock;
145
+ isConfiguredGateBlocker: typeof isConfiguredGateBlocker;
146
+ buildQualityGateWarning: typeof buildQualityGateWarning;
147
+ buildSlopGateBlocker: typeof buildSlopGateBlocker;
148
+ gateMode: typeof gateMode;
149
+ gatePolicyBlocks: typeof gatePolicyBlocks;
150
+ };
151
+ export {};