@optimystic/db-core 0.13.5 → 0.14.1

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,358 @@
1
+ /**
2
+ * Reactivity — Resume RPC: classification, serving, and subscriber-side apply
3
+ * (`docs/reactivity.md` §Resume, §Parent checkpoint summaries, §Wire formats Resume).
4
+ *
5
+ * A subscriber waking from sleep sends one {@link ResumeV1} to its cached primary (or any cohort member).
6
+ * The serving cohort classifies the request against its **stacked** recovery windows — the `W`-deep replay
7
+ * ring sits on top of the `W_checkpoint`-span parent checkpoint immediately below it, so a single round
8
+ * trip recovers `W + W_checkpoint` revisions — and answers with one of four {@link ResumeReplyV1} variants
9
+ * (`docs/reactivity.md` §Replay window, the authoritative stacked semantics):
10
+ *
11
+ * - **Backfill** — `fromRevision` is within the replay ring (`fromRevision ≥ ringLow`). Returns the
12
+ * `[fromRevision, currentRevision]` slice + `currentRevision`. One RT.
13
+ * - **CheckpointWindow** — `fromRevision` is below the ring but within the parent checkpoint span
14
+ * (`chain low ≤ fromRevision < ringLow`). Returns an ordered, contiguous **chain** of
15
+ * {@link CheckpointSummary}s (`checkpoints`, low→high) + the ring's `recentEntries`. The subscriber
16
+ * verifies every link's endpoints, applies each link's merged digest, advances its contiguity head past
17
+ * the whole chain, then replays the recent entries deduped against `lastRevision`. One RT. The chain is a
18
+ * single link in steady state; a new tail that took over across a rotation serves a **two-link**
19
+ * `[inherited, rolling]` chain when a `fromRevision` below both the ring and the rolling checkpoint falls
20
+ * inside the inherited handoff window — so the full stacked range recovers in one reply regardless of
21
+ * where the new tail's own rolling checkpoint has formed (`docs/reactivity.md` §Tail rotation step 5 —
22
+ * "the new tail holds the old checkpoint").
23
+ * - **OutOfWindow** — older than even the checkpoint. Returns `currentTailId` + `currentRevision`; the
24
+ * subscriber falls back to a chain read, then a fresh subscribe.
25
+ * - **TailRotated** — the request's `latestKnownTailId` does not match the cohort's current tail (the
26
+ * subscriber slept across a rotation). Returns `newTailId` + `newRevisionAtRotation`; the subscriber
27
+ * re-registers under the new tail. This is checked **first**: a stale tail means the whole tree moved,
28
+ * so the lag-against-windows classification is moot. The rotation *lifecycle* is owned by
29
+ * [reactivity-rotation-backpressure-policy]; this module only **detects** the stale tail and emits the
30
+ * reply so resume composes with rotation.
31
+ *
32
+ * Wire conventions match the rest of reactivity: JSON, byte fields base64url, unix-ms timestamps, `v: 1`,
33
+ * per-message structural validation on decode. `ResumeV1` is signed by the subscriber's peer key
34
+ * (`signature`); replay protection rides the request envelope as elsewhere in the substrate.
35
+ */
36
+ import { decodeCohortMessage, encodeCohortMessage, DEFAULT_MAX_MESSAGE_BYTES, } from "../cohort-topic/wire/codec.js";
37
+ import { asObject, b64urlField, failWire, reqFiniteNumber, reqIntInRange, reqString, requireV1, } from "./wire-validate.js";
38
+ import { validateCheckpointSummary, verifyCheckpointEndpoints } from "./checkpoint.js";
39
+ import { checkpointCovers } from "./rotation.js";
40
+ import { validateNotificationArray } from "./wire.js";
41
+ // --- validation ---
42
+ /** Narrow an already-parsed value to {@link ResumeV1}, throwing on any defect. */
43
+ export function validateResumeV1(value) {
44
+ const what = "ResumeV1";
45
+ const obj = asObject(value, what);
46
+ requireV1(obj, what);
47
+ return {
48
+ v: 1,
49
+ collectionId: b64urlField(reqString(obj, "collectionId", what), "collectionId", what),
50
+ fromRevision: reqIntInRange(obj, "fromRevision", what, 0),
51
+ latestKnownTailId: b64urlField(reqString(obj, "latestKnownTailId", what), "latestKnownTailId", what),
52
+ subscriberCoord: b64urlField(reqString(obj, "subscriberCoord", what), "subscriberCoord", what),
53
+ timestamp: reqFiniteNumber(obj, "timestamp", what),
54
+ signature: b64urlField(reqString(obj, "signature", what), "signature", what),
55
+ };
56
+ }
57
+ /** Narrow an already-parsed value to {@link ResumeReplyV1}, throwing on any defect. */
58
+ export function validateResumeReplyV1(value) {
59
+ const what = "ResumeReplyV1";
60
+ const obj = asObject(value, what);
61
+ requireV1(obj, what);
62
+ const result = obj["result"];
63
+ if (result !== "backfill" && result !== "checkpoint_window" && result !== "out_of_window" && result !== "tail_rotated") {
64
+ failWire(`${what}: field "result" must be one of backfill|checkpoint_window|out_of_window|tail_rotated`);
65
+ }
66
+ const out = { v: 1, result };
67
+ switch (result) {
68
+ case "backfill": {
69
+ out.entries = validateNotificationArray(obj["entries"], what);
70
+ out.currentRevision = reqIntInRange(obj, "currentRevision", what, 0);
71
+ break;
72
+ }
73
+ case "checkpoint_window": {
74
+ out.checkpoints = validateCheckpointChain(obj["checkpoints"], `${what}.checkpoints`);
75
+ out.recentEntries = validateNotificationArray(obj["recentEntries"], what);
76
+ if (obj["currentRevision"] !== undefined) {
77
+ out.currentRevision = reqIntInRange(obj, "currentRevision", what, 0);
78
+ }
79
+ break;
80
+ }
81
+ case "out_of_window": {
82
+ out.currentTailId = b64urlField(reqString(obj, "currentTailId", what), "currentTailId", what);
83
+ out.currentRevision = reqIntInRange(obj, "currentRevision", what, 0);
84
+ break;
85
+ }
86
+ case "tail_rotated": {
87
+ out.newTailId = b64urlField(reqString(obj, "newTailId", what), "newTailId", what);
88
+ out.newRevisionAtRotation = reqIntInRange(obj, "newRevisionAtRotation", what, 0);
89
+ break;
90
+ }
91
+ }
92
+ return out;
93
+ }
94
+ /**
95
+ * Validate a `checkpoint_window` reply's checkpoint chain: a **non-empty**, **ascending**, internally
96
+ * **contiguous** list of {@link CheckpointSummary}s sharing one `collectionId`. Each link is validated via
97
+ * {@link validateCheckpointSummary}, and for `i ≥ 1` the chain must satisfy
98
+ * `checkpoints[i].fromRevision === checkpoints[i-1].toRevision + 1` (a gapped, overlapping, or misordered
99
+ * chain is rejected). Runs on decode, so a malformed chain never reaches {@link applyResumeReply} over the
100
+ * wire.
101
+ */
102
+ function validateCheckpointChain(value, what) {
103
+ if (!Array.isArray(value) || value.length === 0) {
104
+ failWire(`${what}: must be a non-empty array of checkpoint summaries`);
105
+ }
106
+ const chain = value.map((el, i) => validateCheckpointSummary(el, `${what}[${i}]`));
107
+ for (let i = 0; i < chain.length; i++) {
108
+ if (chain[i].collectionId !== chain[0].collectionId) {
109
+ failWire(`${what}: all checkpoints must share one collectionId`);
110
+ }
111
+ if (i >= 1 && chain[i].fromRevision !== chain[i - 1].toRevision + 1) {
112
+ failWire(`${what}: chain must be ascending and contiguous (checkpoints[${i}].fromRevision must equal checkpoints[${i - 1}].toRevision + 1)`);
113
+ }
114
+ }
115
+ return chain;
116
+ }
117
+ // --- canonical signing payload ---
118
+ const utf8 = new TextEncoder();
119
+ /**
120
+ * Canonical signed byte image of a {@link ResumeV1} (every field except `signature`). Mirrors
121
+ * {@link import("./backfill.js").backfillSigningPayload}: an explicitly-ordered, type-tagged JSON array
122
+ * encoded as UTF-8. The `"ResumeV1"` tag means a resume image can never collide with the `"BackfillV1"`
123
+ * image. `subscriberCoord` is part of the image, so a verifier recomputes over whatever coordinate the
124
+ * request carries — the field order is the byte-for-byte contract between signer and verifier.
125
+ */
126
+ export function resumeSigningPayload(body) {
127
+ return utf8.encode(JSON.stringify([
128
+ "ResumeV1",
129
+ body.v,
130
+ body.collectionId,
131
+ body.fromRevision,
132
+ body.latestKnownTailId,
133
+ body.subscriberCoord,
134
+ body.timestamp,
135
+ ]));
136
+ }
137
+ // --- codecs (length-framed JSON, mirroring the rest of reactivity) ---
138
+ /** Encode a {@link ResumeV1} as a length-prefixed UTF-8 JSON frame. */
139
+ export function encodeResumeV1(msg, maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES) {
140
+ return encodeCohortMessage(validateResumeV1(msg), maxMessageBytes);
141
+ }
142
+ /** Decode a length-prefixed {@link ResumeV1} frame. */
143
+ export function decodeResumeV1(bytes, maxMessageBytes) {
144
+ return validateResumeV1(decodeCohortMessage(bytes, maxMessageBytes));
145
+ }
146
+ /** Encode a {@link ResumeReplyV1} as a length-prefixed UTF-8 JSON frame. */
147
+ export function encodeResumeReplyV1(msg, maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES) {
148
+ return encodeCohortMessage(validateResumeReplyV1(msg), maxMessageBytes);
149
+ }
150
+ /** Decode a length-prefixed {@link ResumeReplyV1} frame. */
151
+ export function decodeResumeReplyV1(bytes, maxMessageBytes) {
152
+ return validateResumeReplyV1(decodeCohortMessage(bytes, maxMessageBytes));
153
+ }
154
+ // --- serving-cohort classification ---
155
+ /** The rolling checkpoint's summary; non-undefined because the caller already proved it abuts the ring (so non-empty). */
156
+ function requireRollingSummary(rolling) {
157
+ const summary = rolling.summary();
158
+ if (summary === undefined) {
159
+ throw new Error("resumeCheckpointChain: rolling checkpoint abuts the ring yet produced no summary (invariant violation)");
160
+ }
161
+ return summary;
162
+ }
163
+ /**
164
+ * Build the served checkpoint chain for a `checkpoint_window` resume: the **shortest** contiguous low→high
165
+ * chain of {@link CheckpointSummary}s that both covers `fromRevision` and **abuts the ring's low edge**
166
+ * (`top.toRevision === ringLow − 1`), or `undefined` when no gap-free chain exists. Shared by
167
+ * {@link classifyResume} and {@link serveResume} so they cannot disagree about the served shape.
168
+ *
169
+ * Cases are evaluated in precedence order (this ordering preserves every existing classification test):
170
+ *
171
+ * - **A — rolling wins.** The rolling checkpoint abuts the ring (it is fed by ring eviction, so it always
172
+ * does) and covers `fromRevision`: the fresher, narrower single link `[rolling]`.
173
+ * - **B1 — inherited abuts the ring directly.** No new-tail rolling checkpoint has formed between the
174
+ * inherited handoff and the ring yet (the `12.51` abut case): the single link `[inherited]`.
175
+ * - **B2 — the bridge.** The inherited handoff abuts the new tail's rolling checkpoint, which abuts the
176
+ * ring: the two-link `[inherited, rolling]` chain spans inherited → rolling → ring with no gap.
177
+ *
178
+ * Any other shape (a gap below `fromRevision`, or a gap between the windows) returns `undefined` → the
179
+ * request falls to `out_of_window` (an honest chain read). `ringLow === undefined` (no live ring to abut /
180
+ * no `recentEntries`) also returns `undefined`.
181
+ */
182
+ function resumeCheckpointChain(fromRevision, ringLow, rolling, inherited) {
183
+ if (ringLow === undefined) {
184
+ return undefined;
185
+ }
186
+ const ringAbut = ringLow - 1;
187
+ // Case A — the rolling checkpoint wins (fresher, narrower). `toRevision === ringAbut` implies it is
188
+ // non-empty, so the summary is defined (asserted in requireRollingSummary).
189
+ if (rolling !== undefined && rolling.toRevision === ringAbut && rolling.covers(fromRevision)) {
190
+ return [requireRollingSummary(rolling)];
191
+ }
192
+ // Case B1 — the inherited handoff abuts the ring directly (the 12.51 abut case): a single link.
193
+ if (inherited !== undefined && inherited.toRevision === ringAbut && checkpointCovers(inherited, fromRevision)) {
194
+ return [inherited];
195
+ }
196
+ // Case B2 — the bridge: inherited abuts the rolling checkpoint, which abuts the ring. The two-link chain
197
+ // carries inherited → rolling → ring with no gap, and each link keeps its own already-correct merged
198
+ // digest (nothing is re-folded, so a per-collection override fold composes trivially).
199
+ if (inherited !== undefined &&
200
+ rolling !== undefined &&
201
+ rolling.toRevision === ringAbut &&
202
+ inherited.toRevision + 1 === rolling.fromRevision &&
203
+ checkpointCovers(inherited, fromRevision)) {
204
+ return [inherited, requireRollingSummary(rolling)];
205
+ }
206
+ return undefined;
207
+ }
208
+ /**
209
+ * Classify a resume request against the serving cohort's stacked windows. The decision order is:
210
+ *
211
+ * 1. **tail_rotated** — `req.latestKnownTailId !== currentTailId`. A stale tail means the tree migrated,
212
+ * so the lag classification below is moot.
213
+ * 2. **backfill** — `fromRevision` is at/above the replay ring's low edge (within, or already current).
214
+ * 3. **checkpoint_window** — below the ring but a gap-free {@link resumeCheckpointChain} covers it: the
215
+ * rolling checkpoint (steady state), the inherited cross-rotation handoff (`docs/reactivity.md` §Tail
216
+ * rotation step 5 — "the new tail holds the old checkpoint"), or the two-link `[inherited, rolling]`
217
+ * bridge spanning both when the new tail's own rolling checkpoint has formed between the handoff and the
218
+ * ring.
219
+ * 4. **out_of_window** — older than even the deepest window, or a gap leaves no contiguous chain to the
220
+ * ring (a chain read), or every window is empty/absent.
221
+ */
222
+ export function classifyResume(req, buffer, checkpoint, currentTailId, inherited) {
223
+ if (req.latestKnownTailId !== currentTailId) {
224
+ return "tail_rotated";
225
+ }
226
+ const low = buffer.lowRevision;
227
+ if (low !== undefined && req.fromRevision >= low) {
228
+ return "backfill";
229
+ }
230
+ return resumeCheckpointChain(req.fromRevision, low, checkpoint, inherited) !== undefined
231
+ ? "checkpoint_window"
232
+ : "out_of_window";
233
+ }
234
+ /**
235
+ * Serve a {@link ResumeV1} from a cohort's stacked windows, producing the classified {@link ResumeReplyV1}.
236
+ * Pure over the supplied snapshot — no I/O, no clock. A request whose `collectionId` does not match
237
+ * `expectedCollectionId` is rejected (a resume is collection-scoped).
238
+ */
239
+ export function serveResume(req, deps) {
240
+ if (req.collectionId !== deps.expectedCollectionId) {
241
+ failWire(`serveResume: request collectionId does not match this cohort's collection`);
242
+ }
243
+ const result = classifyResume(req, deps.buffer, deps.checkpoint, deps.currentTailId, deps.inheritedCheckpoint);
244
+ switch (result) {
245
+ case "backfill": {
246
+ const high = deps.buffer.highRevision ?? deps.currentRevision;
247
+ const entries = deps.buffer.range(req.fromRevision, high).map((e) => e.payload);
248
+ return { v: 1, result, entries, currentRevision: deps.currentRevision };
249
+ }
250
+ case "checkpoint_window": {
251
+ // The contiguous chain the helper built — rolling alone, inherited alone, or the two-link bridge.
252
+ // classifyResume returned checkpoint_window iff this chain is present, so it is non-undefined here
253
+ // (the two calls share inputs, so they cannot disagree).
254
+ const chain = resumeCheckpointChain(req.fromRevision, deps.buffer.lowRevision, deps.checkpoint, deps.inheritedCheckpoint);
255
+ if (chain === undefined) {
256
+ throw new Error("serveResume: checkpoint_window classification produced no checkpoint chain (invariant violation)");
257
+ }
258
+ const recentEntries = deps.buffer.entries().map((e) => e.payload);
259
+ return { v: 1, result, checkpoints: chain, recentEntries, currentRevision: deps.currentRevision };
260
+ }
261
+ case "out_of_window":
262
+ return { v: 1, result, currentTailId: deps.currentTailId, currentRevision: deps.currentRevision };
263
+ case "tail_rotated":
264
+ return {
265
+ v: 1,
266
+ result,
267
+ newTailId: deps.currentTailId,
268
+ newRevisionAtRotation: deps.rotationRevision ?? deps.currentRevision,
269
+ };
270
+ }
271
+ }
272
+ /**
273
+ * Apply a {@link ResumeReplyV1} on the subscriber side, returning the {@link ResumeApplyOutcome}. Backfill
274
+ * and checkpoint-window entries re-enter through {@link ReactivitySubscriber.onNotification} (so they are
275
+ * verified, contiguity-checked, and deduped exactly like live notifications); the other variants escalate
276
+ * to the application via the supplied sinks. A checkpoint whose bracketing endpoints do not verify is
277
+ * **not** applied — the subscriber chain-reads instead (a forged checkpoint must never advance state).
278
+ */
279
+ export async function applyResumeReply(reply, deps) {
280
+ switch (reply.result) {
281
+ case "backfill": {
282
+ for (const n of reply.entries ?? []) {
283
+ await deps.subscriber.onNotification(n);
284
+ }
285
+ return "backfilled";
286
+ }
287
+ case "checkpoint_window": {
288
+ const summaries = reply.checkpoints;
289
+ if (summaries === undefined || summaries.length === 0) {
290
+ failWire(`applyResumeReply: checkpoint_window reply is missing its checkpoint chain`);
291
+ }
292
+ // Low-edge guard on the **lowest** link: endpoint verification proves each link's bounds are *real*
293
+ // committed revisions, but not that the chain connects to the subscriber's contiguity head. If the
294
+ // lowest `fromRevision` sits above `lastRevision + 1` there is an un-summarized gap below the chain;
295
+ // rebaselining would silently skip those revisions. The honest cohort never sends such a reply
296
+ // (`classifyResume` only picks `checkpoint_window` when the chain covers `lastRevision + 1`), so a
297
+ // non-abutting low edge is a forged/buggy reply — chain-read rather than advance past a gap.
298
+ if (summaries[0].fromRevision > deps.subscriber.lastRevision + 1) {
299
+ deps.onChainRead?.(reply.currentTailId, reply.currentRevision);
300
+ return "checkpoint_untrusted";
301
+ }
302
+ // Intra-chain contiguity (defense in depth: the codec already checks every *decoded* reply, but an
303
+ // in-process reply may bypass the codec). A gap/overlap between links would skip or double revisions.
304
+ for (let i = 1; i < summaries.length; i++) {
305
+ if (summaries[i].fromRevision !== summaries[i - 1].toRevision + 1) {
306
+ deps.onChainRead?.(reply.currentTailId, reply.currentRevision);
307
+ return "checkpoint_untrusted";
308
+ }
309
+ }
310
+ // Verify EVERY link's bracketing endpoints **before applying anything** — a single forged link kills
311
+ // the whole reply, so nothing is delivered and `lastRevision` is unchanged (no partial advance).
312
+ for (const summary of summaries) {
313
+ const verdict = await verifyCheckpointEndpoints(summary, deps.verifier);
314
+ if (verdict !== "verified") {
315
+ deps.onChainRead?.(reply.currentTailId, reply.currentRevision);
316
+ return "checkpoint_untrusted";
317
+ }
318
+ }
319
+ // Apply in order: the application sees each link's merged-digest hint, then the contiguity head
320
+ // advances past that link. `rebaseline` is monotone, so the head lands at the top link's
321
+ // `toRevision`; the recent entries (immediately above it) then replay gap-free — any recent entry
322
+ // at/below the head dedupes (`docs/reactivity.md` §Parent checkpoint summaries).
323
+ for (const summary of summaries) {
324
+ deps.onCheckpointDigest?.(summary);
325
+ deps.subscriber.rebaseline(summary.toRevision);
326
+ }
327
+ for (const n of reply.recentEntries ?? []) {
328
+ await deps.subscriber.onNotification(n);
329
+ }
330
+ return "checkpoint_applied";
331
+ }
332
+ case "out_of_window": {
333
+ deps.onChainRead?.(reply.currentTailId, reply.currentRevision);
334
+ return "out_of_window";
335
+ }
336
+ case "tail_rotated": {
337
+ deps.onTailRotated?.(reply.newTailId ?? "", reply.newRevisionAtRotation ?? 0);
338
+ return "tail_rotated";
339
+ }
340
+ }
341
+ }
342
+ class MapStickyCohortHintCache {
343
+ byCollection = new Map();
344
+ get(collectionId) {
345
+ return this.byCollection.get(collectionId);
346
+ }
347
+ set(collectionId, hint) {
348
+ this.byCollection.set(collectionId, hint);
349
+ }
350
+ invalidate(collectionId) {
351
+ this.byCollection.delete(collectionId);
352
+ }
353
+ }
354
+ /** Build a {@link StickyCohortHintCache} (a plain per-collection map; sticky across reconnects). */
355
+ export function createStickyCohortHintCache() {
356
+ return new MapStickyCohortHintCache();
357
+ }
358
+ //# sourceMappingURL=resume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../src/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