@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,223 @@
1
+ import type { ScorePreviewResult } from "./scoring/preview.js";
2
+ import type { CheckSummaryRecord, CollisionReport, ContributorFit, ContributorOutcomeHistory, ContributorProfile, ContributorScoringProfile, IssueRecord, LaneAdvice, PullRequestFileRecord, PullRequestRecord, PullRequestReviewRecord, QueueHealth, RecentMergedPullRequestRecord, RepoFitRecommendation, RepositoryRecord, RoleContext, ScoringModelSnapshotRecord } from "./types/reward-risk-types.js";
3
+ /**
4
+ * Minimal covariant view of `buildPullRequestReviewIntelligence`'s return — only the fields this module
5
+ * reads. The full `src` type (`PullRequestMaintainerPacket & …`) is covariantly assignable to it.
6
+ */
7
+ export type PullRequestReviewIntelligenceView = {
8
+ roleContext: {
9
+ maintainerLane: boolean;
10
+ };
11
+ outcomeContext?: {
12
+ closedPullRequestRate: number;
13
+ } | undefined;
14
+ reviewSignals: {
15
+ linkedIssues: readonly unknown[];
16
+ collisionClusters: number;
17
+ approvalCount: number;
18
+ };
19
+ changeSummary: {
20
+ fileCount: number;
21
+ additions: number;
22
+ deletions: number;
23
+ codeFileCount: number;
24
+ testFileCount: number;
25
+ };
26
+ };
27
+ /** Input shared by {@link buildPullRequestReviewability} and the injected `buildPullRequestReviewIntelligence`. */
28
+ export type PullRequestReviewabilityInput = {
29
+ repo: RepositoryRecord | null;
30
+ pullRequest: PullRequestRecord | null;
31
+ issues: IssueRecord[];
32
+ pullRequests: PullRequestRecord[];
33
+ files: PullRequestFileRecord[];
34
+ reviews: PullRequestReviewRecord[];
35
+ checks: CheckSummaryRecord[];
36
+ recentMergedPullRequests: RecentMergedPullRequestRecord[];
37
+ repoFullName: string;
38
+ pullNumber: number;
39
+ profile?: ContributorProfile | null | undefined;
40
+ outcomeHistory?: ContributorOutcomeHistory | null | undefined;
41
+ };
42
+ /**
43
+ * The `src/signals/engine.ts` builders reward-risk depends on, injected so this package stays free of any
44
+ * `src/` import. The real `src`-typed builders bind cleanly: their argument records are wider than (assignable
45
+ * from) these engine mirrors, and their richer return types are covariantly assignable to the narrowed views
46
+ * above. `isFailingCheckSummary` is imported directly from `./signals/check-summary.js` (#4256).
47
+ */
48
+ export type RewardRiskEngineDeps = {
49
+ buildRoleContext: (args: {
50
+ login: string;
51
+ repo: RepositoryRecord | null;
52
+ repoFullName: string;
53
+ pullRequests: PullRequestRecord[];
54
+ issues: IssueRecord[];
55
+ profile: ContributorProfile;
56
+ }) => RoleContext;
57
+ buildLaneAdvice: (repo: RepositoryRecord | null, fullName: string) => LaneAdvice;
58
+ buildCollisionReport: (fullName: string, issues: IssueRecord[], pullRequests: PullRequestRecord[], recentMergedPullRequests: RecentMergedPullRequestRecord[]) => CollisionReport;
59
+ buildQueueHealth: (repo: RepositoryRecord | null, issues: IssueRecord[], pullRequests: PullRequestRecord[], collisions: CollisionReport) => QueueHealth;
60
+ buildRepoFitRecommendation: (args: {
61
+ login: string;
62
+ repo: RepositoryRecord | null;
63
+ repoFullName: string;
64
+ profile: ContributorProfile;
65
+ outcomeHistory: ContributorOutcomeHistory;
66
+ issues: IssueRecord[];
67
+ pullRequests: PullRequestRecord[];
68
+ }) => RepoFitRecommendation;
69
+ buildContributorIntakeHealth: (repo: RepositoryRecord | null, issues: IssueRecord[], pullRequests: PullRequestRecord[], fullName: string, collisions: CollisionReport) => {
70
+ level: "healthy" | "watch" | "strained" | "blocked";
71
+ };
72
+ buildPullRequestReviewIntelligence: (args: PullRequestReviewabilityInput) => PullRequestReviewIntelligenceView;
73
+ };
74
+ export type RewardRiskActionKind = "cleanup_existing_prs" | "land_existing_prs" | "close_or_withdraw_low_fit_prs" | "open_new_direct_pr" | "file_issue_discovery" | "maintainer_lane_improve_repo" | "maintainer_cut_readiness";
75
+ /** Severity tier for a reward/risk action, from most to least urgent. */
76
+ export type RewardRiskActionSeverity = "critical" | "warning" | "tip" | "info";
77
+ export type RewardRiskAction = {
78
+ actionKind: RewardRiskActionKind;
79
+ repoFullName: string;
80
+ /** Severity tier: critical = eligibility blocker; warning = active penalty; tip = multiplier opportunity; info = planning context. */
81
+ severity: RewardRiskActionSeverity;
82
+ priorityScore: number;
83
+ laneValueScore: number;
84
+ scoreabilityScore: number;
85
+ personalFitScore: number;
86
+ riskPenalty: number;
87
+ maintainerFrictionPenalty: number;
88
+ actionLeverageScore: number;
89
+ whyThisHelps: string[];
90
+ nextActions: string[];
91
+ };
92
+ export type RepoRewardRisk = {
93
+ login: string;
94
+ repoFullName: string;
95
+ generatedAt: string;
96
+ roleContext: RoleContext;
97
+ lane: LaneAdvice;
98
+ recommendation: RepoFitRecommendation["recommendation"];
99
+ rewardUpside: {
100
+ relevantLane: "direct_pr" | "issue_discovery" | "maintainer_lane" | "none";
101
+ repoSlice: number;
102
+ directPrSlice: number;
103
+ issueDiscoverySlice: number;
104
+ maintainerCutSlice: number;
105
+ labelMultiplier: number;
106
+ issueMultiplier: number;
107
+ estimatedScoreIfClean: number;
108
+ currentEstimatedScore: number;
109
+ /** Explicit opportunity factors: competition and freshness of available work. */
110
+ opportunityFactors: {
111
+ /** 0–1; higher = more competing open PRs with duplicate/collision risk. */
112
+ competitionFactor: number;
113
+ /** 0–1; higher = issues in this repo were created or updated more recently. */
114
+ freshnessFactor: number;
115
+ };
116
+ };
117
+ scoreBlockers: string[];
118
+ riskBreakdown: {
119
+ queueBurden: QueueHealth["level"];
120
+ queueBurdenScore: number;
121
+ duplicateClusters: number;
122
+ highRiskDuplicateClusters: number;
123
+ closedPullRequestRate: number;
124
+ openPullRequests: number;
125
+ credibility: number;
126
+ reviewChurnRisk: "low" | "medium" | "high";
127
+ };
128
+ actionImpact: {
129
+ currentOpenPrCount: number;
130
+ openPrThreshold: number;
131
+ openPrMultiplierDelta: string;
132
+ estimatedScoreDelta: string;
133
+ cleanupNeeded: number;
134
+ explanation: string;
135
+ };
136
+ currentPreview: ScorePreviewResult;
137
+ afterCleanupPreview: ScorePreviewResult;
138
+ actions: RewardRiskAction[];
139
+ whyThisHelps: string[];
140
+ nextActions: string[];
141
+ summary: string;
142
+ };
143
+ /** A registered repo where a small number of PR cleanups would unlock or improve scoring. */
144
+ export type EligibilityGapEntry = {
145
+ repoFullName: string;
146
+ /** Number of open PRs to land or withdraw before the open-PR gate improves. */
147
+ prsToUnlock: number;
148
+ /** Estimated merged score after reaching the threshold (from afterCleanupPreview). */
149
+ estimatedScoreAtThreshold: number;
150
+ recommendation: string;
151
+ };
152
+ export type ContributorRewardRiskStrategy = {
153
+ login: string;
154
+ generatedAt: string;
155
+ scoringModelSnapshotId: string;
156
+ summary: string;
157
+ topActions: RewardRiskAction[];
158
+ repoAnalyses: RepoRewardRisk[];
159
+ reasoning: string[];
160
+ actionImpact: string[];
161
+ nextActions: string[];
162
+ /** Repos where 1–5 PR cleanups would flip the open-PR gate toward scoreable. Sorted by fewest prsToUnlock. */
163
+ eligibilityGap: EligibilityGapEntry[];
164
+ };
165
+ export type MaintainerNoiseReport = {
166
+ repoFullName: string;
167
+ generatedAt: string;
168
+ score: number;
169
+ level: "low" | "medium" | "high" | "critical";
170
+ noiseSources: string[];
171
+ maintainerActions: Array<"review_now" | "needs_author" | "likely_duplicate" | "close_or_redirect" | "watch" | "maintainer_lane">;
172
+ queueHealth: QueueHealth;
173
+ summary: string;
174
+ };
175
+ export type PullRequestReviewability = {
176
+ repoFullName: string;
177
+ pullNumber: number;
178
+ generatedAt: string;
179
+ score: number;
180
+ action: "review_now" | "needs_author" | "likely_duplicate" | "close_or_redirect" | "watch" | "maintainer_lane";
181
+ noiseSources: string[];
182
+ whyThisHelps: string[];
183
+ maintainerNextSteps: string[];
184
+ privateSummary: string;
185
+ };
186
+ export declare function buildRepoRewardRisk(args: {
187
+ login: string;
188
+ repo: RepositoryRecord | null;
189
+ repoFullName: string;
190
+ profile: ContributorProfile;
191
+ outcomeHistory: ContributorOutcomeHistory;
192
+ scoringSnapshot: ScoringModelSnapshotRecord;
193
+ scoringProfile?: ContributorScoringProfile | null | undefined;
194
+ issues: IssueRecord[];
195
+ pullRequests: PullRequestRecord[];
196
+ recentMergedPullRequests?: RecentMergedPullRequestRecord[] | undefined;
197
+ /** Repo primary language (from sync metadata / ContributorFit.languageFit),
198
+ * used for the personalFit language-match bonus. */
199
+ repoLanguage?: string | null | undefined;
200
+ }, deps: RewardRiskEngineDeps): RepoRewardRisk;
201
+ export declare function buildContributorRewardRiskStrategy(args: {
202
+ login: string;
203
+ fit: ContributorFit;
204
+ scoringProfile: ContributorScoringProfile;
205
+ scoringSnapshot: ScoringModelSnapshotRecord;
206
+ outcomeHistory: ContributorOutcomeHistory;
207
+ repositories: RepositoryRecord[];
208
+ allIssues: IssueRecord[];
209
+ allPullRequests: PullRequestRecord[];
210
+ recentMergedPullRequests?: RecentMergedPullRequestRecord[] | undefined;
211
+ }, deps: RewardRiskEngineDeps): ContributorRewardRiskStrategy;
212
+ export declare function buildMaintainerNoiseReport(repo: RepositoryRecord | null, issues: IssueRecord[], pullRequests: PullRequestRecord[], recentMergedPullRequests: RecentMergedPullRequestRecord[], fullName: string, deps: RewardRiskEngineDeps): MaintainerNoiseReport;
213
+ export declare function buildPullRequestReviewability(args: PullRequestReviewabilityInput, deps: RewardRiskEngineDeps): PullRequestReviewability;
214
+ declare function bestFitLabels(repo: RepositoryRecord | null): string[];
215
+ declare function pickIssueTimestamp(issue: IssueRecord): string | null;
216
+ /** Unknown/unparseable timestamps floor freshness (parity with gittensory-engine opportunity-freshness.ts). */
217
+ declare function issueAgeDays(value: string | null): number;
218
+ export declare const rewardRiskFreshnessInternals: {
219
+ pickIssueTimestamp: typeof pickIssueTimestamp;
220
+ issueAgeDays: typeof issueAgeDays;
221
+ bestFitLabels: typeof bestFitLabels;
222
+ };
223
+ export {};