@afaik-lab/weigh 0.0.0 → 0.6.1

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 (349) hide show
  1. package/.env.example +49 -0
  2. package/LICENSE +373 -0
  3. package/README.md +103 -1
  4. package/dist/agent.d.ts +83 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +204 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/ceilings.d.ts +32 -0
  9. package/dist/ceilings.d.ts.map +1 -0
  10. package/dist/ceilings.js +61 -0
  11. package/dist/ceilings.js.map +1 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +530 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/config-cli.d.ts +15 -0
  17. package/dist/config-cli.d.ts.map +1 -0
  18. package/dist/config-cli.js +141 -0
  19. package/dist/config-cli.js.map +1 -0
  20. package/dist/config.d.ts +198 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +373 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/context-cli.d.ts +35 -0
  25. package/dist/context-cli.d.ts.map +1 -0
  26. package/dist/context-cli.js +251 -0
  27. package/dist/context-cli.js.map +1 -0
  28. package/dist/context.d.ts +118 -0
  29. package/dist/context.d.ts.map +1 -0
  30. package/dist/context.js +159 -0
  31. package/dist/context.js.map +1 -0
  32. package/dist/corrections/correction-set.d.ts +67 -0
  33. package/dist/corrections/correction-set.d.ts.map +1 -0
  34. package/dist/corrections/correction-set.js +104 -0
  35. package/dist/corrections/correction-set.js.map +1 -0
  36. package/dist/corrections/correction.d.ts +74 -0
  37. package/dist/corrections/correction.d.ts.map +1 -0
  38. package/dist/corrections/correction.js +154 -0
  39. package/dist/corrections/correction.js.map +1 -0
  40. package/dist/corrections/follow-up.d.ts +69 -0
  41. package/dist/corrections/follow-up.d.ts.map +1 -0
  42. package/dist/corrections/follow-up.js +217 -0
  43. package/dist/corrections/follow-up.js.map +1 -0
  44. package/dist/corrections/index.d.ts +31 -0
  45. package/dist/corrections/index.d.ts.map +1 -0
  46. package/dist/corrections/index.js +31 -0
  47. package/dist/corrections/index.js.map +1 -0
  48. package/dist/corrections/ledger.d.ts +78 -0
  49. package/dist/corrections/ledger.d.ts.map +1 -0
  50. package/dist/corrections/ledger.js +117 -0
  51. package/dist/corrections/ledger.js.map +1 -0
  52. package/dist/corrections/promotion.d.ts +119 -0
  53. package/dist/corrections/promotion.d.ts.map +1 -0
  54. package/dist/corrections/promotion.js +221 -0
  55. package/dist/corrections/promotion.js.map +1 -0
  56. package/dist/corrections/schema.d.ts +125 -0
  57. package/dist/corrections/schema.d.ts.map +1 -0
  58. package/dist/corrections/schema.js +100 -0
  59. package/dist/corrections/schema.js.map +1 -0
  60. package/dist/corrections-cli.d.ts +28 -0
  61. package/dist/corrections-cli.d.ts.map +1 -0
  62. package/dist/corrections-cli.js +157 -0
  63. package/dist/corrections-cli.js.map +1 -0
  64. package/dist/diff.d.ts +105 -0
  65. package/dist/diff.d.ts.map +1 -0
  66. package/dist/diff.js +202 -0
  67. package/dist/diff.js.map +1 -0
  68. package/dist/doctor.d.ts +38 -0
  69. package/dist/doctor.d.ts.map +1 -0
  70. package/dist/doctor.js +197 -0
  71. package/dist/doctor.js.map +1 -0
  72. package/dist/events.d.ts +21 -0
  73. package/dist/events.d.ts.map +1 -0
  74. package/dist/events.js +5 -0
  75. package/dist/events.js.map +1 -0
  76. package/dist/findings.d.ts +510 -0
  77. package/dist/findings.d.ts.map +1 -0
  78. package/dist/findings.js +645 -0
  79. package/dist/findings.js.map +1 -0
  80. package/dist/follow-up-cli.d.ts +88 -0
  81. package/dist/follow-up-cli.d.ts.map +1 -0
  82. package/dist/follow-up-cli.js +208 -0
  83. package/dist/follow-up-cli.js.map +1 -0
  84. package/dist/harness.d.ts +64 -0
  85. package/dist/harness.d.ts.map +1 -0
  86. package/dist/harness.js +71 -0
  87. package/dist/harness.js.map +1 -0
  88. package/dist/help/command-help.d.ts +9 -0
  89. package/dist/help/command-help.d.ts.map +1 -0
  90. package/dist/help/command-help.js +21 -0
  91. package/dist/help/command-help.js.map +1 -0
  92. package/dist/help/commands/answer.d.ts +3 -0
  93. package/dist/help/commands/answer.d.ts.map +1 -0
  94. package/dist/help/commands/answer.js +39 -0
  95. package/dist/help/commands/answer.js.map +1 -0
  96. package/dist/help/commands/config.d.ts +3 -0
  97. package/dist/help/commands/config.d.ts.map +1 -0
  98. package/dist/help/commands/config.js +25 -0
  99. package/dist/help/commands/config.js.map +1 -0
  100. package/dist/help/commands/context.d.ts +3 -0
  101. package/dist/help/commands/context.d.ts.map +1 -0
  102. package/dist/help/commands/context.js +44 -0
  103. package/dist/help/commands/context.js.map +1 -0
  104. package/dist/help/commands/corrections.d.ts +3 -0
  105. package/dist/help/commands/corrections.d.ts.map +1 -0
  106. package/dist/help/commands/corrections.js +30 -0
  107. package/dist/help/commands/corrections.js.map +1 -0
  108. package/dist/help/commands/doctor.d.ts +3 -0
  109. package/dist/help/commands/doctor.d.ts.map +1 -0
  110. package/dist/help/commands/doctor.js +12 -0
  111. package/dist/help/commands/doctor.js.map +1 -0
  112. package/dist/help/commands/index.d.ts +4 -0
  113. package/dist/help/commands/index.d.ts.map +1 -0
  114. package/dist/help/commands/index.js +27 -0
  115. package/dist/help/commands/index.js.map +1 -0
  116. package/dist/help/commands/memory.d.ts +3 -0
  117. package/dist/help/commands/memory.d.ts.map +1 -0
  118. package/dist/help/commands/memory.js +33 -0
  119. package/dist/help/commands/memory.js.map +1 -0
  120. package/dist/help/commands/models.d.ts +3 -0
  121. package/dist/help/commands/models.d.ts.map +1 -0
  122. package/dist/help/commands/models.js +17 -0
  123. package/dist/help/commands/models.js.map +1 -0
  124. package/dist/help/commands/options.d.ts +4 -0
  125. package/dist/help/commands/options.d.ts.map +1 -0
  126. package/dist/help/commands/options.js +13 -0
  127. package/dist/help/commands/options.js.map +1 -0
  128. package/dist/help/commands/review.d.ts +3 -0
  129. package/dist/help/commands/review.d.ts.map +1 -0
  130. package/dist/help/commands/review.js +50 -0
  131. package/dist/help/commands/review.js.map +1 -0
  132. package/dist/help/commands/sessions.d.ts +3 -0
  133. package/dist/help/commands/sessions.d.ts.map +1 -0
  134. package/dist/help/commands/sessions.js +23 -0
  135. package/dist/help/commands/sessions.js.map +1 -0
  136. package/dist/help/commands/show.d.ts +3 -0
  137. package/dist/help/commands/show.d.ts.map +1 -0
  138. package/dist/help/commands/show.js +18 -0
  139. package/dist/help/commands/show.js.map +1 -0
  140. package/dist/help/help.d.ts +16 -0
  141. package/dist/help/help.d.ts.map +1 -0
  142. package/dist/help/help.js +68 -0
  143. package/dist/help/help.js.map +1 -0
  144. package/dist/help/index.d.ts +4 -0
  145. package/dist/help/index.d.ts.map +1 -0
  146. package/dist/help/index.js +7 -0
  147. package/dist/help/index.js.map +1 -0
  148. package/dist/index.d.ts +80 -0
  149. package/dist/index.d.ts.map +1 -0
  150. package/dist/index.js +51 -0
  151. package/dist/index.js.map +1 -0
  152. package/dist/knowledge/block.d.ts +65 -0
  153. package/dist/knowledge/block.d.ts.map +1 -0
  154. package/dist/knowledge/block.js +89 -0
  155. package/dist/knowledge/block.js.map +1 -0
  156. package/dist/knowledge/claim.d.ts +143 -0
  157. package/dist/knowledge/claim.d.ts.map +1 -0
  158. package/dist/knowledge/claim.js +303 -0
  159. package/dist/knowledge/claim.js.map +1 -0
  160. package/dist/knowledge/index.d.ts +32 -0
  161. package/dist/knowledge/index.d.ts.map +1 -0
  162. package/dist/knowledge/index.js +29 -0
  163. package/dist/knowledge/index.js.map +1 -0
  164. package/dist/knowledge/novelty.d.ts +65 -0
  165. package/dist/knowledge/novelty.d.ts.map +1 -0
  166. package/dist/knowledge/novelty.js +100 -0
  167. package/dist/knowledge/novelty.js.map +1 -0
  168. package/dist/knowledge/recall.d.ts +134 -0
  169. package/dist/knowledge/recall.d.ts.map +1 -0
  170. package/dist/knowledge/recall.js +229 -0
  171. package/dist/knowledge/recall.js.map +1 -0
  172. package/dist/knowledge/recalled-claim.d.ts +35 -0
  173. package/dist/knowledge/recalled-claim.d.ts.map +1 -0
  174. package/dist/knowledge/recalled-claim.js +67 -0
  175. package/dist/knowledge/recalled-claim.js.map +1 -0
  176. package/dist/knowledge/recalled.d.ts +70 -0
  177. package/dist/knowledge/recalled.d.ts.map +1 -0
  178. package/dist/knowledge/recalled.js +149 -0
  179. package/dist/knowledge/recalled.js.map +1 -0
  180. package/dist/knowledge/schema.d.ts +83 -0
  181. package/dist/knowledge/schema.d.ts.map +1 -0
  182. package/dist/knowledge/schema.js +96 -0
  183. package/dist/knowledge/schema.js.map +1 -0
  184. package/dist/knowledge/staleness.d.ts +48 -0
  185. package/dist/knowledge/staleness.d.ts.map +1 -0
  186. package/dist/knowledge/staleness.js +85 -0
  187. package/dist/knowledge/staleness.js.map +1 -0
  188. package/dist/knowledge/store.d.ts +100 -0
  189. package/dist/knowledge/store.d.ts.map +1 -0
  190. package/dist/knowledge/store.js +184 -0
  191. package/dist/knowledge/store.js.map +1 -0
  192. package/dist/memory/compose-file.d.ts +14 -0
  193. package/dist/memory/compose-file.d.ts.map +1 -0
  194. package/dist/memory/compose-file.js +25 -0
  195. package/dist/memory/compose-file.js.map +1 -0
  196. package/dist/memory/index.d.ts +43 -0
  197. package/dist/memory/index.d.ts.map +1 -0
  198. package/dist/memory/index.js +119 -0
  199. package/dist/memory/index.js.map +1 -0
  200. package/dist/memory/oss.d.ts +62 -0
  201. package/dist/memory/oss.d.ts.map +1 -0
  202. package/dist/memory/oss.js +230 -0
  203. package/dist/memory/oss.js.map +1 -0
  204. package/dist/memory/platform.d.ts +37 -0
  205. package/dist/memory/platform.d.ts.map +1 -0
  206. package/dist/memory/platform.js +131 -0
  207. package/dist/memory/platform.js.map +1 -0
  208. package/dist/memory/scope.d.ts +49 -0
  209. package/dist/memory/scope.d.ts.map +1 -0
  210. package/dist/memory/scope.js +70 -0
  211. package/dist/memory/scope.js.map +1 -0
  212. package/dist/memory/types.d.ts +113 -0
  213. package/dist/memory/types.d.ts.map +1 -0
  214. package/dist/memory/types.js +18 -0
  215. package/dist/memory/types.js.map +1 -0
  216. package/dist/memory-cli.d.ts +17 -0
  217. package/dist/memory-cli.d.ts.map +1 -0
  218. package/dist/memory-cli.js +107 -0
  219. package/dist/memory-cli.js.map +1 -0
  220. package/dist/models-cli.d.ts +12 -0
  221. package/dist/models-cli.d.ts.map +1 -0
  222. package/dist/models-cli.js +54 -0
  223. package/dist/models-cli.js.map +1 -0
  224. package/dist/models.d.ts +111 -0
  225. package/dist/models.d.ts.map +1 -0
  226. package/dist/models.js +228 -0
  227. package/dist/models.js.map +1 -0
  228. package/dist/paths.d.ts +35 -0
  229. package/dist/paths.d.ts.map +1 -0
  230. package/dist/paths.js +65 -0
  231. package/dist/paths.js.map +1 -0
  232. package/dist/profile.d.ts +28 -0
  233. package/dist/profile.d.ts.map +1 -0
  234. package/dist/profile.js +154 -0
  235. package/dist/profile.js.map +1 -0
  236. package/dist/progress.d.ts +70 -0
  237. package/dist/progress.d.ts.map +1 -0
  238. package/dist/progress.js +132 -0
  239. package/dist/progress.js.map +1 -0
  240. package/dist/quiet.d.ts +2 -0
  241. package/dist/quiet.d.ts.map +1 -0
  242. package/dist/quiet.js +21 -0
  243. package/dist/quiet.js.map +1 -0
  244. package/dist/reconcile/continuation.d.ts +132 -0
  245. package/dist/reconcile/continuation.d.ts.map +1 -0
  246. package/dist/reconcile/continuation.js +306 -0
  247. package/dist/reconcile/continuation.js.map +1 -0
  248. package/dist/reconcile/index.d.ts +26 -0
  249. package/dist/reconcile/index.d.ts.map +1 -0
  250. package/dist/reconcile/index.js +28 -0
  251. package/dist/reconcile/index.js.map +1 -0
  252. package/dist/reconcile/outcome-set.d.ts +53 -0
  253. package/dist/reconcile/outcome-set.d.ts.map +1 -0
  254. package/dist/reconcile/outcome-set.js +124 -0
  255. package/dist/reconcile/outcome-set.js.map +1 -0
  256. package/dist/reconcile/outcome.d.ts +56 -0
  257. package/dist/reconcile/outcome.d.ts.map +1 -0
  258. package/dist/reconcile/outcome.js +60 -0
  259. package/dist/reconcile/outcome.js.map +1 -0
  260. package/dist/reconcile/reconciliation.d.ts +49 -0
  261. package/dist/reconcile/reconciliation.d.ts.map +1 -0
  262. package/dist/reconcile/reconciliation.js +88 -0
  263. package/dist/reconcile/reconciliation.js.map +1 -0
  264. package/dist/reconcile/schema.d.ts +157 -0
  265. package/dist/reconcile/schema.d.ts.map +1 -0
  266. package/dist/reconcile/schema.js +97 -0
  267. package/dist/reconcile/schema.js.map +1 -0
  268. package/dist/record/index.d.ts +23 -0
  269. package/dist/record/index.d.ts.map +1 -0
  270. package/dist/record/index.js +25 -0
  271. package/dist/record/index.js.map +1 -0
  272. package/dist/record/review-record.d.ts +28 -0
  273. package/dist/record/review-record.d.ts.map +1 -0
  274. package/dist/record/review-record.js +78 -0
  275. package/dist/record/review-record.js.map +1 -0
  276. package/dist/record/schema.d.ts +153 -0
  277. package/dist/record/schema.d.ts.map +1 -0
  278. package/dist/record/schema.js +87 -0
  279. package/dist/record/schema.js.map +1 -0
  280. package/dist/record/store.d.ts +83 -0
  281. package/dist/record/store.d.ts.map +1 -0
  282. package/dist/record/store.js +162 -0
  283. package/dist/record/store.js.map +1 -0
  284. package/dist/record/stored-review.d.ts +36 -0
  285. package/dist/record/stored-review.d.ts.map +1 -0
  286. package/dist/record/stored-review.js +90 -0
  287. package/dist/record/stored-review.js.map +1 -0
  288. package/dist/refute.d.ts +318 -0
  289. package/dist/refute.d.ts.map +1 -0
  290. package/dist/refute.js +513 -0
  291. package/dist/refute.js.map +1 -0
  292. package/dist/render.d.ts +212 -0
  293. package/dist/render.d.ts.map +1 -0
  294. package/dist/render.js +544 -0
  295. package/dist/render.js.map +1 -0
  296. package/dist/review-cli.d.ts +181 -0
  297. package/dist/review-cli.d.ts.map +1 -0
  298. package/dist/review-cli.js +598 -0
  299. package/dist/review-cli.js.map +1 -0
  300. package/dist/reviewer.d.ts +297 -0
  301. package/dist/reviewer.d.ts.map +1 -0
  302. package/dist/reviewer.js +584 -0
  303. package/dist/reviewer.js.map +1 -0
  304. package/dist/session-cli.d.ts +17 -0
  305. package/dist/session-cli.d.ts.map +1 -0
  306. package/dist/session-cli.js +62 -0
  307. package/dist/session-cli.js.map +1 -0
  308. package/dist/session.d.ts +36 -0
  309. package/dist/session.d.ts.map +1 -0
  310. package/dist/session.js +105 -0
  311. package/dist/session.js.map +1 -0
  312. package/dist/settings.d.ts +68 -0
  313. package/dist/settings.d.ts.map +1 -0
  314. package/dist/settings.js +175 -0
  315. package/dist/settings.js.map +1 -0
  316. package/dist/show-cli.d.ts +39 -0
  317. package/dist/show-cli.d.ts.map +1 -0
  318. package/dist/show-cli.js +56 -0
  319. package/dist/show-cli.js.map +1 -0
  320. package/dist/stdout.d.ts +28 -0
  321. package/dist/stdout.d.ts.map +1 -0
  322. package/dist/stdout.js +44 -0
  323. package/dist/stdout.js.map +1 -0
  324. package/dist/target.d.ts +58 -0
  325. package/dist/target.d.ts.map +1 -0
  326. package/dist/target.js +96 -0
  327. package/dist/target.js.map +1 -0
  328. package/dist/tools/index.d.ts +93 -0
  329. package/dist/tools/index.d.ts.map +1 -0
  330. package/dist/tools/index.js +146 -0
  331. package/dist/tools/index.js.map +1 -0
  332. package/dist/tools/root.d.ts +62 -0
  333. package/dist/tools/root.d.ts.map +1 -0
  334. package/dist/tools/root.js +51 -0
  335. package/dist/tools/root.js.map +1 -0
  336. package/dist/usage.d.ts +75 -0
  337. package/dist/usage.d.ts.map +1 -0
  338. package/dist/usage.js +100 -0
  339. package/dist/usage.js.map +1 -0
  340. package/dist/version.d.ts +14 -0
  341. package/dist/version.d.ts.map +1 -0
  342. package/dist/version.js +26 -0
  343. package/dist/version.js.map +1 -0
  344. package/dist/workspace.d.ts +48 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/dist/workspace.js +126 -0
  347. package/dist/workspace.js.map +1 -0
  348. package/docker-compose.yml +61 -0
  349. package/package.json +72 -1
@@ -0,0 +1,645 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ import { createHash } from 'crypto';
5
+ import { readFileSync } from 'fs';
6
+ import { z } from 'zod';
7
+ import { confine } from './tools/root.js';
8
+ /**
9
+ * What a review produces, and how a finding recognises itself later.
10
+ *
11
+ * Everything downstream keys off this: within-run dedupe, "still open or
12
+ * fixed" across runs, and corrections that must suppress a finding the next
13
+ * time it appears. So a finding needs an identity that survives the code
14
+ * moving, which a file-and-line pair does not — one commit on the base branch
15
+ * and every line number is wrong.
16
+ */
17
+ export const SEVERITIES = ['critical', 'high', 'medium', 'low', 'nit'];
18
+ /** Most severe first, for ranking and for a confidence floor by severity. */
19
+ export const SEVERITY_ORDER = {
20
+ critical: 0,
21
+ high: 1,
22
+ medium: 2,
23
+ low: 3,
24
+ nit: 4,
25
+ };
26
+ export const CATEGORIES = [
27
+ 'correctness',
28
+ 'security',
29
+ 'performance',
30
+ 'concurrency',
31
+ 'error-handling',
32
+ 'api-contract',
33
+ 'testing',
34
+ 'maintainability',
35
+ 'style',
36
+ ];
37
+ /**
38
+ * A claim's grounds: a place in the head tree, and what was there when the
39
+ * claim was made. The snippet is what lets a later run tell "the code still
40
+ * says this" from "someone changed it underneath the finding".
41
+ */
42
+ export const evidenceSchema = z.object({
43
+ path: z.string().describe('Path in the repository under review'),
44
+ line: z.number().int().positive().describe('Line number in the head tree'),
45
+ snippet: z.string().describe('The line as it reads now — quote it exactly'),
46
+ });
47
+ /**
48
+ * The shape the model is required to return.
49
+ *
50
+ * No id and no fingerprint: those are computed by Finding from its location and
51
+ * the code there, never asserted by the model. A model-chosen identifier would
52
+ * change with its wording, which is exactly what the fingerprint exists to
53
+ * survive.
54
+ */
55
+ export const reportedFindingSchema = z.object({
56
+ severity: z.enum(SEVERITIES),
57
+ category: z.enum(CATEGORIES),
58
+ title: z.string().min(1).describe('One line, specific: what is wrong, not what to do'),
59
+ body: z.string().min(1).describe('The argument, and why it matters here'),
60
+ path: z.string().describe('File the finding is about'),
61
+ line: z.number().int().positive().describe('Line in the head tree the finding anchors to'),
62
+ evidence: z.array(evidenceSchema).describe('Code this claim rests on. Cite it or drop the claim.'),
63
+ confidence: z.number().min(0).max(1).describe('How sure you are, 0 to 1'),
64
+ // Nullable rather than optional, and the same for `verdict` below. OpenAI's
65
+ // strict json_schema mode requires every property to appear in `required`,
66
+ // and rejects the whole request otherwise — measured: every openai/* model
67
+ // returns invalid_json_schema for a schema with an optional key, while
68
+ // Anthropic and Google accept it. An optional field silently cost us the
69
+ // structured-output channel on a third of the catalogue.
70
+ suggestion: z.string().nullish().describe('A concrete patch, or null when there is no obvious one'),
71
+ });
72
+ /** What the review recommends, mildest first. */
73
+ export const VERDICTS = ['approve', 'needs_work', 'block'];
74
+ export const reviewOutputSchema = z.object({
75
+ findings: z.array(reportedFindingSchema),
76
+ summary: z.string().describe('Two or three sentences on the change as a whole'),
77
+ verdict: z
78
+ .enum(VERDICTS)
79
+ .nullish()
80
+ .describe('block: do not merge as is. needs_work: wrong behaviour to fix first, none dangerous. approve: nothing to fix, or only low and nit findings.'),
81
+ });
82
+ /**
83
+ * What the refute pass may say about one finding: keep it, or kill it and name
84
+ * what kills it.
85
+ *
86
+ * A ruling rather than a verdict, though `Verdict` further down is the nearer
87
+ * word — that one is the review's single recommendation about the whole
88
+ * change, and this is one answer about one finding. Two things under one name
89
+ * would be confused at every call site that holds both.
90
+ *
91
+ * The refuter rules on findings it was handed and does nothing else. It cannot
92
+ * introduce a finding, reword one, or move its severity, because the schema
93
+ * gives it nowhere to put any of that. A second pass that could edit findings
94
+ * would be a second reviewer, and a second reviewer would need refuting too.
95
+ */
96
+ export const DECISIONS = ['keep', 'drop'];
97
+ /**
98
+ * The only reasons a finding is allowed to die.
99
+ *
100
+ * Narrow on purpose, and the narrowness is the whole design. "I am not
101
+ * convinced" is not on this list: a refuter that may drop what it merely
102
+ * doubts will drop real findings, and a real finding dropped here leaves no
103
+ * trace in the review — the run reads cleaner, not broken. So a kill has to
104
+ * point at something outside the finding that contradicts it.
105
+ *
106
+ * `code` — the refuter re-read the file and it does not say what the finding
107
+ * says it says. The strongest ground, and the only one available before the
108
+ * corrections land.
109
+ *
110
+ * `convention` — the code is deliberate and the repository does it this way
111
+ * throughout; the finding is a disagreement about house style wearing a
112
+ * defect's clothes.
113
+ *
114
+ * `corrected` — a human already ruled on this same fingerprint, as `incorrect`
115
+ * or as `intentional`. Those two alone. `wont-fix` and `out-of-scope` are
116
+ * acknowledgements that the defect is real and was deprioritised, and a
117
+ * refuter that accepted them would be learning to stop mentioning known bugs.
118
+ */
119
+ export const GROUNDS = ['code', 'convention', 'corrected'];
120
+ export const rulingSchema = z.object({
121
+ // The join key, and the reason this schema can stay this small. It is
122
+ // `Finding.id` — the fingerprint — named for what it is here rather than
123
+ // `id`, because a field called `id` in a model's answer is an invitation to
124
+ // invent one, and `reportedFindingSchema` above withholds that field for
125
+ // exactly that reason.
126
+ fingerprint: z.string().describe('The id of the finding being ruled on, copied exactly'),
127
+ decision: z.enum(DECISIONS).describe('drop only when one of the grounds applies; otherwise keep'),
128
+ // Nullable rather than optional, as `suggestion` above and for the same
129
+ // reason. Null is the honest answer for a keep: a kill must be justified,
130
+ // a keep need not be.
131
+ ground: z.enum(GROUNDS).nullish().describe('What kills it. Null when keeping.'),
132
+ reason: z
133
+ .string()
134
+ .nullish()
135
+ .describe('One line a human can check the ground against. Null when keeping.'),
136
+ });
137
+ /**
138
+ * A ruling per finding, and nothing else.
139
+ *
140
+ * No summary and no verdict: the refuter has seen the findings, not the
141
+ * change, and anything it said about the change as a whole would be a
142
+ * confident opinion formed from a list of complaints about it.
143
+ *
144
+ * A drop that arrives with no ground is not rejected here — parsing stays
145
+ * lenient, as it does for the review. It is read as a keep instead, which is
146
+ * where the pass fails safe, and that belongs in the refuter rather than in a
147
+ * parser that can only throw the batch away.
148
+ */
149
+ export const refuteOutputSchema = z.object({
150
+ rulings: z.array(rulingSchema).describe('One per finding you were given, in any order'),
151
+ });
152
+ /**
153
+ * The schema as a provider's strict mode requires it.
154
+ *
155
+ * OpenAI rejects a json_schema whose `required` omits any property —
156
+ * measured, every `openai/*` model answers `invalid_json_schema` for a schema
157
+ * with an optional key, while Anthropic and Google accept it. So the request
158
+ * lists every key as required, and a key Weigh does not insist on is nullable
159
+ * instead: the model must mention it, and `null` is a permitted answer.
160
+ *
161
+ * Strict mode asks for two things of every object, and this sets both rather
162
+ * than inheriting one of them from whatever zod happens to emit: each property
163
+ * listed in `required`, and `additionalProperties: false`. zod 4.6.2 already
164
+ * writes the second, so today the line changes nothing — which is the point.
165
+ * A schema that satisfies the contract by coincidence fails silently the day
166
+ * the coincidence ends, and the failure is a 400 that costs the channel
167
+ * without saying so.
168
+ *
169
+ * `$schema` goes: it is metadata about the document, not part of it, and no
170
+ * provider asks for it. What stays is every constraint that carries meaning —
171
+ * `minLength`, `maximum` and the rest are measured as accepted, and dropping
172
+ * them to be safe would trade real validation for imagined portability.
173
+ *
174
+ * Parsing stays separate and stays lenient. A model that omits a key entirely
175
+ * still had its review read — losing a complete review over a missing
176
+ * `verdict` would be a worse failure than the one this fixes.
177
+ */
178
+ export function strictJsonSchema(schema) {
179
+ const json = z.toJSONSchema(schema);
180
+ delete json.$schema;
181
+ const tighten = (node) => {
182
+ if (Array.isArray(node))
183
+ return node.forEach(tighten);
184
+ if (!node || typeof node !== 'object')
185
+ return;
186
+ const obj = node;
187
+ // Keyed off `properties` rather than `type`, so a node that describes an
188
+ // object without saying so is still tightened.
189
+ const properties = obj.properties;
190
+ if (properties && typeof properties === 'object') {
191
+ obj.required = Object.keys(properties);
192
+ obj.additionalProperties = false;
193
+ }
194
+ Object.values(obj).forEach(tighten);
195
+ };
196
+ tighten(json);
197
+ return json;
198
+ }
199
+ /**
200
+ * The review's recommendation, and the floor its own findings put under it.
201
+ *
202
+ * Asked for rather than computed, because whether a change should ship is a
203
+ * judgement about consequence and the model has the context a rule does not.
204
+ * But a recommendation that contradicts the findings beneath it is worse than
205
+ * no recommendation at all — nobody can act on "approve" printed above a
206
+ * critical — so the findings set a floor the answer is raised to.
207
+ *
208
+ * Optional in the schema on purpose. A missing recommendation is derived from
209
+ * the findings; it is never the reason an otherwise complete review is thrown
210
+ * away.
211
+ */
212
+ export class Verdict {
213
+ level;
214
+ reported;
215
+ complete;
216
+ loweredFrom;
217
+ constructor(level,
218
+ /** What the model said, when it said anything. */
219
+ reported,
220
+ /**
221
+ * Whether the review that produced it ran to the end.
222
+ *
223
+ * A run stopped by its ceilings has findings, but not the absence of the
224
+ * ones it never looked for — and `approve` asserts exactly that absence.
225
+ * Reporting an unfinished run as an approval is the single worst thing
226
+ * this tool could do, so an incomplete verdict says so in place of its
227
+ * level rather than beside it.
228
+ */
229
+ complete = true,
230
+ /**
231
+ * The level this one came down from, when a refute pass undercut it.
232
+ *
233
+ * The previous *level*, not the model's answer — they are only the same
234
+ * thing when the model was never overruled. A verdict can be lowered from
235
+ * `block` and still be above what the model reported, and a boolean here
236
+ * forced the renderer to name `reported` as the origin, which in that
237
+ * case is the wrong end of the move.
238
+ */
239
+ loweredFrom = undefined) {
240
+ this.level = level;
241
+ this.reported = reported;
242
+ this.complete = complete;
243
+ this.loweredFrom = loweredFrom;
244
+ }
245
+ static from(reported, findings) {
246
+ const floor = Verdict._floor(findings);
247
+ if (reported == null)
248
+ return new Verdict(floor, undefined);
249
+ const level = VERDICTS.indexOf(reported) >= VERDICTS.indexOf(floor) ? reported : floor;
250
+ return new Verdict(level, reported);
251
+ }
252
+ /**
253
+ * The verdict of a review that did not finish.
254
+ *
255
+ * Findings it did reach still count — they are true whatever stopped the
256
+ * run — so the level is their floor. What is withheld is the claim that
257
+ * nothing else is there.
258
+ */
259
+ static stopped(findings) {
260
+ return new Verdict(Verdict._floor(findings), undefined, false);
261
+ }
262
+ /**
263
+ * The recommendation, re-judged once a refute pass has taken findings away.
264
+ *
265
+ * What moves is the floor, and only the floor. A dropped finding stops
266
+ * compelling a level it used to compel, in exactly the way the floor exists
267
+ * to compel it in the first place — leaving `BLOCK` standing on a finding
268
+ * the report lists as dropped is as unusable as `APPROVE · 1 critical`, and
269
+ * worse in one respect: it is the answer a gate acts on.
270
+ *
271
+ * What does not move is the model's own answer. `Verdict.from` is applied
272
+ * again rather than the bare floor taken, so a reviewer that said `block`
273
+ * still says `block` after the pass. That is deliberate, and it is where
274
+ * the refuter's authority stops: it rules on findings, it has not seen the
275
+ * change, and by its own instructions it never formed a view about whether
276
+ * the change should ship. A second pass may take the findings out from
277
+ * under a recommendation; it may not overturn one, and it must never be
278
+ * able to manufacture an approval.
279
+ *
280
+ * A level the model chose above its own floor is left alone entirely —
281
+ * nothing that was dropped is what it rested on.
282
+ */
283
+ afterRefute(before, after) {
284
+ if (Verdict._floor(before) !== this.level)
285
+ return this;
286
+ const rejudged = Verdict.from(this.reported, after);
287
+ if (rejudged.level === this.level)
288
+ return this;
289
+ return new Verdict(rejudged.level, this.reported, this.complete, this.level);
290
+ }
291
+ /** The mildest recommendation the findings themselves can support. */
292
+ static _floor(findings) {
293
+ let floor = 'approve';
294
+ for (const finding of findings) {
295
+ if (finding.severity === 'critical' || finding.severity === 'high')
296
+ return 'block';
297
+ if (finding.severity === 'medium')
298
+ floor = 'needs_work';
299
+ }
300
+ return floor;
301
+ }
302
+ /**
303
+ * True when the findings overruled a softer answer.
304
+ *
305
+ * Unaffected by a refute pass, and the two can hold at once: a verdict
306
+ * lowered from `block` to `needs_work` is still above a model that said
307
+ * `approve`, and both facts are worth a line. `level` is never below
308
+ * `reported` — `from` only ever raises — so a disagreement between them is
309
+ * always this one.
310
+ */
311
+ get raised() {
312
+ return this.reported !== undefined && this.reported !== this.level;
313
+ }
314
+ /** True when a refute pass took away what the level rested on. */
315
+ get lowered() {
316
+ return this.loweredFrom !== undefined;
317
+ }
318
+ get label() {
319
+ if (!this.complete)
320
+ return 'INCOMPLETE';
321
+ return this.level === 'needs_work' ? 'NEEDS WORK' : this.level.toUpperCase();
322
+ }
323
+ /**
324
+ * `level` is absent when the review did not finish.
325
+ *
326
+ * Deliberately absent rather than present-and-qualified. A consumer writing
327
+ * `verdict.level === 'approve'` is the obvious way to gate on this, and an
328
+ * unfinished run whose findings floor happens to be `approve` would sail
329
+ * through it. Omitted, that check is falsy and the gate holds; `floor` still
330
+ * carries what the findings support, for anyone who wants it.
331
+ */
332
+ toJSON() {
333
+ if (!this.complete)
334
+ return { complete: false, floor: this.level, raised: false };
335
+ return {
336
+ level: this.level,
337
+ ...(this.reported && { reported: this.reported }),
338
+ raised: this.raised,
339
+ // Present always, like `raised`, because an absent key is read as false
340
+ // by some consumers and as unknown by others. `loweredFrom` comes with
341
+ // it when there is one: the level it came down from is the fact, and it
342
+ // is not derivable from `reported`.
343
+ lowered: this.lowered,
344
+ ...(this.loweredFrom && { loweredFrom: this.loweredFrom }),
345
+ complete: true,
346
+ };
347
+ }
348
+ }
349
+ /** Reads from a checkout, refusing anything outside it. */
350
+ export class WorkspaceFiles {
351
+ root;
352
+ constructor(root) {
353
+ this.root = root;
354
+ }
355
+ read(path) {
356
+ const target = confine(this.root, path);
357
+ if (!target.ok)
358
+ return null;
359
+ try {
360
+ return readFileSync(target.path, 'utf-8');
361
+ }
362
+ catch {
363
+ return null;
364
+ }
365
+ }
366
+ }
367
+ /** A FileSource backed by content already in hand — parsing a stored review. */
368
+ export class StaticFiles {
369
+ files;
370
+ constructor(files) {
371
+ this.files = files;
372
+ }
373
+ read(path) {
374
+ return this.files[path] ?? null;
375
+ }
376
+ }
377
+ /**
378
+ * The code a finding is pinned to, and the source of its identity.
379
+ *
380
+ * One line where that line says something, widened upward when it does not —
381
+ * a finding anchored to `}` would otherwise share an identity with every other
382
+ * closing brace in the file. Widening upward rather than in both directions
383
+ * keeps the anchor stable when the code below it changes, which is the more
384
+ * common edit.
385
+ */
386
+ export class CodeAnchor {
387
+ text;
388
+ constructor(text) {
389
+ this.text = text;
390
+ }
391
+ /**
392
+ * Collapses formatting so a reformat does not read as a different anchor.
393
+ *
394
+ * Deliberately language-agnostic: stripping comments or normalising syntax
395
+ * would need a parser per language, and the gain is small next to the cost
396
+ * of being wrong about a language we guessed at.
397
+ */
398
+ static normalise(text) {
399
+ return text.replace(/\s+/g, ' ').trim();
400
+ }
401
+ /** A line carrying too little to identify anything. */
402
+ static _trivial(text) {
403
+ return CodeAnchor.normalise(text).length < 12;
404
+ }
405
+ static at(content, line) {
406
+ const lines = content.split('\n');
407
+ const index = line - 1;
408
+ if (index < 0 || index >= lines.length)
409
+ return new CodeAnchor('');
410
+ const parts = [lines[index]];
411
+ for (let i = index - 1; i >= 0 && CodeAnchor._trivial(parts.join(' ')); i--) {
412
+ if (CodeAnchor.normalise(lines[i]) === '')
413
+ continue;
414
+ parts.unshift(lines[i]);
415
+ }
416
+ return new CodeAnchor(CodeAnchor.normalise(parts.join(' ')));
417
+ }
418
+ /** For a finding whose file cannot be read; its own words are all we have. */
419
+ static of(text) {
420
+ return new CodeAnchor(CodeAnchor.normalise(text));
421
+ }
422
+ get isEmpty() {
423
+ return this.text === '';
424
+ }
425
+ /**
426
+ * Identity for a claim: where it is, what the code there says, and what kind
427
+ * of claim it is.
428
+ *
429
+ * The line number is deliberately absent — including it would mean a finding
430
+ * stops recognising itself the moment anything above it is edited, and "have
431
+ * I already said this" is the question the whole memory design rests on.
432
+ *
433
+ * The model's wording is absent too, for the same reason in reverse: the
434
+ * same defect described in two different runs must produce one identity, and
435
+ * no model phrases a sentence the same way twice.
436
+ *
437
+ * The cost is that two genuinely different findings of the same category on
438
+ * the same code collapse into one. That is the right way to be wrong: a
439
+ * merged pair loses a finding once, while a split pair reports the same
440
+ * thing forever.
441
+ */
442
+ fingerprint(path, category) {
443
+ return createHash('sha256')
444
+ .update([path, this.text, category].join(' '))
445
+ .digest('hex')
446
+ .slice(0, 16);
447
+ }
448
+ toString() {
449
+ return this.text;
450
+ }
451
+ }
452
+ /** One thing a review has to say, and the evidence it rests on. */
453
+ export class Finding {
454
+ id;
455
+ anchor;
456
+ severity;
457
+ category;
458
+ title;
459
+ body;
460
+ path;
461
+ line;
462
+ evidence;
463
+ confidence;
464
+ suggestion;
465
+ constructor(reported, anchor) {
466
+ this.severity = reported.severity;
467
+ this.category = reported.category;
468
+ this.title = reported.title;
469
+ this.body = reported.body;
470
+ this.path = reported.path;
471
+ this.line = reported.line;
472
+ this.evidence = reported.evidence;
473
+ this.confidence = reported.confidence;
474
+ this.suggestion = reported.suggestion ?? undefined;
475
+ this.anchor = anchor;
476
+ this.id = anchor.fingerprint(this.path, this.category);
477
+ }
478
+ /** Anchors a reported finding to the code it is about. */
479
+ static from(reported, files) {
480
+ const content = files.read(reported.path);
481
+ // A finding citing a file we cannot read still needs an identity; fall
482
+ // back to its own title so it is at least stable within the run.
483
+ const anchor = content ? CodeAnchor.at(content, reported.line) : CodeAnchor.of(reported.title);
484
+ return new Finding(reported, anchor);
485
+ }
486
+ get rank() {
487
+ return SEVERITY_ORDER[this.severity];
488
+ }
489
+ isSameAs(other) {
490
+ return this.id === other.id;
491
+ }
492
+ /** True when this is the better statement of a finding both describe. */
493
+ supersedes(other) {
494
+ if (this.rank !== other.rank)
495
+ return this.rank < other.rank;
496
+ return this.confidence > other.confidence;
497
+ }
498
+ /** Ordering for output: severity, then confidence, then location. */
499
+ compare(other) {
500
+ return (this.rank - other.rank ||
501
+ other.confidence - this.confidence ||
502
+ this.path.localeCompare(other.path) ||
503
+ this.line - other.line);
504
+ }
505
+ toJSON() {
506
+ return {
507
+ id: this.id,
508
+ severity: this.severity,
509
+ category: this.category,
510
+ title: this.title,
511
+ body: this.body,
512
+ path: this.path,
513
+ line: this.line,
514
+ evidence: [...this.evidence],
515
+ confidence: this.confidence,
516
+ suggestion: this.suggestion ?? null,
517
+ anchor: this.anchor.text,
518
+ };
519
+ }
520
+ }
521
+ /**
522
+ * A finding the refute pass killed, and what killed it.
523
+ *
524
+ * Kept rather than deleted, because a finding that vanishes between the review
525
+ * and the report is indistinguishable from one that was never written. The
526
+ * person reading the review has no way to tell a refuter doing its job from a
527
+ * refuter quietly eating the thing they needed to see, and the second failure
528
+ * looks exactly like a cleaner review.
529
+ */
530
+ export class Suppression {
531
+ finding;
532
+ ground;
533
+ reason;
534
+ constructor(finding,
535
+ /** A refute ground, or `confidence` when a floor withheld it. */
536
+ ground,
537
+ /** One line a human can check the ground against, when the pass gave one. */
538
+ reason) {
539
+ this.finding = finding;
540
+ this.ground = ground;
541
+ this.reason = reason;
542
+ }
543
+ toJSON() {
544
+ return {
545
+ finding: this.finding.toJSON(),
546
+ ground: this.ground,
547
+ reason: this.reason ?? null,
548
+ };
549
+ }
550
+ }
551
+ /** The findings from one review, and the operations that only make sense over all of them. */
552
+ export class FindingSet {
553
+ findings;
554
+ _suppressed;
555
+ constructor(findings = [],
556
+ /**
557
+ * What a refute pass took out, travelling with what it left.
558
+ *
559
+ * On the set rather than beside it so that every operation below has to
560
+ * decide what happens to it. A set that dropped its suppressions on the
561
+ * way through `deduped()` would report an honest count of survivors and
562
+ * silently lose the account of what is missing.
563
+ */
564
+ _suppressed = []) {
565
+ this.findings = findings;
566
+ this._suppressed = _suppressed;
567
+ }
568
+ /** What was killed, and why. Empty unless a refute pass ran. */
569
+ get suppressed() {
570
+ return this._suppressed;
571
+ }
572
+ static from(reported, files) {
573
+ return new FindingSet(reported.map((r) => Finding.from(r, files)));
574
+ }
575
+ get size() {
576
+ return this.findings.length;
577
+ }
578
+ get isEmpty() {
579
+ return this.findings.length === 0;
580
+ }
581
+ [Symbol.iterator]() {
582
+ return this.findings[Symbol.iterator]();
583
+ }
584
+ /**
585
+ * One finding per identity, keeping the most serious statement of it.
586
+ *
587
+ * A single loop can still report the same defect twice — once where it is
588
+ * introduced and once where it is called.
589
+ */
590
+ deduped() {
591
+ const best = new Map();
592
+ for (const finding of this.findings) {
593
+ const existing = best.get(finding.id);
594
+ if (!existing || finding.supersedes(existing))
595
+ best.set(finding.id, finding);
596
+ }
597
+ return new FindingSet([...best.values()], this._suppressed);
598
+ }
599
+ /**
600
+ * Withholds anything the reviewer is not sure enough about to be worth saying.
601
+ *
602
+ * The withheld findings are kept, not deleted, and for the same reason a
603
+ * refuted one is: a finding that vanishes between the model and the report
604
+ * is indistinguishable from one that was never written. That matters more
605
+ * here than it does for a kill, because this floor is a number the user
606
+ * guessed at — and the only way to tell whether they guessed well is to see
607
+ * what fell below it.
608
+ *
609
+ * A floor of 0 withholds nothing and is the default. The threshold is not
610
+ * ours to pick: it wants real findings to be set against.
611
+ */
612
+ atLeastConfident(floor) {
613
+ if (floor <= 0)
614
+ return this;
615
+ const kept = [];
616
+ const withheld = [];
617
+ for (const finding of this.findings) {
618
+ if (finding.confidence >= floor)
619
+ kept.push(finding);
620
+ else {
621
+ withheld.push(new Suppression(finding, 'confidence', `the reviewer rated it ${finding.confidence.toFixed(2)}, below the ${floor.toFixed(2)} floor`));
622
+ }
623
+ }
624
+ return new FindingSet(kept, [...this._suppressed, ...withheld]);
625
+ }
626
+ ranked() {
627
+ return [...this.findings].sort((a, b) => a.compare(b));
628
+ }
629
+ /** Ranked, and grouped for output that leads with what matters. */
630
+ bySeverity() {
631
+ const groups = new Map();
632
+ for (const finding of this.ranked()) {
633
+ const group = groups.get(finding.severity);
634
+ if (group)
635
+ group.push(finding);
636
+ else
637
+ groups.set(finding.severity, [finding]);
638
+ }
639
+ return groups;
640
+ }
641
+ toJSON() {
642
+ return this.ranked().map((f) => f.toJSON());
643
+ }
644
+ }
645
+ //# sourceMappingURL=findings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findings.js","sourceRoot":"","sources":["../src/findings.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OA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