@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,484 @@
1
+ /**
2
+ * Matchmaking — V1 wire types, codecs, and per-message validation.
3
+ *
4
+ * Transcribed from `docs/matchmaking.md` §Wire formats. Matchmaking reuses the cohort-topic
5
+ * `RegisterV1` / `RenewV1` envelopes **unchanged**; the matchmaking-specific shape lives in two
6
+ * places:
7
+ *
8
+ * 1. **App payloads** ({@link ProviderAppPayloadV1} / {@link SeekerAppPayloadV1}) carried opaquely
9
+ * inside `RegisterV1.appPayload`. These are serialized to UTF-8 JSON bytes and handed to the
10
+ * cohort-topic {@link import("../cohort-topic/service.js").RegisterRequest}`.appPayload` slot,
11
+ * which base64url-encodes them on the wire. They are therefore **not** length-framed here — the
12
+ * cohort-topic `RegisterV1` frame wraps them.
13
+ *
14
+ * 2. **Query-protocol messages** ({@link QueryV1} / {@link QueryReplyV1} / {@link AggregateCountV1})
15
+ * sent as standalone RPCs over the matchmaking application protocol. These ride the same
16
+ * length-prefixed UTF-8 JSON framing as cohort-topic messages ({@link encodeCohortMessage}).
17
+ *
18
+ * Conventions (matching the cohort-topic wire conventions): all JSON, byte fields base64url (no
19
+ * padding), unix-millisecond timestamps, per-message structural validation on decode. Byte fidelity
20
+ * round-trips (encode→decode→encode is stable). The query-protocol producers (cohort-side reply,
21
+ * root-cohort aggregate sweep) land in later tickets; their decoders live here so the seeker side can
22
+ * be unit-tested against fixtures.
23
+ */
24
+ import { bytesToB64url, b64urlToBytes, decodeCohortMessage, encodeCohortMessage, DEFAULT_MAX_MESSAGE_BYTES, } from "../cohort-topic/wire/codec.js";
25
+ import { CohortWireError } from "../cohort-topic/wire/validate.js";
26
+ import { QUERY_LIMIT_MAX } from "./config.js";
27
+ // --- validation helpers (mirror cohort-topic/wire/validate.ts; local to keep matchmaking DRY) ---
28
+ const utf8Encoder = new TextEncoder();
29
+ const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
30
+ /** Ceiling for an opaque app payload (provider/seeker), guarding decode allocation. */
31
+ export const DEFAULT_MAX_APP_PAYLOAD_BYTES = 64 * 1024;
32
+ function fail(message) {
33
+ throw new CohortWireError(message);
34
+ }
35
+ function asObject(value, what) {
36
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
37
+ fail(`${what}: expected an object`);
38
+ }
39
+ return value;
40
+ }
41
+ function requireV1(obj, what) {
42
+ if (obj["v"] !== 1) {
43
+ fail(`${what}: expected v === 1, got ${JSON.stringify(obj["v"])}`);
44
+ }
45
+ }
46
+ function reqString(obj, key, what) {
47
+ const value = obj[key];
48
+ if (typeof value !== "string") {
49
+ fail(`${what}: field "${key}" must be a string`);
50
+ }
51
+ return value;
52
+ }
53
+ function reqBool(obj, key, what) {
54
+ const value = obj[key];
55
+ if (typeof value !== "boolean") {
56
+ fail(`${what}: field "${key}" must be a boolean`);
57
+ }
58
+ return value;
59
+ }
60
+ function optBool(obj, key, what) {
61
+ const value = obj[key];
62
+ if (value === undefined) {
63
+ return undefined;
64
+ }
65
+ if (typeof value !== "boolean") {
66
+ fail(`${what}: field "${key}" must be a boolean when present`);
67
+ }
68
+ return value;
69
+ }
70
+ function reqFiniteNumber(obj, key, what) {
71
+ const value = obj[key];
72
+ if (typeof value !== "number" || !Number.isFinite(value)) {
73
+ fail(`${what}: field "${key}" must be a finite number`);
74
+ }
75
+ return value;
76
+ }
77
+ function optFiniteNumber(obj, key, what) {
78
+ const value = obj[key];
79
+ if (value === undefined) {
80
+ return undefined;
81
+ }
82
+ if (typeof value !== "number" || !Number.isFinite(value)) {
83
+ fail(`${what}: field "${key}" must be a finite number when present`);
84
+ }
85
+ return value;
86
+ }
87
+ function reqStringArray(obj, key, what) {
88
+ const value = obj[key];
89
+ if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) {
90
+ fail(`${what}: field "${key}" must be an array of strings`);
91
+ }
92
+ return value;
93
+ }
94
+ /** Assert a base64url string decodes cleanly; returns it unchanged. */
95
+ function b64urlField(value, key, what) {
96
+ try {
97
+ b64urlToBytes(value);
98
+ }
99
+ catch {
100
+ fail(`${what}: field "${key}" is not valid base64url`);
101
+ }
102
+ return value;
103
+ }
104
+ /** Require an integer `>= min` (and `<= max` when supplied). */
105
+ function reqIntInRange(value, key, what, min, max) {
106
+ if (!Number.isInteger(value) || value < min || (max !== undefined && value > max)) {
107
+ const bound = max === undefined ? `>= ${min}` : `in ${min}..${max}`;
108
+ fail(`${what}: field "${key}" must be an integer ${bound}, got ${value}`);
109
+ }
110
+ return value;
111
+ }
112
+ function validateCapabilityFilter(value, what) {
113
+ const obj = asObject(value, what);
114
+ const out = {
115
+ must: reqStringArray(obj, "must", what),
116
+ mustNot: reqStringArray(obj, "mustNot", what),
117
+ };
118
+ const minBudget = optFiniteNumber(obj, "minBudget", what);
119
+ if (minBudget !== undefined) {
120
+ out.minBudget = reqIntInRange(minBudget, "minBudget", what, 0);
121
+ }
122
+ return out;
123
+ }
124
+ // --- Provider / Seeker app payloads (opaque RegisterV1.appPayload bytes) ---
125
+ /** Narrow an already-parsed value to {@link ProviderAppPayloadV1}, throwing on any defect. */
126
+ export function validateProviderAppPayloadV1(value) {
127
+ const what = "ProviderAppPayloadV1";
128
+ const obj = asObject(value, what);
129
+ if (obj["kind"] !== "match-provider") {
130
+ fail(`${what}: field "kind" must be exactly "match-provider"`);
131
+ }
132
+ const out = {
133
+ kind: "match-provider",
134
+ capabilities: reqStringArray(obj, "capabilities", what),
135
+ capacityBudget: reqIntInRange(reqFiniteNumber(obj, "capacityBudget", what), "capacityBudget", what, 0),
136
+ contactHint: reqString(obj, "contactHint", what),
137
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
138
+ };
139
+ const serviceUntil = optFiniteNumber(obj, "serviceUntil", what);
140
+ if (serviceUntil !== undefined) {
141
+ out.serviceUntil = serviceUntil;
142
+ }
143
+ return out;
144
+ }
145
+ /** Narrow an already-parsed value to {@link SeekerAppPayloadV1}, throwing on any defect. */
146
+ export function validateSeekerAppPayloadV1(value) {
147
+ const what = "SeekerAppPayloadV1";
148
+ const obj = asObject(value, what);
149
+ if (obj["kind"] !== "match-seeker") {
150
+ fail(`${what}: field "kind" must be exactly "match-seeker"`);
151
+ }
152
+ const out = {
153
+ kind: "match-seeker",
154
+ wantCount: reqIntInRange(reqFiniteNumber(obj, "wantCount", what), "wantCount", what, 1),
155
+ contactHint: reqString(obj, "contactHint", what),
156
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
157
+ };
158
+ if (obj["filter"] !== undefined) {
159
+ out.filter = validateCapabilityFilter(obj["filter"], `${what}.filter`);
160
+ }
161
+ const pushOnArrival = optBool(obj, "pushOnArrival", what);
162
+ if (pushOnArrival !== undefined) {
163
+ out.pushOnArrival = pushOnArrival;
164
+ }
165
+ return out;
166
+ }
167
+ /** Serialize a {@link ProviderAppPayloadV1} to the opaque UTF-8 JSON bytes for `RegisterV1.appPayload`. */
168
+ export function encodeProviderAppPayload(payload) {
169
+ return utf8Encoder.encode(JSON.stringify(validateProviderAppPayloadV1(payload)));
170
+ }
171
+ /** Decode opaque `RegisterV1.appPayload` bytes back to a validated {@link ProviderAppPayloadV1}. */
172
+ export function decodeProviderAppPayload(bytes, maxBytes = DEFAULT_MAX_APP_PAYLOAD_BYTES) {
173
+ return validateProviderAppPayloadV1(parseJsonBytes(bytes, maxBytes, "ProviderAppPayloadV1"));
174
+ }
175
+ /** Serialize a {@link SeekerAppPayloadV1} to the opaque UTF-8 JSON bytes for `RegisterV1.appPayload`. */
176
+ export function encodeSeekerAppPayload(payload) {
177
+ return utf8Encoder.encode(JSON.stringify(validateSeekerAppPayloadV1(payload)));
178
+ }
179
+ /** Decode opaque `RegisterV1.appPayload` bytes back to a validated {@link SeekerAppPayloadV1}. */
180
+ export function decodeSeekerAppPayload(bytes, maxBytes = DEFAULT_MAX_APP_PAYLOAD_BYTES) {
181
+ return validateSeekerAppPayloadV1(parseJsonBytes(bytes, maxBytes, "SeekerAppPayloadV1"));
182
+ }
183
+ /**
184
+ * Decode an opaque `RegisterV1.appPayload` to whichever matchmaking payload it carries, dispatched on
185
+ * `kind` (parsed once — no exception-as-control-flow). The cohort query handler uses this to classify a
186
+ * registration record into a provider vs. seeker entry. Throws {@link CohortWireError} on an unknown
187
+ * `kind` or a malformed payload.
188
+ */
189
+ export function decodeMatchAppPayload(bytes, maxBytes = DEFAULT_MAX_APP_PAYLOAD_BYTES) {
190
+ const value = parseJsonBytes(bytes, maxBytes, "MatchAppPayloadV1");
191
+ const obj = asObject(value, "MatchAppPayloadV1");
192
+ if (obj["kind"] === "match-provider") {
193
+ return validateProviderAppPayloadV1(value);
194
+ }
195
+ if (obj["kind"] === "match-seeker") {
196
+ return validateSeekerAppPayloadV1(value);
197
+ }
198
+ fail(`MatchAppPayloadV1: field "kind" must be "match-provider" or "match-seeker", got ${JSON.stringify(obj["kind"])}`);
199
+ }
200
+ /** Parse opaque (non-framed) UTF-8 JSON payload bytes, rejecting oversized/invalid input. */
201
+ function parseJsonBytes(bytes, maxBytes, what) {
202
+ if (bytes.length > maxBytes) {
203
+ fail(`${what}: payload ${bytes.length} exceeds max ${maxBytes} bytes`);
204
+ }
205
+ let text;
206
+ try {
207
+ text = utf8Decoder.decode(bytes);
208
+ }
209
+ catch {
210
+ fail(`${what}: payload is not valid UTF-8`);
211
+ }
212
+ try {
213
+ return JSON.parse(text);
214
+ }
215
+ catch {
216
+ fail(`${what}: payload is not valid JSON`);
217
+ }
218
+ }
219
+ // --- Query-protocol messages (length-framed RPCs) ---
220
+ /** Narrow an already-parsed value to {@link QueryV1}, throwing on any defect. */
221
+ export function validateQueryV1(value) {
222
+ const what = "QueryV1";
223
+ const obj = asObject(value, what);
224
+ requireV1(obj, what);
225
+ const out = {
226
+ v: 1,
227
+ topicId: b64urlField(reqString(obj, "topicId", what), "topicId", what),
228
+ includeProviders: reqBool(obj, "includeProviders", what),
229
+ includeSeekers: reqBool(obj, "includeSeekers", what),
230
+ limit: reqIntInRange(reqFiniteNumber(obj, "limit", what), "limit", what, 1, QUERY_LIMIT_MAX),
231
+ requesterId: reqString(obj, "requesterId", what),
232
+ timestamp: reqFiniteNumber(obj, "timestamp", what),
233
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
234
+ };
235
+ if (obj["filter"] !== undefined) {
236
+ out.filter = validateCapabilityFilter(obj["filter"], `${what}.filter`);
237
+ }
238
+ return out;
239
+ }
240
+ function validateTopicTrafficV1(value, what) {
241
+ const obj = asObject(value, what);
242
+ return {
243
+ windowSeconds: reqFiniteNumber(obj, "windowSeconds", what),
244
+ arrivalsPerMin: reqFiniteNumber(obj, "arrivalsPerMin", what),
245
+ queriesPerMin: reqFiniteNumber(obj, "queriesPerMin", what),
246
+ directParticipants: reqFiniteNumber(obj, "directParticipants", what),
247
+ childCohortCount: reqFiniteNumber(obj, "childCohortCount", what),
248
+ };
249
+ }
250
+ function validateProviderEntryV1(value) {
251
+ const what = "ProviderEntryV1";
252
+ const obj = asObject(value, what);
253
+ return {
254
+ participantId: reqString(obj, "participantId", what),
255
+ capabilities: reqStringArray(obj, "capabilities", what),
256
+ capacityBudget: reqIntInRange(reqFiniteNumber(obj, "capacityBudget", what), "capacityBudget", what, 0),
257
+ contactHint: reqString(obj, "contactHint", what),
258
+ attachedAt: reqFiniteNumber(obj, "attachedAt", what),
259
+ registrationSig: b64urlField(reqString(obj, "registrationSig", what), "registrationSig", what),
260
+ };
261
+ }
262
+ function validateSeekerEntryV1(value) {
263
+ const what = "SeekerEntryV1";
264
+ const obj = asObject(value, what);
265
+ return {
266
+ participantId: reqString(obj, "participantId", what),
267
+ wantCount: reqIntInRange(reqFiniteNumber(obj, "wantCount", what), "wantCount", what, 1),
268
+ contactHint: reqString(obj, "contactHint", what),
269
+ attachedAt: reqFiniteNumber(obj, "attachedAt", what),
270
+ registrationSig: b64urlField(reqString(obj, "registrationSig", what), "registrationSig", what),
271
+ };
272
+ }
273
+ /** Narrow an already-parsed value to {@link QueryReplyV1}, throwing on any defect. */
274
+ export function validateQueryReplyV1(value) {
275
+ const what = "QueryReplyV1";
276
+ const obj = asObject(value, what);
277
+ requireV1(obj, what);
278
+ const out = {
279
+ v: 1,
280
+ truncated: reqBool(obj, "truncated", what),
281
+ cohortEpoch: b64urlField(reqString(obj, "cohortEpoch", what), "cohortEpoch", what),
282
+ topicTraffic: validateTopicTrafficV1(obj["topicTraffic"], `${what}.topicTraffic`),
283
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
284
+ };
285
+ if (obj["providers"] !== undefined) {
286
+ if (!Array.isArray(obj["providers"])) {
287
+ fail(`${what}: field "providers" must be an array when present`);
288
+ }
289
+ out.providers = obj["providers"].map(validateProviderEntryV1);
290
+ }
291
+ if (obj["seekers"] !== undefined) {
292
+ if (!Array.isArray(obj["seekers"])) {
293
+ fail(`${what}: field "seekers" must be an array when present`);
294
+ }
295
+ out.seekers = obj["seekers"].map(validateSeekerEntryV1);
296
+ }
297
+ return out;
298
+ }
299
+ function validateAggregateBucketV1(value) {
300
+ const what = "AggregateBucketV1";
301
+ const obj = asObject(value, what);
302
+ return {
303
+ targetTier: reqIntInRange(reqFiniteNumber(obj, "targetTier", what), "targetTier", what, 0),
304
+ prefixSlot: reqIntInRange(reqFiniteNumber(obj, "prefixSlot", what), "prefixSlot", what, 0),
305
+ count: reqIntInRange(reqFiniteNumber(obj, "count", what), "count", what, 0),
306
+ };
307
+ }
308
+ /** Narrow an already-parsed value to {@link AggregateCountV1}, throwing on any defect. */
309
+ export function validateAggregateCountV1(value) {
310
+ const what = "AggregateCountV1";
311
+ const obj = asObject(value, what);
312
+ requireV1(obj, what);
313
+ const buckets = obj["bucketCounts"];
314
+ if (!Array.isArray(buckets)) {
315
+ fail(`${what}: field "bucketCounts" must be an array`);
316
+ }
317
+ const signers = obj["signers"];
318
+ if (!Array.isArray(signers) || signers.some((s) => typeof s !== "string")) {
319
+ fail(`${what}: field "signers" must be an array of strings`);
320
+ }
321
+ return {
322
+ v: 1,
323
+ topicId: b64urlField(reqString(obj, "topicId", what), "topicId", what),
324
+ bucketCounts: buckets.map(validateAggregateBucketV1),
325
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
326
+ signers: signers.map((s, i) => b64urlField(s, `signers[${i}]`, what)),
327
+ cohortEpoch: b64urlField(reqString(obj, "cohortEpoch", what), "cohortEpoch", what),
328
+ };
329
+ }
330
+ /** Encode a {@link QueryV1} as a length-prefixed UTF-8 JSON frame. */
331
+ export function encodeQueryV1(msg, maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES) {
332
+ return encodeCohortMessage(validateQueryV1(msg), maxMessageBytes);
333
+ }
334
+ /** Decode a length-prefixed {@link QueryV1} frame. */
335
+ export function decodeQueryV1(bytes, maxMessageBytes) {
336
+ return validateQueryV1(decodeCohortMessage(bytes, maxMessageBytes));
337
+ }
338
+ /** Encode a {@link QueryReplyV1} as a length-prefixed UTF-8 JSON frame. */
339
+ export function encodeQueryReplyV1(msg, maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES) {
340
+ return encodeCohortMessage(validateQueryReplyV1(msg), maxMessageBytes);
341
+ }
342
+ /** Decode a length-prefixed {@link QueryReplyV1} frame. */
343
+ export function decodeQueryReplyV1(bytes, maxMessageBytes) {
344
+ return validateQueryReplyV1(decodeCohortMessage(bytes, maxMessageBytes));
345
+ }
346
+ /** Encode an {@link AggregateCountV1} as a length-prefixed UTF-8 JSON frame. */
347
+ export function encodeAggregateCountV1(msg, maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES) {
348
+ return encodeCohortMessage(validateAggregateCountV1(msg), maxMessageBytes);
349
+ }
350
+ /** Decode a length-prefixed {@link AggregateCountV1} frame. */
351
+ export function decodeAggregateCountV1(bytes, maxMessageBytes) {
352
+ return validateAggregateCountV1(decodeCohortMessage(bytes, maxMessageBytes));
353
+ }
354
+ // --- canonical participant-signature payloads (provider/seeker registration sigs) ---
355
+ /**
356
+ * Canonical signed byte image of a provider registration — `(topicId, capabilities, capacityBudget)`
357
+ * per `docs/matchmaking.md` §Wire formats.
358
+ *
359
+ * **Signing scope (resolved):** the signed image deliberately excludes the matchmaking
360
+ * `correlationId`. The advisory trust model (matchmaking.md §Wire formats) requires a seeker to
361
+ * re-validate each forwarded {@link ProviderEntryV1}'s `registrationSig`, and a {@link ProviderEntryV1}
362
+ * carries **no** `correlationId` field — so binding the signature over `correlationId` would leave the
363
+ * seeker unable to reconstruct the exact signed image. Dropping it (option (b) of the implement ticket)
364
+ * keeps the signed image fully self-contained in the forwarded entry: `topicId` (the topic the seeker
365
+ * queried) + `capabilities` + `capacityBudget`. Replay-binding of the *registration* is handled
366
+ * independently by the cohort-topic `RegisterV1` envelope (its own `correlationId` + replay guard +
367
+ * peer-key signature); the matchmaking signature only attests provider authorship of the advertised
368
+ * capabilities, which the participant peer key (the entry's `participantId`) anchors.
369
+ *
370
+ * Determinism comes from an explicitly-ordered array (stable, unlike object key order), exactly like
371
+ * the cohort-topic `registerSigningPayload`. `topicId` is passed as raw bytes and emitted as base64url
372
+ * so signer and verifier agree byte-for-byte.
373
+ */
374
+ export function providerSigningPayload(topicId, capabilities, capacityBudget) {
375
+ return utf8Encoder.encode(JSON.stringify([
376
+ "ProviderAppPayloadV1",
377
+ bytesToB64url(topicId),
378
+ [...capabilities],
379
+ capacityBudget,
380
+ ]));
381
+ }
382
+ /**
383
+ * Canonical signed byte image of a seeker registration — `(topicId, wantCount)`. Mirrors the provider
384
+ * scope (option (b), see {@link providerSigningPayload}): the image excludes `correlationId` so it is
385
+ * fully reconstructable from a forwarded {@link SeekerEntryV1} (`participantId` + `wantCount`) for
386
+ * collective-assembly re-validation.
387
+ */
388
+ export function seekerSigningPayload(topicId, wantCount) {
389
+ return utf8Encoder.encode(JSON.stringify([
390
+ "SeekerAppPayloadV1",
391
+ bytesToB64url(topicId),
392
+ wantCount,
393
+ ]));
394
+ }
395
+ /**
396
+ * Re-validate a forwarded {@link ProviderEntryV1} against the topic it was returned for: reconstruct the
397
+ * provider signing image from the entry's own fields and verify `registrationSig` against the entry's
398
+ * `participantId`. This is the seeker-side check the advisory trust model hinges on — the cohort vouches
399
+ * only for "these were the registrations I held", never for provider authenticity.
400
+ */
401
+ export function verifyProviderEntry(topicId, entry, verify) {
402
+ let sig;
403
+ try {
404
+ sig = b64urlToBytes(entry.registrationSig);
405
+ }
406
+ catch {
407
+ return false;
408
+ }
409
+ return verify(entry.participantId, providerSigningPayload(topicId, entry.capabilities, entry.capacityBudget), sig);
410
+ }
411
+ /** Re-validate a forwarded {@link SeekerEntryV1} (collective-assembly discovery), mirroring {@link verifyProviderEntry}. */
412
+ export function verifySeekerEntry(topicId, entry, verify) {
413
+ let sig;
414
+ try {
415
+ sig = b64urlToBytes(entry.registrationSig);
416
+ }
417
+ catch {
418
+ return false;
419
+ }
420
+ return verify(entry.participantId, seekerSigningPayload(topicId, entry.wantCount), sig);
421
+ }
422
+ /**
423
+ * Canonical signed byte image of a {@link QueryReplyV1} — the cohort **primary's** single-member
424
+ * signature (not threshold), per `docs/matchmaking.md` §Wire formats. The primary vouches only for the
425
+ * *set it held*; provider authenticity is re-validated per entry via {@link verifyProviderEntry}. The
426
+ * image binds the epoch, truncation flag, traffic snapshot, and the participant ids of each returned
427
+ * entry (order-sensitive) so a tampered reply is detectable, while staying independent of the
428
+ * advisory per-entry signatures.
429
+ */
430
+ export function queryReplySigningPayload(reply) {
431
+ return utf8Encoder.encode(JSON.stringify([
432
+ "QueryReplyV1",
433
+ reply.v,
434
+ reply.cohortEpoch,
435
+ reply.truncated,
436
+ [
437
+ reply.topicTraffic.windowSeconds,
438
+ reply.topicTraffic.arrivalsPerMin,
439
+ reply.topicTraffic.queriesPerMin,
440
+ reply.topicTraffic.directParticipants,
441
+ reply.topicTraffic.childCohortCount,
442
+ ],
443
+ (reply.providers ?? []).map((p) => p.participantId),
444
+ (reply.seekers ?? []).map((s) => s.participantId),
445
+ ]));
446
+ }
447
+ // --- aggregate-count log-bucketing + canonical threshold-signing image (multi-cohort sweep) ---
448
+ /**
449
+ * Log-bucket a raw provider count for an {@link AggregateCountV1} bucket: the largest power of two
450
+ * `<= n` (and `0` for `n <= 0`). The root reports bucketed, not exact, per-shard populations
451
+ * (`docs/matchmaking.md` §Multi-cohort sweep) — both to compress the summary and to avoid leaking exact
452
+ * counts.
453
+ *
454
+ * The bucketing rounds **down** and is monotonic non-decreasing, so a consumer summing bucketed counts
455
+ * (`multi-cohort-seeker.selectShards`) *under*-estimates the true population. That bias is the safe
456
+ * direction for shard selection: the real population is always `>=` the reported one, so selecting until
457
+ * the bucketed sum reaches `wantCount` naturally over-provisions rather than under-selecting.
458
+ */
459
+ export function logBucketCount(n) {
460
+ if (!Number.isFinite(n) || n <= 0) {
461
+ return 0;
462
+ }
463
+ return 2 ** Math.floor(Math.log2(Math.floor(n)));
464
+ }
465
+ /**
466
+ * Canonical threshold-signed byte image of an {@link AggregateCountV1} — covers the semantic fields
467
+ * (`v`, `topicId`, `cohortEpoch`, and the bucket set) but never the `signature`/`signers` envelope,
468
+ * exactly as the cohort-topic `sig/payloads.ts` builders do for their threshold-signed notices. The
469
+ * bucket set is sorted by `(targetTier, prefixSlot)` so the image is independent of bucket emission
470
+ * order — signer and verifier recompute identical bytes.
471
+ */
472
+ export function aggregateCountSigningPayload(unsigned) {
473
+ const buckets = [...unsigned.bucketCounts]
474
+ .sort((a, b) => a.targetTier - b.targetTier || a.prefixSlot - b.prefixSlot)
475
+ .map((b) => [b.targetTier, b.prefixSlot, b.count]);
476
+ return utf8Encoder.encode(JSON.stringify([
477
+ "AggregateCountV1",
478
+ unsigned.v,
479
+ unsigned.topicId,
480
+ unsigned.cohortEpoch,
481
+ buckets,
482
+ ]));
483
+ }
484
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.js","sourceRoot":"","sources":["../../../src/matchmaking/wire.ts"],"names":[],"mappings":"AAAA;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ACnC,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAyD;IACrG,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC;SACxC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;SAC1E,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QACxC,kBAAkB;QAClB,QAAQ,CAAC,CAAC;QACV,QAAQ,CAAC,OAAO;QAChB,QAAQ,CAAC,WAAW;QACpB,OAAO;KACP,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -17,6 +17,15 @@ export type RepoCommitRequest = {
17
17
  blockIds: BlockId[];
18
18
  actionId: ActionId;
19
19
  rev: number;
20
+ /**
21
+ * The collection's chain tail block id (the {@link CommitRequest.tailId}). Optional on the per-block
22
+ * repo operation: the transactor threads the committing collection's tail through every per-block
23
+ * commit so the coordinator carries it into the consensus commit op, letting the committing node's
24
+ * `StorageRepo.commit` stamp it onto the emitted `CollectionChangeEvent` (the reactivity topic anchor
25
+ * `H(tailId ‖ "reactivity")`). Absent on bare per-block paths (e.g. churn replication), which never
26
+ * originate reactivity.
27
+ */
28
+ tailId?: BlockId;
20
29
  };
21
30
  export type IRepo = {
22
31
  get(blockGets: BlockGets, options?: MessageOptions): Promise<GetBlockResults>;
@@ -1 +1 @@
1
- {"version":3,"file":"i-repo.d.ts","sourceRoot":"","sources":["../../../src/network/i-repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtI,MAAM,MAAM,cAAc,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IACnB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9E,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpF,CAAA"}
1
+ {"version":3,"file":"i-repo.d.ts","sourceRoot":"","sources":["../../../src/network/i-repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtI,MAAM,MAAM,cAAc,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IACnB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9E,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpF,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { ActionBlocks, PendRequest, CommitRequest, BlockGets } from "../index.js";
1
+ import type { ActionBlocks, PendRequest, CommitRequest, BlockGets, InvalidateRequest } from "../index.js";
2
2
  export type RepoMessage = {
3
3
  operations: [
4
4
  {
@@ -11,6 +11,8 @@ export type RepoMessage = {
11
11
  };
12
12
  } | {
13
13
  commit: CommitRequest;
14
+ } | {
15
+ invalidate: InvalidateRequest;
14
16
  }
15
17
  ];
16
18
  expiration?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"repo-protocol.d.ts","sourceRoot":"","sources":["../../../src/network/repo-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE;QACX;YAAE,GAAG,EAAE,SAAS,CAAA;SAAE,GAClB;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,GACrB;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,YAAY,CAAA;aAAE,CAAA;SAAE,GACvC;YAAE,MAAM,EAAE,aAAa,CAAA;SAAE;KACzB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"repo-protocol.d.ts","sourceRoot":"","sources":["../../../src/network/repo-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE1G,MAAM,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE;QACX;YAAE,GAAG,EAAE,SAAS,CAAA;SAAE,GAClB;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,GACrB;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,YAAY,CAAA;aAAE,CAAA;SAAE,GACvC;YAAE,MAAM,EAAE,aAAa,CAAA;SAAE,GACzB;YAAE,UAAU,EAAE,iBAAiB,CAAA;SAAE;KACjC,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { CollectionId, BlockId, IBlock, ActionId, Transform, Transforms } from "../index.js";
2
2
  import type { ActionContext, ActionRev } from "../collection/action.js";
3
3
  import type { Transaction } from "../transaction/transaction.js";
4
+ import type { DisputeResolutionProof } from "../log/struct.js";
4
5
  import type { PeerId } from "./types.js";
5
6
  export type ActionBlocks = {
6
7
  blockIds: BlockId[];
@@ -35,7 +36,7 @@ export type PendRequest = ActionTransforms & {
35
36
  superclusterNominees?: PeerId[];
36
37
  };
37
38
  export type BlockActionStatus = ActionBlocks & {
38
- statuses: ('pending' | 'committed' | 'checkpointed' | 'aborted')[];
39
+ statuses: ('pending' | 'committed' | 'checkpointed' | 'aborted' | 'committed-invalidated')[];
39
40
  };
40
41
  export type PendSuccess = {
41
42
  success: true;
@@ -62,6 +63,27 @@ export type CommitRequest = ActionBlocks & {
62
63
  /** The new revision for the committed action */
63
64
  rev: number;
64
65
  };
66
+ /**
67
+ * Originates a compensating invalidation through the same critical-cluster consensus as any
68
+ * transaction: it takes a revision slot and serializes against concurrent commits. Each member
69
+ * applies it deterministically — verifying {@link resolution} as an invalidation certificate, then
70
+ * writing the per-block compensating revisions and appending the durable invalidation log entry.
71
+ *
72
+ * Carries everything a member needs to apply the reversal without trusting the originator: the
73
+ * target action, the blocks it wrote, the owning collection's log, and the signed proof.
74
+ */
75
+ export type InvalidateRequest = {
76
+ /** actionId of the committed action being reversed. */
77
+ invalidatedActionId: ActionId;
78
+ /** rev of the invalidated entry — pins which block revisions to roll back. */
79
+ invalidatedRev: number;
80
+ /** Blocks the invalidated action wrote (its commit's blockIds). */
81
+ blockIds: BlockId[];
82
+ /** The collection (log) the invalidated action belongs to — where the compensating entry lands. */
83
+ collectionId: CollectionId;
84
+ /** The invalidation certificate (challenger-wins + signed 2/3 decisive arbitrator votes). */
85
+ resolution: DisputeResolutionProof;
86
+ };
65
87
  export type CommitResult = CommitSuccess | StaleFailure;
66
88
  export type CommitSuccess = {
67
89
  success: true;
@@ -1 +1 @@
1
- {"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../../src/network/struct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,KA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