@earendil-works/chord 1.3.0 → 1.5.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 (841) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +129 -10
  3. package/dist/cell.d.ts +7 -7
  4. package/dist/cell.d.ts.map +1 -1
  5. package/dist/cell.js.map +1 -1
  6. package/dist/context/index.d.ts +8 -0
  7. package/dist/context/index.d.ts.map +1 -1
  8. package/dist/context/index.js +15 -0
  9. package/dist/context/index.js.map +1 -1
  10. package/dist/contract.d.ts +51 -52
  11. package/dist/contract.d.ts.map +1 -1
  12. package/dist/contract.js +19 -24
  13. package/dist/contract.js.map +1 -1
  14. package/dist/delta/apply-immutable-trusted.js +3 -4
  15. package/dist/delta/apply-immutable-trusted.js.map +1 -1
  16. package/dist/delta/diff.d.ts.map +1 -1
  17. package/dist/delta/diff.js +5 -3
  18. package/dist/delta/diff.js.map +1 -1
  19. package/dist/delta/index.d.ts +9 -1
  20. package/dist/delta/index.d.ts.map +1 -1
  21. package/dist/delta/index.js +15 -11
  22. package/dist/delta/index.js.map +1 -1
  23. package/dist/delta/pending.d.ts +36 -0
  24. package/dist/delta/pending.d.ts.map +1 -0
  25. package/dist/delta/pending.js +143 -0
  26. package/dist/delta/pending.js.map +1 -0
  27. package/dist/delta/tracker.d.ts +12 -0
  28. package/dist/delta/tracker.d.ts.map +1 -1
  29. package/dist/delta/tracker.js +109 -39
  30. package/dist/delta/tracker.js.map +1 -1
  31. package/dist/host.d.ts.map +1 -1
  32. package/dist/host.js +9 -7
  33. package/dist/host.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/next/contracts/accepts.d.ts +81 -0
  39. package/dist/next/contracts/accepts.d.ts.map +1 -0
  40. package/dist/next/contracts/accepts.js +123 -0
  41. package/dist/next/contracts/accepts.js.map +1 -0
  42. package/dist/next/contracts/contract.d.ts +121 -0
  43. package/dist/next/contracts/contract.d.ts.map +1 -0
  44. package/dist/next/contracts/contract.js +50 -0
  45. package/dist/next/contracts/contract.js.map +1 -0
  46. package/dist/next/contracts/declare.d.ts +107 -0
  47. package/dist/next/contracts/declare.d.ts.map +1 -0
  48. package/dist/next/contracts/declare.js +136 -0
  49. package/dist/next/contracts/declare.js.map +1 -0
  50. package/dist/next/contracts/evolve.d.ts +92 -0
  51. package/dist/next/contracts/evolve.d.ts.map +1 -0
  52. package/dist/next/contracts/evolve.js +179 -0
  53. package/dist/next/contracts/evolve.js.map +1 -0
  54. package/dist/next/contracts/fingerprint.d.ts +16 -0
  55. package/dist/next/contracts/fingerprint.d.ts.map +1 -0
  56. package/dist/next/contracts/fingerprint.js +50 -0
  57. package/dist/next/contracts/fingerprint.js.map +1 -0
  58. package/dist/next/contracts/history.d.ts +71 -0
  59. package/dist/next/contracts/history.d.ts.map +1 -0
  60. package/dist/next/contracts/history.js +3 -0
  61. package/dist/next/contracts/history.js.map +1 -0
  62. package/dist/next/contracts/host-kind.d.ts +40 -0
  63. package/dist/next/contracts/host-kind.d.ts.map +1 -0
  64. package/dist/next/contracts/host-kind.js +37 -0
  65. package/dist/next/contracts/host-kind.js.map +1 -0
  66. package/dist/next/contracts/index.d.ts +7 -0
  67. package/dist/next/contracts/index.d.ts.map +1 -0
  68. package/dist/next/contracts/index.js +6 -0
  69. package/dist/next/contracts/index.js.map +1 -0
  70. package/dist/next/contracts/internal.d.ts +10 -0
  71. package/dist/next/contracts/internal.d.ts.map +1 -0
  72. package/dist/next/contracts/internal.js +9 -0
  73. package/dist/next/contracts/internal.js.map +1 -0
  74. package/dist/next/contracts/names.d.ts +3 -0
  75. package/dist/next/contracts/names.d.ts.map +1 -0
  76. package/dist/next/contracts/names.js +13 -0
  77. package/dist/next/contracts/names.js.map +1 -0
  78. package/dist/next/contracts/params.d.ts +28 -0
  79. package/dist/next/contracts/params.d.ts.map +1 -0
  80. package/dist/next/contracts/params.js +50 -0
  81. package/dist/next/contracts/params.js.map +1 -0
  82. package/dist/next/contracts/schema.d.ts +102 -0
  83. package/dist/next/contracts/schema.d.ts.map +1 -0
  84. package/dist/next/contracts/schema.js +103 -0
  85. package/dist/next/contracts/schema.js.map +1 -0
  86. package/dist/next/contracts/snapshot.d.ts +16 -0
  87. package/dist/next/contracts/snapshot.d.ts.map +1 -0
  88. package/dist/next/contracts/snapshot.js +167 -0
  89. package/dist/next/contracts/snapshot.js.map +1 -0
  90. package/dist/next/data/args.d.ts +50 -0
  91. package/dist/next/data/args.d.ts.map +1 -0
  92. package/dist/next/data/args.js +83 -0
  93. package/dist/next/data/args.js.map +1 -0
  94. package/dist/next/data/errors.d.ts +73 -0
  95. package/dist/next/data/errors.d.ts.map +1 -0
  96. package/dist/next/data/errors.js +107 -0
  97. package/dist/next/data/errors.js.map +1 -0
  98. package/dist/next/data/failure.d.ts +26 -0
  99. package/dist/next/data/failure.d.ts.map +1 -0
  100. package/dist/next/data/failure.js +72 -0
  101. package/dist/next/data/failure.js.map +1 -0
  102. package/dist/next/data/index.d.ts +4 -0
  103. package/dist/next/data/index.d.ts.map +1 -0
  104. package/dist/next/data/index.js +4 -0
  105. package/dist/next/data/index.js.map +1 -0
  106. package/dist/next/data/internal.d.ts +7 -0
  107. package/dist/next/data/internal.d.ts.map +1 -0
  108. package/dist/next/data/internal.js +8 -0
  109. package/dist/next/data/internal.js.map +1 -0
  110. package/dist/next/data/params.d.ts +20 -0
  111. package/dist/next/data/params.d.ts.map +1 -0
  112. package/dist/next/data/params.js +31 -0
  113. package/dist/next/data/params.js.map +1 -0
  114. package/dist/next/data/principal.d.ts +17 -0
  115. package/dist/next/data/principal.d.ts.map +1 -0
  116. package/dist/next/data/principal.js +41 -0
  117. package/dist/next/data/principal.js.map +1 -0
  118. package/dist/next/data/validator.d.ts +12 -0
  119. package/dist/next/data/validator.d.ts.map +1 -0
  120. package/dist/next/data/validator.js +34 -0
  121. package/dist/next/data/validator.js.map +1 -0
  122. package/dist/next/documents/address-source.d.ts +20 -0
  123. package/dist/next/documents/address-source.d.ts.map +1 -0
  124. package/dist/next/documents/address-source.js +44 -0
  125. package/dist/next/documents/address-source.js.map +1 -0
  126. package/dist/next/documents/definition.d.ts +84 -0
  127. package/dist/next/documents/definition.d.ts.map +1 -0
  128. package/dist/next/documents/definition.js +73 -0
  129. package/dist/next/documents/definition.js.map +1 -0
  130. package/dist/next/documents/documents.d.ts +106 -0
  131. package/dist/next/documents/documents.d.ts.map +1 -0
  132. package/dist/next/documents/documents.js +224 -0
  133. package/dist/next/documents/documents.js.map +1 -0
  134. package/dist/next/documents/fence.d.ts +9 -0
  135. package/dist/next/documents/fence.d.ts.map +1 -0
  136. package/dist/next/documents/fence.js +15 -0
  137. package/dist/next/documents/fence.js.map +1 -0
  138. package/dist/next/documents/handles.d.ts +76 -0
  139. package/dist/next/documents/handles.d.ts.map +1 -0
  140. package/dist/next/documents/handles.js +66 -0
  141. package/dist/next/documents/handles.js.map +1 -0
  142. package/dist/next/documents/index.d.ts +4 -0
  143. package/dist/next/documents/index.d.ts.map +1 -0
  144. package/dist/next/documents/index.js +3 -0
  145. package/dist/next/documents/index.js.map +1 -0
  146. package/dist/next/documents/internal.d.ts +9 -0
  147. package/dist/next/documents/internal.d.ts.map +1 -0
  148. package/dist/next/documents/internal.js +9 -0
  149. package/dist/next/documents/internal.js.map +1 -0
  150. package/dist/next/documents/keyed-slot.d.ts +103 -0
  151. package/dist/next/documents/keyed-slot.d.ts.map +1 -0
  152. package/dist/next/documents/keyed-slot.js +395 -0
  153. package/dist/next/documents/keyed-slot.js.map +1 -0
  154. package/dist/next/documents/line.d.ts +7 -0
  155. package/dist/next/documents/line.d.ts.map +1 -0
  156. package/dist/next/documents/line.js +14 -0
  157. package/dist/next/documents/line.js.map +1 -0
  158. package/dist/next/documents/persistence.d.ts +104 -0
  159. package/dist/next/documents/persistence.d.ts.map +1 -0
  160. package/dist/next/documents/persistence.js +128 -0
  161. package/dist/next/documents/persistence.js.map +1 -0
  162. package/dist/next/documents/residency.d.ts +31 -0
  163. package/dist/next/documents/residency.d.ts.map +1 -0
  164. package/dist/next/documents/residency.js +93 -0
  165. package/dist/next/documents/residency.js.map +1 -0
  166. package/dist/next/documents/slot.d.ts +109 -0
  167. package/dist/next/documents/slot.d.ts.map +1 -0
  168. package/dist/next/documents/slot.js +181 -0
  169. package/dist/next/documents/slot.js.map +1 -0
  170. package/dist/next/documents/transaction.d.ts +133 -0
  171. package/dist/next/documents/transaction.d.ts.map +1 -0
  172. package/dist/next/documents/transaction.js +409 -0
  173. package/dist/next/documents/transaction.js.map +1 -0
  174. package/dist/next/host/activity.d.ts +31 -0
  175. package/dist/next/host/activity.d.ts.map +1 -0
  176. package/dist/next/host/activity.js +40 -0
  177. package/dist/next/host/activity.js.map +1 -0
  178. package/dist/next/host/adapted.d.ts +49 -0
  179. package/dist/next/host/adapted.d.ts.map +1 -0
  180. package/dist/next/host/adapted.js +214 -0
  181. package/dist/next/host/adapted.js.map +1 -0
  182. package/dist/next/host/attempt.d.ts +278 -0
  183. package/dist/next/host/attempt.d.ts.map +1 -0
  184. package/dist/next/host/attempt.js +1072 -0
  185. package/dist/next/host/attempt.js.map +1 -0
  186. package/dist/next/host/backoff.d.ts +29 -0
  187. package/dist/next/host/backoff.d.ts.map +1 -0
  188. package/dist/next/host/backoff.js +69 -0
  189. package/dist/next/host/backoff.js.map +1 -0
  190. package/dist/next/host/ctx.d.ts +47 -0
  191. package/dist/next/host/ctx.d.ts.map +1 -0
  192. package/dist/next/host/ctx.js +108 -0
  193. package/dist/next/host/ctx.js.map +1 -0
  194. package/dist/next/host/deadline.d.ts +12 -0
  195. package/dist/next/host/deadline.d.ts.map +1 -0
  196. package/dist/next/host/deadline.js +40 -0
  197. package/dist/next/host/deadline.js.map +1 -0
  198. package/dist/next/host/dependencies.d.ts +65 -0
  199. package/dist/next/host/dependencies.d.ts.map +1 -0
  200. package/dist/next/host/dependencies.js +115 -0
  201. package/dist/next/host/dependencies.js.map +1 -0
  202. package/dist/next/host/destination.d.ts +48 -0
  203. package/dist/next/host/destination.d.ts.map +1 -0
  204. package/dist/next/host/destination.js +101 -0
  205. package/dist/next/host/destination.js.map +1 -0
  206. package/dist/next/host/facet.d.ts +79 -0
  207. package/dist/next/host/facet.d.ts.map +1 -0
  208. package/dist/next/host/facet.js +55 -0
  209. package/dist/next/host/facet.js.map +1 -0
  210. package/dist/next/host/follow.d.ts +52 -0
  211. package/dist/next/host/follow.d.ts.map +1 -0
  212. package/dist/next/host/follow.js +207 -0
  213. package/dist/next/host/follow.js.map +1 -0
  214. package/dist/next/host/host.d.ts +495 -0
  215. package/dist/next/host/host.d.ts.map +1 -0
  216. package/dist/next/host/host.js +1075 -0
  217. package/dist/next/host/host.js.map +1 -0
  218. package/dist/next/host/index.d.ts +17 -0
  219. package/dist/next/host/index.d.ts.map +1 -0
  220. package/dist/next/host/index.js +6 -0
  221. package/dist/next/host/index.js.map +1 -0
  222. package/dist/next/host/internal.d.ts +10 -0
  223. package/dist/next/host/internal.d.ts.map +1 -0
  224. package/dist/next/host/internal.js +8 -0
  225. package/dist/next/host/internal.js.map +1 -0
  226. package/dist/next/host/members.d.ts +50 -0
  227. package/dist/next/host/members.d.ts.map +1 -0
  228. package/dist/next/host/members.js +107 -0
  229. package/dist/next/host/members.js.map +1 -0
  230. package/dist/next/host/native.d.ts +55 -0
  231. package/dist/next/host/native.d.ts.map +1 -0
  232. package/dist/next/host/native.js +92 -0
  233. package/dist/next/host/native.js.map +1 -0
  234. package/dist/next/host/object.d.ts +290 -0
  235. package/dist/next/host/object.d.ts.map +1 -0
  236. package/dist/next/host/object.js +1127 -0
  237. package/dist/next/host/object.js.map +1 -0
  238. package/dist/next/host/parked.d.ts +23 -0
  239. package/dist/next/host/parked.d.ts.map +1 -0
  240. package/dist/next/host/parked.js +79 -0
  241. package/dist/next/host/parked.js.map +1 -0
  242. package/dist/next/host/presence.d.ts +34 -0
  243. package/dist/next/host/presence.d.ts.map +1 -0
  244. package/dist/next/host/presence.js +117 -0
  245. package/dist/next/host/presence.js.map +1 -0
  246. package/dist/next/host/ref-state.d.ts +53 -0
  247. package/dist/next/host/ref-state.d.ts.map +1 -0
  248. package/dist/next/host/ref-state.js +83 -0
  249. package/dist/next/host/ref-state.js.map +1 -0
  250. package/dist/next/host/reference-keys.d.ts +36 -0
  251. package/dist/next/host/reference-keys.d.ts.map +1 -0
  252. package/dist/next/host/reference-keys.js +168 -0
  253. package/dist/next/host/reference-keys.js.map +1 -0
  254. package/dist/next/host/reference-source.d.ts +65 -0
  255. package/dist/next/host/reference-source.d.ts.map +1 -0
  256. package/dist/next/host/reference-source.js +285 -0
  257. package/dist/next/host/reference-source.js.map +1 -0
  258. package/dist/next/host/reference.d.ts +308 -0
  259. package/dist/next/host/reference.d.ts.map +1 -0
  260. package/dist/next/host/reference.js +775 -0
  261. package/dist/next/host/reference.js.map +1 -0
  262. package/dist/next/host/retry-on.d.ts +28 -0
  263. package/dist/next/host/retry-on.d.ts.map +1 -0
  264. package/dist/next/host/retry-on.js +52 -0
  265. package/dist/next/host/retry-on.js.map +1 -0
  266. package/dist/next/host/revocation.d.ts +16 -0
  267. package/dist/next/host/revocation.d.ts.map +1 -0
  268. package/dist/next/host/revocation.js +27 -0
  269. package/dist/next/host/revocation.js.map +1 -0
  270. package/dist/next/host/root.d.ts +27 -0
  271. package/dist/next/host/root.d.ts.map +1 -0
  272. package/dist/next/host/root.js +68 -0
  273. package/dist/next/host/root.js.map +1 -0
  274. package/dist/next/host/route.d.ts +64 -0
  275. package/dist/next/host/route.d.ts.map +1 -0
  276. package/dist/next/host/route.js +190 -0
  277. package/dist/next/host/route.js.map +1 -0
  278. package/dist/next/host/routines.d.ts +76 -0
  279. package/dist/next/host/routines.d.ts.map +1 -0
  280. package/dist/next/host/routines.js +350 -0
  281. package/dist/next/host/routines.js.map +1 -0
  282. package/dist/next/host/sleep.d.ts +9 -0
  283. package/dist/next/host/sleep.d.ts.map +1 -0
  284. package/dist/next/host/sleep.js +40 -0
  285. package/dist/next/host/sleep.js.map +1 -0
  286. package/dist/next/host/staging.d.ts +94 -0
  287. package/dist/next/host/staging.d.ts.map +1 -0
  288. package/dist/next/host/staging.js +302 -0
  289. package/dist/next/host/staging.js.map +1 -0
  290. package/dist/next/host/unbound.d.ts +30 -0
  291. package/dist/next/host/unbound.d.ts.map +1 -0
  292. package/dist/next/host/unbound.js +67 -0
  293. package/dist/next/host/unbound.js.map +1 -0
  294. package/dist/next/host/uuid.d.ts +3 -0
  295. package/dist/next/host/uuid.d.ts.map +1 -0
  296. package/dist/next/host/uuid.js +38 -0
  297. package/dist/next/host/uuid.js.map +1 -0
  298. package/dist/next/index.d.ts +28 -0
  299. package/dist/next/index.d.ts.map +1 -0
  300. package/dist/next/index.js +18 -0
  301. package/dist/next/index.js.map +1 -0
  302. package/dist/next/jobs/definition.d.ts +96 -0
  303. package/dist/next/jobs/definition.d.ts.map +1 -0
  304. package/dist/next/jobs/definition.js +83 -0
  305. package/dist/next/jobs/definition.js.map +1 -0
  306. package/dist/next/jobs/index.d.ts +5 -0
  307. package/dist/next/jobs/index.d.ts.map +1 -0
  308. package/dist/next/jobs/index.js +3 -0
  309. package/dist/next/jobs/index.js.map +1 -0
  310. package/dist/next/jobs/internal.d.ts +3 -0
  311. package/dist/next/jobs/internal.d.ts.map +1 -0
  312. package/dist/next/jobs/internal.js +4 -0
  313. package/dist/next/jobs/internal.js.map +1 -0
  314. package/dist/next/jobs/job.d.ts +152 -0
  315. package/dist/next/jobs/job.d.ts.map +1 -0
  316. package/dist/next/jobs/job.js +320 -0
  317. package/dist/next/jobs/job.js.map +1 -0
  318. package/dist/next/jobs/persisted.d.ts +38 -0
  319. package/dist/next/jobs/persisted.d.ts.map +1 -0
  320. package/dist/next/jobs/persisted.js +95 -0
  321. package/dist/next/jobs/persisted.js.map +1 -0
  322. package/dist/next/jobs/records.d.ts +231 -0
  323. package/dist/next/jobs/records.d.ts.map +1 -0
  324. package/dist/next/jobs/records.js +869 -0
  325. package/dist/next/jobs/records.js.map +1 -0
  326. package/dist/next/jobs/run-states.d.ts +69 -0
  327. package/dist/next/jobs/run-states.d.ts.map +1 -0
  328. package/dist/next/jobs/run-states.js +228 -0
  329. package/dist/next/jobs/run-states.js.map +1 -0
  330. package/dist/next/jobs/run.d.ts +113 -0
  331. package/dist/next/jobs/run.d.ts.map +1 -0
  332. package/dist/next/jobs/run.js +200 -0
  333. package/dist/next/jobs/run.js.map +1 -0
  334. package/dist/next/jobs/running.d.ts +44 -0
  335. package/dist/next/jobs/running.d.ts.map +1 -0
  336. package/dist/next/jobs/running.js +117 -0
  337. package/dist/next/jobs/running.js.map +1 -0
  338. package/dist/next/jobs/stored.d.ts +63 -0
  339. package/dist/next/jobs/stored.d.ts.map +1 -0
  340. package/dist/next/jobs/stored.js +55 -0
  341. package/dist/next/jobs/stored.js.map +1 -0
  342. package/dist/next/link/binary.d.ts +4 -0
  343. package/dist/next/link/binary.d.ts.map +1 -0
  344. package/dist/next/link/binary.js +534 -0
  345. package/dist/next/link/binary.js.map +1 -0
  346. package/dist/next/link/channel.d.ts +63 -0
  347. package/dist/next/link/channel.d.ts.map +1 -0
  348. package/dist/next/link/channel.js +202 -0
  349. package/dist/next/link/channel.js.map +1 -0
  350. package/dist/next/link/errors.d.ts +7 -0
  351. package/dist/next/link/errors.d.ts.map +1 -0
  352. package/dist/next/link/errors.js +21 -0
  353. package/dist/next/link/errors.js.map +1 -0
  354. package/dist/next/link/index.d.ts +8 -0
  355. package/dist/next/link/index.d.ts.map +1 -0
  356. package/dist/next/link/index.js +8 -0
  357. package/dist/next/link/index.js.map +1 -0
  358. package/dist/next/link/internal.d.ts +9 -0
  359. package/dist/next/link/internal.d.ts.map +1 -0
  360. package/dist/next/link/internal.js +10 -0
  361. package/dist/next/link/internal.js.map +1 -0
  362. package/dist/next/link/ipc.d.ts +22 -0
  363. package/dist/next/link/ipc.d.ts.map +1 -0
  364. package/dist/next/link/ipc.js +64 -0
  365. package/dist/next/link/ipc.js.map +1 -0
  366. package/dist/next/link/link.d.ts +34 -0
  367. package/dist/next/link/link.d.ts.map +1 -0
  368. package/dist/next/link/link.js +87 -0
  369. package/dist/next/link/link.js.map +1 -0
  370. package/dist/next/link/message.d.ts +249 -0
  371. package/dist/next/link/message.d.ts.map +1 -0
  372. package/dist/next/link/message.js +123 -0
  373. package/dist/next/link/message.js.map +1 -0
  374. package/dist/next/link/part.d.ts +80 -0
  375. package/dist/next/link/part.d.ts.map +1 -0
  376. package/dist/next/link/part.js +164 -0
  377. package/dist/next/link/part.js.map +1 -0
  378. package/dist/next/link/text.d.ts +6 -0
  379. package/dist/next/link/text.d.ts.map +1 -0
  380. package/dist/next/link/text.js +335 -0
  381. package/dist/next/link/text.js.map +1 -0
  382. package/dist/next/link/values.d.ts +40 -0
  383. package/dist/next/link/values.d.ts.map +1 -0
  384. package/dist/next/link/values.js +117 -0
  385. package/dist/next/link/values.js.map +1 -0
  386. package/dist/next/link/websocket.d.ts +26 -0
  387. package/dist/next/link/websocket.d.ts.map +1 -0
  388. package/dist/next/link/websocket.js +91 -0
  389. package/dist/next/link/websocket.js.map +1 -0
  390. package/dist/next/registries/contribution.d.ts +50 -0
  391. package/dist/next/registries/contribution.d.ts.map +1 -0
  392. package/dist/next/registries/contribution.js +129 -0
  393. package/dist/next/registries/contribution.js.map +1 -0
  394. package/dist/next/registries/entries.d.ts +18 -0
  395. package/dist/next/registries/entries.d.ts.map +1 -0
  396. package/dist/next/registries/entries.js +42 -0
  397. package/dist/next/registries/entries.js.map +1 -0
  398. package/dist/next/registries/index.d.ts +3 -0
  399. package/dist/next/registries/index.d.ts.map +1 -0
  400. package/dist/next/registries/index.js +5 -0
  401. package/dist/next/registries/index.js.map +1 -0
  402. package/dist/next/registries/internal.d.ts +4 -0
  403. package/dist/next/registries/internal.d.ts.map +1 -0
  404. package/dist/next/registries/internal.js +5 -0
  405. package/dist/next/registries/internal.js.map +1 -0
  406. package/dist/next/registries/record.d.ts +94 -0
  407. package/dist/next/registries/record.d.ts.map +1 -0
  408. package/dist/next/registries/record.js +253 -0
  409. package/dist/next/registries/record.js.map +1 -0
  410. package/dist/next/registries/registry.d.ts +74 -0
  411. package/dist/next/registries/registry.d.ts.map +1 -0
  412. package/dist/next/registries/registry.js +14 -0
  413. package/dist/next/registries/registry.js.map +1 -0
  414. package/dist/next/registries/value.d.ts +48 -0
  415. package/dist/next/registries/value.d.ts.map +1 -0
  416. package/dist/next/registries/value.js +199 -0
  417. package/dist/next/registries/value.js.map +1 -0
  418. package/dist/next/remote/calls.d.ts +25 -0
  419. package/dist/next/remote/calls.d.ts.map +1 -0
  420. package/dist/next/remote/calls.js +62 -0
  421. package/dist/next/remote/calls.js.map +1 -0
  422. package/dist/next/remote/consumer.d.ts +42 -0
  423. package/dist/next/remote/consumer.d.ts.map +1 -0
  424. package/dist/next/remote/consumer.js +343 -0
  425. package/dist/next/remote/consumer.js.map +1 -0
  426. package/dist/next/remote/hold.d.ts +130 -0
  427. package/dist/next/remote/hold.d.ts.map +1 -0
  428. package/dist/next/remote/hold.js +537 -0
  429. package/dist/next/remote/hold.js.map +1 -0
  430. package/dist/next/remote/host-link.d.ts +77 -0
  431. package/dist/next/remote/host-link.d.ts.map +1 -0
  432. package/dist/next/remote/host-link.js +182 -0
  433. package/dist/next/remote/host-link.js.map +1 -0
  434. package/dist/next/remote/internal.d.ts +6 -0
  435. package/dist/next/remote/internal.d.ts.map +1 -0
  436. package/dist/next/remote/internal.js +6 -0
  437. package/dist/next/remote/internal.js.map +1 -0
  438. package/dist/next/remote/path.d.ts +46 -0
  439. package/dist/next/remote/path.d.ts.map +1 -0
  440. package/dist/next/remote/path.js +73 -0
  441. package/dist/next/remote/path.js.map +1 -0
  442. package/dist/next/remote/provider.d.ts +76 -0
  443. package/dist/next/remote/provider.d.ts.map +1 -0
  444. package/dist/next/remote/provider.js +506 -0
  445. package/dist/next/remote/provider.js.map +1 -0
  446. package/dist/next/remote/relay.d.ts +58 -0
  447. package/dist/next/remote/relay.d.ts.map +1 -0
  448. package/dist/next/remote/relay.js +117 -0
  449. package/dist/next/remote/relay.js.map +1 -0
  450. package/dist/next/remote/remote-object.d.ts +133 -0
  451. package/dist/next/remote/remote-object.d.ts.map +1 -0
  452. package/dist/next/remote/remote-object.js +411 -0
  453. package/dist/next/remote/remote-object.js.map +1 -0
  454. package/dist/next/remote/replica.d.ts +59 -0
  455. package/dist/next/remote/replica.d.ts.map +1 -0
  456. package/dist/next/remote/replica.js +125 -0
  457. package/dist/next/remote/replica.js.map +1 -0
  458. package/dist/next/state/batch.d.ts +64 -0
  459. package/dist/next/state/batch.d.ts.map +1 -0
  460. package/dist/next/state/batch.js +163 -0
  461. package/dist/next/state/batch.js.map +1 -0
  462. package/dist/next/state/derive.d.ts +52 -0
  463. package/dist/next/state/derive.d.ts.map +1 -0
  464. package/dist/next/state/derive.js +182 -0
  465. package/dist/next/state/derive.js.map +1 -0
  466. package/dist/next/state/index.d.ts +6 -0
  467. package/dist/next/state/index.d.ts.map +1 -0
  468. package/dist/next/state/index.js +4 -0
  469. package/dist/next/state/index.js.map +1 -0
  470. package/dist/next/state/internal.d.ts +6 -0
  471. package/dist/next/state/internal.d.ts.map +1 -0
  472. package/dist/next/state/internal.js +8 -0
  473. package/dist/next/state/internal.js.map +1 -0
  474. package/dist/next/state/native-source.d.ts +106 -0
  475. package/dist/next/state/native-source.d.ts.map +1 -0
  476. package/dist/next/state/native-source.js +240 -0
  477. package/dist/next/state/native-source.js.map +1 -0
  478. package/dist/next/state/watchable.d.ts +114 -0
  479. package/dist/next/state/watchable.d.ts.map +1 -0
  480. package/dist/next/state/watchable.js +156 -0
  481. package/dist/next/state/watchable.js.map +1 -0
  482. package/dist/next/state/writable.d.ts +32 -0
  483. package/dist/next/state/writable.d.ts.map +1 -0
  484. package/dist/next/state/writable.js +49 -0
  485. package/dist/next/state/writable.js.map +1 -0
  486. package/dist/next/store/adapter.d.ts +67 -0
  487. package/dist/next/store/adapter.d.ts.map +1 -0
  488. package/dist/next/store/adapter.js +118 -0
  489. package/dist/next/store/adapter.js.map +1 -0
  490. package/dist/next/store/allocator.d.ts +17 -0
  491. package/dist/next/store/allocator.d.ts.map +1 -0
  492. package/dist/next/store/allocator.js +30 -0
  493. package/dist/next/store/allocator.js.map +1 -0
  494. package/dist/next/store/applier.d.ts +8 -0
  495. package/dist/next/store/applier.d.ts.map +1 -0
  496. package/dist/next/store/applier.js +375 -0
  497. package/dist/next/store/applier.js.map +1 -0
  498. package/dist/next/store/apply-batch.d.ts +12 -0
  499. package/dist/next/store/apply-batch.d.ts.map +1 -0
  500. package/dist/next/store/apply-batch.js +83 -0
  501. package/dist/next/store/apply-batch.js.map +1 -0
  502. package/dist/next/store/archive.d.ts +32 -0
  503. package/dist/next/store/archive.d.ts.map +1 -0
  504. package/dist/next/store/archive.js +129 -0
  505. package/dist/next/store/archive.js.map +1 -0
  506. package/dist/next/store/backend.d.ts +10 -0
  507. package/dist/next/store/backend.d.ts.map +1 -0
  508. package/dist/next/store/backend.js +15 -0
  509. package/dist/next/store/backend.js.map +1 -0
  510. package/dist/next/store/catalog.d.ts +24 -0
  511. package/dist/next/store/catalog.d.ts.map +1 -0
  512. package/dist/next/store/catalog.js +17 -0
  513. package/dist/next/store/catalog.js.map +1 -0
  514. package/dist/next/store/claims.d.ts +23 -0
  515. package/dist/next/store/claims.d.ts.map +1 -0
  516. package/dist/next/store/claims.js +65 -0
  517. package/dist/next/store/claims.js.map +1 -0
  518. package/dist/next/store/columns.d.ts +77 -0
  519. package/dist/next/store/columns.d.ts.map +1 -0
  520. package/dist/next/store/columns.js +77 -0
  521. package/dist/next/store/columns.js.map +1 -0
  522. package/dist/next/store/engine.d.ts +176 -0
  523. package/dist/next/store/engine.d.ts.map +1 -0
  524. package/dist/next/store/engine.js +283 -0
  525. package/dist/next/store/engine.js.map +1 -0
  526. package/dist/next/store/evaluate.d.ts +17 -0
  527. package/dist/next/store/evaluate.d.ts.map +1 -0
  528. package/dist/next/store/evaluate.js +128 -0
  529. package/dist/next/store/evaluate.js.map +1 -0
  530. package/dist/next/store/export.d.ts +17 -0
  531. package/dist/next/store/export.d.ts.map +1 -0
  532. package/dist/next/store/export.js +200 -0
  533. package/dist/next/store/export.js.map +1 -0
  534. package/dist/next/store/expression.d.ts +150 -0
  535. package/dist/next/store/expression.d.ts.map +1 -0
  536. package/dist/next/store/expression.js +268 -0
  537. package/dist/next/store/expression.js.map +1 -0
  538. package/dist/next/store/import.d.ts +10 -0
  539. package/dist/next/store/import.d.ts.map +1 -0
  540. package/dist/next/store/import.js +276 -0
  541. package/dist/next/store/import.js.map +1 -0
  542. package/dist/next/store/index.d.ts +16 -0
  543. package/dist/next/store/index.d.ts.map +1 -0
  544. package/dist/next/store/index.js +13 -0
  545. package/dist/next/store/index.js.map +1 -0
  546. package/dist/next/store/json-column.d.ts +33 -0
  547. package/dist/next/store/json-column.d.ts.map +1 -0
  548. package/dist/next/store/json-column.js +61 -0
  549. package/dist/next/store/json-column.js.map +1 -0
  550. package/dist/next/store/jsonl.d.ts +9 -0
  551. package/dist/next/store/jsonl.d.ts.map +1 -0
  552. package/dist/next/store/jsonl.js +61 -0
  553. package/dist/next/store/jsonl.js.map +1 -0
  554. package/dist/next/store/outbox.d.ts +26 -0
  555. package/dist/next/store/outbox.d.ts.map +1 -0
  556. package/dist/next/store/outbox.js +80 -0
  557. package/dist/next/store/outbox.js.map +1 -0
  558. package/dist/next/store/query.d.ts +39 -0
  559. package/dist/next/store/query.d.ts.map +1 -0
  560. package/dist/next/store/query.js +97 -0
  561. package/dist/next/store/query.js.map +1 -0
  562. package/dist/next/store/refusal.d.ts +15 -0
  563. package/dist/next/store/refusal.d.ts.map +1 -0
  564. package/dist/next/store/refusal.js +36 -0
  565. package/dist/next/store/refusal.js.map +1 -0
  566. package/dist/next/store/rows.d.ts +80 -0
  567. package/dist/next/store/rows.d.ts.map +1 -0
  568. package/dist/next/store/rows.js +183 -0
  569. package/dist/next/store/rows.js.map +1 -0
  570. package/dist/next/store/schema.d.ts +25 -0
  571. package/dist/next/store/schema.d.ts.map +1 -0
  572. package/dist/next/store/schema.js +115 -0
  573. package/dist/next/store/schema.js.map +1 -0
  574. package/dist/next/store/sql.d.ts +73 -0
  575. package/dist/next/store/sql.d.ts.map +1 -0
  576. package/dist/next/store/sql.js +234 -0
  577. package/dist/next/store/sql.js.map +1 -0
  578. package/dist/next/store/step.d.ts +48 -0
  579. package/dist/next/store/step.d.ts.map +1 -0
  580. package/dist/next/store/step.js +50 -0
  581. package/dist/next/store/step.js.map +1 -0
  582. package/dist/next/store/store.d.ts +161 -0
  583. package/dist/next/store/store.d.ts.map +1 -0
  584. package/dist/next/store/store.js +627 -0
  585. package/dist/next/store/store.js.map +1 -0
  586. package/dist/next/store/table-changes.d.ts +29 -0
  587. package/dist/next/store/table-changes.d.ts.map +1 -0
  588. package/dist/next/store/table-changes.js +102 -0
  589. package/dist/next/store/table-changes.js.map +1 -0
  590. package/dist/next/store/table-evolve.d.ts +74 -0
  591. package/dist/next/store/table-evolve.d.ts.map +1 -0
  592. package/dist/next/store/table-evolve.js +201 -0
  593. package/dist/next/store/table-evolve.js.map +1 -0
  594. package/dist/next/store/table-handle.d.ts +67 -0
  595. package/dist/next/store/table-handle.d.ts.map +1 -0
  596. package/dist/next/store/table-handle.js +101 -0
  597. package/dist/next/store/table-handle.js.map +1 -0
  598. package/dist/next/store/table-history.d.ts +75 -0
  599. package/dist/next/store/table-history.d.ts.map +1 -0
  600. package/dist/next/store/table-history.js +42 -0
  601. package/dist/next/store/table-history.js.map +1 -0
  602. package/dist/next/store/table-migration.d.ts +16 -0
  603. package/dist/next/store/table-migration.d.ts.map +1 -0
  604. package/dist/next/store/table-migration.js +202 -0
  605. package/dist/next/store/table-migration.js.map +1 -0
  606. package/dist/next/store/table-writes.d.ts +125 -0
  607. package/dist/next/store/table-writes.d.ts.map +1 -0
  608. package/dist/next/store/table-writes.js +165 -0
  609. package/dist/next/store/table-writes.js.map +1 -0
  610. package/dist/next/store/table.d.ts +80 -0
  611. package/dist/next/store/table.d.ts.map +1 -0
  612. package/dist/next/store/table.js +103 -0
  613. package/dist/next/store/table.js.map +1 -0
  614. package/dist/next/store/text.d.ts +14 -0
  615. package/dist/next/store/text.d.ts.map +1 -0
  616. package/dist/next/store/text.js +51 -0
  617. package/dist/next/store/text.js.map +1 -0
  618. package/dist/next/store/writes.d.ts +5 -0
  619. package/dist/next/store/writes.d.ts.map +1 -0
  620. package/dist/next/store/writes.js +4 -0
  621. package/dist/next/store/writes.js.map +1 -0
  622. package/dist/next-node/compression.d.ts +7 -0
  623. package/dist/next-node/compression.d.ts.map +1 -0
  624. package/dist/next-node/compression.js +24 -0
  625. package/dist/next-node/compression.js.map +1 -0
  626. package/dist/next-node/http/admission.d.ts +63 -0
  627. package/dist/next-node/http/admission.d.ts.map +1 -0
  628. package/dist/next-node/http/admission.js +134 -0
  629. package/dist/next-node/http/admission.js.map +1 -0
  630. package/dist/next-node/http/authenticate.d.ts +21 -0
  631. package/dist/next-node/http/authenticate.d.ts.map +1 -0
  632. package/dist/next-node/http/authenticate.js +34 -0
  633. package/dist/next-node/http/authenticate.js.map +1 -0
  634. package/dist/next-node/http/cookies.d.ts +24 -0
  635. package/dist/next-node/http/cookies.d.ts.map +1 -0
  636. package/dist/next-node/http/cookies.js +62 -0
  637. package/dist/next-node/http/cookies.js.map +1 -0
  638. package/dist/next-node/http/file.d.ts +23 -0
  639. package/dist/next-node/http/file.d.ts.map +1 -0
  640. package/dist/next-node/http/file.js +94 -0
  641. package/dist/next-node/http/file.js.map +1 -0
  642. package/dist/next-node/http/headers.d.ts +37 -0
  643. package/dist/next-node/http/headers.d.ts.map +1 -0
  644. package/dist/next-node/http/headers.js +129 -0
  645. package/dist/next-node/http/headers.js.map +1 -0
  646. package/dist/next-node/http/http.d.ts +100 -0
  647. package/dist/next-node/http/http.d.ts.map +1 -0
  648. package/dist/next-node/http/http.js +462 -0
  649. package/dist/next-node/http/http.js.map +1 -0
  650. package/dist/next-node/http/incoming.d.ts +19 -0
  651. package/dist/next-node/http/incoming.d.ts.map +1 -0
  652. package/dist/next-node/http/incoming.js +31 -0
  653. package/dist/next-node/http/incoming.js.map +1 -0
  654. package/dist/next-node/http/index.d.ts +11 -0
  655. package/dist/next-node/http/index.d.ts.map +1 -0
  656. package/dist/next-node/http/index.js +12 -0
  657. package/dist/next-node/http/index.js.map +1 -0
  658. package/dist/next-node/http/node.d.ts +78 -0
  659. package/dist/next-node/http/node.d.ts.map +1 -0
  660. package/dist/next-node/http/node.js +291 -0
  661. package/dist/next-node/http/node.js.map +1 -0
  662. package/dist/next-node/http/request.d.ts +54 -0
  663. package/dist/next-node/http/request.d.ts.map +1 -0
  664. package/dist/next-node/http/request.js +116 -0
  665. package/dist/next-node/http/request.js.map +1 -0
  666. package/dist/next-node/http/response.d.ts +63 -0
  667. package/dist/next-node/http/response.d.ts.map +1 -0
  668. package/dist/next-node/http/response.js +202 -0
  669. package/dist/next-node/http/response.js.map +1 -0
  670. package/dist/next-node/http/router.d.ts +114 -0
  671. package/dist/next-node/http/router.d.ts.map +1 -0
  672. package/dist/next-node/http/router.js +261 -0
  673. package/dist/next-node/http/router.js.map +1 -0
  674. package/dist/next-node/http/upgrades.d.ts +58 -0
  675. package/dist/next-node/http/upgrades.d.ts.map +1 -0
  676. package/dist/next-node/http/upgrades.js +184 -0
  677. package/dist/next-node/http/upgrades.js.map +1 -0
  678. package/dist/next-node/plugins/build.d.ts +57 -0
  679. package/dist/next-node/plugins/build.d.ts.map +1 -0
  680. package/dist/next-node/plugins/build.js +334 -0
  681. package/dist/next-node/plugins/build.js.map +1 -0
  682. package/dist/next-node/plugins/discover.d.ts +36 -0
  683. package/dist/next-node/plugins/discover.d.ts.map +1 -0
  684. package/dist/next-node/plugins/discover.js +91 -0
  685. package/dist/next-node/plugins/discover.js.map +1 -0
  686. package/dist/next-node/plugins/evaluate.d.ts +33 -0
  687. package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
  688. package/dist/next-node/plugins/evaluate.js +98 -0
  689. package/dist/next-node/plugins/evaluate.js.map +1 -0
  690. package/dist/next-node/plugins/index.d.ts +9 -0
  691. package/dist/next-node/plugins/index.d.ts.map +1 -0
  692. package/dist/next-node/plugins/index.js +11 -0
  693. package/dist/next-node/plugins/index.js.map +1 -0
  694. package/dist/next-node/plugins/install.d.ts +13 -0
  695. package/dist/next-node/plugins/install.d.ts.map +1 -0
  696. package/dist/next-node/plugins/install.js +37 -0
  697. package/dist/next-node/plugins/install.js.map +1 -0
  698. package/dist/next-node/plugins/plugins.d.ts +135 -0
  699. package/dist/next-node/plugins/plugins.d.ts.map +1 -0
  700. package/dist/next-node/plugins/plugins.js +206 -0
  701. package/dist/next-node/plugins/plugins.js.map +1 -0
  702. package/dist/next-node/plugins/runtime.d.ts +41 -0
  703. package/dist/next-node/plugins/runtime.d.ts.map +1 -0
  704. package/dist/next-node/plugins/runtime.js +136 -0
  705. package/dist/next-node/plugins/runtime.js.map +1 -0
  706. package/dist/next-node/plugins/stack.d.ts +16 -0
  707. package/dist/next-node/plugins/stack.d.ts.map +1 -0
  708. package/dist/next-node/plugins/stack.js +61 -0
  709. package/dist/next-node/plugins/stack.js.map +1 -0
  710. package/dist/next-node/plugins/watcher.d.ts +58 -0
  711. package/dist/next-node/plugins/watcher.d.ts.map +1 -0
  712. package/dist/next-node/plugins/watcher.js +281 -0
  713. package/dist/next-node/plugins/watcher.js.map +1 -0
  714. package/dist/next-node/workers/control.d.ts +83 -0
  715. package/dist/next-node/workers/control.d.ts.map +1 -0
  716. package/dist/next-node/workers/control.js +77 -0
  717. package/dist/next-node/workers/control.js.map +1 -0
  718. package/dist/next-node/workers/index.d.ts +5 -0
  719. package/dist/next-node/workers/index.d.ts.map +1 -0
  720. package/dist/next-node/workers/index.js +7 -0
  721. package/dist/next-node/workers/index.js.map +1 -0
  722. package/dist/next-node/workers/lock.d.ts +21 -0
  723. package/dist/next-node/workers/lock.d.ts.map +1 -0
  724. package/dist/next-node/workers/lock.js +137 -0
  725. package/dist/next-node/workers/lock.js.map +1 -0
  726. package/dist/next-node/workers/main.d.ts +46 -0
  727. package/dist/next-node/workers/main.d.ts.map +1 -0
  728. package/dist/next-node/workers/main.js +230 -0
  729. package/dist/next-node/workers/main.js.map +1 -0
  730. package/dist/next-node/workers/process.d.ts +42 -0
  731. package/dist/next-node/workers/process.d.ts.map +1 -0
  732. package/dist/next-node/workers/process.js +125 -0
  733. package/dist/next-node/workers/process.js.map +1 -0
  734. package/dist/next-node/workers/workers.d.ts +80 -0
  735. package/dist/next-node/workers/workers.d.ts.map +1 -0
  736. package/dist/next-node/workers/workers.js +572 -0
  737. package/dist/next-node/workers/workers.js.map +1 -0
  738. package/dist/object.d.ts +4 -4
  739. package/dist/object.d.ts.map +1 -1
  740. package/dist/object.js +3 -4
  741. package/dist/object.js.map +1 -1
  742. package/dist/output.d.ts +9 -3
  743. package/dist/output.d.ts.map +1 -1
  744. package/dist/output.js +21 -9
  745. package/dist/output.js.map +1 -1
  746. package/dist/remote.d.ts.map +1 -1
  747. package/dist/remote.js +2 -2
  748. package/dist/remote.js.map +1 -1
  749. package/dist/schema.d.ts +8 -4
  750. package/dist/schema.d.ts.map +1 -1
  751. package/dist/schema.js +180 -5
  752. package/dist/schema.js.map +1 -1
  753. package/dist/sqlite/cloudflare.d.ts +54 -0
  754. package/dist/sqlite/cloudflare.d.ts.map +1 -0
  755. package/dist/sqlite/cloudflare.js +144 -0
  756. package/dist/sqlite/cloudflare.js.map +1 -0
  757. package/dist/sqlite/database.d.ts +40 -0
  758. package/dist/sqlite/database.d.ts.map +1 -0
  759. package/dist/sqlite/database.js +2 -0
  760. package/dist/sqlite/database.js.map +1 -0
  761. package/dist/sqlite/index.d.ts +4 -0
  762. package/dist/sqlite/index.d.ts.map +1 -0
  763. package/dist/sqlite/index.js +3 -0
  764. package/dist/sqlite/index.js.map +1 -0
  765. package/dist/sqlite/migrations.d.ts +10 -0
  766. package/dist/sqlite/migrations.d.ts.map +1 -0
  767. package/dist/sqlite/migrations.js +33 -0
  768. package/dist/sqlite/migrations.js.map +1 -0
  769. package/dist/sqlite/node.d.ts +41 -0
  770. package/dist/sqlite/node.d.ts.map +1 -0
  771. package/dist/sqlite/node.js +191 -0
  772. package/dist/sqlite/node.js.map +1 -0
  773. package/dist/sqlite/schema.d.ts +3 -0
  774. package/dist/sqlite/schema.d.ts.map +1 -0
  775. package/dist/sqlite/schema.js +10 -0
  776. package/dist/sqlite/schema.js.map +1 -0
  777. package/dist/telemetry-sqlite/index.d.ts +24 -0
  778. package/dist/telemetry-sqlite/index.d.ts.map +1 -0
  779. package/dist/telemetry-sqlite/index.js +273 -0
  780. package/dist/telemetry-sqlite/index.js.map +1 -0
  781. package/dist/telemetry-sqlite/store.d.ts +9 -0
  782. package/dist/telemetry-sqlite/store.d.ts.map +1 -0
  783. package/dist/telemetry-sqlite/store.js +110 -0
  784. package/dist/telemetry-sqlite/store.js.map +1 -0
  785. package/dist/watch.d.ts +194 -0
  786. package/dist/watch.d.ts.map +1 -0
  787. package/dist/watch.js +383 -0
  788. package/dist/watch.js.map +1 -0
  789. package/dist/wire.d.ts +174 -193
  790. package/dist/wire.d.ts.map +1 -1
  791. package/dist/wire.js +81 -80
  792. package/dist/wire.js.map +1 -1
  793. package/docs/guide.md +15 -15
  794. package/docs/next/benchmarks.md +959 -0
  795. package/docs/next/decisions.md +2957 -0
  796. package/docs/next/dependencies/book.md +1671 -0
  797. package/docs/next/dependencies/index.html +2641 -0
  798. package/docs/next/dependencies/model.md +330 -0
  799. package/docs/next/design.md +2554 -0
  800. package/docs/next/durable-observers/book.md +432 -0
  801. package/docs/next/durable-observers/index.html +517 -0
  802. package/docs/next/flow-control/book.md +333 -0
  803. package/docs/next/flow-control/fold/index.html +265 -0
  804. package/docs/next/flow-control/index.html +548 -0
  805. package/docs/next/flow-control/window/index.html +228 -0
  806. package/docs/next/guide-plugins-hosts/book.md +607 -0
  807. package/docs/next/guide-plugins-hosts/index.html +652 -0
  808. package/docs/next/http-workers/book.md +378 -0
  809. package/docs/next/http-workers/index.html +515 -0
  810. package/docs/next/layer-1.md +311 -0
  811. package/docs/next/layer-2.md +216 -0
  812. package/docs/next/plugin-model/book.md +186 -0
  813. package/docs/next/plugin-model/index.html +310 -0
  814. package/docs/next/plugin-primer/book.md +273 -0
  815. package/docs/next/plugin-primer/index.html +430 -0
  816. package/docs/next/slice-1.md +236 -0
  817. package/docs/next/slice-10.md +285 -0
  818. package/docs/next/slice-11.md +93 -0
  819. package/docs/next/slice-2.md +174 -0
  820. package/docs/next/slice-3a.md +296 -0
  821. package/docs/next/slice-3b.md +197 -0
  822. package/docs/next/slice-4.md +146 -0
  823. package/docs/next/slice-4a.md +418 -0
  824. package/docs/next/slice-4b.md +208 -0
  825. package/docs/next/slice-5.md +281 -0
  826. package/docs/next/slice-6a.md +676 -0
  827. package/docs/next/slice-6b.md +332 -0
  828. package/docs/next/slice-7a.md +130 -0
  829. package/docs/next/slice-7b/book.md +608 -0
  830. package/docs/next/slice-7b/index.html +842 -0
  831. package/docs/next/slice-7b.md +255 -0
  832. package/docs/next/slice-7c.md +165 -0
  833. package/docs/next/slice-8.md +194 -0
  834. package/docs/next/slices.md +230 -0
  835. package/docs/next/store/book.md +665 -0
  836. package/docs/next/store/index.html +861 -0
  837. package/docs/next/store/walkthrough.md +193 -0
  838. package/docs/spec.md +9 -9
  839. package/docs/tutorial.md +26 -25
  840. package/package.json +42 -5
  841. package/src/delta/README.md +69 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../../../src/next/host/host.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,oHAAoH;AACpH,sHAAsH;AACtH,wHAAwH;AACxH,kCAAkC;AAGlC,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAElB,eAAe,EACf,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,YAAY,EAAe,MAAM,0BAA0B,CAAC;AACrE,OAA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AC","sourcesContent":["// Hosts (§3): `createHost`, loading facets and the start barrier, links to children, the parent (connected again after\n// a drop) and routes, the origins it relays holds for, getting and holding references as a principal, the heartbeat\n// of every link, revocation (§4), presence (§19) and keep-alive counts, registries and root scopes (slice 8), reloads\n// (slice 7b: staging, the commit, each object's fate, the report), closing; one batch per host, the backoff map and the\n// endings new instances wait for.\n\nimport type { TelemetryContext } from \"@earendil-works/pi-telemetry\";\nimport {\n\tawaitWithContext,\n\tBACKGROUND_CONTEXT,\n\ttype Context,\n\twithAbortSignal,\n\twithoutAbortSignal,\n} from \"../../context/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { Watchable } from \"../../watch.ts\";\nimport type { Address, Contract, HostKind, ParamsOf } from \"../contracts/index.ts\";\nimport { contractData, type Params } from \"../contracts/internal.ts\";\nimport { ChordError, type FailureCause, type Principal, type PrincipalKeyFunction } from \"../data/index.ts\";\nimport {\n\tasChordError,\n\tbinds,\n\tcanonicalJson,\n\tcheckParams,\n\tidentityKey,\n\tinvalid,\n\tprincipalKey,\n} from \"../data/internal.ts\";\nimport { binaryCodec, type Codec, type Compression, type Link, type PartLimits } from \"../link/index.ts\";\nimport { linkLimits } from \"../link/internal.ts\";\nimport type { Registry, RegistryValue } from \"../registries/index.ts\";\nimport type { RegistryValueSource } from \"../registries/internal.ts\";\nimport { type RegistryContribution, type RegistryError, RegistryRecord } from \"../registries/internal.ts\";\nimport {\n\ttype HoldRequest,\n\tHostLink,\n\ttype LinkRole,\n\tPath,\n\ttype ProviderSide,\n\tRemoteObject,\n\ttype Upstream,\n} from \"../remote/internal.ts\";\nimport { Batch, type BatchError } from \"../state/internal.ts\";\nimport type { ChordStore, Store } from \"../store/store.ts\";\nimport { Activity, type ActivityCounts } from \"./activity.ts\";\nimport { type Attempt, notLive } from \"./attempt.ts\";\nimport { Backoff } from \"./backoff.ts\";\nimport { type Caller, type Ctx, withLinkedAbortSignal } from \"./ctx.ts\";\nimport { Destination, type Placed } from \"./destination.ts\";\nimport type { Facet } from \"./facet.ts\";\nimport { contributionOf } from \"./members.ts\";\nimport type { CloseFailed } from \"./native.ts\";\nimport { ChordObject, type Holder, type ReloadFate, type Served } from \"./object.ts\";\nimport { type Presence, References } from \"./presence.ts\";\nimport { Binding, type CheckedParams, type Held, type Reference, type Target } from \"./reference.ts\";\nimport { RevocationKeys, type RevokedBy } from \"./revocation.ts\";\nimport { type RootOptions, RootScopes } from \"./root.ts\";\nimport { Route, type RouteHandle, type RouteOptions } from \"./route.ts\";\nimport {\n\taddStaged,\n\temptyStaged,\n\ttype PluginFacet,\n\ttype Recorded,\n\ttype Request,\n\trecordFactory,\n\ttype Staged,\n\ttype StagedPlugin,\n\ttype StagedRegistry,\n\ttype StagingHost,\n\tstagePlugin,\n} from \"./staging.ts\";\nimport { UnboundIndex, type UnboundRequest } from \"./unbound.ts\";\nimport { uuidv7 } from \"./uuid.ts\";\n\n/** What `createHost` takes; `R` is the app's revocation type (JSON). */\nexport type HostOptions<P extends Principal = Principal, R extends JsonValue = JsonValue> = {\n\t/** This host's address (`Session({ id })`): it serves only objects placed there. Without one, a client. */\n\treadonly address?: Address;\n\t/** Who this host acts as for its own requests; a host without one (a client) has none. */\n\treadonly principal?: P;\n\t/** The key of a principal in identities; L1's canonical JSON by default. The same function on every host. */\n\treadonly principalKey?: PrincipalKeyFunction<P>;\n\t/** The telemetry adapter; NOOP by default. */\n\treadonly telemetry?: TelemetryContext;\n\t/** Everything that fails in the background; every app handles it. */\n\treadonly onError: (error: HostError) => void;\n\t/** How long a native's close, and an ending object's running calls, are waited for; 30 s by default. */\n\treadonly closeTimeout?: number;\n\t/** How long an activation attempt, and a `get`, may take until the object is live; 60 s by default. */\n\treadonly readyTimeout?: number;\n\t/**\n\t * The heartbeat of every link: a link silent for `ping` ms (15 s by default) sends a `ping`; one silent for `close`\n\t * ms (30 s by default), its handshake included, is closed.\n\t */\n\treadonly heartbeat?: { readonly ping?: number; readonly close?: number };\n\t/**\n\t * What revokes a principal (§4): `host.revoke(r)` ends the objects and closes the child links of every principal\n\t * `p` whose `revokedBy(p)` holds `r` (compared as canonical JSON). The same function on every host.\n\t */\n\treadonly revokedBy?: RevokedBy<P, R>;\n\t/**\n\t * A synchronous compressor (`nodeCompression` for Node): JSON parts above 16 KiB this host originates are deflated\n\t * once, and deflated parts it owns inflated in place. Without one (a browser), nothing is compressed and deflated\n\t * parts are inflated asynchronously, later messages of their link waiting in order.\n\t */\n\treadonly compression?: Compression;\n\t/**\n\t * The store persisted documents and tables live in (`openStore`); the app owns it and closes it after the host.\n\t * One open host per store. A `storage_failed` of the store is reported once and closes the host.\n\t */\n\treadonly store?: Store;\n};\n\n/** Where a reported part sits on its object: a routine (`on`, `onLive`) or a native, by kind, from 1 in declaration order. */\nexport type Position = { readonly kind: \"on\" | \"onLive\" | \"native\"; readonly position: number };\n\n/**\n * What `onError` gets, by kind. `object` is the object's type, with its params key when it has params; `failure` is a\n * `FailureCause`, `error` the plain error.\n */\nexport type HostError =\n\t| BatchError\n\t| RegistryError\n\t| { readonly kind: \"activation_failed\"; readonly object: string; readonly failure: FailureCause }\n\t/** A live object failed at runtime (a `migrate` failing on access, a stored version newer than the code). */\n\t| { readonly kind: \"object_failed\"; readonly object: string; readonly failure: FailureCause }\n\t/** The host's store stopped after a backend error: the host closes itself (once). */\n\t| { readonly kind: \"storage_failed\"; readonly error: unknown }\n\t| { readonly kind: \"close_failed\"; readonly object: string; readonly native: Position; readonly error: unknown }\n\t| { readonly kind: \"close_timeout\"; readonly object: string; readonly native: Position }\n\t| { readonly kind: \"drain_timeout\"; readonly object: string }\n\t| { readonly kind: \"protocol_error\"; readonly error: unknown }\n\t| { readonly kind: \"resolve_failed\"; readonly address: string; readonly error: unknown }\n\t/**\n\t * A derive's compute threw (its owner's, once per failure episode: the first failure after a value or after its\n\t * creation; a value ends the episode); `member` when it is an exposed state member.\n\t */\n\t| { readonly kind: \"derive_failed\"; readonly object: string; readonly member?: string; readonly error: unknown }\n\t/** A routine's call threw, or its source failed for good; `routine` is its kind and position. */\n\t| { readonly kind: \"routine_failed\"; readonly object: string; readonly routine: Position; readonly error: unknown }\n\t/** A job's `run` threw (not after an abort): its outcome is `failed { threw }`. */\n\t| {\n\t\t\treadonly kind: \"job_failed\";\n\t\t\treadonly object: string;\n\t\t\treadonly job: string;\n\t\t\treadonly id: string;\n\t\t\treadonly error: unknown;\n\t }\n\t/** A job's `finish` threw: retried with backoff, blocked after five failures in a row. */\n\t| {\n\t\t\treadonly kind: \"job_finish_failed\";\n\t\t\treadonly object: string;\n\t\t\treadonly job: string;\n\t\t\treadonly id: string;\n\t\t\treadonly error: unknown;\n\t }\n\t/** A persisted run was cut off five times in a row by crashes (D6): it ends `failed { restart_limit }`, `finish` runs. */\n\t| {\n\t\t\treadonly kind: \"job_interrupted\";\n\t\t\treadonly object: string;\n\t\t\treadonly job: string;\n\t\t\treadonly id: string;\n\t\t\treadonly restarts: number;\n\t }\n\t/** A blocked run was dropped without `finish`: aborted, or its object ended. */\n\t| { readonly kind: \"job_dropped\"; readonly object: string; readonly job: string; readonly id: string }\n\t/**\n\t * An attempt parked longer than `readyTimeout` (since `since`, `Date.now()` time), whatever its blocker: once per\n\t * parking episode, naming the first blocker in declaration order (`waitingFor`, a reference's label or `registry\n\t * <name>`) and its `state`; a diagnostic of a ring across hosts started at the same moment or a long wait (nothing\n\t * fails).\n\t */\n\t| {\n\t\t\treadonly kind: \"parked_long\";\n\t\t\treadonly object: string;\n\t\t\treadonly waitingFor: string;\n\t\t\treadonly state: \"loading\" | \"failed\";\n\t\t\treadonly since: number;\n\t };\n\n/**\n * What `accept` and `connect` take: the principal of the host at the other end, as this host stamps it; `trusted` skips\n * the message check on the link (IPC to the host's own processes; never grants the principal fields); the codec both\n * ends of the link use (`binaryCodec` by default); and the limits per part of what arrives on it (Q2: none on a\n * trusted link, 16 MiB on the wire and 64 MiB decoded otherwise, unless set).\n */\nexport type LinkOptions<P extends Principal = Principal> = {\n\treadonly principal: P;\n\treadonly trusted?: boolean;\n\treadonly codec?: Codec;\n\treadonly limits?: PartLimits;\n};\n\n/** What `host.get` and `host.hold` take besides the type, the params and the context. */\nexport type GetOptions = {\n\t/**\n\t * A getter's deadline for its whole wait, and how long a call made while the reference is loading waits (the park\n\t * deadline); the host's `readyTimeout` by default.\n\t */\n\treadonly readyTimeout?: number;\n};\n\n/**\n * A host whatever its principal type, as Chord's own parts use it: `ChordHost<P>` is invariant in `P` (`load` takes\n * facets typed for exactly `P`).\n */\nexport type AnyHost = Omit<ChordHost, \"load\" | \"reload\" | \"accept\" | \"connect\" | \"route\" | \"references\" | \"root\">;\n\n/** A host. `P` is the app's principal type, `R` its revocation type. */\nexport interface Host<P extends Principal = Principal, R extends JsonValue = JsonValue> {\n\t/**\n\t * Runs every facet's setup and publishes what they declared in one batch (the types and registries served, the\n\t * registries composed once, the contributions); requests that waited for the publication are placed after that\n\t * batch. Then activates every served type with empty params and resolves when each has had its first outcome (the\n\t * start barrier, decision (a)): live, failed by its own cause, parked with no blocker here still without its first\n\t * outcome, or ended (failures go to `onError`). A plugin whose setup throws or is refused at declaration (its name,\n\t * a type or registry another plugin serves, a remote type here without principal or address, `checkAccepts`) is\n\t * left out and reported (`failed`); it never closes the host. Runs once.\n\t */\n\tload(facets: readonly PluginFacet<P>[], context: Context): Promise<LoadReport>;\n\t/**\n\t * Reloads this host's plugins (slice 7b): `facets` is its complete new plugin set; a plugin in it and not loaded\n\t * is added, one loaded with another facet value is changed (the same facet object is unchanged: untouched), one\n\t * loaded and not in it is removed. Staging runs every new setup and every affected object's new factory against a\n\t * recording `self`, per plugin: a plugin whose new code fails there keeps its old code (an added one is left out),\n\t * and so does a changed plugin whose recorded requests would not bind because of it (the closure rule); both are\n\t * reported (`failed`); `options.failed` names plugins the caller passes as their loaded facet because their new\n\t * code failed before (a build, an evaluation): the same for the closure rule and the report. Then it commits in one\n\t * batch (types, registries,\n\t * contributions; a publication waking the requests for the names it serves) and every object of a changed or\n\t * removed plugin takes its fate: swapped in place, restarted after its drain, retried, or ended (its type\n\t * removed). Resolves with the report once every fate started (swaps and retries checked their dependencies; it\n\t * does not wait for objects to go live). Reloads run one after another. Throws before `load` resolved; rejects\n\t * `released/closed` after `close`; `context`'s abort before the commit rejects `aborted` and changes nothing, after\n\t * it only ends the wait (`aborted`, its `details.committed` naming what the commit applied: `CommittedReload`).\n\t */\n\treload(facets: readonly PluginFacet<P>[], context: Context, options?: ReloadOptions): Promise<ReloadReport>;\n\t/**\n\t * A reference once its object is live (and hydrated). It acts as the host's principal and goes where its type's host\n\t * address puts it: here, over a route, or over the parent link (`Destination`). It waits while the reference is\n\t * `loading` (before the host's publication too), `failed { transient }` or `failed { waiting }` until its\n\t * `readyTimeout`, then rejects with the last cause and releases the reference; a broken failure rejects at once.\n\t */\n\tget<C extends Contract>(Type: C, params: ParamsOf<C>, context: Context, options?: GetOptions): Promise<Reference<C>>;\n\t/**\n\t * A reference at once, following its object until released: loading, live, failed (retried as its object is) and\n\t * loading again while its link is down; it never rejects. Throws at once only for invalid params (also before\n\t * `load`). A type not served where it goes is `loading` before the host's publication and `failed { waiting }` after\n\t * it (bound when a publication serves it); a `hostAddress` or route that refuses fails it broken. Its `variant` is\n\t * `undefined` until its first binding.\n\t */\n\thold<C extends Contract>(Type: C, params: ParamsOf<C>, context: Context, options?: GetOptions): Held<C>;\n\t/**\n\t * A link from a child: this host serves its remote types over it, every hold and call arriving on it acting as\n\t * `principal`. `context` is the parent of the work arriving on it (its cancellation is dropped).\n\t */\n\taccept(link: Link, options: LinkOptions<P>, context: Context): void;\n\t/**\n\t * This host's parent link: remote types not served here and not routed are held over it, every such reference held\n\t * again on a new one; holds arriving on it may name whom they act for. Throws while the previous one is open; once\n\t * it closed (a drop), `connect` takes the next. `principal` is who the parent is.\n\t */\n\tconnect(link: Link, options: LinkOptions<P>, context: Context): void;\n\t/**\n\t * How this host reaches hosts of `Kind` (called before `load`, once per kind): `authorize` admits every hold routed\n\t * over it, `resolve` makes the link of an address, for a new hold, on `retry`, or once after a link that completed\n\t * its handshake dropped while held (no timer). A rejected `resolve`, or a link closed before its handshake, fails the\n\t * address's holders `failed { waiting }` (they stay on its path). `context` is the parent of the route's work (its\n\t * `resolve`s, the holds and calls on its links), aborted for it when this host closes. Returns the address controls.\n\t */\n\troute<N extends string, Q extends Params>(\n\t\tKind: HostKind<N, Q>,\n\t\toptions: RouteOptions<P, HostKind<N, Q>>,\n\t\tcontext: Context,\n\t): RouteHandle<HostKind<N, Q>>;\n\t/**\n\t * Revokes `revocation` (§4, R10, R11), synchronously: every remote object whose principal it revokes (`revokedBy`)\n\t * ends at once, whatever references remain (holders get `forbidden`, running calls are aborted, an activation is\n\t * abandoned); every child link whose principal it revokes closes (never the parent, never this host's own\n\t * principal); and every route link is sent `revoke`, which the host there applies with its own `revokedBy`. Nothing\n\t * is replayed to links made later.\n\t */\n\trevoke(revocation: R, context: Context): void;\n\t/**\n\t * The references to objects of `Type` on this host (§19), one entry per reference: the object's params, the\n\t * principal it acts as (remote types) and its origin, the incarnation of the host it was made for (two tabs are two\n\t * origins). Changes in the batch where a reference binds or ends; a link drop is a departure.\n\t */\n\treferences<C extends Contract>(Type: C): Watchable<readonly Presence<C, P>[]>;\n\t/**\n\t * The work keeping this host busy, for the app's supervisor: holds arriving over links and served here, method\n\t * calls running, running jobs and lingering objects; published at most once per microtask turn with changes.\n\t */\n\treadonly activity: Watchable<ActivityCounts>;\n\t/**\n\t * Registry `R`'s composed value as `R`'s version sees it, for code outside objects, once it is usable: waits for the\n\t * host's publication, then while it has no value (`unavailable/undeclared` without a provider, a first `compose`\n\t * that threw, a version not served here: `contract_mismatch`) until its `readyTimeout`, then rejects with the last\n\t * error.\n\t */\n\tregistry<C, V>(R: Registry<C, V>, context: Context, options?: GetOptions): Promise<RegistryValue<V>>;\n\t/**\n\t * Runs `fn` with a call context for code outside objects (a Durable tool, a CLI): the host's principal (or\n\t * `options.principal`; an explicit `undefined` runs anonymous), this host's incarnation, `context`'s telemetry and signal, `ctx.get`. When `fn` settles or\n\t * `context` aborts, the context is sealed: its signal aborted, `ctx.get` refused `released`, every reference it took\n\t * released; an abort rejects at once. `host.close` seals the open ones; after it, `root` rejects `released`.\n\t */\n\troot<T>(fn: (ctx: Ctx<P>) => Promise<T>, context: Context, options?: RootOptions<P>): Promise<T>;\n\t/**\n\t * Closes its links, seals its root scopes, then ends every object at once, then drains and closes them one by one,\n\t * the last to go live first (reason `close`). Rejects with an `AggregateError` of the closes that threw.\n\t */\n\tclose(context: Context): Promise<void>;\n}\n\n/** A plugin left out at `load`, or whose new code failed at a reload (it kept its old code, if it had any), and why. */\nexport type PluginFailure = { readonly plugin: string; readonly error: unknown };\n\n/**\n * What a reload's commit applied, by plugin name: the `details.committed` of the `aborted` error of a reload whose\n * context aborted after its commit (the commit stands; only the wait for the report ended).\n */\nexport type CommittedReload = {\n\treadonly added: readonly string[];\n\treadonly changed: readonly string[];\n\treadonly removed: readonly string[];\n\t/** The plugins whose new code failed: they kept their old code (an added one was left out). */\n\treadonly failed: readonly string[];\n};\n\n/** What `host.reload` takes besides the plugin set: the plugins whose new code failed before it (a build, an evaluation). */\nexport type ReloadOptions = { readonly failed?: readonly PluginFailure[] };\n\n/** What `load` did (decision \"Per plugin at startup and reload\"): the plugins it left out. */\nexport type LoadReport = { readonly failed: readonly PluginFailure[] };\n\n/**\n * What a reload did (slice 7b §1): its plugins by change (those applied), the plugins whose new code failed, and what\n * every affected object did.\n */\nexport type ReloadReport = {\n\treadonly plugins: {\n\t\treadonly added: readonly string[];\n\t\treadonly changed: readonly string[];\n\t\treadonly removed: readonly string[];\n\t};\n\treadonly failed: readonly PluginFailure[];\n\t/** Every live, activating, parked or failed object of a changed or removed plugin, by its label. */\n\treadonly objects: readonly ReloadedObject[];\n};\n\n/**\n * One object's fate in a reload: `swapped` (pure, in place), `restarted` (natives: drained, closed with reason\n * `reload`, activated again), `ended` (its type is gone), `parked` (its new code waits for a dependency, `cause`), or\n * `retried` (it was failed, parked or activating: a new attempt runs on the new code).\n */\nexport type ReloadedObject = { readonly object: string } & (\n\t| { readonly kind: \"swapped\" }\n\t| { readonly kind: \"restarted\" }\n\t| { readonly kind: \"ended\" }\n\t| { readonly kind: \"parked\"; readonly cause: FailureCause }\n\t| { readonly kind: \"retried\" }\n);\n\n/**\n * What a hold placed here binds to (`serving`): its object, or why it waits unbound (`failed { waiting }`: not served,\n * another version, or placed elsewhere by the provider's code).\n */\nexport type Serving =\n\t| { readonly kind: \"object\"; readonly object: ChordObject }\n\t| { readonly kind: \"waiting\"; readonly cause: FailureCause };\n\n/**\n * A published plugin: its facet (an unchanged reload passes the same object), what its setup staged (a reload that\n * keeps it uses it again, its setup not run) and its contributions in the registries' tables.\n */\ntype LoadedPlugin<P extends Principal> = {\n\treadonly facet: Facet<P>;\n\treadonly staged: StagedPlugin;\n\treadonly contributions: readonly RegistryContribution[];\n};\n\n/**\n * What a reload staged: the staged set, the facets of the plugins it applies, the plugins by change, those that failed,\n * and each affected object's fate.\n */\ntype ReloadPlan<P extends Principal> = {\n\treadonly staged: Staged;\n\treadonly facets: ReadonlyMap<string, Facet<P>>;\n\treadonly added: readonly string[];\n\treadonly changed: readonly string[];\n\treadonly removed: readonly string[];\n\treadonly failed: readonly PluginFailure[];\n\treadonly fates: readonly PlannedFate[];\n};\n\n/** One staging pass of a reload: its plan, or the plugins it found failing (staging runs again without their new code). */\ntype StagingPass<P extends Principal> =\n\t| { readonly kind: \"staged\"; readonly plan: ReloadPlan<P>; readonly recorded: readonly RecordedFactory[] }\n\t| { readonly kind: \"failed\"; readonly failed: ReadonlyMap<string, unknown> };\n\n/** A recorded new factory of an object staging planned a fate for: whose new code it is, and what it declared. */\ntype RecordedFactory = { readonly plugin: string; readonly recorded: Recorded };\n\n/** An affected object's fate, as staging decided it. */\ntype PlannedFate =\n\t| { readonly kind: \"end\"; readonly object: ChordObject }\n\t| { readonly kind: ReloadFate; readonly object: ChordObject; readonly served: Served };\n\n/** A fate started by a reload's commit, for its report: a swap's or retry's new attempt is checked first. */\ntype StartedFate =\n\t| { readonly object: string; readonly kind: \"ended\" }\n\t| { readonly object: string; readonly kind: \"swapped\" | \"restarted\" | \"retried\"; readonly attempt: Attempt };\n\n/** Creates a host. */\nexport function createHost<P extends Principal = Principal, R extends JsonValue = JsonValue>(\n\toptions: HostOptions<P, R>,\n): Host<P, R> {\n\treturn new ChordHost<P, R>(options);\n}\n\n/** No activation chain (Q5). */\nconst NO_CHAIN: readonly string[] = [];\n\n/** The params of a type with empty params, as checked: nothing, and the empty key. */\nconst EMPTY_PARAMS: CheckedParams = { params: {}, key: \"\" };\n\n/** The host: its served types, its objects by identity, its batch, backoff and endings. */\nexport class ChordHost<P extends Principal = Principal, R extends JsonValue = JsonValue> implements Host<P, R> {\n\treadonly batch: Batch;\n\treadonly timeouts: { readonly close: number; readonly ready: number };\n\treadonly backoff = new Backoff((identity) => this.#due(identity));\n\treadonly address: Address | undefined;\n\treadonly principal: P | undefined;\n\t/** This run of the host, sent in every handshake (R20). */\n\treadonly incarnation = uuidv7();\n\treadonly compression: Compression | undefined;\n\t/** The host's store, if it has one. */\n\treadonly store: ChordStore | undefined;\n\treadonly #activity: Activity;\n\treadonly #principalKey: PrincipalKeyFunction<P> | undefined;\n\treadonly #revocationKeys: RevocationKeys;\n\t/** The presence list of each type someone asked about (`references`), by type name. */\n\treadonly #references = new Map<string, References>();\n\treadonly #onError: (error: HostError) => void;\n\t/** The served types by name: the published plugin set's (a reload's commit replaces it). */\n\t#types = new Map<string, Served>();\n\t/** The published plugins by name: their facet (an unchanged one is the same object), registries and contributions. */\n\treadonly #plugins = new Map<string, LoadedPlugin<P>>();\n\t/** The reloads, one after another (slice 7b §1): the last one's end, which the next one waits for. */\n\t#reloading: Promise<void> = Promise.resolve();\n\t/** By identity, in the order they went live (the others where they were created). */\n\treadonly #objects = new Map<string, ChordObject>();\n\t/** Teardowns still running, by identity: the next instance of an identity waits for its previous ones. */\n\treadonly #endings = new Map<string, Promise<void>>();\n\t/** The requests that cannot bind yet, by name: before the publication all of them, then those left unbound. */\n\treadonly #unbound = new UnboundIndex();\n\t/** Resolved at the host's first publication (`load`'s batch), or its close. */\n\treadonly #publication = Promise.withResolvers<void>();\n\t#published = false;\n\t/** Every open link: children, routes and the parent. */\n\treadonly #links = new Set<HostLink>();\n\t/** Where holds go that are not served here and not routed: the parent link, across reconnects. */\n\treadonly #parent = new Path(() => {});\n\t/**\n\t * Remote references failed for a part past a link's limits: on no link's path (no reconnect holds them, no route\n\t * resolves for them) until `ref.retry()` places them anew; ended at `close` like the others.\n\t */\n\treadonly unplaced = new Path(() => {});\n\treadonly #routes = new Map<string, Route>();\n\treadonly #destination: Destination;\n\t/** The downstream origins this host relays holds for, by their number on upstream links (never reused). */\n\treadonly relays = new Map<number, ProviderSide>();\n\t#nextOrigin = 1;\n\t/** Aborted when the host closes: the context of every route's `resolve`, and the end of waiting `host.registry`s. */\n\treadonly #routing = new AbortController();\n\treadonly #heartbeat: { readonly ping: number; readonly close: number };\n\t/** Its registries by name, each made by its first use (a serve, a contribution or a reader). */\n\treadonly #registries = new Map<string, RegistryRecord>();\n\treadonly #roots = new RootScopes(this);\n\t/** The one heartbeat timer, running while the host has a link. */\n\t#ticking: ReturnType<typeof setInterval> | undefined;\n\t#state: \"new\" | \"loading\" | \"loaded\" | \"closed\" = \"new\";\n\t/** The one closing, which every `close` returns. */\n\t#closing: Promise<void> | undefined;\n\n\tconstructor(options: HostOptions<P>) {\n\t\tthis.address = options.address;\n\t\tthis.principal = options.principal;\n\t\tthis.#principalKey = options.principalKey;\n\t\tthis.#onError = options.onError;\n\t\tthis.batch = new Batch((error) => this.report(error), options.telemetry?.metrics);\n\t\tthis.compression = options.compression;\n\t\tthis.#activity = new Activity(this.batch);\n\t\t// `revokedBy` is called with this host's principals only, the `P`s its links stamp.\n\t\tthis.#revocationKeys = new RevocationKeys(options.revokedBy as RevokedBy<Principal, JsonValue> | undefined);\n\t\tthis.timeouts = { close: options.closeTimeout ?? 30_000, ready: options.readyTimeout ?? 60_000 };\n\t\tthis.#heartbeat = { ping: options.heartbeat?.ping ?? 15_000, close: options.heartbeat?.close ?? 30_000 };\n\t\tthis.#destination = new Destination(this.address, this.#routes, this.#parent);\n\t\t// Chord's own: `openStore` made it.\n\t\tthis.store = options.store as ChordStore | undefined;\n\t\tthis.store?.attach({ failed: (error) => this.#storageFailed(error), batch: this.batch });\n\t}\n\n\tasync load(facets: readonly PluginFacet<P>[], context: Context): Promise<LoadReport> {\n\t\tthis.batch.assertOutside(\"load\");\n\t\tthis.#assertOpen();\n\t\tif (this.#state !== \"new\") throw new Error(\"load runs once per host\");\n\t\tthis.#state = \"loading\";\n\t\tconst staged = emptyStaged();\n\t\tconst loaded = new Map<string, Facet<P>>();\n\t\tconst failed: PluginFailure[] = [];\n\t\t// A name given twice is refused the second time whether or not the first staged.\n\t\tconst given = new Set<string>();\n\t\t// In the given order: of two plugins serving one name, the later is left out.\n\t\tfor (const plugin of facets) {\n\t\t\tconst twice = given.has(plugin.name);\n\t\t\tgiven.add(plugin.name);\n\t\t\tconst error = twice ? loadedTwice(plugin.name) : this.#stageInto(staged, plugin);\n\t\t\tif (error === undefined) loaded.set(plugin.name, plugin.facet);\n\t\t\telse failed.push({ plugin: plugin.name, error });\n\t\t}\n\t\tthis.#types = staged.types;\n\t\t// The publication: the types and registries served, the facets' contributions and the first composition of\n\t\t// every served registry, in one batch, before any object activates.\n\t\tthis.batch.commit(() => {\n\t\t\tthis.#publish(staged, loaded);\n\t\t\tfor (const record of this.#registries.values()) record.composeServed();\n\t\t}, context);\n\t\t// After the batch: what waited for the publication is placed (the gate lasted only for the setups).\n\t\tthis.#published = true;\n\t\tthis.#publication.resolve();\n\t\tthis.#unbound.wakeAll();\n\t\tconst objects = [...this.#types.values()]\n\t\t\t.filter((served) => served.kind === \"local\" && served.hostLifetime)\n\t\t\t.map((served) => this.#object(served, EMPTY_PARAMS, undefined, context));\n\t\tawait Promise.all(objects.map(({ firstOutcome }) => firstOutcome));\n\t\tif (this.#state === \"loading\") this.#state = \"loaded\";\n\t\treturn { failed };\n\t}\n\n\t/**\n\t * Whether a request for `Type` with `params` binds to `served` as a real bind checks it (`bind`): its kind, version\n\t * and fingerprint, and the provider's own host address; one whose `hostAddress` throws does not.\n\t */\n\t#wouldBind(served: Served, Type: Contract, params: ParamsOf<Contract>): boolean {\n\t\tif (unboundCause(served, Type.kind, Type.name, Type.version, Type.fingerprint) !== undefined) return false;\n\t\ttry {\n\t\t\treturn this.#misplaced(Type, served, params) === undefined;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Whether a request for `Type` with `params` goes here; a `hostAddress` that throws: not here (it fails at bind). */\n\t#placedHere(Type: Contract, params: ParamsOf<Contract>): boolean {\n\t\ttry {\n\t\t\treturn this.#destination.placedHere(Type, params);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Stages `plugin`'s new code into `staged`: the error that refuses it (its setup, a declaration, a name served twice). */\n\t#stageInto(staged: Staged, plugin: PluginFacet<P>): unknown {\n\t\ttry {\n\t\t\treturn addStaged(staged, stagePlugin(plugin, this.#stagingHost()));\n\t\t} catch (error) {\n\t\t\treturn error;\n\t\t}\n\t}\n\n\treload(facets: readonly PluginFacet<P>[], context: Context, options: ReloadOptions = {}): Promise<ReloadReport> {\n\t\tthis.batch.assertOutside(\"reload\");\n\t\tif (this.#state === \"closed\") return Promise.reject(this.#closedError());\n\t\tif (this.#state !== \"loaded\") throw new Error(\"reload runs after load\");\n\t\tconst reload = this.#reloading.then(() => this.#reload(facets, options.failed ?? [], context));\n\t\t// The tail settles to nothing: a report kept as its value would keep a rejected facet's closure (its error).\n\t\tthis.#reloading = reload.then(\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\treturn reload;\n\t}\n\n\t/** One reload, after the previous one: staging, the commit, the fates, the report. */\n\tasync #reload(\n\t\tfacets: readonly PluginFacet<P>[],\n\t\tbefore: readonly PluginFailure[],\n\t\tcontext: Context,\n\t): Promise<ReloadReport> {\n\t\tthis.#assertOpen();\n\t\tif (context.abortSignal?.aborted) throw reloadAborted();\n\t\tconst plan = this.#stageReload(facets, before, context);\n\t\t// Aborted while it staged (a setup may abort it synchronously): nothing changed.\n\t\tif (context.abortSignal?.aborted) throw reloadAborted();\n\t\tconst started = this.#commit(plan, context);\n\t\tconst { added, changed, removed, failed } = plan;\n\t\tconst plugins = { added, changed, removed };\n\t\tconst committed: CommittedReload = { ...plugins, failed: failed.map(({ plugin }) => plugin) };\n\t\tconst objects = await this.#report(started, committed, context);\n\t\treturn { plugins, failed, objects };\n\t}\n\n\t/**\n\t * Staging (slice 7b §2), synchronous (no request or arriving hold meets it half done), per plugin (decision \"Per\n\t * plugin at startup and reload\"): a pass stages the new code (`#stagePass`); a plugin whose new code fails there\n\t * (or failed `before`, passed as its loaded facet) keeps its old code (an added one is left out) and staging runs\n\t * again without it; then a changed plugin whose recorded requests would not bind because of such a plugin keeps its\n\t * old code too (`#closure`), until nothing more fails. Bounded by the number of plugins with new code.\n\t */\n\t#stageReload(facets: readonly PluginFacet<P>[], before: readonly PluginFailure[], context: Context): ReloadPlan<P> {\n\t\tconst failed = new Map(before.map(({ plugin, error }) => [plugin, error]));\n\t\tconst given = new Map<string, Facet<P>>();\n\t\t// A name given twice: the second is refused, the first staged.\n\t\tconst twice: PluginFailure[] = [];\n\t\tfor (const { name, facet } of facets) {\n\t\t\tif (given.has(name)) twice.push({ plugin: name, error: loadedTwice(name) });\n\t\t\telse given.set(name, facet);\n\t\t}\n\t\tfor (;;) {\n\t\t\tconst pass = this.#stagePass(given, failed, context);\n\t\t\tif (pass.kind === \"failed\") {\n\t\t\t\tfor (const [name, error] of pass.failed) failed.set(name, error);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst kept = this.#closure(pass.plan, pass.recorded, failed);\n\t\t\tif (kept.size > 0) {\n\t\t\t\tfor (const [name, error] of kept) failed.set(name, error);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst failures = [...failed].map(([plugin, error]) => ({ plugin, error }));\n\t\t\treturn { ...pass.plan, failed: [...twice, ...failures] };\n\t\t}\n\t}\n\n\t/**\n\t * One staging pass: the loaded entries of the plugins kept as they are (unchanged, or failed: their setups not run\n\t * again) first, then every other plugin's new code in the given order (one refused by a name the table has already\n\t * fails), then the new factory of every object of a changed or removed plugin whose type is still served (a throw\n\t * fails the plugin serving it). Its plan, or the plugins that failed.\n\t */\n\t#stagePass(\n\t\tgiven: ReadonlyMap<string, Facet<P>>,\n\t\tfailed: ReadonlyMap<string, unknown>,\n\t\tcontext: Context,\n\t): StagingPass<P> {\n\t\tconst staged = emptyStaged();\n\t\tconst failing = new Map<string, unknown>();\n\t\tconst fresh: PluginFacet<P>[] = [];\n\t\tfor (const [name, facet] of given) {\n\t\t\tconst loaded = this.#plugins.get(name);\n\t\t\tif (loaded !== undefined && (loaded.facet === facet || failed.has(name))) addStaged(staged, loaded.staged);\n\t\t\telse if (!failed.has(name)) fresh.push({ name, facet });\n\t\t}\n\t\tfor (const plugin of fresh) {\n\t\t\tconst error = this.#stageInto(staged, plugin);\n\t\t\tif (error !== undefined) failing.set(plugin.name, error);\n\t\t}\n\t\tif (failing.size > 0) return { kind: \"failed\", failed: failing };\n\t\tconst applied = new Set(fresh.map(({ name }) => name));\n\t\tconst removed = [...this.#plugins.keys()].filter((name) => !given.has(name));\n\t\tconst reloaded = new Set([...applied, ...removed]);\n\t\tconst fates: PlannedFate[] = [];\n\t\tconst recorded: RecordedFactory[] = [];\n\t\tfor (const object of this.#objects.values()) {\n\t\t\tif (!reloaded.has(object.served.plugin)) continue;\n\t\t\tconst served = staged.types.get(object.served.contract.name);\n\t\t\tif (served === undefined || served.kind !== object.served.kind) {\n\t\t\t\tfates.push({ kind: \"end\", object });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst declared = recordFactory(object, served, context);\n\t\t\t\trecorded.push({ plugin: served.plugin, recorded: declared });\n\t\t\t\tfates.push({ kind: object.reloadFate(declared), object, served });\n\t\t\t} catch (error) {\n\t\t\t\tif (!failing.has(served.plugin)) failing.set(served.plugin, error);\n\t\t\t}\n\t\t}\n\t\tif (failing.size > 0) return { kind: \"failed\", failed: failing };\n\t\tconst facets = new Map(fresh.map(({ name, facet }) => [name, facet]));\n\t\tconst added = fresh.filter(({ name }) => !this.#plugins.has(name)).map(({ name }) => name);\n\t\tconst changed = fresh.filter(({ name }) => this.#plugins.has(name)).map(({ name }) => name);\n\t\tconst plan = { staged, facets, added, changed, removed, failed: [], fates };\n\t\treturn { kind: \"staged\", plan, recorded };\n\t}\n\n\t/**\n\t * The closure rule: the changed plugins (new code applied) of `plan` with a recorded request that would not bind in\n\t * the staged table because of a plugin that failed in this reload: its name served there by such a plugin's old code,\n\t * or not served at all while some plugin failed (what a failed setup would have served is unknown). Requests to\n\t * another host are not checked (a rollout's rules). Each such plugin with the error it keeps its old code for.\n\t */\n\t#closure(\n\t\tplan: ReloadPlan<P>,\n\t\trecorded: readonly RecordedFactory[],\n\t\tfailed: ReadonlyMap<string, unknown>,\n\t): Map<string, unknown> {\n\t\tconst kept = new Map<string, unknown>();\n\t\tif (failed.size === 0) return kept;\n\t\tfor (const { plugin, recorded: declared } of recorded) {\n\t\t\tif (kept.has(plugin) || !plan.facets.has(plugin)) continue;\n\t\t\tfor (const request of declared.requests) {\n\t\t\t\tconst unbound = this.#unboundRequest(plan.staged, request, failed);\n\t\t\t\tif (unbound === undefined) continue;\n\t\t\t\tkept.set(plugin, new Error(`plugin \"${plugin}\": ${unbound}`));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn kept;\n\t}\n\n\t/**\n\t * Why `request` (of a new factory) would not bind in `staged` because of a plugin in `failed`; `undefined`\n\t * when it binds, is placed on another host, or does not bind for another reason (it waits as any request does).\n\t */\n\t#unboundRequest(staged: Staged, request: Request, failed: ReadonlyMap<string, unknown>): string | undefined {\n\t\tconst name = request.kind === \"type\" ? request.contract.name : request.registry.name;\n\t\tconst provider = request.kind === \"type\" ? staged.types.get(name)?.plugin : staged.registries.get(name)?.plugin;\n\t\tif (provider !== undefined && !failed.has(provider)) return undefined;\n\t\tif (request.kind === \"type\") {\n\t\t\tconst { contract, params } = request;\n\t\t\t// A remote type the object reaches on another host: placed by the rollout's rules, not this host's.\n\t\t\tif (!this.#placedHere(contract, params)) return undefined;\n\t\t\tconst served = staged.types.get(name);\n\t\t\tif (served !== undefined && this.#wouldBind(served, contract, params)) return undefined;\n\t\t\treturn provider === undefined\n\t\t\t\t? `needs ${name} v${contract.version}, which no plugin serves now (a plugin failed)`\n\t\t\t\t: `needs ${name} v${contract.version}, which plugin \"${provider}\" serves on its old code`;\n\t\t}\n\t\tconst served = staged.registries.get(name);\n\t\tif (served !== undefined && registryServes(served, request.registry.version)) return undefined;\n\t\treturn provider === undefined\n\t\t\t? `needs registry ${name} v${request.registry.version}, which no plugin serves now (a plugin failed)`\n\t\t\t: `needs registry ${name} v${request.registry.version}, which plugin \"${provider}\" serves on its old code`;\n\t}\n\n\t/**\n\t * The commit (slice 7b §3), one batch: the served types become the staged ones (an unchanged plugin's stay as\n\t * they were), the removed plugins' registry providers go and the reloaded ones' are replaced, their facet\n\t * contributions replaced by plugin, every changed registry composed once; a removed type's presence list goes.\n\t * Then each object takes its fate, host-lifetime objects of new types start, and the publication wakes the\n\t * requests waiting for the names the reload serves.\n\t */\n\t#commit(plan: ReloadPlan<P>, context: Context): readonly StartedFate[] {\n\t\tconst { staged, changed, removed } = plan;\n\t\tconst published = new Set(plan.facets.keys());\n\t\t// A kept plugin's types are its loaded ones, as they are: its objects are untouched.\n\t\tconst types = staged.types;\n\t\tthis.batch.commit(() => {\n\t\t\tfor (const name of [...changed, ...removed]) {\n\t\t\t\tconst loaded = this.#plugins.get(name)!;\n\t\t\t\tfor (const registry of loaded.staged.registries.keys()) {\n\t\t\t\t\tif (staged.registries.get(registry)?.plugin !== name) this.registryRecord(registry).unserve();\n\t\t\t\t}\n\t\t\t\tfor (const contribution of loaded.contributions) contribution.record.remove(contribution);\n\t\t\t\tthis.#plugins.delete(name);\n\t\t\t}\n\t\t\tthis.#types = types;\n\t\t\tthis.#publish(staged, plan.facets);\n\t\t\tfor (const name of published) {\n\t\t\t\tfor (const registry of staged.plugins.get(name)!.registries.keys()) {\n\t\t\t\t\tthis.registryRecord(registry).composeServed();\n\t\t\t\t}\n\t\t\t}\n\t\t}, context);\n\t\tfor (const name of this.#references.keys()) if (!types.has(name)) this.#references.delete(name);\n\t\tconst names = new Set<string>();\n\t\tfor (const [name, served] of types) if (published.has(served.plugin)) names.add(name);\n\t\tfor (const [name, { plugin }] of staged.registries) if (published.has(plugin)) names.add(name);\n\t\tconst started = plan.fates.map((fate) => this.#startFate(fate));\n\t\tfor (const type of types.values()) {\n\t\t\tif (type.kind === \"local\" && type.hostLifetime) this.#object(type, EMPTY_PARAMS, undefined, context);\n\t\t}\n\t\tthis.#unbound.wake(names);\n\t\treturn started;\n\t}\n\n\t/**\n\t * Starts one object's fate after the commit (slice 7b §4): a removed type's object ends, its holders waiting\n\t * `not_served`; any other swaps, restarts or retries on its new served type.\n\t */\n\t#startFate(fate: PlannedFate): StartedFate {\n\t\tconst { object } = fate;\n\t\tif (fate.kind === \"end\") {\n\t\t\tconst error = new ChordError({\n\t\t\t\tcode: \"unavailable\",\n\t\t\t\tmessage: `${object.served.contract.name} is not served here`,\n\t\t\t});\n\t\t\tobject.remove({ kind: \"waiting\", error });\n\t\t\treturn { object: object.label, kind: \"ended\" };\n\t\t}\n\t\tconst attempt = object.reload(fate.served, fate.kind);\n\t\treturn { object: object.label, kind: STARTED[fate.kind], attempt };\n\t}\n\n\t/**\n\t * The report, once every swap and retry had its first dependency check (a parked one reports why); restarts are\n\t * reported at once (their check follows the drain). `context`'s abort ends only this wait (`aborted`, its `details`\n\t * naming what the commit applied: `committed`).\n\t */\n\tasync #report(\n\t\tstarted: readonly StartedFate[],\n\t\tcommitted: CommittedReload,\n\t\tcontext: Context,\n\t): Promise<ReloadedObject[]> {\n\t\tconst checks = started.map(async (fate): Promise<ReloadedObject> => {\n\t\t\tif (fate.kind === \"ended\" || fate.kind === \"restarted\") return { object: fate.object, kind: fate.kind };\n\t\t\tconst cause = await fate.attempt.checked;\n\t\t\treturn cause === undefined\n\t\t\t\t? { object: fate.object, kind: fate.kind }\n\t\t\t\t: { object: fate.object, kind: \"parked\", cause };\n\t\t});\n\t\ttry {\n\t\t\treturn await awaitWithContext(Promise.all(checks), context);\n\t\t} catch {\n\t\t\tconst { added, changed, removed, failed } = committed;\n\t\t\tconst details = {\n\t\t\t\tcommitted: { added: [...added], changed: [...changed], removed: [...removed], failed: [...failed] },\n\t\t\t};\n\t\t\tthrow new ChordError({ code: \"aborted\", message: \"reload: aborted after its commit\", details });\n\t\t}\n\t}\n\n\t/** This host as staging sees it: whom it acts as, its address and its presence lists. */\n\t#stagingHost(): StagingHost {\n\t\t// Setups get presence lists of this host's `P`; staging passes them on as they are.\n\t\tconst references = (Type: Contract) => this.references(Type);\n\t\treturn { principal: this.principal, address: this.address, references: references as StagingHost[\"references\"] };\n\t}\n\n\tasync get<C extends Contract>(\n\t\tType: C,\n\t\tparams: ParamsOf<C>,\n\t\tcontext: Context,\n\t\toptions: GetOptions = {},\n\t): Promise<Reference<C>> {\n\t\tconst binding = await this.acquire(Type, params, this.#own(), context, options);\n\t\t// The binding was built from `Type`'s members.\n\t\treturn binding.reference as Reference<C>;\n\t}\n\n\thold<C extends Contract>(Type: C, params: ParamsOf<C>, context: Context, options: GetOptions = {}): Held<C> {\n\t\tthis.batch.assertOutside(\"hold\");\n\t\t// The binding was built from `Type`'s members; it may be unbound, so `variant` may be undefined.\n\t\treturn this.#hold(Type, params, this.#own(), context, options).reference as Held<C>;\n\t}\n\n\taccept(link: Link, options: LinkOptions<P>, context: Context): void {\n\t\tthis.#assertOpen();\n\t\tthis.#link(link, \"child\", options, context);\n\t}\n\n\tconnect(link: Link, options: LinkOptions<P>, context: Context): void {\n\t\tthis.#assertOpen();\n\t\tif (this.#parent.link !== undefined) throw new Error(\"connect: this host has an open parent link\");\n\t\tconst parent = this.#link(link, \"parent\", options, context);\n\t\tif (parent.open) this.#parent.connected(parent);\n\t}\n\n\troute<N extends string, Q extends Params>(\n\t\tKind: HostKind<N, Q>,\n\t\toptions: RouteOptions<P, HostKind<N, Q>>,\n\t\tcontext: Context,\n\t): RouteHandle<HostKind<N, Q>> {\n\t\tthis.#assertOpen();\n\t\tif (this.#state !== \"new\") throw new Error(\"route: routes are declared before load\");\n\t\tif (this.#routes.has(Kind.kind)) throw new Error(`route: ${Kind.kind} is routed already`);\n\t\t// The parent of the route's work: its `resolve`s and the holds and calls on its links, aborted when it closes.\n\t\tconst routing = withAbortSignal(this.#routing.signal, context);\n\t\t// A route calls `authorize` with the principals of holds on this host, `P`s, and addresses of `Kind`.\n\t\tconst route = new Route(\n\t\t\tKind as unknown as HostKind,\n\t\t\toptions as unknown as RouteOptions<Principal, HostKind>,\n\t\t\tthis,\n\t\t\trouting,\n\t\t);\n\t\tthis.#routes.set(Kind.kind, route);\n\t\treturn {\n\t\t\tretry: (address) => route.retry(address.key),\n\t\t\tsuspend: (address) => route.suspend(address.key),\n\t\t};\n\t}\n\n\trevoke(revocation: R, context: Context): void {\n\t\tconst key = canonicalJson(revocation, context);\n\t\tconst revoked = (principal: Principal): boolean =>\n\t\t\t!this.#isOwn(principal, context) && this.#revocationKeys.revokes(principal, key, context);\n\t\tconst error = (label: string): ChordError =>\n\t\t\tnew ChordError({ code: \"forbidden\", reason: \"revoked\", message: `${label}: revoked` });\n\t\tfor (const object of [...this.#objects.values()]) {\n\t\t\tif (object.principal !== undefined && revoked(object.principal)) object.end(error(object.label));\n\t\t}\n\t\t// Requests not bound (waiting for the publication or a provider, refused, waiting for their link) end too: nothing\n\t\t// revives them.\n\t\tconst unbound = error(\"an unbound request\");\n\t\tthis.#unbound.revoke(revoked, unbound);\n\t\tfor (const link of this.#links) link.revokeUnbound(revoked, unbound);\n\t\t// This host's own requests over its paths, linked or not (a route still resolving, a link down): a later link\n\t\t// would hold them again (fix round 1).\n\t\tfor (const holder of this.#pathHolders()) {\n\t\t\tif (holder.kind !== \"remote\") continue;\n\t\t\tconst { principal } = holder.caller;\n\t\t\tif (principal !== undefined && revoked(principal)) holder.revoke(error(holder.label));\n\t\t}\n\t\t// Down the route links before the child links close: a worker ends the principal's objects with the revocation's\n\t\t// error before the closed origins release their holds.\n\t\tfor (const link of this.#links) if (link.role === \"route\") link.send({ kind: \"revoke\", revocation });\n\t\tfor (const link of [...this.#links]) if (link.role === \"child\" && revoked(link.principal)) link.close();\n\t}\n\n\tget activity(): Watchable<ActivityCounts> {\n\t\t// Its value is an `ActivityCounts`.\n\t\treturn this.#activity as unknown as Watchable<ActivityCounts>;\n\t}\n\n\treferences<C extends Contract>(Type: C): Watchable<readonly Presence<C, P>[]> {\n\t\tlet references = this.#references.get(Type.name);\n\t\tif (references === undefined) {\n\t\t\treferences = new References(this.batch);\n\t\t\tfor (const object of this.#objects.values()) {\n\t\t\t\tif (object.served.contract.name !== Type.name) continue;\n\t\t\t\tfor (const holder of object.holders) references.record(object, holder);\n\t\t\t}\n\t\t\tthis.#references.set(Type.name, references);\n\t\t}\n\t\t// Entries of `Type`'s objects, acting as `P`s.\n\t\treturn references as unknown as Watchable<readonly Presence<C, P>[]>;\n\t}\n\n\tasync registry<C, V>(R: Registry<C, V>, context: Context, options: GetOptions = {}): Promise<RegistryValue<V>> {\n\t\tthis.batch.assertOutside(\"registry\");\n\t\tthis.#assertOpen();\n\t\tconst timeout = options.readyTimeout ?? this.timeouts.ready;\n\t\tconst expired = new AbortController();\n\t\tconst waiting = withLinkedAbortSignal(expired.signal, context);\n\t\tlet last: unknown;\n\t\tconst deadline = setTimeout(() => expired.abort(last ?? notLive(`registry ${R.name}`, timeout)), timeout);\n\t\t// The host's close ends the wait at once, `released/closed` (its timer with it).\n\t\tconst closing = (): void => expired.abort(this.#closedError());\n\t\tthis.#routing.signal.addEventListener(\"abort\", closing, { once: true });\n\t\ttry {\n\t\t\tawait awaitWithContext(this.#publication.promise, waiting.context);\n\t\t\tthis.#assertOpen();\n\t\t\tconst value = this.registryRecord(R.name).value(R.version);\n\t\t\t// Its values are the composition as `R`'s version has it, `V`.\n\t\t\tconst usable = (): boolean => {\n\t\t\t\tconst start = value.start();\n\t\t\t\tif (start.kind === \"value\" || start.last !== undefined) return true;\n\t\t\t\tlast = start.error;\n\t\t\t\treturn false;\n\t\t\t};\n\t\t\tif (!usable()) await untilUsable(value, usable, waiting.context);\n\t\t\treturn value as RegistryValue<V>;\n\t\t} finally {\n\t\t\tclearTimeout(deadline);\n\t\t\tthis.#routing.signal.removeEventListener(\"abort\", closing);\n\t\t\twaiting.release();\n\t\t}\n\t}\n\n\tasync root<T>(fn: (ctx: Ctx<P>) => Promise<T>, context: Context, options: RootOptions<P> = {}): Promise<T> {\n\t\tthis.batch.assertOutside(\"root\");\n\t\tthis.#assertOpen();\n\t\t// The scope's ctx acts as `principal`, a `P`: an explicit `undefined` runs anonymous (an HTTP request nobody\n\t\t// authenticated), only an omitted one takes the host's.\n\t\tconst principal = \"principal\" in options ? options.principal : this.principal;\n\t\treturn this.#roots.run(fn as (ctx: Ctx) => Promise<T>, principal, context);\n\t}\n\n\t/** The record of registry `name` on this host, made by its first use. */\n\tregistryRecord(name: string): RegistryRecord {\n\t\tlet record = this.#registries.get(name);\n\t\tif (record === undefined) {\n\t\t\trecord = new RegistryRecord(name, this.batch, (error) => this.report(error));\n\t\t\tthis.#registries.set(name, record);\n\t\t}\n\t\treturn record;\n\t}\n\n\tasync close(_context: Context): Promise<void> {\n\t\tthis.batch.assertOutside(\"close\");\n\t\tthis.#closing ??= this.#close();\n\t\treturn this.#closing;\n\t}\n\n\t/**\n\t * Whether the host published its setups (`load`'s batch): until then requests made here and holds arriving wait in\n\t * the unbound index, placed by the publication.\n\t */\n\tget published(): boolean {\n\t\treturn this.#published;\n\t}\n\n\t/** `request` cannot bind yet: indexed under `name` (the type or registry it waits for) until woken or ended. */\n\tindex(name: string, request: UnboundRequest): void {\n\t\tthis.#unbound.add(name, request);\n\t}\n\n\t/**\n\t * `binding`, whose object left it (its type removed, its version no longer bound: slice 7b §6), waits unbound with\n\t * `cause` under its type's name; a publication places it again (`params` checked as it was, under `context`).\n\t */\n\trewait(binding: Binding, Type: Contract, params: CheckedParams, cause: FailureCause, context: Context): void {\n\t\tthis.#wait(binding, Type.name, cause, () => this.#place(binding, Type, params, context));\n\t}\n\n\t/** `request` left the unbound index's wait for `name` (it ended, or a retry checks it again). */\n\tunindex(name: string, request: UnboundRequest): void {\n\t\tthis.#unbound.delete(name, request);\n\t}\n\n\t/** Whether the host closes: its objects end through `close`, not through its links. */\n\tget closing(): boolean {\n\t\treturn this.#state === \"closed\";\n\t}\n\n\t/**\n\t * A reference to `Type` made by `caller` (its principal, its origin's incarnation), once it is live (`host.get`,\n\t * `ctx.get`): a hold, waited for up to the getter's one deadline, across reconnects and through `loading`,\n\t * `failed { transient }` and `failed { waiting }`; a broken failure rejects at once, the deadline with the last\n\t * failure's error. A getter that gives up releases its reference.\n\t */\n\tasync acquire(\n\t\tType: Contract,\n\t\tparams: unknown,\n\t\tcaller: Caller,\n\t\tcontext: Context,\n\t\toptions: GetOptions,\n\t): Promise<Binding> {\n\t\tthis.batch.assertOutside(\"get\");\n\t\tconst binding = this.#hold(Type, params, caller, context, options);\n\t\tconst timeout = options.readyTimeout ?? this.timeouts.ready;\n\t\tconst expired = new AbortController();\n\t\tconst waiting = withLinkedAbortSignal(expired.signal, context);\n\t\tconst deadline = setTimeout(() => expired.abort(binding.lastFailure ?? notLive(binding.label, timeout)), timeout);\n\t\ttry {\n\t\t\tawait binding.live(waiting.context);\n\t\t\treturn binding;\n\t\t} catch (error) {\n\t\t\tbinding.release();\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tclearTimeout(deadline);\n\t\t\twaiting.release();\n\t\t}\n\t}\n\n\t/** Adds `delta` to the keep-alive count of `kind` (`host.activity`), where the work happens. */\n\tcount(kind: keyof ActivityCounts, delta: number): void {\n\t\tthis.#activity.count(kind, delta);\n\t}\n\n\t/** `holder` references `object`: listed in its type's presence, if someone asked for it. */\n\treferenced(object: ChordObject, holder: Holder, context: Context): void {\n\t\tthis.#references.get(object.served.contract.name)?.add(object, holder, context);\n\t}\n\n\t/** `holders` of `object` ended: gone from its type's presence. */\n\tunreferenced(object: ChordObject, holders: Iterable<Holder>, context: Context): void {\n\t\tthis.#references.get(object.served.contract.name)?.remove(holders, context);\n\t}\n\n\t/** Reports a background failure to `onError`; a throwing `onError` has nowhere left to report to. */\n\treport(error: HostError): void {\n\t\ttry {\n\t\t\tthis.#onError(error);\n\t\t} catch {\n\t\t\t// Nothing to do: teardowns and attempts go on.\n\t\t}\n\t}\n\n\t/**\n\t * An unbound reference to an object of `Type` made by `caller`, declared by `dependent` (`undefined` for\n\t * `host.get`, `host.hold` and `ctx.get`).\n\t */\n\treference(Type: Contract, dependent: ChordObject | undefined, caller: Caller, options: GetOptions): Binding {\n\t\tthis.#assertOpen();\n\t\treturn this.#binding(Type, dependent, caller, options);\n\t}\n\n\t/**\n\t * Binds `binding` to the object for (Type, params) as its principal where its host address puts it (`Destination`):\n\t * the object here, created with its first attempt if there is none, or a remote object held over its path. Placed\n\t * here, the check is only against the type served here: not served (or of the other kind) or not at the caller's\n\t * version and fingerprint, the reference waits unbound, `failed { waiting }`, indexed under the type's name. Returns\n\t * the object it bound to; throws as `Destination.reference` does (a broken refusal).\n\t */\n\tbind(binding: Binding, Type: Contract, params: CheckedParams, context: Context): Target | undefined {\n\t\tconst { principal } = binding.caller;\n\t\tconst placed = this.#destination.reference(Type, params.params, principal, context);\n\t\tif (placed.kind === \"path\") {\n\t\t\tconst { caller, dependent } = binding;\n\t\t\tconst remote = new RemoteObject(this, Type, params, placed.address, caller, placed.path, dependent);\n\t\t\tplaced.path.attach(remote);\n\t\t\tbinding.bind(remote);\n\t\t\treturn remote;\n\t\t}\n\t\tconst served = this.#types.get(Type.name);\n\t\tconst unbound =\n\t\t\tunboundCause(served, Type.kind, Type.name, Type.version, Type.fingerprint) ??\n\t\t\tthis.#misplaced(Type, served!, params.params);\n\t\tif (unbound !== undefined) {\n\t\t\tthis.#wait(binding, Type.name, unbound, () => this.#place(binding, Type, params, context));\n\t\t\treturn undefined;\n\t\t}\n\t\t// An anonymous scope (an HTTP request nobody authenticated) is no principal a remote type's factory can serve\n\t\t// (Opus's build review F5): refused, never bound as the host.\n\t\tif (served!.kind !== \"local\" && principal === undefined) {\n\t\t\tthrow new ChordError({\n\t\t\t\tcode: \"forbidden\",\n\t\t\t\tmessage: `${Type.name}: an anonymous caller gets no remote object`,\n\t\t\t});\n\t\t}\n\t\t// Checked above: served here at the caller's version.\n\t\tconst object = this.#object(served!, params, principal, context, NO_CHAIN, binding.dependent);\n\t\tbinding.bind(object);\n\t\treturn object;\n\t}\n\n\t/** Where a hold arriving on `link` goes (`Destination.hold`: by the address it names); `released` once the host closed. */\n\tplace(request: HoldRequest, link: HostLink, caller: Caller, context: Context): Placed {\n\t\tthis.#assertOpen();\n\t\treturn this.#destination.hold(request, link, caller.principal, context);\n\t}\n\n\t/**\n\t * What a hold placed here binds to, acting as `principal`: the object, or why it waits unbound (`failed\n\t * { waiting }`): a remote type not served here (`not_served`), not at the hold's version and fingerprint, or whose\n\t * params put it on another host (code skew: `version`). Throws for a broken refusal: invalid params, an activation\n\t * the hold's chain waits for (`invalid/cycle`, Q5). A new object keeps the hold's chain.\n\t */\n\tserving(request: HoldRequest, params: unknown, principal: Principal, context: Context): Serving {\n\t\tconst { type, version, fingerprint, chain = NO_CHAIN } = request;\n\t\tconst served = this.#types.get(type);\n\t\tconst unbound = unboundCause(served, \"remote\", type, version, fingerprint);\n\t\tif (unbound !== undefined) return { kind: \"waiting\", cause: unbound };\n\t\t// Checked above: a remote type served here.\n\t\tconst remote = served as Extract<Served, { readonly kind: \"remote\" }>;\n\t\tconst checked = checkParams(remote.contract, params, context);\n\t\tconst misplaced = this.#destination.misplaced(remote.contract, checked.params);\n\t\tif (misplaced !== undefined) return { kind: \"waiting\", cause: { kind: \"waiting\", error: misplaced } };\n\t\tconst object = this.#object(remote, checked, principal, context, chain);\n\t\tconst activation = object.activationId;\n\t\tif (activation !== undefined && chain.includes(activation)) throw this.cycle(chain, activation, [object.label]);\n\t\treturn { kind: \"object\", object };\n\t}\n\n\t/**\n\t * The path a remote reference of `Type` with `params` acting as `principal` goes over now: `ref.retry()` places a\n\t * reference failed for a part past the limits anew (a route may have forgotten its old path). Throws as\n\t * `Destination.reference` does, and `unavailable` for a type placed here now.\n\t */\n\tpathOf(Type: Contract, params: ParamsOf<Contract>, principal: Principal | undefined): Path {\n\t\t// A retry has no context of its own: its admission checks count on none.\n\t\tconst placed = this.#destination.reference(Type, params, principal, BACKGROUND_CONTEXT);\n\t\tif (placed.kind === \"path\") return placed.path;\n\t\tthrow new ChordError({ code: \"unavailable\", message: `${Type.name} is placed here now` });\n\t}\n\n\t/**\n\t * The `invalid/cycle` error of a cycle through `chain` (Q5): its entries from the activation `id` on, by label\n\t * where the object is on this host (\"…\" for other hosts'), then `closing`.\n\t */\n\tcycle(chain: readonly string[], id: string, closing: readonly string[]): ChordError {\n\t\tconst labels = new Map([...this.#objects.values()].map((each) => [each.activationId, each.label]));\n\t\tconst cycle = chain.slice(chain.indexOf(id)).map((entry) => labels.get(entry) ?? \"…\");\n\t\treturn invalid(\"cycle\", `dependency cycle: ${[...cycle, ...closing].join(\" → \")}`);\n\t}\n\n\t/** A new origin number for `side`, which relays holds upstream; registered in `relays` until it closes. */\n\trelayOrigin(side: ProviderSide): number {\n\t\tconst origin = this.#nextOrigin++;\n\t\tthis.relays.set(origin, side);\n\t\treturn origin;\n\t}\n\n\t/**\n\t * A route's link, its work under the route's `context`: registered with the host and its heartbeat; one closed\n\t * already is returned closed.\n\t */\n\trouteLink(link: Link, options: LinkOptions<Principal>, context: Context): HostLink {\n\t\treturn this.#link(link, \"route\", options, context);\n\t}\n\n\t/** A link completed its handshake: a route's address resolves again once if it drops. */\n\tlinkOpened(link: HostLink): void {\n\t\tif (link.role !== \"route\") return;\n\t\tfor (const route of this.#routes.values()) route.opened(link);\n\t}\n\n\t/**\n\t * Forgets a link once it closed: the origins relaying to it, then the parent's path or its route's address are\n\t * told; the heartbeat may stop.\n\t */\n\tunlink(link: HostLink): void {\n\t\tthis.#links.delete(link);\n\t\tfor (const relay of this.relays.values()) relay.unlinked(link);\n\t\tif (this.#links.size === 0) {\n\t\t\tclearInterval(this.#ticking);\n\t\t\tthis.#ticking = undefined;\n\t\t}\n\t\tif (link.role === \"parent\") this.#parent.disconnected(link);\n\t\tif (link.role === \"route\") for (const route of this.#routes.values()) if (route.closed(link)) break;\n\t}\n\n\t/** Moves `object` behind every object that went live before it (close ends in reverse); its backoff is over. */\n\twentLive(object: ChordObject): void {\n\t\tthis.#objects.delete(object.identity);\n\t\tthis.#objects.set(object.identity, object);\n\t\tthis.backoff.delete(object.identity);\n\t}\n\n\t/** Drops an ended object (once, before a next instance of its identity exists). */\n\tforget(object: ChordObject): void {\n\t\tthis.#objects.delete(object.identity);\n\t\tthis.backoff.ended(object.identity);\n\t}\n\n\t/** Records a teardown for `identity`: its next attempt waits for it and for every earlier one still running. */\n\tending(identity: string, teardown: Promise<void>): void {\n\t\tconst previous = this.#endings.get(identity);\n\t\tconst ending = previous === undefined ? teardown : Promise.all([previous, teardown]).then(() => {});\n\t\tthis.#endings.set(identity, ending);\n\t\tvoid ending.then(() => {\n\t\t\tif (this.#endings.get(identity) === ending) this.#endings.delete(identity);\n\t\t});\n\t}\n\n\t/** What the next attempt for `identity` waits for: its previous instances' teardowns, if any still run. */\n\tendingOf(identity: string): Promise<void> | undefined {\n\t\treturn this.#endings.get(identity);\n\t}\n\n\t/**\n\t * A reference to `Type` made by `caller` for `host.hold` and getters: params checked at once (`invalid/params`,\n\t * also before `load`), then placed (`#place`); before the host's publication it waits in the unbound index,\n\t * `loading`, and the publication places it.\n\t */\n\t#hold(Type: Contract, params: unknown, caller: Caller, context: Context, options: GetOptions): Binding {\n\t\tthis.#assertOpen();\n\t\tconst checked = checkParams(Type, params, context);\n\t\tconst binding = this.#binding(Type, undefined, caller, options);\n\t\tconst place = (): void => this.#place(binding, Type, checked, context);\n\t\tif (this.#published) place();\n\t\telse this.#wait(binding, Type.name, undefined, place);\n\t\treturn binding;\n\t}\n\n\t/**\n\t * Places a reference (`bind`); where it cannot go (a `hostAddress` or `authorize` that throws or refuses) fails it\n\t * broken, until `ref.retry()` places it again. One woken after the host closed ends as the close ended the others.\n\t */\n\t#place(binding: Binding, Type: Contract, checked: CheckedParams, context: Context): void {\n\t\tif (this.#state === \"closed\") {\n\t\t\tbinding.end(this.#closedError());\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.bind(binding, Type, checked, context);\n\t\t} catch (error) {\n\t\t\tconst again = (): void => this.#place(binding, Type, checked, context);\n\t\t\tbinding.refuse({ kind: \"broken\", error: asChordError(error, Type.name) }, again);\n\t\t}\n\t}\n\n\t/**\n\t * The provider's own host-address check of a remote `Type` placed here by the consumer's contract, against the one\n\t * served (`invalid/host_address`, `waiting`: code skew); none when both have the same `hostAddress` (the consumer\n\t * computed it with the provider's function) or the type is local. A provider's `hostAddress` that throws throws.\n\t */\n\t#misplaced(Type: Contract, served: Served, params: ParamsOf<Contract>): FailureCause | undefined {\n\t\tif (served.kind !== \"remote\" || contractData(Type).hostAddress === contractData(served.contract).hostAddress) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst error = this.#destination.misplaced(served.contract, params);\n\t\treturn error === undefined ? undefined : { kind: \"waiting\", error };\n\t}\n\n\t/** Leaves `binding` unbound in the index under `name`: `cause` (`waiting`), or none before the publication. */\n\t#wait(binding: Binding, name: string, cause: FailureCause | undefined, place: () => void): void {\n\t\tbinding.wait(cause, place, () => this.#unbound.delete(name, binding));\n\t\tthis.#unbound.add(name, binding);\n\t}\n\n\t/** A new reference's binding made by `caller`; its parked calls wait its `readyTimeout`. */\n\t#binding(Type: Contract, dependent: ChordObject | undefined, caller: Caller, options: GetOptions): Binding {\n\t\treturn new Binding(Type, this.batch, dependent, caller, options.readyTimeout ?? this.timeouts.ready);\n\t}\n\n\t/** This host as the maker of its own references: its principal and incarnation. */\n\t#own(): Caller {\n\t\treturn { principal: this.principal, incarnation: this.incarnation };\n\t}\n\n\t/** Whether `principal` is this host's own (by principal key): revocation never touches it. */\n\t#isOwn(principal: Principal, context: Context): boolean {\n\t\tconst own = this.principal;\n\t\tif (own === undefined) return false;\n\t\t// Principals on this host are `P`s: its own, and the ones its links stamp.\n\t\treturn (\n\t\t\tprincipalKey(own, context, this.#principalKey) === principalKey(principal as P, context, this.#principalKey)\n\t\t);\n\t}\n\n\t/** A new link of `role`, registered with the heartbeat while open. */\n\t#link(link: Link, role: LinkRole, options: LinkOptions<Principal>, context: Context): HostLink {\n\t\tconst { principal, trusted = false, codec = binaryCodec } = options;\n\t\tconst limits = linkLimits(trusted, options.limits);\n\t\tconst made = new HostLink(this, link, { role, principal, trusted, codec, limits }, withoutAbortSignal(context));\n\t\tif (!made.open) return made;\n\t\tthis.#links.add(made);\n\t\tif (this.#ticking === undefined) {\n\t\t\tconst { ping, close } = this.#heartbeat;\n\t\t\tthis.#ticking = setInterval(() => {\n\t\t\t\tconst now = Date.now();\n\t\t\t\tfor (const each of [...this.#links]) each.tick(now, ping, close);\n\t\t\t}, Math.min(ping, close) / 10);\n\t\t}\n\t\treturn made;\n\t}\n\n\t/**\n\t * The object for `params` (checked by L1) and, for a remote type, `principal` (its key is part of the identity),\n\t * created if there is none; its first attempt starts at once, or when its identity's backoff window ends. A new one\n\t * keeps the activation chain it is created for (Q5): `chain` (a hold's), or that of `dependent`'s activation when\n\t * an activation declared it, so its own holds over links carry that chain on.\n\t */\n\t#object(\n\t\tserved: Served,\n\t\tparams: CheckedParams,\n\t\tprincipal: Principal | undefined,\n\t\tcontext: Context,\n\t\tchain: readonly string[] = NO_CHAIN,\n\t\tdependent?: ChordObject,\n\t): ChordObject {\n\t\tconst { key, params: checked } = params;\n\t\tconst identity =\n\t\t\tserved.kind === \"local\"\n\t\t\t\t? identityKey(served.contract, key)\n\t\t\t\t: // A host serving remote types has a principal, which its references act as unless a\n\t\t\t\t\t// link stamped its own (only `P`s).\n\t\t\t\t\tidentityKey(served.contract, key, principalKey(principal as P, context, this.#principalKey));\n\t\tlet object = this.#objects.get(identity);\n\t\tif (object === undefined) {\n\t\t\t// Shared by every getter: one getter's cancellation does not cancel it.\n\t\t\tconst owner = served.kind === \"local\" ? undefined : principal;\n\t\t\tconst created = dependent?.activationChain() ?? chain;\n\t\t\tobject = new ChordObject(this, served, checked, owner, key, identity, withoutAbortSignal(context), created);\n\t\t\tthis.#objects.set(identity, object);\n\t\t\tif (!this.backoff.waiting(identity)) object.attempt();\n\t\t}\n\t\treturn object;\n\t}\n\n\t/**\n\t * Closes the links, then ends every object at once and tears them down one by one, the last to go live first, after\n\t * the endings already running.\n\t */\n\tasync #close(): Promise<void> {\n\t\tthis.#state = \"closed\";\n\t\tthis.#routing.abort(this.#closedError());\n\t\t// Links first, children, routes, then the parent: no `gone` goes out for the objects ending below.\n\t\tconst links = [...this.#links];\n\t\tfor (const role of [\"child\", \"route\", \"parent\"]) for (const link of links) if (link.role === role) link.close();\n\t\t// Remote references end now: their parked calls reject `released`, no later link holds them.\n\t\tconst closed = this.#closedError();\n\t\t// Code outside objects stops at its next use of Chord: an `fn` waiting in `sleep(ms, ctx)` ends.\n\t\tthis.#roots.close(closed);\n\t\tfor (const holder of this.#pathHolders()) if (holder.kind === \"remote\") holder.lost(closed);\n\t\t// At the fence too: requests still waiting for a publication or a provider end as the others did, and gets\n\t\t// waiting for a publication that will not come fail now, not after the slow closes below (fix round 1).\n\t\tthis.#unbound.close(closed);\n\t\tthis.#publication.resolve();\n\t\tthis.backoff.clear();\n\t\t// Every object is sealed before any teardown releases a reference, so none ends in the background.\n\t\tconst teardowns = [...this.#objects.values()].reverse().map((object) => object.stop());\n\t\tawait Promise.all(this.#endings.values());\n\t\tconst failures: CloseFailed[] = [];\n\t\tfor (const tearDown of teardowns) failures.push(...(await tearDown()));\n\t\tthis.#types.clear();\n\t\t// Their facets keep their factories' closures (which may keep objects' handles).\n\t\tthis.#plugins.clear();\n\t\tfor (const record of this.#registries.values()) record.close();\n\t\tthis.#registries.clear();\n\t\tthis.store?.detach();\n\t\tif (failures.length > 0) {\n\t\t\tconst message = `host.close: ${failures.length} native close(s) threw`;\n\t\t\tthrow new AggregateError(\n\t\t\t\tfailures.map(({ error }) => error),\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Every holder of the parent path, the unplaced one and every route's paths: this host's requests over links. */\n\t#pathHolders(): Upstream[] {\n\t\tconst routed = [...this.#routes.values()].flatMap((route) => route.holders());\n\t\treturn [...this.#parent.holders(), ...this.unplaced.holders(), ...routed];\n\t}\n\n\t/** The store stopped after a backend error (it tells the host once): reported, and the host closes. */\n\t#storageFailed(error: unknown): void {\n\t\tthis.report({ kind: \"storage_failed\", error });\n\t\tthis.#closing ??= this.#close();\n\t\t// The app's own `close` returns this closing and gets its failures.\n\t\tthis.#closing.catch(() => {});\n\t}\n\n\t/** A backoff window ended: the identity's object is retried; without one the entry goes. */\n\t#due(identity: string): void {\n\t\tconst object = this.#objects.get(identity);\n\t\tif (object === undefined) this.backoff.delete(identity);\n\t\telse object.attempt();\n\t}\n\n\t/**\n\t * Publishes the staged plugins of `facets` (by name), inside the publication's batch: the registries they serve\n\t * served, their facet contributions entered into the tables (the types are the staged table's, set by the caller).\n\t */\n\t#publish(staged: Staged, facets: ReadonlyMap<string, Facet<P>>): void {\n\t\tfor (const [name, facet] of facets) {\n\t\t\tconst plugin = staged.plugins.get(name)!;\n\t\t\tfor (const [registry, { registry: token, provider }] of plugin.registries) {\n\t\t\t\tthis.registryRecord(registry).serve(token.version, provider);\n\t\t\t}\n\t\t\tconst contributions = plugin.contributions.map(({ registry, value }) =>\n\t\t\t\tcontributionOf(\n\t\t\t\t\tthis.registryRecord(registry.name),\n\t\t\t\t\t{ plugin: name, type: undefined },\n\t\t\t\t\tregistry.version,\n\t\t\t\t\tvalue,\n\t\t\t\t),\n\t\t\t);\n\t\t\tfor (const contribution of contributions) contribution.record.add(contribution);\n\t\t\tthis.#plugins.set(name, { facet, staged: plugin, contributions });\n\t\t}\n\t}\n\n\t#assertOpen(): void {\n\t\tif (this.#state === \"closed\") throw this.#closedError();\n\t}\n\n\t#closedError(): ChordError {\n\t\treturn new ChordError({ code: \"released\", reason: \"closed\", message: \"the host is closed\" });\n\t}\n}\n\n/**\n * Why a reference to a type of `kind` at `version` and `fingerprint`, placed here, cannot bind to `served` (the type of\n * that name served here): not served, or as the other kind (`unavailable`); another version or fingerprint\n * (`contract_mismatch`); `undefined` when it binds. Both wait for a publication: `failed { waiting }`.\n */\nfunction unboundCause(\n\tserved: Served | undefined,\n\tkind: Contract[\"kind\"],\n\tname: string,\n\tversion: number,\n\tfingerprint: string,\n): FailureCause | undefined {\n\tif (served === undefined || served.kind !== kind) {\n\t\treturn { kind: \"waiting\", error: new ChordError({ code: \"unavailable\", message: `${name} is not served here` }) };\n\t}\n\tconst { contract } = served;\n\tif (binds(served.provider, version, fingerprint)) return undefined;\n\tconst message = `${name} v${version} does not match the served v${contract.version}`;\n\treturn { kind: \"waiting\", error: new ChordError({ code: \"contract_mismatch\", message }) };\n}\n\n/**\n * Waits until `usable()` (a registry value's check, which records its last error) holds, checked at every change the\n * value tells its waiters of (after the batch that made it); rejects when `context` aborts or the value closes. It\n * waits on the value only while it runs.\n */\nasync function untilUsable(value: RegistryValueSource, usable: () => boolean, context: Context): Promise<void> {\n\tlet changed = Promise.withResolvers<void>();\n\tconst release = value.wait({\n\t\tdependencyMoved: () => queueMicrotask(() => changed.resolve()),\n\t\t// The value closed with its host: the wait ends with the close's error.\n\t\tclosed: (error) => changed.reject(error),\n\t});\n\ttry {\n\t\twhile (!usable()) {\n\t\t\tawait awaitWithContext(changed.promise, context);\n\t\t\tchanged = Promise.withResolvers<void>();\n\t\t}\n\t} finally {\n\t\trelease();\n\t}\n}\n\n/** What the report calls a fate. */\nconst STARTED = { swap: \"swapped\", restart: \"restarted\", retry: \"retried\" } as const;\n\n/** The `aborted` error of a reload whose context aborted before its commit: nothing changed. */\nfunction reloadAborted(): ChordError {\n\treturn new ChordError({ code: \"aborted\", message: \"reload: aborted\" });\n}\n\n/** The error of a plugin name given twice: the second is refused. */\nfunction loadedTwice(name: string): Error {\n\treturn new Error(`plugin \"${name}\" is loaded twice`);\n}\n\n/** Whether registry provider `served` serves readers of `version`: its own, or an older one its `accepts` maps back. */\nfunction registryServes(served: StagedRegistry, version: number): boolean {\n\tconst provided = served.registry.version;\n\treturn provided === version || (provided > version && served.provider.accepts?.[version]?.value !== undefined);\n}\n"]}
@@ -0,0 +1,17 @@
1
+ export type { ActivityCounts } from "./activity.ts";
2
+ export type { Factory, Self, StoreSelf } from "./attempt.ts";
3
+ export type { Ctx } from "./ctx.ts";
4
+ export { defineFacet, type Facet, type FacetHost, type FacetSelf, type ServeOptions } from "./facet.ts";
5
+ export type { FollowAttach, FollowAttachment, FollowObserver } from "./follow.ts";
6
+ export { type CommittedReload, createHost, type GetOptions, type Host, type HostError, type HostOptions, type LinkOptions, type LoadReport, type PluginFailure, type Position, type ReloadedObject, type ReloadOptions, type ReloadReport, } from "./host.ts";
7
+ export type { Native, NativeCloseReason, NativeOptions } from "./native.ts";
8
+ export type { Presence } from "./presence.ts";
9
+ export type { RefState } from "./ref-state.ts";
10
+ export type { Held, Reference, RefIn } from "./reference.ts";
11
+ export type { RevokedBy } from "./revocation.ts";
12
+ export type { RootOptions } from "./root.ts";
13
+ export type { RouteHandle, RouteOptions } from "./route.ts";
14
+ export type { OnHandler, OnLiveHandler, OnNativeHandler, RoutineDeclarations } from "./routines.ts";
15
+ export { sleep, untilAborted } from "./sleep.ts";
16
+ export type { PluginFacet } from "./staging.ts";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceR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,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Hosts for apps: creating a host, facets, factories, natives, references and the ctx of method handlers, routines and
2
+ // their waiting helpers, revocation, presence and keep-alive counts, root scopes.
3
+ export { defineFacet } from "./facet.js";
4
+ export { createHost, } from "./host.js";
5
+ export { sleep, untilAborted } from "./sleep.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next/host/index.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,kFAAkF;AAKlF,OAAO,EAAE,WAAW,EAAiE,MAAM,YAAY,CAAC;AAExG,OAAO,EAEN,UAAU,GAYV,MAAM,WAAW,CAAC;AASnB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Hosts for apps: creating a host, facets, factories, natives, references and the ctx of method handlers, routines and\n// their waiting helpers, revocation, presence and keep-alive counts, root scopes.\n\nexport type { ActivityCounts } from \"./activity.ts\";\nexport type { Factory, Self, StoreSelf } from \"./attempt.ts\";\nexport type { Ctx } from \"./ctx.ts\";\nexport { defineFacet, type Facet, type FacetHost, type FacetSelf, type ServeOptions } from \"./facet.ts\";\nexport type { FollowAttach, FollowAttachment, FollowObserver } from \"./follow.ts\";\nexport {\n\ttype CommittedReload,\n\tcreateHost,\n\ttype GetOptions,\n\ttype Host,\n\ttype HostError,\n\ttype HostOptions,\n\ttype LinkOptions,\n\ttype LoadReport,\n\ttype PluginFailure,\n\ttype Position,\n\ttype ReloadedObject,\n\ttype ReloadOptions,\n\ttype ReloadReport,\n} from \"./host.ts\";\nexport type { Native, NativeCloseReason, NativeOptions } from \"./native.ts\";\nexport type { Presence } from \"./presence.ts\";\nexport type { RefState } from \"./ref-state.ts\";\nexport type { Held, Reference, RefIn } from \"./reference.ts\";\nexport type { RevokedBy } from \"./revocation.ts\";\nexport type { RootOptions } from \"./root.ts\";\nexport type { RouteHandle, RouteOptions } from \"./route.ts\";\nexport type { OnHandler, OnLiveHandler, OnNativeHandler, RoutineDeclarations } from \"./routines.ts\";\nexport { sleep, untilAborted } from \"./sleep.ts\";\nexport type { PluginFacet } from \"./staging.ts\";\n"]}
@@ -0,0 +1,10 @@
1
+ export type { PinnedKey } from "./attempt.ts";
2
+ export { nextDelay } from "./backoff.ts";
3
+ export { CallContext, type Caller } from "./ctx.ts";
4
+ export type { AnyHost, ChordHost, Serving } from "./host.ts";
5
+ export type { ChordObject, Holder, Removal } from "./object.ts";
6
+ export { LIVE, LOADING, type RefState } from "./ref-state.ts";
7
+ export { type Attachable, type Binding, type CheckedParams, type Followed, type RetryWalk, retryWalk, type Target, } from "./reference.ts";
8
+ export type { UnboundRequest } from "./unbound.ts";
9
+ export { uuidv7 } from "./uuid.ts";
10
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/next/host/internal.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACN,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,SAAS,EACT,KAAK,MAAM,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ // Hosts for Chord's layers: what the remote sides of links use of a host, its objects and references; what jobs use of
2
+ // a handler's ctx, the backoff and ids.
3
+ export { nextDelay } from "./backoff.js";
4
+ export { CallContext } from "./ctx.js";
5
+ export { LIVE, LOADING } from "./ref-state.js";
6
+ export { retryWalk, } from "./reference.js";
7
+ export { uuidv7 } from "./uuid.js";
8
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/next/host/internal.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,wCAAwC;AAGxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAiB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAMN,SAAS,GAET,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC","sourcesContent":["// Hosts for Chord's layers: what the remote sides of links use of a host, its objects and references; what jobs use of\n// a handler's ctx, the backoff and ids.\n\nexport type { PinnedKey } from \"./attempt.ts\";\nexport { nextDelay } from \"./backoff.ts\";\nexport { CallContext, type Caller } from \"./ctx.ts\";\nexport type { AnyHost, ChordHost, Serving } from \"./host.ts\";\nexport type { ChordObject, Holder, Removal } from \"./object.ts\";\nexport { LIVE, LOADING, type RefState } from \"./ref-state.ts\";\nexport {\n\ttype Attachable,\n\ttype Binding,\n\ttype CheckedParams,\n\ttype Followed,\n\ttype RetryWalk,\n\tretryWalk,\n\ttype Target,\n} from \"./reference.ts\";\nexport type { UnboundRequest } from \"./unbound.ts\";\nexport { uuidv7 } from \"./uuid.ts\";\n"]}
@@ -0,0 +1,50 @@
1
+ import type { Context } from "../../context/index.ts";
2
+ import type { Contract } from "../contracts/index.ts";
3
+ import type { KeyedSlot } from "../documents/internal.ts";
4
+ import { type Contributor, RegistryContribution, type RegistryRecord } from "../registries/internal.ts";
5
+ import { type Derive, type DeriveSource } from "../state/internal.ts";
6
+ import { type Binding } from "./reference.ts";
7
+ /** A checked implementation, as Chord calls and follows it. */
8
+ export type Members = {
9
+ /** The methods, each called with its arguments (`null` for none) and a context. */
10
+ readonly methods: ReadonlyMap<string, Method>;
11
+ /** The state members, resolved to what Chord follows. */
12
+ readonly state: ReadonlyMap<string, DeriveSource>;
13
+ /** The keyed members (slice 6a §12): the object's own slot, or the provider's member it re-exposes. */
14
+ readonly keyed: ReadonlyMap<string, KeyedBinding>;
15
+ };
16
+ /**
17
+ * What a keyed member is: a keyed document handle's slot (`own`), or another object's keyed member re-exposed through
18
+ * a reference (`reexposed`), which reads end at the ultimate provider's slot (rule 22) and pinned keys follow.
19
+ */
20
+ export type KeyedBinding = {
21
+ readonly kind: "own";
22
+ readonly slot: KeyedSlot;
23
+ } | {
24
+ readonly kind: "reexposed";
25
+ readonly binding: Binding;
26
+ readonly member: string;
27
+ };
28
+ /** A method as Chord calls it. */
29
+ export type Method = (args: unknown, context: Context) => Promise<unknown>;
30
+ /**
31
+ * Checks what a factory returned (plugin code): a local contract's members, or a remote contract's `{ variant,
32
+ * members }` naming one of its current variants. Errors name the variant or member (the failure cause adds the
33
+ * object).
34
+ */
35
+ export declare function checkImplementation(contract: Contract, implementation: unknown): {
36
+ readonly variant: string | undefined;
37
+ readonly members: Members;
38
+ };
39
+ /**
40
+ * Resolves every derive's sources; errors name a derive by the member exposing it, else by its position. `report`
41
+ * makes each derive's failure report, with the member exposing it when there is one (`derive_failed`).
42
+ */
43
+ export declare function attachDerives(derives: readonly Derive[], state: ReadonlyMap<string, DeriveSource>, report: (member: string | undefined) => (error: unknown) => void): void;
44
+ /**
45
+ * A contribution of `contributor` at `version` to `record`, as Chord follows it: a Chord watchable (a source, a
46
+ * constant, a document handle, a reference member, a native source: another registry's value too) is followed,
47
+ * anything else is a plain value, whatever methods it has (registries carry natives).
48
+ */
49
+ export declare function contributionOf(record: RegistryRecord, contributor: Contributor, version: number, value: unknown): RegistryContribution;
50
+ //# sourceMappingURL=members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/next/host/members.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAEN,KAAK,WAAW,EAChB,oBAAoB,EACpB,KAAK,cAAc,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,MAAM,EAAoB,KAAK,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,KAAK,OAAO,EAAkC,MAAM,gBAAgB,CAAC;AAE9E,+DAA+D;AAC/D,MAAM,MAAM,OAAO,GAAG;IACrB,mFAAmF;IACnF,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAClD,uGAAuG;IACvG,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAClD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,YAAY,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,kCAAkC;AAClC,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,OAAO,GACrB;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAWrE;AAyCD;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,EACxC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC9D,IAAI,CAYN;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,GACZ,oBAAoB,CAEtB"}
@@ -0,0 +1,107 @@
1
+ // The member check (Q14): an implementation is one variant with exactly that variant's members, methods being
2
+ // functions and state members JSON watchables; and the resolution of what Chord follows behind every derive's declared
3
+ // sources (JSON and native) and every contribution to a registry (slice 8).
4
+ //
5
+ // The rule for watches across attempts (decision "References are the only indirection"): consumers' watches and
6
+ // derives over another object's member follow it through their reference's member (`reference-source.ts`) and keys
7
+ // (`reference-keys.ts`), passed straight through to the instance's own document or derive. While the object points at
8
+ // nothing they keep their last values (one `failed` call for a failure); when a new instance goes live they move by
9
+ // name to its member (a key pinned there again), whether a document or a derive: one frame from the last value, and
10
+ // every derive downstream recovers (decision "self healing"). A re-exposed member is the re-exposing object's
11
+ // reference member: it holds with that object, its provider's source goes on. Holds over a link follow the live
12
+ // instance's members and take a snapshot at each binding.
13
+ import { currentVariants, LOCAL, takesNoArgs } from "../contracts/internal.js";
14
+ import { RegistryContribution, } from "../registries/internal.js";
15
+ import { NativeSource } from "../state/internal.js";
16
+ import { resolveKeyed, resolveWatchable } from "./reference.js";
17
+ /**
18
+ * Checks what a factory returned (plugin code): a local contract's members, or a remote contract's `{ variant,
19
+ * members }` naming one of its current variants. Errors name the variant or member (the failure cause adds the
20
+ * object).
21
+ */
22
+ export function checkImplementation(contract, implementation) {
23
+ const variants = currentVariants(contract);
24
+ if (contract.kind === "local") {
25
+ // The member check establishes the shape.
26
+ return { variant: undefined, members: checkMembers(variants.get(LOCAL), implementation) };
27
+ }
28
+ // Plugin code: a remote factory returns `{ variant, members }`, which the checks below establish.
29
+ const { variant, members } = implementation;
30
+ const data = variants.get(variant);
31
+ if (data === undefined)
32
+ throw new Error(`variant ${JSON.stringify(variant)}: not a variant of ${contract.name}`);
33
+ return { variant, members: checkMembers(data, members) };
34
+ }
35
+ /**
36
+ * Checks members against a variant's (exactly its members, methods being functions, state members JSON watchables and
37
+ * keyed members keyed document handles); a method without arguments is called with the context alone.
38
+ */
39
+ function checkMembers({ state, methods, keyed }, implementation) {
40
+ for (const member of Object.keys(implementation)) {
41
+ if (!state.has(member) && !methods.has(member) && !keyed.has(member))
42
+ throw new Error(`${member}: not a member`);
43
+ }
44
+ // Own properties only: an inherited `toString` is no implementation of a member named so.
45
+ const own = (member) => Object.hasOwn(implementation, member) ? implementation[member] : undefined;
46
+ const checked = {
47
+ methods: new Map(),
48
+ state: new Map(),
49
+ keyed: new Map(),
50
+ };
51
+ for (const [member, data] of methods) {
52
+ const method = own(member);
53
+ if (typeof method !== "function")
54
+ throw new Error(`${member}: a method is a function`);
55
+ const call = takesNoArgs(data)
56
+ ? (_args, context) => method(context)
57
+ : (args, context) => method(args, context);
58
+ checked.methods.set(member, call);
59
+ }
60
+ for (const member of state.keys()) {
61
+ const source = resolveWatchable(own(member));
62
+ if (source === undefined)
63
+ throw new Error(`${member}: a state member is a JSON watchable`);
64
+ checked.state.set(member, source);
65
+ }
66
+ for (const member of keyed.keys()) {
67
+ const resolved = resolveKeyed(own(member));
68
+ if (resolved === undefined)
69
+ throw new Error(`${member}: a keyed member is a keyed document handle`);
70
+ checked.keyed.set(member, resolved);
71
+ }
72
+ return checked;
73
+ }
74
+ /**
75
+ * Resolves every derive's sources; errors name a derive by the member exposing it, else by its position. `report`
76
+ * makes each derive's failure report, with the member exposing it when there is one (`derive_failed`).
77
+ */
78
+ export function attachDerives(derives, state, report) {
79
+ const exposed = new Map([...state].map(([member, source]) => [source, member]));
80
+ derives.forEach((derive, position) => {
81
+ const member = exposed.get(derive);
82
+ const name = member ?? `derive #${position + 1}`;
83
+ const resolve = (source, index) => {
84
+ const resolved = resolveWatchable(source) ?? (source instanceof NativeSource ? source : undefined);
85
+ if (resolved === undefined)
86
+ throw new Error(`${name}: source ${index} is not a Chord watchable`);
87
+ return resolved;
88
+ };
89
+ derive.attach(resolve, report(member));
90
+ });
91
+ }
92
+ /**
93
+ * A contribution of `contributor` at `version` to `record`, as Chord follows it: a Chord watchable (a source, a
94
+ * constant, a document handle, a reference member, a native source: another registry's value too) is followed,
95
+ * anything else is a plain value, whatever methods it has (registries carry natives).
96
+ */
97
+ export function contributionOf(record, contributor, version, value) {
98
+ return new RegistryContribution(record, contributor, version, contentOf(value));
99
+ }
100
+ /** What Chord follows behind a contribution: its JSON or native source when it is a Chord watchable. */
101
+ function contentOf(value) {
102
+ if (value instanceof NativeSource)
103
+ return { kind: "native", source: value };
104
+ const source = resolveWatchable(value);
105
+ return source === undefined ? { kind: "plain", value } : { kind: "json", source };
106
+ }
107
+ //# sourceMappingURL=members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.js","sourceRoot":"","sources":["../../../src/next/host/members.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,uHAAuH;AACvH,4EAA4E;AAC5E,EAAE;AACF,gHAAgH;AAChH,mHAAmH;AACnH,sHAAsH;AACtH,oHAAoH;AACpH,oHAAoH;A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gBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,YAAY,KAAK,2BAA2B,CAAC,CAAC;YACjG,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC7B,MAAsB,EACtB,WAAwB,EACxB,OAAe,EACf,KAAc;IAEd,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,wGAAwG;AACxG,SAAS,SAAS,CAAC,KAAc;IAChC,IAAI,KAAK,YAAY,YAAY;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC5E,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACnF,CAAC","sourcesContent":["// The member check (Q14): an implementation is one variant with exactly that variant's members, methods being\n// functions and state members JSON watchables; and the resolution of what Chord follows behind every derive's declared\n// sources (JSON and native) and every contribution to a registry (slice 8).\n//\n// The rule for watches across attempts (decision \"References are the only indirection\"): consumers' watches and\n// derives over another object's member follow it through their reference's member (`reference-source.ts`) and keys\n// (`reference-keys.ts`), passed straight through to the instance's own document or derive. While the object points at\n// nothing they keep their last values (one `failed` call for a failure); when a new instance goes live they move by\n// name to its member (a key pinned there again), whether a document or a derive: one frame from the last value, and\n// every derive downstream recovers (decision \"self healing\"). A re-exposed member is the re-exposing object's\n// reference member: it holds with that object, its provider's source goes on. Holds over a link follow the live\n// instance's members and take a snapshot at each binding.\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { Contract } from \"../contracts/index.ts\";\nimport { currentVariants, LOCAL, takesNoArgs, type VariantData } from \"../contracts/internal.ts\";\nimport type { KeyedSlot } from \"../documents/internal.ts\";\nimport {\n\ttype ContributionContent,\n\ttype Contributor,\n\tRegistryContribution,\n\ttype RegistryRecord,\n} from \"../registries/internal.ts\";\nimport { type Derive, type DeriveInput, type DeriveSource, NativeSource } from \"../state/internal.ts\";\nimport { type Binding, resolveKeyed, resolveWatchable } from \"./reference.ts\";\n\n/** A checked implementation, as Chord calls and follows it. */\nexport type Members = {\n\t/** The methods, each called with its arguments (`null` for none) and a context. */\n\treadonly methods: ReadonlyMap<string, Method>;\n\t/** The state members, resolved to what Chord follows. */\n\treadonly state: ReadonlyMap<string, DeriveSource>;\n\t/** The keyed members (slice 6a §12): the object's own slot, or the provider's member it re-exposes. */\n\treadonly keyed: ReadonlyMap<string, KeyedBinding>;\n};\n\n/**\n * What a keyed member is: a keyed document handle's slot (`own`), or another object's keyed member re-exposed through\n * a reference (`reexposed`), which reads end at the ultimate provider's slot (rule 22) and pinned keys follow.\n */\nexport type KeyedBinding =\n\t| { readonly kind: \"own\"; readonly slot: KeyedSlot }\n\t| { readonly kind: \"reexposed\"; readonly binding: Binding; readonly member: string };\n\n/** A method as Chord calls it. */\nexport type Method = (args: unknown, context: Context) => Promise<unknown>;\n\n/**\n * Checks what a factory returned (plugin code): a local contract's members, or a remote contract's `{ variant,\n * members }` naming one of its current variants. Errors name the variant or member (the failure cause adds the\n * object).\n */\nexport function checkImplementation(\n\tcontract: Contract,\n\timplementation: unknown,\n): { readonly variant: string | undefined; readonly members: Members } {\n\tconst variants = currentVariants(contract);\n\tif (contract.kind === \"local\") {\n\t\t// The member check establishes the shape.\n\t\treturn { variant: undefined, members: checkMembers(variants.get(LOCAL)!, implementation as Implementation) };\n\t}\n\t// Plugin code: a remote factory returns `{ variant, members }`, which the checks below establish.\n\tconst { variant, members } = implementation as { readonly variant: string; readonly members: Implementation };\n\tconst data = variants.get(variant);\n\tif (data === undefined) throw new Error(`variant ${JSON.stringify(variant)}: not a variant of ${contract.name}`);\n\treturn { variant, members: checkMembers(data, members) };\n}\n\ntype Implementation = { readonly [member: string]: unknown };\n\n/**\n * Checks members against a variant's (exactly its members, methods being functions, state members JSON watchables and\n * keyed members keyed document handles); a method without arguments is called with the context alone.\n */\nfunction checkMembers({ state, methods, keyed }: VariantData, implementation: Implementation): Members {\n\tfor (const member of Object.keys(implementation)) {\n\t\tif (!state.has(member) && !methods.has(member) && !keyed.has(member)) throw new Error(`${member}: not a member`);\n\t}\n\t// Own properties only: an inherited `toString` is no implementation of a member named so.\n\tconst own = (member: string): unknown =>\n\t\tObject.hasOwn(implementation, member) ? implementation[member] : undefined;\n\tconst checked = {\n\t\tmethods: new Map<string, Method>(),\n\t\tstate: new Map<string, DeriveSource>(),\n\t\tkeyed: new Map<string, KeyedBinding>(),\n\t};\n\tfor (const [member, data] of methods) {\n\t\tconst method = own(member);\n\t\tif (typeof method !== \"function\") throw new Error(`${member}: a method is a function`);\n\t\tconst call: Method = takesNoArgs(data)\n\t\t\t? (_args, context) => method(context)\n\t\t\t: (args, context) => method(args, context);\n\t\tchecked.methods.set(member, call);\n\t}\n\tfor (const member of state.keys()) {\n\t\tconst source = resolveWatchable(own(member));\n\t\tif (source === undefined) throw new Error(`${member}: a state member is a JSON watchable`);\n\t\tchecked.state.set(member, source);\n\t}\n\tfor (const member of keyed.keys()) {\n\t\tconst resolved = resolveKeyed(own(member));\n\t\tif (resolved === undefined) throw new Error(`${member}: a keyed member is a keyed document handle`);\n\t\tchecked.keyed.set(member, resolved);\n\t}\n\treturn checked;\n}\n\n/**\n * Resolves every derive's sources; errors name a derive by the member exposing it, else by its position. `report`\n * makes each derive's failure report, with the member exposing it when there is one (`derive_failed`).\n */\nexport function attachDerives(\n\tderives: readonly Derive[],\n\tstate: ReadonlyMap<string, DeriveSource>,\n\treport: (member: string | undefined) => (error: unknown) => void,\n): void {\n\tconst exposed = new Map<DeriveSource, string>([...state].map(([member, source]) => [source, member]));\n\tderives.forEach((derive, position) => {\n\t\tconst member = exposed.get(derive);\n\t\tconst name = member ?? `derive #${position + 1}`;\n\t\tconst resolve = (source: unknown, index: number): DeriveInput => {\n\t\t\tconst resolved = resolveWatchable(source) ?? (source instanceof NativeSource ? source : undefined);\n\t\t\tif (resolved === undefined) throw new Error(`${name}: source ${index} is not a Chord watchable`);\n\t\t\treturn resolved;\n\t\t};\n\t\tderive.attach(resolve, report(member));\n\t});\n}\n\n/**\n * A contribution of `contributor` at `version` to `record`, as Chord follows it: a Chord watchable (a source, a\n * constant, a document handle, a reference member, a native source: another registry's value too) is followed,\n * anything else is a plain value, whatever methods it has (registries carry natives).\n */\nexport function contributionOf(\n\trecord: RegistryRecord,\n\tcontributor: Contributor,\n\tversion: number,\n\tvalue: unknown,\n): RegistryContribution {\n\treturn new RegistryContribution(record, contributor, version, contentOf(value));\n}\n\n/** What Chord follows behind a contribution: its JSON or native source when it is a Chord watchable. */\nfunction contentOf(value: unknown): ContributionContent {\n\tif (value instanceof NativeSource) return { kind: \"native\", source: value };\n\tconst source = resolveWatchable(value);\n\treturn source === undefined ? { kind: \"plain\", value } : { kind: \"json\", source };\n}\n"]}
@@ -0,0 +1,55 @@
1
+ import { type Context } from "../../context/index.ts";
2
+ import type { HostError } from "./host.ts";
3
+ /** Why a native closes: its object ended or its attempt failed (`end`), the host closes (`close`), a reload (slice 7). */
4
+ export type NativeCloseReason = {
5
+ readonly kind: "end";
6
+ } | {
7
+ readonly kind: "close";
8
+ } | {
9
+ readonly kind: "reload";
10
+ };
11
+ /** A native's handle. */
12
+ export interface Native<T> {
13
+ /** The opened value: throws `not_ready` until its open resolved and `released` once its close started. */
14
+ readonly value: T;
15
+ }
16
+ /** What `self.open` takes besides the open and the close. */
17
+ export type NativeOptions = {
18
+ /** How long its close may take; the host's `closeTimeout` by default. */
19
+ readonly closeTimeout?: number;
20
+ };
21
+ /** A close that threw, as reported. */
22
+ export type CloseFailed = Extract<HostError, {
23
+ readonly kind: "close_failed";
24
+ }>;
25
+ /**
26
+ * Where a native belongs: its object's label and its position in declaration order (from 1) for errors and reports,
27
+ * the object's context (every close runs under it, never under the aborted opener's), and where it reports.
28
+ */
29
+ type NativeOwner = {
30
+ readonly object: string;
31
+ readonly position: number;
32
+ readonly context: Context;
33
+ readonly report: (error: HostError) => void;
34
+ };
35
+ /** What an attempt does with each of its natives, whatever their value's type. */
36
+ export interface NativeSlot {
37
+ open(context: Context): Promise<void>;
38
+ close(reason: NativeCloseReason): Promise<CloseFailed | undefined>;
39
+ }
40
+ /** One native of one attempt: opened at most once, closed exactly once. */
41
+ export declare class NativeHandle<T> implements Native<T>, NativeSlot {
42
+ #private;
43
+ constructor(open: (context: Context) => Promise<T>, close: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>, closeTimeout: number, owner: NativeOwner);
44
+ get value(): T;
45
+ /** Opens the value; one that arrives after its attempt was abandoned is closed at once, a failure reported. */
46
+ open(context: Context): Promise<void>;
47
+ /** Closes the value if it is open (a pending open's value is closed when it arrives); resolves with a throw. */
48
+ close(reason: NativeCloseReason): Promise<CloseFailed | undefined>;
49
+ }
50
+ /** Whether `promise` settled within `ms` (it rejects when `promise` does first); `promise` itself runs on. */
51
+ export declare function within(promise: Promise<unknown>, ms: number): Promise<"settled" | "timeout">;
52
+ /** Whether the `size` pieces of work in `drain` settled within `ms` (at once when there is none). */
53
+ export declare function drained(drain: Iterable<Promise<unknown>>, size: number, ms: number): Promise<"settled" | "timeout">;
54
+ export {};
55
+ //# sourceMappingURL=native.d.ts.map