@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,598 @@
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 { loadConfig } from './config.js';
5
+ import { ProgressReporter } from './progress.js';
6
+ import { ReviewRenderer } from './render.js';
7
+ import { buildContext, renderContext } from './context.js';
8
+ import { collectDiff, resolveCommit, workingState } from './diff.js';
9
+ import { CorrectionSet, Corrections } from './corrections/index.js';
10
+ import { Knowledge, Recall } from './knowledge/index.js';
11
+ import { createMemoryStore } from './memory/index.js';
12
+ import { readProfile } from './profile.js';
13
+ import { ReviewRecord, ReviewStore } from './record/index.js';
14
+ import { Continuation } from './reconcile/index.js';
15
+ import { Reviewer } from './reviewer.js';
16
+ import { Refuter } from './refute.js';
17
+ import { Spend } from './usage.js';
18
+ import { writeOut } from './stdout.js';
19
+ import { repoRootOf, resolveTarget } from './target.js';
20
+ import { createWorkspace } from './workspace.js';
21
+ /**
22
+ * `weigh review` — assemble the context, then either show it or act on it.
23
+ *
24
+ * The assembly is the same either way. `--dry-run` stops before the model call
25
+ * so the bundle and its cost can be inspected before anything is spent; without
26
+ * it, the same bundle goes to the reviewer.
27
+ */
28
+ export class ReviewCommand {
29
+ _options;
30
+ constructor(_options) {
31
+ this._options = _options;
32
+ }
33
+ async run() {
34
+ const prepared = this._prepare();
35
+ try {
36
+ const config = this._config();
37
+ // Decided before anything is shown or sent, because it decides what is:
38
+ // a continuation is handed only what changed since the review it
39
+ // continues, and a dry run has to preview that same narrower bundle.
40
+ const continuation = this._continuation(prepared.context, config);
41
+ const { context, diff } = continuation ? this._sinceLast(prepared, continuation) : prepared;
42
+ if (continuation && context.since && context.files.length === 0) {
43
+ return await this._unchanged(continuation, context.since, prepared.leftOut);
44
+ }
45
+ if (this._options.dryRun)
46
+ return await this._showContext(context, diff, config, continuation);
47
+ return await this._review(context, diff, config, continuation);
48
+ }
49
+ finally {
50
+ prepared.workspace.cleanup();
51
+ }
52
+ }
53
+ /**
54
+ * Everything up to the model call. Throws with a usable message, never a stack.
55
+ *
56
+ * The diff comes back beside the context because recall queries the hunks
57
+ * themselves, file by file, and the context carries them only as one joined
58
+ * string sized to a prompt budget.
59
+ */
60
+ _prepare() {
61
+ const target = resolveTarget({ ...(this._options.repo && { repo: this._options.repo }) });
62
+ const uncommitted = this._options.uncommitted ?? false;
63
+ const state = workingState(target.root);
64
+ // `--uncommitted` reviews the tree as it stands; `--head` names a commit to
65
+ // review instead. Asking for both has no single answer, and the one it used
66
+ // to pick silently was the wrong one.
67
+ if (this._options.head && uncommitted) {
68
+ throw new Error('--head names a commit to review; --uncommitted reviews the working tree. Pass one.');
69
+ }
70
+ // Resolved here, against the user's checkout, because the workspace is
71
+ // checked out before the diff is collected. Without it `--head` moved the
72
+ // diff and left the tree at HEAD, so every file the model read — and every
73
+ // line a finding was anchored to — came from a different commit than the
74
+ // hunks it was shown.
75
+ const head = this._options.head ? resolveCommit(target.root, this._options.head, 'Head') : undefined;
76
+ const workspace = createWorkspace({
77
+ target,
78
+ ...(head && { sha: head }),
79
+ includeUncommitted: uncommitted,
80
+ });
81
+ try {
82
+ const diff = collectDiff({
83
+ root: workspace.root,
84
+ ...(this._options.base && { base: this._options.base }),
85
+ ...(head && { head }),
86
+ includeUncommitted: uncommitted,
87
+ });
88
+ const context = buildContext({
89
+ target,
90
+ workspace,
91
+ diff,
92
+ profile: readProfile(workspace.root),
93
+ });
94
+ // Reviewing HEAD while the user is looking at unstaged edits reports on
95
+ // code they are not about to push. Say so rather than quietly differing.
96
+ if (!uncommitted && !state.clean) {
97
+ const paths = state.staged.length + state.unstaged.length + state.untracked.length;
98
+ context.workspace.reason += `; working tree has uncommitted changes (${paths} path(s)) — pass --uncommitted to review them`;
99
+ }
100
+ return { context, diff, workspace, target, leftOut: !uncommitted && !state.clean };
101
+ }
102
+ catch (err) {
103
+ workspace.cleanup();
104
+ throw err;
105
+ }
106
+ }
107
+ /**
108
+ * The change narrowed to what moved since the review being continued.
109
+ *
110
+ * A continuation is there to confirm fixes and catch regressions, so it is
111
+ * shown the commits that came after the last review and nothing else — the
112
+ * rest of the branch was reviewed then, and showing it again is what made a
113
+ * second run cost as much as the first and report a fresh crop of findings.
114
+ *
115
+ * The same workspace, profile and base: only the starting commit changes,
116
+ * so `repo` is identical to the full context's and the record still keys
117
+ * the next run to this branch.
118
+ *
119
+ * A last-reviewed commit this checkout no longer has — collected after a
120
+ * force-push, say — leaves nothing to diff from. The full change is the
121
+ * answer then, which is what a continuation was shown before this existed.
122
+ */
123
+ _sinceLast(prepared, continuation) {
124
+ const sha = continuation.prior.repo.headSha;
125
+ if (!sha)
126
+ return prepared;
127
+ const full = prepared.diff;
128
+ try {
129
+ const diff = collectDiff({
130
+ root: prepared.workspace.root,
131
+ base: full.base,
132
+ ...(full.headSha && { head: full.headSha }),
133
+ includeUncommitted: full.uncommitted,
134
+ since: sha,
135
+ });
136
+ const since = { review: continuation.prior.id, sha: diff.since ?? sha };
137
+ const context = buildContext({
138
+ target: prepared.target,
139
+ workspace: prepared.workspace,
140
+ diff,
141
+ profile: prepared.context.profile,
142
+ since,
143
+ });
144
+ // Carries the note `_prepare` added about uncommitted work.
145
+ context.workspace = prepared.context.workspace;
146
+ return { context, diff };
147
+ }
148
+ catch (err) {
149
+ this._warn(`reviewing the whole branch again — ${err?.message ?? err}`);
150
+ return prepared;
151
+ }
152
+ }
153
+ /**
154
+ * The answer when nothing has changed since the review being continued.
155
+ *
156
+ * No call, no record. The last review is still the latest word on this
157
+ * branch, and a run with nothing to look at could only restate its rulings
158
+ * at the cost of a call — or, worse, invent findings to have something to
159
+ * say. A record of that run would also become the next one's baseline,
160
+ * standing in for the review that did the work.
161
+ *
162
+ * Exit 0 either way: the code says whether a review finished, and the one
163
+ * this points at did. A dry run stops here too, since it previews what a
164
+ * review would do.
165
+ */
166
+ async _unchanged(continuation, since, leftOut) {
167
+ if (this._options.quiet)
168
+ return 0;
169
+ if (this._options.json) {
170
+ await writeOut(JSON.stringify({ unchanged: { review: since.review, headSha: since.sha } }) + '\n');
171
+ return 0;
172
+ }
173
+ await writeOut([
174
+ `No changes since review ${since.review} at ${since.sha.slice(0, 8)}; ${continuation.rulesOn ? `its ${continuation.findings.length} finding(s) stand` : 'it reported no findings'}.`,
175
+ ...(leftOut ? ['The working tree has uncommitted changes — pass --uncommitted to review them.'] : []),
176
+ 'Pass --fresh to review the whole branch again.',
177
+ '',
178
+ ].join('\n'));
179
+ return 0;
180
+ }
181
+ _config() {
182
+ const config = loadConfig({
183
+ ...(this._options.model && { model: this._options.model }),
184
+ ...(this._options.maxSteps !== undefined && { maxSteps: this._options.maxSteps }),
185
+ ...(this._options.maxCost !== undefined && { maxCost: this._options.maxCost }),
186
+ ...(this._options.coverageFloor !== undefined && { coverageFloor: this._options.coverageFloor }),
187
+ ...(this._options.confidenceFloor !== undefined && { confidenceFloor: this._options.confidenceFloor }),
188
+ ...(this._options.effort !== undefined && { effort: this._options.effort }),
189
+ }, this._repoRoot());
190
+ // After loadConfig, as applyOverrides does for every other command, so a
191
+ // flag means the same thing whichever command it is passed to.
192
+ if (this._options.user)
193
+ config.memory.userId = this._options.user;
194
+ if (this._options.memoryBackend)
195
+ config.memory.backend = this._options.memoryBackend;
196
+ if (this._options.noMemory)
197
+ config.memory.enabled = false;
198
+ return config;
199
+ }
200
+ /** Where the shared `.weigh.json` is read from: the repository under review. */
201
+ _repoRoot() {
202
+ const repoRoot = repoRootOf(this._options.repo);
203
+ return repoRoot ? { repoRoot } : {};
204
+ }
205
+ // ── Dry run ───────────────────────────────────────────────────────
206
+ async _showContext(context, diff, config, continuation) {
207
+ if (this._options.quiet)
208
+ return 0;
209
+ // Recalled here too, and at the cost of the same reads a review would
210
+ // make. A dry run is what anyone inspects before spending money on a
211
+ // call, and one that showed the diff while leaving out what Weigh is
212
+ // about to say about the repository would be a preview of something else.
213
+ const recalled = await this._recall(context, diff, config);
214
+ const knowledge = recalled && !recalled.isEmpty ? recalled : undefined;
215
+ // The findings the review will rule on, as they follow the change in the
216
+ // prompt. Left out, a dry run of a continuation would show neither that
217
+ // text nor its size, and the size is most of what a dry run is for.
218
+ const carried = continuation?.rulesOn ? { continuation, brief: continuation.render(context) } : undefined;
219
+ if (this._options.json) {
220
+ await writeOut(JSON.stringify({
221
+ ...context,
222
+ ...(knowledge && { recalled: knowledge.toJSON() }),
223
+ ...(carried && {
224
+ carried: {
225
+ review: carried.continuation.prior.id,
226
+ findings: carried.continuation.findings.length,
227
+ rendered: carried.brief,
228
+ },
229
+ }),
230
+ rendered: renderContext(context),
231
+ }) + '\n');
232
+ return 0;
233
+ }
234
+ await writeOut([
235
+ this._contextSummary(context, knowledge, carried),
236
+ '',
237
+ ...(knowledge ? [knowledge.render(), ''] : []),
238
+ renderContext(context),
239
+ '',
240
+ ...(carried ? [carried.brief, ''] : []),
241
+ ].join('\n'));
242
+ return 0;
243
+ }
244
+ _contextSummary(context, recalled, carried) {
245
+ const { repo, totals, estimate } = context;
246
+ const inlined = context.files.filter((f) => f.inlined).length;
247
+ return [
248
+ `workspace ${context.workspace.mode} — ${context.workspace.reason}`,
249
+ `base ${repo.base} ${repo.baseSha.slice(0, 8)}`,
250
+ `head ${repo.uncommitted ? 'working tree' : (repo.headSha?.slice(0, 8) ?? '—')}`,
251
+ `merge base ${repo.mergeBase.slice(0, 8)}`,
252
+ ...(context.since ? [`since ${context.since.sha.slice(0, 8)} (review ${context.since.review})`] : []),
253
+ `changes ${totals.files} file(s), +${totals.additions} −${totals.deletions}`,
254
+ `diff ${inlined} of ${totals.files} inlined${estimate.filesOmitted ? `, ${estimate.filesOmitted} left for the tools` : ''}`,
255
+ // The chars are said here because the estimate below is the context's
256
+ // own and does not know about this block.
257
+ ...(recalled
258
+ ? [`recalled ${recalled.describe()} (${recalled.render().length.toLocaleString()} chars)`]
259
+ : []),
260
+ // Likewise outside the estimate.
261
+ ...(carried
262
+ ? [
263
+ `carried ${carried.continuation.findings.length} finding(s) from review ${carried.continuation.prior.id} (${carried.brief.length.toLocaleString()} chars)`,
264
+ ]
265
+ : []),
266
+ `context ~${estimate.approxTokens.toLocaleString()} tokens (${estimate.chars.toLocaleString()} chars, estimated)`,
267
+ ].join('\n');
268
+ }
269
+ // ── Review ────────────────────────────────────────────────────────
270
+ async _review(context, diff, config, continuation) {
271
+ // Minted before the call, so a run that stops early is still a run with a
272
+ // name — and so the id never depends on what the model did.
273
+ const runId = ReviewRecord.newId();
274
+ // Before the progress line, because what the review was told is part of
275
+ // what it is about to do — and before the call, because the whole point of
276
+ // a recalled convention is a finding that is never born.
277
+ const recalled = await this._recall(context, diff, config);
278
+ // Before the call, for the same reason the recall is. What a human already
279
+ // said about a finding decides whether this run reports it at all, and the
280
+ // two labels a refute pass may stand on must be in hand before that pass
281
+ // is briefed.
282
+ const answered = this._corrections(context);
283
+ const progress = ProgressReporter.for({
284
+ ...(this._options.quiet !== undefined && { quiet: this._options.quiet }),
285
+ ...(this._options.noProgress !== undefined && { noProgress: this._options.noProgress }),
286
+ });
287
+ progress?.start([
288
+ context.since
289
+ ? `${context.totals.files} file(s) since ${context.since.sha.slice(0, 8)}`
290
+ : `${context.totals.files} file(s) against ${context.repo.base}`,
291
+ `${config.model} · ${config.effort} effort`,
292
+ // Worth saying before the run rather than after: it changes what the
293
+ // model is asked for, and a reader watching a review of a branch they
294
+ // have reviewed before should see which one it is standing on.
295
+ ...(continuation
296
+ ? [
297
+ `continuing ${continuation.prior.id} · ${continuation.rulesOn ? `${continuation.findings.length} finding(s) to rule on` : 'nothing to rule on'}`,
298
+ ]
299
+ : []),
300
+ ...(recalled && !recalled.isEmpty ? [recalled.describe()] : []),
301
+ ...(answered.isEmpty ? [] : [answered.describe()]),
302
+ ].join(' · '));
303
+ // `done` writes the blank line that separates the progress from the
304
+ // report, so it has to be the last thing printed. When a refute pass
305
+ // follows, the review is not the last thing to happen.
306
+ const refuting = this._options.refute ?? config.refute;
307
+ const relay = (event) => {
308
+ if (refuting && event.type === 'done')
309
+ return;
310
+ progress?.handle(event);
311
+ };
312
+ const reviewed = await new Reviewer(config).review(context, {
313
+ ...(progress && { onEvent: relay }),
314
+ ...(continuation && { continuation }),
315
+ ...(recalled && !recalled.isEmpty && { knowledge: recalled }),
316
+ ...(answered.isEmpty ? {} : { corrections: answered }),
317
+ });
318
+ const result = refuting ? await this._refute(context, config, reviewed, progress, answered) : reviewed;
319
+ if (refuting)
320
+ progress?.handle({ type: 'done', findings: result.findings.size });
321
+ // Written before anything is printed, and in every output mode. The record
322
+ // is not a presentation of the review — it is the review, and `--quiet`
323
+ // asks for no output rather than for no run.
324
+ const record = new ReviewRecord(runId, context, result);
325
+ const saved = this._save(record, config);
326
+ // A review that stopped on its ceilings is not a review that passed. It
327
+ // still prints everything it computed — coverage, spend, whatever findings
328
+ // it reached — but a caller gating on the exit code must not read an
329
+ // unfinished run as a clean one.
330
+ const code = result.stopped ? 1 : 0;
331
+ // `--quiet` documents itself as no output and an exit code; the review
332
+ // still runs, so a caller using it as a gate gets the same answer.
333
+ if (this._options.quiet)
334
+ return code;
335
+ if (this._options.json) {
336
+ await writeOut(JSON.stringify(record.toJSON()) + '\n');
337
+ return code;
338
+ }
339
+ await writeOut(this._render(context, result, recalled, saved));
340
+ return code;
341
+ }
342
+ /**
343
+ * What Weigh knows about this repository that bears on this change.
344
+ *
345
+ * Nothing here may cost the run its review. A store that is down, a claim
346
+ * that cannot be read, a query that fails — each of those costs this review
347
+ * its context, which is a worse review and not a failed one, and the reason
348
+ * goes to stderr where a reader can see why the report reads as though
349
+ * nothing was remembered.
350
+ */
351
+ async _recall(context, diff, config) {
352
+ if (!config.knowledge.enabled)
353
+ return undefined;
354
+ const knowledge = new Knowledge(createMemoryStore(config.memory), config);
355
+ // Not the same no as the one above. That one is a choice — review this
356
+ // change without being told anything — and this one is an absence, which
357
+ // `weigh doctor` already reports. Both stop here rather than carrying on
358
+ // to an empty block: the caller cannot tell the difference, since it drops
359
+ // an empty recall anyway, but a disabled store would be read fifteen times
360
+ // to be told nothing.
361
+ if (!knowledge.enabled)
362
+ return undefined;
363
+ try {
364
+ return await new Recall(knowledge, config.knowledge, (message) => this._warn(message)).for({
365
+ target: context.repo.target,
366
+ branch: context.repo.branch,
367
+ files: diff.files,
368
+ });
369
+ }
370
+ catch (err) {
371
+ this._warn(`nothing recalled about this repository — ${err?.message ?? err}`);
372
+ return undefined;
373
+ }
374
+ }
375
+ /**
376
+ * The review this run continues, if it continues one.
377
+ *
378
+ * Switched off, the store is not even read: a fresh review is one that does
379
+ * not know what came before, and reading a record it has been told to ignore
380
+ * would only produce a warning nobody asked for.
381
+ */
382
+ _continuation(context, config) {
383
+ // Read before the review runs, and necessarily before this one is saved:
384
+ // the store would otherwise hand back the record we are about to write.
385
+ if (this._options.fresh || !config.continuation)
386
+ return undefined;
387
+ // Keyed to the branch rather than to the repository: another branch's
388
+ // findings are about a different change. A detached HEAD has none.
389
+ const branch = context.repo.branch;
390
+ if (!branch)
391
+ return undefined;
392
+ // Reading is not writing, so `--no-session` does not suppress this. That
393
+ // flag says to keep no record of *this* run.
394
+ try {
395
+ return Continuation.latest(new ReviewStore().history(context.repo.target, branch), context);
396
+ }
397
+ catch (err) {
398
+ // A record that cannot be read costs this run its comparison, not its
399
+ // review.
400
+ this._warn(`could not read the last review — ${err?.message ?? err}`);
401
+ return undefined;
402
+ }
403
+ }
404
+ /**
405
+ * What a human has already ruled about findings in this repository.
406
+ *
407
+ * A failed read costs the run its rulings, never its review. The set comes
408
+ * back empty, so nothing is silenced and nothing is grounded, and the review
409
+ * says too much rather than too little. The reason goes to stderr. In the
410
+ * direction that drops a finding, "could not check" must never come out as
411
+ * "nobody ruled".
412
+ *
413
+ * `--fresh` skips it. That flag asks for a review standing on nothing but
414
+ * the change in front of it, which is what makes two runs of a branch
415
+ * comparable. A suppression would make them differ for a reason that has
416
+ * nothing to do with the prompt.
417
+ */
418
+ _corrections(context) {
419
+ if (this._options.fresh)
420
+ return CorrectionSet.empty();
421
+ const { target, branch } = context.repo;
422
+ try {
423
+ return CorrectionSet.of(new Corrections().inForce(target, branch));
424
+ }
425
+ catch (err) {
426
+ this._warn(`rulings not applied — ${err?.message ?? err}`);
427
+ return CorrectionSet.empty();
428
+ }
429
+ }
430
+ /** Stderr, where it is visible without being part of the report. */
431
+ _warn(message) {
432
+ if (!this._options.quiet)
433
+ process.stderr.write(`Warning: ${message}\n`);
434
+ }
435
+ /**
436
+ * Writes the review where a later run can find it, and returns the path.
437
+ *
438
+ * Nothing downstream may fail because of this. The findings are already in
439
+ * hand; a record that cannot be written costs the next run its history, not
440
+ * this one its review. So the reason goes to stderr, where it is visible
441
+ * without being part of the report — and not at all under `--quiet`, which
442
+ * promises an exit code and nothing else.
443
+ */
444
+ _save(record, config) {
445
+ if (!config.sessionEnabled || this._options.noSession)
446
+ return undefined;
447
+ try {
448
+ return new ReviewStore().save(record);
449
+ }
450
+ catch (err) {
451
+ this._warn(`review not saved — ${err?.message ?? err}`);
452
+ return undefined;
453
+ }
454
+ }
455
+ /**
456
+ * The second pass, and the accounting that makes it one review.
457
+ *
458
+ * Not run on a review that did not finish. Its findings are the ones it
459
+ * managed to reach, its budget is spent, and paying for a second call to
460
+ * take some of them away is the wrong thing to do with what is left. The
461
+ * reason is recorded rather than silently skipped, so a reader who asked
462
+ * for `--refute` learns why they did not get one.
463
+ */
464
+ async _refute(context, config, result, progress, answered) {
465
+ if (result.stopped) {
466
+ return this._notRefuted(result, 'error', 'it was not run — the review itself did not finish.');
467
+ }
468
+ // A call given no budget is a call that fails, and it would fail after
469
+ // spawning a subprocess and reporting a ceiling nobody can act on. Saying
470
+ // so costs nothing and reads as what it is.
471
+ const budget = Refuter.remainingBudget(config.maxCost, result.usage.cost);
472
+ if (budget === 0) {
473
+ return this._notRefuted(result, 'cost', 'it was not run — the review used the whole --max-cost ceiling.');
474
+ }
475
+ const before = result.findings;
476
+ // The rulings are matched against this subset, so applying them to the
477
+ // whole set below can take nothing else out — a carried finding is out of
478
+ // the pass's reach even if it names that finding's fingerprint.
479
+ const candidates = this._refutable(result);
480
+ const carried = before.size - candidates.size;
481
+ // No heading when there is nothing to rule on: `Refuter` makes no call in
482
+ // that case, and a heading over no tool calls reads as a pass that hung.
483
+ if (!candidates.isEmpty) {
484
+ progress?.refuting([
485
+ `${candidates.size}${result.reconciled ? ' new' : ''} finding${candidates.size === 1 ? '' : 's'}`,
486
+ ...(carried > 0 ? [`${carried} from the last review not re-checked`] : []),
487
+ result.model,
488
+ ].join(' · '));
489
+ }
490
+ const pass = await new Refuter(config).refute(candidates, context, {
491
+ ...(progress && { onEvent: (event) => progress.handle(event) }),
492
+ // What is left of the ceiling, not a second helping of it.
493
+ maxCost: budget,
494
+ ...(answered.isEmpty ? {} : { corrections: answered }),
495
+ });
496
+ // The same set the brief was built from. A pass briefed with a ruling and
497
+ // then judged against a different ledger could be told that its own ground
498
+ // does not exist.
499
+ const findings = pass.rulings.applyTo(before, answered);
500
+ // What this pass took, not what the set carries: the confidence floor has
501
+ // already put its own withheld findings in there, and counting those as
502
+ // refute kills would credit the second call with work it never did.
503
+ const dropped = findings.suppressed.length - before.suppressed.length;
504
+ return {
505
+ ...result,
506
+ findings,
507
+ // The recommendation was formed against findings that are no longer all
508
+ // there. Left alone it would print BLOCK over a report whose only high
509
+ // finding is listed as dropped — and the recommendation is the one
510
+ // thing a reader or a gate acts on.
511
+ verdict: result.verdict.afterRefute(before, findings),
512
+ // One review, whatever it took to produce. A footer showing the first
513
+ // call's spend under a report the second call changed would be a figure
514
+ // about something the reader is not looking at.
515
+ usage: Spend.merge(result.usage, pass.usage),
516
+ durationMs: result.durationMs + pass.durationMs,
517
+ refuted: {
518
+ dropped,
519
+ kept: candidates.size - dropped,
520
+ ...(carried > 0 && { carried }),
521
+ ...(pass.stopped && { stopped: pass.stopped }),
522
+ usage: pass.usage,
523
+ durationMs: pass.durationMs,
524
+ },
525
+ };
526
+ }
527
+ /**
528
+ * What a refute pass is shown: on a continuation, only what this run
529
+ * reported for the first time. Carried findings were judged when they were
530
+ * first reported.
531
+ *
532
+ * One place, so a pass that ran and one that did not count `kept` and
533
+ * `carried` over the same split.
534
+ */
535
+ _refutable(result) {
536
+ return result.reconciled ? result.reconciled.newIn(result.findings) : result.findings;
537
+ }
538
+ /** A review the pass never ran on, and the reason it did not. */
539
+ _notRefuted(result, reason, detail) {
540
+ const shown = this._refutable(result).size;
541
+ const carried = result.findings.size - shown;
542
+ return {
543
+ ...result,
544
+ refuted: {
545
+ dropped: 0,
546
+ kept: shown,
547
+ ...(carried > 0 && { carried }),
548
+ stopped: { reason, detail },
549
+ usage: Spend.none(),
550
+ durationMs: 0,
551
+ },
552
+ };
553
+ }
554
+ /** Layout lives in ReviewRenderer; this only supplies the facts. */
555
+ _render(context, result, recalled, saved) {
556
+ const config = this._config();
557
+ const withheld = result.findings.suppressed.filter((s) => s.ground === 'confidence').length;
558
+ const footer = {
559
+ coverage: result.coverage.describe(),
560
+ coverageRatio: result.coverage.ratio,
561
+ model: result.model,
562
+ effort: result.effort,
563
+ channel: result.channel,
564
+ ...(result.stopped && { stopped: result.stopped.detail }),
565
+ nudges: result.nudges,
566
+ ...(withheld > 0 && { withheld: { count: withheld, floor: config.confidenceFloor } }),
567
+ ...(result.refuted && {
568
+ refuted: {
569
+ dropped: result.refuted.dropped,
570
+ kept: result.refuted.kept,
571
+ ...(result.refuted.carried && { carried: result.refuted.carried }),
572
+ ...(result.refuted.stopped && { stopped: result.refuted.stopped.detail }),
573
+ },
574
+ }),
575
+ modelCalls: result.usage.modelCalls,
576
+ inputTokens: result.usage.inputTokens,
577
+ outputTokens: result.usage.outputTokens,
578
+ cachedTokens: result.usage.cachedTokens,
579
+ ...(result.usage.cost !== undefined && { cost: result.usage.cost }),
580
+ durationMs: result.durationMs,
581
+ base: context.repo.base,
582
+ baseSha: context.repo.baseSha,
583
+ head: context.repo.uncommitted ? 'working tree' : (context.repo.headSha?.slice(0, 8) ?? '—'),
584
+ ...(recalled && !recalled.isEmpty && { recalled: recalled.describe() }),
585
+ ...(result.reconciled && {
586
+ continued: result.reconciled.since
587
+ ? `${result.reconciled.against} · shown changes since ${result.reconciled.since.slice(0, 8)}`
588
+ : result.reconciled.against,
589
+ }),
590
+ ...(saved && { saved }),
591
+ };
592
+ return ReviewRenderer.for(process.stdout).review(result.summary, result.findings.bySeverity(), result.verdict, footer, result.findings.suppressed, result.reconciled);
593
+ }
594
+ }
595
+ export async function runReviewCommand(options) {
596
+ return new ReviewCommand(options).run();
597
+ }
598
+ //# sourceMappingURL=review-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-cli.js","sourceRoot":"","sources":["../src/review-cli.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,UAAU,EAAyD,MAAM,aAAa,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAkC,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAa,MAAM,WAAW,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAiB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAqB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC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