@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":"merge.d.ts","sourceRoot":"","sources":["../../src/graph/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAElD,wFAAwF;AACxF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAQhF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,gSAMhC,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,6IAGhC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EACvD,GAAG,SAAS,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE,CAKV;AAED,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWpE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,131 @@
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
+ /**
41
+ * Should `incoming` replace `existing`?
42
+ *
43
+ * Strict: an exact tie on all three keeps what is already there, so re-ingesting
44
+ * the same batch is a no-op rather than a rewrite.
45
+ */
46
+ export function preferIncoming(incoming, existing) {
47
+ if (incoming.resolution !== existing.resolution) {
48
+ return incoming.resolution > existing.resolution;
49
+ }
50
+ if (incoming.confidence !== existing.confidence) {
51
+ return incoming.confidence > existing.confidence;
52
+ }
53
+ return incoming.producedBy < existing.producedBy;
54
+ }
55
+ /**
56
+ * The same rule as a SQL `WHERE` clause on an upsert's `DO UPDATE`.
57
+ *
58
+ * `excluded` is the incoming row, `edges` the one already stored — SQLite's
59
+ * upsert names them that way. Kept adjacent to `preferIncoming` on purpose:
60
+ * `merge.test.ts` runs one case table through both and fails if they disagree.
61
+ */
62
+ export const EDGE_MERGE_CONDITION = `
63
+ excluded.resolution > edges.resolution
64
+ OR (excluded.resolution = edges.resolution AND excluded.confidence > edges.confidence)
65
+ OR (excluded.resolution = edges.resolution
66
+ AND excluded.confidence = edges.confidence
67
+ AND excluded.produced_by < edges.produced_by)
68
+ `;
69
+ /** The same, for nodes. Nodes carry no confidence, so the middle key drops out. */
70
+ export const NODE_MERGE_CONDITION = `
71
+ excluded.resolution > nodes.resolution
72
+ OR (excluded.resolution = nodes.resolution AND excluded.produced_by < nodes.produced_by)
73
+ `;
74
+ /**
75
+ * Producers that corroborated a merged item, sorted and de-duplicated.
76
+ *
77
+ * DEC-012 records this instead of combining confidence. It is not decoration:
78
+ * "two independent adapters agree" is a materially different statement from "one
79
+ * adapter is fairly sure", and it is the only form in which the graph can carry
80
+ * that distinction without inventing an evidence model.
81
+ */
82
+ export function corroborators(existing, ...producers) {
83
+ const prior = existing?.["corroboratedBy"];
84
+ const all = new Set(Array.isArray(prior) ? prior : []);
85
+ for (const p of producers)
86
+ all.add(p);
87
+ return [...all].sort();
88
+ }
89
+ /** Merge two edges that share an id. Returns the winner, carrying corroboration. */
90
+ export function mergeEdge(incoming, existing) {
91
+ const winner = preferIncoming(incoming, existing) ? incoming : existing;
92
+ const corroboratedBy = corroborators({ ...existing.attrs, ...incoming.attrs }, existing.producedBy, incoming.producedBy);
93
+ return {
94
+ ...winner,
95
+ attrs: { ...(winner.attrs ?? {}), corroboratedBy },
96
+ };
97
+ }
98
+ /**
99
+ * Merge two nodes that share an id.
100
+ *
101
+ * Attributes are NOT unioned. `attrs` is language- and framework-specific detail
102
+ * (§11A.4), so pooling two adapters' attributes would produce a node describing
103
+ * a thing that does not exist. The winner's attrs are kept whole and the loser is
104
+ * recorded as a corroborator.
105
+ */
106
+ export function mergeNode(incoming, existing) {
107
+ const winner = preferIncoming({ ...incoming, confidence: 0 }, { ...existing, confidence: 0 })
108
+ ? incoming
109
+ : existing;
110
+ return {
111
+ ...winner,
112
+ attrs: {
113
+ ...winner.attrs,
114
+ corroboratedBy: corroborators(existing.attrs, existing.producedBy, incoming.producedBy),
115
+ },
116
+ };
117
+ }
118
+ /**
119
+ * The fields two nodes sharing an id must agree on.
120
+ *
121
+ * Compared as one opaque string rather than field by field. That is not only
122
+ * tidier: `n.language !== m.language` reads to the boundary lint as branching on
123
+ * a language, and the lint is right to be suspicious — the exception here is
124
+ * that this asks whether two nodes *disagree*, never which language either one
125
+ * is. Folding both fields into a fingerprint states that intent in the code
126
+ * rather than in a lint suppression.
127
+ */
128
+ export function identityFingerprint(node) {
129
+ return JSON.stringify([node.type, node.language]);
130
+ }
131
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/graph/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAWH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,QAAmB,EAAE,QAAmB;IACrE,IAAI,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACnD,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACnD,CAAC;IACD,OAAO,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;CAMnC,CAAC;AAEF,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;CAGnC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAuD,EACvD,GAAG,SAAmB;IAEtB,MAAM,KAAK,GAAG,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AAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;SACxF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Writing a built graph back out, split by producer.
3
+ *
4
+ * `buildGraph` merges many producers into one graph; `writeBatch` invalidates
5
+ * and writes **one producer's** rows at a time, because DEC-014's invalidation
6
+ * rule is per-adapter — re-running the Python adapter must not evict the
7
+ * TypeScript adapter's rows. So the merged graph has to be partitioned back
8
+ * before it can be stored.
9
+ *
10
+ * That partition was written out by hand in every bench script that has ever
11
+ * stored a graph, identically, five times. It is not a measurement concern: it
12
+ * is the engine's own write path, and the MCP server needs it too. Lifted here
13
+ * so there is one copy and one place for it to be wrong.
14
+ *
15
+ * ## The subtlety worth stating
16
+ *
17
+ * The rows written for a producer are the **post-merge** ones, not the batch's
18
+ * originals. A node supplied by two adapters is merged (DEC-012) and the merged
19
+ * row carries the winning `producedBy`; writing the pre-merge originals would
20
+ * store the losing version under the loser's producer and then let the next
21
+ * incremental run resurrect it. Filtering the merged graph by `producedBy` is
22
+ * what makes the store agree with the builder.
23
+ *
24
+ * A batch that contributed nothing after the merge is still written, with empty
25
+ * rows, on purpose: that is how a re-run that *removes* a symbol evicts the row
26
+ * it used to own. Skipping empty batches would make deletions invisible.
27
+ */
28
+ import type { IRBatch } from "@descryy/ir";
29
+ import type { SqlDriver } from "../store/driver/driver.ts";
30
+ import { type WriteOptions, type WriteResult } from "../store/writer.ts";
31
+ import type { BuildResult } from "./build.ts";
32
+ export interface PersistResult {
33
+ readonly writes: readonly WriteResult[];
34
+ readonly nodesWritten: number;
35
+ readonly edgesWritten: number;
36
+ readonly unresolvedWritten: number;
37
+ /** Union of every write's evictions — files a replaced run covered and this one did not. */
38
+ readonly evictedFiles: readonly string[];
39
+ readonly orphanedEdges: number;
40
+ }
41
+ export declare function persistGraph(driver: SqlDriver, batches: readonly IRBatch[], built: BuildResult, options?: WriteOptions): PersistResult;
42
+ //# sourceMappingURL=persist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../src/graph/persist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAc,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,SAAS,OAAO,EAAE,EAC3B,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,YAAiB,GACzB,aAAa,CA6Bf"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Writing a built graph back out, split by producer.
3
+ *
4
+ * `buildGraph` merges many producers into one graph; `writeBatch` invalidates
5
+ * and writes **one producer's** rows at a time, because DEC-014's invalidation
6
+ * rule is per-adapter — re-running the Python adapter must not evict the
7
+ * TypeScript adapter's rows. So the merged graph has to be partitioned back
8
+ * before it can be stored.
9
+ *
10
+ * That partition was written out by hand in every bench script that has ever
11
+ * stored a graph, identically, five times. It is not a measurement concern: it
12
+ * is the engine's own write path, and the MCP server needs it too. Lifted here
13
+ * so there is one copy and one place for it to be wrong.
14
+ *
15
+ * ## The subtlety worth stating
16
+ *
17
+ * The rows written for a producer are the **post-merge** ones, not the batch's
18
+ * originals. A node supplied by two adapters is merged (DEC-012) and the merged
19
+ * row carries the winning `producedBy`; writing the pre-merge originals would
20
+ * store the losing version under the loser's producer and then let the next
21
+ * incremental run resurrect it. Filtering the merged graph by `producedBy` is
22
+ * what makes the store agree with the builder.
23
+ *
24
+ * A batch that contributed nothing after the merge is still written, with empty
25
+ * rows, on purpose: that is how a re-run that *removes* a symbol evicts the row
26
+ * it used to own. Skipping empty batches would make deletions invisible.
27
+ */
28
+ import { writeBatch } from "../store/writer.js";
29
+ export function persistGraph(driver, batches, built, options = {}) {
30
+ const writes = [];
31
+ const evicted = new Set();
32
+ for (const batch of batches) {
33
+ writes.push(writeBatch(driver, {
34
+ ...batch,
35
+ nodes: built.nodes.filter((node) => node.producedBy === batch.producedBy),
36
+ edges: built.edges.filter((edge) => edge.producedBy === batch.producedBy),
37
+ unresolved: built.unresolved.filter((ref) => ref.producedBy === batch.producedBy),
38
+ }, options));
39
+ }
40
+ for (const write of writes)
41
+ for (const file of write.evictedFiles)
42
+ evicted.add(file);
43
+ return {
44
+ writes,
45
+ nodesWritten: writes.reduce((n, w) => n + w.nodesWritten, 0),
46
+ edgesWritten: writes.reduce((n, w) => n + w.edgesWritten, 0),
47
+ unresolvedWritten: writes.reduce((n, w) => n + w.unresolvedWritten, 0),
48
+ evictedFiles: [...evicted].sort(),
49
+ orphanedEdges: writes.reduce((n, w) => n + w.orphanedEdges, 0),
50
+ };
51
+ }
52
+ //# sourceMappingURL=persist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persist.js","sourceRoot":"","sources":["../../src/graph/persist.ts"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,YAAY,EAAE,CAAC,CAAC;QAC5D,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACtE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE;QACjC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;KAC/D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Runtime confirmation — architecture §11B.3, the R4 half of the moat.
3
+ *
4
+ * > *"A purely static code-graph tool is capped at R3 permanently. It has no
5
+ * > runtime. This is the one accuracy source that cannot be copied without
6
+ * > also building the testing half, and it should be treated as the core
7
+ * > technical moat rather than the graph itself."* — §11B.3
8
+ *
9
+ * The schema has held `observed_edges` and `edge_corrections` since the store
10
+ * was first written, both on the EARNED side of DEC-017's partition, both
11
+ * carrying a comment explaining why they cannot be recomputed. **Nothing read
12
+ * or wrote either one.** This module is what they were for.
13
+ *
14
+ * ## The three arrows §11B.3 draws, and where each one lands
15
+ *
16
+ * | Observation | What happens |
17
+ * | --- | --- |
18
+ * | confirms an edge the graph already has, below R4 | **promote** to R4, `observed_by_run` set |
19
+ * | confirms an edge the graph does not have | **create** it at R4 — "recall gap closed" |
20
+ * | denies an edge the graph has, below R4 | **correct** it: an `edge_corrections` row, and a {@link GraphDefectRecord} out |
21
+ *
22
+ * ## Why a denial demotes confidence and does not delete the edge
23
+ *
24
+ * `edges` is DERIVED. Deleting a row there is undone by the next index, which
25
+ * regenerates the identical guess from the identical source and has no memory
26
+ * of the run that disproved it — the correction would evaporate exactly when
27
+ * it was needed again. §11B.5 already states the answer: corrections are
28
+ * *"stored as graph overrides keyed by stable node IDs, surviving re-index and
29
+ * adapter upgrades."* So the durable statement is the `edge_corrections` row,
30
+ * and the effect on the derived graph is a confidence demotion that
31
+ * {@link reapplyEarnedOverlays} re-applies after every rebuild.
32
+ *
33
+ * Demotion rather than deletion is also DEC-284's own stated direction — *"it
34
+ * fails toward demote, which is the safe direction"* — and it keeps rule 2
35
+ * intact from the other side: a wrong edge stops being load-bearing without
36
+ * the graph asserting a *new* fact (that the call does not exist) that no
37
+ * single observation actually establishes.
38
+ *
39
+ * ## What this module refuses to do
40
+ *
41
+ * - **Invent a node.** An observation naming a node this graph does not hold
42
+ * is refused with its reason, never created. Rule 2, and the same posture
43
+ * `correlateExecution` takes one layer down for an ambiguous resolution.
44
+ * - **Adjudicate R4 against R4.** A denial against an edge already at R4 is
45
+ * two runtime observations disagreeing across time — a staleness question
46
+ * whose policy is decided (DEC-284 + a 7-day backstop) but whose consumer
47
+ * does not exist yet. `contradiction.ts` excludes the case by construction
48
+ * and this module reports it as {@link RuntimeConfirmationResult.staleR4}
49
+ * rather than laundering it through a path that looks decided.
50
+ * - **Judge a finding.** Resolution has no opinion on confidence (RT-027).
51
+ * Nothing here reads or writes a finding, a hypothesis or a category.
52
+ *
53
+ * @see `packages/ir/src/contradiction.ts` — the pure detection this persists.
54
+ * @see `documents/plans/ai-layer-plan.md` §10 — *"the valuable half."*
55
+ */
56
+ import { type EdgeType, type GraphDefectRecord, type RuntimeEdgeObservation } from "@descryy/ir";
57
+ import type { SqlDriver } from "../store/driver/driver.ts";
58
+ /** One observation this pass declined to act on, with the resolver's own reason. */
59
+ export interface RuntimeObservationRefusal {
60
+ readonly from: string;
61
+ readonly to: string;
62
+ readonly edgeType: EdgeType;
63
+ readonly reason: string;
64
+ }
65
+ /** A denial aimed at an edge already at R4 — out of scope here. See the module doc. */
66
+ export interface StaleR4Observation {
67
+ readonly edgeId: string;
68
+ readonly observedByRun: string | null;
69
+ readonly detail: string;
70
+ }
71
+ export interface RuntimeConfirmationInput {
72
+ /** The run that witnessed these observations. Becomes `edges.observed_by_run` and `observed_edges.run_id`. */
73
+ readonly runId: string;
74
+ /** The commit the observed application was built from. Stored so a later reader can tell whether the code has moved under the observation. */
75
+ readonly commitSha: string;
76
+ readonly observations: readonly RuntimeEdgeObservation[];
77
+ }
78
+ export interface RuntimeConfirmationResult {
79
+ /** Edge ids that moved from below R4 up to R4. */
80
+ readonly promoted: readonly string[];
81
+ /** Edge ids created at R4 because no static producer found them. */
82
+ readonly created: readonly string[];
83
+ /** Edge ids already at R4 and observed again — reported, never silently dropped. */
84
+ readonly confirmed: readonly string[];
85
+ /** Denials of a sub-R4 edge, shaped for the independent edge-precision check. */
86
+ readonly contradictions: readonly GraphDefectRecord[];
87
+ readonly staleR4: readonly StaleR4Observation[];
88
+ readonly refused: readonly RuntimeObservationRefusal[];
89
+ }
90
+ /** One row of the EARNED R4 ledger. */
91
+ export interface ObservedEdgeRow {
92
+ readonly edgeId: string;
93
+ readonly runId: string;
94
+ readonly from: string;
95
+ readonly to: string;
96
+ readonly edgeType: EdgeType;
97
+ readonly commitSha: string;
98
+ readonly observedAt: number;
99
+ }
100
+ /** One row of the EARNED correction ledger (§11B.5). */
101
+ export interface EdgeCorrectionRow {
102
+ readonly edgeId: string;
103
+ readonly verdict: "wrong" | "right";
104
+ readonly reason: string;
105
+ readonly correctedAt: number;
106
+ }
107
+ /**
108
+ * A clock, injected so a test can pin `observed_at`/`corrected_at`. Same shape
109
+ * the store's own tests already use.
110
+ */
111
+ export interface Clock {
112
+ now(): number;
113
+ }
114
+ /**
115
+ * Apply a run's edge observations to the graph, writing the earned record and
116
+ * projecting it onto the derived edges in one transaction.
117
+ *
118
+ * Pure with respect to its inputs and total over them: every observation lands
119
+ * in exactly one of the six result arrays, so a caller can account for all of
120
+ * them without inspecting the store. Never throws for an observation it cannot
121
+ * act on — that is a refusal, per the five-result-states rule the tool contract
122
+ * applies one layer up.
123
+ */
124
+ export declare function applyRuntimeObservations(driver: SqlDriver, input: RuntimeConfirmationInput, clock?: Clock): RuntimeConfirmationResult;
125
+ /**
126
+ * Re-project the EARNED ledgers onto a freshly rebuilt derived graph.
127
+ *
128
+ * **This is what makes the DEC-017 partition pay.** `dropDerived()` removes
129
+ * `edges` and leaves `observed_edges`/`edge_corrections` standing; a re-index
130
+ * then regenerates the same static guesses, at their static resolutions, with
131
+ * no memory of any run. Without this call the moat is silently reset on every
132
+ * rebuild — the edges would be back at R2 and the R4 rows would sit in a table
133
+ * nothing consults, which is indistinguishable from never having observed
134
+ * anything.
135
+ *
136
+ * Observations whose endpoints no longer exist are reported as refusals rather
137
+ * than recreated: the code moved, and re-minting a node from an old run's
138
+ * record would be the same rule-2 violation one rebuild later.
139
+ */
140
+ export declare function reapplyEarnedOverlays(driver: SqlDriver): RuntimeConfirmationResult;
141
+ /** Every row of the EARNED R4 ledger, oldest first, optionally for one run. */
142
+ export declare function observedEdges(driver: SqlDriver, options?: {
143
+ readonly runId?: string;
144
+ }): ObservedEdgeRow[];
145
+ /** Every row of the EARNED correction ledger (§11B.5), oldest first. */
146
+ export declare function edgeCorrections(driver: SqlDriver): EdgeCorrectionRow[];
147
+ /**
148
+ * Record a human's verdict on an edge — §11B.5's other producer.
149
+ *
150
+ * *"On one team's codebase, a few hundred corrections buy more accuracy than a
151
+ * quarter of parser work."* Same table the runtime's own denials land in, on
152
+ * purpose: an edge is wrong or it is not, and who noticed does not change what
153
+ * the graph should do about it. The `reason` is the correction's provenance and
154
+ * is never summarised.
155
+ */
156
+ export declare function recordEdgeCorrection(driver: SqlDriver, input: {
157
+ readonly from: string;
158
+ readonly to: string;
159
+ readonly edgeType: EdgeType;
160
+ readonly verdict: "wrong" | "right";
161
+ readonly reason: string;
162
+ }, clock?: Clock): {
163
+ readonly edgeId: string;
164
+ };
165
+ /** The `producedBy` every runtime-minted edge carries. Provenance is load-bearing (§11A.5). */
166
+ export declare const RUNTIME_ADAPTER_ID = "runtime-confirmation";
167
+ export declare const RUNTIME_ADAPTER_VERSION = "1";
168
+ export declare const RUNTIME_PRODUCER = "runtime-confirmation@1";
169
+ //# sourceMapp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