@descryy/core 0.1.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 (366) hide show
  1. package/LICENSE +21 -0
  2. package/dist/capabilities/index.d.ts +3 -0
  3. package/dist/capabilities/index.d.ts.map +1 -0
  4. package/dist/capabilities/index.js +2 -0
  5. package/dist/capabilities/index.js.map +1 -0
  6. package/dist/capabilities/preconditions.d.ts +99 -0
  7. package/dist/capabilities/preconditions.d.ts.map +1 -0
  8. package/dist/capabilities/preconditions.js +94 -0
  9. package/dist/capabilities/preconditions.js.map +1 -0
  10. package/dist/contracts/engine.d.ts +90 -0
  11. package/dist/contracts/engine.d.ts.map +1 -0
  12. package/dist/contracts/engine.js +291 -0
  13. package/dist/contracts/engine.js.map +1 -0
  14. package/dist/contracts/index.d.ts +9 -0
  15. package/dist/contracts/index.d.ts.map +1 -0
  16. package/dist/contracts/index.js +5 -0
  17. package/dist/contracts/index.js.map +1 -0
  18. package/dist/contracts/orphans.d.ts +96 -0
  19. package/dist/contracts/orphans.d.ts.map +1 -0
  20. package/dist/contracts/orphans.js +241 -0
  21. package/dist/contracts/orphans.js.map +1 -0
  22. package/dist/contracts/paths.d.ts +132 -0
  23. package/dist/contracts/paths.d.ts.map +1 -0
  24. package/dist/contracts/paths.js +245 -0
  25. package/dist/contracts/paths.js.map +1 -0
  26. package/dist/contracts/shapes.d.ts +99 -0
  27. package/dist/contracts/shapes.d.ts.map +1 -0
  28. package/dist/contracts/shapes.js +196 -0
  29. package/dist/contracts/shapes.js.map +1 -0
  30. package/dist/governance/budget.d.ts +89 -0
  31. package/dist/governance/budget.d.ts.map +1 -0
  32. package/dist/governance/budget.js +101 -0
  33. package/dist/governance/budget.js.map +1 -0
  34. package/dist/governance/candidate-boundary.d.ts +49 -0
  35. package/dist/governance/candidate-boundary.d.ts.map +1 -0
  36. package/dist/governance/candidate-boundary.js +51 -0
  37. package/dist/governance/candidate-boundary.js.map +1 -0
  38. package/dist/governance/escalation.d.ts +63 -0
  39. package/dist/governance/escalation.d.ts.map +1 -0
  40. package/dist/governance/escalation.js +72 -0
  41. package/dist/governance/escalation.js.map +1 -0
  42. package/dist/governance/fact-boundary.d.ts +77 -0
  43. package/dist/governance/fact-boundary.d.ts.map +1 -0
  44. package/dist/governance/fact-boundary.js +91 -0
  45. package/dist/governance/fact-boundary.js.map +1 -0
  46. package/dist/governance/finding-funnel.d.ts +109 -0
  47. package/dist/governance/finding-funnel.d.ts.map +1 -0
  48. package/dist/governance/finding-funnel.js +137 -0
  49. package/dist/governance/finding-funnel.js.map +1 -0
  50. package/dist/governance/index.d.ts +11 -0
  51. package/dist/governance/index.d.ts.map +1 -0
  52. package/dist/governance/index.js +6 -0
  53. package/dist/governance/index.js.map +1 -0
  54. package/dist/graph/build.d.ts +127 -0
  55. package/dist/graph/build.d.ts.map +1 -0
  56. package/dist/graph/build.js +0 -0
  57. package/dist/graph/build.js.map +1 -0
  58. package/dist/graph/cross-language.d.ts +70 -0
  59. package/dist/graph/cross-language.d.ts.map +1 -0
  60. package/dist/graph/cross-language.js +104 -0
  61. package/dist/graph/cross-language.js.map +1 -0
  62. package/dist/graph/index.d.ts +11 -0
  63. package/dist/graph/index.d.ts.map +1 -0
  64. package/dist/graph/index.js +6 -0
  65. package/dist/graph/index.js.map +1 -0
  66. package/dist/graph/merge.d.ts +95 -0
  67. package/dist/graph/merge.d.ts.map +1 -0
  68. package/dist/graph/merge.js +131 -0
  69. package/dist/graph/merge.js.map +1 -0
  70. package/dist/graph/persist.d.ts +42 -0
  71. package/dist/graph/persist.d.ts.map +1 -0
  72. package/dist/graph/persist.js +52 -0
  73. package/dist/graph/persist.js.map +1 -0
  74. package/dist/graph/runtime-confirmation.d.ts +169 -0
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -0
  76. package/dist/graph/runtime-confirmation.js +318 -0
  77. package/dist/graph/runtime-confirmation.js.map +1 -0
  78. package/dist/index.d.ts +18 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +19 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/ledger/index.d.ts +5 -0
  83. package/dist/ledger/index.d.ts.map +1 -0
  84. package/dist/ledger/index.js +3 -0
  85. package/dist/ledger/index.js.map +1 -0
  86. package/dist/ledger/mint.d.ts +81 -0
  87. package/dist/ledger/mint.d.ts.map +1 -0
  88. package/dist/ledger/mint.js +138 -0
  89. package/dist/ledger/mint.js.map +1 -0
  90. package/dist/ledger/resolve.d.ts +124 -0
  91. package/dist/ledger/resolve.d.ts.map +1 -0
  92. package/dist/ledger/resolve.js +290 -0
  93. package/dist/ledger/resolve.js.map +1 -0
  94. package/dist/multipr/fingerprint.d.ts +56 -0
  95. package/dist/multipr/fingerprint.d.ts.map +1 -0
  96. package/dist/multipr/fingerprint.js +169 -0
  97. package/dist/multipr/fingerprint.js.map +1 -0
  98. package/dist/multipr/hidden-dependency.d.ts +120 -0
  99. package/dist/multipr/hidden-dependency.d.ts.map +1 -0
  100. package/dist/multipr/hidden-dependency.js +185 -0
  101. package/dist/multipr/hidden-dependency.js.map +1 -0
  102. package/dist/multipr/index.d.ts +14 -0
  103. package/dist/multipr/index.d.ts.map +1 -0
  104. package/dist/multipr/index.js +8 -0
  105. package/dist/multipr/index.js.map +1 -0
  106. package/dist/multipr/mechanical.d.ts +239 -0
  107. package/dist/multipr/mechanical.d.ts.map +1 -0
  108. package/dist/multipr/mechanical.js +333 -0
  109. package/dist/multipr/mechanical.js.map +1 -0
  110. package/dist/multipr/migration-heads.d.ts +160 -0
  111. package/dist/multipr/migration-heads.d.ts.map +1 -0
  112. package/dist/multipr/migration-heads.js +212 -0
  113. package/dist/multipr/migration-heads.js.map +1 -0
  114. package/dist/multipr/overlap.d.ts +186 -0
  115. package/dist/multipr/overlap.d.ts.map +1 -0
  116. package/dist/multipr/overlap.js +254 -0
  117. package/dist/multipr/overlap.js.map +1 -0
  118. package/dist/multipr/scope-store.d.ts +105 -0
  119. package/dist/multipr/scope-store.d.ts.map +1 -0
  120. package/dist/multipr/scope-store.js +182 -0
  121. package/dist/multipr/scope-store.js.map +1 -0
  122. package/dist/multipr/superseded.d.ts +133 -0
  123. package/dist/multipr/superseded.d.ts.map +1 -0
  124. package/dist/multipr/superseded.js +128 -0
  125. package/dist/multipr/superseded.js.map +1 -0
  126. package/dist/query/confirmed-facts.d.ts +56 -0
  127. package/dist/query/confirmed-facts.d.ts.map +1 -0
  128. package/dist/query/confirmed-facts.js +64 -0
  129. package/dist/query/confirmed-facts.js.map +1 -0
  130. package/dist/query/declared-value-closure.d.ts +126 -0
  131. package/dist/query/declared-value-closure.d.ts.map +1 -0
  132. package/dist/query/declared-value-closure.js +156 -0
  133. package/dist/query/declared-value-closure.js.map +1 -0
  134. package/dist/query/index.d.ts +28 -0
  135. package/dist/query/index.d.ts.map +1 -0
  136. package/dist/query/index.js +15 -0
  137. package/dist/query/index.js.map +1 -0
  138. package/dist/query/memory.d.ts +20 -0
  139. package/dist/query/memory.d.ts.map +1 -0
  140. package/dist/query/memory.js +55 -0
  141. package/dist/query/memory.js.map +1 -0
  142. package/dist/query/provider.d.ts +127 -0
  143. package/dist/query/provider.d.ts.map +1 -0
  144. package/dist/query/provider.js +54 -0
  145. package/dist/query/provider.js.map +1 -0
  146. package/dist/query/queries.d.ts +119 -0
  147. package/dist/query/queries.d.ts.map +1 -0
  148. package/dist/query/queries.js +267 -0
  149. package/dist/query/queries.js.map +1 -0
  150. package/dist/query/refusal-fetch.d.ts +114 -0
  151. package/dist/query/refusal-fetch.d.ts.map +1 -0
  152. package/dist/query/refusal-fetch.js +200 -0
  153. package/dist/query/refusal-fetch.js.map +1 -0
  154. package/dist/query/refusal-questions.d.ts +123 -0
  155. package/dist/query/refusal-questions.d.ts.map +1 -0
  156. package/dist/query/refusal-questions.js +122 -0
  157. package/dist/query/refusal-questions.js.map +1 -0
  158. package/dist/query/root-cause-score.d.ts +218 -0
  159. package/dist/query/root-cause-score.d.ts.map +1 -0
  160. package/dist/query/root-cause-score.js +251 -0
  161. package/dist/query/root-cause-score.js.map +1 -0
  162. package/dist/query/row-closure-picture.d.ts +108 -0
  163. package/dist/query/row-closure-picture.d.ts.map +1 -0
  164. package/dist/query/row-closure-picture.js +131 -0
  165. package/dist/query/row-closure-picture.js.map +1 -0
  166. package/dist/query/similar-incidents.d.ts +76 -0
  167. package/dist/query/similar-incidents.d.ts.map +1 -0
  168. package/dist/query/similar-incidents.js +169 -0
  169. package/dist/query/similar-incidents.js.map +1 -0
  170. package/dist/query/sqlite.d.ts +13 -0
  171. package/dist/query/sqlite.d.ts.map +1 -0
  172. package/dist/query/sqlite.js +54 -0
  173. package/dist/query/sqlite.js.map +1 -0
  174. package/dist/query/traverse.d.ts +110 -0
  175. package/dist/query/traverse.d.ts.map +1 -0
  176. package/dist/query/traverse.js +0 -0
  177. package/dist/query/traverse.js.map +1 -0
  178. package/dist/query/unresolved.d.ts +195 -0
  179. package/dist/query/unresolved.d.ts.map +1 -0
  180. package/dist/query/unresolved.js +225 -0
  181. package/dist/query/unresolved.js.map +1 -0
  182. package/dist/query/verification-status.d.ts +134 -0
  183. package/dist/query/verification-status.d.ts.map +1 -0
  184. package/dist/query/verification-status.js +163 -0
  185. package/dist/query/verification-status.js.map +1 -0
  186. package/dist/recording/index.d.ts +26 -0
  187. package/dist/recording/index.d.ts.map +1 -0
  188. package/dist/recording/index.js +30 -0
  189. package/dist/recording/index.js.map +1 -0
  190. package/dist/recording/migrate.d.ts +22 -0
  191. package/dist/recording/migrate.d.ts.map +1 -0
  192. package/dist/recording/migrate.js +51 -0
  193. package/dist/recording/migrate.js.map +1 -0
  194. package/dist/recording/reader.d.ts +27 -0
  195. package/dist/recording/reader.d.ts.map +1 -0
  196. package/dist/recording/reader.js +55 -0
  197. package/dist/recording/reader.js.map +1 -0
  198. package/dist/recording/redact.d.ts +63 -0
  199. package/dist/recording/redact.d.ts.map +1 -0
  200. package/dist/recording/redact.js +98 -0
  201. package/dist/recording/redact.js.map +1 -0
  202. package/dist/recording/schema.d.ts +41 -0
  203. package/dist/recording/schema.d.ts.map +1 -0
  204. package/dist/recording/schema.js +104 -0
  205. package/dist/recording/schema.js.map +1 -0
  206. package/dist/recording/writer.d.ts +120 -0
  207. package/dist/recording/writer.d.ts.map +1 -0
  208. package/dist/recording/writer.js +81 -0
  209. package/dist/recording/writer.js.map +1 -0
  210. package/dist/scoping/fanout.d.ts +86 -0
  211. package/dist/scoping/fanout.d.ts.map +1 -0
  212. package/dist/scoping/fanout.js +95 -0
  213. package/dist/scoping/fanout.js.map +1 -0
  214. package/dist/scoping/index.d.ts +10 -0
  215. package/dist/scoping/index.d.ts.map +1 -0
  216. package/dist/scoping/index.js +6 -0
  217. package/dist/scoping/index.js.map +1 -0
  218. package/dist/scoping/score.d.ts +83 -0
  219. package/dist/scoping/score.d.ts.map +1 -0
  220. package/dist/scoping/score.js +125 -0
  221. package/dist/scoping/score.js.map +1 -0
  222. package/dist/scoping/tiers.d.ts +32 -0
  223. package/dist/scoping/tiers.d.ts.map +1 -0
  224. package/dist/scoping/tiers.js +35 -0
  225. package/dist/scoping/tiers.js.map +1 -0
  226. package/dist/scoping/traverse.d.ts +60 -0
  227. package/dist/scoping/traverse.d.ts.map +1 -0
  228. package/dist/scoping/traverse.js +172 -0
  229. package/dist/scoping/traverse.js.map +1 -0
  230. package/dist/scoping/weights.d.ts +97 -0
  231. package/dist/scoping/weights.d.ts.map +1 -0
  232. package/dist/scoping/weights.js +167 -0
  233. package/dist/scoping/weights.js.map +1 -0
  234. package/dist/sources/git/diff.d.ts +53 -0
  235. package/dist/sources/git/diff.d.ts.map +1 -0
  236. package/dist/sources/git/diff.js +140 -0
  237. package/dist/sources/git/diff.js.map +1 -0
  238. package/dist/sources/git/env.d.ts +2 -0
  239. package/dist/sources/git/env.d.ts.map +1 -0
  240. package/dist/sources/git/env.js +21 -0
  241. package/dist/sources/git/env.js.map +1 -0
  242. package/dist/sources/git/history.d.ts +140 -0
  243. package/dist/sources/git/history.d.ts.map +1 -0
  244. package/dist/sources/git/history.js +314 -0
  245. package/dist/sources/git/history.js.map +1 -0
  246. package/dist/sources/git/index.d.ts +7 -0
  247. package/dist/sources/git/index.d.ts.map +1 -0
  248. package/dist/sources/git/index.js +4 -0
  249. package/dist/sources/git/index.js.map +1 -0
  250. package/dist/sources/git/source.d.ts +95 -0
  251. package/dist/sources/git/source.d.ts.map +1 -0
  252. package/dist/sources/git/source.js +0 -0
  253. package/dist/sources/git/source.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +59 -0
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -0
  256. package/dist/sources/migrations/dialects.js +84 -0
  257. package/dist/sources/migrations/dialects.js.map +1 -0
  258. package/dist/sources/migrations/index.d.ts +3 -0
  259. package/dist/sources/migrations/index.d.ts.map +1 -0
  260. package/dist/sources/migrations/index.js +2 -0
  261. package/dist/sources/migrations/index.js.map +1 -0
  262. package/dist/sources/migrations/read.d.ts +113 -0
  263. package/dist/sources/migrations/read.d.ts.map +1 -0
  264. package/dist/sources/migrations/read.js +270 -0
  265. package/dist/sources/migrations/read.js.map +1 -0
  266. package/dist/sources/workspace/index.d.ts +3 -0
  267. package/dist/sources/workspace/index.d.ts.map +1 -0
  268. package/dist/sources/workspace/index.js +2 -0
  269. package/dist/sources/workspace/index.js.map +1 -0
  270. package/dist/sources/workspace/workspace.d.ts +64 -0
  271. package/dist/sources/workspace/workspace.d.ts.map +1 -0
  272. package/dist/sources/workspace/workspace.js +294 -0
  273. package/dist/sources/workspace/workspace.js.map +1 -0
  274. package/dist/store/driver/driver.d.ts +82 -0
  275. package/dist/store/driver/driver.d.ts.map +1 -0
  276. package/dist/store/driver/driver.js +31 -0
  277. package/dist/store/driver/driver.js.map +1 -0
  278. package/dist/store/driver/node-sqlite.d.ts +28 -0
  279. package/dist/store/driver/node-sqlite.d.ts.map +1 -0
  280. package/dist/store/driver/node-sqlite.js +188 -0
  281. package/dist/store/driver/node-sqlite.js.map +1 -0
  282. package/dist/store/index.d.ts +33 -0
  283. package/dist/store/index.d.ts.map +1 -0
  284. package/dist/store/index.js +46 -0
  285. package/dist/store/index.js.map +1 -0
  286. package/dist/store/migrate.d.ts +68 -0
  287. package/dist/store/migrate.d.ts.map +1 -0
  288. package/dist/store/migrate.js +140 -0
  289. package/dist/store/migrate.js.map +1 -0
  290. package/dist/store/reader.d.ts +127 -0
  291. package/dist/store/reader.d.ts.map +1 -0
  292. package/dist/store/reader.js +269 -0
  293. package/dist/store/reader.js.map +1 -0
  294. package/dist/store/schema.d.ts +87 -0
  295. package/dist/store/schema.d.ts.map +1 -0
  296. package/dist/store/schema.js +322 -0
  297. package/dist/store/schema.js.map +1 -0
  298. package/dist/store/writer.d.ts +116 -0
  299. package/dist/store/writer.d.ts.map +1 -0
  300. package/dist/store/writer.js +279 -0
  301. package/dist/store/writer.js.map +1 -0
  302. package/dist/tiers/certify.d.ts +375 -0
  303. package/dist/tiers/certify.d.ts.map +1 -0
  304. package/dist/tiers/certify.js +434 -0
  305. package/dist/tiers/certify.js.map +1 -0
  306. package/dist/tiers/index.d.ts +5 -0
  307. package/dist/tiers/index.d.ts.map +1 -0
  308. package/dist/tiers/index.js +3 -0
  309. package/dist/tiers/index.js.map +1 -0
  310. package/dist/tiers/ladder.d.ts +73 -0
  311. package/dist/tiers/ladder.d.ts.map +1 -0
  312. package/dist/tiers/ladder.js +197 -0
  313. package/dist/tiers/ladder.js.map +1 -0
  314. package/dist/validation/config-graph.d.ts +104 -0
  315. package/dist/validation/config-graph.d.ts.map +1 -0
  316. package/dist/validation/config-graph.js +205 -0
  317. package/dist/validation/config-graph.js.map +1 -0
  318. package/dist/validation/env.d.ts +243 -0
  319. package/dist/validation/env.d.ts.map +1 -0
  320. package/dist/validation/env.js +447 -0
  321. package/dist/validation/env.js.map +1 -0
  322. package/dist/validation/index.d.ts +16 -0
  323. package/dist/validation/index.d.ts.map +1 -0
  324. package/dist/validation/index.js +9 -0
  325. package/dist/validation/index.js.map +1 -0
  326. package/dist/validation/join-substitution.d.ts +186 -0
  327. package/dist/validation/join-substitution.d.ts.map +1 -0
  328. package/dist/validation/join-substitution.js +191 -0
  329. package/dist/validation/join-substitution.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +133 -0
  331. package/dist/validation/migrations.d.ts.map +1 -0
  332. package/dist/validation/migrations.js +315 -0
  333. package/dist/validation/migrations.js.map +1 -0
  334. package/dist/validation/nodes.d.ts +32 -0
  335. package/dist/validation/nodes.d.ts.map +1 -0
  336. package/dist/validation/nodes.js +45 -0
  337. package/dist/validation/nodes.js.map +1 -0
  338. package/dist/validation/rollback.d.ts +124 -0
  339. package/dist/validation/rollback.d.ts.map +1 -0
  340. package/dist/validation/rollback.js +302 -0
  341. package/dist/validation/rollback.js.map +1 -0
  342. package/dist/validation/route-drift.d.ts +108 -0
  343. package/dist/validation/route-drift.d.ts.map +1 -0
  344. package/dist/validation/route-drift.js +103 -0
  345. package/dist/validation/route-drift.js.map +1 -0
  346. package/dist/validation/sources.d.ts +153 -0
  347. package/dist/validation/sources.d.ts.map +1 -0
  348. package/dist/validation/sources.js +409 -0
  349. package/dist/validation/sources.js.map +1 -0
  350. package/dist/worker/index.d.ts +5 -0
  351. package/dist/worker/index.d.ts.map +1 -0
  352. package/dist/worker/index.js +3 -0
  353. package/dist/worker/index.js.map +1 -0
  354. package/dist/worker/pool.d.ts +73 -0
  355. package/dist/worker/pool.d.ts.map +1 -0
  356. package/dist/worker/pool.js +203 -0
  357. package/dist/worker/pool.js.map +1 -0
  358. package/dist/worker/protocol.d.ts +91 -0
  359. package/dist/worker/protocol.d.ts.map +1 -0
  360. package/dist/worker/protocol.js +19 -0
  361. package/dist/worker/protocol.js.map +1 -0
  362. package/dist/worker/traversal.worker.d.ts +25 -0
  363. package/dist/worker/traversal.worker.d.ts.map +1 -0
  364. package/dist/worker/traversal.worker.js +124 -0
  365. package/dist/worker/traversal.worker.js.map +1 -0
  366. package/package.json +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finding-funnel.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B,CAqCrB;AAYD;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The governance funnel — architecture §20.1.
3
+ *
4
+ * > *"Without this layer, a run that surfaces 200 findings gets read by
5
+ * > nobody. Volume without governance is functionally the same as no output at
6
+ * > all."*
7
+ *
8
+ * §20.1 draws a five-filter funnel ending in a hard cap. Two of its boxes had
9
+ * no implementation anywhere: **F2, "known false positives from the feedback
10
+ * store,"** and **the HARD CAP itself**, whose value architecture §32 item 6
11
+ * has carried as a blank since the document was written (*"Hard cap value —
12
+ * how many findings is 'a few'"*, Tuning, *"set from early runs"*).
13
+ *
14
+ * `CLAUDE.md` rule 5 — *"a few high-confidence findings, never an exhaustive
15
+ * maybe-list"* — is the rule aimed most directly at what this whole category
16
+ * of tool gets wrong, and it was the one rule with no number behind it. Three
17
+ * per-check caps of 25 existed (`contracts/orphans.ts`, `validation/rollback.ts`,
18
+ * `validation/env.ts`), which is not the same thing: three checks at 25 present
19
+ * 75 items and nothing objects.
20
+ *
21
+ * ## The cap values, and where they come from
22
+ *
23
+ * §20.1 states its own worked example in prose: *"Twenty-seven possible issues
24
+ * get ignored. Three confirmed issues plus two worth checking get acted on
25
+ * immediately."* **Three plus two is five**, and that is `pr`'s cap — read off
26
+ * the architecture rather than invented.
27
+ *
28
+ * The other three are scaled to their trigger the same way `NODE_BUDGETS`
29
+ * already is, and for the same reason: an IDE hover and a nightly sweep are
30
+ * not the same reading surface. **Starting values, not measurements** —
31
+ * `CLAUDE.md`'s standing convention for every number in this project.
32
+ *
33
+ * ## What this module deliberately does not own
34
+ *
35
+ * - **It does not assign a category.** Only G4 does (`ai-governance-spec.md`
36
+ * §11). This runs strictly after, on already-categorised findings, and
37
+ * reorders and truncates them without touching a single field.
38
+ * - **It does not store dismissals.** `isDismissed` is a caller-supplied
39
+ * predicate. The ledger is `descry-desktop`'s (§21.3 puts the feedback store
40
+ * next to the runs it belongs to); the *filter* is governance and belongs
41
+ * here, next to G1–G4.
42
+ * - **It never silently drops anything.** Every finding that entered leaves in
43
+ * exactly one of `reported` / `unconfirmed` / `suppressed`, and the count it
44
+ * truncated is a structured field with a rendered sentence — the same rule
45
+ * `ai-tool-contract.md` §4 technique 5 applies one layer down (*"a capped
46
+ * result that looks complete is the same defect as a zero that looks like a
47
+ * finding"*).
48
+ */
49
+ import { findingFingerprint } from "@descryy/ir";
50
+ /**
51
+ * How many findings one run may report, per trigger.
52
+ *
53
+ * `pr` is architecture §20.1's own arithmetic (3 confirmed + 2 worth
54
+ * checking). The rest are scaled to the reading surface, the same shape
55
+ * `NODE_BUDGETS` uses, and are starting values pending real runs to tune from.
56
+ */
57
+ export const FINDING_CAPS = {
58
+ /** A hover is one line of screen. More than one finding there is a list nobody reads. */
59
+ "ide-hover": 1,
60
+ /** A developer is mid-push and blocked. Only the strongest survive. */
61
+ "pre-push": 3,
62
+ /** §20.1's own worked example. */
63
+ pr: 5,
64
+ /** Someone opened a report deliberately and is reading it. Looser, still capped. */
65
+ nightly: 10,
66
+ };
67
+ /** Rank order for §20.1's "rank by confidence × impact". Higher wins. */
68
+ const CATEGORY_RANK = {
69
+ confirmed: 4,
70
+ "strongly supported": 3,
71
+ unconfirmed: 2,
72
+ "not analysable": 1,
73
+ unsupported: 0,
74
+ };
75
+ /** Categories that belong in §20.1's separate unconfirmed list rather than the capped one. */
76
+ const NOT_CONFIDENT = new Set(["unconfirmed", "not analysable", "unsupported"]);
77
+ /**
78
+ * Run §20.1's funnel over one run's findings.
79
+ *
80
+ * Pure and total: same input, same output, and every input finding appears in
81
+ * exactly one output list. Deterministic ordering — required by
82
+ * `ai-layer-plan.md` §9 layer 6's replay guarantee, so ties break on the
83
+ * finding's own fingerprint rather than on input order.
84
+ */
85
+ export function runFindingFunnel(findings, options) {
86
+ const isDismissed = options.isDismissed ?? (() => false);
87
+ const suppressed = [];
88
+ const confident = [];
89
+ const unconfirmed = [];
90
+ for (const finding of findings) {
91
+ if (isDismissed(finding)) {
92
+ suppressed.push(finding);
93
+ continue;
94
+ }
95
+ if (NOT_CONFIDENT.has(finding.confidence))
96
+ unconfirmed.push(finding);
97
+ else
98
+ confident.push(finding);
99
+ }
100
+ const ranked = [...confident].sort(compareFindings);
101
+ const cap = Math.max(0, Math.floor(options.cap ?? FINDING_CAPS[options.trigger]));
102
+ const reported = ranked.slice(0, cap);
103
+ const dropped = ranked.length - reported.length;
104
+ return {
105
+ reported,
106
+ unconfirmed: [...unconfirmed].sort(compareFindings),
107
+ suppressed,
108
+ truncation: {
109
+ total: ranked.length,
110
+ shown: reported.length,
111
+ dropped,
112
+ disclosure: dropped === 0
113
+ ? null
114
+ : `${dropped} further finding${dropped === 1 ? "" : "s"} met the confidence bar and ` +
115
+ `${dropped === 1 ? "was" : "were"} not shown: this run reports at most ${cap}, ranked by ` +
116
+ "confidence. They were found, not missed.",
117
+ },
118
+ };
119
+ }
120
+ function compareFindings(a, b) {
121
+ const byCategory = CATEGORY_RANK[b.confidence] - CATEGORY_RANK[a.confidence];
122
+ if (byCategory !== 0)
123
+ return byCategory;
124
+ // Then by how well the code beneath it was understood — rule 3's axis.
125
+ const byResolution = Number(b.resolutionLevel) - Number(a.resolutionLevel);
126
+ if (byResolution !== 0)
127
+ return byResolution;
128
+ // A stable, content-derived tiebreak, so replay reproduces the order.
129
+ return findingFingerprint(a) < findingFingerprint(b) ? -1 : 1;
130
+ }
131
+ /**
132
+ * Re-exported so a caller wiring the funnel and its ledger imports one module.
133
+ * The implementation lives in `@descryy/ir`'s identity module — see
134
+ * `DEC-NEXT-edge-id-prefix-split` for why an identity gets exactly one home.
135
+ */
136
+ export { findingFingerprint } from "@descryy/ir";
137
+ //# sourceMappingURL=finding-funnel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finding-funnel.js","sourceRoot":"","sources":["../../src/governance/finding-funnel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC5C,sEAAsE;IACtE,OAAO,kBAAkB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { checkFactBoundary } from "./fact-boundary.ts";
2
+ export type { Citation, CitationPathSegment, FactualClaim, SlotOutput, RejectedClaim, FactBoundaryResult } from "./fact-boundary.ts";
3
+ export { checkCandidateBoundary } from "./candidate-boundary.ts";
4
+ export type { PlanItem, RejectedPlanItem, CandidateBoundaryResult } from "./candidate-boundary.ts";
5
+ export { BUDGET_CAP_NAMES, DEFAULT_INVESTIGATION_BUDGET, checkRunBudget, hypothesisRoundLimitReached, } from "./budget.ts";
6
+ export type { BudgetCapExceeded, BudgetCapName, BudgetCheckResult, HypothesisBudgetUsage, InvestigationBudget, RunBudgetUsage, } from "./budget.ts";
7
+ export { ESCALATION_TRIGGERS, checkEscalation } from "./escalation.ts";
8
+ export type { EscalationCheckInput, EscalationTrigger } from "./escalation.ts";
9
+ export { runFindingFunnel, findingFingerprint, FINDING_CAPS } from "./finding-funnel.ts";
10
+ export type { FindingFunnelOptions, FindingFunnelResult, FindingTruncation, } from "./finding-funnel.ts";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAErI,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzF,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { checkFactBoundary } from "./fact-boundary.js";
2
+ export { checkCandidateBoundary } from "./candidate-boundary.js";
3
+ export { BUDGET_CAP_NAMES, DEFAULT_INVESTIGATION_BUDGET, checkRunBudget, hypothesisRoundLimitReached, } from "./budget.js";
4
+ export { ESCALATION_TRIGGERS, checkEscalation } from "./escalation.js";
5
+ export { runFindingFunnel, findingFingerprint, FINDING_CAPS } from "./finding-funnel.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * The Graph Builder.
3
+ *
4
+ * This is the first place the multi-language thesis is true or false in code.
5
+ * Everything before it works on one adapter's output at a time; this folds
6
+ * several adapters' IR into one graph, and either the cross-language join
7
+ * happens here or it never happens at all.
8
+ *
9
+ * Its acceptance test is XL-1 — *exactly one* `API_ENDPOINT` node after merging
10
+ * both adapters — and XL-2, that the node carries no language. Step 7 showed the
11
+ * two fakes reach the same endpoint id independently; this has to preserve that
12
+ * through the merge rather than produce two nodes or one wrong one.
13
+ *
14
+ * ## Four rules, in order of how much damage they prevent
15
+ *
16
+ * **1. Never invent a node.** An edge whose target cannot be resolved is
17
+ * dropped. It never becomes a stub node, however convenient that would be for
18
+ * traversal. On the prior-art graphs measured for this build, 52-60% of edges
19
+ * pointed at a non-existent target — `append` with in-degree 1,036, `get` with
20
+ * 973. Materialising those as nodes is how a graph acquires a thousand-way hub
21
+ * that every impact score then routes through.
22
+ *
23
+ * **2. Merge is order-independent.** DEC-012's third tie-break exists only for
24
+ * this. Without it, "which adapter ran first" leaks into every impact score, and
25
+ * the symptom is an unreproducible difference nobody can bisect.
26
+ *
27
+ * **3. Collisions are reported, not merged.** Two nodes sharing an id but
28
+ * disagreeing on type or language are not the same thing, and merging them pools
29
+ * the edges of two unrelated symbols. See DEC-024 — this is a live hazard in a
30
+ * polyglot monorepo, not a hypothetical one.
31
+ *
32
+ * **4. Nothing enters without passing the Normaliser.** The builder calls it
33
+ * rather than trusting its caller, because the batch-spanning `nodeExists` it
34
+ * needs — an edge may legitimately point into a sibling batch in the same build
35
+ * — can only be computed here.
36
+ */
37
+ import { type IRBatch, type IREdge, type IRNode, type NodeType, type NormaliseOptions, type Rejection, type UnresolvedRef } from "@descryy/ir";
38
+ /**
39
+ * Two nodes claimed the same id but are not the same thing.
40
+ *
41
+ * Reported rather than resolved. There is no correct merge — the ids are equal,
42
+ * so the graph has no way to represent them separately — and picking one
43
+ * silently is the corruption DEC-024 describes. Surfacing it puts the failure in
44
+ * §20.2's "not analysable" category, where a user can see it.
45
+ */
46
+ export interface IdentityCollision {
47
+ readonly nodeId: string;
48
+ readonly kept: {
49
+ readonly type: string;
50
+ readonly language: string | null;
51
+ readonly producedBy: string;
52
+ };
53
+ readonly discarded: {
54
+ readonly type: string;
55
+ readonly language: string | null;
56
+ readonly producedBy: string;
57
+ };
58
+ }
59
+ /**
60
+ * How much of a workspace-scoped node type actually crossed a repository
61
+ * boundary, and how much only ever existed in one.
62
+ *
63
+ * Counted per *repository*, not per producer: two adapters in one repo agreeing
64
+ * on a node is a within-repo merge and is not what DEC-054's scope table exists
65
+ * to achieve.
66
+ */
67
+ export interface JoinMetric {
68
+ readonly type: NodeType;
69
+ /** Distinct nodes of this type in the built graph. */
70
+ readonly total: number;
71
+ /** Of those, how many were supplied by more than one repository — the join. */
72
+ readonly joined: number;
73
+ /** Repositories in this build that emitted the type at all. */
74
+ readonly repos: readonly string[];
75
+ /** The identity scope each of those repositories resolved to, deduplicated. */
76
+ readonly scopes: readonly string[];
77
+ }
78
+ /**
79
+ * Something the build cannot call an error but must not pass over in silence.
80
+ *
81
+ * `NO_CROSS_REPO_JOIN` is the one that matters and the reason this list exists.
82
+ * A workspace id has to be byte-identical in every repository that shares it,
83
+ * and when it is not, nothing fails: every batch normalises, every node is
84
+ * well-formed, every edge resolves, and the two sides simply never meet. Zero
85
+ * joins, zero errors, zero warnings — which is why the zero itself has to be the
86
+ * warning.
87
+ */
88
+ export interface BuildWarning {
89
+ readonly code: "NO_CROSS_REPO_JOIN";
90
+ readonly type: NodeType;
91
+ readonly detail: string;
92
+ }
93
+ export interface BuildResult {
94
+ readonly nodes: readonly IRNode[];
95
+ readonly edges: readonly IREdge[];
96
+ readonly unresolved: readonly UnresolvedRef[];
97
+ /** Everything the Normaliser turned away, per batch, with its typed reason. */
98
+ readonly rejections: readonly Rejection[];
99
+ /** Node ids more than one batch supplied. Normal and expected — this is the join. */
100
+ readonly mergedNodes: number;
101
+ /** Edge ids more than one batch supplied. DEC-012 resolved each. */
102
+ readonly mergedEdges: number;
103
+ readonly collisions: readonly IdentityCollision[];
104
+ /** Edges dropped because an endpoint resolved to nothing. Never stubbed. */
105
+ readonly droppedEdges: number;
106
+ /** Per workspace-scoped type, emitted by at least one repository in this build. */
107
+ readonly joins: readonly JoinMetric[];
108
+ readonly warnings: readonly BuildWarning[];
109
+ }
110
+ export interface BuildOptions {
111
+ /**
112
+ * Does a node with this id already exist in the store? An incremental build
113
+ * over one changed file legitimately points at nodes no batch in this build
114
+ * supplied.
115
+ */
116
+ readonly nodeExists?: (id: string) => boolean;
117
+ readonly confidenceCeilings?: NormaliseOptions["confidenceCeilings"];
118
+ }
119
+ /**
120
+ * Fold normalised batches into one graph.
121
+ *
122
+ * Pure: no store, no IO. The store is one consumer of the result, the
123
+ * conformance harness is another, and a builder that wrote as it went could be
124
+ * tested by neither without a database.
125
+ */
126
+ export declare function buildGraph(batches: readonly IRBatch[], options?: BuildOptions): BuildResult;
127
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/graph/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI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CAC7B,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CACvE;QACD,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjD,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,aAAa,CACxD,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,CAC7C,CACF;QACD,UAAU;QACV,WAAW;QACX,WAAW;QACX,UAAU;QACV,YAAY;QACZ,KAAK;QACL,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The cross-language declaration index — DEC-161.
3
+ *
4
+ * Runs **after** every adapter has produced its batch, over the batches
5
+ * themselves rather than inside any one adapter, because the target id an
6
+ * unresolved reference should join to is not something the referencing
7
+ * adapter can compute — it does not have the declaring language's source.
8
+ *
9
+ * ## Why the key is a string neither side derives from the other
10
+ *
11
+ * `UnresolvedRef.rawTarget` is what the referencing side's own source spells —
12
+ * a Java `import okhttp3.OkHttpClient;` cannot carry Kotlin's module or source
13
+ * set, because nothing in that line names either.
14
+ * `CrossLanguageDeclaration.qualifiedName` is the same kind of fact, stated by
15
+ * the *declaring* adapter about how an external reader would reach its node.
16
+ * Matching the two is a string comparison over two independently-computed
17
+ * facts, not a derivation of one from the other — which is what keeps this a
18
+ * resolver rather than a heuristic.
19
+ *
20
+ * ## Mutual declaration
21
+ *
22
+ * Two adapters resolve against each other only when each names the other as a
23
+ * peer (`CapabilityMatrix.crossLanguageNamespace`). A one-sided declaration —
24
+ * or two unrelated adapters that happen to pick the same namespace `id` by
25
+ * accident — resolves nothing. This is deliberate: equality-only comparison
26
+ * makes an accidental id collision silent otherwise, and that is the exact
27
+ * failure this mechanism exists to prevent, arriving through its own door if
28
+ * declaration were not mutual.
29
+ *
30
+ * ## Ambiguity is the normal case, not the exception
31
+ *
32
+ * More than one candidate for a `qualifiedName`, with no stated basis to
33
+ * choose between them, is reported and resolves nothing — precision over
34
+ * recall, and the same rule `dup-ids.mjs` enforces on plain node identity.
35
+ *
36
+ * ## Resolution and provenance
37
+ *
38
+ * Every resolved edge is stamped `resolution: 1` (R1 — a name match between
39
+ * two adapters, neither of which type-checked the other's file) and
40
+ * `producedBy: RESOLVER_PRODUCED_BY`. Neither adapter produced this edge, and
41
+ * attributing it to one would make that adapter's own precision figures
42
+ * answer for a join it did not make.
43
+ */
44
+ import type { IRBatch, IREdge, UnresolvedRef } from "@descryy/ir";
45
+ /** Stamped on every edge this pass mints. Neither adapter's own id, on purpose. */
46
+ export declare const RESOLVER_PRODUCED_BY = "cross-language-resolver@1";
47
+ export interface NamespaceDeclaration {
48
+ readonly id: string;
49
+ readonly peers: readonly string[];
50
+ }
51
+ /** More than one declared node answers to this `qualifiedName` inside a
52
+ * matched namespace pair — refused rather than guessed. */
53
+ export interface CrossLanguageAmbiguity {
54
+ readonly unresolved: UnresolvedRef;
55
+ readonly qualifiedName: string;
56
+ readonly candidateNodeIds: readonly string[];
57
+ }
58
+ export interface CrossLanguageResult {
59
+ readonly resolved: readonly IREdge[];
60
+ readonly ambiguous: readonly CrossLanguageAmbiguity[];
61
+ }
62
+ /**
63
+ * @param batches Every batch in this build, from every adapter.
64
+ * @param namespaceOf A batch's `producedBy` (`adapterId@version`) to its
65
+ * declared namespace, if any. The caller supplies this because a
66
+ * `CapabilityMatrix` is a per-adapter fact, not a per-batch one, and this
67
+ * pass is deliberately kept ignorant of how an adapter is instantiated.
68
+ */
69
+ export declare function resolveCrossLanguage(batches: readonly IRBatch[], namespaceOf: (producedBy: string) => NamespaceDeclaration | undefined): CrossLanguageResult;
70
+ //# sourceMappingURL=cross-language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-language.d.ts","sourceRoot":"","sources":["../../src/graph/cross-language.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5E,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;4DAC4D;AAC5D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACvD;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,OAAO,EAAE,EAC3B,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,oBAAoB,GAAG,SAAS,GACpE,mBAAmB,CAqDrB"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The cross-language declaration index — DEC-161.
3
+ *
4
+ * Runs **after** every adapter has produced its batch, over the batches
5
+ * themselves rather than inside any one adapter, because the target id an
6
+ * unresolved reference should join to is not something the referencing
7
+ * adapter can compute — it does not have the declaring language's source.
8
+ *
9
+ * ## Why the key is a string neither side derives from the other
10
+ *
11
+ * `UnresolvedRef.rawTarget` is what the referencing side's own source spells —
12
+ * a Java `import okhttp3.OkHttpClient;` cannot carry Kotlin's module or source
13
+ * set, because nothing in that line names either.
14
+ * `CrossLanguageDeclaration.qualifiedName` is the same kind of fact, stated by
15
+ * the *declaring* adapter about how an external reader would reach its node.
16
+ * Matching the two is a string comparison over two independently-computed
17
+ * facts, not a derivation of one from the other — which is what keeps this a
18
+ * resolver rather than a heuristic.
19
+ *
20
+ * ## Mutual declaration
21
+ *
22
+ * Two adapters resolve against each other only when each names the other as a
23
+ * peer (`CapabilityMatrix.crossLanguageNamespace`). A one-sided declaration —
24
+ * or two unrelated adapters that happen to pick the same namespace `id` by
25
+ * accident — resolves nothing. This is deliberate: equality-only comparison
26
+ * makes an accidental id collision silent otherwise, and that is the exact
27
+ * failure this mechanism exists to prevent, arriving through its own door if
28
+ * declaration were not mutual.
29
+ *
30
+ * ## Ambiguity is the normal case, not the exception
31
+ *
32
+ * More than one candidate for a `qualifiedName`, with no stated basis to
33
+ * choose between them, is reported and resolves nothing — precision over
34
+ * recall, and the same rule `dup-ids.mjs` enforces on plain node identity.
35
+ *
36
+ * ## Resolution and provenance
37
+ *
38
+ * Every resolved edge is stamped `resolution: 1` (R1 — a name match between
39
+ * two adapters, neither of which type-checked the other's file) and
40
+ * `producedBy: RESOLVER_PRODUCED_BY`. Neither adapter produced this edge, and
41
+ * attributing it to one would make that adapter's own precision figures
42
+ * answer for a join it did not make.
43
+ */
44
+ /** Stamped on every edge this pass mints. Neither adapter's own id, on purpose. */
45
+ export const RESOLVER_PRODUCED_BY = "cross-language-resolver@1";
46
+ function isMutualPeer(a, b) {
47
+ return a.peers.includes(b.id) && b.peers.includes(a.id);
48
+ }
49
+ /**
50
+ * @param batches Every batch in this build, from every adapter.
51
+ * @param namespaceOf A batch's `producedBy` (`adapterId@version`) to its
52
+ * declared namespace, if any. The caller supplies this because a
53
+ * `CapabilityMatrix` is a per-adapter fact, not a per-batch one, and this
54
+ * pass is deliberately kept ignorant of how an adapter is instantiated.
55
+ */
56
+ export function resolveCrossLanguage(batches, namespaceOf) {
57
+ // One entry per batch that actually declared a namespace. A batch with no
58
+ // declaration contributes nothing to either side — it is neither a source
59
+ // of candidates nor a consumer of them.
60
+ const declaring = batches
61
+ .map((batch) => ({ batch, namespace: namespaceOf(batch.producedBy) }))
62
+ .filter((entry) => entry.namespace !== undefined);
63
+ // qualifiedName -> candidate node ids, scoped to ONE declaring batch at a
64
+ // time rather than pooled across batches sharing a namespace id — pooling
65
+ // would let two same-language batches silently stand in for each other,
66
+ // which is not a claim this pass is entitled to make.
67
+ const resolved = [];
68
+ const ambiguous = [];
69
+ for (const referencing of declaring) {
70
+ if (referencing.batch.unresolved.length === 0)
71
+ continue;
72
+ for (const ref of referencing.batch.unresolved) {
73
+ const candidates = [];
74
+ for (const declaringSide of declaring) {
75
+ if (declaringSide.batch === referencing.batch)
76
+ continue;
77
+ if (!isMutualPeer(referencing.namespace, declaringSide.namespace))
78
+ continue;
79
+ if (declaringSide.batch.crossLanguageDeclarations === undefined)
80
+ continue;
81
+ for (const decl of declaringSide.batch.crossLanguageDeclarations) {
82
+ if (decl.qualifiedName === ref.rawTarget)
83
+ candidates.push(decl.nodeId);
84
+ }
85
+ }
86
+ if (candidates.length === 0)
87
+ continue; // Not this pass's failure to explain.
88
+ if (candidates.length > 1) {
89
+ ambiguous.push({ unresolved: ref, qualifiedName: ref.rawTarget, candidateNodeIds: candidates });
90
+ continue;
91
+ }
92
+ resolved.push({
93
+ from: ref.fromNodeId,
94
+ to: candidates[0],
95
+ type: ref.edgeType,
96
+ resolution: 1,
97
+ confidence: 1,
98
+ producedBy: RESOLVER_PRODUCED_BY,
99
+ });
100
+ }
101
+ }
102
+ return { resolved, ambiguous };
103
+ }
104
+ //# sourceMappingURL=cross-language.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-language.js","sourceRoot":"","sources":["../../src/graph/cross-language.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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SAAS,CAAC;oBAAE,SAAS;gBAC5E,IAAI,aAAa,CAAC,KAAK,CAAC,yBAAyB,KAAK,SAAS;oBAAE,SAAS;gBAE1E,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC;oBACjE,IAAI,IAAI,CAAC,aAAa,KAAK,GAAG,CAAC,SAAS;wBAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACzE,CAAC;YACH,CAAC;YAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS,CAAC,sCAAsC;YAE7E,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;gBAChG,SAAS;YACX,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,GAAG,CAAC,UAAU;gBACpB,EAAE,EAAE,UAAU,CAAC,CAAC,CAAE;gBAClB,IAAI,EAAE,GAAG,CAAC,QAA2B;gBACrC,UAAU,EAAE,CAAC;gBACb,UAAU,EAAE,CAAC;gBACb,UAAU,EAAE,oBAAoB;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { buildGraph } from "./build.ts";
2
+ export type { BuildResult, BuildOptions, IdentityCollision } from "./build.ts";
3
+ export { persistGraph } from "./persist.ts";
4
+ export type { PersistResult } from "./persist.ts";
5
+ export { preferIncoming, mergeEdge, mergeNode, corroborators, identityFingerprint, EDGE_MERGE_CONDITION, NODE_MERGE_CONDITION, } from "./merge.ts";
6
+ export type { Mergeable } from "./merge.ts";
7
+ export { resolveCrossLanguage, RESOLVER_PRODUCED_BY } from "./cross-language.ts";
8
+ export type { NamespaceDeclaration, CrossLanguageAmbiguity, CrossLanguageResult } from "./cross-language.ts";
9
+ export { applyRuntimeObservations, reapplyEarnedOverlays, observedEdges, edgeCorrections, recordEdgeCorrection, RUNTIME_ADAPTER_ID, RUNTIME_ADAPTER_VERSION, RUNTIME_PRODUCER, } from "./runtime-confirmation.ts";
10
+ export type { Clock, EdgeCorrectionRow, ObservedEdgeRow, RuntimeConfirmationInput, RuntimeConfirmationResult, RuntimeObservationRefusal, StaleR4Observation, } from "./runtime-confirmation.ts";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { buildGraph } from "./build.js";
2
+ export { persistGraph } from "./persist.js";
3
+ export { preferIncoming, mergeEdge, mergeNode, corroborators, identityFingerprint, EDGE_MERGE_CONDITION, NODE_MERGE_CONDITION, } from "./merge.js";
4
+ export { resolveCrossLanguage, RESOLVER_PRODUCED_BY } from "./cross-language.js";
5
+ export { applyRuntimeObservations, reapplyEarnedOverlays, observedEdges, edgeCorrections, recordEdgeCorrection, RUNTIME_ADAPTER_ID, RUNTIME_ADAPTER_VERSION, RUNTIME_PRODUCER, } from "./runtime-confirmation.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The merge policy — DEC-012.
3
+ *
4
+ * Two adapters finding the same relationship produce the same edge id, by
5
+ * construction: `hash(from, to, type)` deliberately excludes resolution,
6
+ * confidence and producer. On the prior-art graphs measured for this build, 30%
7
+ * of edges were exact duplicates, so this is the common path rather than an
8
+ * edge case.
9
+ *
10
+ * ## The rule
11
+ *
12
+ * higher `resolution` wins
13
+ * → tie: higher `confidence` wins
14
+ * → tie: lexicographically smaller `producedBy` wins
15
+ *
16
+ * ## What the rule refuses to do
17
+ *
18
+ * **Confidence is never combined.** Two adapters each 0.8 confident does not
19
+ * make 0.96, or 0.8, or anything else — there is no evidence-combination model
20
+ * here, the two adapters are not independent observers, and inventing a formula
21
+ * would silently move every impact score in §12.4 with nothing in the output to
22
+ * show it happened. Corroboration is recorded as a fact (`attrs.corroboratedBy`)
23
+ * rather than folded into a number.
24
+ *
25
+ * The third tie-break exists only to make the result independent of the order
26
+ * batches arrive in. Lexicographic order is arbitrary; determinism is not.
27
+ *
28
+ * ## Why the rule is written twice
29
+ *
30
+ * The merge has to hold in two places: in memory, when the Graph Builder folds
31
+ * several batches together, and in SQL, when a later batch upserts onto an edge
32
+ * an earlier one already wrote. A rule enforced in only the first is not
33
+ * enforced at all, because the writer is reachable directly.
34
+ *
35
+ * So it appears as a TypeScript predicate and as a SQL `WHERE` fragment, side by
36
+ * side, with a differential test that runs the same case table through both.
37
+ * Two copies with a test that they agree beats one copy that only covers one of
38
+ * the two paths.
39
+ */
40
+ import type { IREdge, IRNode } from "@descryy/ir";
41
+ /** The fields the merge decides between. Both the graph and a stored row satisfy it. */
42
+ export interface Mergeable {
43
+ readonly resolution: number;
44
+ readonly confidence: number;
45
+ readonly producedBy: string;
46
+ }
47
+ /**
48
+ * Should `incoming` replace `existing`?
49
+ *
50
+ * Strict: an exact tie on all three keeps what is already there, so re-ingesting
51
+ * the same batch is a no-op rather than a rewrite.
52
+ */
53
+ export declare function preferIncoming(incoming: Mergeable, existing: Mergeable): boolean;
54
+ /**
55
+ * The same rule as a SQL `WHERE` clause on an upsert's `DO UPDATE`.
56
+ *
57
+ * `excluded` is the incoming row, `edges` the one already stored — SQLite's
58
+ * upsert names them that way. Kept adjacent to `preferIncoming` on purpose:
59
+ * `merge.test.ts` runs one case table through both and fails if they disagree.
60
+ */
61
+ export declare const EDGE_MERGE_CONDITION = "\n excluded.resolution > edges.resolution\n OR (excluded.resolution = edges.resolution AND excluded.confidence > edges.confidence)\n OR (excluded.resolution = edges.resolution\n AND excluded.confidence = edges.confidence\n AND excluded.produced_by < edges.produced_by)\n";
62
+ /** The same, for nodes. Nodes carry no confidence, so the middle key drops out. */
63
+ export declare const NODE_MERGE_CONDITION = "\n excluded.resolution > nodes.resolution\n OR (excluded.resolution = nodes.resolution AND excluded.produced_by < nodes.produced_by)\n";
64
+ /**
65
+ * Producers that corroborated a merged item, sorted and de-duplicated.
66
+ *
67
+ * DEC-012 records this instead of combining confidence. It is not decoration:
68
+ * "two independent adapters agree" is a materially different statement from "one
69
+ * adapter is fairly sure", and it is the only form in which the graph can carry
70
+ * that distinction without inventing an evidence model.
71
+ */
72
+ export declare function corroborators(existing: Readonly<Record<string, unknown>> | undefined, ...producers: string[]): string[];
73
+ /** Merge two edges that share an id. Returns the winner, carrying corroboration. */
74
+ export declare function mergeEdge(incoming: IREdge, existing: IREdge): IREdge;
75
+ /**
76
+ * Merge two nodes that share an id.
77
+ *
78
+ * Attributes are NOT unioned. `attrs` is language- and framework-specific detail
79
+ * (§11A.4), so pooling two adapters' attributes would produce a node describing
80
+ * a thing that does not exist. The winner's attrs are kept whole and the loser is
81
+ * recorded as a corroborator.
82
+ */
83
+ export declare function mergeNode(incoming: IRNode, existing: IRNode): IRNode;
84
+ /**
85
+ * The fields two nodes sharing an id must agree on.
86
+ *
87
+ * Compared as one opaque string rather than field by field. That is not only
88
+ * tidier: `n.language !== m.language` reads to the boundary lint as branching on
89
+ * a language, and the lint is right to be suspicious — the exception here is
90
+ * that this asks whether two nodes *disagree*, never which language either one
91
+ * is. Folding both fields into a fingerprint states that intent in the code
92
+ * rather than in a lint suppression.
93
+ */
94
+ export declare function identityFingerprint(node: IRNode): string;
95
+ //# sourceMappingURL=merge.d.ts.map