@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,418 @@
1
+ # Slice 4a: links and relays (spec, for the owner's approval)
2
+
3
+ Status: **approved (owner, 2026-10-24)**, revised after Astra's and Fable's spec reviews (`/tmp/s4a-review-*.md`);
4
+ sections 4-6 and their races revised for the decision "Relay flow control per origin" (owner, 2026-10-24), which
5
+ replaces per-hop acks, `reset { holds }`, relay recovery and id renumbering.
6
+ Guiding rule (owner): simple, fast, correct. The single source for building 4a, together with the feature map in
7
+ `slices.md` (entries assigned to 4a), `design.md` read in full (most relevant: §3 hosts, links, routes, flow control,
8
+ recovery; §4; §7; §18; §22), the decision log (R1, Q1, Q4 and "Wire protocol", Q13, R20, "Flow control: an
9
+ ack-clocked window", "One pending queue for slow consumers of state", "Slice 4 split and first decisions", "Slice 4a
10
+ spec decisions", "Slice 4a review decisions", "Relay flow control per origin"), the carry-over (L6, L7, 4b), `slice-4.md` (the split and 4b) and the
11
+ root `AGENTS.md` style section. Builds on L1 and slices 1-3b (`9066b343c`).
12
+
13
+ ## What an app can do after this slice
14
+
15
+ ```ts
16
+ export const Server = hostKind("server");
17
+ export const Session = hostKind("session", { id: str() }); // params like a contract's
18
+
19
+ export const Notes = remote("notes", {
20
+ version: 1,
21
+ params: { session: str() },
22
+ placement: ({ session }) => Session({ id: session }), // never part of the fingerprint
23
+ variants: { … },
24
+ });
25
+
26
+ // server.ts
27
+ const server = createHost<P>({ address: Server(), principal: { kind: "server" }, onError });
28
+ server.route(Session, {
29
+ authorize: (principal, address) => principal.kind === "owner" || (principal.kind === "guest" && principal.session === address.params.id),
30
+ resolve: async (address, context) => {
31
+ const child = fork("worker.ts", [], { serialization: "advanced" }); // no `signal`: see below
32
+ child.send({ id: address.params.id, init: initFor(address.params.id) }); // the app's own start message
33
+ return { link: ipcLink(child), principal: { kind: "worker", session: address.params.id }, trusted: true };
34
+ },
35
+ });
36
+ await server.load(serverFacets, ctx);
37
+ wss.on("connection", (ws, req) => server.accept(webSocketLink(ws), { principal: authenticate(req) }, ctx));
38
+
39
+ // worker.ts: connect first (W6), then load; start data through the core facet (§18)
40
+ const { id, init } = await startMessage(process);
41
+ const worker = createHost<P>({ address: Session({ id }), principal: { kind: "worker", session: id }, onError });
42
+ worker.connect(ipcLink(process), { principal: { kind: "server" }, trusted: true }, ctx);
43
+ await worker.load([{ name: "@app/core", facet: coreWorkerFacet(init) }, ...workerFacets], ctx); // serves SessionInfo
44
+
45
+ // a tab
46
+ const tab = createHost<P>({ onError });
47
+ tab.connect(webSocketLink(new WebSocket("/chord")), { principal: { kind: "server" } }, ctx);
48
+ const notes = await tab.get(Notes, { session: "S1" }, ctx); // tab → server → route(Session) → worker
49
+ ```
50
+
51
+ Do not pass `context.abortSignal` to `fork`: `host.close` aborts it, which kills the worker and makes Node emit an
52
+ `error` event on the child process that crashes an app without a handler. Chord closes the link at `host.close`; the
53
+ worker exits when its parent link closes. `resolve` returns the link before the worker has loaded (the worker connects first, W6): a `resolve` that waited for
54
+ the worker's `load` while the worker's facets hold server types would deadlock.
55
+
56
+ ## 1. Host kinds, addresses, placement (§3)
57
+
58
+ - `hostKind(name, params?)` declares a kind of addressable host; `params` follow L1's params policy (a flat record of
59
+ required `str()`, `int()`, `bool()`, `oneOf(...)`), checked with L1's compiled params check. `Session({ id: "S1" })` is
60
+ an **address**: `{ kind, params, key }`, its key built like an identity key (`session|S1`). Two addresses are equal
61
+ when their keys are. No host-name strings in app code.
62
+ - `createHost({ address })`: an addressable host. Without an address a host is a client (§3 roles). A host without a
63
+ principal serves only local types: `serve` of a remote type makes `load` throw (owner, 2026-10-24; a remote object
64
+ is owned by the serving host's principal).
65
+ - `remote(name, { …, placement })` (an L1 change): `placement(params) => Address`, a typed function; not part of the
66
+ fingerprint (L1 normal form unchanged). `local` contracts have no placement.
67
+ - **The caller computes the address** and sends it in the `hold` (section 5). A host that relays never needs the
68
+ contract: it routes by the address alone.
69
+ - **Where a reference or an arriving hold goes** (first match):
70
+
71
+ | Case | Goes |
72
+ | --- | --- |
73
+ | the type is served here and its placement (computed here from the params) is this host's address, or it has none | here |
74
+ | a reference made here (`host.get`/`hold`, `self.get`, `ctx.get`) to a served type whose address is another host's | on, as if not served here (next rows): worker S1 reaches `Notes { session: "S2" }` through the parent |
75
+ | an arriving hold for a served type whose params place it on another host | broken `invalid/placement` (misrouted; never forwarded); the address the hold names only routes it |
76
+ | the hold names an address of a kind this host has a route for | over that route's link (the address's params checked against the kind; `authorize` first) |
77
+ | otherwise (a remote type) | over the parent link; a hold that arrived *on* the parent link is never sent back to it: `unavailable` |
78
+ | no parent link | `unavailable` (as 3a) |
79
+
80
+ - `placement` or `authorize` throwing fails the hold broken with that error; an address whose params fail the kind's
81
+ check is broken `invalid/placement`.
82
+
83
+ ## 2. Routes (§3)
84
+
85
+ ```ts
86
+ host.route(Session, {
87
+ authorize(principal: P, address: Address<typeof Session>): boolean;
88
+ resolve(address: Address<typeof Session>, context: Context): Promise<{ link: Link; principal: P; trusted?: boolean }>;
89
+ });
90
+ ```
91
+
92
+ - `route` is called by base code before `load`; one route per kind (a second throws).
93
+ - **`authorize`** runs for every hold routed over the route, with the hold's principal (section 4), before anything
94
+ starts. `false` fails the hold broken `forbidden`.
95
+ - **`resolve`** runs at most once at a time per address: the first hold starts it, later holds wait for the same
96
+ promise. The returned link becomes the address's link (section 3, role `route`). `context` is aborted only when the
97
+ host closes. A resolve whose holds were all released meanwhile finishes and its link is kept (§3).
98
+ - **Failure and re-resolve:** a rejected `resolve`, a returned link that is already closed, or the address's link
99
+ closing while holds over it exist, starts the per-address backoff (1 s doubling to 60 s; a backoff map keyed by
100
+ address, separate from objects' identity backoff). While waiting, the holds are `loading` (3b). Only a link that
101
+ completed its handshake resets the backoff. Without holds for the address, nothing is resolved again.
102
+ - A `resolve` that never settles is the app's (it bounds its own `fork`); getters still time out by their deadlines.
103
+ - Chord never closes a route link itself except at `host.close`; stopping idle workers is the app's (`host.activity`,
104
+ 4b).
105
+
106
+ ## 3. Links carry both directions (§3, §22)
107
+
108
+ - **One link object per link** replaces 3a's `ProviderLink`/`ConsumerLink` pair: one channel (handshake, codec,
109
+ checks, heartbeat), a **provider side** (holds and calls it received; ids chosen by the peer), a **consumer side**
110
+ (holds and calls this host's own references sent; ids from its own counters). The provider side is one per
111
+ **origin** (section 4): the peer's own work, and each downstream link of a peer that relays. Message kinds are
112
+ directional, so each goes to its side. Locally served holds and relayed holds are two kinds of entries in a provider
113
+ side's table; a relayed hold is never hydrated into a `RemoteObject`.
114
+ - Every link has the peer's principal, `trusted`, and a role:
115
+
116
+ | Role | Made by | A hold arriving on it acts as | This host holds over it |
117
+ | --- | --- | --- | --- |
118
+ | parent | `connect` | the hold's `principal`/`incarnation` fields when present, else the link's principal and peer incarnation | types routed to the parent (a worker's holds of server types, everything a client gets) |
119
+ | child | `accept` | the link's principal and peer incarnation (fields ignored) | nothing |
120
+ | route | `resolve` | the link's principal and peer incarnation (fields ignored) | the address's objects |
121
+
122
+ - **Trusted links** (`trusted: true` on `accept`, `connect` and `resolve`'s result; default untrusted) skip only the
123
+ `MESSAGE` schema check (carry-over L6): framing, `checkParams`, `checkArgs` and Delta decoding still run. Trust never
124
+ grants the principal fields: they are read only on the parent link.
125
+ - `host.close` closes every link (children, routes, parent), then ends objects (3a order).
126
+ - **Remote objects** (3b's `RemoteObject`) belong to a **path**: the parent, or a route address. Each new link for a
127
+ path holds every remote object of that path again (3b's re-hold); a closed link drops its tables and the objects go
128
+ `loading`.
129
+
130
+ ## 4. Principals and relays (§4, §22, R1, Q13, R20)
131
+
132
+ **Principals on holds.** A `hold` carries `principal?` and `incarnation?`. The receiver uses them only on its parent
133
+ link; everywhere else they are ignored and the link's principal and peer incarnation apply (a tab cannot claim to be
134
+ the owner). Calls carry no principal: a call runs as its hold's principal and with its hold's incarnation
135
+ (`ctx.principal`, `ctx.incarnation`), so stamping calls separately is not needed (refines R1/Q13 "hold and call").
136
+
137
+ **What a host sends** in those fields when it holds over a route link (towards a child that honours them):
138
+
139
+ | The reference was made by | `principal` | `incarnation` |
140
+ | --- | --- | --- |
141
+ | `host.get` / `host.hold` | the host's own | this host's |
142
+ | `ctx.get` in a handler | the handler's `ctx.principal` (the caller's) | the handler's `ctx.incarnation` |
143
+ | `self.get` in a remote object | that object's principal | this host's |
144
+ | `self.get` in a local object or a facet | the host's own | this host's |
145
+ | a relayed hold (below) | the arriving hold's principal | the arriving hold's incarnation |
146
+
147
+ So a guest's call on the server whose handler `ctx.get`s a worker type reaches the worker as the guest, and gets the
148
+ guest's variant. `RemoteObject` keeps its binding's caller (3b drops it today) and two references with different
149
+ principals are two remote objects.
150
+
151
+ **Upward is a boundary.** A worker's hold of a server type goes over the worker's parent link; the server ignores
152
+ principal fields from a child, so it acts as the worker, whoever the worker's handler serves. A worker that acts for a
153
+ user towards the server passes the user as data and the server object decides. Documented.
154
+
155
+ **Relays.** A host that receives a hold it cannot serve (section 1's table: a route or the parent) relays it: it holds
156
+ it again on that link (the **upstream** link) with the arriving hold's principal and incarnation, and forwards between
157
+ the two without parsing payloads (decision "Relay flow control per origin").
158
+
159
+ - **Origins.** The relay gives each downstream origin (a downstream link, and the origin its messages carry when that
160
+ link is itself a relay's) a number, one counter per host, never reused; 0 is a host's own work. Every message
161
+ upstream for that origin carries `origin` (section 5); the provider keys holds, calls, windows and acks by (link,
162
+ origin, id), and its answers carry the origin back. `origin` is honoured on every link (a worker may relay a
163
+ child's hold to its parent); principals and incarnations stay parent-only.
164
+ - **Ids are not renumbered:** an upstream hold has the downstream hold's id, under the origin's number; calls the
165
+ same. Two tabs (two holds) of one principal are two upstream holds with their own encoders (R1).
166
+ - **Nothing is parsed:** the relay routes by the hold's address and authorizes it; params, arguments, results,
167
+ snapshots and ops travel as opaque parts (section 5).
168
+ - **What the relay keeps:** per relayed hold, its upstream link and its original `hold` message (params copied once),
169
+ which routes `call`, `cancel`, `retry` and `release` upstream at once and holds again on the next link; per
170
+ downstream origin, the FIFO of the sender of each `bound`/`state` message in flight (section 6), and the set of
171
+ upstream links it relayed to.
172
+ - **Forwarding up:** `hold`, `call`, `cancel`, `retry`, `release` with the origin's number; a `hold` waiting for its
173
+ route is sent when the link exists; a `release` before that drops it. A call is forwarded at once; with no
174
+ upstream link it is answered `unavailable`.
175
+ - **Forwarding down:** a message from upstream with an origin goes to that origin's provider side, which forwards it
176
+ with its own origin (none for a tab), ids and parts unchanged: `bound`, `state`, `failed`, `loading`, `result`,
177
+ `error`, `gone`. One upstream message concerns one origin, so it is never split. **A link answers only for what was
178
+ relayed over it** (owner, 2026-10-24): every entry of a `bound` or `state`, every `failed`, `loading` and `gone` by
179
+ its hold, every `result` and `error` by its call is checked against the relay's table: the hold (the call's hold)
180
+ must be relayed over the link the answer came from; otherwise it is dropped (Q1: also an answer crossing a release).
181
+ A `bound` or `state` left with some entries is forwarded with those; left with none, it is acknowledged to that link
182
+ at once (its window would otherwise lose the slot). A message for an origin from a link the origin relayed nothing
183
+ to is ignored whole. Cost: one table lookup per entry, a copy of the entry list only when one is dropped.
184
+ - **Upstream drop:** the relay sends `loading { hold }` downstream for every relayed hold on the dropped link, fails
185
+ their relayed calls in flight with `unavailable` (never resent), re-resolves (section 2) and holds again upstream
186
+ from the kept message (same id, same origin); the new `bound` is forwarded. A `bound` on a hold the consumer has
187
+ bound already replaces its replicas in one batch, another variant allowed (3b's re-hold path, now also for live
188
+ holds); `loading` on a live hold moves it to `loading`, and on a hold still loading fails a dependent's wait at once
189
+ (R18, as a dropped link does).
190
+ - **Downstream drop:** the origin's provider side ends: its served holds are released, its relayed holds forgotten,
191
+ and every upstream link it relayed to gets one `closed { origin }`, which releases the origin's holds and aborts its
192
+ calls there. The origin's number is never used again.
193
+ - **`gone`** from upstream is forwarded; the relayed hold is forgotten.
194
+
195
+ ## 5. Messages (§22, 2b)
196
+
197
+ Changes to slice 3a's `MESSAGE` and both codecs:
198
+
199
+ - **Parts are opaque bytes:** `params`, `args`, `value` (results), `bound` member values and `state` member ops are the
200
+ UTF-8 JSON text as bytes (plus byte segments for payloads marked `bytes`). The binary codec already writes them
201
+ length-prefixed; decoding returns views of the received buffer. A part is parsed only where it is owned, right when
202
+ its message is handled (so a malformed part is still a protocol error that closes the link): the provider parses
203
+ `params` (`checkParams`) and `args` (`checkArgs`), the consumer parses results and snapshots and decodes ops. A
204
+ message naming an unknown id is ignored before its parts are parsed (Q1). The text codec, a debugging codec,
205
+ re-serializes parts at decode (accepted cost: one parse per part per relay hop).
206
+ - `hello { protocol, incarnation, calls }`: `calls` is the number of concurrent calls this side accepts (section 6).
207
+ - **`origin?`** on `hold`, `release`, `call`, `cancel`, `retry`, `ack` (towards the provider) and `bound`, `state`,
208
+ `failed`, `loading`, `result`, `error`, `gone` (back): the relay's number of the downstream origin (an integer from
209
+ 1; absent: the sender's own work). Binary codec: the kind byte's high bit, then the origin as a varint; text codec:
210
+ `["@", origin, tuple]`. The schema refuses an origin on `hello`, `ping` and `pong`.
211
+ - `hold { origin?, hold, type, version, fingerprint, params, address?, principal?, incarnation? }`: `address` is the
212
+ address the caller computed (absent for a type without placement); it routes the hold, the provider places it by
213
+ its params.
214
+ - **`bound { holds: [{ hold, variant, members, failed }] }`:** one message may bind several holds; the consumer applies
215
+ all of them in one batch. Used for first bindings and re-holds.
216
+ - `ack { origin? }`: consumer to provider, one per applied `bound` or `state` message of that origin.
217
+ - `closed { origin }`: relay to provider, the downstream origin ended: its holds are released and its calls aborted.
218
+ - `ping {}` and `pong {}`: the heartbeat (section 7).
219
+ - `PROTOCOL_VERSION` stays 1 (nothing is deployed; carry-over L6).
220
+
221
+ ## 6. Flow control (§3, decision log)
222
+
223
+ **The window.** Per origin of a link, at most **K = 2** of the provider's own `bound` and `state` messages
224
+ unacknowledged; only these two kinds count (every other message is control and is never queued behind them). The
225
+ consumer sends `ack` (with the message's origin) after applying each (after its batch); an `ack` after the link or
226
+ the origin closed, or crossing nothing in flight, is ignored. The provider keeps per origin the sender of every
227
+ message in flight, in order: itself, or (at a relay) the upstream link it forwarded the message from. Acks arrive in
228
+ that order: one for its own message frees a slot, one for a relayed message is sent to that upstream link with the
229
+ origin's number there. So a tab served through a relay by W workers may have 2W messages in flight (plus the relay's
230
+ own 2), each worker's window bounding its own.
231
+
232
+ **The provider while the window is full:**
233
+
234
+ - each touched hold member keeps its ops in its **pending queue** (raw ops, never mutated: the same ops feed other
235
+ holds and watches; `r` drops everything before it; the leaf index merges a new append or primitive set into the last
236
+ pending op on the same path, any other op clears it; past 10,000 pending ops only "replace with the current value"
237
+ stays). The cap bounds entries, not payload bytes. When an `ack` frees a slot, one `state` message carries every
238
+ waiting hold's entry: its members' pending ops encoded once (or `[["r", value]]` after an overflow), all reflecting
239
+ the latest commit.
240
+ - a hold that binds while the window is full waits for a slot; its snapshot and subscription are taken in one
241
+ synchronous step when its `bound` is sent (3a race 2).
242
+ - a hold whose object leaves `live` while its `bound` waits goes back to pending (no `bound` is built for it; slice
243
+ 7's reload).
244
+
245
+ **The pending queue** is shared Chord code (`src/delta/`); the shared watch handle uses it too, in the same pi change
246
+ (carry-over; pi first).
247
+
248
+ **The relay** folds, drops and resets nothing: it forwards each upstream `bound`/`state` at once and returns its
249
+ `ack` when the downstream acknowledges it. A slow tab stalls only its origin at each worker, whose pending queues fold
250
+ its commits as they do for a direct consumer; other tabs and the relay's own holds on the same worker are other
251
+ origins with their own windows. A relay keeps no state per message beyond its senders FIFO.
252
+
253
+ **Calls.** `hello` announces how many concurrent calls a side accepts per origin (N, default 256, the same on every
254
+ host); a side sends no call before the peer's `hello`. A host sends at most N of its own calls per link in flight;
255
+ further calls wait in the link's **call queue**, one FIFO, sent in order as replies free slots (it does not preempt
256
+ calls already running). A relay forwards calls at once: each downstream origin's consumer is bounded by its own N,
257
+ so the upstream sees at most N per origin. Rules:
258
+
259
+ - a slot is freed once per call: by its `result` or `error`, by its `cancel` (when sent, at the caller; when received,
260
+ at the provider), or by its hold's `release`, `gone`, its origin's `closed` or the link closing;
261
+ - a call still queued when its hold rebinds (`loading`, then `bound`) is rejected `unavailable` (it may name a method
262
+ index of the old variant);
263
+ - a provider seeing more than N running calls of one origin closes the link (protocol error); a call naming a hold it
264
+ does not know is ignored before it is counted (Q1).
265
+
266
+ ## 7. Transports and heartbeat (§3)
267
+
268
+ - **`ipcLink(port)`** over a Node IPC channel (`fork` with `serialization: "advanced"`, or `process` in the child),
269
+ typed structurally (`send`, `on("message")`, `on("disconnect")`, `disconnect()`), no Node import in Chord. A
270
+ `Uint8Array` crosses as one message. `send` returning `false` is backpressure, not failure; a thrown error, an error
271
+ callback or `disconnect` closes the link once; messages after close are dropped; listeners are removed on close.
272
+ - **`webSocketLink(socket)`** over a WebSocket (`ws` in Node, the browser's), typed structurally: binary frames,
273
+ `binaryType = "arraybuffer"`; messages sent while the socket is still connecting are buffered and sent on `open`;
274
+ a socket already closed gives a closed link; close on `close` and `error`. The transport's `maxPayload` stays its
275
+ hard cap (code 1009; size limits per part are 4b).
276
+ - Both deliver whole messages in order and close both ends, like `memoryLinkPair`. They live in `src/next/link/`.
277
+ - **Heartbeat on every link kind**, in the channel: each link keeps a `lastReceived` timestamp (updated on every
278
+ received message; sends do not count) and the host runs one interval timer for all its links (no timer per
279
+ message). A link silent for 15 s sends `ping` (once its handshake is done; `hello` comes first); the peer answers
280
+ `pong` at once, never queued behind the window. A link silent for 30 s, the handshake included, is closed (its
281
+ references go `loading`, 3b). Both numbers are host options; tests use fake timers. The heartbeat detects a silent
282
+ transport, not a peer that answers pings but withholds acks (bounded instead by the window and the pending cap).
283
+
284
+ ## Races
285
+
286
+ Routes and resolve:
287
+
288
+ 1. Two holds for one address while its `resolve` runs: one `resolve`, shared.
289
+ 2. `resolve` rejects or returns a closed link: holds stay `loading`; re-resolve after the address's backoff while holds
290
+ exist; only a link that completed its handshake resets the backoff.
291
+ 3. Every hold for an address is released while `resolve` runs: it finishes; the link is kept.
292
+ 4. `authorize` refuses or throws: the hold fails broken; other principals for the address still resolve.
293
+ 5. Placement mismatch at the provider: broken `invalid/placement`.
294
+ 6. A worker restarts: its link closes; the next link's `hello` has a new incarnation; re-holds get fresh objects.
295
+ 7. `host.close` during `resolve`: its context is aborted; a link it still returns is closed at once.
296
+ 8. A hold from the parent for a type this host does not serve and has no route for: `unavailable` (never back to the
297
+ parent).
298
+
299
+ Principals and relays:
300
+
301
+ 9. A tab sends `principal: { kind: "owner" }` on its hold: ignored (child link); the hold acts as the tab's principal.
302
+ 10. A guest's handler on the server `ctx.get`s a worker type: the worker sees the guest (principal and incarnation).
303
+ 11. A worker's handler serving a guest gets a server type: the server sees the worker (upward boundary).
304
+ 12. The upstream link drops with relayed holds: `loading` downstream, relayed calls in flight `unavailable`,
305
+ re-resolve, re-hold with the same id and origin, the new `bound` forwarded; acks for messages of the dropped link
306
+ still in flight downstream go nowhere.
307
+ 13. A tab call that crossed the `loading` notice reaches the relay while upstream is down: `unavailable`.
308
+ 14. A tab releases a hold whose upstream hold is not sent yet: dropped; already sent: released upstream; messages
309
+ crossing it are forwarded and ignored by the tab (Q1).
310
+ 15. The tab link closes: one `closed { origin }` to each upstream link it relayed to (no `release` or `cancel`); the
311
+ worker releases the origin's holds and aborts its calls; its messages crossing the `closed` are dropped at the
312
+ relay (the origin is gone).
313
+ 16. `gone` from upstream: forwarded, the relayed hold forgotten.
314
+ 17. Holds of two tabs on one worker: two origins, so never one message; each tab's messages are atomic for it.
315
+
316
+ Flow control:
317
+
318
+ 18. An `ack` crossing a `release` or a close, or crossing nothing in flight: acks count messages per origin; one
319
+ with nothing in flight is ignored.
320
+ 19. Two workers' messages for one tab interleave at the relay: the senders FIFO returns each `ack` to its worker.
321
+ 20. A first `bound` from a worker while the tab is slow: forwarded at once (the worker's window for the tab origin
322
+ has room for it, or the binding waits there).
323
+ 21. A commit touches A and B of one tab on one worker while the tab is slow: one entry each in the worker's next
324
+ message for the tab origin, never split.
325
+ 22. A worker answers for a hold (or a call) of the same origin relayed over another worker's link, or for one the tab
326
+ released: the entry, notice or reply is dropped; a `bound`/`state` left empty is acknowledged to it at once. A
327
+ link the origin relayed nothing to: its message is ignored whole.
328
+ 23. The pending queue overflows while the window is full: the next message carries `[["r", value]]` for that member.
329
+ 24. A failed member, a constant and an empty variant in a first binding: carried in the `bound` (values, failed list).
330
+ 25. More than N calls: the excess waits in the caller's call queue; a relay forwards at once, so a worker counts at
331
+ most N per origin; one more is a protocol error.
332
+ 26. A call queued across a rebind with another variant: rejected `unavailable`.
333
+
334
+ Links and heartbeat:
335
+
336
+ 27. IPC: the child exits during `send`, or `disconnect` races a message in flight: the link closes once.
337
+ 28. WebSocket: a frame above `maxPayload` closes the connection (1009): references go `loading`.
338
+ 29. A WebSocket still connecting: `hello` and early messages are buffered until `open`.
339
+ 30. A peer that never sends `hello`: closed after 30 s. A busy link sends no pings. Two sides pinging at once: both
340
+ answer.
341
+ 31. A peer stalled by a synchronous handler for over 30 s is closed (documented: handlers must not block the event
342
+ loop that long).
343
+
344
+ ## Cost per hop
345
+
346
+ | Hop | Work |
347
+ | --- | --- |
348
+ | relay, per message | decode the envelope, swap the origin (one shallow copy of the message), encode the envelope; parts copied once into the outgoing buffer (O(bytes)), never parsed; per `bound`/`state` one FIFO entry |
349
+ | relay, per hold | the address's params checked once (route admission, `authorize`) |
350
+ | provider, window free | as slice 3a: one encode per commit per touched hold member |
351
+ | provider, window full | per op: one path key and one map lookup (leaf index); one encode per waiting member per freed slot |
352
+ | provider, per origin | a window and pending state per origin with holds; none for a relay |
353
+ | consumer | as slice 3a, plus one `ack` per `bound`/`state` message |
354
+ | origin | two bytes per message on a relay's upstream links |
355
+ | heartbeat | one timestamp write per received message; one host-wide timer |
356
+ | trusted link | no `MESSAGE` schema check |
357
+
358
+ Producer-side string diffs are not 4a's: a provider whose documents grow by plain string assignment pays Delta's
359
+ O(length) append detection per commit until it writes through `appendText` (pi #9265).
360
+
361
+ ## Benchmarks
362
+
363
+ Extend `test/next/bench/` (by hand, recorded in `benchmarks.md`): commit-to-frame and bytes through a relay (tab ↔
364
+ server ↔ worker over memory links, and over real IPC and a loopback WebSocket); hold-to-live through a relay including
365
+ `resolve` of an in-process worker; a consumer throttled to 64 KiB/s with stalls of 1, 10 and 60 s receiving a streamed
366
+ reply into a 500 KB view (bytes, catching up, sender heap; the producer's commit time recorded separately from the
367
+ encode); 10,000 calls from one tab with another tab's latency (p95) through the relay.
368
+
369
+ ## Carry-over taken by this slice
370
+
371
+ L6: trusted links skip the message check; a second `bound` on a bound hold (now in 4a: upstream re-holds);
372
+ `PROTOCOL_VERSION` unchanged. L7: `placement` (`invalid/placement`, not in the fingerprint). Decided: C12 (no call
373
+ credits; the call window). The pending queue and the shared watch handle change (pi first). §18's core facet pattern
374
+ (start data from the start message), shown in example 13. Left for 4b: revocation, cross-host cycles,
375
+ `host.references`, `host.activity`, size limits, compression (carry-over section 4b). Left as it is: L6's
376
+ `map(bytes())` declaration bug. From the 4a reviews (owner, 2026-10-24): an activation's `readyTimeout` covers its wait for the
377
+ previous instance's teardown too (an attempt abandoned there has opened nothing).
378
+
379
+ ## Tests
380
+
381
+ - Host kinds and placement: addresses and keys; `placement` excluded from the fingerprint; every row of section 1's
382
+ table; `invalid/placement`; throwing `placement` and `authorize`; never back to the parent.
383
+ - Routes: one `resolve` per address, rejection and backoff (fake timers), a closed returned link, re-resolve after a
384
+ drop while held and not without holds, `authorize` per principal, `host.close` aborting `resolve`.
385
+ - Two-sided links: the server holds a worker type and serves the worker's hold of a server type over one route link;
386
+ worker to worker through the server; a host that applies its own messages and forwards a tab origin's, each
387
+ acknowledged by its consumer.
388
+ - Principals: every row of section 4's table (guest `ctx.get`, remote `self.get`, local `self.get`, `host.get`
389
+ through a route), a forged `principal` from a tab ignored, the upward boundary, two origins with equal principal
390
+ keys but different incarnations.
391
+ - Relays: ids kept under the origin both ways, an origin per downstream link never reused, a worker's entries,
392
+ notices and replies for another worker's hold of the same origin dropped (a mixed message forwarded with its own
393
+ entries only, an emptied one acknowledged at once); no part parsed at a binary relay (a counter); upstream drop (`loading`, calls
394
+ `unavailable`, re-hold with the same id and origin, `bound` with another variant); downstream drop (`closed` per
395
+ worker); `gone`; mixed codecs (binary tab, text worker link).
396
+ - Flow control: K = 2 with a slow consumer; folding through the leaf index and the cap; a `bound` waiting for a slot,
397
+ and going back to pending when its object leaves `live`; a window per origin (a stalled origin folds, another
398
+ keeps receiving); `closed` per origin; through a relay: every message forwarded at once, each `ack` back to its
399
+ worker in order across two workers, a derive over two holds of a slow tab never torn.
400
+ - Calls: the window of N, the FIFO call queue, release and `gone` freeing slots once, a queued call across a
401
+ variant-changing rebind, N per origin at the provider (one more closes the link; an unknown hold ignored first),
402
+ calls in both directions with equal ids.
403
+ - Transports and heartbeat: IPC with a real `fork` (one small test) and a fake port (`send` returning false is not a
404
+ close); WebSocket over `ws` loopback and a fake socket (connecting buffer, already closed); silence before `hello`,
405
+ a busy link without pings, a half-open link closed at 30 s, simultaneous pings; timers and listeners released.
406
+ - Cost guards: no part parsed at a binary relay; one encode per waiting member per freed slot; no `MESSAGE` check on
407
+ trusted links; no timer per message.
408
+ - GC: a released relayed hold, a closed route link, a dropped downstream link, pending `resolve` waiters, the call
409
+ queue, the pending queue after a `closed`, received buffers not kept by parts after handling.
410
+ - Examples: `12-routes.ts` (a server routing to an in-process worker, a guest's `ctx.get` through it), `13-relay.ts`
411
+ (tab, server, worker over IPC and WebSocket; the worker's `SessionInfo` from its start message), `14-flow-control.ts`
412
+ (a slow tab: folding at the provider, and through a relay folding at the worker per origin while a fast tab keeps
413
+ receiving).
414
+
415
+ ## Size
416
+
417
+ About 2,500-3,000 changed or new source lines (two-sided links, routes, principals, the relay with origins, opaque parts in both codecs, flow control with the pending queue and the call queue, two transports, the
418
+ heartbeat), plus the pi change for the pending queue and the watch handle. Tests and examples about as much again.
@@ -0,0 +1,208 @@
1
+ # Slice 4b: authority and housekeeping (spec)
2
+
3
+ Status: **revised (2026-10-24) for flow control per origin; the owner sent it to building directly**, with reviews of
4
+ the build by fresh reviewers. Guiding rule (owner): simple, fast, correct. The single source for building 4b, together
5
+ with the feature map in `slices.md` (entries assigned to 4b) and its "Carry-over" section for slice 4b, `design.md` read
6
+ in full (most relevant: §3 links, relays and keep-alive, §4 principals and revocation, §6 cycles, §19 presence, §22
7
+ size limits and compression, §26 open points), the decision log (R2, R10, R11, Q2, Q5, R26, "Compression at the
8
+ origin", "Relay flow control per origin", "Slice 4b: `host.activity` is a watchable", "Simplification pass after 4a")
9
+ and the root `AGENTS.md` section "Chord v2 Code Style". Builds on slice 4a as simplified (`79a0206dc`).
10
+
11
+ Points marked **proposal** are the builder's default; the owner decides them after the build (they are collected in
12
+ the last section).
13
+
14
+ ## What an app can do after this slice
15
+
16
+ ```ts
17
+ type Revocation = { grant: string } | { device: string } | { session: string };
18
+ const server = createHost<P, Revocation>({
19
+ address: Server(), principal: { kind: "server" }, onError,
20
+ revokedBy: (p) => p.kind === "guest" ? [{ grant: p.grant }, { session: p.session }]
21
+ : p.kind === "owner" && p.access === "device" ? [{ device: p.device }] : [],
22
+ compression: nodeCompression, // from `@earendil-works/chord/next/node`
23
+ });
24
+ server.revoke({ grant: "g1" }, ctx); // ends g1's objects here and on every worker, closes g1's links
25
+
26
+ host.serve(Notes, ({ session }, principal, self) => {
27
+ const viewers = self.derive([host.references(Notes)], ([refs]) =>
28
+ refs.filter((r) => r.params.session === session).length);
29
+ …
30
+ });
31
+
32
+ const activity = await worker.activity.watch(ctx); // the app's supervisor decides
33
+
34
+ server.accept(webSocketLink(ws), { principal, limits: { part: 16 * MiB, decoded: 64 * MiB } }, ctx);
35
+ ```
36
+
37
+ ## 1. Revocation (§4, R10, R11)
38
+
39
+ - `createHost({ revokedBy })`: `(principal: P) => R[]`, `R` JSON; the same app code on every host. A principal's
40
+ **revocation keys** are the canonical JSON of each value `revokedBy` returns, computed once per principal object and
41
+ cached weakly (a `WeakMap` keyed by the principal object, with a GC test). L1's unused `revocationKeys` was cut
42
+ (owner, 2026-10-24): write the helper here, next to its user.
43
+ - `host.revoke(r, context)` on a host, synchronously:
44
+ 1. ends at once every object whose identity principal `p` has `r` in its keys (remote objects; local objects have no
45
+ principal), whatever references remain (R11): each holder gets `gone` with `forbidden` ("revoked"), running
46
+ calls' contexts are aborted (their callers are rejected), an activation in progress is abandoned. Teardown then
47
+ runs as for any ending (drain, closes with reason `end`).
48
+ 2. closes every **child** link (made by `accept`) whose principal has `r`; never the parent link, never the host's
49
+ own principal. Closing a tab's link at a relay sends `closed { origin }` upstream (4a), so that tab's holds on the
50
+ workers are released without a revocation message.
51
+ 3. sends `revoke { revocation: r }` on every **route** link (its children), which apply it with their own
52
+ `revokedBy`, and so on down. Nothing is replayed: a child connected later gets no past revocation (its objects
53
+ are new, and the revoked links are closed already).
54
+ - A `revoke` message is honoured only on the **parent** link (like the principal fields on holds); arriving on any
55
+ other link it is ignored.
56
+ - What `gone` means for consumers is 3a's rule (calls on the hold reject; a relay forwards it). Holds acting for a
57
+ revoked principal arrive at a worker as their own objects (identity principal = the hold's principal, 4a), so the
58
+ worker's own `revokedBy` ends them.
59
+ - Reconnecting never restores revoked authority: authentication is the app's; a changed grant is a new principal (its
60
+ key includes the grant revision, design §4).
61
+ - Jobs and revocation (R11) arrive with slice 5.
62
+
63
+ ## 2. Cycles across hosts (§6, Q5)
64
+
65
+ - Every object instance gets an **instance id** (uuidv7) at its first attempt; a restarted object (a new instance)
66
+ gets a new one, so an old chain never matches it (owner, 2026-10-24, D4).
67
+ - A hold made during an activation (a `self.get` of a type that is not served here, routed over a link) carries
68
+ `chain: string[]`: the chain of the activating object (the chain of the hold that created it, if any) plus its own
69
+ instance id; at most 32 entries (a longer chain keeps its last 32: a longer cycle is not detected; documented).
70
+ - A provider refuses a hold whose chain contains the instance id of the object it would bind while that object is
71
+ activating: the hold fails broken `invalid/cycle` naming the cycle by labels where known.
72
+ - **Proposal:** a dependency failing with `invalid/cycle` fails the dependent **broken** with the same error (an
73
+ exception to R18's "dependency failures are transient"). Otherwise, A (server) → B (worker) → A would fail B
74
+ transient, B would retry with backoff, and every retry would hit the same cycle.
75
+ - `chain` is honoured on trusted links (any role: a cycle runs server → worker → server over route and parent links)
76
+ and dropped from holds arriving on untrusted links. Relays copy it upstream unchanged (they activate nothing).
77
+ - One-host cycles stay as built (slice 1: following waiting objects).
78
+
79
+ ## 3. Presence: `host.references(Type)` (§19)
80
+
81
+ - `host.references(Type)` (on the host, and on the facet's host): a JSON `Watchable` of the references to objects of
82
+ that type on this host: `{ params, principal, origin }[]` (`principal` absent for a local type). `origin` is the
83
+ incarnation of the host where the reference was made: for a hold over a link, the hold's caller incarnation (the
84
+ tab's own, carried by a relay on route links, 4a); for a local reference, this host's incarnation. Two tabs are two
85
+ origins.
86
+ - It changes in the batch where a reference binds or ends; derives over it recompute there (W1). A link drop is a
87
+ departure (its holds end); smoothing is the UI's. Lingering objects have no references.
88
+ - Cost: one entry added or removed per reference, kept per type (a type nobody asks about costs a counter at most:
89
+ **proposal** build the list per type only while it is watched or read).
90
+
91
+ ## 4. Keep-alive counts: `host.activity` (§3, R26)
92
+
93
+ - `host.activity`: a JSON `Watchable` of `{ references, calls, jobs, lingering }` (owner, 2026-10-24): holds arriving
94
+ over links and served here, method calls running on this host (local and remote), running jobs (0 until slice 5),
95
+ lingering objects.
96
+ - Counters are kept where the work happens; a change marks the watchable dirty, and one publication per microtask turn
97
+ carries every change of that turn (not one per call start and end); its value is built from the counters when
98
+ published or read. A slow watcher gets the newest counts (pending queue).
99
+
100
+ ## 5. Size limits per part (R2, Q2)
101
+
102
+ - `accept(link, { …, limits })`, `connect(link, { …, limits })` and `resolve`'s result take
103
+ `limits: { part?: number; decoded?: number }` (bytes): `part` bounds a part's size on the wire, `decoded` its size
104
+ after inflating (section 6). Defaults (Q2): none on trusted links (IPC); on untrusted links 16 MiB and 64 MiB.
105
+ - Checked from the part's length before it is parsed or inflated (parts are opaque); the decoded bound is enforced
106
+ while inflating (section 6).
107
+ - An oversized part fails only its hold or call (`too_large/part`); the other parts of the message apply: an argument
108
+ part fails its call (`error` to the caller), a result fails its call, a snapshot fails its hold (no automatic
109
+ re-hold), a state part fails its hold. The link stays up.
110
+ - **The admitting link's limits travel with relayed work** (Q2): a relay checks `part` on the admitting link itself
111
+ (the bytes are there) and stamps `limit` (the admitting link's `decoded`) on the upstream `hold`; honoured only on
112
+ the parent link (like the principal fields); calls on the hold inherit it. The host that inflates enforces the
113
+ smaller of its own link's and the stamped one, so a worker never inflates a tab's argument beyond the tab link's
114
+ limit.
115
+ - The WebSocket's `maxPayload` stays the transport's hard cap (4a).
116
+
117
+ ## 6. Compression at the origin (#27: owner leaning (b), built as (b))
118
+
119
+ Problem: encoding happens in the synchronous flush (one message per commit, W1), so compression must be synchronous;
120
+ browsers have only the asynchronous `CompressionStream`/`DecompressionStream`.
121
+
122
+ - **Who compresses:** a host with a synchronous compressor (`createHost({ compression })`) compresses each JSON part
123
+ above 16 KiB (deflate raw, level 1) when it encodes it; the part's envelope says so (a codec flag per part in both
124
+ codecs). Byte segments stay raw. Hosts without one (browsers) send every part uncompressed; their parts are
125
+ arguments and params, which are small.
126
+ - **Who inflates:** the end that owns the part, when its message is handled. Relays never inflate (parts are opaque).
127
+ - **The adapter**, portable: `compression?: { deflate(bytes): Uint8Array; inflate(bytes, limit): Uint8Array }`
128
+ (synchronous). Chord ships `nodeCompression` (Node's `zlib.deflateRawSync`/`inflateRawSync` with
129
+ `maxOutputLength`) in a Node-only subpath; `src/next` itself imports no Node module. Without the adapter, a host
130
+ inflates asynchronously with the web `DecompressionStream("deflate-raw")`, counting output bytes and aborting past
131
+ the limit.
132
+ - **Order with asynchronous inflate:** a received message whose parts need an asynchronous inflate is held, and every
133
+ later message of that link waits behind it, in order, until it is inflated and handled. The queue is bounded: a
134
+ provider has at most two `bound`/`state` messages in flight per origin (2W + 2 for a tab behind a relay with W
135
+ workers), at most N = 256 call results per origin, and the `ack` goes out only after the message was applied, so a
136
+ slow inflate is backpressure like a slow consumer (its commits fold at the provider). Control messages (`ping`,
137
+ `pong`) are answered when they are reached in order; the 30 s heartbeat leaves ample room.
138
+ - Threshold (16 KiB) and level (1) are protocol constants, not per link.
139
+ - `PROTOCOL_VERSION` stays 1 (nothing deployed).
140
+
141
+ ## Messages
142
+
143
+ - `hold` gains `chain?: string[]` (trusted links only) and `limit?: number` (parent link only).
144
+ - `revoke { revocation }` (parent to child; honoured on the parent link only; no origin).
145
+ - A part's codec flag: in the binary codec a flag in the part's length prefix (builder's choice, documented); in the
146
+ text codec, which is for debugging but may sit on a relayed link, a compressed part travels as a tagged element
147
+ holding its base64 (**proposal**; the text codec itself never compresses).
148
+
149
+ ## Races
150
+
151
+ 1. `revoke` while an object of the principal activates: the attempt is abandoned, holders get `gone`.
152
+ 2. `revoke` while a call of the principal runs: its context is aborted; the caller is rejected (`gone` reaches it).
153
+ 3. A hold stamped with a revoked principal is already on its way to a worker: it binds, then the worker's `revoke`
154
+ (sent right after on the same link, per-direction order) ends it: R10's window, accepted.
155
+ 4. Two tabs of one grant, one revoked: both principals have the key, so the shared objects end for both and both links
156
+ close.
157
+ 5. `revoke` crossing a `resolve`: the new worker link gets no past `revoke`.
158
+ 6. A `revoke` from a child link: ignored.
159
+ 7. A cycle through a relay: the chain is copied upstream; detection at the provider.
160
+ 8. A cycle through a restart: new instance ids, no false cycle.
161
+ 9. `host.references` and a link drop in one batch with a commit: the derive sees the departure in that batch.
162
+ 10. An oversized part inside a `state` message with other holds' entries: only its hold fails.
163
+ 11. A compressed part whose inflated size exceeds the limit: its hold or call fails `too_large/part`; the link stays.
164
+ 12. A stamped `limit` or `chain` from a child or untrusted link: ignored.
165
+ 13. An asynchronous inflate in flight when the link closes: its message and everything queued behind it are dropped.
166
+ 14. A slow asynchronous inflate at a tab: the worker's window for the tab's origin fills; its commits fold.
167
+
168
+ ## Cost per hop
169
+
170
+ | Hop | Work |
171
+ | --- | --- |
172
+ | revoke | keys cached per principal; one lookup per object and link; O(objects + links) once |
173
+ | hold during activation | one chain array (at most 32) |
174
+ | presence | one entry added or removed per reference, in the batch |
175
+ | activity | counters; at most one publication per microtask turn with changes |
176
+ | size limits | one comparison per part before parsing |
177
+ | compression | one deflate per part above 16 KiB at its origin, one inflate at its owner; relays nothing |
178
+
179
+ ## Carry-over taken (from `slices.md`, section "Slice 4b")
180
+
181
+ All of it: revocation, cross-host cycles with instance ids, `host.references` and `host.activity`, size limits and
182
+ compression, the Durable conversation view's size on re-hold (known cost until pi #11327; nothing to build), route
183
+ links' context (give `route` a `context` option, defaulting to the host's background context, used for the link's
184
+ work and telemetry), one N on every host (unchanged; note stays), `gone` becomes reachable (test it through
185
+ revocation; drop the hand-ended test only if the new one covers the same paths).
186
+
187
+ ## Tests
188
+
189
+ Every race; revocation on one host, across a relay to a worker, two tabs of one grant; a child's `revoke` ignored;
190
+ cycles server → worker → server and through a relay, no false cycle after a restart, the broken dependent (proposal);
191
+ presence per origin with derives and link drops; activity counts per kind and one publication per turn; limits per
192
+ part in every message kind, the stamped decoded limit, a compressed bomb (both inflate paths); compression round
193
+ trips in both codecs, relays not inflating (a counter), the asynchronous inflate's ordering and its close race; cost
194
+ guards; GC (revoked objects, presence entries, revocation key cache, chains, the inflate queue). Examples:
195
+ `15-revocation.ts`, `16-presence-and-activity.ts`, `17-limits-and-compression.ts`. Benchmarks in `benchmarks.md`: a
196
+ 500 KB snapshot and a 1 MiB result compressed and not (bytes, encode and inflate time, synchronous and asynchronous).
197
+
198
+ ## Size
199
+
200
+ About 800-1,000 source lines.
201
+
202
+ ## Decisions for the owner after the build
203
+
204
+ Collected here by the builder and reviewers; known now:
205
+
206
+ 1. A cycle error makes the dependent broken (section 2), an exception to R18.
207
+ 2. Compression (b) as built: adapter shape, the asynchronous fallback, the text codec's form of a compressed part.
208
+ 3. `host.references` built lazily per type, or always.