@origintrail-official/dkg-agent 10.0.20 → 10.0.21

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 (535) hide show
  1. package/dist/approved-private-replica.d.ts +54 -0
  2. package/dist/approved-private-replica.d.ts.map +1 -0
  3. package/dist/approved-private-replica.js +148 -0
  4. package/dist/approved-private-replica.js.map +1 -0
  5. package/dist/bounded-operation.d.ts +2 -0
  6. package/dist/bounded-operation.d.ts.map +1 -1
  7. package/dist/bounded-operation.js +5 -0
  8. package/dist/bounded-operation.js.map +1 -1
  9. package/dist/chain-finality-confirmations-v1.d.ts +7 -0
  10. package/dist/chain-finality-confirmations-v1.d.ts.map +1 -0
  11. package/dist/chain-finality-confirmations-v1.js +9 -0
  12. package/dist/chain-finality-confirmations-v1.js.map +1 -0
  13. package/dist/chain-reconciler.d.ts +23 -0
  14. package/dist/chain-reconciler.d.ts.map +1 -1
  15. package/dist/chain-reconciler.js +35 -0
  16. package/dist/chain-reconciler.js.map +1 -1
  17. package/dist/context-graph-member-proof.d.ts +13 -0
  18. package/dist/context-graph-member-proof.d.ts.map +1 -1
  19. package/dist/context-graph-member-proof.js +36 -0
  20. package/dist/context-graph-member-proof.js.map +1 -1
  21. package/dist/context-graph-membership-persist-scheduler.d.ts +7 -23
  22. package/dist/context-graph-membership-persist-scheduler.d.ts.map +1 -1
  23. package/dist/context-graph-membership-persist-scheduler.js +12 -88
  24. package/dist/context-graph-membership-persist-scheduler.js.map +1 -1
  25. package/dist/context-graph-meta-projection.d.ts +13 -2
  26. package/dist/context-graph-meta-projection.d.ts.map +1 -1
  27. package/dist/context-graph-meta-projection.js +61 -24
  28. package/dist/context-graph-meta-projection.js.map +1 -1
  29. package/dist/context-graph-private-meta-proof.d.ts +5 -0
  30. package/dist/context-graph-private-meta-proof.d.ts.map +1 -1
  31. package/dist/context-graph-private-meta-proof.js +23 -0
  32. package/dist/context-graph-private-meta-proof.js.map +1 -1
  33. package/dist/context-graph-read-authority.d.ts +13 -0
  34. package/dist/context-graph-read-authority.d.ts.map +1 -1
  35. package/dist/context-graph-read-authority.js +23 -3
  36. package/dist/context-graph-read-authority.js.map +1 -1
  37. package/dist/context-graph-storage-discovery.d.ts +11 -2
  38. package/dist/context-graph-storage-discovery.d.ts.map +1 -1
  39. package/dist/context-graph-storage-discovery.js +11 -2
  40. package/dist/context-graph-storage-discovery.js.map +1 -1
  41. package/dist/context-graph-subscription-persist-scheduler.d.ts +52 -0
  42. package/dist/context-graph-subscription-persist-scheduler.d.ts.map +1 -0
  43. package/dist/context-graph-subscription-persist-scheduler.js +78 -0
  44. package/dist/context-graph-subscription-persist-scheduler.js.map +1 -0
  45. package/dist/curator-dial-address.d.ts +16 -0
  46. package/dist/curator-dial-address.d.ts.map +1 -0
  47. package/dist/curator-dial-address.js +58 -0
  48. package/dist/curator-dial-address.js.map +1 -0
  49. package/dist/curator-meta-refresh.d.ts +2 -0
  50. package/dist/curator-meta-refresh.d.ts.map +1 -1
  51. package/dist/curator-meta-refresh.js +2 -44
  52. package/dist/curator-meta-refresh.js.map +1 -1
  53. package/dist/curator-peer-connection.d.ts +21 -0
  54. package/dist/curator-peer-connection.d.ts.map +1 -0
  55. package/dist/curator-peer-connection.js +41 -0
  56. package/dist/curator-peer-connection.js.map +1 -0
  57. package/dist/dkg-agent-base.d.ts +94 -22
  58. package/dist/dkg-agent-base.d.ts.map +1 -1
  59. package/dist/dkg-agent-base.js +97 -144
  60. package/dist/dkg-agent-base.js.map +1 -1
  61. package/dist/dkg-agent-cg-registry.d.ts +10 -0
  62. package/dist/dkg-agent-cg-registry.d.ts.map +1 -1
  63. package/dist/dkg-agent-cg-registry.js +176 -115
  64. package/dist/dkg-agent-cg-registry.js.map +1 -1
  65. package/dist/dkg-agent-cg-resolve.d.ts +6 -4
  66. package/dist/dkg-agent-cg-resolve.d.ts.map +1 -1
  67. package/dist/dkg-agent-cg-resolve.js +22 -16
  68. package/dist/dkg-agent-cg-resolve.js.map +1 -1
  69. package/dist/dkg-agent-constants.d.ts +4 -2
  70. package/dist/dkg-agent-constants.d.ts.map +1 -1
  71. package/dist/dkg-agent-constants.js +4 -2
  72. package/dist/dkg-agent-constants.js.map +1 -1
  73. package/dist/dkg-agent-crypto.d.ts +101 -21
  74. package/dist/dkg-agent-crypto.d.ts.map +1 -1
  75. package/dist/dkg-agent-crypto.js +670 -152
  76. package/dist/dkg-agent-crypto.js.map +1 -1
  77. package/dist/dkg-agent-helpers.d.ts +2 -2
  78. package/dist/dkg-agent-helpers.d.ts.map +1 -1
  79. package/dist/dkg-agent-helpers.js +3 -3
  80. package/dist/dkg-agent-helpers.js.map +1 -1
  81. package/dist/dkg-agent-join.d.ts +12 -1
  82. package/dist/dkg-agent-join.d.ts.map +1 -1
  83. package/dist/dkg-agent-join.js +80 -92
  84. package/dist/dkg-agent-join.js.map +1 -1
  85. package/dist/dkg-agent-lifecycle.d.ts +58 -15
  86. package/dist/dkg-agent-lifecycle.d.ts.map +1 -1
  87. package/dist/dkg-agent-lifecycle.js +295 -114
  88. package/dist/dkg-agent-lifecycle.js.map +1 -1
  89. package/dist/dkg-agent-publish.d.ts +33 -40
  90. package/dist/dkg-agent-publish.d.ts.map +1 -1
  91. package/dist/dkg-agent-publish.js +190 -256
  92. package/dist/dkg-agent-publish.js.map +1 -1
  93. package/dist/dkg-agent-query.d.ts +7 -0
  94. package/dist/dkg-agent-query.d.ts.map +1 -1
  95. package/dist/dkg-agent-query.js +75 -63
  96. package/dist/dkg-agent-query.js.map +1 -1
  97. package/dist/dkg-agent-registered-private-empty-vm.d.ts +70 -0
  98. package/dist/dkg-agent-registered-private-empty-vm.d.ts.map +1 -0
  99. package/dist/dkg-agent-registered-private-empty-vm.js +133 -0
  100. package/dist/dkg-agent-registered-private-empty-vm.js.map +1 -0
  101. package/dist/dkg-agent-rfc64-catalog-auto-publish.d.ts +8 -3
  102. package/dist/dkg-agent-rfc64-catalog-auto-publish.d.ts.map +1 -1
  103. package/dist/dkg-agent-rfc64-catalog-auto-publish.js +45 -51
  104. package/dist/dkg-agent-rfc64-catalog-auto-publish.js.map +1 -1
  105. package/dist/dkg-agent-rfc64-catalog.d.ts +63 -87
  106. package/dist/dkg-agent-rfc64-catalog.d.ts.map +1 -1
  107. package/dist/dkg-agent-rfc64-catalog.js +595 -551
  108. package/dist/dkg-agent-rfc64-catalog.js.map +1 -1
  109. package/dist/dkg-agent-swm-host.d.ts +43 -52
  110. package/dist/dkg-agent-swm-host.d.ts.map +1 -1
  111. package/dist/dkg-agent-swm-host.js +629 -812
  112. package/dist/dkg-agent-swm-host.js.map +1 -1
  113. package/dist/dkg-agent-swm-state.d.ts +15 -0
  114. package/dist/dkg-agent-swm-state.d.ts.map +1 -1
  115. package/dist/dkg-agent-swm-state.js +43 -0
  116. package/dist/dkg-agent-swm-state.js.map +1 -1
  117. package/dist/dkg-agent-swm-substrate.d.ts +2 -0
  118. package/dist/dkg-agent-swm-substrate.d.ts.map +1 -1
  119. package/dist/dkg-agent-swm-substrate.js +110 -53
  120. package/dist/dkg-agent-swm-substrate.js.map +1 -1
  121. package/dist/dkg-agent-types.d.ts +62 -26
  122. package/dist/dkg-agent-types.d.ts.map +1 -1
  123. package/dist/dkg-agent-types.js.map +1 -1
  124. package/dist/dkg-agent-vm-promotion.d.ts +2 -0
  125. package/dist/dkg-agent-vm-promotion.d.ts.map +1 -1
  126. package/dist/dkg-agent-vm-promotion.js +39 -5
  127. package/dist/dkg-agent-vm-promotion.js.map +1 -1
  128. package/dist/dkg-agent.d.ts +8 -1
  129. package/dist/dkg-agent.d.ts.map +1 -1
  130. package/dist/dkg-agent.js +75 -45
  131. package/dist/dkg-agent.js.map +1 -1
  132. package/dist/exact-graph-content-verifier.d.ts.map +1 -1
  133. package/dist/exact-graph-content-verifier.js +3 -2
  134. package/dist/exact-graph-content-verifier.js.map +1 -1
  135. package/dist/finalization-handler.d.ts +19 -207
  136. package/dist/finalization-handler.d.ts.map +1 -1
  137. package/dist/finalization-handler.js +79 -1646
  138. package/dist/finalization-handler.js.map +1 -1
  139. package/dist/finalization-recovery-worker.js +1 -1
  140. package/dist/finalization-recovery-worker.js.map +1 -1
  141. package/dist/finalized-authority-cold-resolution.d.ts +6 -1
  142. package/dist/finalized-authority-cold-resolution.d.ts.map +1 -1
  143. package/dist/finalized-authority-cold-resolution.js +22 -3
  144. package/dist/finalized-authority-cold-resolution.js.map +1 -1
  145. package/dist/gossip-session.d.ts +29 -0
  146. package/dist/gossip-session.d.ts.map +1 -0
  147. package/dist/gossip-session.js +48 -0
  148. package/dist/gossip-session.js.map +1 -0
  149. package/dist/index.d.ts +3 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +4 -0
  152. package/dist/index.js.map +1 -1
  153. package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.d.ts +5 -5
  154. package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.d.ts.map +1 -1
  155. package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.js +59 -49
  156. package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.js.map +1 -1
  157. package/dist/internal/context-graph-authority/finalized-target-projection.d.ts +17 -0
  158. package/dist/internal/context-graph-authority/finalized-target-projection.d.ts.map +1 -0
  159. package/dist/internal/context-graph-authority/finalized-target-projection.js +36 -0
  160. package/dist/internal/context-graph-authority/finalized-target-projection.js.map +1 -0
  161. package/dist/internal/context-graph-authority/swm-transport-authority.d.ts +43 -7
  162. package/dist/internal/context-graph-authority/swm-transport-authority.d.ts.map +1 -1
  163. package/dist/internal/context-graph-authority/swm-transport-authority.js +135 -18
  164. package/dist/internal/context-graph-authority/swm-transport-authority.js.map +1 -1
  165. package/dist/internal/context-graph-binding-abort.d.ts +3 -0
  166. package/dist/internal/context-graph-binding-abort.d.ts.map +1 -0
  167. package/dist/internal/context-graph-binding-abort.js +32 -0
  168. package/dist/internal/context-graph-binding-abort.js.map +1 -0
  169. package/dist/internal/context-graph-cache-invalidating-store.d.ts +3 -0
  170. package/dist/internal/context-graph-cache-invalidating-store.d.ts.map +1 -0
  171. package/dist/internal/context-graph-cache-invalidating-store.js +167 -0
  172. package/dist/internal/context-graph-cache-invalidating-store.js.map +1 -0
  173. package/dist/internal/context-graph-meta-record-copy.d.ts +3 -0
  174. package/dist/internal/context-graph-meta-record-copy.d.ts.map +1 -0
  175. package/dist/internal/context-graph-meta-record-copy.js +21 -0
  176. package/dist/internal/context-graph-meta-record-copy.js.map +1 -0
  177. package/dist/internal/gossip/host-mode-handler.d.ts +11 -0
  178. package/dist/internal/gossip/host-mode-handler.d.ts.map +1 -0
  179. package/dist/internal/gossip/host-mode-handler.js +41 -0
  180. package/dist/internal/gossip/host-mode-handler.js.map +1 -0
  181. package/dist/internal/join-encryption-key-bundle.d.ts +10 -0
  182. package/dist/internal/join-encryption-key-bundle.d.ts.map +1 -0
  183. package/dist/internal/join-encryption-key-bundle.js +72 -0
  184. package/dist/internal/join-encryption-key-bundle.js.map +1 -0
  185. package/dist/internal/knowledge-asset-vm-publish-request.d.ts +31 -0
  186. package/dist/internal/knowledge-asset-vm-publish-request.d.ts.map +1 -0
  187. package/dist/internal/knowledge-asset-vm-publish-request.js +91 -0
  188. package/dist/internal/knowledge-asset-vm-publish-request.js.map +1 -0
  189. package/dist/internal/lifecycle-sync-policy.d.ts +5 -0
  190. package/dist/internal/lifecycle-sync-policy.d.ts.map +1 -0
  191. package/dist/internal/lifecycle-sync-policy.js +12 -0
  192. package/dist/internal/lifecycle-sync-policy.js.map +1 -0
  193. package/dist/internal/local-private-member.d.ts +14 -0
  194. package/dist/internal/local-private-member.d.ts.map +1 -0
  195. package/dist/internal/local-private-member.js +21 -0
  196. package/dist/internal/local-private-member.js.map +1 -0
  197. package/dist/internal/promote/assertion-promote-precommit.d.ts +41 -1
  198. package/dist/internal/promote/assertion-promote-precommit.d.ts.map +1 -1
  199. package/dist/internal/promote/assertion-promote-precommit.js +74 -5
  200. package/dist/internal/promote/assertion-promote-precommit.js.map +1 -1
  201. package/dist/internal/storage-ack-owned-request.d.ts +16 -0
  202. package/dist/internal/storage-ack-owned-request.d.ts.map +1 -0
  203. package/dist/internal/storage-ack-owned-request.js +16 -0
  204. package/dist/internal/storage-ack-owned-request.js.map +1 -0
  205. package/dist/internal/vm-reconcile-local-admission-wait.d.ts +96 -0
  206. package/dist/internal/vm-reconcile-local-admission-wait.d.ts.map +1 -0
  207. package/dist/internal/vm-reconcile-local-admission-wait.js +226 -0
  208. package/dist/internal/vm-reconcile-local-admission-wait.js.map +1 -0
  209. package/dist/internal/vm-reconcile-read-authority.d.ts +27 -0
  210. package/dist/internal/vm-reconcile-read-authority.d.ts.map +1 -0
  211. package/dist/internal/vm-reconcile-read-authority.js +33 -0
  212. package/dist/internal/vm-reconcile-read-authority.js.map +1 -0
  213. package/dist/internal/vm-reconcile-sweep-admission.d.ts +2 -0
  214. package/dist/internal/vm-reconcile-sweep-admission.d.ts.map +1 -1
  215. package/dist/internal/vm-reconcile-sweep.d.ts +16 -4
  216. package/dist/internal/vm-reconcile-sweep.d.ts.map +1 -1
  217. package/dist/internal/vm-reconcile-sweep.js +91 -50
  218. package/dist/internal/vm-reconcile-sweep.js.map +1 -1
  219. package/dist/internal/workspace-projected-delegatees.d.ts +3 -0
  220. package/dist/internal/workspace-projected-delegatees.d.ts.map +1 -0
  221. package/dist/internal/workspace-projected-delegatees.js +34 -0
  222. package/dist/internal/workspace-projected-delegatees.js.map +1 -0
  223. package/dist/join-approval-restart-projection.d.ts +14 -0
  224. package/dist/join-approval-restart-projection.d.ts.map +1 -0
  225. package/dist/join-approval-restart-projection.js +32 -0
  226. package/dist/join-approval-restart-projection.js.map +1 -0
  227. package/dist/keyed-persist-scheduler.d.ts +72 -0
  228. package/dist/keyed-persist-scheduler.d.ts.map +1 -0
  229. package/dist/keyed-persist-scheduler.js +140 -0
  230. package/dist/keyed-persist-scheduler.js.map +1 -0
  231. package/dist/map-with-concurrency.d.ts +7 -0
  232. package/dist/map-with-concurrency.d.ts.map +1 -1
  233. package/dist/map-with-concurrency.js +36 -0
  234. package/dist/map-with-concurrency.js.map +1 -1
  235. package/dist/p2p/network-admission-coordinator.d.ts +15 -0
  236. package/dist/p2p/network-admission-coordinator.d.ts.map +1 -1
  237. package/dist/p2p/network-admission-coordinator.js +20 -2
  238. package/dist/p2p/network-admission-coordinator.js.map +1 -1
  239. package/dist/prepare-unscoped-context-graph-read-checks.d.ts.map +1 -1
  240. package/dist/prepare-unscoped-context-graph-read-checks.js +12 -0
  241. package/dist/prepare-unscoped-context-graph-read-checks.js.map +1 -1
  242. package/dist/registered-context-graph-authority.d.ts +7 -0
  243. package/dist/registered-context-graph-authority.d.ts.map +1 -1
  244. package/dist/registered-private-empty-vm-attempt-v1.d.ts +34 -0
  245. package/dist/registered-private-empty-vm-attempt-v1.d.ts.map +1 -0
  246. package/dist/registered-private-empty-vm-attempt-v1.js +120 -0
  247. package/dist/registered-private-empty-vm-attempt-v1.js.map +1 -0
  248. package/dist/reserved-ka-id-allocation.d.ts +12 -0
  249. package/dist/reserved-ka-id-allocation.d.ts.map +1 -0
  250. package/dist/reserved-ka-id-allocation.js +25 -0
  251. package/dist/reserved-ka-id-allocation.js.map +1 -0
  252. package/dist/rfc64/authority-rpc-circuit-breaker-v1.d.ts +5 -3
  253. package/dist/rfc64/authority-rpc-circuit-breaker-v1.d.ts.map +1 -1
  254. package/dist/rfc64/authority-rpc-circuit-breaker-v1.js +9 -0
  255. package/dist/rfc64/authority-rpc-circuit-breaker-v1.js.map +1 -1
  256. package/dist/rfc64/catalog-completion-evidence-v1.d.ts +38 -0
  257. package/dist/rfc64/catalog-completion-evidence-v1.d.ts.map +1 -0
  258. package/dist/rfc64/catalog-completion-evidence-v1.js +49 -0
  259. package/dist/rfc64/catalog-completion-evidence-v1.js.map +1 -0
  260. package/dist/rfc64/catalog-operational-applied-heads-v1.d.ts +6 -3
  261. package/dist/rfc64/catalog-operational-applied-heads-v1.d.ts.map +1 -1
  262. package/dist/rfc64/catalog-operational-applied-heads-v1.js +6 -3
  263. package/dist/rfc64/catalog-operational-applied-heads-v1.js.map +1 -1
  264. package/dist/rfc64/catalog-operational-reads-v1.d.ts +13 -0
  265. package/dist/rfc64/catalog-operational-reads-v1.d.ts.map +1 -0
  266. package/dist/rfc64/catalog-operational-reads-v1.js +56 -0
  267. package/dist/rfc64/catalog-operational-reads-v1.js.map +1 -0
  268. package/dist/rfc64/catalog-operational-targets-v1.d.ts +55 -0
  269. package/dist/rfc64/catalog-operational-targets-v1.d.ts.map +1 -0
  270. package/dist/rfc64/catalog-operational-targets-v1.js +379 -0
  271. package/dist/rfc64/catalog-operational-targets-v1.js.map +1 -0
  272. package/dist/rfc64/catalog-replay-recovery-runtime-v1.d.ts +2 -0
  273. package/dist/rfc64/catalog-replay-recovery-runtime-v1.d.ts.map +1 -1
  274. package/dist/rfc64/catalog-replay-recovery-runtime-v1.js +18 -25
  275. package/dist/rfc64/catalog-replay-recovery-runtime-v1.js.map +1 -1
  276. package/dist/rfc64/legacy-swm-boundary-codec-v1.d.ts +25 -0
  277. package/dist/rfc64/legacy-swm-boundary-codec-v1.d.ts.map +1 -0
  278. package/dist/rfc64/legacy-swm-boundary-codec-v1.js +127 -0
  279. package/dist/rfc64/legacy-swm-boundary-codec-v1.js.map +1 -0
  280. package/dist/rfc64/legacy-swm-boundary-v1.d.ts +12 -0
  281. package/dist/rfc64/legacy-swm-boundary-v1.d.ts.map +1 -1
  282. package/dist/rfc64/legacy-swm-boundary-v1.js +83 -144
  283. package/dist/rfc64/legacy-swm-boundary-v1.js.map +1 -1
  284. package/dist/rfc64/private-catalog-subscription-readiness-v1.d.ts +33 -0
  285. package/dist/rfc64/private-catalog-subscription-readiness-v1.d.ts.map +1 -0
  286. package/dist/rfc64/private-catalog-subscription-readiness-v1.js +97 -0
  287. package/dist/rfc64/private-catalog-subscription-readiness-v1.js.map +1 -0
  288. package/dist/rfc64/private-read-roster-v1.d.ts +14 -0
  289. package/dist/rfc64/private-read-roster-v1.d.ts.map +1 -0
  290. package/dist/rfc64/private-read-roster-v1.js +57 -0
  291. package/dist/rfc64/private-read-roster-v1.js.map +1 -0
  292. package/dist/rfc64/registered-private-empty-vm-proof-v1.d.ts +20 -0
  293. package/dist/rfc64/registered-private-empty-vm-proof-v1.d.ts.map +1 -0
  294. package/dist/rfc64/registered-private-empty-vm-proof-v1.js +26 -0
  295. package/dist/rfc64/registered-private-empty-vm-proof-v1.js.map +1 -0
  296. package/dist/rfc64/swm-inventory-shadow-runtime-v1.d.ts +3 -1
  297. package/dist/rfc64/swm-inventory-shadow-runtime-v1.d.ts.map +1 -1
  298. package/dist/rfc64/swm-inventory-shadow-runtime-v1.js +34 -0
  299. package/dist/rfc64/swm-inventory-shadow-runtime-v1.js.map +1 -1
  300. package/dist/sync/auth/pipe-request-tail.d.ts +5 -1
  301. package/dist/sync/auth/pipe-request-tail.d.ts.map +1 -1
  302. package/dist/sync/auth/pipe-request-tail.js +13 -3
  303. package/dist/sync/auth/pipe-request-tail.js.map +1 -1
  304. package/dist/sync/auth/request-build.d.ts +3 -0
  305. package/dist/sync/auth/request-build.d.ts.map +1 -1
  306. package/dist/sync/auth/request-build.js +11 -2
  307. package/dist/sync/auth/request-build.js.map +1 -1
  308. package/dist/sync/backpressure.d.ts +27 -16
  309. package/dist/sync/backpressure.d.ts.map +1 -1
  310. package/dist/sync/backpressure.js +66 -40
  311. package/dist/sync/backpressure.js.map +1 -1
  312. package/dist/sync/catchup-policy.d.ts +2 -0
  313. package/dist/sync/catchup-policy.d.ts.map +1 -1
  314. package/dist/sync/catchup-policy.js +2 -0
  315. package/dist/sync/catchup-policy.js.map +1 -1
  316. package/dist/sync/exact-assets.d.ts +7 -5
  317. package/dist/sync/exact-assets.d.ts.map +1 -1
  318. package/dist/sync/exact-assets.js +13 -8
  319. package/dist/sync/exact-assets.js.map +1 -1
  320. package/dist/sync/exact-batch-observation.d.ts +3 -0
  321. package/dist/sync/exact-batch-observation.d.ts.map +1 -0
  322. package/dist/sync/exact-batch-observation.js +13 -0
  323. package/dist/sync/exact-batch-observation.js.map +1 -0
  324. package/dist/sync/exact-batch-stream-capability.d.ts +24 -0
  325. package/dist/sync/exact-batch-stream-capability.d.ts.map +1 -0
  326. package/dist/sync/exact-batch-stream-capability.js +88 -0
  327. package/dist/sync/exact-batch-stream-capability.js.map +1 -0
  328. package/dist/sync/exact-batch-stream-contract.d.ts +78 -0
  329. package/dist/sync/exact-batch-stream-contract.d.ts.map +1 -0
  330. package/dist/sync/exact-batch-stream-contract.js +206 -0
  331. package/dist/sync/exact-batch-stream-contract.js.map +1 -0
  332. package/dist/sync/peer-connection.d.ts.map +1 -1
  333. package/dist/sync/peer-connection.js +11 -2
  334. package/dist/sync/peer-connection.js.map +1 -1
  335. package/dist/sync/priority-admission-queue.d.ts +17 -0
  336. package/dist/sync/priority-admission-queue.d.ts.map +1 -1
  337. package/dist/sync/priority-admission-queue.js +58 -37
  338. package/dist/sync/priority-admission-queue.js.map +1 -1
  339. package/dist/sync/requester/admission-boundary.d.ts +12 -0
  340. package/dist/sync/requester/admission-boundary.d.ts.map +1 -0
  341. package/dist/sync/requester/admission-boundary.js +22 -0
  342. package/dist/sync/requester/admission-boundary.js.map +1 -0
  343. package/dist/sync/requester/durable-sync.d.ts +2 -1
  344. package/dist/sync/requester/durable-sync.d.ts.map +1 -1
  345. package/dist/sync/requester/durable-sync.js +3 -188
  346. package/dist/sync/requester/durable-sync.js.map +1 -1
  347. package/dist/sync/requester/exact-batch-stream-driver.d.ts +83 -0
  348. package/dist/sync/requester/exact-batch-stream-driver.d.ts.map +1 -0
  349. package/dist/sync/requester/exact-batch-stream-driver.js +299 -0
  350. package/dist/sync/requester/exact-batch-stream-driver.js.map +1 -0
  351. package/dist/sync/requester/exact-batch-stream.d.ts +72 -0
  352. package/dist/sync/requester/exact-batch-stream.d.ts.map +1 -0
  353. package/dist/sync/requester/exact-batch-stream.js +267 -0
  354. package/dist/sync/requester/exact-batch-stream.js.map +1 -0
  355. package/dist/sync/requester/exact-recovery-transport.d.ts +19 -0
  356. package/dist/sync/requester/exact-recovery-transport.d.ts.map +1 -0
  357. package/dist/sync/requester/exact-recovery-transport.js +3 -0
  358. package/dist/sync/requester/exact-recovery-transport.js.map +1 -0
  359. package/dist/sync/requester/finalized-swm-twin-reconciliation.js +12 -3
  360. package/dist/sync/requester/finalized-swm-twin-reconciliation.js.map +1 -1
  361. package/dist/sync/requester/graph-scoped-materialization.d.ts.map +1 -1
  362. package/dist/sync/requester/graph-scoped-materialization.js +58 -24
  363. package/dist/sync/requester/graph-scoped-materialization.js.map +1 -1
  364. package/dist/sync/requester/page-fetch.d.ts +7 -0
  365. package/dist/sync/requester/page-fetch.d.ts.map +1 -1
  366. package/dist/sync/requester/page-fetch.js +103 -49
  367. package/dist/sync/requester/page-fetch.js.map +1 -1
  368. package/dist/sync/requester/shared-memory-sync.d.ts +10 -5
  369. package/dist/sync/requester/shared-memory-sync.d.ts.map +1 -1
  370. package/dist/sync/requester/shared-memory-sync.js +149 -150
  371. package/dist/sync/requester/shared-memory-sync.js.map +1 -1
  372. package/dist/sync/requester/swm-materialization-memo.d.ts +12 -0
  373. package/dist/sync/requester/swm-materialization-memo.d.ts.map +1 -0
  374. package/dist/sync/requester/swm-materialization-memo.js +54 -0
  375. package/dist/sync/requester/swm-materialization-memo.js.map +1 -0
  376. package/dist/sync/requester/swm-recovery.d.ts +3 -29
  377. package/dist/sync/requester/swm-recovery.d.ts.map +1 -1
  378. package/dist/sync/requester/swm-recovery.js +11 -10
  379. package/dist/sync/requester/swm-recovery.js.map +1 -1
  380. package/dist/sync/requester/swm-snapshot-materializer.d.ts.map +1 -1
  381. package/dist/sync/requester/swm-snapshot-materializer.js +18 -0
  382. package/dist/sync/requester/swm-snapshot-materializer.js.map +1 -1
  383. package/dist/sync/requester/swm-target-executor.d.ts +6 -0
  384. package/dist/sync/requester/swm-target-executor.d.ts.map +1 -1
  385. package/dist/sync/requester/swm-target-executor.js +24 -3
  386. package/dist/sync/requester/swm-target-executor.js.map +1 -1
  387. package/dist/sync/requester/verified-asset-preparation.d.ts +9 -0
  388. package/dist/sync/requester/verified-asset-preparation.d.ts.map +1 -0
  389. package/dist/sync/requester/verified-asset-preparation.js +190 -0
  390. package/dist/sync/requester/verified-asset-preparation.js.map +1 -0
  391. package/dist/sync/responder/asset-metadata.d.ts +18 -0
  392. package/dist/sync/responder/asset-metadata.d.ts.map +1 -0
  393. package/dist/sync/responder/asset-metadata.js +27 -0
  394. package/dist/sync/responder/asset-metadata.js.map +1 -0
  395. package/dist/sync/responder/durable-data-request-policy.d.ts +2 -16
  396. package/dist/sync/responder/durable-data-request-policy.d.ts.map +1 -1
  397. package/dist/sync/responder/durable-data-request-policy.js +1 -31
  398. package/dist/sync/responder/durable-data-request-policy.js.map +1 -1
  399. package/dist/sync/responder/exact-asset-export-cache.d.ts +89 -0
  400. package/dist/sync/responder/exact-asset-export-cache.d.ts.map +1 -0
  401. package/dist/sync/responder/exact-asset-export-cache.js +550 -0
  402. package/dist/sync/responder/exact-asset-export-cache.js.map +1 -0
  403. package/dist/sync/responder/exact-batch-stream.d.ts +47 -0
  404. package/dist/sync/responder/exact-batch-stream.d.ts.map +1 -0
  405. package/dist/sync/responder/exact-batch-stream.js +151 -0
  406. package/dist/sync/responder/exact-batch-stream.js.map +1 -0
  407. package/dist/sync/responder/exact-data-session.d.ts +67 -0
  408. package/dist/sync/responder/exact-data-session.d.ts.map +1 -0
  409. package/dist/sync/responder/exact-data-session.js +130 -0
  410. package/dist/sync/responder/exact-data-session.js.map +1 -0
  411. package/dist/sync/responder/exact-graph-cursor-filter.d.ts +9 -0
  412. package/dist/sync/responder/exact-graph-cursor-filter.d.ts.map +1 -0
  413. package/dist/sync/responder/exact-graph-cursor-filter.js +101 -0
  414. package/dist/sync/responder/exact-graph-cursor-filter.js.map +1 -0
  415. package/dist/sync/responder/exact-graph-reader.d.ts +95 -0
  416. package/dist/sync/responder/exact-graph-reader.d.ts.map +1 -0
  417. package/dist/sync/responder/exact-graph-reader.js +623 -0
  418. package/dist/sync/responder/exact-graph-reader.js.map +1 -0
  419. package/dist/sync/responder/exact-page-reader.d.ts +37 -0
  420. package/dist/sync/responder/exact-page-reader.d.ts.map +1 -0
  421. package/dist/sync/responder/exact-page-reader.js +130 -0
  422. package/dist/sync/responder/exact-page-reader.js.map +1 -0
  423. package/dist/sync/responder/graph-plan.d.ts +19 -85
  424. package/dist/sync/responder/graph-plan.d.ts.map +1 -1
  425. package/dist/sync/responder/graph-plan.js +51 -988
  426. package/dist/sync/responder/graph-plan.js.map +1 -1
  427. package/dist/sync/responder/page-framing-policy.d.ts +31 -0
  428. package/dist/sync/responder/page-framing-policy.d.ts.map +1 -0
  429. package/dist/sync/responder/page-framing-policy.js +41 -0
  430. package/dist/sync/responder/page-framing-policy.js.map +1 -0
  431. package/dist/sync/responder/responder-row-page.d.ts +85 -0
  432. package/dist/sync/responder/responder-row-page.d.ts.map +1 -0
  433. package/dist/sync/responder/responder-row-page.js +181 -0
  434. package/dist/sync/responder/responder-row-page.js.map +1 -0
  435. package/dist/sync/responder/row-serialization.d.ts +34 -0
  436. package/dist/sync/responder/row-serialization.d.ts.map +1 -0
  437. package/dist/sync/responder/row-serialization.js +69 -0
  438. package/dist/sync/responder/row-serialization.js.map +1 -0
  439. package/dist/sync/responder/session-plan-memo.d.ts +20 -0
  440. package/dist/sync/responder/session-plan-memo.d.ts.map +1 -0
  441. package/dist/sync/responder/session-plan-memo.js +135 -0
  442. package/dist/sync/responder/session-plan-memo.js.map +1 -0
  443. package/dist/sync/responder/sync-handler.d.ts +18 -1
  444. package/dist/sync/responder/sync-handler.d.ts.map +1 -1
  445. package/dist/sync/responder/sync-handler.js +101 -57
  446. package/dist/sync/responder/sync-handler.js.map +1 -1
  447. package/dist/sync/shared-memory-completion.d.ts +30 -0
  448. package/dist/sync/shared-memory-completion.d.ts.map +1 -1
  449. package/dist/sync/shared-memory-completion.js +13 -0
  450. package/dist/sync/shared-memory-completion.js.map +1 -1
  451. package/dist/sync/wire-compression.d.ts +47 -0
  452. package/dist/sync/wire-compression.d.ts.map +1 -0
  453. package/dist/sync/wire-compression.js +111 -0
  454. package/dist/sync/wire-compression.js.map +1 -0
  455. package/dist/unscoped-query-consistency.d.ts +12 -0
  456. package/dist/unscoped-query-consistency.d.ts.map +1 -1
  457. package/dist/unscoped-query-consistency.js +17 -1
  458. package/dist/unscoped-query-consistency.js.map +1 -1
  459. package/dist/vm-promotion-audit.d.ts +2 -2
  460. package/dist/vm-promotion-audit.d.ts.map +1 -1
  461. package/dist/vm-promotion-audit.js +26 -9
  462. package/dist/vm-promotion-audit.js.map +1 -1
  463. package/dist/vm-reconcile-dispatcher.d.ts +42 -1
  464. package/dist/vm-reconcile-dispatcher.d.ts.map +1 -1
  465. package/dist/vm-reconcile-dispatcher.js +103 -4
  466. package/dist/vm-reconcile-dispatcher.js.map +1 -1
  467. package/dist/vm-reconcile-peer-topology.d.ts +7 -9
  468. package/dist/vm-reconcile-peer-topology.d.ts.map +1 -1
  469. package/dist/vm-reconcile-peer-topology.js +1 -37
  470. package/dist/vm-reconcile-peer-topology.js.map +1 -1
  471. package/dist/vm-recovery-candidate-order.d.ts +16 -0
  472. package/dist/vm-recovery-candidate-order.d.ts.map +1 -0
  473. package/dist/vm-recovery-candidate-order.js +24 -0
  474. package/dist/vm-recovery-candidate-order.js.map +1 -0
  475. package/dist/vm-recovery-core-transport-preference.d.ts +69 -0
  476. package/dist/vm-recovery-core-transport-preference.d.ts.map +1 -0
  477. package/dist/vm-recovery-core-transport-preference.js +131 -0
  478. package/dist/vm-recovery-core-transport-preference.js.map +1 -0
  479. package/dist/vm-recovery-experiment-policy.d.ts +24 -0
  480. package/dist/vm-recovery-experiment-policy.d.ts.map +1 -0
  481. package/dist/vm-recovery-experiment-policy.js +18 -0
  482. package/dist/vm-recovery-experiment-policy.js.map +1 -0
  483. package/dist/vm-recovery-footprint.d.ts +54 -0
  484. package/dist/vm-recovery-footprint.d.ts.map +1 -1
  485. package/dist/vm-recovery-footprint.js +88 -24
  486. package/dist/vm-recovery-footprint.js.map +1 -1
  487. package/dist/vm-recovery-microbatch.d.ts +2 -0
  488. package/dist/vm-recovery-microbatch.d.ts.map +1 -1
  489. package/dist/vm-recovery-microbatch.js +7 -3
  490. package/dist/vm-recovery-microbatch.js.map +1 -1
  491. package/dist/vm-recovery-pass-authority.d.ts +84 -0
  492. package/dist/vm-recovery-pass-authority.d.ts.map +1 -0
  493. package/dist/vm-recovery-pass-authority.js +126 -0
  494. package/dist/vm-recovery-pass-authority.js.map +1 -0
  495. package/dist/vm-recovery-phase-timing.d.ts +75 -0
  496. package/dist/vm-recovery-phase-timing.d.ts.map +1 -0
  497. package/dist/vm-recovery-phase-timing.js +236 -0
  498. package/dist/vm-recovery-phase-timing.js.map +1 -0
  499. package/dist/vm-recovery-preparation.d.ts +143 -0
  500. package/dist/vm-recovery-preparation.d.ts.map +1 -0
  501. package/dist/vm-recovery-preparation.js +433 -0
  502. package/dist/vm-recovery-preparation.js.map +1 -0
  503. package/dist/vm-recovery-provider-policy.d.ts +13 -1
  504. package/dist/vm-recovery-provider-policy.d.ts.map +1 -1
  505. package/dist/vm-recovery-provider-policy.js +37 -5
  506. package/dist/vm-recovery-provider-policy.js.map +1 -1
  507. package/dist/vm-recovery-stream-profile.d.ts +15 -0
  508. package/dist/vm-recovery-stream-profile.d.ts.map +1 -0
  509. package/dist/vm-recovery-stream-profile.js +53 -0
  510. package/dist/vm-recovery-stream-profile.js.map +1 -0
  511. package/dist/vm-recovery-stream-setback-policy.d.ts +54 -0
  512. package/dist/vm-recovery-stream-setback-policy.d.ts.map +1 -0
  513. package/dist/vm-recovery-stream-setback-policy.js +85 -0
  514. package/dist/vm-recovery-stream-setback-policy.js.map +1 -0
  515. package/dist/vm-recovery-timing-observer.d.ts +27 -0
  516. package/dist/vm-recovery-timing-observer.d.ts.map +1 -0
  517. package/dist/vm-recovery-timing-observer.js +49 -0
  518. package/dist/vm-recovery-timing-observer.js.map +1 -0
  519. package/dist/vm-recovery-transport-budget-policy.d.ts +32 -0
  520. package/dist/vm-recovery-transport-budget-policy.d.ts.map +1 -0
  521. package/dist/vm-recovery-transport-budget-policy.js +55 -0
  522. package/dist/vm-recovery-transport-budget-policy.js.map +1 -0
  523. package/dist/vm-recovery-transport-plan.d.ts +83 -0
  524. package/dist/vm-recovery-transport-plan.d.ts.map +1 -0
  525. package/dist/vm-recovery-transport-plan.js +117 -0
  526. package/dist/vm-recovery-transport-plan.js.map +1 -0
  527. package/package.json +17 -9
  528. package/dist/finalization-annotations.d.ts +0 -5
  529. package/dist/finalization-annotations.d.ts.map +0 -1
  530. package/dist/finalization-annotations.js +0 -6
  531. package/dist/finalization-annotations.js.map +0 -1
  532. package/dist/swm-ka-bound.d.ts +0 -21
  533. package/dist/swm-ka-bound.d.ts.map +0 -1
  534. package/dist/swm-ka-bound.js +0 -36
  535. package/dist/swm-ka-bound.js.map +0 -1
@@ -0,0 +1,72 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { createHash } from 'node:crypto';
3
+ import { WORKSPACE_AGENT_ENCRYPTION_KEY_ALGORITHM_X25519, decodeWorkspaceEncryptionKey, workspaceAgentEncryptionKeyId } from '@origintrail-official/dkg-core';
4
+ import { ethers } from 'ethers';
5
+ import { computeWorkspaceEncryptionKeysAttestationDigest, verifyAgentDelegation } from '../auth/agent-delegation.js';
6
+ import { verifyWorkspaceEncryptionKeyBinding } from '../agent-keystore.js';
7
+ const JOIN_ENCRYPTION_KEY_LIMIT = 8;
8
+ export function verifiedDelegationKeyIds(agentAddress, keys) {
9
+ return new Set(keys.map((key) => workspaceAgentEncryptionKeyId(agentAddress, decodeWorkspaceEncryptionKey(key.publicEncryptionKey)).toLowerCase()));
10
+ }
11
+ export function verifyJoinEncryptionKeyBundle(delegation, carrierPeerId) {
12
+ const keys = delegation.workspaceEncryptionKeys;
13
+ if (keys === undefined)
14
+ return null;
15
+ if (!Array.isArray(keys) || keys.length === 0 || keys.length > JOIN_ENCRYPTION_KEY_LIMIT) {
16
+ throw new Error(`Join request must carry between 1 and ${JOIN_ENCRYPTION_KEY_LIMIT} workspace encryption keys.`);
17
+ }
18
+ // Preserve the existing admission contract for a signed carrier mismatch:
19
+ // policy evaluation reports a bounded pending decision. Do not accept the
20
+ // bundle because the carrier has not proven it is the signed delegatee.
21
+ if (delegation.delegateePeerId !== carrierPeerId)
22
+ return null;
23
+ // issuedAtMs becomes the durable cross-CG cache high-water, so authenticate
24
+ // the base delegation here as well as at the admission boundary.
25
+ verifyAgentDelegation(delegation);
26
+ if (!Number.isSafeInteger(delegation.issuedAtMs) || delegation.issuedAtMs < 0) {
27
+ throw new Error('Join request carries an invalid encryption-key freshness timestamp.');
28
+ }
29
+ const verified = keys.map((key) => {
30
+ if (key === null
31
+ || typeof key !== 'object'
32
+ || key.encryptionKeyAlgorithm !== WORKSPACE_AGENT_ENCRYPTION_KEY_ALGORITHM_X25519
33
+ || typeof key.publicEncryptionKey !== 'string'
34
+ || typeof key.encryptionKeyProof !== 'string') {
35
+ throw new Error('Join request carries a malformed workspace encryption key.');
36
+ }
37
+ let valid = false;
38
+ try {
39
+ valid = verifyWorkspaceEncryptionKeyBinding(delegation.agentAddress, key.encryptionKeyAlgorithm, key.publicEncryptionKey, key.encryptionKeyProof);
40
+ }
41
+ catch {
42
+ valid = false;
43
+ }
44
+ if (!valid) {
45
+ throw new Error('Join request carries an invalid workspace encryption key proof.');
46
+ }
47
+ return key;
48
+ });
49
+ if (typeof delegation.workspaceEncryptionKeysSignature !== 'string') {
50
+ throw new Error('Join request is missing its workspace encryption-key attestation.');
51
+ }
52
+ let attestationSigner = '';
53
+ try {
54
+ attestationSigner = ethers.verifyMessage(computeWorkspaceEncryptionKeysAttestationDigest(delegation), delegation.workspaceEncryptionKeysSignature);
55
+ }
56
+ catch {
57
+ attestationSigner = '';
58
+ }
59
+ if (attestationSigner.toLowerCase() !== delegation.agentAddress.toLowerCase()) {
60
+ throw new Error('Join request carries an invalid workspace encryption-key attestation.');
61
+ }
62
+ const canonicalKeySet = [...new Set(verified.map((key) => JSON.stringify({
63
+ encryptionKeyAlgorithm: key.encryptionKeyAlgorithm,
64
+ publicEncryptionKey: key.publicEncryptionKey,
65
+ })))].sort();
66
+ return {
67
+ issuedAtMs: delegation.issuedAtMs,
68
+ keySetDigest: `0x${createHash('sha256').update(JSON.stringify(canonicalKeySet)).digest('hex')}`,
69
+ keys: verified,
70
+ };
71
+ }
72
+ //# sourceMappingURL=join-encryption-key-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-encryption-key-bundle.js","sourceRoot":"","sources":["../../src/internal/join-encryption-key-bundle.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,+CAA+C,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC9J,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,+CAA+C,EAAE,qBAAqB,EAA8B,MAAM,6BAA6B,CAAC;AACjJ,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAQpC,MAAM,UAAU,wBAAwB,CACtC,YAAoB,EACpB,IAA6C;IAE7C,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,6BAA6B,CAC5D,YAAY,EACZ,4BAA4B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CACtD,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,UAAiC,EACjC,aAAqB;IAErB,MAAM,IAAI,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAChD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAA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,CAAC;IACb,CAAC,CAAC,CAAC;IACH,IAAI,OAAO,UAAU,CAAC,gCAAgC,KAAK,QAAQ,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,iBAAiB,GAAG,MAAM,CAAC,aAAa,CACtC,+CAA+C,CAAC,UAAU,CAAC,EAC3D,UAAU,CAAC,gCAAgC,CAC5C,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB,GAAG,EAAE,CAAC;IACzB,CAAC;IACD,IAAI,iBAAiB,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9E,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;YACvE,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;SAC7C,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACb,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,YAAY,EAAE,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/F,IAAI,EAAE,QAAQ;KACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type AssertionSeal, GRAPH_KA_CONTENT_SCOPE_VERSION } from '@origintrail-official/dkg-core';
2
+ import { type PublishOptions, type KnowledgeAssetVmPublishRequest } from '@origintrail-official/dkg-publisher';
3
+ type KnowledgeAssetVmPublicationOperationPlan = {
4
+ readonly kind: 'initial';
5
+ readonly pricingPolicy: PublishOptions['pricingPolicy'];
6
+ } | {
7
+ readonly kind: 'update';
8
+ readonly vmCurrentAssertion: string;
9
+ };
10
+ /** One operation discriminator shared by admission, sync, and queued execution. */
11
+ export declare function planKnowledgeAssetVmPublication(input: {
12
+ readonly vmCurrentAssertion?: string;
13
+ readonly pricingPolicy?: PublishOptions['pricingPolicy'];
14
+ }): KnowledgeAssetVmPublicationOperationPlan;
15
+ /** Required immutable envelope consumed by graph-scoped queued publication. */
16
+ export type GraphScopedKnowledgeAssetVmPublishRequest = KnowledgeAssetVmPublishRequest & {
17
+ readonly contentScopeVersion: typeof GRAPH_KA_CONTENT_SCOPE_VERSION;
18
+ readonly kaUal: string;
19
+ readonly assertionVersion: string;
20
+ readonly publicTripleCount: number;
21
+ readonly privateTripleCount: number;
22
+ };
23
+ /** Narrow the existing persisted-envelope checks before any graph mutation. */
24
+ export declare function isGraphScopedKnowledgeAssetVmPublishRequest(request: KnowledgeAssetVmPublishRequest): request is GraphScopedKnowledgeAssetVmPublishRequest;
25
+ /** Rebuild the immutable graph-scoped seal carried by one queued VM request. */
26
+ export declare function assertionSealFromQueuedKnowledgeAssetVmPublishRequest(request: GraphScopedKnowledgeAssetVmPublishRequest): AssertionSeal;
27
+ export type KnowledgeAssetVmPublishRequestWithoutIntentKey = Omit<KnowledgeAssetVmPublishRequest, 'intentKey'>;
28
+ /** Canonical immutable projection of the persisted queued-publish request. */
29
+ export declare function createKnowledgeAssetVmPublishIntentKey(request: KnowledgeAssetVmPublishRequestWithoutIntentKey): string;
30
+ export {};
31
+ //# sourceMappingURL=knowledge-asset-vm-publish-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-asset-vm-publish-request.d.ts","sourceRoot":"","sources":["../../src/internal/knowledge-asset-vm-publish-request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B,EAAkC,MAAM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ifier: Apache-2.0
2
+ import { createHash } from 'node:crypto';
3
+ import { GRAPH_KA_CONTENT_SCOPE_VERSION, createGraphKnowledgeAssetScope } from '@origintrail-official/dkg-core';
4
+ import { assertPublicationPricingPolicyApplicable } from '@origintrail-official/dkg-publisher';
5
+ import { ethers } from 'ethers';
6
+ /** One operation discriminator shared by admission, sync, and queued execution. */
7
+ export function planKnowledgeAssetVmPublication(input) {
8
+ if (input.vmCurrentAssertion) {
9
+ assertPublicationPricingPolicyApplicable(input.pricingPolicy, { kind: 'update' });
10
+ return { kind: 'update', vmCurrentAssertion: input.vmCurrentAssertion };
11
+ }
12
+ assertPublicationPricingPolicyApplicable(input.pricingPolicy, {
13
+ kind: 'initial',
14
+ graphScoped: true,
15
+ });
16
+ return { kind: 'initial', pricingPolicy: input.pricingPolicy };
17
+ }
18
+ /** Narrow the existing persisted-envelope checks before any graph mutation. */
19
+ export function isGraphScopedKnowledgeAssetVmPublishRequest(request) {
20
+ return request.contentScopeVersion === GRAPH_KA_CONTENT_SCOPE_VERSION
21
+ && request.kaUal !== undefined
22
+ && request.assertionVersion !== undefined
23
+ && request.publicTripleCount !== undefined
24
+ && request.privateTripleCount !== undefined
25
+ && request.roots.length === 0;
26
+ }
27
+ /** Rebuild the immutable graph-scoped seal carried by one queued VM request. */
28
+ export function assertionSealFromQueuedKnowledgeAssetVmPublishRequest(request) {
29
+ const graphScope = createGraphKnowledgeAssetScope(request.kaUal, request.assertionVersion);
30
+ return {
31
+ merkleRoot: ethers.getBytes(request.seal.merkleRoot),
32
+ authorAddress: ethers.getAddress(request.seal.authorAddress),
33
+ authorAttestationR: ethers.getBytes(request.seal.signature.r),
34
+ authorAttestationVS: ethers.getBytes(request.seal.signature.vs),
35
+ authorSchemeVersion: request.seal.schemeVersion,
36
+ chainId: BigInt(request.sealChainId),
37
+ kav10Address: ethers.getAddress(request.sealKav10Address),
38
+ finalizedAtIso: request.sealFinalizedAtIso,
39
+ contentScopeVersion: GRAPH_KA_CONTENT_SCOPE_VERSION,
40
+ kaUal: graphScope.ual,
41
+ assertionVersion: graphScope.assertionVersion,
42
+ publicTripleCount: request.publicTripleCount,
43
+ ...(request.privateMerkleRoot
44
+ ? { privateMerkleRoot: ethers.getBytes(request.privateMerkleRoot) }
45
+ : {}),
46
+ privateTripleCount: request.privateTripleCount,
47
+ rootEntities: [],
48
+ ...(request.seal.reservedKaId !== undefined
49
+ ? { reservedKaId: BigInt(request.seal.reservedKaId) }
50
+ : {}),
51
+ };
52
+ }
53
+ /** Canonical immutable projection of the persisted queued-publish request. */
54
+ export function createKnowledgeAssetVmPublishIntentKey(request) {
55
+ const canonicalIntent = {
56
+ contextGraphId: request.contextGraphId,
57
+ name: request.name,
58
+ agentAddress: request.agentAddress ?? null,
59
+ subGraphName: request.subGraphName ?? null,
60
+ shareOperationId: request.shareOperationId,
61
+ roots: request.roots,
62
+ contentScopeVersion: request.contentScopeVersion ?? null,
63
+ kaUal: request.kaUal ?? null,
64
+ assertionVersion: request.assertionVersion ?? null,
65
+ publicTripleCount: request.publicTripleCount ?? null,
66
+ privateMerkleRoot: request.privateMerkleRoot?.toLowerCase() ?? null,
67
+ privateTripleCount: request.privateTripleCount ?? null,
68
+ accessPolicy: request.accessPolicy ?? null,
69
+ allowedPeers: request.allowedPeers ?? [],
70
+ entityProofs: request.entityProofs ?? null,
71
+ sealMerkleRoot: request.sealMerkleRoot.toLowerCase(),
72
+ seal: request.seal,
73
+ sealChainId: request.sealChainId,
74
+ sealKav10Address: request.sealKav10Address,
75
+ sealFinalizedAtIso: request.sealFinalizedAtIso,
76
+ wmCurrentAssertion: request.wmCurrentAssertion ?? null,
77
+ swmCurrentAssertion: request.swmCurrentAssertion ?? null,
78
+ vmCurrentAssertion: request.vmCurrentAssertion ?? null,
79
+ kaNumber: request.kaNumber ?? null,
80
+ reservedUal: request.reservedUal ?? null,
81
+ publishEpochs: request.publishEpochs ?? null,
82
+ // Keep the pre-feature canonical JSON unchanged when the policy is omitted.
83
+ ...(request.pricingPolicy !== undefined
84
+ ? { pricingPolicy: request.pricingPolicy }
85
+ : {}),
86
+ clearSharedMemoryAfter: request.clearSharedMemoryAfter ?? null,
87
+ publisherNodeIdentityIdOverride: request.publisherNodeIdentityIdOverride ?? null,
88
+ };
89
+ return `sha256:${createHash('sha256').update(JSON.stringify(canonicalIntent)).digest('hex')}`;
90
+ }
91
+ //# sourceMappingURL=knowledge-asset-vm-publish-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-asset-vm-publish-request.js","sourceRoot":"","sources":["../../src/internal/knowledge-asset-vm-publish-request.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAsB,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AACpI,OAAO,EAA4D,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AACzJ,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYhC,mFAAmF;AACnF,MAAM,UAAU,+BAA+B,CAAC,KAG/C;IACC,IAAI,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7B,wCAAwC,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAC1E,CAAC;IACD,wCAAwC,CAAC,KAAK,CAAC,aAAa,EAAE;QAC5D,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;AAWD,+EAA+E;AAC/E,MAAM,UAAU,2CAA2C,CACzD,OAAuC;IAEvC,OAAO,OAAO,CAAC,mBAAmB,KAAK,8BAA8B;WAChE,OAAO,CAAC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AO,CAAC,gBAAgB;QAC1C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,IAAI;QACtD,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,IAAI;QACxD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,IAAI;QACtD,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI;QAClC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;QACxC,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI;QAC5C,4EAA4E;QAC5E,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS;YACrC,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE;YAC1C,CAAC,CAAC,EAAE,CAAC;QACP,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,IAAI,IAAI;QAC9D,+BAA+B,EAC7B,OAAO,CAAC,+BAA+B,IAAI,IAAI;KAClD,CAAC;IACF,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAChG,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type DKGAgentConfig } from '../dkg-agent-types.js';
2
+ export declare function syncReconcilerEnabled(config: DKGAgentConfig): boolean;
3
+ export declare function syncOnConnectEnabled(config: DKGAgentConfig): boolean;
4
+ export declare function durableSyncEnabled(config: DKGAgentConfig): boolean;
5
+ //# sourceMappingURL=lifecycle-sync-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-sync-policy.d.ts","sourceRoot":"","sources":["../../src/internal/lifecycle-sync-policy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAElE"}
@@ -0,0 +1,12 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { resolveBooleanSwitch, resolveSyncReconcilerEnabled } from '../sync/backpressure.js';
3
+ export function syncReconcilerEnabled(config) {
4
+ return resolveSyncReconcilerEnabled(config.syncReconcilerEnabled);
5
+ }
6
+ export function syncOnConnectEnabled(config) {
7
+ return resolveBooleanSwitch(config.syncOnConnectEnabled, 'DKG_SYNC_ON_CONNECT_ENABLED', true);
8
+ }
9
+ export function durableSyncEnabled(config) {
10
+ return resolveBooleanSwitch(config.durableSyncEnabled, 'DKG_DURABLE_SYNC_ENABLED', true);
11
+ }
12
+ //# sourceMappingURL=lifecycle-sync-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-sync-policy.js","sourceRoot":"","sources":["../../src/internal/lifecycle-sync-policy.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAG7F,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,OAAO,4BAA4B,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,OAAO,oBAAoB,CAAC,MAAM,CAAC,oBAAoB,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,OAAO,oBAAoB,CAAC,MAAM,CAAC,kBAAkB,EAAE,0BAA0B,EAAE,IAAI,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Whether `meta` declares an explicit private policy (#865) and lists one of
3
+ * `localAgents` among its allowed agents, participants, curators or creators,
4
+ * and not among its revoked agents.
5
+ */
6
+ export declare function isLocalPrivateMember(meta: {
7
+ readonly accessPolicy?: string;
8
+ readonly allowedAgents: readonly string[];
9
+ readonly participantAgents: readonly string[];
10
+ readonly curators: readonly string[];
11
+ readonly creators: readonly string[];
12
+ readonly revokedAgents: readonly string[];
13
+ }, localAgents: readonly (string | undefined)[]): boolean;
14
+ //# sourceMappingURL=local-private-member.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-private-member.d.ts","sourceRoot":"","sources":["../../src/internal/local-private-member.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE;IACJ,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,EACD,WAAW,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAC3C,OAAO,CAWT"}
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /** A context graph member identity: a bare agent address or its `did:dkg:agent:` DID. */
3
+ function memberAgentAddress(value) {
4
+ const match = /^(?:did:dkg:agent:)?(0x[0-9a-fA-F]{40})$/.exec(value.trim());
5
+ return match?.[1]?.toLowerCase();
6
+ }
7
+ /**
8
+ * Whether `meta` declares an explicit private policy (#865) and lists one of
9
+ * `localAgents` among its allowed agents, participants, curators or creators,
10
+ * and not among its revoked agents.
11
+ */
12
+ export function isLocalPrivateMember(meta, localAgents) {
13
+ if (meta.accessPolicy?.trim().toLowerCase() !== 'private')
14
+ return false;
15
+ const revoked = new Set(meta.revokedAgents.map(memberAgentAddress));
16
+ const members = new Set([...meta.allowedAgents, ...meta.participantAgents, ...meta.curators, ...meta.creators]
17
+ .map(memberAgentAddress)
18
+ .filter((member) => member !== undefined && !revoked.has(member)));
19
+ return localAgents.some((local) => (local !== undefined && members.has(memberAgentAddress(local))));
20
+ }
21
+ //# sourceMappingURL=local-private-member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-private-member.js","sourceRoot":"","sources":["../../src/internal/local-private-member.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,yFAAyF;AACzF,SAAS,kBAAkB,CAAC,KAAa;IACvC,MAAM,KAAK,GAAG,0CAA0C,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5E,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAOC,EACD,WAA4C;IAE5C,IAAI,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;SACnF,GAAG,CAAC,kBAAkB,CAAC;SACvB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CACpE,CAAC;IACF,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACjC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAC9D,CAAC,CAAC;AACL,CAAC"}
@@ -16,11 +16,51 @@ type AssertionPromotePreCommitResult = {
16
16
  gossipSigner: GossipSigner;
17
17
  publisherOptions: PublisherAssertionPromoteOptions;
18
18
  };
19
+ /**
20
+ * The same translation for the root promote's boundary companion, which the
21
+ * publisher prepares synchronously. Only the retirement fence is transient:
22
+ * every other refusal from the prepare (unavailable persistence, the head
23
+ * limit, invalid input) is a hard failure and passes through unchanged.
24
+ */
25
+ export declare function translateLegacySwmRetirementFence<T>(prepare: () => T): T;
26
+ /** Waits before each repeat of a promote's recipient read. */
27
+ export declare const PROMOTE_RECIPIENT_RETRY_DELAYS_MS: readonly number[];
28
+ /**
29
+ * No repeat starts later than this after the first read began. It sits below
30
+ * the chain authority read deadline, so a read that ran into that deadline is
31
+ * reported at once instead of being asked again.
32
+ */
33
+ export declare const PROMOTE_RECIPIENT_RETRY_BUDGET_MS = 2000;
34
+ /** The clock and sleep of the recipient repeat, replaceable in tests. */
35
+ export interface PromoteRecipientRetryTiming {
36
+ now(): number;
37
+ sleep(delayMs: number): Promise<void>;
38
+ }
39
+ /**
40
+ * Repeat a promote's recipient read while it fails with a retryable authority
41
+ * outage and the bound allows.
42
+ *
43
+ * The recipient read accepts its roster only while the node-wide authority
44
+ * facts revision stands still, and it gives up after a few attempts. Work that
45
+ * has nothing to do with this promote moves that revision: after a Context
46
+ * Graph is registered the node reconciles the new graph's gossip subscription
47
+ * several times within a few hundred milliseconds. A share sent straight after
48
+ * a registration can therefore use up those attempts and report the roster as
49
+ * temporarily unavailable, although no fact changed and the same read succeeds
50
+ * moments later.
51
+ *
52
+ * Repeating it is safe. It only reads authority and recipient keys, it fails
53
+ * closed every time, and the publisher asks for it before the attempt claims
54
+ * an operation id or writes Shared Memory. The bound is short on purpose: each
55
+ * repeat costs chain reads, and a failure that outlasts the bound is reported
56
+ * to the caller, which retries the whole promote.
57
+ */
58
+ export declare function resolvePromoteRecipientsWithinBound<T>(resolve: () => Promise<T>, timing?: PromoteRecipientRetryTiming): Promise<T>;
19
59
  /**
20
60
  * Resolve agent prerequisites without access to the committing publisher.
21
61
  * The publisher receives concrete, pre-wrapped recipient and curator callbacks,
22
62
  * not a policy that it could apply to arbitrary commit/finalization failures.
23
63
  */
24
- export declare function prepareAssertionPromote(host: AssertionPromotePreCommitHost, input: AssertionPromotePreCommitInput): Promise<AssertionPromotePreCommitResult>;
64
+ export declare function prepareAssertionPromote(host: AssertionPromotePreCommitHost, input: AssertionPromotePreCommitInput, recipientRetryTiming?: PromoteRecipientRetryTiming): Promise<AssertionPromotePreCommitResult>;
25
65
  export {};
26
66
  //# sourceMappingURL=assertion-promote-precommit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertion-promote-precommit.d.ts","sourceRoot":"","sources":["../../../src/internal/promote/assertion-promote-precommit.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,KAAK,YAAY,GAAG,OAAO,CACzB,UAAU,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC,CAC3D,CAAC;AAEF,KAAK,gCAAgC,GAAG,IAAI,CAC1C,uBAAuB,EACrB,cAAc,GACd,iBAAiB,GACjB,qBAAqB,GACrB,cAAc,GACd,cAAc,CACjB,CAAC;AAEF,KAAK,mCAAmC,GACpC,oCAAoC,GACpC,0BAA0B,GAC1B,iCAAiC,GACjC,8BAA8B,GAC9B,2BAA2B,CAAC;AAEhC,KAAK,6BAA6B,GAAG;KAClC,MAAM,IAAI,mCAAmC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACrF,CAAC;AAEF,UAAU,8BAA8B;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,gCAAgC,CAAC;CAC5C;AAED,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,gCAAgC,CAAC;CACpD,CAAC;AAoBF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,6BAA6B,EACnC,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,+BAA+B,CAAC,CA4C1C"}
1
+ {"version":3,"file":"assertion-promote-precommit.d.ts","sourceRoot":"","sources":["../../../src/internal/promote/assertion-promote-precommit.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,KAAK,YAAY,GAAG,OAAO,CACzB,UAAU,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC,CAC3D,CAAC;AAEF,KAAK,gCAAgC,GAAG,IAAI,CAC1C,uBAAuB,EACrB,cAAc,GACd,iBAAiB,GACjB,qBAAqB,GACrB,cAAc,GACd,cAAc,CACjB,CAAC;AAEF,KAAK,mCAAmC,GACpC,oCAAoC,GACpC,0BAA0B,GAC1B,iCAAiC,GACjC,8BAA8B,GAC9B,2BAA2B,CAAC;AAEhC,KAAK,6BAA6B,GAAG;KAClC,MAAM,IAAI,mCAAmC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACrF,CAAC;AAEF,UAAU,8BAA8B;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,gCAAgC,CAAC;CAC5C;AAED,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,gCAAgC,CAAC;CACpD,CAAC;AAuBF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CASxE;AAED,8DAA8D;AAC9D,eAAO,MAAM,iCAAiC,EAAE,SAAS,MAAM,EAAmC,CAAC;AAEnG;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AAEvD,yEAAyE;AACzE,MAAM,WAAW,2BAA2B;IAC1C,GAAG,IAAI,MAAM,CAAC;IACd,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAOD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mCAAmC,CAAC,CAAC,EACzD,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,MAAM,GAAE,2BAAiE,GACxE,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,6BAA6B,EACnC,KAAK,EAAE,8BAA8B,EACrC,oBAAoB,CAAC,EAAE,2BAA2B,GACjD,OAAO,CAAC,+BAA+B,CAAC,CA+C1C"}
@@ -1,7 +1,12 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- import { createOperationContext } from '@origintrail-official/dkg-core';
2
+ import { createOperationContext, isRfc64LegacySwmBoundaryRetirementInProgressError, } from '@origintrail-official/dkg-core';
3
3
  import { createPromoteRetryableFailure, } from '@origintrail-official/dkg-publisher';
4
4
  import { isContextGraphAuthorityUnavailableMarker, isRetryableContextGraphAuthorityUnavailableReason, } from '../context-graph-authority/context-graph-authority.js';
5
+ /** An authority failure that can heal on its own (the shared classification). */
6
+ function isRetryableAuthorityUnavailable(error) {
7
+ return isContextGraphAuthorityUnavailableMarker(error)
8
+ && isRetryableContextGraphAuthorityUnavailableReason(error.reason);
9
+ }
5
10
  /**
6
11
  * Retry translation belongs to these concrete agent prerequisite callbacks;
7
12
  * which reasons are retryable is the shared authority classification.
@@ -11,19 +16,83 @@ async function resolvePromoteAuthority(resolve) {
11
16
  return await resolve();
12
17
  }
13
18
  catch (error) {
14
- if (isContextGraphAuthorityUnavailableMarker(error)
15
- && isRetryableContextGraphAuthorityUnavailableReason(error.reason)) {
19
+ if (isRetryableAuthorityUnavailable(error)) {
20
+ throw createPromoteRetryableFailure(error);
21
+ }
22
+ throw error;
23
+ }
24
+ }
25
+ /**
26
+ * The same translation for the root promote's boundary companion, which the
27
+ * publisher prepares synchronously. Only the retirement fence is transient:
28
+ * every other refusal from the prepare (unavailable persistence, the head
29
+ * limit, invalid input) is a hard failure and passes through unchanged.
30
+ */
31
+ export function translateLegacySwmRetirementFence(prepare) {
32
+ try {
33
+ return prepare();
34
+ }
35
+ catch (error) {
36
+ if (isRfc64LegacySwmBoundaryRetirementInProgressError(error)) {
16
37
  throw createPromoteRetryableFailure(error);
17
38
  }
18
39
  throw error;
19
40
  }
20
41
  }
42
+ /** Waits before each repeat of a promote's recipient read. */
43
+ export const PROMOTE_RECIPIENT_RETRY_DELAYS_MS = Object.freeze([100, 300, 700]);
44
+ /**
45
+ * No repeat starts later than this after the first read began. It sits below
46
+ * the chain authority read deadline, so a read that ran into that deadline is
47
+ * reported at once instead of being asked again.
48
+ */
49
+ export const PROMOTE_RECIPIENT_RETRY_BUDGET_MS = 2_000;
50
+ const REAL_PROMOTE_RECIPIENT_RETRY_TIMING = Object.freeze({
51
+ now: () => performance.now(),
52
+ sleep: (delayMs) => new Promise((resolve) => { setTimeout(resolve, delayMs); }),
53
+ });
54
+ /**
55
+ * Repeat a promote's recipient read while it fails with a retryable authority
56
+ * outage and the bound allows.
57
+ *
58
+ * The recipient read accepts its roster only while the node-wide authority
59
+ * facts revision stands still, and it gives up after a few attempts. Work that
60
+ * has nothing to do with this promote moves that revision: after a Context
61
+ * Graph is registered the node reconciles the new graph's gossip subscription
62
+ * several times within a few hundred milliseconds. A share sent straight after
63
+ * a registration can therefore use up those attempts and report the roster as
64
+ * temporarily unavailable, although no fact changed and the same read succeeds
65
+ * moments later.
66
+ *
67
+ * Repeating it is safe. It only reads authority and recipient keys, it fails
68
+ * closed every time, and the publisher asks for it before the attempt claims
69
+ * an operation id or writes Shared Memory. The bound is short on purpose: each
70
+ * repeat costs chain reads, and a failure that outlasts the bound is reported
71
+ * to the caller, which retries the whole promote.
72
+ */
73
+ export async function resolvePromoteRecipientsWithinBound(resolve, timing = REAL_PROMOTE_RECIPIENT_RETRY_TIMING) {
74
+ const startedAt = timing.now();
75
+ for (let attempt = 0;; attempt += 1) {
76
+ try {
77
+ return await resolve();
78
+ }
79
+ catch (error) {
80
+ const delayMs = PROMOTE_RECIPIENT_RETRY_DELAYS_MS[attempt];
81
+ if (delayMs === undefined
82
+ || !isRetryableAuthorityUnavailable(error)
83
+ || timing.now() - startedAt + delayMs > PROMOTE_RECIPIENT_RETRY_BUDGET_MS) {
84
+ throw error;
85
+ }
86
+ await timing.sleep(delayMs);
87
+ }
88
+ }
89
+ }
21
90
  /**
22
91
  * Resolve agent prerequisites without access to the committing publisher.
23
92
  * The publisher receives concrete, pre-wrapped recipient and curator callbacks,
24
93
  * not a policy that it could apply to arbitrary commit/finalization failures.
25
94
  */
26
- export async function prepareAssertionPromote(host, input) {
95
+ export async function prepareAssertionPromote(host, input, recipientRetryTiming) {
27
96
  return resolvePromoteAuthority(async () => {
28
97
  const gossipSigner = await host.resolveWorkspaceGossipSigningAgent(input.contextGraphId);
29
98
  const confirmBeforeCommit = await host.buildCuratorAckConfirmer(input.contextGraphId, gossipSigner, {
@@ -52,7 +121,7 @@ export async function prepareAssertionPromote(host, input) {
52
121
  confirmBeforeCommit: confirmBeforeCommit === undefined
53
122
  ? undefined
54
123
  : (message) => resolvePromoteAuthority(() => confirmBeforeCommit(message)),
55
- resolveWorkspaceRecipients: (request) => resolvePromoteAuthority(() => host.resolveWorkspaceRecipientsGated(request)),
124
+ resolveWorkspaceRecipients: (request) => resolvePromoteAuthority(() => resolvePromoteRecipientsWithinBound(() => host.resolveWorkspaceRecipientsGated(request), recipientRetryTiming)),
56
125
  ...(shareAccessPolicy !== undefined ? { accessPolicy: shareAccessPolicy } : {}),
57
126
  ...(input.options?.allowedPeers !== undefined
58
127
  ? { allowedPeers: [...input.options.allowedPeers] }
@@ -1 +1 @@
1
- {"version":3,"file":"assertion-promote-precommit.js","sourceRoot":"","sources":["../../../src/internal/promote/assertion-promote-precommit.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,6BAA6B,GAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,wCAAwC,EACxC,iDAAiD,GAClD,MAAM,uDAAuD,CAAC;AAsC/D;;;GAGG;AACH,KAAK,UAAU,uBAAuB,CAAI,OAAyB;IACjE,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IACE,wCAAwC,CAAC,KAAK,CAAC;eAC5C,iDAAiD,CAAC,KAAK,CAAC,MAAM,CAAC,EAClE,CAAC;YACD,MAAM,6BAA6B,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAmC,EACnC,KAAqC;IAErC,OAAO,uBAAuB,CAAC,KAAK,IAAI,EAAE;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kCAAkC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzF,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAC7D,KAAK,CAAC,cAAc,EACpB,YAAY,EACZ;YACE,eAAe,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,CACpD;gBACD,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/E,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS;oBAC3C,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;oBACnD,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"assertion-promote-precommit.js","sourceRoot":"","sources":["../../../src/internal/promote/assertion-promote-precommit.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EACL,sBAAsB,EACtB,iDAAiD,GAClD,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,GAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,wCAAwC,EACxC,iDAAiD,GAClD,MAAM,uDAAuD,CAAC;AAsC/D,iFAAiF;AACjF,SAAS,+BAA+B,CAAC,KAAc;IACrD,OAAO,wCAAwC,CAAC,KAAK,CAAC;WACjD,iDAAiD,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,uBAAuB,CAAI,OAAyB;IACjE,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,+BAA+B,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,6BAA6B,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAI,OAAgB;IACnE,IAAI,CAAC;QACH,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC;IAAC,OA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Y,EAAE;oBAC9C,CAAC,CAAC,EAAE,CAAC;gBACP,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,kBAAkB,EAAE,YAAY,EAAE,YAAY;gBAC9C,mBAAmB,EAAE,mBAAmB,KAAK,SAAS;oBACpD,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAuB,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;gBAC5E,0BAA0B,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAuB,CAC9D,GAAG,EAAE,CAAC,mCAAmC,CACvC,GAAG,EAAE,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,EACnD,oBAAoB,CACrB,CACF;gBACD,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/E,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS;oBAC3C,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;oBACnD,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type ACKCollectorDeps } from '@origintrail-official/dkg-publisher';
2
+ interface ACKReliableMessenger {
3
+ sendRequestOwned(peerId: string, protocol: string, data: Uint8Array, opts: {
4
+ timeoutMs: number;
5
+ }): Promise<{
6
+ delivered: boolean;
7
+ error?: unknown;
8
+ response?: Uint8Array;
9
+ }>;
10
+ }
11
+ export declare function createACKSendP2P(input: {
12
+ messenger: ACKReliableMessenger;
13
+ timeoutMs: number;
14
+ }): ACKCollectorDeps['sendP2P'];
15
+ export {};
16
+ //# sourceMappingURL=storage-ack-owned-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-ack-owned-request.d.ts","sourceRoot":"","sources":["../../src/internal/storage-ack-owned-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,UAAU,oBAAoB;IAC5B,gBAAgB,CACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CAC5E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,SAAS,EAAE,oBAAoB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAa9B"}
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ export function createACKSendP2P(input) {
3
+ return async (peerId, protocol, data) => {
4
+ const sendResult = await input.messenger.sendRequestOwned(peerId, protocol, data, {
5
+ timeoutMs: input.timeoutMs,
6
+ });
7
+ if (!sendResult.delivered) {
8
+ throw new Error(`substrate send already in flight (transport): ${sendResult.error}`);
9
+ }
10
+ if (!sendResult.response) {
11
+ throw new Error('substrate delivered (transport) without response');
12
+ }
13
+ return sendResult.response;
14
+ };
15
+ }
16
+ //# sourceMappingURL=storage-ack-owned-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-ack-owned-request.js","sourceRoot":"","sources":["../../src/internal/storage-ack-owned-request.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAatC,MAAM,UAAU,gBAAgB,CAAC,KAGhC;IACC,OAAO,KAAK,EAAE,MAAc,EAAE,QAAgB,EAAE,IAAgB,EAAE,EAAE;QAClE,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAChF,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,iDAAiD,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,UAAU,CAAC,QAAQ,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Graphs waiting for node-local sync admission, served in turn.
3
+ *
4
+ * A reconcile pass that the node's own sync admission refused has nothing to
5
+ * gain from running again while that capacity is still in use: every repeat
6
+ * costs the pass's chain reads and is refused the same way, and every waiting
7
+ * graph pays them at once. This component owns the wait instead. A refused
8
+ * graph is kept in arrival order and nudged once the admission can take its
9
+ * fetch, one graph at a time.
10
+ *
11
+ * A pass that could not start its work at all, because the source it had to
12
+ * ask did not answer, waits here too (see {@link VmReconcileLocalAdmissionWait.defer}).
13
+ *
14
+ * It owns no sync lease and no VM worker. A nudge re-enters the ordinary
15
+ * bounded dispatcher, and the periodic sweep still visits a waiting graph.
16
+ */
17
+ export interface LocalAdmissionWaitOptions {
18
+ signal?: AbortSignal;
19
+ isCurrent: () => boolean;
20
+ /** Whether the node's sync admission would take this graph's fetch right now. */
21
+ canAdmit: () => boolean;
22
+ }
23
+ /** One pass of a graph, from the moment it started. */
24
+ export interface LocalAdmissionPass {
25
+ readonly key: string;
26
+ /** The graph's place in the wait when the pass started, if it had one. */
27
+ readonly waiting: object | undefined;
28
+ }
29
+ export interface VmReconcileLocalAdmissionWaitDeps {
30
+ /**
31
+ * Nudge one graph and return its pass's completion. Undefined when the
32
+ * nudge was not admitted (held after a failed pass, or no queue room).
33
+ * `deferred` says the graph was parked by `defer`, so the hold a failed
34
+ * pass leaves is its own and this nudge is the retry.
35
+ */
36
+ readonly nudge: (key: string, deferred: boolean) => Promise<unknown> | undefined;
37
+ /** Bound on retained waiters. */
38
+ readonly maxWaiters: number;
39
+ }
40
+ export declare class VmReconcileLocalAdmissionWait {
41
+ private readonly deps;
42
+ /** Waiting graphs, in the order they are served. */
43
+ private readonly waiters;
44
+ /** The waiter nudged last, until its pass settles. */
45
+ private turn;
46
+ /** No waiter is nudged before this time: a nudged pass was refused all the same. */
47
+ private holdUntil;
48
+ private timer;
49
+ private closed;
50
+ constructor(deps: VmReconcileLocalAdmissionWaitDeps);
51
+ /**
52
+ * The node's sync admission refused this graph's fetch. `canAdmit` reads the
53
+ * admission the fetch will ask. Every waiter uses this readiness contract.
54
+ */
55
+ retry(key: string, options: LocalAdmissionWaitOptions): void;
56
+ /**
57
+ * A graph that just used the node's sync admission and has more to fetch
58
+ * goes behind the graphs already waiting for it. Returns false, and parks
59
+ * nothing, when no other graph is waiting.
60
+ */
61
+ yieldTurn(key: string, options: LocalAdmissionWaitOptions): boolean;
62
+ /**
63
+ * A pass ended before its work started: the source it had to ask gave no
64
+ * answer. Nothing here can read when it will, so the graph goes behind the
65
+ * others and no waiter is nudged for one delay. A graph that keeps getting
66
+ * no answer then costs one short pass per delay, in turn with the rest.
67
+ * `canAdmit` is the same readiness contract as for a refused fetch: the
68
+ * graph is not asked again while its fetch could not start anyway.
69
+ *
70
+ * Returns `again` when the pass was this wait's own nudge, `parked` when it
71
+ * came from elsewhere, and undefined when the graph was not taken.
72
+ */
73
+ defer(key: string, options: LocalAdmissionWaitOptions): 'parked' | 'again' | undefined;
74
+ /** A pass of this graph is starting. Hand the result to {@link passEnded}. */
75
+ passStarted(key: string): LocalAdmissionPass;
76
+ /**
77
+ * The pass ended. A graph whose place in the wait is still the one it had
78
+ * when the pass started was not refused again, so it is no longer waiting.
79
+ * Whatever the pass used is free now, so this is also when the next waiter
80
+ * can go.
81
+ */
82
+ passEnded(pass: LocalAdmissionPass): void;
83
+ close(): void;
84
+ private park;
85
+ private remove;
86
+ /**
87
+ * Nudge the longest waiter the node's sync admission can take, unless a
88
+ * nudged pass is still out. Waiters are read in arrival order and one that
89
+ * cannot be admitted yet is passed over, so a graph with capacity of its own
90
+ * is not held behind one without.
91
+ */
92
+ private wake;
93
+ /** One timer for the whole wait: the next delay to run out, else a capacity re-read per interval. */
94
+ private armTimer;
95
+ }
96
+ //# sourceMappingURL=vm-reconcile-local-admission-wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vm-reconcile-local-admission-wait.d.ts","sourceRoot":"","sources":["../../src/internal/vm-reconcile-local-admission-wait.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,OAAO,CAAC;CACzB;AAQD,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,iCAAiC;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACjF,iCAAiC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAWD,qBAAa,6BAA6B;IAU5B,OAAO,CAAC,QAAQ,CAAC,IAAI;IATjC,oDAAoD;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,sDAAsD;IACtD,OAAO,CAAC,IAAI,CAAiD;IAC7D,oF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