@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,338 @@
1
+ export type JsonPrimitive = string | number | boolean | null;
2
+ export type JsonValue = JsonPrimitive | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ export type RegistryRepoConfig = {
6
+ repo: string;
7
+ emissionShare: number;
8
+ issueDiscoveryShare: number;
9
+ labelMultipliers: Record<string, number>;
10
+ trustedLabelPipeline?: boolean | null;
11
+ maintainerCut: number;
12
+ defaultLabelMultiplier?: number | null;
13
+ fixedBaseScore?: number | null;
14
+ eligibilityMode?: string | null;
15
+ raw: Record<string, JsonValue>;
16
+ };
17
+ export type AdvisoryConclusion = "success" | "neutral" | "action_required";
18
+ export type AdvisorySeverity = "info" | "warning" | "critical";
19
+ export type AdvisoryFinding = {
20
+ code: string;
21
+ title: string;
22
+ severity: AdvisorySeverity;
23
+ detail: string;
24
+ action?: string;
25
+ publicText?: string;
26
+ confidence?: number;
27
+ };
28
+ export type Advisory = {
29
+ id: string;
30
+ targetType: "repository" | "pull_request" | "issue";
31
+ targetKey: string;
32
+ repoFullName: string;
33
+ pullNumber?: number;
34
+ issueNumber?: number;
35
+ headSha?: string;
36
+ conclusion: AdvisoryConclusion;
37
+ severity: AdvisorySeverity;
38
+ title: string;
39
+ summary: string;
40
+ findings: AdvisoryFinding[];
41
+ generatedAt: string;
42
+ };
43
+ export type RepositoryRecord = {
44
+ fullName: string;
45
+ owner: string;
46
+ name: string;
47
+ installationId?: number | null | undefined;
48
+ isInstalled: boolean;
49
+ isRegistered: boolean;
50
+ isPrivate: boolean;
51
+ htmlUrl?: string | null | undefined;
52
+ defaultBranch?: string | null | undefined;
53
+ registryConfig?: RegistryRepoConfig | null | undefined;
54
+ };
55
+ export type PullRequestRecord = {
56
+ repoFullName: string;
57
+ number: number;
58
+ title: string;
59
+ state: string;
60
+ authorLogin?: string | null | undefined;
61
+ authorAssociation?: string | null | undefined;
62
+ headSha?: string | null | undefined;
63
+ headRef?: string | null | undefined;
64
+ baseRef?: string | null | undefined;
65
+ htmlUrl?: string | null | undefined;
66
+ mergedAt?: string | null | undefined;
67
+ isDraft?: boolean | null | undefined;
68
+ mergeableState?: string | null | undefined;
69
+ reviewDecision?: string | null | undefined;
70
+ body?: string | null | undefined;
71
+ createdAt?: string | null | undefined;
72
+ updatedAt?: string | null | undefined;
73
+ closedAt?: string | null | undefined;
74
+ linkedIssueClaimedAt?: string | null | undefined;
75
+ labels: string[];
76
+ linkedIssues: number[];
77
+ slopRisk?: number | null | undefined;
78
+ slopBand?: string | null | undefined;
79
+ mergeAttemptCount?: number | null | undefined;
80
+ mergeBlockedSha?: string | null | undefined;
81
+ mergeBlockedReason?: string | null | undefined;
82
+ approvedHeadSha?: string | null | undefined;
83
+ lastRegatedAt?: string | null | undefined;
84
+ lastPublishedSurfaceSha?: string | null | undefined;
85
+ changedFiles?: string[] | undefined;
86
+ };
87
+ export type IssueRecord = {
88
+ repoFullName: string;
89
+ number: number;
90
+ title: string;
91
+ state: string;
92
+ authorLogin?: string | null | undefined;
93
+ authorAssociation?: string | null | undefined;
94
+ htmlUrl?: string | null | undefined;
95
+ body?: string | null | undefined;
96
+ createdAt?: string | null | undefined;
97
+ updatedAt?: string | null | undefined;
98
+ closedAt?: string | null | undefined;
99
+ labels: string[];
100
+ linkedPrs: number[];
101
+ };
102
+ export type BountyRecord = {
103
+ id: string;
104
+ repoFullName: string;
105
+ issueNumber: number;
106
+ status: string;
107
+ amountText?: string | null | undefined;
108
+ sourceUrl?: string | null | undefined;
109
+ payload: Record<string, JsonValue>;
110
+ discoveredAt?: string | null | undefined;
111
+ updatedAt?: string | null | undefined;
112
+ };
113
+ export type GateRuleMode = "off" | "advisory" | "block";
114
+ export type GatePolicyPack = "gittensor" | "oss-anti-slop";
115
+ export type RepositorySettings = {
116
+ repoFullName: string;
117
+ hardGuardrailGlobs?: string[] | null | undefined;
118
+ };
119
+ export type RecentMergedPullRequestRecord = {
120
+ repoFullName: string;
121
+ number: number;
122
+ title: string;
123
+ authorLogin?: string | null | undefined;
124
+ htmlUrl?: string | null | undefined;
125
+ labels: string[];
126
+ linkedIssues: number[];
127
+ changedFiles?: string[] | undefined;
128
+ };
129
+ export type ParticipationLane = "direct_pr" | "issue_discovery" | "split" | "inactive" | "unknown";
130
+ export type SignalFinding = AdvisoryFinding;
131
+ export type LaneAdvice = {
132
+ lane: ParticipationLane;
133
+ repoFullName: string;
134
+ issueDiscoveryShare?: number | undefined;
135
+ directPrShare?: number | undefined;
136
+ summary: string;
137
+ contributorGuidance: string;
138
+ maintainerGuidance: string;
139
+ };
140
+ export type CollisionItem = {
141
+ type: "issue" | "pull_request" | "recent_merged_pull_request";
142
+ number: number;
143
+ title: string;
144
+ authorLogin?: string | null | undefined;
145
+ htmlUrl?: string | null | undefined;
146
+ labels?: string[] | undefined;
147
+ linkedIssues?: number[] | undefined;
148
+ linkedIssueClaimedAt?: string | null | undefined;
149
+ changedFiles?: string[] | undefined;
150
+ body?: string | null | undefined;
151
+ };
152
+ export type CollisionCluster = {
153
+ id: string;
154
+ risk: "low" | "medium" | "high";
155
+ reason: string;
156
+ items: CollisionItem[];
157
+ };
158
+ export type CollisionReport = {
159
+ repoFullName: string;
160
+ generatedAt: string;
161
+ summary: {
162
+ clusterCount: number;
163
+ highRiskCount: number;
164
+ itemsReviewed: number;
165
+ };
166
+ clusters: CollisionCluster[];
167
+ };
168
+ export type QueueHealth = {
169
+ repoFullName: string;
170
+ generatedAt: string;
171
+ burdenScore: number;
172
+ level: "low" | "medium" | "high" | "critical";
173
+ summary: string;
174
+ signals: {
175
+ openIssues: number;
176
+ openPullRequests: number;
177
+ unlinkedPullRequests: number;
178
+ stalePullRequests: number;
179
+ draftPullRequests: number;
180
+ maintainerAuthoredPullRequests: number;
181
+ collisionClusters: number;
182
+ ageBuckets: {
183
+ under7Days: number;
184
+ days7To30: number;
185
+ over30Days: number;
186
+ };
187
+ likelyReviewablePullRequests: number;
188
+ cachedOpenPullRequests?: number | undefined;
189
+ likelyReviewablePullRequestsSource?: "cache" | "sampled_cache" | "authoritative" | undefined;
190
+ };
191
+ findings: AdvisoryFinding[];
192
+ };
193
+ export type QueueSignalCounts = {
194
+ openIssues?: number | undefined;
195
+ openPullRequests?: number | undefined;
196
+ likelyReviewablePullRequests?: number | undefined;
197
+ };
198
+ export type PreflightInput = {
199
+ repoFullName: string;
200
+ contributorLogin?: string | undefined;
201
+ title: string;
202
+ body?: string | undefined;
203
+ labels?: string[] | undefined;
204
+ changedFiles?: string[] | undefined;
205
+ linkedIssues?: number[] | undefined;
206
+ tests?: string[] | undefined;
207
+ authorAssociation?: string | undefined;
208
+ };
209
+ export type PreflightResult = {
210
+ repoFullName: string;
211
+ generatedAt: string;
212
+ status: "ready" | "needs_work" | "hold";
213
+ lane: LaneAdvice;
214
+ reviewBurden: "low" | "medium" | "high";
215
+ linkedIssues: number[];
216
+ findings: SignalFinding[];
217
+ collisions: CollisionCluster[];
218
+ };
219
+ export type PublicReadinessScore = {
220
+ total: number;
221
+ components: Array<{
222
+ key: "traceability" | "related_work" | "change_scope" | "validation" | "pr_state" | "queue_pressure";
223
+ label: string;
224
+ score: number;
225
+ max: number;
226
+ evidence: string;
227
+ action: string;
228
+ }>;
229
+ };
230
+ export type IssueQualityReport = {
231
+ repoFullName: string;
232
+ generatedAt: string;
233
+ lane: LaneAdvice;
234
+ issues: Array<{
235
+ number: number;
236
+ title: string;
237
+ status: "ready" | "needs_proof" | "hold" | "do_not_use";
238
+ score: number;
239
+ reasons: string[];
240
+ warnings: string[];
241
+ }>;
242
+ summary: string;
243
+ };
244
+ export type BountyLifecycle = "active" | "historical" | "completed" | "cancelled" | "stale" | "ambiguous" | "unknown";
245
+ export type FocusManifestSource = "repo_file" | "api_record" | "none";
246
+ export type FocusManifestLinkedIssuePolicy = "required" | "preferred" | "optional";
247
+ export type FocusManifestIssueDiscoveryPolicy = "encouraged" | "neutral" | "discouraged";
248
+ export type ReviewCheckMode = "required" | "visible" | "disabled";
249
+ export type CombineStrategy = "single" | "consensus" | "synthesis";
250
+ export type OnMerge = "either" | "both";
251
+ export type FocusManifestGateConfig = {
252
+ present: boolean;
253
+ enabled: boolean | null;
254
+ checkMode: ReviewCheckMode | null;
255
+ pack: GatePolicyPack | null;
256
+ linkedIssue: GateRuleMode | null;
257
+ duplicates: GateRuleMode | null;
258
+ readinessMode: GateRuleMode | null;
259
+ readinessMinScore: number | null;
260
+ slopMode: GateRuleMode | null;
261
+ slopMinScore: number | null;
262
+ slopAiAdvisory: boolean | null;
263
+ sizeMode: GateRuleMode | null;
264
+ lockfileIntegrityMode: GateRuleMode | null;
265
+ aiReviewMode: GateRuleMode | null;
266
+ aiReviewByok: boolean | null;
267
+ aiReviewProvider: "anthropic" | "openai" | null;
268
+ aiReviewModel: string | null;
269
+ aiReviewAllAuthors: boolean | null;
270
+ aiReviewCloseConfidence: number | null;
271
+ aiReviewCombine: CombineStrategy | null;
272
+ aiReviewOnMerge: OnMerge | null;
273
+ aiReviewReviewers: ReadonlyArray<{
274
+ model: string;
275
+ fallback?: string | null | undefined;
276
+ }> | null;
277
+ mergeReadiness: GateRuleMode | null;
278
+ manifestPolicy: GateRuleMode | null;
279
+ selfAuthoredLinkedIssue: GateRuleMode | null;
280
+ dryRun: boolean | null;
281
+ firstTimeContributorGrace: boolean | null;
282
+ premergeContentRecheck: boolean | null;
283
+ requireFreshRebaseWindowMinutes: number | null;
284
+ claMode: GateRuleMode | null;
285
+ claConsentPhrase: string | null;
286
+ claCheckRunName: string | null;
287
+ claCheckRunAppSlug: string | null;
288
+ expectedCiContexts: ReadonlyArray<string> | null;
289
+ };
290
+ export type PreMergeCheck = {
291
+ name: string;
292
+ whenPaths: string[];
293
+ titleContains: string | null;
294
+ descriptionContains: string | null;
295
+ requireLabel: string | null;
296
+ enforce: boolean;
297
+ };
298
+ export type FocusManifestReviewConfig = {
299
+ present: boolean;
300
+ preMergeChecks: PreMergeCheck[];
301
+ };
302
+ export type FocusManifestSettings = {
303
+ hardGuardrailGlobs?: string[] | null | undefined;
304
+ };
305
+ export type FocusManifest = {
306
+ present: boolean;
307
+ source: FocusManifestSource;
308
+ wantedPaths: string[];
309
+ preferredLabels: string[];
310
+ linkedIssuePolicy: FocusManifestLinkedIssuePolicy;
311
+ testExpectations: string[];
312
+ issueDiscoveryPolicy: FocusManifestIssueDiscoveryPolicy;
313
+ maintainerNotes: string[];
314
+ publicNotes: string[];
315
+ gate: FocusManifestGateConfig;
316
+ settings: FocusManifestSettings;
317
+ review: FocusManifestReviewConfig;
318
+ warnings: string[];
319
+ };
320
+ export type FocusManifestFinding = {
321
+ code: "manifest_off_focus" | "manifest_preferred_path" | "manifest_missing_preferred_label" | "manifest_linked_issue_required" | "manifest_linked_issue_preferred" | "manifest_missing_tests" | "manifest_issue_discovery_discouraged" | "manifest_malformed";
322
+ severity: "info" | "warning" | "critical";
323
+ title: string;
324
+ detail: string;
325
+ action?: string | undefined;
326
+ };
327
+ export type FocusManifestGuidance = {
328
+ present: boolean;
329
+ source: FocusManifestSource;
330
+ linkedIssuePolicy: FocusManifestLinkedIssuePolicy;
331
+ issueDiscoveryPolicy: FocusManifestIssueDiscoveryPolicy;
332
+ matchedWantedPaths: string[];
333
+ preferredLabelHits: string[];
334
+ findings: FocusManifestFinding[];
335
+ publicNextSteps: string[];
336
+ warnings: string[];
337
+ summary: string;
338
+ };
@@ -0,0 +1,3 @@
1
+ // Local mirrors from src/types.ts, src/signals/engine.ts, and src/signals/focus-manifest.ts.
2
+ // Keep in sync by hand — the engine package cannot import across into src/.
3
+ export {};
@@ -0,0 +1,319 @@
1
+ export type JsonPrimitive = string | number | boolean | null;
2
+ export type JsonValue = JsonPrimitive | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ export type ParticipationLane = "direct_pr" | "issue_discovery" | "split" | "inactive" | "unknown";
6
+ export type ContributorRole = "outside_contributor" | "repo_maintainer" | "org_member" | "collaborator" | "owner" | "unknown";
7
+ export type AdvisorySeverity = "info" | "warning" | "critical";
8
+ export type AdvisoryFinding = {
9
+ code: string;
10
+ title: string;
11
+ severity: AdvisorySeverity;
12
+ detail: string;
13
+ action?: string;
14
+ publicText?: string;
15
+ confidence?: number;
16
+ };
17
+ export type SignalFinding = AdvisoryFinding;
18
+ export type RepoTimeDecayOverrides = {
19
+ gracePeriodHours?: number | null | undefined;
20
+ sigmoidMidpointDays?: number | null | undefined;
21
+ sigmoidSteepness?: number | null | undefined;
22
+ minMultiplier?: number | null | undefined;
23
+ };
24
+ export type RegistryRepoConfig = {
25
+ repo: string;
26
+ emissionShare: number;
27
+ issueDiscoveryShare: number;
28
+ labelMultipliers: Record<string, number>;
29
+ trustedLabelPipeline?: boolean | null;
30
+ maintainerCut: number;
31
+ defaultLabelMultiplier?: number | null;
32
+ fixedBaseScore?: number | null;
33
+ eligibilityMode?: string | null;
34
+ timeDecay?: RepoTimeDecayOverrides | null;
35
+ raw: Record<string, JsonValue>;
36
+ };
37
+ export type RepositoryRecord = {
38
+ fullName: string;
39
+ owner: string;
40
+ name: string;
41
+ installationId?: number | null | undefined;
42
+ isInstalled: boolean;
43
+ isRegistered: boolean;
44
+ isPrivate: boolean;
45
+ htmlUrl?: string | null | undefined;
46
+ defaultBranch?: string | null | undefined;
47
+ registryConfig?: RegistryRepoConfig | null | undefined;
48
+ };
49
+ export type PullRequestRecord = {
50
+ repoFullName: string;
51
+ number: number;
52
+ title: string;
53
+ state: string;
54
+ authorLogin?: string | null | undefined;
55
+ authorAssociation?: string | null | undefined;
56
+ headSha?: string | null | undefined;
57
+ headRef?: string | null | undefined;
58
+ baseRef?: string | null | undefined;
59
+ htmlUrl?: string | null | undefined;
60
+ mergedAt?: string | null | undefined;
61
+ isDraft?: boolean | null | undefined;
62
+ mergeableState?: string | null | undefined;
63
+ reviewDecision?: string | null | undefined;
64
+ body?: string | null | undefined;
65
+ createdAt?: string | null | undefined;
66
+ updatedAt?: string | null | undefined;
67
+ closedAt?: string | null | undefined;
68
+ linkedIssueClaimedAt?: string | null | undefined;
69
+ labels: string[];
70
+ linkedIssues: number[];
71
+ slopRisk?: number | null | undefined;
72
+ slopBand?: string | null | undefined;
73
+ mergeAttemptCount?: number | null | undefined;
74
+ mergeBlockedSha?: string | null | undefined;
75
+ mergeBlockedReason?: string | null | undefined;
76
+ approvedHeadSha?: string | null | undefined;
77
+ lastRegatedAt?: string | null | undefined;
78
+ lastPublishedSurfaceSha?: string | null | undefined;
79
+ changedFiles?: string[] | undefined;
80
+ };
81
+ export type IssueRecord = {
82
+ repoFullName: string;
83
+ number: number;
84
+ title: string;
85
+ state: string;
86
+ authorLogin?: string | null | undefined;
87
+ authorAssociation?: string | null | undefined;
88
+ htmlUrl?: string | null | undefined;
89
+ body?: string | null | undefined;
90
+ createdAt?: string | null | undefined;
91
+ updatedAt?: string | null | undefined;
92
+ closedAt?: string | null | undefined;
93
+ labels: string[];
94
+ linkedPrs: number[];
95
+ };
96
+ export type RecentMergedPullRequestRecord = {
97
+ repoFullName: string;
98
+ number: number;
99
+ title: string;
100
+ authorLogin?: string | null | undefined;
101
+ htmlUrl?: string | null | undefined;
102
+ mergedAt?: string | null | undefined;
103
+ labels: string[];
104
+ linkedIssues: number[];
105
+ changedFiles: string[];
106
+ payload: Record<string, JsonValue>;
107
+ };
108
+ export type PullRequestFileRecord = {
109
+ repoFullName: string;
110
+ pullNumber: number;
111
+ path: string;
112
+ status?: string | null | undefined;
113
+ additions: number;
114
+ deletions: number;
115
+ changes: number;
116
+ previousFilename?: string | null | undefined;
117
+ payload: Record<string, JsonValue>;
118
+ };
119
+ export type PullRequestReviewRecord = {
120
+ id: string;
121
+ repoFullName: string;
122
+ pullNumber: number;
123
+ reviewerLogin?: string | null | undefined;
124
+ state: string;
125
+ authorAssociation?: string | null | undefined;
126
+ submittedAt?: string | null | undefined;
127
+ payload: Record<string, JsonValue>;
128
+ };
129
+ export type CheckSummaryRecord = {
130
+ id: string;
131
+ repoFullName: string;
132
+ pullNumber?: number | null | undefined;
133
+ headSha?: string | null | undefined;
134
+ name: string;
135
+ status: string;
136
+ conclusion?: string | null | undefined;
137
+ startedAt?: string | null | undefined;
138
+ completedAt?: string | null | undefined;
139
+ detailsUrl?: string | null | undefined;
140
+ payload: Record<string, JsonValue>;
141
+ };
142
+ export type ScoringModelSnapshotRecord = {
143
+ id: string;
144
+ sourceKind: "raw-github" | "api" | "fallback" | "test";
145
+ sourceUrl: string;
146
+ fetchedAt: string;
147
+ activeModel: "current_density_model" | "pending_saturation_model" | "exponential_saturation_model" | "unknown";
148
+ constants: Record<string, number>;
149
+ programmingLanguages: Record<string, JsonValue>;
150
+ registrySnapshotId?: string | null | undefined;
151
+ warnings: string[];
152
+ payload: Record<string, JsonValue>;
153
+ };
154
+ export type PublicContributorProfile = {
155
+ login: string;
156
+ topLanguages: string[];
157
+ source: "github" | "unavailable";
158
+ };
159
+ export type ContributorProfile = {
160
+ login: string;
161
+ generatedAt: string;
162
+ github: PublicContributorProfile;
163
+ source: "gittensor_api" | "github_cache";
164
+ registeredRepoActivity: {
165
+ pullRequests: number;
166
+ mergedPullRequests: number;
167
+ issues: number;
168
+ reposTouched: string[];
169
+ dominantLabels: string[];
170
+ };
171
+ trustSignals: {
172
+ evidenceScore: number;
173
+ level: "new" | "emerging" | "established";
174
+ unlinkedOpenPullRequests: number;
175
+ maintainerAssociatedPullRequests: number;
176
+ };
177
+ };
178
+ export type ContributorScoringProfile = {
179
+ evidence: {
180
+ credibilityAssumption: number;
181
+ };
182
+ };
183
+ export type ContributorFit = {
184
+ profile: ContributorProfile;
185
+ languageFit: Array<{
186
+ repoFullName: string;
187
+ language?: string | null | undefined;
188
+ match: boolean;
189
+ }>;
190
+ opportunities: Array<{
191
+ repoFullName: string;
192
+ }>;
193
+ };
194
+ export type OutcomePattern = {
195
+ repoFullName?: string | undefined;
196
+ title: string;
197
+ detail: string;
198
+ confidence: "high" | "medium" | "low";
199
+ };
200
+ export type ContributorOutcomeHistory = {
201
+ login: string;
202
+ generatedAt: string;
203
+ source: ContributorProfile["source"];
204
+ totals: {
205
+ pullRequests: number;
206
+ mergedPullRequests: number;
207
+ openPullRequests: number;
208
+ closedPullRequests: number;
209
+ closedPullRequestRate: number;
210
+ issues: number;
211
+ openIssues: number;
212
+ closedIssues: number;
213
+ solvedIssues: number;
214
+ validSolvedIssues: number;
215
+ credibility: number;
216
+ issueCredibility: number;
217
+ };
218
+ repoOutcomes: Array<{
219
+ repoFullName: string;
220
+ role: ContributorRole;
221
+ lane: ParticipationLane;
222
+ maintainerLane: boolean;
223
+ pullRequests: number;
224
+ mergedPullRequests: number;
225
+ openPullRequests: number;
226
+ closedPullRequests: number;
227
+ closedPullRequestRate: number;
228
+ issues: number;
229
+ openIssues: number;
230
+ closedIssues: number;
231
+ solvedIssues: number;
232
+ validSolvedIssues: number;
233
+ credibility: number;
234
+ issueCredibility: number;
235
+ isEligible: boolean;
236
+ successLevel: "strong" | "emerging" | "weak" | "maintainer_context";
237
+ strengths: string[];
238
+ risks: string[];
239
+ }>;
240
+ successPatterns: OutcomePattern[];
241
+ failurePatterns: OutcomePattern[];
242
+ summary: string;
243
+ };
244
+ export type CollisionItem = {
245
+ type: "issue" | "pull_request" | "recent_merged_pull_request";
246
+ number: number;
247
+ title: string;
248
+ };
249
+ export type CollisionCluster = {
250
+ id: string;
251
+ risk: "low" | "medium" | "high";
252
+ reason: string;
253
+ items: CollisionItem[];
254
+ };
255
+ export type CollisionReport = {
256
+ repoFullName: string;
257
+ generatedAt: string;
258
+ summary: {
259
+ clusterCount: number;
260
+ highRiskCount: number;
261
+ itemsReviewed: number;
262
+ };
263
+ clusters: CollisionCluster[];
264
+ };
265
+ export type RoleContext = {
266
+ login: string;
267
+ repoFullName: string;
268
+ generatedAt: string;
269
+ role: ContributorRole;
270
+ maintainerLane: boolean;
271
+ normalContributorEvidenceAllowed: boolean;
272
+ source: "github_association" | "repo_owner_match" | "gittensor_api" | "cache" | "unknown";
273
+ association?: string | null | undefined;
274
+ reasons: string[];
275
+ guidance: string;
276
+ };
277
+ export type LaneAdvice = {
278
+ lane: ParticipationLane;
279
+ repoFullName: string;
280
+ issueDiscoveryShare?: number | undefined;
281
+ directPrShare?: number | undefined;
282
+ summary: string;
283
+ contributorGuidance: string;
284
+ maintainerGuidance: string;
285
+ };
286
+ export type QueueHealth = {
287
+ repoFullName: string;
288
+ generatedAt: string;
289
+ burdenScore: number;
290
+ level: "low" | "medium" | "high" | "critical";
291
+ summary: string;
292
+ signals: {
293
+ openIssues: number;
294
+ openPullRequests: number;
295
+ unlinkedPullRequests: number;
296
+ stalePullRequests: number;
297
+ draftPullRequests: number;
298
+ maintainerAuthoredPullRequests: number;
299
+ collisionClusters: number;
300
+ ageBuckets: {
301
+ under7Days: number;
302
+ days7To30: number;
303
+ over30Days: number;
304
+ };
305
+ likelyReviewablePullRequests: number;
306
+ cachedOpenPullRequests?: number | undefined;
307
+ likelyReviewablePullRequestsSource?: "cache" | "sampled_cache" | "authoritative" | undefined;
308
+ };
309
+ findings: SignalFinding[];
310
+ rankedPullRequests?: {
311
+ number: number;
312
+ title: string;
313
+ authorLogin: string;
314
+ recommendation: string;
315
+ }[];
316
+ };
317
+ export type RepoFitRecommendation = {
318
+ recommendation: "pursue" | "cleanup_first" | "maintainer_lane" | "avoid_for_now" | "unknown";
319
+ };
@@ -0,0 +1,11 @@
1
+ // Local type mirrors for the reward-risk engine module (#2281).
2
+ //
3
+ // Mirrored by hand from `src/types.ts` and `src/signals/engine.ts` — the engine package cannot import
4
+ // across into `src/`, so (as with `predicted-gate-types.ts`) these are kept in sync manually. Types that
5
+ // only ever reach the injected `src`-side builders (see `RewardRiskEngineDeps` in `../reward-risk.ts`) or
6
+ // `buildScorePreview` are subset mirrors carrying just the fields those consumers require: because the
7
+ // omitted `src` fields are all optional, a subset stays mutually assignable to the full `src` type, and the
8
+ // real runtime objects still flow through the injected builders untouched. Types that appear in this
9
+ // module's PUBLIC return surface (`RoleContext`, `LaneAdvice`, `QueueHealth`) are full verbatim copies so
10
+ // existing consumers can read every field.
11
+ export {};
@@ -0,0 +1 @@
1
+ export declare function nowIso(): string;
@@ -0,0 +1,3 @@
1
+ export function nowIso() {
2
+ return new Date().toISOString();
3
+ }
@@ -0,0 +1,2 @@
1
+ /** Published semver of `@loopover/engine`, derived from this package's own package.json. */
2
+ export declare const ENGINE_VERSION: string;
@@ -0,0 +1,3 @@
1
+ import ownPackageJson from "../package.json" with { type: "json" };
2
+ /** Published semver of `@loopover/engine`, derived from this package's own package.json. */
3
+ export const ENGINE_VERSION = ownPackageJson.version;