@optimystic/db-core 0.13.4 → 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 +29 -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 +19 -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 +44 -2
  353. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  354. package/dist/src/transactor/network-transactor.js +132 -17
  355. package/dist/src/transactor/network-transactor.js.map +1 -1
  356. package/package.json +3 -2
  357. package/src/cluster/structs.ts +86 -57
  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 +19 -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 +162 -19
@@ -0,0 +1,80 @@
1
+ import type { BlockId, CollectionId } from '../index.js';
2
+ import type { ActionId } from '../collection/action.js';
3
+
4
+ /** A commit landed on this node mutating one collection's blocks. */
5
+ export type CollectionChangeEvent = {
6
+ /** Header/collection id of the affected collection (block.header.collectionId). */
7
+ readonly collectionId: CollectionId;
8
+ /** Blocks within that collection mutated by this commit. */
9
+ readonly blockIds: readonly BlockId[];
10
+ readonly actionId: ActionId;
11
+ readonly rev: number;
12
+ /**
13
+ * The collection's chain tail block id at the time of this commit (the `CommitRequest.tailId`).
14
+ * Anchors the rotating reactivity topic `H(tailId ‖ "reactivity")`. Present on commit-driven
15
+ * events; `undefined` on read-driven promotions (the `StorageRepo.get` path has no commit tail —
16
+ * those never originate anyway, and are cert-gated out downstream).
17
+ */
18
+ readonly tailId?: BlockId;
19
+ /**
20
+ * `true` iff this change event is a durable **invalidation** — a compensating revision + appended
21
+ * `InvalidationEntry` reversing a previously-committed action proven invalid by dispute
22
+ * (`docs/right-is-right.md` §Durable Invalidation), rather than an ordinary commit. An invalidation
23
+ * is a committed collection change like any other, so it flows through the same notification path;
24
+ * this flag lets a subscriber distinguish it (drop derived results + resubmit) from a plain commit
25
+ * (refresh). A hint only — correctness never depends on it: the subscriber always re-reads the
26
+ * authoritative reverted state. Absent (falsy) on ordinary commits.
27
+ */
28
+ readonly invalidation?: boolean;
29
+ /**
30
+ * When {@link invalidation} is set, the `actionId` of the original committed action that was
31
+ * reversed (the `InvalidationEntry.invalidatedActionId`). Lets an invalidation-aware client
32
+ * dedup/coalesce multiple cascade notifications by the action they reverse, and resubmit exactly
33
+ * the affected work. Absent on ordinary commits.
34
+ */
35
+ readonly invalidatedActionId?: ActionId;
36
+ };
37
+
38
+ export type CollectionChangeListener = (event: CollectionChangeEvent) => void;
39
+
40
+ /**
41
+ * The cluster-consensus commit certificate for a committed action — the **authoritative** proof
42
+ * that the cohort agreed the commit. It is the cross-package currency the local change-notifier
43
+ * bridge forwards into the cohort-topic substrate (`CohortTopicService.onLocalCommit`) so reactivity
44
+ * can originate notifications **without re-signing**: a notification's signature is bit-for-bit this
45
+ * `thresholdSig`. The bridge and every downstream consumer treat the bytes as opaque and pass them
46
+ * through unchanged — only the cluster layer that produced consensus ever mints one.
47
+ *
48
+ * Peer ids are carried as their string form (the cluster keys signatures by peer-id string); db-core
49
+ * stays cross-platform and never references a libp2p `PeerId` type here.
50
+ */
51
+ export type CommitCert = {
52
+ /** Threshold signature bytes proving `signers` agreed the commit. Forwarded UNCHANGED; never re-signed. */
53
+ readonly thresholdSig: Uint8Array;
54
+ /** Peer-id strings whose signatures compose {@link thresholdSig} (a distinct set of size ≥ {@link minSigs}). */
55
+ readonly signers: readonly string[];
56
+ /** Threshold the signer set satisfies (the cluster super-majority / cohort `k − x`). */
57
+ readonly minSigs: number;
58
+ /**
59
+ * The exact byte preimage each `signers[i]` signed to produce its 64-byte chunk of
60
+ * {@link thresholdSig} — the cluster's per-member commit-vote payload `utf8(commitHash + ":approve")`,
61
+ * identical across all approving signers. Reactivity sets a notification's `digest` to
62
+ * base64url(signedPayload) so a subscriber's threshold-verify over `digest` reproduces the exact
63
+ * signed image. Opaque to db-core; minted only by the cluster layer.
64
+ */
65
+ readonly signedPayload: Uint8Array;
66
+ };
67
+
68
+ export interface IBlockChangeNotifier {
69
+ /**
70
+ * Subscribe to commits that mutate the given collection. Returns an
71
+ * idempotent unsubscribe. Listeners are invoked AFTER the commit's critical
72
+ * section (locks released), synchronously in commit order; a throwing
73
+ * listener must not break the commit or other listeners (log + continue).
74
+ */
75
+ onCollectionChange(collectionId: CollectionId, listener: CollectionChangeListener): () => void;
76
+ }
77
+
78
+ export function isBlockChangeNotifier(x: unknown): x is IBlockChangeNotifier {
79
+ return !!x && typeof (x as IBlockChangeNotifier).onCollectionChange === 'function';
80
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./change-notifier.js";
1
2
  export * from "./network-transactor.js";
2
3
  export * from "./transactor-source.js";
3
4
  export * from "./transactor.js";
@@ -1,7 +1,8 @@
1
1
  import { peerIdFromString } from "../network/types.js";
2
2
  import type { PeerId } from "../network/types.js";
3
- import type { ActionTransforms, ActionBlocks, BlockActionStatus, ITransactor, PendSuccess, StaleFailure, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, Transforms, CommitRequest, ActionId, RepoCommitRequest, ClusterNomineesResult } from "../index.js";
4
- import { transformForBlockId, groupBy, concatTransforms, concatTransform, transformsFromTransform, blockIdsForTransforms } from "../index.js";
3
+ import type { ActionTransforms, ActionBlocks, BlockActionStatus, ITransactor, PendSuccess, StaleFailure, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, Transforms, CommitRequest, ActionId, RepoCommitRequest, ClusterNomineesResult, CollectionId, IBlock } from "../index.js";
4
+ import type { IBlockChangeNotifier, CollectionChangeListener } from "./change-notifier.js";
5
+ import { transformForBlockId, groupBy, concatTransforms, concatTransform, transformsFromTransform, blockIdsForTransforms, Log, Tracker, CacheSource, TransactorSource } from "../index.js";
5
6
  import { blockIdToBytes } from "../utility/block-id-to-bytes.js";
6
7
  import { isRecordEmpty } from "../utility/is-record-empty.js";
7
8
  import { type CoordinatorBatch, makeBatchesByPeer, incompleteBatches, everyBatch, allBatches, mergeBlocks, processBatches, createBatchesForPayload } from "../utility/batch-coordinator.js";
@@ -14,13 +15,41 @@ type NetworkTransactorInit = {
14
15
  abortOrCancelTimeoutMs: number;
15
16
  keyNetwork: IKeyNetwork;
16
17
  getRepo: (peerId: PeerId) => IRepo;
18
+ /**
19
+ * Per-peer dial deadline in ms applied to each downstream repo call.
20
+ * `timeoutMs` is the overall transaction budget; `dialTimeoutMs` caps how
21
+ * long a single peer can hold that budget hostage during its dial. When a
22
+ * peer is unreachable, the dial fails fast and the batch-retry loop can
23
+ * re-pick a different coordinator within the remaining overall budget.
24
+ * Omit to fall back to a sensible default (3s); set 0 / negative to disable.
25
+ */
26
+ dialTimeoutMs?: number;
27
+ /**
28
+ * Optional local change-notifier (e.g. the hosting node's StorageRepo) used to
29
+ * satisfy {@link IBlockChangeNotifier}. When supplied, `onCollectionChange`
30
+ * delegates to it so consumers can feature-detect change notifications on the
31
+ * transactor they already hold rather than reaching into node internals. When
32
+ * absent, `onCollectionChange` is a logged no-op.
33
+ */
34
+ localChangeNotifier?: IBlockChangeNotifier;
17
35
  }
18
36
 
19
- export class NetworkTransactor implements ITransactor {
37
+ /**
38
+ * Default per-peer dial deadline. Chosen as a compromise between:
39
+ * - long enough for a typical libp2p dial+TLS handshake on a wired LAN
40
+ * (sub-second) plus reasonable WAN latency, including circuit-relay hops;
41
+ * - short enough that an unreachable cluster member burns ~1/10th of a
42
+ * typical 30s transaction budget before the retry loop moves on.
43
+ */
44
+ const DEFAULT_DIAL_TIMEOUT_MS = 3000;
45
+
46
+ export class NetworkTransactor implements ITransactor, IBlockChangeNotifier {
20
47
  private readonly keyNetwork: IKeyNetwork;
21
48
  private readonly timeoutMs: number;
22
49
  private readonly abortOrCancelTimeoutMs: number;
50
+ private readonly dialTimeoutMs: number | undefined;
23
51
  private readonly getRepo: (peerId: PeerId) => IRepo;
52
+ private readonly localChangeNotifier: IBlockChangeNotifier | undefined;
24
53
 
25
54
  constructor(
26
55
  init: NetworkTransactorInit,
@@ -28,7 +57,27 @@ export class NetworkTransactor implements ITransactor {
28
57
  this.keyNetwork = init.keyNetwork;
29
58
  this.timeoutMs = init.timeoutMs;
30
59
  this.abortOrCancelTimeoutMs = init.abortOrCancelTimeoutMs;
60
+ // A user explicitly passing 0 or negative means "do not bound dials separately".
61
+ // Undefined falls back to the library default.
62
+ this.dialTimeoutMs = init.dialTimeoutMs === undefined
63
+ ? DEFAULT_DIAL_TIMEOUT_MS
64
+ : (init.dialTimeoutMs > 0 ? init.dialTimeoutMs : undefined);
31
65
  this.getRepo = init.getRepo;
66
+ this.localChangeNotifier = init.localChangeNotifier;
67
+ }
68
+
69
+ /**
70
+ * Subscribe to commits landing on the local node for `collectionId`, delegating
71
+ * to the `localChangeNotifier` supplied at construction. When no notifier was
72
+ * supplied this is a no-op (returns an inert unsubscribe) — a NetworkTransactor
73
+ * with no co-located storage cannot observe commits locally.
74
+ */
75
+ onCollectionChange(collectionId: CollectionId, listener: CollectionChangeListener): () => void {
76
+ if (!this.localChangeNotifier) {
77
+ log('onCollectionChange: no localChangeNotifier configured; subscription is a no-op for collection=%s', collectionId);
78
+ return () => { };
79
+ }
80
+ return this.localChangeNotifier.onCollectionChange(collectionId, listener);
32
81
  }
33
82
 
34
83
  async get(blockGets: BlockGets): Promise<GetBlockResults> {
@@ -50,7 +99,7 @@ export class NetworkTransactor implements ITransactor {
50
99
  try {
51
100
  await processBatches(
52
101
  batches,
53
- (batch) => this.getRepo(batch.peerId).get({ blockIds: batch.payload, context: blockGets.context }, { expiration }),
102
+ (batch) => this.getRepo(batch.peerId).get({ blockIds: batch.payload, context: blockGets.context }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
54
103
  batch => batch.payload,
55
104
  (gets, blockId, mergeWithGets) => [...(mergeWithGets ?? []), ...gets.filter(bid => bid === blockId)],
56
105
  expiration,
@@ -99,7 +148,7 @@ export class NetworkTransactor implements ITransactor {
99
148
  b.subsumedBy = [...(b.subsumedBy ?? []), ...retries];
100
149
  await processBatches(
101
150
  retries,
102
- (batch) => this.getRepo(batch.peerId).get({ blockIds: batch.payload, context: blockGets.context }, { expiration }),
151
+ (batch) => this.getRepo(batch.peerId).get({ blockIds: batch.payload, context: blockGets.context }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
103
152
  batch => batch.payload,
104
153
  (gets, blockId, mergeWithGets) => [...(mergeWithGets ?? []), ...gets.filter(id => id === blockId)],
105
154
  expiration,
@@ -164,7 +213,7 @@ export class NetworkTransactor implements ITransactor {
164
213
  const blockStates = await this.get({ blockIds: allBlockIds });
165
214
 
166
215
  // Determine status for each action ref
167
- return blockActions.map(ref => ({
216
+ const results: BlockActionStatus[] = blockActions.map(ref => ({
168
217
  ...ref,
169
218
  statuses: ref.blockIds.map(blockId => {
170
219
  const result = blockStates[blockId];
@@ -178,12 +227,85 @@ export class NetworkTransactor implements ITransactor {
178
227
  if (state.latest?.actionId === ref.actionId) {
179
228
  return 'committed';
180
229
  }
181
- // Action is neither pending nor the latest committed - consider it aborted
182
- // Note: This doesn't check historical commits; a more complete implementation
183
- // would need to query the revision history
230
+ // Neither pending nor the latest committed. Block state alone calls this `aborted`, but a
231
+ // committed action that was later durably **invalidated** also presents this way — the
232
+ // compensating revision is now the block's latest, so the original action is no longer it.
233
+ // The `refineInvalidatedStatuses` pass below disambiguates from the authoritative log.
184
234
  return 'aborted';
185
235
  })
186
236
  }));
237
+
238
+ // Authoritative `committed-invalidated` from durable state: consult each affected collection's
239
+ // log for an InvalidationEntry against the queried action (survives a node restart — the in-memory
240
+ // dispute map is only a fast cache; the log is the source of truth). Only `aborted` slots are
241
+ // ambiguous, so this is a no-op for ordinary pending/committed queries.
242
+ await this.refineInvalidatedStatuses(results, blockStates);
243
+ return results;
244
+ }
245
+
246
+ /**
247
+ * Refine the otherwise-`aborted` statuses to `committed-invalidated` for any queried action that has a
248
+ * durable {@link import("../log/struct.js").InvalidationEntry} against it. Reads the collection log via
249
+ * {@link Log.findInvalidation} — the durable, restart-surviving source of truth (`docs/right-is-right.md`
250
+ * §Durable Invalidation) — rather than the per-node, in-memory dispute map. A `pending` slot is left
251
+ * untouched: a still-pending transaction whose base was invalidated will be rejected on its own
252
+ * validation ("pending → will-be-rejected"), which is not the same as `committed-invalidated`.
253
+ *
254
+ * Best-effort and isolated: a log-open/read fault leaves the slot `aborted` (logged) rather than
255
+ * failing the whole status query. The per-call caches keep one log open and one lookup per
256
+ * `(collection, action)` even when many refs share a collection.
257
+ */
258
+ private async refineInvalidatedStatuses(results: BlockActionStatus[], blockStates: GetBlockResults): Promise<void> {
259
+ const logByCollection = new Map<CollectionId, Log<unknown> | undefined>();
260
+ const invalidatedByKey = new Map<string, boolean>();
261
+
262
+ for (const ref of results) {
263
+ if (!ref.statuses.some(status => status === 'aborted')) {
264
+ continue; // no ambiguous slot — an invalidation could not change this ref's answer
265
+ }
266
+ const collectionId = collectionIdForRef(ref, blockStates);
267
+ if (collectionId === undefined) {
268
+ continue; // genuinely aborted: no fetched block to anchor a collection log on
269
+ }
270
+ const key = `${collectionId} ${ref.actionId}`;
271
+ let invalidated = invalidatedByKey.get(key);
272
+ if (invalidated === undefined) {
273
+ invalidated = await this.hasDurableInvalidation(collectionId, ref.actionId, logByCollection);
274
+ invalidatedByKey.set(key, invalidated);
275
+ }
276
+ if (!invalidated) {
277
+ continue;
278
+ }
279
+ for (let i = 0; i < ref.statuses.length; i++) {
280
+ if (ref.statuses[i] === 'aborted') {
281
+ ref.statuses[i] = 'committed-invalidated';
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ /** Whether `actionId` has a durable invalidation entry in `collectionId`'s log (opened once, cached). */
288
+ private async hasDurableInvalidation(
289
+ collectionId: CollectionId,
290
+ actionId: ActionId,
291
+ logByCollection: Map<CollectionId, Log<unknown> | undefined>,
292
+ ): Promise<boolean> {
293
+ try {
294
+ let collectionLog = logByCollection.get(collectionId);
295
+ if (!logByCollection.has(collectionId)) {
296
+ const source = new TransactorSource<IBlock>(collectionId, this, undefined);
297
+ const tracker = new Tracker<IBlock>(new CacheSource<IBlock>(source));
298
+ collectionLog = await Log.open<unknown>(tracker, collectionId);
299
+ logByCollection.set(collectionId, collectionLog);
300
+ }
301
+ if (!collectionLog) {
302
+ return false;
303
+ }
304
+ return (await collectionLog.findInvalidation(actionId)) !== undefined;
305
+ } catch (err) {
306
+ log('getStatus: durable invalidation lookup failed collection=%s action=%s: %o', collectionId, actionId, err);
307
+ return false;
308
+ }
187
309
  }
188
310
 
189
311
  private async consolidateCoordinators(
@@ -313,6 +435,7 @@ export class NetworkTransactor implements ITransactor {
313
435
  { ...blockAction, transforms: batch.payload },
314
436
  {
315
437
  expiration,
438
+ dialTimeoutMs: this.dialTimeoutMs,
316
439
  coordinatingBlockIds: batch.coordinatingBlockIds
317
440
  } as any
318
441
  ),
@@ -387,7 +510,7 @@ export class NetworkTransactor implements ITransactor {
387
510
  const expiration = Date.now() + this.abortOrCancelTimeoutMs;
388
511
  await processBatches(
389
512
  batches,
390
- (batch) => this.getRepo(batch.peerId).cancel({ actionId: actionRef.actionId, blockIds: batch.payload }, { expiration }),
513
+ (batch) => this.getRepo(batch.peerId).cancel({ actionId: actionRef.actionId, blockIds: batch.payload }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
391
514
  batch => batch.payload,
392
515
  mergeBlocks,
393
516
  expiration,
@@ -407,16 +530,20 @@ export class NetworkTransactor implements ITransactor {
407
530
  log('commit actionId=%s rev=%d blockIds=%d', request.actionId, request.rev, request.blockIds.length);
408
531
  const allBlockIds = [...new Set([...request.blockIds, request.tailId])];
409
532
 
410
- // Commit the header block if provided and not already in blockIds
533
+ // Commit the header block if provided and not already in blockIds.
534
+ // `request.tailId` is threaded into every per-block commit so the coordinator carries it into the
535
+ // consensus commit op → each committing node's StorageRepo.commit stamps it onto the emitted
536
+ // CollectionChangeEvent (the reactivity topic anchor). Without this the per-block RepoCommitRequest
537
+ // drops the collection tail and reactivity origination is gated off (undefined tail → non-member).
411
538
  if (request.headerId && !request.blockIds.includes(request.headerId)) {
412
- const headerResult = await this.commitBlock(request.headerId, allBlockIds, request.actionId, request.rev);
539
+ const headerResult = await this.commitBlock(request.headerId, allBlockIds, request.actionId, request.rev, request.tailId);
413
540
  if (!headerResult.success) {
414
541
  return headerResult;
415
542
  }
416
543
  }
417
544
 
418
545
  // Commit the tail block
419
- const tailResult = await this.commitBlock(request.tailId, allBlockIds, request.actionId, request.rev);
546
+ const tailResult = await this.commitBlock(request.tailId, allBlockIds, request.actionId, request.rev, request.tailId);
420
547
  if (!tailResult.success) {
421
548
  return tailResult;
422
549
  }
@@ -427,7 +554,7 @@ export class NetworkTransactor implements ITransactor {
427
554
  !(request.headerId && bid === request.headerId && !request.blockIds.includes(request.headerId))
428
555
  );
429
556
  if (remainingBlocks.length > 0) {
430
- const { error } = await this.commitBlocks({ blockIds: remainingBlocks, actionId: request.actionId, rev: request.rev });
557
+ const { error } = await this.commitBlocks({ blockIds: remainingBlocks, actionId: request.actionId, rev: request.rev, tailId: request.tailId });
431
558
  if (error) {
432
559
  // Non-tail block commit failures should not fail the overall action once the tail has committed.
433
560
  // Proceed and rely on reconciliation paths (e.g. reads with context) to finalize state on lagging peers.
@@ -439,8 +566,8 @@ export class NetworkTransactor implements ITransactor {
439
566
  return { success: true };
440
567
  }
441
568
 
442
- private async commitBlock(blockId: BlockId, blockIds: BlockId[], actionId: ActionId, rev: number): Promise<CommitResult> {
443
- const { batches: tailBatches, error: tailError } = await this.commitBlocks({ blockIds: [blockId], actionId, rev });
569
+ private async commitBlock(blockId: BlockId, blockIds: BlockId[], actionId: ActionId, rev: number, tailId?: BlockId): Promise<CommitResult> {
570
+ const { batches: tailBatches, error: tailError } = await this.commitBlocks({ blockIds: [blockId], actionId, rev, tailId });
444
571
  if (tailError) {
445
572
  // Cancel all pending actions as background microtask
446
573
  Promise.resolve().then(() => this.cancel({ blockIds, actionId }));
@@ -455,7 +582,7 @@ export class NetworkTransactor implements ITransactor {
455
582
  }
456
583
 
457
584
  /** Attempts to commit a set of blocks, and handles failures and errors */
458
- private async commitBlocks({ blockIds, actionId, rev }: RepoCommitRequest) {
585
+ private async commitBlocks({ blockIds, actionId, rev, tailId }: RepoCommitRequest) {
459
586
  const expiration = Date.now() + this.timeoutMs;
460
587
  const batches = await this.batchesForPayload<BlockId[], CommitResult>(blockIds, blockIds, mergeBlocks, []);
461
588
  log('commitBlocks actionId=%s rev=%d batches=%d', actionId, rev, batches.length);
@@ -463,7 +590,7 @@ export class NetworkTransactor implements ITransactor {
463
590
  try {
464
591
  await processBatches(
465
592
  batches,
466
- (batch) => this.getRepo(batch.peerId).commit({ actionId, blockIds: batch.payload, rev }, { expiration }),
593
+ (batch) => this.getRepo(batch.peerId).commit({ actionId, blockIds: batch.payload, rev, tailId }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
467
594
  batch => batch.payload,
468
595
  mergeBlocks,
469
596
  expiration,
@@ -521,7 +648,7 @@ export class NetworkTransactor implements ITransactor {
521
648
  );
522
649
  await processBatches(
523
650
  operationBatches,
524
- (batch) => this.getRepo(batch.peerId).cancel({ actionId: actionRef.actionId, blockIds: batch.payload }, { expiration }),
651
+ (batch) => this.getRepo(batch.peerId).cancel({ actionId: actionRef.actionId, blockIds: batch.payload }, { expiration, dialTimeoutMs: this.dialTimeoutMs }),
525
652
  batch => batch.payload,
526
653
  mergeBlocks,
527
654
  expiration,
@@ -544,6 +671,22 @@ export class NetworkTransactor implements ITransactor {
544
671
  }
545
672
 
546
673
 
674
+ /**
675
+ * The owning collection id for an action ref, read from any fetched block's header. A
676
+ * committed-then-invalidated action still has a materialized (compensating) block whose header carries
677
+ * the collection id; a genuinely-aborted action has no fetched block, so this returns `undefined` and
678
+ * the status stays `aborted`.
679
+ */
680
+ function collectionIdForRef(ref: ActionBlocks, blockStates: GetBlockResults): CollectionId | undefined {
681
+ for (const blockId of ref.blockIds) {
682
+ const collectionId = blockStates[blockId]?.block?.header.collectionId;
683
+ if (collectionId !== undefined) {
684
+ return collectionId;
685
+ }
686
+ }
687
+ return undefined;
688
+ }
689
+
547
690
  /** Returns a readable message for an unknown error value. */
548
691
  function errorMessage(err: unknown): string {
549
692
  if (err instanceof Error) return err.message;