@descryy/core 0.3.0 → 0.5.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 (362) hide show
  1. package/dist/budget/reply.d.ts +11 -46
  2. package/dist/budget/reply.d.ts.map +1 -1
  3. package/dist/budget/reply.js +10 -39
  4. package/dist/budget/reply.js.map +1 -1
  5. package/dist/budget/size.d.ts +2 -21
  6. package/dist/budget/size.d.ts.map +1 -1
  7. package/dist/budget/size.js +3 -24
  8. package/dist/budget/size.js.map +1 -1
  9. package/dist/capabilities/preconditions.d.ts +7 -68
  10. package/dist/capabilities/preconditions.d.ts.map +1 -1
  11. package/dist/capabilities/preconditions.js +6 -57
  12. package/dist/capabilities/preconditions.js.map +1 -1
  13. package/dist/contracts/engine.d.ts +26 -12
  14. package/dist/contracts/engine.d.ts.map +1 -1
  15. package/dist/contracts/engine.js +28 -11
  16. package/dist/contracts/engine.js.map +1 -1
  17. package/dist/contracts/index.d.ts +1 -1
  18. package/dist/contracts/index.d.ts.map +1 -1
  19. package/dist/contracts/index.js.map +1 -1
  20. package/dist/contracts/orphans.d.ts +28 -77
  21. package/dist/contracts/orphans.d.ts.map +1 -1
  22. package/dist/contracts/orphans.js +124 -94
  23. package/dist/contracts/orphans.js.map +1 -1
  24. package/dist/contracts/paths.d.ts +4 -114
  25. package/dist/contracts/paths.d.ts.map +1 -1
  26. package/dist/contracts/paths.js +7 -140
  27. package/dist/contracts/paths.js.map +1 -1
  28. package/dist/contracts/shapes.d.ts +13 -66
  29. package/dist/contracts/shapes.d.ts.map +1 -1
  30. package/dist/contracts/shapes.js +20 -91
  31. package/dist/contracts/shapes.js.map +1 -1
  32. package/dist/governance/budget.d.ts +12 -48
  33. package/dist/governance/budget.d.ts.map +1 -1
  34. package/dist/governance/budget.js +12 -48
  35. package/dist/governance/budget.js.map +1 -1
  36. package/dist/governance/candidate-boundary.d.ts +4 -32
  37. package/dist/governance/candidate-boundary.d.ts.map +1 -1
  38. package/dist/governance/candidate-boundary.js +4 -32
  39. package/dist/governance/candidate-boundary.js.map +1 -1
  40. package/dist/governance/escalation.d.ts +7 -45
  41. package/dist/governance/escalation.d.ts.map +1 -1
  42. package/dist/governance/escalation.js +7 -45
  43. package/dist/governance/escalation.js.map +1 -1
  44. package/dist/governance/fact-boundary.d.ts +7 -49
  45. package/dist/governance/fact-boundary.d.ts.map +1 -1
  46. package/dist/governance/fact-boundary.js +5 -43
  47. package/dist/governance/fact-boundary.js.map +1 -1
  48. package/dist/governance/finding-funnel.d.ts +11 -72
  49. package/dist/governance/finding-funnel.d.ts.map +1 -1
  50. package/dist/governance/finding-funnel.js +9 -68
  51. package/dist/governance/finding-funnel.js.map +1 -1
  52. package/dist/graph/build.d.ts +13 -75
  53. package/dist/graph/build.d.ts.map +1 -1
  54. package/dist/graph/build.js +0 -0
  55. package/dist/graph/build.js.map +1 -1
  56. package/dist/graph/cross-language.d.ts +4 -43
  57. package/dist/graph/cross-language.d.ts.map +1 -1
  58. package/dist/graph/cross-language.js +9 -77
  59. package/dist/graph/cross-language.js.map +1 -1
  60. package/dist/graph/index.d.ts +1 -1
  61. package/dist/graph/index.d.ts.map +1 -1
  62. package/dist/graph/merge.d.ts +8 -76
  63. package/dist/graph/merge.d.ts.map +1 -1
  64. package/dist/graph/merge.js +27 -77
  65. package/dist/graph/merge.js.map +1 -1
  66. package/dist/graph/observed-tests.d.ts +7 -68
  67. package/dist/graph/observed-tests.d.ts.map +1 -1
  68. package/dist/graph/observed-tests.js +5 -60
  69. package/dist/graph/observed-tests.js.map +1 -1
  70. package/dist/graph/persist.d.ts +2 -25
  71. package/dist/graph/persist.d.ts.map +1 -1
  72. package/dist/graph/persist.js +2 -25
  73. package/dist/graph/persist.js.map +1 -1
  74. package/dist/graph/runtime-confirmation.d.ts +14 -91
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -1
  76. package/dist/graph/runtime-confirmation.js +19 -103
  77. package/dist/graph/runtime-confirmation.js.map +1 -1
  78. package/dist/ledger/mint.d.ts +9 -43
  79. package/dist/ledger/mint.d.ts.map +1 -1
  80. package/dist/ledger/mint.js +15 -65
  81. package/dist/ledger/mint.js.map +1 -1
  82. package/dist/ledger/resolve.d.ts +13 -81
  83. package/dist/ledger/resolve.d.ts.map +1 -1
  84. package/dist/ledger/resolve.js +13 -76
  85. package/dist/ledger/resolve.js.map +1 -1
  86. package/dist/multipr/fingerprint.d.ts +5 -46
  87. package/dist/multipr/fingerprint.d.ts.map +1 -1
  88. package/dist/multipr/fingerprint.js +22 -74
  89. package/dist/multipr/fingerprint.js.map +1 -1
  90. package/dist/multipr/hidden-dependency.d.ts +13 -73
  91. package/dist/multipr/hidden-dependency.d.ts.map +1 -1
  92. package/dist/multipr/hidden-dependency.js +12 -63
  93. package/dist/multipr/hidden-dependency.js.map +1 -1
  94. package/dist/multipr/mechanical.d.ts +25 -160
  95. package/dist/multipr/mechanical.d.ts.map +1 -1
  96. package/dist/multipr/mechanical.js +21 -137
  97. package/dist/multipr/mechanical.js.map +1 -1
  98. package/dist/multipr/migration-heads.d.ts +18 -105
  99. package/dist/multipr/migration-heads.d.ts.map +1 -1
  100. package/dist/multipr/migration-heads.js +15 -84
  101. package/dist/multipr/migration-heads.js.map +1 -1
  102. package/dist/multipr/overlap.d.ts +16 -94
  103. package/dist/multipr/overlap.d.ts.map +1 -1
  104. package/dist/multipr/overlap.js +25 -105
  105. package/dist/multipr/overlap.js.map +1 -1
  106. package/dist/multipr/scope-store.d.ts +15 -80
  107. package/dist/multipr/scope-store.d.ts.map +1 -1
  108. package/dist/multipr/scope-store.js +17 -87
  109. package/dist/multipr/scope-store.js.map +1 -1
  110. package/dist/multipr/superseded.d.ts +10 -95
  111. package/dist/multipr/superseded.d.ts.map +1 -1
  112. package/dist/multipr/superseded.js +7 -60
  113. package/dist/multipr/superseded.js.map +1 -1
  114. package/dist/query/confirmed-facts.d.ts +12 -58
  115. package/dist/query/confirmed-facts.d.ts.map +1 -1
  116. package/dist/query/confirmed-facts.js +8 -47
  117. package/dist/query/confirmed-facts.js.map +1 -1
  118. package/dist/query/declared-value-closure.d.ts +13 -104
  119. package/dist/query/declared-value-closure.d.ts.map +1 -1
  120. package/dist/query/declared-value-closure.js +15 -104
  121. package/dist/query/declared-value-closure.js.map +1 -1
  122. package/dist/query/memory.d.ts +5 -9
  123. package/dist/query/memory.d.ts.map +1 -1
  124. package/dist/query/memory.js +31 -15
  125. package/dist/query/memory.js.map +1 -1
  126. package/dist/query/prominence.d.ts +6 -55
  127. package/dist/query/prominence.d.ts.map +1 -1
  128. package/dist/query/prominence.js +6 -55
  129. package/dist/query/prominence.js.map +1 -1
  130. package/dist/query/provider.d.ts +28 -81
  131. package/dist/query/provider.d.ts.map +1 -1
  132. package/dist/query/provider.js +8 -29
  133. package/dist/query/provider.js.map +1 -1
  134. package/dist/query/queries.d.ts +15 -65
  135. package/dist/query/queries.d.ts.map +1 -1
  136. package/dist/query/queries.js +43 -100
  137. package/dist/query/queries.js.map +1 -1
  138. package/dist/query/refusal-fetch.d.ts +8 -85
  139. package/dist/query/refusal-fetch.d.ts.map +1 -1
  140. package/dist/query/refusal-fetch.js +11 -93
  141. package/dist/query/refusal-fetch.js.map +1 -1
  142. package/dist/query/refusal-questions.d.ts +17 -92
  143. package/dist/query/refusal-questions.d.ts.map +1 -1
  144. package/dist/query/refusal-questions.js +14 -78
  145. package/dist/query/refusal-questions.js.map +1 -1
  146. package/dist/query/resolution-floor.d.ts +3 -23
  147. package/dist/query/resolution-floor.d.ts.map +1 -1
  148. package/dist/query/resolution-floor.js +3 -23
  149. package/dist/query/resolution-floor.js.map +1 -1
  150. package/dist/query/root-cause-score.d.ts +11 -161
  151. package/dist/query/root-cause-score.d.ts.map +1 -1
  152. package/dist/query/root-cause-score.js +6 -137
  153. package/dist/query/root-cause-score.js.map +1 -1
  154. package/dist/query/row-closure-picture.d.ts +5 -67
  155. package/dist/query/row-closure-picture.d.ts.map +1 -1
  156. package/dist/query/row-closure-picture.js +6 -67
  157. package/dist/query/row-closure-picture.js.map +1 -1
  158. package/dist/query/similar-incidents.d.ts +6 -41
  159. package/dist/query/similar-incidents.d.ts.map +1 -1
  160. package/dist/query/similar-incidents.js +15 -69
  161. package/dist/query/similar-incidents.js.map +1 -1
  162. package/dist/query/sqlite.d.ts +3 -7
  163. package/dist/query/sqlite.d.ts.map +1 -1
  164. package/dist/query/sqlite.js +13 -16
  165. package/dist/query/sqlite.js.map +1 -1
  166. package/dist/query/test-coverage.d.ts +5 -45
  167. package/dist/query/test-coverage.d.ts.map +1 -1
  168. package/dist/query/test-coverage.js +10 -53
  169. package/dist/query/test-coverage.js.map +1 -1
  170. package/dist/query/traverse.d.ts +22 -126
  171. package/dist/query/traverse.d.ts.map +1 -1
  172. package/dist/query/traverse.js +0 -0
  173. package/dist/query/traverse.js.map +1 -1
  174. package/dist/query/unresolved.d.ts +19 -164
  175. package/dist/query/unresolved.d.ts.map +1 -1
  176. package/dist/query/unresolved.js +11 -138
  177. package/dist/query/unresolved.js.map +1 -1
  178. package/dist/query/verification-status.d.ts +12 -109
  179. package/dist/query/verification-status.d.ts.map +1 -1
  180. package/dist/query/verification-status.js +9 -99
  181. package/dist/query/verification-status.js.map +1 -1
  182. package/dist/recording/migrate.d.ts +4 -10
  183. package/dist/recording/migrate.d.ts.map +1 -1
  184. package/dist/recording/migrate.js +4 -10
  185. package/dist/recording/migrate.js.map +1 -1
  186. package/dist/recording/reader.d.ts +2 -7
  187. package/dist/recording/reader.d.ts.map +1 -1
  188. package/dist/recording/reader.js +2 -7
  189. package/dist/recording/reader.js.map +1 -1
  190. package/dist/recording/redact.d.ts +6 -57
  191. package/dist/recording/redact.d.ts.map +1 -1
  192. package/dist/recording/redact.js +8 -64
  193. package/dist/recording/redact.js.map +1 -1
  194. package/dist/recording/schema.d.ts +3 -38
  195. package/dist/recording/schema.d.ts.map +1 -1
  196. package/dist/recording/schema.js +3 -38
  197. package/dist/recording/schema.js.map +1 -1
  198. package/dist/recording/writer.d.ts +11 -74
  199. package/dist/recording/writer.d.ts.map +1 -1
  200. package/dist/recording/writer.js +3 -43
  201. package/dist/recording/writer.js.map +1 -1
  202. package/dist/scoping/fanout.d.ts +6 -68
  203. package/dist/scoping/fanout.d.ts.map +1 -1
  204. package/dist/scoping/fanout.js +6 -68
  205. package/dist/scoping/fanout.js.map +1 -1
  206. package/dist/scoping/score.d.ts +20 -70
  207. package/dist/scoping/score.d.ts.map +1 -1
  208. package/dist/scoping/score.js +20 -70
  209. package/dist/scoping/score.js.map +1 -1
  210. package/dist/scoping/tiers.d.ts +4 -16
  211. package/dist/scoping/tiers.d.ts.map +1 -1
  212. package/dist/scoping/tiers.js +4 -16
  213. package/dist/scoping/tiers.js.map +1 -1
  214. package/dist/scoping/traverse.d.ts +3 -25
  215. package/dist/scoping/traverse.d.ts.map +1 -1
  216. package/dist/scoping/traverse.js +14 -49
  217. package/dist/scoping/traverse.js.map +1 -1
  218. package/dist/scoping/weights.d.ts +10 -74
  219. package/dist/scoping/weights.d.ts.map +1 -1
  220. package/dist/scoping/weights.js +14 -86
  221. package/dist/scoping/weights.js.map +1 -1
  222. package/dist/sources/confirmed/incidents.d.ts +5 -35
  223. package/dist/sources/confirmed/incidents.d.ts.map +1 -1
  224. package/dist/sources/confirmed/incidents.js +14 -48
  225. package/dist/sources/confirmed/incidents.js.map +1 -1
  226. package/dist/sources/git/diff.d.ts +71 -65
  227. package/dist/sources/git/diff.d.ts.map +1 -1
  228. package/dist/sources/git/diff.js +136 -83
  229. package/dist/sources/git/diff.js.map +1 -1
  230. package/dist/sources/git/env.d.ts +7 -0
  231. package/dist/sources/git/env.d.ts.map +1 -1
  232. package/dist/sources/git/env.js +10 -11
  233. package/dist/sources/git/env.js.map +1 -1
  234. package/dist/sources/git/history.d.ts +64 -84
  235. package/dist/sources/git/history.d.ts.map +1 -1
  236. package/dist/sources/git/history.js +141 -112
  237. package/dist/sources/git/history.js.map +1 -1
  238. package/dist/sources/git/incidents.d.ts +13 -75
  239. package/dist/sources/git/incidents.d.ts.map +1 -1
  240. package/dist/sources/git/incidents.js +21 -91
  241. package/dist/sources/git/incidents.js.map +1 -1
  242. package/dist/sources/git/index.d.ts +5 -3
  243. package/dist/sources/git/index.d.ts.map +1 -1
  244. package/dist/sources/git/index.js +3 -2
  245. package/dist/sources/git/index.js.map +1 -1
  246. package/dist/sources/git/source.d.ts +9 -79
  247. package/dist/sources/git/source.d.ts.map +1 -1
  248. package/dist/sources/git/source.js +0 -0
  249. package/dist/sources/git/source.js.map +1 -1
  250. package/dist/sources/migrations/across-change.d.ts +94 -0
  251. package/dist/sources/migrations/across-change.d.ts.map +1 -0
  252. package/dist/sources/migrations/across-change.js +278 -0
  253. package/dist/sources/migrations/across-change.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +20 -36
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -1
  256. package/dist/sources/migrations/dialects.js +11 -36
  257. package/dist/sources/migrations/dialects.js.map +1 -1
  258. package/dist/sources/migrations/index.d.ts +3 -1
  259. package/dist/sources/migrations/index.d.ts.map +1 -1
  260. package/dist/sources/migrations/index.js +2 -1
  261. package/dist/sources/migrations/index.js.map +1 -1
  262. package/dist/sources/migrations/read.d.ts +14 -79
  263. package/dist/sources/migrations/read.d.ts.map +1 -1
  264. package/dist/sources/migrations/read.js +14 -89
  265. package/dist/sources/migrations/read.js.map +1 -1
  266. package/dist/sources/workspace/workspace.d.ts +6 -42
  267. package/dist/sources/workspace/workspace.d.ts.map +1 -1
  268. package/dist/sources/workspace/workspace.js +10 -53
  269. package/dist/sources/workspace/workspace.js.map +1 -1
  270. package/dist/store/driver/driver.d.ts +9 -38
  271. package/dist/store/driver/driver.d.ts.map +1 -1
  272. package/dist/store/driver/driver.js +4 -22
  273. package/dist/store/driver/driver.js.map +1 -1
  274. package/dist/store/driver/node-sqlite.d.ts +3 -12
  275. package/dist/store/driver/node-sqlite.d.ts.map +1 -1
  276. package/dist/store/driver/node-sqlite.js +4 -18
  277. package/dist/store/driver/node-sqlite.js.map +1 -1
  278. package/dist/store/index.d.ts +2 -7
  279. package/dist/store/index.d.ts.map +1 -1
  280. package/dist/store/index.js +4 -10
  281. package/dist/store/index.js.map +1 -1
  282. package/dist/store/migrate.d.ts +14 -50
  283. package/dist/store/migrate.d.ts.map +1 -1
  284. package/dist/store/migrate.js +15 -52
  285. package/dist/store/migrate.js.map +1 -1
  286. package/dist/store/reader.d.ts +19 -84
  287. package/dist/store/reader.d.ts.map +1 -1
  288. package/dist/store/reader.js +25 -92
  289. package/dist/store/reader.js.map +1 -1
  290. package/dist/store/schema.d.ts +14 -76
  291. package/dist/store/schema.d.ts.map +1 -1
  292. package/dist/store/schema.js +14 -76
  293. package/dist/store/schema.js.map +1 -1
  294. package/dist/store/writer.d.ts +14 -88
  295. package/dist/store/writer.d.ts.map +1 -1
  296. package/dist/store/writer.js +29 -123
  297. package/dist/store/writer.js.map +1 -1
  298. package/dist/tiers/certify.d.ts +46 -281
  299. package/dist/tiers/certify.d.ts.map +1 -1
  300. package/dist/tiers/certify.js +46 -226
  301. package/dist/tiers/certify.js.map +1 -1
  302. package/dist/tiers/ladder.d.ts +7 -51
  303. package/dist/tiers/ladder.d.ts.map +1 -1
  304. package/dist/tiers/ladder.js +13 -89
  305. package/dist/tiers/ladder.js.map +1 -1
  306. package/dist/validation/attributes.d.ts +47 -0
  307. package/dist/validation/attributes.d.ts.map +1 -0
  308. package/dist/validation/attributes.js +130 -0
  309. package/dist/validation/attributes.js.map +1 -0
  310. package/dist/validation/config-graph.d.ts +7 -56
  311. package/dist/validation/config-graph.d.ts.map +1 -1
  312. package/dist/validation/config-graph.js +15 -61
  313. package/dist/validation/config-graph.js.map +1 -1
  314. package/dist/validation/env.d.ts +53 -2
  315. package/dist/validation/env.d.ts.map +1 -1
  316. package/dist/validation/env.js +99 -4
  317. package/dist/validation/env.js.map +1 -1
  318. package/dist/validation/index.d.ts +5 -1
  319. package/dist/validation/index.d.ts.map +1 -1
  320. package/dist/validation/index.js +3 -1
  321. package/dist/validation/index.js.map +1 -1
  322. package/dist/validation/join-substitution.d.ts +22 -120
  323. package/dist/validation/join-substitution.d.ts.map +1 -1
  324. package/dist/validation/join-substitution.js +13 -90
  325. package/dist/validation/join-substitution.js.map +1 -1
  326. package/dist/validation/migration-integrity.d.ts +72 -0
  327. package/dist/validation/migration-integrity.d.ts.map +1 -0
  328. package/dist/validation/migration-integrity.js +238 -0
  329. package/dist/validation/migration-integrity.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +23 -88
  331. package/dist/validation/migrations.d.ts.map +1 -1
  332. package/dist/validation/migrations.js +20 -79
  333. package/dist/validation/migrations.js.map +1 -1
  334. package/dist/validation/nodes.d.ts +3 -1
  335. package/dist/validation/nodes.d.ts.map +1 -1
  336. package/dist/validation/nodes.js +3 -1
  337. package/dist/validation/nodes.js.map +1 -1
  338. package/dist/validation/rollback.d.ts +10 -73
  339. package/dist/validation/rollback.d.ts.map +1 -1
  340. package/dist/validation/rollback.js +23 -81
  341. package/dist/validation/rollback.js.map +1 -1
  342. package/dist/validation/route-drift.d.ts +9 -62
  343. package/dist/validation/route-drift.d.ts.map +1 -1
  344. package/dist/validation/route-drift.js +7 -52
  345. package/dist/validation/route-drift.js.map +1 -1
  346. package/dist/validation/sources.d.ts +16 -94
  347. package/dist/validation/sources.d.ts.map +1 -1
  348. package/dist/validation/sources.js +51 -147
  349. package/dist/validation/sources.js.map +1 -1
  350. package/dist/worker/pool.d.ts +6 -45
  351. package/dist/worker/pool.d.ts.map +1 -1
  352. package/dist/worker/pool.js +5 -42
  353. package/dist/worker/pool.js.map +1 -1
  354. package/dist/worker/protocol.d.ts +7 -20
  355. package/dist/worker/protocol.d.ts.map +1 -1
  356. package/dist/worker/protocol.js +3 -10
  357. package/dist/worker/protocol.js.map +1 -1
  358. package/dist/worker/traversal.worker.d.ts +2 -21
  359. package/dist/worker/traversal.worker.d.ts.map +1 -1
  360. package/dist/worker/traversal.worker.js +4 -23
  361. package/dist/worker/traversal.worker.js.map +1 -1
  362. package/package.json +11 -2
@@ -1,55 +1,14 @@
1
- /**
2
- * §14.3 — where two in-flight changes touch the same thing, and whether that
3
- * matters.
4
- *
5
- * ## A shared node alone is not a conflict
6
- *
7
- * §14.3 says this outright and it is the whole design. At real team scale many
8
- * pull requests incidentally touch the same low-importance code — a shared
9
- * logging helper, a barrel file, a constants module. A tool that reports every
10
- * shared node reports mostly noise, and a developer who has dismissed six
11
- * incidental overlaps will dismiss the seventh without reading it.
12
- *
13
- * So severity is a product of *what* is shared, not *that* something is:
14
- *
15
- * score(node) = impact × NODE_TYPE_WEIGHT[type]
16
- *
17
- * A shared `API_ENDPOINT` is two changes to one contract. A shared `FUNCTION`
18
- * in a utility module is two people editing a file. The weights are the only
19
- * thing separating them and they are tuning values, labelled as such.
20
- *
21
- * ## Resolution is carried per node, and that is §14.2's one addition
22
- *
23
- * §14.2 adds `Resolution` to the persisted row with a reason: *so overlap
24
- * severity is not computed across incomparable evidence*. If one change's node
25
- * was resolved by a type checker and the other's by syntax alone, an overlap
26
- * asserted at the stronger level claims more than half of its own evidence
27
- * supports.
28
- *
29
- * The rule follows DEC-058 exactly — a claim carries the resolution of ITS OWN
30
- * evidence, not of the run that produced it. Here the claim rests on two
31
- * observations, so it carries **the weaker of the two**, and the finding's
32
- * reliability class follows from that rather than from either side alone.
33
- *
34
- * ## What this deliberately does not do
35
- *
36
- * §14.4's mechanical-versus-semantic classification needs the actual diff lines
37
- * at the shared node, which this module never sees. It reports the overlap and
38
- * stops; classifying it — and the auto-apply path that is the single documented
39
- * exception to approval-before-code-change — belongs where the diff is.
40
- * Guessing "mechanical" without reading the lines would be the one place in
41
- * this system where a wrong guess edits somebody's branch.
42
- */
1
+ /** §14.3 — whether two in-flight changes touching the same node is a real
2
+ * conflict: score = impact × NODE_TYPE_WEIGHT[type] (tuning values), so a
3
+ * shared node alone isn't one. §14.2 carries resolution per node; a claim
4
+ * uses the weaker of the two (DEC-058). Does NOT classify mechanical vs
5
+ * semantic (§14.4) — needs diff lines this module never sees. */
43
6
  import type { NodeType, ResolutionLevel } from "@descryy/ir";
44
7
  import type { ReliabilityClass } from "@descryy/ir";
45
8
  /** How a change touched a node. §14.2's `DiffType`. */
46
9
  export type DiffType = "added" | "modified" | "deleted";
47
- /**
48
- * One row of a change's scoped subgraph — §14.2's shape, without persistence.
49
- *
50
- * Defined here rather than in a store module so overlap can be computed and
51
- * tested with no database, the same reason `AdjacencyProvider` exists.
52
- */
10
+ /** One row of a change's scoped subgraph — §14.2's shape, without
11
+ * persistence, so overlap can be computed/tested with no database. */
53
12
  export interface PrScopeEntry {
54
13
  readonly nodeId: string;
55
14
  readonly nodeType: NodeType;
@@ -73,15 +32,8 @@ export interface PrScope {
73
32
  readonly computedAt: number;
74
33
  /** The head commit of the change itself. Identifies it; never compares it. */
75
34
  readonly headSha: string;
76
- /**
77
- * The commit **the graph** was at when this scope was computed.
78
- *
79
- * Not the same as `headSha`, and the distinction is load-bearing: two scopes
80
- * are comparable only when this agrees. A single `baseSha` field stood here
81
- * first, described as "the base commit it was computed against", which is
82
- * ambiguous between the two and would have let a comparison key on the wrong
83
- * one. §14.2's column comment is what caught it.
84
- */
35
+ /** Commit the graph was at when computed — not `headSha`; two scopes are
36
+ * comparable only when this agrees (§14.2). */
85
37
  readonly graphCommitSha: string;
86
38
  }
87
39
  /** One node two changes both touch. */
@@ -133,40 +85,14 @@ export interface OverlapReport {
133
85
  /** Pairs refused before comparison — see `incomparable`. */
134
86
  readonly incomparable: number;
135
87
  };
136
- /**
137
- * Pairs that could not be compared at all.
138
- *
139
- * **An incomparable pair and a non-conflicting pair produce the same empty
140
- * overlap**, so they are separated here rather than left to be inferred from
141
- * a count that does not distinguish them.
142
- */
88
+ /** Pairs that could not be compared at all — kept separate from
89
+ * non-conflicting pairs, which produce the same empty overlap. */
143
90
  readonly incomparable: readonly IncomparablePair[];
144
91
  readonly notes: readonly string[];
145
92
  }
146
- /**
147
- * §14.3's `NodeTypeWeight`. **Tuning values, and labelled as such.**
148
- *
149
- * The architecture gives the shape and one worked contrast — a shared utility
150
- * function scores low, a shared API contract scores high — and fixes no
151
- * numbers. These are a defensible starting point and are expected to move once
152
- * there is data. The ordering is the part that is argued:
153
- *
154
- * - **Contract surfaces highest.** `API_ENDPOINT` and `API_ROUTE` are the join
155
- * between two services; two changes to one is the case where a merge compiles
156
- * and the system breaks.
157
- * - **Schema next.** A `DATABASE_TABLE` or `DATABASE_COLUMN` touched twice is
158
- * two migrations against one object, which §14.6 checks separately and which
159
- * fails at merge rather than at review.
160
- * - **Types above callables.** Two changes to a `DTO` or `MODEL` shape reach
161
- * every consumer; two changes to one `FUNCTION` reach its callers.
162
- * - **`FILE` lowest of the real types.** File-level overlap is what every naive
163
- * tool already reports and it is the noise this weighting exists to suppress.
164
- *
165
- * Exhaustive over the frozen vocabulary on purpose: `Record<NodeType, number>`
166
- * means adding a node type is a compile error here rather than a silent zero,
167
- * and a silent zero would make the new type invisible to conflict detection
168
- * without any test failing.
169
- */
93
+ /** §14.3's `NodeTypeWeight` — tuning values. Ordering: contract > schema >
94
+ * types (DTO/MODEL) > callables > `FILE`. `Record<NodeType,...>` is
95
+ * exhaustive, so a new node type is a compile error, not a silent zero. */
170
96
  export declare const NODE_TYPE_WEIGHTS: Readonly<Record<NodeType, number>>;
171
97
  /** Default score below which a shared node is incidental rather than a conflict. */
172
98
  export declare const DEFAULT_CONFLICT_THRESHOLD = 0.3;
@@ -176,11 +102,7 @@ export interface OverlapOptions {
176
102
  /** Cap on findings, per rule 5. Truncation is reported. */
177
103
  readonly limit?: number;
178
104
  }
179
- /**
180
- * Overlaps between every pair of in-flight changes.
181
- *
182
- * Pure over scopes, so it needs no store and no graph. §14.2's persistence is a
183
- * layer above this, not a prerequisite for it.
184
- */
105
+ /** Overlaps between every pair of in-flight changes. Pure over scopes — no
106
+ * store, no graph; §14.2's persistence sits above this, not before it. */
185
107
  export declare function findOverlaps(scopes: readonly PrScope[], options?: OverlapOptions): OverlapReport;
186
108
  //# sourceMappingUR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D;QAC5D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF;uEACmE;IACnE,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;4EAE4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAkBhE,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AASD;2EAC2E;AAC3E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAiKf"}
@@ -1,70 +1,12 @@
1
- /**
2
- * §14.3 — where two in-flight changes touch the same thing, and whether that
3
- * matters.
4
- *
5
- * ## A shared node alone is not a conflict
6
- *
7
- * §14.3 says this outright and it is the whole design. At real team scale many
8
- * pull requests incidentally touch the same low-importance code — a shared
9
- * logging helper, a barrel file, a constants module. A tool that reports every
10
- * shared node reports mostly noise, and a developer who has dismissed six
11
- * incidental overlaps will dismiss the seventh without reading it.
12
- *
13
- * So severity is a product of *what* is shared, not *that* something is:
14
- *
15
- * score(node) = impact × NODE_TYPE_WEIGHT[type]
16
- *
17
- * A shared `API_ENDPOINT` is two changes to one contract. A shared `FUNCTION`
18
- * in a utility module is two people editing a file. The weights are the only
19
- * thing separating them and they are tuning values, labelled as such.
20
- *
21
- * ## Resolution is carried per node, and that is §14.2's one addition
22
- *
23
- * §14.2 adds `Resolution` to the persisted row with a reason: *so overlap
24
- * severity is not computed across incomparable evidence*. If one change's node
25
- * was resolved by a type checker and the other's by syntax alone, an overlap
26
- * asserted at the stronger level claims more than half of its own evidence
27
- * supports.
28
- *
29
- * The rule follows DEC-058 exactly — a claim carries the resolution of ITS OWN
30
- * evidence, not of the run that produced it. Here the claim rests on two
31
- * observations, so it carries **the weaker of the two**, and the finding's
32
- * reliability class follows from that rather than from either side alone.
33
- *
34
- * ## What this deliberately does not do
35
- *
36
- * §14.4's mechanical-versus-semantic classification needs the actual diff lines
37
- * at the shared node, which this module never sees. It reports the overlap and
38
- * stops; classifying it — and the auto-apply path that is the single documented
39
- * exception to approval-before-code-change — belongs where the diff is.
40
- * Guessing "mechanical" without reading the lines would be the one place in
41
- * this system where a wrong guess edits somebody's branch.
42
- */
1
+ /** §14.3 — whether two in-flight changes touching the same node is a real
2
+ * conflict: score = impact × NODE_TYPE_WEIGHT[type] (tuning values), so a
3
+ * shared node alone isn't one. §14.2 carries resolution per node; a claim
4
+ * uses the weaker of the two (DEC-058). Does NOT classify mechanical vs
5
+ * semantic (§14.4) — needs diff lines this module never sees. */
43
6
  import { reliabilityCap, reliabilityNote } from "@descryy/ir";
44
- /**
45
- * §14.3's `NodeTypeWeight`. **Tuning values, and labelled as such.**
46
- *
47
- * The architecture gives the shape and one worked contrast — a shared utility
48
- * function scores low, a shared API contract scores high — and fixes no
49
- * numbers. These are a defensible starting point and are expected to move once
50
- * there is data. The ordering is the part that is argued:
51
- *
52
- * - **Contract surfaces highest.** `API_ENDPOINT` and `API_ROUTE` are the join
53
- * between two services; two changes to one is the case where a merge compiles
54
- * and the system breaks.
55
- * - **Schema next.** A `DATABASE_TABLE` or `DATABASE_COLUMN` touched twice is
56
- * two migrations against one object, which §14.6 checks separately and which
57
- * fails at merge rather than at review.
58
- * - **Types above callables.** Two changes to a `DTO` or `MODEL` shape reach
59
- * every consumer; two changes to one `FUNCTION` reach its callers.
60
- * - **`FILE` lowest of the real types.** File-level overlap is what every naive
61
- * tool already reports and it is the noise this weighting exists to suppress.
62
- *
63
- * Exhaustive over the frozen vocabulary on purpose: `Record<NodeType, number>`
64
- * means adding a node type is a compile error here rather than a silent zero,
65
- * and a silent zero would make the new type invisible to conflict detection
66
- * without any test failing.
67
- */
7
+ /** §14.3's `NodeTypeWeight` — tuning values. Ordering: contract > schema >
8
+ * types (DTO/MODEL) > callables > `FILE`. `Record<NodeType,...>` is
9
+ * exhaustive, so a new node type is a compile error, not a silent zero. */
68
10
  export const NODE_TYPE_WEIGHTS = {
69
11
  API_ENDPOINT: 1.0,
70
12
  API_ROUTE: 1.0,
@@ -79,32 +21,21 @@ export const NODE_TYPE_WEIGHTS = {
79
21
  FUNCTION: 0.4,
80
22
  TEST_CASE: 0.3,
81
23
  FILE: 0.2,
82
- // History artefacts. Two changes cannot both "touch" an incident; if these
83
- // ever appear in a diff scope something upstream is wrong, and a weight of
84
- // zero would hide that rather than surface it.
24
+ // History artefacts; if these appear in a diff scope something upstream is
25
+ // wrong — zero weight would hide that rather than surface it.
85
26
  INCIDENT: 0.1,
86
27
  FIX_PATTERN: 0.1,
87
28
  };
88
29
  /** Default score below which a shared node is incidental rather than a conflict. */
89
30
  export const DEFAULT_CONFLICT_THRESHOLD = 0.3;
90
- /**
91
- * The impact a shared node carries is the **higher** of the two.
92
- *
93
- * A node peripheral to one change and central to the other is a real conflict:
94
- * somebody is about to have their central concern edited from underneath them.
95
- * Taking the minimum would let a large blast radius be discounted by a
96
- * one-line drive-by touching the same node, which is the case most worth
97
- * catching.
98
- */
31
+ /** Impact of a shared node is the **higher** of the two — a node peripheral
32
+ * to one change and central to the other is still a real conflict; the
33
+ * min would let a drive-by touch discount a large blast radius. */
99
34
  function impactOfPair(a, b) {
100
35
  return Math.max(a.impactScore, b.impactScore);
101
36
  }
102
- /**
103
- * Overlaps between every pair of in-flight changes.
104
- *
105
- * Pure over scopes, so it needs no store and no graph. §14.2's persistence is a
106
- * layer above this, not a prerequisite for it.
107
- */
37
+ /** Overlaps between every pair of in-flight changes. Pure over scopes — no
38
+ * store, no graph; §14.2's persistence sits above this, not before it. */
108
39
  export function findOverlaps(scopes, options = {}) {
109
40
  const threshold = options.threshold ?? DEFAULT_CONFLICT_THRESHOLD;
110
41
  const weights = options.weights ?? NODE_TYPE_WEIGHTS;
@@ -121,14 +52,9 @@ export function findOverlaps(scopes, options = {}) {
121
52
  pairs += 1;
122
53
  const left = byId[i];
123
54
  const right = byId[j];
124
- // Refused BEFORE any node is compared. §14.2's schema puts the graph
125
- // commit in the primary key so two graph states of one PR cannot
126
- // overwrite each other, and warns that a reader ignoring it "will happily
127
- // overlap a scope from last week with one from today and report a
128
- // number". That warning is honoured here rather than in the store,
129
- // because a caller constructing scopes by hand never touches a store —
130
- // and because an incomparable pair returns the same empty overlap a
131
- // genuinely non-conflicting one does.
55
+ // Refused BEFORE any node is compared: comparing across two graph
56
+ // states of one PR would silently overlap "last week" with "today".
57
+ // Checked here, not the store, since hand-built scopes never touch one.
132
58
  const reason = left.scope.repo !== right.scope.repo
133
59
  ? "different-repo"
134
60
  : left.scope.graphCommitSha !== right.scope.graphCommitSha
@@ -146,9 +72,8 @@ export function findOverlaps(scopes, options = {}) {
146
72
  if (b === undefined)
147
73
  continue;
148
74
  overlapSize += 1;
149
- // DEC-058 at the pair level: the claim rests on two observations, so it
150
- // carries the weaker. Asserting at the stronger would claim more than
151
- // half its own evidence supports.
75
+ // DEC-058 at the pair level: claim carries the weaker of the two
76
+ // observations — the stronger would claim more than its evidence supports.
152
77
  const resolution = Math.min(a.resolution, b.resolution);
153
78
  const resolutionMismatch = a.resolution !== b.resolution;
154
79
  if (resolutionMismatch)
@@ -169,9 +94,8 @@ export function findOverlaps(scopes, options = {}) {
169
94
  score,
170
95
  diffTypes: [a.diffType, b.diffType],
171
96
  resolution,
172
- // An overlap is a claim about which symbols two changes both name —
173
- // a name-level fact, not a claim about shapes. R2 therefore permits
174
- // class A here where a shape claim on the same evidence would not.
97
+ // Name-level fact (which symbols both changes touch), not a shape
98
+ // claim — R2 permits class A here where a shape claim would not.
175
99
  reliability: reliabilityCap(resolution, true),
176
100
  resolutionMismatch,
177
101
  });
@@ -195,13 +119,9 @@ export function findOverlaps(scopes, options = {}) {
195
119
  b: right.scope.prId,
196
120
  overlapSize,
197
121
  surfaced: shared,
198
- // §14.3 writes `OverlapSize × ImpactScore × NodeTypeWeight`. Read
199
- // literally that multiplies a pair-level count by two node-level
200
- // quantities, which lets one shared trivial node scale with the size of
201
- // an unrelated overlap. Summing the per-node scores keeps the same
202
- // intent — more shared, and more important, scores higher — and stays
203
- // monotonic in both. The divergence is deliberate and recorded rather
204
- // than silently "interpreted".
122
+ // §14.3 literally says OverlapSize × ImpactScore × NodeTypeWeight,
123
+ // which would let one trivial node scale with an unrelated overlap's
124
+ // size. Summing per-node scores keeps the same intent; deliberate divergence.
205
125
  conflictScore: shared.reduce((sum, s) => sum + s.score, 0),
206
126
  disclosure,
207
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../src/multipr/overlap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+G9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAuC;IACnE,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,eAAe,EAAE,GAAG;IACpB,cAAc,EAAE,GAAG;IACnB,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;IACd,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;IACd,IAAI,EAAE,GAAG;IACT,2EAA2E;IAC3E,2EAA2E;IAC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AI,aAAa,GAAG,CAAC,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CACR,GAAG,aAAa,wEAAwE;YACtF,mFAAmF;YACnF,oDAAoD,CACvD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,QAAQ,CAAC,MAAM;QAC9B,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK;YACL,gBAAgB;YAChB,cAAc;YACd,YAAY,EAAE,YAAY,CAAC,MAAM;SAClC;QACD,YAAY;QACZ,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -1,105 +1,40 @@
1
1
  /**
2
- * §14.2 — persisting a change's scoped subgraph, and the one field that makes
3
- * two of them comparable.
4
- *
5
- * ## Why this is stored at all, when everything else derived is thrown away
6
- *
7
- * A scope looks derived. It is not, and the reason is easy to get backwards:
8
- * everything on the derived side regenerates because *the source still produces
9
- * it*. A PR scope was computed against a graph **at one commit**, and that graph
10
- * moves. Recomputing it later does not restore it — it answers a different
11
- * question and returns a plausible answer to it. Dropping it does not lose time,
12
- * it loses the comparison basis.
13
- *
14
- * That is why `pr_scopes` sits in `EARNED_TABLES` beside observed edges and
15
- * human corrections, and it is the weaker-looking member of that set in one
16
- * respect and the more dangerous in another: an R4 observation cannot be
17
- * recomputed at any price, whereas a PR scope can be recomputed **wrongly**.
18
- *
19
- * ## `graphCommitSha` is the whole design
20
- *
21
- * Two scopes are comparable only when they were computed against the same
22
- * graph. The schema puts that commit in the primary key so the same PR at two
23
- * graph states is two rows rather than one silently overwriting the other, and
24
- * indexes `(repo, graph_commit_sha)` because overlap scoring's only real query
25
- * is *every scope computed against one graph*.
26
- *
27
- * **It is a different commit from the PR's own head**, and this module renamed a
28
- * field to say so. `overlap.ts` originally carried one `baseSha` described as
29
- * "the base commit it was computed against", which is ambiguous between the two
30
- * and would have let a comparison key on the wrong one. The store's column
31
- * comment is what caught it.
32
- *
33
- * ## An incomparable pair and a non-conflicting pair look identical
34
- *
35
- * Both produce an empty overlap. The schema comment warns that a reader
36
- * ignoring `graph_commit_sha` "will happily overlap a scope from last week with
37
- * one from today and report a number" — so the refusal lives in `findOverlaps`
38
- * rather than here, where it also protects the caller who never touches a store.
2
+ * §14.2 — persisting a change's scoped subgraph. Looks derived but isn't: computed against a graph at one commit, and that graph moves — recomputing later answers a different question, so pr_scopes sits in EARNED_TABLES (worse than an R4 observation: it can be recomputed wrongly, not just never).
3
+ * graphCommitSha (distinct from the PR's head — a prior `baseSha` name was ambiguous) is in the primary key so two graph states are two rows, not an overwrite. An incomparable pair and a non-conflicting pair both produce empty overlap, so that refusal lives in findOverlaps, not here.
39
4
  */
40
5
  import type { SqlDriver } from "../store/driver/driver.ts";
41
6
  import type { PrScope } from "./overlap.ts";
42
- /**
43
- * Thrown when a stored scope cannot be turned back into one.
44
- *
45
- * A corrupt row is not an empty scope. Returning `[]` here would make a damaged
46
- * store indistinguishable from a PR that touched nothing, which is the
47
- * conflation §14.8 exists to refuse one layer up.
48
- */
7
+ /** Thrown when a stored scope can't be decoded. A corrupt row is not an
8
+ * empty scope — returning [] would conflate the two (§14.8 refuses this). */
49
9
  export declare class ScopeDecodeError extends Error {
50
10
  readonly name = "ScopeDecodeError";
51
11
  constructor(message: string, options?: {
52
12
  cause?: unknown;
53
13
  });
54
14
  }
55
- /**
56
- * Row access for `pr_scopes`. Thin on purpose, in the style of `reader.ts`:
57
- * nothing here scores, compares or decides staleness.
58
- */
15
+ /** Row access for pr_scopes. Thin on purpose (style of reader.ts): nothing
16
+ * here scores, compares or decides staleness. */
59
17
  export declare class ScopeStore {
60
18
  #private;
61
19
  constructor(driver: SqlDriver);
62
- /**
63
- * Write a scope, replacing any row for the same `(repo, prId, graphCommitSha)`.
64
- *
65
- * Replacement is safe **only** because the graph commit is in the key:
66
- * recomputing the same PR against the same graph must produce the same scope,
67
- * so the row being replaced is equal to the one replacing it. Recomputing
68
- * against a *different* graph writes a new row and leaves the old comparison
69
- * basis intact, which is the entire reason the column is in the key.
70
- */
20
+ /** Write a scope, replacing any row for (repo, prId, graphCommitSha).
21
+ * Safe only because the graph commit is in the key — a different graph
22
+ * writes a new row and leaves the old comparison basis intact. */
71
23
  save(scope: PrScope): void;
72
24
  saveAll(scopes: readonly PrScope[]): void;
73
25
  /** One scope, or `undefined` when no row exists for that exact graph state. */
74
26
  load(repo: string, prId: string, graphCommitSha: string): PrScope | undefined;
75
- /**
76
- * **The query overlap scoring is for**: every scope computed against one
77
- * graph, and therefore every scope that can legitimately be compared.
78
- *
79
- * Ordered by `pr_id` so a report is stable across runs — an unordered read
80
- * makes two identical graphs produce two differently-ordered reports and
81
- * turns a diff into noise.
82
- */
27
+ /** The query overlap scoring is for: every scope computed against one
28
+ * graph. Ordered by pr_id so a report is stable across runs. */
83
29
  loadForGraph(repo: string, graphCommitSha: string): PrScope[];
84
- /**
85
- * Every graph state a PR has a scope for, newest computation first.
86
- *
87
- * Exposed because "this PR was scoped against three different graphs" is a
88
- * fact a caller may need and cannot reconstruct from `load`, which requires
89
- * knowing the commit in advance.
90
- */
30
+ /** Every graph state a PR has a scope for, newest first — not reconstructable
31
+ * from `load`, which requires knowing the commit in advance. */
91
32
  graphStatesFor(repo: string, prId: string): {
92
33
  graphCommitSha: string;
93
34
  computedAt: number;
94
35
  }[];
95
- /**
96
- * Forget a PR entirely — every graph state it was scoped against.
97
- *
98
- * The only legitimate deletion: a closed or merged PR is not in flight and
99
- * cannot conflict with anything. Deleting a *single* graph state is not
100
- * offered, because the row is the comparison basis and there is no caller who
101
- * wants exactly one of them gone.
102
- */
36
+ /** Forget a PR entirely — every graph state it was scoped against. The only
37
+ * legitimate deletion: a closed/merged PR can't conflict with anything. */
103
38
  forget(repo: string, prId: string): number;
104
39
  }
105
40
  //# sourceMappingURL=scope-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope-store.d.ts","sourceRoot":"","sources":["../../src/multipr/scope-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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