@optimystic/db-core 0.13.5 → 0.14.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 (447) hide show
  1. package/dist/src/cluster/structs.d.ts +13 -0
  2. package/dist/src/cluster/structs.d.ts.map +1 -1
  3. package/dist/src/cohort-topic/addressing.d.ts +53 -0
  4. package/dist/src/cohort-topic/addressing.d.ts.map +1 -0
  5. package/dist/src/cohort-topic/addressing.js +95 -0
  6. package/dist/src/cohort-topic/addressing.js.map +1 -0
  7. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts +105 -0
  8. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts.map +1 -0
  9. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js +197 -0
  10. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js.map +1 -0
  11. package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts +50 -0
  12. package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts.map +1 -0
  13. package/dist/src/cohort-topic/antidos/bootstrap-evidence.js +62 -0
  14. package/dist/src/cohort-topic/antidos/bootstrap-evidence.js.map +1 -0
  15. package/dist/src/cohort-topic/antidos/index.d.ts +6 -0
  16. package/dist/src/cohort-topic/antidos/index.d.ts.map +1 -0
  17. package/dist/src/cohort-topic/antidos/index.js +6 -0
  18. package/dist/src/cohort-topic/antidos/index.js.map +1 -0
  19. package/dist/src/cohort-topic/antidos/rate-limiter.d.ts +95 -0
  20. package/dist/src/cohort-topic/antidos/rate-limiter.d.ts.map +1 -0
  21. package/dist/src/cohort-topic/antidos/rate-limiter.js +146 -0
  22. package/dist/src/cohort-topic/antidos/rate-limiter.js.map +1 -0
  23. package/dist/src/cohort-topic/antidos/replay-guard.d.ts +37 -0
  24. package/dist/src/cohort-topic/antidos/replay-guard.d.ts.map +1 -0
  25. package/dist/src/cohort-topic/antidos/replay-guard.js +78 -0
  26. package/dist/src/cohort-topic/antidos/replay-guard.js.map +1 -0
  27. package/dist/src/cohort-topic/antidos/topic-budget.d.ts +50 -0
  28. package/dist/src/cohort-topic/antidos/topic-budget.d.ts.map +1 -0
  29. package/dist/src/cohort-topic/antidos/topic-budget.js +95 -0
  30. package/dist/src/cohort-topic/antidos/topic-budget.js.map +1 -0
  31. package/dist/src/cohort-topic/antiflood/index.d.ts +3 -0
  32. package/dist/src/cohort-topic/antiflood/index.d.ts.map +1 -0
  33. package/dist/src/cohort-topic/antiflood/index.js +3 -0
  34. package/dist/src/cohort-topic/antiflood/index.js.map +1 -0
  35. package/dist/src/cohort-topic/antiflood/invariants.d.ts +70 -0
  36. package/dist/src/cohort-topic/antiflood/invariants.d.ts.map +1 -0
  37. package/dist/src/cohort-topic/antiflood/invariants.js +86 -0
  38. package/dist/src/cohort-topic/antiflood/invariants.js.map +1 -0
  39. package/dist/src/cohort-topic/antiflood/jitter.d.ts +65 -0
  40. package/dist/src/cohort-topic/antiflood/jitter.d.ts.map +1 -0
  41. package/dist/src/cohort-topic/antiflood/jitter.js +75 -0
  42. package/dist/src/cohort-topic/antiflood/jitter.js.map +1 -0
  43. package/dist/src/cohort-topic/coldstart.d.ts +117 -0
  44. package/dist/src/cohort-topic/coldstart.d.ts.map +1 -0
  45. package/dist/src/cohort-topic/coldstart.js +127 -0
  46. package/dist/src/cohort-topic/coldstart.js.map +1 -0
  47. package/dist/src/cohort-topic/dmax.d.ts +44 -0
  48. package/dist/src/cohort-topic/dmax.d.ts.map +1 -0
  49. package/dist/src/cohort-topic/dmax.js +70 -0
  50. package/dist/src/cohort-topic/dmax.js.map +1 -0
  51. package/dist/src/cohort-topic/gossip/bus.d.ts +85 -0
  52. package/dist/src/cohort-topic/gossip/bus.d.ts.map +1 -0
  53. package/dist/src/cohort-topic/gossip/bus.js +146 -0
  54. package/dist/src/cohort-topic/gossip/bus.js.map +1 -0
  55. package/dist/src/cohort-topic/gossip/index.d.ts +4 -0
  56. package/dist/src/cohort-topic/gossip/index.d.ts.map +1 -0
  57. package/dist/src/cohort-topic/gossip/index.js +4 -0
  58. package/dist/src/cohort-topic/gossip/index.js.map +1 -0
  59. package/dist/src/cohort-topic/gossip/records.d.ts +12 -0
  60. package/dist/src/cohort-topic/gossip/records.d.ts.map +1 -0
  61. package/dist/src/cohort-topic/gossip/records.js +41 -0
  62. package/dist/src/cohort-topic/gossip/records.js.map +1 -0
  63. package/dist/src/cohort-topic/gossip/view.d.ts +39 -0
  64. package/dist/src/cohort-topic/gossip/view.d.ts.map +1 -0
  65. package/dist/src/cohort-topic/gossip/view.js +30 -0
  66. package/dist/src/cohort-topic/gossip/view.js.map +1 -0
  67. package/dist/src/cohort-topic/index.d.ts +21 -0
  68. package/dist/src/cohort-topic/index.d.ts.map +1 -0
  69. package/dist/src/cohort-topic/index.js +21 -0
  70. package/dist/src/cohort-topic/index.js.map +1 -0
  71. package/dist/src/cohort-topic/load/barometer.d.ts +78 -0
  72. package/dist/src/cohort-topic/load/barometer.d.ts.map +1 -0
  73. package/dist/src/cohort-topic/load/barometer.js +93 -0
  74. package/dist/src/cohort-topic/load/barometer.js.map +1 -0
  75. package/dist/src/cohort-topic/load/index.d.ts +2 -0
  76. package/dist/src/cohort-topic/load/index.d.ts.map +1 -0
  77. package/dist/src/cohort-topic/load/index.js +2 -0
  78. package/dist/src/cohort-topic/load/index.js.map +1 -0
  79. package/dist/src/cohort-topic/member-engine.d.ts +134 -0
  80. package/dist/src/cohort-topic/member-engine.d.ts.map +1 -0
  81. package/dist/src/cohort-topic/member-engine.js +264 -0
  82. package/dist/src/cohort-topic/member-engine.js.map +1 -0
  83. package/dist/src/cohort-topic/membership/index.d.ts +4 -0
  84. package/dist/src/cohort-topic/membership/index.d.ts.map +1 -0
  85. package/dist/src/cohort-topic/membership/index.js +4 -0
  86. package/dist/src/cohort-topic/membership/index.js.map +1 -0
  87. package/dist/src/cohort-topic/membership/publisher.d.ts +82 -0
  88. package/dist/src/cohort-topic/membership/publisher.d.ts.map +1 -0
  89. package/dist/src/cohort-topic/membership/publisher.js +107 -0
  90. package/dist/src/cohort-topic/membership/publisher.js.map +1 -0
  91. package/dist/src/cohort-topic/membership/source.d.ts +31 -0
  92. package/dist/src/cohort-topic/membership/source.d.ts.map +1 -0
  93. package/dist/src/cohort-topic/membership/source.js +32 -0
  94. package/dist/src/cohort-topic/membership/source.js.map +1 -0
  95. package/dist/src/cohort-topic/membership/verifier.d.ts +96 -0
  96. package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -0
  97. package/dist/src/cohort-topic/membership/verifier.js +250 -0
  98. package/dist/src/cohort-topic/membership/verifier.js.map +1 -0
  99. package/dist/src/cohort-topic/ports.d.ts +149 -0
  100. package/dist/src/cohort-topic/ports.d.ts.map +1 -0
  101. package/dist/src/cohort-topic/ports.js +25 -0
  102. package/dist/src/cohort-topic/ports.js.map +1 -0
  103. package/dist/src/cohort-topic/promotion.d.ts +135 -0
  104. package/dist/src/cohort-topic/promotion.d.ts.map +1 -0
  105. package/dist/src/cohort-topic/promotion.js +269 -0
  106. package/dist/src/cohort-topic/promotion.js.map +1 -0
  107. package/dist/src/cohort-topic/registration/bytes.d.ts +16 -0
  108. package/dist/src/cohort-topic/registration/bytes.d.ts.map +1 -0
  109. package/dist/src/cohort-topic/registration/bytes.js +32 -0
  110. package/dist/src/cohort-topic/registration/bytes.js.map +1 -0
  111. package/dist/src/cohort-topic/registration/handoff.d.ts +69 -0
  112. package/dist/src/cohort-topic/registration/handoff.d.ts.map +1 -0
  113. package/dist/src/cohort-topic/registration/handoff.js +98 -0
  114. package/dist/src/cohort-topic/registration/handoff.js.map +1 -0
  115. package/dist/src/cohort-topic/registration/index.d.ts +7 -0
  116. package/dist/src/cohort-topic/registration/index.d.ts.map +1 -0
  117. package/dist/src/cohort-topic/registration/index.js +7 -0
  118. package/dist/src/cohort-topic/registration/index.js.map +1 -0
  119. package/dist/src/cohort-topic/registration/renewal.d.ts +115 -0
  120. package/dist/src/cohort-topic/registration/renewal.d.ts.map +1 -0
  121. package/dist/src/cohort-topic/registration/renewal.js +306 -0
  122. package/dist/src/cohort-topic/registration/renewal.js.map +1 -0
  123. package/dist/src/cohort-topic/registration/sharding.d.ts +31 -0
  124. package/dist/src/cohort-topic/registration/sharding.d.ts.map +1 -0
  125. package/dist/src/cohort-topic/registration/sharding.js +48 -0
  126. package/dist/src/cohort-topic/registration/sharding.js.map +1 -0
  127. package/dist/src/cohort-topic/registration/store.d.ts +13 -0
  128. package/dist/src/cohort-topic/registration/store.d.ts.map +1 -0
  129. package/dist/src/cohort-topic/registration/store.js +72 -0
  130. package/dist/src/cohort-topic/registration/store.js.map +1 -0
  131. package/dist/src/cohort-topic/registration/types.d.ts +71 -0
  132. package/dist/src/cohort-topic/registration/types.d.ts.map +1 -0
  133. package/dist/src/cohort-topic/registration/types.js +27 -0
  134. package/dist/src/cohort-topic/registration/types.js.map +1 -0
  135. package/dist/src/cohort-topic/ring-hash.d.ts +27 -0
  136. package/dist/src/cohort-topic/ring-hash.d.ts.map +1 -0
  137. package/dist/src/cohort-topic/ring-hash.js +45 -0
  138. package/dist/src/cohort-topic/ring-hash.js.map +1 -0
  139. package/dist/src/cohort-topic/service.d.ts +157 -0
  140. package/dist/src/cohort-topic/service.d.ts.map +1 -0
  141. package/dist/src/cohort-topic/service.js +237 -0
  142. package/dist/src/cohort-topic/service.js.map +1 -0
  143. package/dist/src/cohort-topic/sig/index.d.ts +3 -0
  144. package/dist/src/cohort-topic/sig/index.d.ts.map +1 -0
  145. package/dist/src/cohort-topic/sig/index.js +3 -0
  146. package/dist/src/cohort-topic/sig/index.js.map +1 -0
  147. package/dist/src/cohort-topic/sig/payloads.d.ts +25 -0
  148. package/dist/src/cohort-topic/sig/payloads.d.ts.map +1 -0
  149. package/dist/src/cohort-topic/sig/payloads.js +25 -0
  150. package/dist/src/cohort-topic/sig/payloads.js.map +1 -0
  151. package/dist/src/cohort-topic/sig/threshold.d.ts +33 -0
  152. package/dist/src/cohort-topic/sig/threshold.d.ts.map +1 -0
  153. package/dist/src/cohort-topic/sig/threshold.js +51 -0
  154. package/dist/src/cohort-topic/sig/threshold.js.map +1 -0
  155. package/dist/src/cohort-topic/tiers.d.ts +58 -0
  156. package/dist/src/cohort-topic/tiers.d.ts.map +1 -0
  157. package/dist/src/cohort-topic/tiers.js +49 -0
  158. package/dist/src/cohort-topic/tiers.js.map +1 -0
  159. package/dist/src/cohort-topic/traffic.d.ts +90 -0
  160. package/dist/src/cohort-topic/traffic.d.ts.map +1 -0
  161. package/dist/src/cohort-topic/traffic.js +146 -0
  162. package/dist/src/cohort-topic/traffic.js.map +1 -0
  163. package/dist/src/cohort-topic/walk.d.ts +123 -0
  164. package/dist/src/cohort-topic/walk.d.ts.map +1 -0
  165. package/dist/src/cohort-topic/walk.js +150 -0
  166. package/dist/src/cohort-topic/walk.js.map +1 -0
  167. package/dist/src/cohort-topic/willingness.d.ts +123 -0
  168. package/dist/src/cohort-topic/willingness.d.ts.map +1 -0
  169. package/dist/src/cohort-topic/willingness.js +143 -0
  170. package/dist/src/cohort-topic/willingness.js.map +1 -0
  171. package/dist/src/cohort-topic/wire/codec.d.ts +42 -0
  172. package/dist/src/cohort-topic/wire/codec.d.ts.map +1 -0
  173. package/dist/src/cohort-topic/wire/codec.js +163 -0
  174. package/dist/src/cohort-topic/wire/codec.js.map +1 -0
  175. package/dist/src/cohort-topic/wire/index.d.ts +6 -0
  176. package/dist/src/cohort-topic/wire/index.d.ts.map +1 -0
  177. package/dist/src/cohort-topic/wire/index.js +6 -0
  178. package/dist/src/cohort-topic/wire/index.js.map +1 -0
  179. package/dist/src/cohort-topic/wire/payloads.d.ts +38 -0
  180. package/dist/src/cohort-topic/wire/payloads.d.ts.map +1 -0
  181. package/dist/src/cohort-topic/wire/payloads.js +102 -0
  182. package/dist/src/cohort-topic/wire/payloads.js.map +1 -0
  183. package/dist/src/cohort-topic/wire/types.d.ts +304 -0
  184. package/dist/src/cohort-topic/wire/types.d.ts.map +1 -0
  185. package/dist/src/cohort-topic/wire/types.js +16 -0
  186. package/dist/src/cohort-topic/wire/types.js.map +1 -0
  187. package/dist/src/cohort-topic/wire/validate.d.ts +25 -0
  188. package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -0
  189. package/dist/src/cohort-topic/wire/validate.js +427 -0
  190. package/dist/src/cohort-topic/wire/validate.js.map +1 -0
  191. package/dist/src/collection/collection.d.ts +58 -1
  192. package/dist/src/collection/collection.d.ts.map +1 -1
  193. package/dist/src/collection/collection.js +76 -0
  194. package/dist/src/collection/collection.js.map +1 -1
  195. package/dist/src/collections/tree/tree.d.ts +58 -2
  196. package/dist/src/collections/tree/tree.d.ts.map +1 -1
  197. package/dist/src/collections/tree/tree.js +59 -2
  198. package/dist/src/collections/tree/tree.js.map +1 -1
  199. package/dist/src/index.d.ts +3 -0
  200. package/dist/src/index.d.ts.map +1 -1
  201. package/dist/src/index.js +3 -0
  202. package/dist/src/index.js.map +1 -1
  203. package/dist/src/log/log.d.ts +42 -4
  204. package/dist/src/log/log.d.ts.map +1 -1
  205. package/dist/src/log/log.js +71 -3
  206. package/dist/src/log/log.js.map +1 -1
  207. package/dist/src/log/struct.d.ts +122 -2
  208. package/dist/src/log/struct.d.ts.map +1 -1
  209. package/dist/src/log/struct.js.map +1 -1
  210. package/dist/src/matchmaking/capability-filter.d.ts +24 -0
  211. package/dist/src/matchmaking/capability-filter.d.ts.map +1 -0
  212. package/dist/src/matchmaking/capability-filter.js +37 -0
  213. package/dist/src/matchmaking/capability-filter.js.map +1 -0
  214. package/dist/src/matchmaking/config.d.ts +77 -0
  215. package/dist/src/matchmaking/config.d.ts.map +1 -0
  216. package/dist/src/matchmaking/config.js +69 -0
  217. package/dist/src/matchmaking/config.js.map +1 -0
  218. package/dist/src/matchmaking/index.d.ts +21 -0
  219. package/dist/src/matchmaking/index.d.ts.map +1 -0
  220. package/dist/src/matchmaking/index.js +21 -0
  221. package/dist/src/matchmaking/index.js.map +1 -0
  222. package/dist/src/matchmaking/multi-cohort-seeker.d.ts +133 -0
  223. package/dist/src/matchmaking/multi-cohort-seeker.d.ts.map +1 -0
  224. package/dist/src/matchmaking/multi-cohort-seeker.js +142 -0
  225. package/dist/src/matchmaking/multi-cohort-seeker.js.map +1 -0
  226. package/dist/src/matchmaking/provider.d.ts +70 -0
  227. package/dist/src/matchmaking/provider.d.ts.map +1 -0
  228. package/dist/src/matchmaking/provider.js +93 -0
  229. package/dist/src/matchmaking/provider.js.map +1 -0
  230. package/dist/src/matchmaking/query-eval.d.ts +53 -0
  231. package/dist/src/matchmaking/query-eval.d.ts.map +1 -0
  232. package/dist/src/matchmaking/query-eval.js +69 -0
  233. package/dist/src/matchmaking/query-eval.js.map +1 -0
  234. package/dist/src/matchmaking/seeker-walk.d.ts +95 -0
  235. package/dist/src/matchmaking/seeker-walk.d.ts.map +1 -0
  236. package/dist/src/matchmaking/seeker-walk.js +75 -0
  237. package/dist/src/matchmaking/seeker-walk.js.map +1 -0
  238. package/dist/src/matchmaking/seeker.d.ts +51 -0
  239. package/dist/src/matchmaking/seeker.d.ts.map +1 -0
  240. package/dist/src/matchmaking/seeker.js +62 -0
  241. package/dist/src/matchmaking/seeker.js.map +1 -0
  242. package/dist/src/matchmaking/topic-anchor.d.ts +54 -0
  243. package/dist/src/matchmaking/topic-anchor.d.ts.map +1 -0
  244. package/dist/src/matchmaking/topic-anchor.js +67 -0
  245. package/dist/src/matchmaking/topic-anchor.js.map +1 -0
  246. package/dist/src/matchmaking/voting-quorum.d.ts +233 -0
  247. package/dist/src/matchmaking/voting-quorum.d.ts.map +1 -0
  248. package/dist/src/matchmaking/voting-quorum.js +238 -0
  249. package/dist/src/matchmaking/voting-quorum.js.map +1 -0
  250. package/dist/src/matchmaking/wire.d.ts +259 -0
  251. package/dist/src/matchmaking/wire.d.ts.map +1 -0
  252. package/dist/src/matchmaking/wire.js +484 -0
  253. package/dist/src/matchmaking/wire.js.map +1 -0
  254. package/dist/src/network/i-repo.d.ts +9 -0
  255. package/dist/src/network/i-repo.d.ts.map +1 -1
  256. package/dist/src/network/repo-protocol.d.ts +3 -1
  257. package/dist/src/network/repo-protocol.d.ts.map +1 -1
  258. package/dist/src/network/struct.d.ts +23 -1
  259. package/dist/src/network/struct.d.ts.map +1 -1
  260. package/dist/src/reactivity/backfill.d.ts +118 -0
  261. package/dist/src/reactivity/backfill.d.ts.map +1 -0
  262. package/dist/src/reactivity/backfill.js +137 -0
  263. package/dist/src/reactivity/backfill.js.map +1 -0
  264. package/dist/src/reactivity/backpressure.d.ts +99 -0
  265. package/dist/src/reactivity/backpressure.d.ts.map +1 -0
  266. package/dist/src/reactivity/backpressure.js +153 -0
  267. package/dist/src/reactivity/backpressure.js.map +1 -0
  268. package/dist/src/reactivity/checkpoint.d.ts +165 -0
  269. package/dist/src/reactivity/checkpoint.d.ts.map +1 -0
  270. package/dist/src/reactivity/checkpoint.js +232 -0
  271. package/dist/src/reactivity/checkpoint.js.map +1 -0
  272. package/dist/src/reactivity/config.d.ts +131 -0
  273. package/dist/src/reactivity/config.d.ts.map +1 -0
  274. package/dist/src/reactivity/config.js +135 -0
  275. package/dist/src/reactivity/config.js.map +1 -0
  276. package/dist/src/reactivity/dedupe.d.ts +51 -0
  277. package/dist/src/reactivity/dedupe.d.ts.map +1 -0
  278. package/dist/src/reactivity/dedupe.js +90 -0
  279. package/dist/src/reactivity/dedupe.js.map +1 -0
  280. package/dist/src/reactivity/forwarder.d.ts +50 -0
  281. package/dist/src/reactivity/forwarder.d.ts.map +1 -0
  282. package/dist/src/reactivity/forwarder.js +52 -0
  283. package/dist/src/reactivity/forwarder.js.map +1 -0
  284. package/dist/src/reactivity/index.d.ts +34 -0
  285. package/dist/src/reactivity/index.d.ts.map +1 -0
  286. package/dist/src/reactivity/index.js +34 -0
  287. package/dist/src/reactivity/index.js.map +1 -0
  288. package/dist/src/reactivity/notification.d.ts +72 -0
  289. package/dist/src/reactivity/notification.d.ts.map +1 -0
  290. package/dist/src/reactivity/notification.js +92 -0
  291. package/dist/src/reactivity/notification.js.map +1 -0
  292. package/dist/src/reactivity/policy.d.ts +59 -0
  293. package/dist/src/reactivity/policy.d.ts.map +1 -0
  294. package/dist/src/reactivity/policy.js +64 -0
  295. package/dist/src/reactivity/policy.js.map +1 -0
  296. package/dist/src/reactivity/push-state.d.ts +140 -0
  297. package/dist/src/reactivity/push-state.d.ts.map +1 -0
  298. package/dist/src/reactivity/push-state.js +270 -0
  299. package/dist/src/reactivity/push-state.js.map +1 -0
  300. package/dist/src/reactivity/recover.d.ts +75 -0
  301. package/dist/src/reactivity/recover.d.ts.map +1 -0
  302. package/dist/src/reactivity/recover.js +105 -0
  303. package/dist/src/reactivity/recover.js.map +1 -0
  304. package/dist/src/reactivity/replay-buffer.d.ts +57 -0
  305. package/dist/src/reactivity/replay-buffer.d.ts.map +1 -0
  306. package/dist/src/reactivity/replay-buffer.js +88 -0
  307. package/dist/src/reactivity/replay-buffer.js.map +1 -0
  308. package/dist/src/reactivity/resume.d.ts +214 -0
  309. package/dist/src/reactivity/resume.d.ts.map +1 -0
  310. package/dist/src/reactivity/resume.js +358 -0
  311. package/dist/src/reactivity/resume.js.map +1 -0
  312. package/dist/src/reactivity/rotation.d.ts +283 -0
  313. package/dist/src/reactivity/rotation.d.ts.map +1 -0
  314. package/dist/src/reactivity/rotation.js +265 -0
  315. package/dist/src/reactivity/rotation.js.map +1 -0
  316. package/dist/src/reactivity/subscriber.d.ts +66 -0
  317. package/dist/src/reactivity/subscriber.d.ts.map +1 -0
  318. package/dist/src/reactivity/subscriber.js +75 -0
  319. package/dist/src/reactivity/subscriber.js.map +1 -0
  320. package/dist/src/reactivity/subscription.d.ts +52 -0
  321. package/dist/src/reactivity/subscription.d.ts.map +1 -0
  322. package/dist/src/reactivity/subscription.js +28 -0
  323. package/dist/src/reactivity/subscription.js.map +1 -0
  324. package/dist/src/reactivity/topic-anchor.d.ts +46 -0
  325. package/dist/src/reactivity/topic-anchor.d.ts.map +1 -0
  326. package/dist/src/reactivity/topic-anchor.js +61 -0
  327. package/dist/src/reactivity/topic-anchor.js.map +1 -0
  328. package/dist/src/reactivity/verify.d.ts +41 -0
  329. package/dist/src/reactivity/verify.d.ts.map +1 -0
  330. package/dist/src/reactivity/verify.js +48 -0
  331. package/dist/src/reactivity/verify.js.map +1 -0
  332. package/dist/src/reactivity/wire-validate.d.ts +28 -0
  333. package/dist/src/reactivity/wire-validate.d.ts.map +1 -0
  334. package/dist/src/reactivity/wire-validate.js +79 -0
  335. package/dist/src/reactivity/wire-validate.js.map +1 -0
  336. package/dist/src/reactivity/wire.d.ts +102 -0
  337. package/dist/src/reactivity/wire.d.ts.map +1 -0
  338. package/dist/src/reactivity/wire.js +129 -0
  339. package/dist/src/reactivity/wire.js.map +1 -0
  340. package/dist/src/transaction/coordinator.d.ts +9 -5
  341. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  342. package/dist/src/transaction/coordinator.js +48 -25
  343. package/dist/src/transaction/coordinator.js.map +1 -1
  344. package/dist/src/transactor/change-notifier.d.ts +74 -0
  345. package/dist/src/transactor/change-notifier.d.ts.map +1 -0
  346. package/dist/src/transactor/change-notifier.js +4 -0
  347. package/dist/src/transactor/change-notifier.js.map +1 -0
  348. package/dist/src/transactor/index.d.ts +1 -0
  349. package/dist/src/transactor/index.d.ts.map +1 -1
  350. package/dist/src/transactor/index.js +1 -0
  351. package/dist/src/transactor/index.js.map +1 -1
  352. package/dist/src/transactor/network-transactor.d.ts +34 -2
  353. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  354. package/dist/src/transactor/network-transactor.js +113 -13
  355. package/dist/src/transactor/network-transactor.js.map +1 -1
  356. package/package.json +2 -2
  357. package/src/cluster/structs.ts +13 -0
  358. package/src/cohort-topic/addressing.ts +112 -0
  359. package/src/cohort-topic/antidos/bootstrap-evidence-envelope.ts +253 -0
  360. package/src/cohort-topic/antidos/bootstrap-evidence.ts +94 -0
  361. package/src/cohort-topic/antidos/index.ts +5 -0
  362. package/src/cohort-topic/antidos/rate-limiter.ts +210 -0
  363. package/src/cohort-topic/antidos/replay-guard.ts +109 -0
  364. package/src/cohort-topic/antidos/topic-budget.ts +145 -0
  365. package/src/cohort-topic/antiflood/index.ts +2 -0
  366. package/src/cohort-topic/antiflood/invariants.ts +108 -0
  367. package/src/cohort-topic/antiflood/jitter.ts +117 -0
  368. package/src/cohort-topic/coldstart.ts +204 -0
  369. package/src/cohort-topic/dmax.ts +88 -0
  370. package/src/cohort-topic/gossip/bus.ts +217 -0
  371. package/src/cohort-topic/gossip/index.ts +3 -0
  372. package/src/cohort-topic/gossip/records.ts +45 -0
  373. package/src/cohort-topic/gossip/view.ts +66 -0
  374. package/src/cohort-topic/index.ts +20 -0
  375. package/src/cohort-topic/load/barometer.ts +134 -0
  376. package/src/cohort-topic/load/index.ts +1 -0
  377. package/src/cohort-topic/member-engine.ts +409 -0
  378. package/src/cohort-topic/membership/index.ts +3 -0
  379. package/src/cohort-topic/membership/publisher.ts +171 -0
  380. package/src/cohort-topic/membership/source.ts +41 -0
  381. package/src/cohort-topic/membership/verifier.ts +345 -0
  382. package/src/cohort-topic/ports.ts +157 -0
  383. package/src/cohort-topic/promotion.ts +384 -0
  384. package/src/cohort-topic/registration/bytes.ts +37 -0
  385. package/src/cohort-topic/registration/handoff.ts +154 -0
  386. package/src/cohort-topic/registration/index.ts +6 -0
  387. package/src/cohort-topic/registration/renewal.ts +423 -0
  388. package/src/cohort-topic/registration/sharding.ts +61 -0
  389. package/src/cohort-topic/registration/store.ts +81 -0
  390. package/src/cohort-topic/registration/types.ts +76 -0
  391. package/src/cohort-topic/ring-hash.ts +50 -0
  392. package/src/cohort-topic/service.ts +390 -0
  393. package/src/cohort-topic/sig/index.ts +2 -0
  394. package/src/cohort-topic/sig/payloads.ts +39 -0
  395. package/src/cohort-topic/sig/threshold.ts +64 -0
  396. package/src/cohort-topic/tiers.ts +74 -0
  397. package/src/cohort-topic/traffic.ts +211 -0
  398. package/src/cohort-topic/walk.ts +255 -0
  399. package/src/cohort-topic/willingness.ts +237 -0
  400. package/src/cohort-topic/wire/codec.ts +204 -0
  401. package/src/cohort-topic/wire/index.ts +16 -0
  402. package/src/cohort-topic/wire/payloads.ts +117 -0
  403. package/src/cohort-topic/wire/types.ts +343 -0
  404. package/src/cohort-topic/wire/validate.ts +478 -0
  405. package/src/collection/collection.ts +93 -1
  406. package/src/collections/tree/tree.ts +84 -3
  407. package/src/index.ts +3 -0
  408. package/src/log/log.ts +86 -7
  409. package/src/log/struct.ts +126 -2
  410. package/src/matchmaking/capability-filter.ts +45 -0
  411. package/src/matchmaking/config.ts +98 -0
  412. package/src/matchmaking/index.ts +21 -0
  413. package/src/matchmaking/multi-cohort-seeker.ts +234 -0
  414. package/src/matchmaking/provider.ts +123 -0
  415. package/src/matchmaking/query-eval.ts +105 -0
  416. package/src/matchmaking/seeker-walk.ts +127 -0
  417. package/src/matchmaking/seeker.ts +86 -0
  418. package/src/matchmaking/topic-anchor.ts +90 -0
  419. package/src/matchmaking/voting-quorum.ts +394 -0
  420. package/src/matchmaking/wire.ts +680 -0
  421. package/src/network/i-repo.ts +9 -0
  422. package/src/network/repo-protocol.ts +3 -2
  423. package/src/network/struct.ts +24 -1
  424. package/src/reactivity/backfill.ts +220 -0
  425. package/src/reactivity/backpressure.ts +191 -0
  426. package/src/reactivity/checkpoint.ts +308 -0
  427. package/src/reactivity/config.ts +172 -0
  428. package/src/reactivity/dedupe.ts +132 -0
  429. package/src/reactivity/forwarder.ts +87 -0
  430. package/src/reactivity/index.ts +34 -0
  431. package/src/reactivity/notification.ts +123 -0
  432. package/src/reactivity/policy.ts +79 -0
  433. package/src/reactivity/push-state.ts +343 -0
  434. package/src/reactivity/recover.ts +153 -0
  435. package/src/reactivity/replay-buffer.ts +141 -0
  436. package/src/reactivity/resume.ts +549 -0
  437. package/src/reactivity/rotation.ts +415 -0
  438. package/src/reactivity/subscriber.ts +132 -0
  439. package/src/reactivity/subscription.ts +66 -0
  440. package/src/reactivity/topic-anchor.ts +71 -0
  441. package/src/reactivity/verify.ts +73 -0
  442. package/src/reactivity/wire-validate.ts +87 -0
  443. package/src/reactivity/wire.ts +224 -0
  444. package/src/transaction/coordinator.ts +53 -27
  445. package/src/transactor/change-notifier.ts +80 -0
  446. package/src/transactor/index.ts +1 -0
  447. package/src/transactor/network-transactor.ts +133 -15
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeker-walk.js","sourceRoot":"","sources":["../../../src/matchmaking/seeker-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AA8BnF,iGAAiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,MAA4B;IAC9D,OAAO,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,iBAAiB,GAAG,CAAC,MAAM,CAAC,mBAAmB,GAAG,MAAM,CAAC,CAAC;AACjG,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,gBAAgB,CAAC,MAA4B,EAAE,GAAkB;IAChF,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IACnG,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAC/C,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,MAA4B,EAAE,GAAkB;IAChF,OAAO,MAAM,CAAC,SAAS,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,MAA4B,EAAE,GAAkB;IACtE,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,SAAS,IAAI,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAiBD,iEAAiE;AACjE,MAAM,UAAU,yBAAyB;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACpC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,KAA6B,EAAE,OAAe,EAAE,QAAgB;IAC5F,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,EAAE,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B,EAAE,UAAkB,2BAA2B;IAC7G,OAAO,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Matchmaking — seeker registration state (db-core, transport-agnostic).
3
+ *
4
+ * A {@link MatchmakingSeeker} owns the short-lived seeker state for one topic and builds the signed
5
+ * {@link SeekerAppPayloadV1} that the db-p2p `seeker-manager` registers at cohort-topic tier **T2**
6
+ * with a short TTL (`seeker_ttl`, default 10 s — `docs/matchmaking.md` §Seeker query). The seeker
7
+ * registers briefly so other seekers can find it (collective assembly) and the cohort sees active
8
+ * demand.
9
+ *
10
+ * This module holds *registration* state only. The `QueryV1` issuance and the hang-out-vs-continue
11
+ * decision live in the pure {@link import("./seeker-walk.js").decide} engine and the db-p2p
12
+ * `seeker-walk-client` that drives the walk; the capability filter is {@link import("./capability-filter.js").matchesFilter}.
13
+ *
14
+ * Crypto-free: signing is an injected callback, matching {@link MatchmakingProvider}.
15
+ */
16
+ import { type CapabilityFilter, type SeekerAppPayloadV1 } from "./wire.js";
17
+ /** Construction inputs for a {@link MatchmakingSeeker}. */
18
+ export interface MatchmakingSeekerOptions {
19
+ /** The matchmaking topic this seeker is querying. */
20
+ readonly topicId: Uint8Array;
21
+ /** Number of providers desired (integer `>= 1`). */
22
+ readonly wantCount: number;
23
+ /** Multiaddr or PeerId-based callback (collective-assembly use). */
24
+ readonly contactHint: string;
25
+ /** Optional capability filter (evaluated cohort-side in the next ticket; carried here). */
26
+ readonly filter?: CapabilityFilter;
27
+ /** Opt into arrival pushes; default false (poll path). Consumed by the next ticket. */
28
+ readonly pushOnArrival?: boolean;
29
+ /** Sign the canonical registration image; resolves the base64url signature. */
30
+ readonly sign: (payload: Uint8Array) => Promise<string>;
31
+ /** 16-byte registration correlation id (not signature-bound); default fresh CSPRNG bytes. */
32
+ readonly correlationId?: Uint8Array;
33
+ /** CSPRNG source (injectable for deterministic tests). Default `@noble/hashes` `randomBytes`. */
34
+ readonly randomBytes?: (n: number) => Uint8Array;
35
+ }
36
+ /** Live seeker state + signed-payload builder for one matchmaking topic (registration only). */
37
+ export declare class MatchmakingSeeker {
38
+ readonly topicId: Uint8Array;
39
+ readonly correlationId: Uint8Array;
40
+ private readonly wantCount;
41
+ private readonly contactHint;
42
+ private readonly filter?;
43
+ private readonly pushOnArrival?;
44
+ private readonly sign;
45
+ constructor(options: MatchmakingSeekerOptions);
46
+ /** Build the signed {@link SeekerAppPayloadV1} for this seeker's registration. */
47
+ buildAppPayload(): Promise<SeekerAppPayloadV1>;
48
+ /** Build the opaque bytes for the cohort-topic `RegisterV1.appPayload` slot. */
49
+ appPayloadBytes(): Promise<Uint8Array>;
50
+ }
51
+ //# sourceMappingURL=seeker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeker.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/seeker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAwB,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAA0B,MAAM,WAAW,CAAC;AAEzH,2DAA2D;AAC3D,MAAM,WAAW,wBAAwB;IACxC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACnC,uFAAuF;IACvF,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6FAA6F;IAC7F,QAAQ,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC;IACpC,iGAAiG;IACjG,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;CACjD;AAED,gGAAgG;AAChG,qBAAa,iBAAiB;IAC7B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2C;gBAEpD,OAAO,EAAE,wBAAwB;IAc7C,kFAAkF;IAC5E,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAiBpD,gFAAgF;IAC1E,eAAe,IAAI,OAAO,CAAC,UAAU,CAAC;CAG5C"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Matchmaking — seeker registration state (db-core, transport-agnostic).
3
+ *
4
+ * A {@link MatchmakingSeeker} owns the short-lived seeker state for one topic and builds the signed
5
+ * {@link SeekerAppPayloadV1} that the db-p2p `seeker-manager` registers at cohort-topic tier **T2**
6
+ * with a short TTL (`seeker_ttl`, default 10 s — `docs/matchmaking.md` §Seeker query). The seeker
7
+ * registers briefly so other seekers can find it (collective assembly) and the cohort sees active
8
+ * demand.
9
+ *
10
+ * This module holds *registration* state only. The `QueryV1` issuance and the hang-out-vs-continue
11
+ * decision live in the pure {@link import("./seeker-walk.js").decide} engine and the db-p2p
12
+ * `seeker-walk-client` that drives the walk; the capability filter is {@link import("./capability-filter.js").matchesFilter}.
13
+ *
14
+ * Crypto-free: signing is an injected callback, matching {@link MatchmakingProvider}.
15
+ */
16
+ import { randomBytes } from "@noble/hashes/utils.js";
17
+ import { seekerSigningPayload, encodeSeekerAppPayload } from "./wire.js";
18
+ /** Live seeker state + signed-payload builder for one matchmaking topic (registration only). */
19
+ export class MatchmakingSeeker {
20
+ topicId;
21
+ correlationId;
22
+ wantCount;
23
+ contactHint;
24
+ filter;
25
+ pushOnArrival;
26
+ sign;
27
+ constructor(options) {
28
+ if (!Number.isInteger(options.wantCount) || options.wantCount < 1) {
29
+ throw new RangeError(`matchmaking seeker: wantCount must be an integer >= 1, got ${options.wantCount}`);
30
+ }
31
+ this.topicId = options.topicId;
32
+ this.wantCount = options.wantCount;
33
+ this.contactHint = options.contactHint;
34
+ this.filter = options.filter;
35
+ this.pushOnArrival = options.pushOnArrival;
36
+ this.sign = options.sign;
37
+ const rand = options.randomBytes ?? randomBytes;
38
+ this.correlationId = options.correlationId ?? rand(16);
39
+ }
40
+ /** Build the signed {@link SeekerAppPayloadV1} for this seeker's registration. */
41
+ async buildAppPayload() {
42
+ const signature = await this.sign(seekerSigningPayload(this.topicId, this.wantCount));
43
+ const payload = {
44
+ kind: "match-seeker",
45
+ wantCount: this.wantCount,
46
+ contactHint: this.contactHint,
47
+ signature,
48
+ };
49
+ if (this.filter !== undefined) {
50
+ payload.filter = this.filter;
51
+ }
52
+ if (this.pushOnArrival !== undefined) {
53
+ payload.pushOnArrival = this.pushOnArrival;
54
+ }
55
+ return payload;
56
+ }
57
+ /** Build the opaque bytes for the cohort-topic `RegisterV1.appPayload` slot. */
58
+ async appPayloadBytes() {
59
+ return encodeSeekerAppPayload(await this.buildAppPayload());
60
+ }
61
+ }
62
+ //# sourceMappingURL=seeker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeker.js","sourceRoot":"","sources":["../../../src/matchmaking/seeker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAkD,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAsBzH,gGAAgG;AAChG,MAAM,OAAO,iBAAiB;IACpB,OAAO,CAAa;IACpB,aAAa,CAAa;IAClB,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,MAAM,CAAoB;IAC1B,aAAa,CAAW;IACxB,IAAI,CAA2C;IAEhE,YAAY,OAAiC;QAC5C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,UAAU,CAAC,8DAA8D,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC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
+ * ```
7
+ * topicId(kind, label) = H(kind ‖ label ‖ "match")
8
+ * ```
9
+ *
10
+ * Unlike reactivity, matchmaking topics do **not** rotate — a task or capability label has a stable
11
+ * identity over its useful lifetime, so the anchor is a pure function of `(kind, label)`.
12
+ *
13
+ * `kind` namespaces the topic so unrelated label spaces never collide; `label` is application-defined
14
+ * (capability name, proposal hash, task-type id). The resulting `topicId` is fed verbatim into
15
+ * cohort-topic tier addressing (`coord_d(self, topicId)`), so it is derived with the **same** hash
16
+ * primitive cohort-topic uses for `coord_d` input — db-core's own {@link IRingHash} (SHA-256 truncated
17
+ * to the ring width), **not** a FRET import. At the default `ringBits = 256` the anchor is a 32-byte
18
+ * value, matching the cohort-topic `topicId` width.
19
+ *
20
+ * Concatenation is delimiter-free, exactly as the spec writes it. This is unambiguous because `kind`
21
+ * is drawn from a closed set ({@link MATCH_TOPIC_KINDS}) in which no member is a prefix of another, so
22
+ * `kind ‖ label` can never alias a different `(kind, label)` pair. The trailing `"match"` literal
23
+ * domain-separates matchmaking anchors from any other application that might hash the same label.
24
+ */
25
+ import type { IRingHash } from "../cohort-topic/ports.js";
26
+ /**
27
+ * The category of a matchmaking topic. Namespaces the `label` space so unrelated topics never
28
+ * collide on the ring (`docs/matchmaking.md` §Anchor).
29
+ *
30
+ * - `task` — a work-task type id; long-lived, matures a deep tree.
31
+ * - `capability` — a capability name (storage class, region, hardware feature); long-lived.
32
+ * - `quorum` — a voting-proposal hash; short-lived, forms a shallow tree that demotes once closed.
33
+ * - `capacity-class` — a capacity bucket for capacity gossip.
34
+ */
35
+ export type MatchTopicKind = "task" | "capability" | "quorum" | "capacity-class";
36
+ /** Every matchmaking topic kind. Validated against on the seeker/provider build path. */
37
+ export declare const MATCH_TOPIC_KINDS: readonly MatchTopicKind[];
38
+ /** Derives the stable `topicId` for a matchmaking `(kind, label)` pair. */
39
+ export interface MatchTopicAnchor {
40
+ /** `H(kind ‖ label ‖ "match")` — the cohort-topic `topicId` for this matchmaking topic. */
41
+ topicId(kind: MatchTopicKind, label: string): Uint8Array;
42
+ }
43
+ /** True iff `kind` is one of the closed {@link MATCH_TOPIC_KINDS}. */
44
+ export declare function isMatchTopicKind(kind: string): kind is MatchTopicKind;
45
+ /**
46
+ * Build a {@link MatchTopicAnchor} over the injected hash. db-p2p passes the same {@link IRingHash}
47
+ * instance it binds to FRET's `RING_BITS`, so the anchor and cohort-topic routing keys line up; the
48
+ * default constructs db-core's own {@link createRingHash} (256-bit SHA-256), which is byte-identical
49
+ * to what the cohort-topic host uses.
50
+ */
51
+ export declare function createMatchTopicAnchor(hash?: IRingHash): MatchTopicAnchor;
52
+ /** One-shot convenience: `H(kind ‖ label ‖ "match")` over the default db-core ring hash. */
53
+ export declare function matchTopicId(kind: MatchTopicKind, label: string, hash?: IRingHash): Uint8Array;
54
+ //# sourceMappingURL=topic-anchor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topic-anchor.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/topic-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAEjF,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAAuD,CAAC;AAO/G,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAChC,2FAA2F;IAC3F,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC;CACzD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,cAAc,CAErE;AAoBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,SAA4B,GAAG,gBAAgB,CAE3F;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,SAA4B,GAAG,UAAU,CAEhH"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Matchmaking — stable topic anchor.
3
+ *
4
+ * Transcribed from `docs/matchmaking.md` §Anchor:
5
+ *
6
+ * ```
7
+ * topicId(kind, label) = H(kind ‖ label ‖ "match")
8
+ * ```
9
+ *
10
+ * Unlike reactivity, matchmaking topics do **not** rotate — a task or capability label has a stable
11
+ * identity over its useful lifetime, so the anchor is a pure function of `(kind, label)`.
12
+ *
13
+ * `kind` namespaces the topic so unrelated label spaces never collide; `label` is application-defined
14
+ * (capability name, proposal hash, task-type id). The resulting `topicId` is fed verbatim into
15
+ * cohort-topic tier addressing (`coord_d(self, topicId)`), so it is derived with the **same** hash
16
+ * primitive cohort-topic uses for `coord_d` input — db-core's own {@link IRingHash} (SHA-256 truncated
17
+ * to the ring width), **not** a FRET import. At the default `ringBits = 256` the anchor is a 32-byte
18
+ * value, matching the cohort-topic `topicId` width.
19
+ *
20
+ * Concatenation is delimiter-free, exactly as the spec writes it. This is unambiguous because `kind`
21
+ * is drawn from a closed set ({@link MATCH_TOPIC_KINDS}) in which no member is a prefix of another, so
22
+ * `kind ‖ label` can never alias a different `(kind, label)` pair. The trailing `"match"` literal
23
+ * domain-separates matchmaking anchors from any other application that might hash the same label.
24
+ */
25
+ import { createRingHash } from "../cohort-topic/ring-hash.js";
26
+ /** Every matchmaking topic kind. Validated against on the seeker/provider build path. */
27
+ export const MATCH_TOPIC_KINDS = ["task", "capability", "quorum", "capacity-class"];
28
+ /** Domain-separation suffix mixed into every matchmaking anchor. */
29
+ const MATCH_SUFFIX = "match";
30
+ const utf8 = new TextEncoder();
31
+ /** True iff `kind` is one of the closed {@link MATCH_TOPIC_KINDS}. */
32
+ export function isMatchTopicKind(kind) {
33
+ return MATCH_TOPIC_KINDS.includes(kind);
34
+ }
35
+ class HashMatchTopicAnchor {
36
+ hash;
37
+ constructor(hash) {
38
+ this.hash = hash;
39
+ }
40
+ topicId(kind, label) {
41
+ if (!isMatchTopicKind(kind)) {
42
+ throw new RangeError(`matchmaking topicId: unknown kind ${JSON.stringify(kind)}`);
43
+ }
44
+ const kindBytes = utf8.encode(kind);
45
+ const labelBytes = utf8.encode(label);
46
+ const suffixBytes = utf8.encode(MATCH_SUFFIX);
47
+ const input = new Uint8Array(kindBytes.length + labelBytes.length + suffixBytes.length);
48
+ input.set(kindBytes, 0);
49
+ input.set(labelBytes, kindBytes.length);
50
+ input.set(suffixBytes, kindBytes.length + labelBytes.length);
51
+ return this.hash.H(input);
52
+ }
53
+ }
54
+ /**
55
+ * Build a {@link MatchTopicAnchor} over the injected hash. db-p2p passes the same {@link IRingHash}
56
+ * instance it binds to FRET's `RING_BITS`, so the anchor and cohort-topic routing keys line up; the
57
+ * default constructs db-core's own {@link createRingHash} (256-bit SHA-256), which is byte-identical
58
+ * to what the cohort-topic host uses.
59
+ */
60
+ export function createMatchTopicAnchor(hash = createRingHash()) {
61
+ return new HashMatchTopicAnchor(hash);
62
+ }
63
+ /** One-shot convenience: `H(kind ‖ label ‖ "match")` over the default db-core ring hash. */
64
+ export function matchTopicId(kind, label, hash = createRingHash()) {
65
+ return createMatchTopicAnchor(hash).topicId(kind, label);
66
+ }
67
+ //# sourceMappingURL=topic-anchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topic-anchor.js","sourceRoot":"","sources":["../../../src/matchmaking/topic-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAc9D,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAA8B,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAE/G,oEAAoE;AACpE,MAAM,YAAY,GAAG,OAAO,CAAC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ED,4FAA4F;AAC5F,MAAM,UAAU,YAAY,CAAC,IAAoB,EAAE,KAAa,EAAE,OAAkB,cAAc,EAAE;IACnG,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Matchmaking — voting-quorum assembler (db-core, discovery-only composition).
3
+ *
4
+ * The voting subsystem's **discovery** flow, built as a thin composition over the matchmaking module
5
+ * (`docs/matchmaking.md` §Voting-quorum assembly). Matchmaking already provides "find the peers": the
6
+ * stable {@link import("./topic-anchor.js").MatchTopicAnchor}, the signed provider registration
7
+ * ({@link MatchmakingProvider}), the single-cohort hang-out walk and the hot-topic multi-cohort sweep,
8
+ * and the reply-side per-entry `registrationSig` re-validation ({@link verifyProviderEntry}). This
9
+ * module adds the small amount of glue that turns that surface into "assemble a quorum of eligible
10
+ * voters for proposal `P`".
11
+ *
12
+ * **No matchmaking wire-protocol change is introduced.** The genuinely voting-layer pieces are injected
13
+ * or left out of scope entirely:
14
+ *
15
+ * - **Eligibility proof minting** — the caller mints an opaque proof (a signature over the proposal from
16
+ * a stake-bearing key, etc.) and supplies the {@link VotingQuorumRequest.verifyEligibility} predicate
17
+ * over it. Matchmaking treats the proof as opaque bytes carried in the provider's `capabilities`.
18
+ * - **The quorum selection rule** (random sample, stake-weighted, geographic) — injected via
19
+ * {@link VotingQuorumRequest.select}; the default is first-`targetSize`.
20
+ * - **Ballots, tally, dispute, ballot privacy** — out of scope; a separate forthcoming voting doc.
21
+ *
22
+ * ## Resolved design decisions (`docs/matchmaking.md` §Voting-quorum assembly)
23
+ *
24
+ * 1. **Reply-side per-entry verification is the default and required path; a client-side reputation
25
+ * pre-filter is optional and additive.** Quorum-assembly *liveness* must never depend on
26
+ * reputation-subsystem *availability*, so reputation is an optimization, never a dependency.
27
+ * Matchmaking forwards each entry's `registrationSig` plus the eligibility proof in `capabilities`,
28
+ * so reply-side verification is effectively free; the cohort returns ineligible entries the
29
+ * coordinator discards (bandwidth bounded by `query_limit_max × swept-cohort-count`).
30
+ * 2. **Flash-vote fairness among competing coordinators is a voting-layer concern; no matchmaking signal
31
+ * is added.** Matchmaking returns an advisory *candidate set*, never an allocation — overlapping sets
32
+ * are expected and quorum non-collision is decided by the voting protocol.
33
+ * 3. **No matchmaking protocol additions are needed.** `AggregateCountV1` is threshold-signed (an
34
+ * attested *registered*-provider count); an attested *eligible*-voter count, if voting needs one, is a
35
+ * voting-layer aggregate computed after discovery+verification, not a matchmaking message.
36
+ * 4. **Quorum-assembler delegation.** The seeker role may be held by the coordinator itself or by a
37
+ * delegated assembler peer; whoever holds it owns `patienceMs` and the reply-side re-validation duty.
38
+ * A delegated assembler returns an already-validated {@link ProviderEntryV1}`[]`; because every entry
39
+ * carries `registrationSig` + the proof in `capabilities`, the set is independently checkable, so the
40
+ * coordinator MAY re-validate (trust-but-verify) on receipt by re-running the verify→select pipeline.
41
+ *
42
+ * ## Architecture seam
43
+ *
44
+ * db-core is transport-free, so the actual discovery I/O (the register/query/renew walk, the root
45
+ * `AggregateCountV1` sweep) is **injected** as a {@link QuorumDiscovery} port — exactly as the seeker
46
+ * walk client and entry verifier are injected elsewhere in this module. db-p2p binds the port to
47
+ * `MatchmakingSeeker.walk` (single-cohort) and `multi-cohort-seeker` (sweep). The assembler itself never
48
+ * dials voters, never collects ballots, never tallies.
49
+ */
50
+ import { type MatchTopicAnchor } from "./topic-anchor.js";
51
+ import { type ProviderEntryV1, type EntrySigVerifier } from "./wire.js";
52
+ /** Default concurrent-vote-collection budget for a registered voter — accepts one vote-collection RPC. */
53
+ export declare const DEFAULT_VOTER_CAPACITY_BUDGET = 1;
54
+ /**
55
+ * Indicative `patienceMs` range for voting-quorum assembly (`docs/matchmaking.md` §Patience budgeting).
56
+ * Advisory only — the layer does not dictate; {@link VotingQuorumAssembler.assembleQuorum} requires a
57
+ * positive budget but does not clamp to this window.
58
+ */
59
+ export declare const VOTING_PATIENCE_MIN_MS = 30000;
60
+ export declare const VOTING_PATIENCE_MAX_MS = 300000;
61
+ /**
62
+ * Reserved capability-tag prefix carrying a voter's opaque eligibility proof. The proof is bound into the
63
+ * provider `capabilities`, which {@link import("./wire.js").providerSigningPayload} covers, so the
64
+ * provider's `registrationSig` attests the proof verbatim. The caller's `verifyEligibility` predicate
65
+ * reads it back from the forwarded entry via {@link eligibilityProofOf}.
66
+ */
67
+ export declare const ELIGIBILITY_TAG_PREFIX = "voter-eligibility:";
68
+ /** Encode an opaque eligibility proof as the reserved capability tag. */
69
+ export declare function eligibilityTag(proof: string): string;
70
+ /** Extract the eligibility proof from a capability set, or `undefined` if no eligibility tag is present. */
71
+ export declare function eligibilityProofFromCapabilities(capabilities: readonly string[]): string | undefined;
72
+ /** Extract the eligibility proof carried by a forwarded {@link ProviderEntryV1} (`undefined` if absent). */
73
+ export declare function eligibilityProofOf(entry: ProviderEntryV1): string | undefined;
74
+ /** One discovery slice: candidate entries plus the hotness signal that drives the single-vs-sweep choice. */
75
+ export interface QuorumDiscoverySlice {
76
+ /** Candidate provider entries returned by this discovery hop (advisory — the assembler re-verifies). */
77
+ readonly entries: readonly ProviderEntryV1[];
78
+ /**
79
+ * Max `topicTraffic.childCohortCount` observed across the walked tiers. `> 0` means the topic has
80
+ * promoted (it is hot), so a single-cohort sample is unrepresentative and the assembler escalates to
81
+ * the multi-cohort sweep. The sweep hop sets this to `0` (the decision is already made).
82
+ */
83
+ readonly childCohortCount: number;
84
+ }
85
+ /** Inputs to one discovery hop. */
86
+ export interface QuorumDiscoveryRequest {
87
+ /** The quorum topic id (`H("quorum" ‖ proposalHash ‖ "match")`). */
88
+ readonly topicId: Uint8Array;
89
+ /** Providers desired (drives the hang-out feasibility math / how many shards the sweep unions). */
90
+ readonly wantCount: number;
91
+ /** Patience budget remaining for this hop (ms); drains across walk → sweep. */
92
+ readonly patienceMs: number;
93
+ }
94
+ /**
95
+ * The discovery surface {@link VotingQuorumAssembler} composes over. db-p2p binds:
96
+ * - {@link QuorumDiscovery.walk} → `MatchmakingSeeker.walk` (single-cohort hang-out walk), and
97
+ * - {@link QuorumDiscovery.sweep} → `multi-cohort-seeker` (root `AggregateCountV1` → tier shards union).
98
+ *
99
+ * Both surface already-deduped, `registrationSig`-validated entries in production; the assembler treats
100
+ * them as advisory candidates and re-validates regardless, which keeps the delegated-assembler
101
+ * (trust-but-verify) path and the mock-tier test fixtures honest.
102
+ */
103
+ export interface QuorumDiscovery {
104
+ /** Single-cohort hang-out walk; returns matched candidates plus the observed hotness signal. */
105
+ walk(req: QuorumDiscoveryRequest): Promise<QuorumDiscoverySlice>;
106
+ /** Multi-cohort sweep across high-population tier shards; returns the unioned candidate slice. */
107
+ sweep(req: QuorumDiscoveryRequest): Promise<QuorumDiscoverySlice>;
108
+ }
109
+ /** A request to assemble a voting quorum for one proposal. All voting-layer policy is injected here. */
110
+ export interface VotingQuorumRequest {
111
+ /** The proposal hash — the quorum topic's label. */
112
+ readonly proposalHash: string;
113
+ /** Desired quorum size (integer `>= 1`). */
114
+ readonly targetSize: number;
115
+ /** Patience budget (ms); positive. Voting range is 30–300 s (§Patience budgeting), advisory. */
116
+ readonly patienceMs: number;
117
+ /** Voting/stake-layer eligibility predicate over the opaque proof in an entry's `capabilities`. */
118
+ readonly verifyEligibility: (entry: ProviderEntryV1) => boolean;
119
+ /** Voting-layer quorum selection rule; default = first `targetSize`. Must choose from the input set. */
120
+ readonly select?: (eligible: ProviderEntryV1[], targetSize: number) => ProviderEntryV1[];
121
+ /** Optional, additive reputation pre-filter applied *before* verification to trim candidates. */
122
+ readonly reputationPrefilter?: (candidates: ProviderEntryV1[]) => ProviderEntryV1[];
123
+ /** Force the multi-cohort sweep even when a single-cohort walk would suffice (representativeness). */
124
+ readonly preferSweep?: boolean;
125
+ }
126
+ /** The outcome of {@link VotingQuorumAssembler.assembleQuorum}. */
127
+ export interface VotingQuorumResult {
128
+ /** The selected, eligibility-verified quorum, deduped by `participantId`. */
129
+ readonly quorum: ProviderEntryV1[];
130
+ /** Distinct candidates discovery surfaced (after dedup, before eligibility filtering). */
131
+ readonly candidates: number;
132
+ /** Candidates that passed `registrationSig` re-validation **and** `verifyEligibility`. */
133
+ readonly eligible: number;
134
+ /** Whether the assembled quorum met `targetSize` (`quorum.length >= targetSize`). */
135
+ readonly metTarget: boolean;
136
+ /** Whether the multi-cohort sweep was used (hot topic or `preferSweep`). */
137
+ readonly swept: boolean;
138
+ }
139
+ /** Construction inputs for a {@link VotingQuorumAssembler}; deps are per-role and validated at call time. */
140
+ export interface VotingQuorumAssemblerDeps {
141
+ /** Stable topic anchor; defaults to db-core's ring-hash anchor ({@link createMatchTopicAnchor}). */
142
+ readonly anchor?: MatchTopicAnchor;
143
+ /** Discovery surface (walk + sweep) — required by {@link VotingQuorumAssembler.assembleQuorum}. */
144
+ readonly discovery?: QuorumDiscovery;
145
+ /**
146
+ * Per-entry `registrationSig` verifier (db-p2p binds `verifyPeerSig`) — required by
147
+ * {@link VotingQuorumAssembler.assembleQuorum}. db-core is crypto-free, so the peer-key check is
148
+ * injected, matching {@link verifyProviderEntry}'s contract.
149
+ */
150
+ readonly verifyEntrySig?: EntrySigVerifier;
151
+ /** Sign a provider registration image — required by {@link VotingQuorumAssembler.registerEligibleVoter}. */
152
+ readonly sign?: (payload: Uint8Array) => Promise<string>;
153
+ /**
154
+ * Register a signed voter-provider payload at the quorum topic (cohort-topic T2) — required by
155
+ * {@link VotingQuorumAssembler.registerEligibleVoter}. db-p2p binds this to the provider manager /
156
+ * `MatchmakingProvider.register` once `matchmaking-sweep-adversarial-module` lands.
157
+ */
158
+ readonly registerProvider?: (req: RegisterVoterProviderRequest) => Promise<void>;
159
+ /** CSPRNG source for the provider correlation id (injectable for deterministic tests). */
160
+ readonly randomBytes?: (n: number) => Uint8Array;
161
+ /** Wall clock (unix ms), injectable for tests; default `Date.now`. Splits patience across walk → sweep. */
162
+ readonly clock?: () => number;
163
+ }
164
+ /** What {@link VotingQuorumAssembler.registerEligibleVoter} hands the injected `registerProvider` port. */
165
+ export interface RegisterVoterProviderRequest {
166
+ /** The quorum topic id this voter registers at. */
167
+ readonly topicId: Uint8Array;
168
+ /** The opaque, signed cohort-topic `RegisterV1.appPayload` bytes for the voter provider. */
169
+ readonly appPayloadBytes: Uint8Array;
170
+ }
171
+ /** Construction inputs for {@link VotingQuorumAssembler.registerEligibleVoter}. */
172
+ export interface RegisterEligibleVoterRequest {
173
+ /** The proposal hash — the quorum topic's label. */
174
+ readonly proposalHash: string;
175
+ /** base64url, app-defined eligibility proof minted by the voting/stake layer. */
176
+ readonly eligibilityProof: string;
177
+ /** Extra application capability tags merged into the registration (the proof tag is always added). */
178
+ readonly capabilityTags?: readonly string[];
179
+ /** Concurrent vote-collection budget; default {@link DEFAULT_VOTER_CAPACITY_BUDGET} (1). */
180
+ readonly capacityBudget?: number;
181
+ /** Multiaddr or PeerId-based callback for the vote-collection dial. */
182
+ readonly contactHint: string;
183
+ /** Optional soft expiry hint (unix ms). */
184
+ readonly serviceUntil?: number;
185
+ }
186
+ /**
187
+ * Discovery-only voting-quorum assembler over the matchmaking module. One instance can act in either
188
+ * role: a voter calls {@link registerEligibleVoter}; a coordinator (or delegated assembler) calls
189
+ * {@link assembleQuorum}. Deps are role-specific and asserted per method, so a coordinator need not
190
+ * supply `sign`/`registerProvider` and a voter need not supply `discovery`/`verifyEntrySig`.
191
+ */
192
+ export declare class VotingQuorumAssembler {
193
+ private readonly anchor;
194
+ private readonly deps;
195
+ private readonly clock;
196
+ constructor(deps?: VotingQuorumAssemblerDeps);
197
+ /**
198
+ * The quorum topic anchor for a proposal: `kind = "quorum"`, `label = proposalHash`, yielding
199
+ * `topicId = H("quorum" ‖ proposalHash ‖ "match")` via the matchmaking topic anchor.
200
+ */
201
+ static quorumTopic(proposalHash: string): {
202
+ kind: "quorum";
203
+ label: string;
204
+ };
205
+ /** Resolve the cohort-topic `topicId` for a proposal's quorum topic. */
206
+ topicIdFor(proposalHash: string): Uint8Array;
207
+ /**
208
+ * Voter side: bind the caller-minted eligibility proof into `capabilities`, build the signed provider
209
+ * registration, and register it at the quorum topic (cohort-topic T2). The proof is opaque to
210
+ * matchmaking; the provider `signature` covers `(topicId, capabilities, capacityBudget)`, so it binds
211
+ * the proof to the registration.
212
+ */
213
+ registerEligibleVoter(req: RegisterEligibleVoterRequest): Promise<void>;
214
+ /**
215
+ * Coordinator / delegated-assembler side: discover → verify → select. Drives the single-cohort walk,
216
+ * escalates to the multi-cohort sweep on a hot topic (`childCohortCount > 0`) or when `preferSweep`,
217
+ * dedups by `participantId`, applies the optional reputation pre-filter, re-validates each entry's
218
+ * `registrationSig` **and** `verifyEligibility`, then applies the selection rule. Passes the *draining*
219
+ * patience budget to each discovery hop (walk, then sweep) — the deadline is fixed at entry and each
220
+ * hop receives the remaining slice — and on exhaustion returns whatever matched with `metTarget = false`.
221
+ * (Both legs honour `patienceMs`: the walk enforces a wall-clock deadline across hops and hang-out; the
222
+ * sweep stops starting new shard queries once the budget drains. The residual is at most one in-flight
223
+ * shard RPC — assembly never blocks materially past `patienceMs`.)
224
+ */
225
+ assembleQuorum(req: VotingQuorumRequest): Promise<VotingQuorumResult>;
226
+ private requireDiscovery;
227
+ private requireVerifyEntrySig;
228
+ private requireSign;
229
+ private requireRegisterProvider;
230
+ }
231
+ /** The default selection rule: take the first `targetSize` eligible entries (the discovery order). */
232
+ export declare function defaultSelect(eligible: ProviderEntryV1[], targetSize: number): ProviderEntryV1[];
233
+ //# sourceMappingURL=voting-quorum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voting-quorum.d.ts","sourceRoot":"","sources":["../../../src/matchmaking/voting-quorum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAuB,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,M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