@amalgm/live 0.2.81-preview.45708334404 → 0.2.81-preview.46146788616

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 (1099) hide show
  1. package/dist/apply/contracts.d.ts +17 -348
  2. package/dist/apply/contracts.js +1 -108
  3. package/dist/apply/fetch-ahead.d.ts +0 -45
  4. package/dist/apply/fetch-ahead.js +1 -169
  5. package/dist/apply/index.d.ts +0 -2
  6. package/dist/apply/index.js +1 -10
  7. package/dist/apply/journey.d.ts +0 -35
  8. package/dist/apply/journey.js +1 -403
  9. package/dist/apply/lane.d.ts +0 -34
  10. package/dist/apply/lane.js +1 -72
  11. package/dist/apply/line.d.ts +0 -28
  12. package/dist/apply/line.js +1 -81
  13. package/dist/apply/plans.d.ts +0 -14
  14. package/dist/apply/plans.js +1 -182
  15. package/dist/apply/rail.d.ts +0 -60
  16. package/dist/apply/rail.js +1 -776
  17. package/dist/apply/selection.d.ts +0 -15
  18. package/dist/apply/selection.js +1 -111
  19. package/dist/apply/settling.d.ts +0 -57
  20. package/dist/apply/settling.js +1 -63
  21. package/dist/apply/showing.d.ts +1 -95
  22. package/dist/apply/showing.js +1 -203
  23. package/dist/apply/type-adapters.d.ts +0 -8
  24. package/dist/apply/type-adapters.js +1 -39
  25. package/dist/apply/window.d.ts +0 -109
  26. package/dist/apply/window.js +1 -323
  27. package/dist/clash/bodmas.d.ts +1 -51
  28. package/dist/clash/bodmas.js +1 -130
  29. package/dist/clash/echo.d.ts +0 -27
  30. package/dist/clash/echo.js +1 -35
  31. package/dist/clash/index.d.ts +0 -1
  32. package/dist/clash/index.js +1 -6
  33. package/dist/clash/local-work.d.ts +0 -36
  34. package/dist/clash/local-work.js +1 -51
  35. package/dist/clash/resolution.d.ts +0 -13
  36. package/dist/clash/resolution.js +1 -15
  37. package/dist/clash/tetris.d.ts +0 -18
  38. package/dist/clash/tetris.js +1 -26
  39. package/dist/{sharing/command-input.d.ts → commands/input.d.ts} +5 -9
  40. package/dist/commands/input.js +1 -0
  41. package/dist/commands/mcp.d.ts +23 -0
  42. package/dist/commands/mcp.js +1 -0
  43. package/dist/contracts/content.d.ts +0 -78
  44. package/dist/contracts/content.js +1 -251
  45. package/dist/contracts/index.d.ts +0 -6
  46. package/dist/contracts/index.js +1 -9
  47. package/dist/contracts/protection.d.ts +16 -22
  48. package/dist/contracts/protection.js +1 -53
  49. package/dist/contracts/validate.d.ts +0 -18
  50. package/dist/contracts/validate.js +1 -23
  51. package/dist/detection/adapter-contract.d.ts +0 -75
  52. package/dist/detection/adapter-contract.js +1 -130
  53. package/dist/detection/batch.d.ts +1 -14
  54. package/dist/detection/batch.js +1 -75
  55. package/dist/detection/classify.d.ts +6 -40
  56. package/dist/detection/classify.js +1 -45
  57. package/dist/detection/content.d.ts +0 -17
  58. package/dist/detection/content.js +1 -76
  59. package/dist/detection/dispositions.d.ts +3 -82
  60. package/dist/detection/dispositions.js +0 -20
  61. package/dist/detection/echo.d.ts +0 -20
  62. package/dist/detection/echo.js +1 -33
  63. package/dist/detection/identity.d.ts +0 -56
  64. package/dist/detection/identity.js +1 -229
  65. package/dist/detection/ignore-lines.d.ts +0 -15
  66. package/dist/detection/ignore-lines.js +2 -212
  67. package/dist/detection/index.d.ts +0 -31
  68. package/dist/detection/index.js +1 -48
  69. package/dist/detection/package-proposal.d.ts +0 -24
  70. package/dist/detection/package-proposal.js +1 -114
  71. package/dist/detection/record-order.d.ts +5 -19
  72. package/dist/detection/record-order.js +1 -311
  73. package/dist/detection/record-proposal.d.ts +0 -98
  74. package/dist/detection/record-proposal.js +1 -384
  75. package/dist/detection/refusal.d.ts +0 -69
  76. package/dist/detection/refusal.js +1 -78
  77. package/dist/detection/removals.d.ts +0 -8
  78. package/dist/detection/removals.js +1 -51
  79. package/dist/detection/scoped-identity.d.ts +1 -61
  80. package/dist/detection/scoped-identity.js +1 -189
  81. package/dist/detection/skip-defaults.d.ts +0 -16
  82. package/dist/detection/skip-defaults.js +3 -20
  83. package/dist/detection/skip-policy.d.ts +0 -58
  84. package/dist/detection/skip-policy.js +1 -203
  85. package/dist/detection/watch-boundary.d.ts +0 -16
  86. package/dist/detection/watch-boundary.js +1 -47
  87. package/dist/drive/contracts.d.ts +0 -182
  88. package/dist/drive/contracts.js +1 -30
  89. package/dist/drive/drive.d.ts +0 -147
  90. package/dist/drive/drive.js +1 -414
  91. package/dist/drive/held-removals.d.ts +0 -49
  92. package/dist/drive/held-removals.js +1 -136
  93. package/dist/drive/index.d.ts +0 -7
  94. package/dist/drive/index.js +1 -16
  95. package/dist/drive/kept.d.ts +0 -10
  96. package/dist/drive/kept.js +1 -33
  97. package/dist/drive/listing.d.ts +2 -13
  98. package/dist/drive/listing.js +1 -84
  99. package/dist/drive/map-index.d.ts +0 -59
  100. package/dist/drive/map-index.js +1 -240
  101. package/dist/drive/placements.d.ts +0 -71
  102. package/dist/drive/placements.js +1 -164
  103. package/dist/drive/records.d.ts +0 -43
  104. package/dist/drive/records.js +1 -85
  105. package/dist/drive/where.d.ts +7 -94
  106. package/dist/drive/where.js +2 -378
  107. package/dist/entities/accepted-view.d.ts +0 -47
  108. package/dist/entities/accepted-view.js +1 -260
  109. package/dist/entities/bytes.d.ts +0 -16
  110. package/dist/entities/bytes.js +1 -112
  111. package/dist/entities/cloud.d.ts +0 -125
  112. package/dist/entities/cloud.js +1 -430
  113. package/dist/entities/graph-head.d.ts +0 -32
  114. package/dist/entities/graph-head.js +1 -114
  115. package/dist/entities/graph-pages.d.ts +0 -75
  116. package/dist/entities/graph-pages.js +1 -239
  117. package/dist/entities/index.d.ts +0 -28
  118. package/dist/entities/index.js +1 -40
  119. package/dist/entities/package-pages.d.ts +0 -28
  120. package/dist/entities/package-pages.js +1 -91
  121. package/dist/entities/placement-owed.d.ts +0 -27
  122. package/dist/entities/placement-owed.js +1 -86
  123. package/dist/entities/reducer.d.ts +0 -30
  124. package/dist/entities/reducer.js +1 -130
  125. package/dist/entities/registry-graph.d.ts +0 -80
  126. package/dist/entities/registry-graph.js +1 -478
  127. package/dist/entities/rules.d.ts +7 -72
  128. package/dist/entities/rules.js +1 -230
  129. package/dist/entities/types.d.ts +0 -71
  130. package/dist/entities/types.js +1 -55
  131. package/dist/entities/units.d.ts +0 -25
  132. package/dist/entities/units.js +1 -27
  133. package/dist/faults/classify.d.ts +0 -24
  134. package/dist/faults/classify.js +1 -77
  135. package/dist/faults/index.d.ts +0 -8
  136. package/dist/faults/index.js +1 -13
  137. package/dist/faults/need.d.ts +0 -24
  138. package/dist/faults/need.js +1 -76
  139. package/dist/faults/recover.d.ts +0 -18
  140. package/dist/faults/recover.js +1 -44
  141. package/dist/faults/report.d.ts +0 -23
  142. package/dist/faults/report.js +1 -130
  143. package/dist/faults/scrub.d.ts +0 -27
  144. package/dist/faults/scrub.js +3 -159
  145. package/dist/faults/wire.d.ts +0 -13
  146. package/dist/faults/wire.js +1 -42
  147. package/dist/files/accepted-files.d.ts +0 -37
  148. package/dist/files/accepted-files.js +1 -129
  149. package/dist/files/api.d.ts +0 -1
  150. package/dist/files/api.js +1 -83
  151. package/dist/files/browse-types.d.ts +7 -7
  152. package/dist/files/browse-types.js +1 -46
  153. package/dist/files/browser.d.ts +4 -2
  154. package/dist/files/browser.js +1 -100
  155. package/dist/files/cloud-files.d.ts +6 -5
  156. package/dist/files/cloud-files.js +1 -153
  157. package/dist/files/commands.d.ts +0 -54
  158. package/dist/files/commands.js +1 -140
  159. package/dist/files/computer-address.d.ts +0 -10
  160. package/dist/files/computer-address.js +1 -48
  161. package/dist/files/index.d.ts +1 -3
  162. package/dist/files/index.js +1 -18
  163. package/dist/files/local-files.d.ts +0 -2
  164. package/dist/files/local-files.js +1 -104
  165. package/dist/files/media-type.d.ts +0 -1
  166. package/dist/files/media-type.js +1 -50
  167. package/dist/files/own-folders.d.ts +0 -29
  168. package/dist/files/own-folders.js +1 -50
  169. package/dist/files/plans.d.ts +1 -16
  170. package/dist/files/plans.js +1 -36
  171. package/dist/files/trash.d.ts +0 -97
  172. package/dist/files/trash.js +1 -287
  173. package/dist/files/usage-categories.d.ts +0 -13
  174. package/dist/files/usage-categories.js +1 -33
  175. package/dist/files/usage-chain.d.ts +0 -27
  176. package/dist/files/usage-chain.js +1 -44
  177. package/dist/files/usage-effect.d.ts +0 -34
  178. package/dist/files/usage-effect.js +1 -29
  179. package/dist/files/usage.d.ts +3 -47
  180. package/dist/files/usage.js +1 -132
  181. package/dist/git/alternates.d.ts +0 -21
  182. package/dist/git/alternates.js +1 -79
  183. package/dist/git/artifact.d.ts +0 -69
  184. package/dist/git/artifact.js +1 -190
  185. package/dist/git/chain.d.ts +0 -32
  186. package/dist/git/chain.js +1 -55
  187. package/dist/git/holds.d.ts +30 -0
  188. package/dist/git/holds.js +1 -0
  189. package/dist/git/index.d.ts +4 -2
  190. package/dist/git/index.js +1 -11
  191. package/dist/git/parts.d.ts +10 -0
  192. package/dist/git/parts.js +7 -0
  193. package/dist/git/places.d.ts +6 -0
  194. package/dist/git/places.js +1 -0
  195. package/dist/git/plan.d.ts +0 -40
  196. package/dist/git/plan.js +1 -97
  197. package/dist/git/play.d.ts +11 -72
  198. package/dist/git/play.js +4 -318
  199. package/dist/git/refs.d.ts +0 -18
  200. package/dist/git/refs.js +8 -63
  201. package/dist/git/restore.d.ts +8 -0
  202. package/dist/git/restore.js +2 -0
  203. package/dist/git/state.d.ts +0 -103
  204. package/dist/git/state.js +3 -209
  205. package/dist/git/tag.d.ts +5 -51
  206. package/dist/git/tag.js +3 -68
  207. package/dist/git/text.d.ts +0 -3
  208. package/dist/git/text.js +1 -4
  209. package/dist/git/turns.d.ts +0 -104
  210. package/dist/git/turns.js +1 -153
  211. package/dist/history/history.d.ts +2 -14
  212. package/dist/history/history.js +1 -51
  213. package/dist/history/identity.d.ts +11 -0
  214. package/dist/history/identity.js +1 -0
  215. package/dist/history/index.d.ts +6 -9
  216. package/dist/history/index.js +1 -10
  217. package/dist/history/rule.d.ts +3 -38
  218. package/dist/history/rule.js +1 -78
  219. package/dist/history/runs.d.ts +17 -0
  220. package/dist/history/runs.js +1 -0
  221. package/dist/history/types.d.ts +6 -64
  222. package/dist/history/types.js +0 -9
  223. package/dist/history/version.d.ts +2 -8
  224. package/dist/history/version.js +1 -32
  225. package/dist/index.d.ts +0 -15
  226. package/dist/index.js +1 -32
  227. package/dist/records/authority.d.ts +0 -7
  228. package/dist/records/authority.js +1 -28
  229. package/dist/records/codec.d.ts +0 -2
  230. package/dist/records/codec.js +1 -43
  231. package/dist/records/contracts.d.ts +0 -20
  232. package/dist/records/contracts.js +1 -190
  233. package/dist/records/inbox.d.ts +0 -3
  234. package/dist/records/inbox.js +1 -40
  235. package/dist/records/index.d.ts +0 -2
  236. package/dist/records/index.js +1 -18
  237. package/dist/records/intentional.d.ts +0 -24
  238. package/dist/records/intentional.js +1 -58
  239. package/dist/records/outbox.d.ts +0 -10
  240. package/dist/records/outbox.js +1 -46
  241. package/dist/records/owned-effects.d.ts +0 -8
  242. package/dist/records/owned-effects.js +1 -37
  243. package/dist/records/publication.d.ts +1 -67
  244. package/dist/records/publication.js +1 -583
  245. package/dist/records/rail-ports.d.ts +2 -81
  246. package/dist/records/rail-ports.js +0 -3
  247. package/dist/records/rail.d.ts +1 -42
  248. package/dist/records/rail.js +1 -195
  249. package/dist/records/receive-channel.d.ts +0 -42
  250. package/dist/records/receive-channel.js +1 -131
  251. package/dist/records/receive-loop.d.ts +0 -48
  252. package/dist/records/receive-loop.js +1 -278
  253. package/dist/records/receive-pages.d.ts +0 -23
  254. package/dist/records/receive-pages.js +1 -98
  255. package/dist/records/retry-clock.d.ts +0 -3
  256. package/dist/records/retry-clock.js +1 -35
  257. package/dist/records/send-batch.d.ts +0 -45
  258. package/dist/records/send-batch.js +1 -119
  259. package/dist/records/send-freeing.d.ts +4 -42
  260. package/dist/records/send-freeing.js +1 -124
  261. package/dist/records/send-line.d.ts +1 -82
  262. package/dist/records/send-line.js +1 -411
  263. package/dist/records/send-preparation.d.ts +0 -39
  264. package/dist/records/send-preparation.js +1 -226
  265. package/dist/records/submit-frame.d.ts +0 -28
  266. package/dist/records/submit-frame.js +1 -161
  267. package/dist/records/unsent-count.d.ts +0 -24
  268. package/dist/records/unsent-count.js +1 -91
  269. package/dist/records/wire.d.ts +0 -10
  270. package/dist/records/wire.js +1 -121
  271. package/dist/registration/home-layout.d.ts +0 -18
  272. package/dist/registration/home-layout.js +1 -34
  273. package/dist/registration/index.d.ts +0 -3
  274. package/dist/registration/index.js +1 -5
  275. package/dist/registration/user-ground.d.ts +0 -165
  276. package/dist/registration/user-ground.js +1 -399
  277. package/dist/sharing/access.d.ts +0 -8
  278. package/dist/sharing/access.js +1 -51
  279. package/dist/sharing/cli.d.ts +0 -7
  280. package/dist/sharing/cli.js +8 -88
  281. package/dist/sharing/commands.d.ts +3 -16
  282. package/dist/sharing/commands.js +1 -164
  283. package/dist/sharing/construct.d.ts +0 -10
  284. package/dist/sharing/construct.js +1 -47
  285. package/dist/sharing/download.d.ts +0 -12
  286. package/dist/sharing/download.js +1 -45
  287. package/dist/sharing/entity.d.ts +0 -11
  288. package/dist/sharing/entity.js +1 -53
  289. package/dist/sharing/errors.d.ts +0 -2
  290. package/dist/sharing/errors.js +1 -11
  291. package/dist/sharing/grants.d.ts +0 -15
  292. package/dist/sharing/grants.js +1 -103
  293. package/dist/sharing/index.d.ts +3 -9
  294. package/dist/sharing/index.js +1 -16
  295. package/dist/sharing/mcp.d.ts +2 -25
  296. package/dist/sharing/mcp.js +1 -31
  297. package/dist/sharing/permissions.d.ts +0 -8
  298. package/dist/sharing/permissions.js +1 -45
  299. package/dist/sharing/publish.d.ts +0 -8
  300. package/dist/sharing/publish.js +1 -42
  301. package/dist/sharing/share.d.ts +0 -10
  302. package/dist/sharing/share.js +1 -31
  303. package/dist/sharing/sharing.d.ts +0 -5
  304. package/dist/sharing/sharing.js +1 -22
  305. package/dist/sharing/types.d.ts +0 -47
  306. package/dist/sharing/types.js +1 -15
  307. package/dist/steps.d.ts +0 -18
  308. package/dist/steps.js +1 -58
  309. package/dist/transfer/artifacts.d.ts +0 -19
  310. package/dist/transfer/artifacts.js +1 -89
  311. package/dist/transfer/batches.d.ts +0 -11
  312. package/dist/transfer/batches.js +1 -40
  313. package/dist/transfer/cargo-pack.d.ts +39 -0
  314. package/dist/transfer/cargo-pack.js +1 -0
  315. package/dist/transfer/cargo.d.ts +0 -39
  316. package/dist/transfer/cargo.js +1 -130
  317. package/dist/transfer/dispute.d.ts +9 -0
  318. package/dist/transfer/dispute.js +1 -0
  319. package/dist/transfer/download.d.ts +0 -97
  320. package/dist/transfer/download.js +1 -627
  321. package/dist/transfer/index.d.ts +2 -3
  322. package/dist/transfer/index.js +1 -10
  323. package/dist/transfer/parallel.d.ts +0 -19
  324. package/dist/transfer/parallel.js +1 -136
  325. package/dist/transfer/ranges.d.ts +0 -22
  326. package/dist/transfer/ranges.js +1 -59
  327. package/dist/transfer/refs.d.ts +0 -22
  328. package/dist/transfer/refs.js +1 -41
  329. package/dist/transfer/upload.d.ts +0 -49
  330. package/dist/transfer/upload.js +1 -248
  331. package/dist/versions/admit.d.ts +8 -0
  332. package/dist/versions/admit.js +1 -0
  333. package/dist/versions/api.d.ts +3 -0
  334. package/dist/versions/api.js +1 -0
  335. package/dist/versions/cli-text.d.ts +3 -0
  336. package/dist/versions/cli-text.js +5 -0
  337. package/dist/versions/cli.d.ts +12 -0
  338. package/dist/versions/cli.js +19 -0
  339. package/dist/versions/commands.d.ts +31 -0
  340. package/dist/versions/commands.js +1 -0
  341. package/dist/versions/content.d.ts +4 -0
  342. package/dist/versions/content.js +1 -0
  343. package/dist/versions/dates.d.ts +15 -0
  344. package/dist/versions/dates.js +1 -0
  345. package/dist/versions/deliver.d.ts +25 -0
  346. package/dist/versions/deliver.js +2 -0
  347. package/dist/versions/errors.d.ts +10 -0
  348. package/dist/versions/errors.js +1 -0
  349. package/dist/versions/index.d.ts +18 -0
  350. package/dist/versions/index.js +1 -0
  351. package/dist/versions/line.d.ts +8 -0
  352. package/dist/versions/line.js +1 -0
  353. package/dist/versions/list.d.ts +5 -0
  354. package/dist/versions/list.js +1 -0
  355. package/dist/versions/mcp.d.ts +3 -0
  356. package/dist/versions/mcp.js +1 -0
  357. package/dist/versions/ports.d.ts +46 -0
  358. package/dist/versions/ports.js +0 -0
  359. package/dist/versions/read.d.ts +12 -0
  360. package/dist/versions/read.js +1 -0
  361. package/dist/versions/restore.d.ts +5 -0
  362. package/dist/versions/restore.js +1 -0
  363. package/dist/versions/services.d.ts +4 -0
  364. package/dist/versions/services.js +1 -0
  365. package/dist/versions/show.d.ts +5 -0
  366. package/dist/versions/show.js +1 -0
  367. package/dist/versions/types.d.ts +64 -0
  368. package/dist/versions/types.js +0 -0
  369. package/dist/versions/versions.d.ts +10 -0
  370. package/dist/versions/versions.js +1 -0
  371. package/dist/watching/coverage.d.ts +0 -23
  372. package/dist/watching/coverage.js +1 -44
  373. package/dist/watching/index.d.ts +0 -6
  374. package/dist/watching/index.js +1 -9
  375. package/dist/watching/maintenance.d.ts +0 -66
  376. package/dist/watching/maintenance.js +1 -204
  377. package/dist/watching/suspicion.d.ts +0 -59
  378. package/dist/watching/suspicion.js +1 -513
  379. package/dist/workspace/api.d.ts +0 -1
  380. package/dist/workspace/api.js +1 -108
  381. package/dist/workspace/entries.d.ts +0 -3
  382. package/dist/workspace/entries.js +1 -77
  383. package/dist/workspace/identity.d.ts +0 -2
  384. package/dist/workspace/identity.js +1 -27
  385. package/dist/workspace/index.d.ts +0 -1
  386. package/dist/workspace/index.js +1 -5
  387. package/dist/workspace/registry.d.ts +0 -12
  388. package/dist/workspace/registry.js +1 -255
  389. package/dist/workspace/types.d.ts +0 -19
  390. package/dist/workspace/types.js +0 -2
  391. package/dist-cjs/apply/contracts.js +1 -115
  392. package/dist-cjs/apply/fetch-ahead.js +1 -174
  393. package/dist-cjs/apply/index.js +1 -26
  394. package/dist-cjs/apply/journey.js +1 -408
  395. package/dist-cjs/apply/lane.js +1 -76
  396. package/dist-cjs/apply/line.js +1 -91
  397. package/dist-cjs/apply/plans.js +1 -185
  398. package/dist-cjs/apply/rail.js +1 -780
  399. package/dist-cjs/apply/selection.js +1 -117
  400. package/dist-cjs/apply/settling.js +1 -67
  401. package/dist-cjs/apply/showing.js +1 -211
  402. package/dist-cjs/apply/type-adapters.js +1 -43
  403. package/dist-cjs/apply/window.js +1 -331
  404. package/dist-cjs/clash/bodmas.js +1 -133
  405. package/dist-cjs/clash/echo.js +1 -38
  406. package/dist-cjs/clash/index.js +1 -22
  407. package/dist-cjs/clash/local-work.js +1 -57
  408. package/dist-cjs/clash/resolution.js +1 -19
  409. package/dist-cjs/clash/tetris.js +1 -29
  410. package/dist-cjs/commands/input.js +1 -0
  411. package/dist-cjs/commands/mcp.js +1 -0
  412. package/dist-cjs/contracts/content.js +1 -267
  413. package/dist-cjs/contracts/index.js +1 -25
  414. package/dist-cjs/contracts/protection.js +1 -58
  415. package/dist-cjs/contracts/validate.js +1 -31
  416. package/dist-cjs/detection/adapter-contract.js +1 -135
  417. package/dist-cjs/detection/batch.js +1 -78
  418. package/dist-cjs/detection/classify.js +1 -52
  419. package/dist-cjs/detection/content.js +1 -82
  420. package/dist-cjs/detection/dispositions.js +1 -21
  421. package/dist-cjs/detection/echo.js +1 -36
  422. package/dist-cjs/detection/identity.js +1 -239
  423. package/dist-cjs/detection/ignore-lines.js +2 -216
  424. package/dist-cjs/detection/index.js +1 -64
  425. package/dist-cjs/detection/package-proposal.js +1 -120
  426. package/dist-cjs/detection/record-order.js +1 -314
  427. package/dist-cjs/detection/record-proposal.js +1 -398
  428. package/dist-cjs/detection/refusal.js +1 -88
  429. package/dist-cjs/detection/removals.js +1 -54
  430. package/dist-cjs/detection/scoped-identity.js +1 -192
  431. package/dist-cjs/detection/skip-defaults.js +2 -22
  432. package/dist-cjs/detection/skip-policy.js +1 -208
  433. package/dist-cjs/detection/watch-boundary.js +1 -51
  434. package/dist-cjs/drive/contracts.js +1 -34
  435. package/dist-cjs/drive/drive.js +1 -418
  436. package/dist-cjs/drive/held-removals.js +1 -140
  437. package/dist-cjs/drive/index.js +1 -32
  438. package/dist-cjs/drive/kept.js +1 -36
  439. package/dist-cjs/drive/listing.js +1 -87
  440. package/dist-cjs/drive/map-index.js +1 -245
  441. package/dist-cjs/drive/placements.js +1 -168
  442. package/dist-cjs/drive/records.js +1 -93
  443. package/dist-cjs/drive/where.js +2 -394
  444. package/dist-cjs/entities/accepted-view.js +1 -264
  445. package/dist-cjs/entities/bytes.js +1 -124
  446. package/dist-cjs/entities/cloud.js +1 -451
  447. package/dist-cjs/entities/graph-head.js +1 -121
  448. package/dist-cjs/entities/graph-pages.js +1 -257
  449. package/dist-cjs/entities/index.js +1 -56
  450. package/dist-cjs/entities/package-pages.js +1 -99
  451. package/dist-cjs/entities/placement-owed.js +1 -91
  452. package/dist-cjs/entities/reducer.js +1 -136
  453. package/dist-cjs/entities/registry-graph.js +1 -483
  454. package/dist-cjs/entities/rules.js +1 -251
  455. package/dist-cjs/entities/types.js +1 -61
  456. package/dist-cjs/entities/units.js +1 -30
  457. package/dist-cjs/faults/classify.js +1 -83
  458. package/dist-cjs/faults/index.js +1 -32
  459. package/dist-cjs/faults/need.js +1 -84
  460. package/dist-cjs/faults/recover.js +1 -49
  461. package/dist-cjs/faults/report.js +1 -135
  462. package/dist-cjs/faults/scrub.js +3 -169
  463. package/dist-cjs/faults/wire.js +1 -47
  464. package/dist-cjs/files/accepted-files.js +1 -135
  465. package/dist-cjs/files/api.js +1 -85
  466. package/dist-cjs/files/browse-types.js +1 -54
  467. package/dist-cjs/files/browser.js +1 -104
  468. package/dist-cjs/files/cloud-files.js +1 -159
  469. package/dist-cjs/files/commands.js +1 -145
  470. package/dist-cjs/files/computer-address.js +1 -52
  471. package/dist-cjs/files/index.js +1 -65
  472. package/dist-cjs/files/local-files.js +1 -108
  473. package/dist-cjs/files/media-type.js +1 -53
  474. package/dist-cjs/files/own-folders.js +1 -53
  475. package/dist-cjs/files/plans.js +1 -40
  476. package/dist-cjs/files/trash.js +1 -299
  477. package/dist-cjs/files/usage-categories.js +1 -37
  478. package/dist-cjs/files/usage-chain.js +1 -49
  479. package/dist-cjs/files/usage-effect.js +1 -34
  480. package/dist-cjs/files/usage.js +1 -140
  481. package/dist-cjs/git/alternates.js +1 -84
  482. package/dist-cjs/git/artifact.js +1 -202
  483. package/dist-cjs/git/chain.js +1 -59
  484. package/dist-cjs/git/holds.js +1 -0
  485. package/dist-cjs/git/index.js +1 -29
  486. package/dist-cjs/git/parts.js +7 -0
  487. package/dist-cjs/git/places.js +1 -0
  488. package/dist-cjs/git/plan.js +1 -100
  489. package/dist-cjs/git/play.js +4 -323
  490. package/dist-cjs/git/refs.js +8 -72
  491. package/dist-cjs/git/restore.js +2 -0
  492. package/dist-cjs/git/state.js +3 -230
  493. package/dist-cjs/git/tag.js +3 -72
  494. package/dist-cjs/git/text.js +1 -8
  495. package/dist-cjs/git/turns.js +1 -162
  496. package/dist-cjs/history/history.js +1 -53
  497. package/dist-cjs/history/identity.js +1 -0
  498. package/dist-cjs/history/index.js +1 -21
  499. package/dist-cjs/history/rule.js +1 -83
  500. package/dist-cjs/history/runs.js +1 -0
  501. package/dist-cjs/history/types.js +1 -10
  502. package/dist-cjs/history/version.js +1 -36
  503. package/dist-cjs/index.js +1 -48
  504. package/dist-cjs/records/authority.js +1 -31
  505. package/dist-cjs/records/codec.js +1 -49
  506. package/dist-cjs/records/contracts.js +1 -196
  507. package/dist-cjs/records/inbox.js +1 -43
  508. package/dist-cjs/records/index.js +1 -47
  509. package/dist-cjs/records/intentional.js +1 -61
  510. package/dist-cjs/records/outbox.js +1 -50
  511. package/dist-cjs/records/owned-effects.js +1 -41
  512. package/dist-cjs/records/publication.js +1 -593
  513. package/dist-cjs/records/rail-ports.js +1 -4
  514. package/dist-cjs/records/rail.js +1 -199
  515. package/dist-cjs/records/receive-channel.js +1 -136
  516. package/dist-cjs/records/receive-loop.js +1 -282
  517. package/dist-cjs/records/receive-pages.js +1 -103
  518. package/dist-cjs/records/retry-clock.js +1 -39
  519. package/dist-cjs/records/send-batch.js +1 -126
  520. package/dist-cjs/records/send-freeing.js +1 -128
  521. package/dist-cjs/records/send-line.js +1 -415
  522. package/dist-cjs/records/send-preparation.js +1 -230
  523. package/dist-cjs/records/submit-frame.js +1 -167
  524. package/dist-cjs/records/unsent-count.js +1 -95
  525. package/dist-cjs/records/wire.js +1 -127
  526. package/dist-cjs/registration/home-layout.js +1 -38
  527. package/dist-cjs/registration/index.js +1 -21
  528. package/dist-cjs/registration/user-ground.js +1 -407
  529. package/dist-cjs/sharing/access.js +1 -56
  530. package/dist-cjs/sharing/cli.js +8 -93
  531. package/dist-cjs/sharing/commands.js +1 -169
  532. package/dist-cjs/sharing/construct.js +1 -53
  533. package/dist-cjs/sharing/download.js +1 -48
  534. package/dist-cjs/sharing/entity.js +1 -59
  535. package/dist-cjs/sharing/errors.js +1 -14
  536. package/dist-cjs/sharing/grants.js +1 -108
  537. package/dist-cjs/sharing/index.js +1 -36
  538. package/dist-cjs/sharing/mcp.js +1 -33
  539. package/dist-cjs/sharing/permissions.js +1 -47
  540. package/dist-cjs/sharing/publish.js +1 -45
  541. package/dist-cjs/sharing/share.js +1 -36
  542. package/dist-cjs/sharing/sharing.js +1 -24
  543. package/dist-cjs/sharing/types.js +1 -19
  544. package/dist-cjs/steps.js +1 -64
  545. package/dist-cjs/transfer/artifacts.js +1 -95
  546. package/dist-cjs/transfer/batches.js +1 -44
  547. package/dist-cjs/transfer/cargo-pack.js +1 -0
  548. package/dist-cjs/transfer/cargo.js +1 -135
  549. package/dist-cjs/transfer/dispute.js +1 -0
  550. package/dist-cjs/transfer/download.js +1 -634
  551. package/dist-cjs/transfer/index.js +1 -30
  552. package/dist-cjs/transfer/parallel.js +1 -143
  553. package/dist-cjs/transfer/ranges.js +1 -63
  554. package/dist-cjs/transfer/refs.js +1 -45
  555. package/dist-cjs/transfer/upload.js +1 -256
  556. package/dist-cjs/versions/admit.js +1 -0
  557. package/dist-cjs/versions/api.js +1 -0
  558. package/dist-cjs/versions/cli-text.js +5 -0
  559. package/dist-cjs/versions/cli.js +19 -0
  560. package/dist-cjs/versions/commands.js +1 -0
  561. package/dist-cjs/versions/content.js +1 -0
  562. package/dist-cjs/versions/dates.js +1 -0
  563. package/dist-cjs/versions/deliver.js +2 -0
  564. package/dist-cjs/versions/errors.js +1 -0
  565. package/dist-cjs/versions/index.js +1 -0
  566. package/dist-cjs/versions/line.js +1 -0
  567. package/dist-cjs/versions/list.js +1 -0
  568. package/dist-cjs/versions/mcp.js +1 -0
  569. package/dist-cjs/versions/ports.js +1 -0
  570. package/dist-cjs/versions/read.js +1 -0
  571. package/dist-cjs/versions/restore.js +1 -0
  572. package/dist-cjs/versions/services.js +1 -0
  573. package/dist-cjs/versions/show.js +1 -0
  574. package/dist-cjs/versions/types.js +1 -0
  575. package/dist-cjs/versions/versions.js +1 -0
  576. package/dist-cjs/watching/coverage.js +1 -48
  577. package/dist-cjs/watching/index.js +1 -25
  578. package/dist-cjs/watching/maintenance.js +1 -208
  579. package/dist-cjs/watching/suspicion.js +1 -517
  580. package/dist-cjs/workspace/api.js +1 -110
  581. package/dist-cjs/workspace/entries.js +1 -82
  582. package/dist-cjs/workspace/identity.js +1 -32
  583. package/dist-cjs/workspace/index.js +1 -15
  584. package/dist-cjs/workspace/registry.js +1 -259
  585. package/dist-cjs/workspace/types.js +1 -3
  586. package/package.json +22 -7
  587. package/PURPOSE.md +0 -697
  588. package/dist/apply/contracts.d.ts.map +0 -1
  589. package/dist/apply/contracts.js.map +0 -1
  590. package/dist/apply/fetch-ahead.d.ts.map +0 -1
  591. package/dist/apply/fetch-ahead.js.map +0 -1
  592. package/dist/apply/index.d.ts.map +0 -1
  593. package/dist/apply/index.js.map +0 -1
  594. package/dist/apply/journey.d.ts.map +0 -1
  595. package/dist/apply/journey.js.map +0 -1
  596. package/dist/apply/lane.d.ts.map +0 -1
  597. package/dist/apply/lane.js.map +0 -1
  598. package/dist/apply/line.d.ts.map +0 -1
  599. package/dist/apply/line.js.map +0 -1
  600. package/dist/apply/plans.d.ts.map +0 -1
  601. package/dist/apply/plans.js.map +0 -1
  602. package/dist/apply/rail.d.ts.map +0 -1
  603. package/dist/apply/rail.js.map +0 -1
  604. package/dist/apply/selection.d.ts.map +0 -1
  605. package/dist/apply/selection.js.map +0 -1
  606. package/dist/apply/settling.d.ts.map +0 -1
  607. package/dist/apply/settling.js.map +0 -1
  608. package/dist/apply/showing.d.ts.map +0 -1
  609. package/dist/apply/showing.js.map +0 -1
  610. package/dist/apply/type-adapters.d.ts.map +0 -1
  611. package/dist/apply/type-adapters.js.map +0 -1
  612. package/dist/apply/window.d.ts.map +0 -1
  613. package/dist/apply/window.js.map +0 -1
  614. package/dist/clash/bodmas.d.ts.map +0 -1
  615. package/dist/clash/bodmas.js.map +0 -1
  616. package/dist/clash/echo.d.ts.map +0 -1
  617. package/dist/clash/echo.js.map +0 -1
  618. package/dist/clash/index.d.ts.map +0 -1
  619. package/dist/clash/index.js.map +0 -1
  620. package/dist/clash/local-work.d.ts.map +0 -1
  621. package/dist/clash/local-work.js.map +0 -1
  622. package/dist/clash/resolution.d.ts.map +0 -1
  623. package/dist/clash/resolution.js.map +0 -1
  624. package/dist/clash/tetris.d.ts.map +0 -1
  625. package/dist/clash/tetris.js.map +0 -1
  626. package/dist/contracts/content.d.ts.map +0 -1
  627. package/dist/contracts/content.js.map +0 -1
  628. package/dist/contracts/index.d.ts.map +0 -1
  629. package/dist/contracts/index.js.map +0 -1
  630. package/dist/contracts/protection.d.ts.map +0 -1
  631. package/dist/contracts/protection.js.map +0 -1
  632. package/dist/contracts/validate.d.ts.map +0 -1
  633. package/dist/contracts/validate.js.map +0 -1
  634. package/dist/detection/adapter-contract.d.ts.map +0 -1
  635. package/dist/detection/adapter-contract.js.map +0 -1
  636. package/dist/detection/batch.d.ts.map +0 -1
  637. package/dist/detection/batch.js.map +0 -1
  638. package/dist/detection/classify.d.ts.map +0 -1
  639. package/dist/detection/classify.js.map +0 -1
  640. package/dist/detection/content.d.ts.map +0 -1
  641. package/dist/detection/content.js.map +0 -1
  642. package/dist/detection/dispositions.d.ts.map +0 -1
  643. package/dist/detection/dispositions.js.map +0 -1
  644. package/dist/detection/echo.d.ts.map +0 -1
  645. package/dist/detection/echo.js.map +0 -1
  646. package/dist/detection/identity.d.ts.map +0 -1
  647. package/dist/detection/identity.js.map +0 -1
  648. package/dist/detection/ignore-lines.d.ts.map +0 -1
  649. package/dist/detection/ignore-lines.js.map +0 -1
  650. package/dist/detection/index.d.ts.map +0 -1
  651. package/dist/detection/index.js.map +0 -1
  652. package/dist/detection/package-proposal.d.ts.map +0 -1
  653. package/dist/detection/package-proposal.js.map +0 -1
  654. package/dist/detection/record-order.d.ts.map +0 -1
  655. package/dist/detection/record-order.js.map +0 -1
  656. package/dist/detection/record-proposal.d.ts.map +0 -1
  657. package/dist/detection/record-proposal.js.map +0 -1
  658. package/dist/detection/refusal.d.ts.map +0 -1
  659. package/dist/detection/refusal.js.map +0 -1
  660. package/dist/detection/removals.d.ts.map +0 -1
  661. package/dist/detection/removals.js.map +0 -1
  662. package/dist/detection/scoped-identity.d.ts.map +0 -1
  663. package/dist/detection/scoped-identity.js.map +0 -1
  664. package/dist/detection/skip-defaults.d.ts.map +0 -1
  665. package/dist/detection/skip-defaults.js.map +0 -1
  666. package/dist/detection/skip-policy.d.ts.map +0 -1
  667. package/dist/detection/skip-policy.js.map +0 -1
  668. package/dist/detection/watch-boundary.d.ts.map +0 -1
  669. package/dist/detection/watch-boundary.js.map +0 -1
  670. package/dist/drive/contracts.d.ts.map +0 -1
  671. package/dist/drive/contracts.js.map +0 -1
  672. package/dist/drive/drive.d.ts.map +0 -1
  673. package/dist/drive/drive.js.map +0 -1
  674. package/dist/drive/held-removals.d.ts.map +0 -1
  675. package/dist/drive/held-removals.js.map +0 -1
  676. package/dist/drive/index.d.ts.map +0 -1
  677. package/dist/drive/index.js.map +0 -1
  678. package/dist/drive/kept.d.ts.map +0 -1
  679. package/dist/drive/kept.js.map +0 -1
  680. package/dist/drive/listing.d.ts.map +0 -1
  681. package/dist/drive/listing.js.map +0 -1
  682. package/dist/drive/map-index.d.ts.map +0 -1
  683. package/dist/drive/map-index.js.map +0 -1
  684. package/dist/drive/placements.d.ts.map +0 -1
  685. package/dist/drive/placements.js.map +0 -1
  686. package/dist/drive/records.d.ts.map +0 -1
  687. package/dist/drive/records.js.map +0 -1
  688. package/dist/drive/where.d.ts.map +0 -1
  689. package/dist/drive/where.js.map +0 -1
  690. package/dist/entities/accepted-view.d.ts.map +0 -1
  691. package/dist/entities/accepted-view.js.map +0 -1
  692. package/dist/entities/bytes.d.ts.map +0 -1
  693. package/dist/entities/bytes.js.map +0 -1
  694. package/dist/entities/cloud.d.ts.map +0 -1
  695. package/dist/entities/cloud.js.map +0 -1
  696. package/dist/entities/graph-head.d.ts.map +0 -1
  697. package/dist/entities/graph-head.js.map +0 -1
  698. package/dist/entities/graph-pages.d.ts.map +0 -1
  699. package/dist/entities/graph-pages.js.map +0 -1
  700. package/dist/entities/index.d.ts.map +0 -1
  701. package/dist/entities/index.js.map +0 -1
  702. package/dist/entities/package-pages.d.ts.map +0 -1
  703. package/dist/entities/package-pages.js.map +0 -1
  704. package/dist/entities/placement-owed.d.ts.map +0 -1
  705. package/dist/entities/placement-owed.js.map +0 -1
  706. package/dist/entities/reducer.d.ts.map +0 -1
  707. package/dist/entities/reducer.js.map +0 -1
  708. package/dist/entities/registry-graph.d.ts.map +0 -1
  709. package/dist/entities/registry-graph.js.map +0 -1
  710. package/dist/entities/rules.d.ts.map +0 -1
  711. package/dist/entities/rules.js.map +0 -1
  712. package/dist/entities/types.d.ts.map +0 -1
  713. package/dist/entities/types.js.map +0 -1
  714. package/dist/entities/units.d.ts.map +0 -1
  715. package/dist/entities/units.js.map +0 -1
  716. package/dist/faults/classify.d.ts.map +0 -1
  717. package/dist/faults/classify.js.map +0 -1
  718. package/dist/faults/index.d.ts.map +0 -1
  719. package/dist/faults/index.js.map +0 -1
  720. package/dist/faults/need.d.ts.map +0 -1
  721. package/dist/faults/need.js.map +0 -1
  722. package/dist/faults/recover.d.ts.map +0 -1
  723. package/dist/faults/recover.js.map +0 -1
  724. package/dist/faults/report.d.ts.map +0 -1
  725. package/dist/faults/report.js.map +0 -1
  726. package/dist/faults/scrub.d.ts.map +0 -1
  727. package/dist/faults/scrub.js.map +0 -1
  728. package/dist/faults/wire.d.ts.map +0 -1
  729. package/dist/faults/wire.js.map +0 -1
  730. package/dist/files/accepted-files.d.ts.map +0 -1
  731. package/dist/files/accepted-files.js.map +0 -1
  732. package/dist/files/api.d.ts.map +0 -1
  733. package/dist/files/api.js.map +0 -1
  734. package/dist/files/browse-types.d.ts.map +0 -1
  735. package/dist/files/browse-types.js.map +0 -1
  736. package/dist/files/browser.d.ts.map +0 -1
  737. package/dist/files/browser.js.map +0 -1
  738. package/dist/files/cloud-files.d.ts.map +0 -1
  739. package/dist/files/cloud-files.js.map +0 -1
  740. package/dist/files/commands.d.ts.map +0 -1
  741. package/dist/files/commands.js.map +0 -1
  742. package/dist/files/computer-address.d.ts.map +0 -1
  743. package/dist/files/computer-address.js.map +0 -1
  744. package/dist/files/index.d.ts.map +0 -1
  745. package/dist/files/index.js.map +0 -1
  746. package/dist/files/local-files.d.ts.map +0 -1
  747. package/dist/files/local-files.js.map +0 -1
  748. package/dist/files/media-type.d.ts.map +0 -1
  749. package/dist/files/media-type.js.map +0 -1
  750. package/dist/files/own-folders.d.ts.map +0 -1
  751. package/dist/files/own-folders.js.map +0 -1
  752. package/dist/files/plans.d.ts.map +0 -1
  753. package/dist/files/plans.js.map +0 -1
  754. package/dist/files/trash.d.ts.map +0 -1
  755. package/dist/files/trash.js.map +0 -1
  756. package/dist/files/usage-categories.d.ts.map +0 -1
  757. package/dist/files/usage-categories.js.map +0 -1
  758. package/dist/files/usage-chain.d.ts.map +0 -1
  759. package/dist/files/usage-chain.js.map +0 -1
  760. package/dist/files/usage-effect.d.ts.map +0 -1
  761. package/dist/files/usage-effect.js.map +0 -1
  762. package/dist/files/usage.d.ts.map +0 -1
  763. package/dist/files/usage.js.map +0 -1
  764. package/dist/git/alternates.d.ts.map +0 -1
  765. package/dist/git/alternates.js.map +0 -1
  766. package/dist/git/artifact.d.ts.map +0 -1
  767. package/dist/git/artifact.js.map +0 -1
  768. package/dist/git/chain.d.ts.map +0 -1
  769. package/dist/git/chain.js.map +0 -1
  770. package/dist/git/commands.d.ts +0 -3
  771. package/dist/git/commands.d.ts.map +0 -1
  772. package/dist/git/commands.js +0 -35
  773. package/dist/git/commands.js.map +0 -1
  774. package/dist/git/index.d.ts.map +0 -1
  775. package/dist/git/index.js.map +0 -1
  776. package/dist/git/plan.d.ts.map +0 -1
  777. package/dist/git/plan.js.map +0 -1
  778. package/dist/git/play.d.ts.map +0 -1
  779. package/dist/git/play.js.map +0 -1
  780. package/dist/git/refs.d.ts.map +0 -1
  781. package/dist/git/refs.js.map +0 -1
  782. package/dist/git/state.d.ts.map +0 -1
  783. package/dist/git/state.js.map +0 -1
  784. package/dist/git/tag.d.ts.map +0 -1
  785. package/dist/git/tag.js.map +0 -1
  786. package/dist/git/text.d.ts.map +0 -1
  787. package/dist/git/text.js.map +0 -1
  788. package/dist/git/turns.d.ts.map +0 -1
  789. package/dist/git/turns.js.map +0 -1
  790. package/dist/history/history.d.ts.map +0 -1
  791. package/dist/history/history.js.map +0 -1
  792. package/dist/history/index.d.ts.map +0 -1
  793. package/dist/history/index.js.map +0 -1
  794. package/dist/history/rule.d.ts.map +0 -1
  795. package/dist/history/rule.js.map +0 -1
  796. package/dist/history/types.d.ts.map +0 -1
  797. package/dist/history/types.js.map +0 -1
  798. package/dist/history/version.d.ts.map +0 -1
  799. package/dist/history/version.js.map +0 -1
  800. package/dist/index.d.ts.map +0 -1
  801. package/dist/index.js.map +0 -1
  802. package/dist/records/authority.d.ts.map +0 -1
  803. package/dist/records/authority.js.map +0 -1
  804. package/dist/records/codec.d.ts.map +0 -1
  805. package/dist/records/codec.js.map +0 -1
  806. package/dist/records/contracts.d.ts.map +0 -1
  807. package/dist/records/contracts.js.map +0 -1
  808. package/dist/records/inbox.d.ts.map +0 -1
  809. package/dist/records/inbox.js.map +0 -1
  810. package/dist/records/index.d.ts.map +0 -1
  811. package/dist/records/index.js.map +0 -1
  812. package/dist/records/intentional.d.ts.map +0 -1
  813. package/dist/records/intentional.js.map +0 -1
  814. package/dist/records/outbox.d.ts.map +0 -1
  815. package/dist/records/outbox.js.map +0 -1
  816. package/dist/records/owned-effects.d.ts.map +0 -1
  817. package/dist/records/owned-effects.js.map +0 -1
  818. package/dist/records/publication.d.ts.map +0 -1
  819. package/dist/records/publication.js.map +0 -1
  820. package/dist/records/rail-ports.d.ts.map +0 -1
  821. package/dist/records/rail-ports.js.map +0 -1
  822. package/dist/records/rail.d.ts.map +0 -1
  823. package/dist/records/rail.js.map +0 -1
  824. package/dist/records/receive-channel.d.ts.map +0 -1
  825. package/dist/records/receive-channel.js.map +0 -1
  826. package/dist/records/receive-loop.d.ts.map +0 -1
  827. package/dist/records/receive-loop.js.map +0 -1
  828. package/dist/records/receive-pages.d.ts.map +0 -1
  829. package/dist/records/receive-pages.js.map +0 -1
  830. package/dist/records/retry-clock.d.ts.map +0 -1
  831. package/dist/records/retry-clock.js.map +0 -1
  832. package/dist/records/send-batch.d.ts.map +0 -1
  833. package/dist/records/send-batch.js.map +0 -1
  834. package/dist/records/send-freeing.d.ts.map +0 -1
  835. package/dist/records/send-freeing.js.map +0 -1
  836. package/dist/records/send-line.d.ts.map +0 -1
  837. package/dist/records/send-line.js.map +0 -1
  838. package/dist/records/send-preparation.d.ts.map +0 -1
  839. package/dist/records/send-preparation.js.map +0 -1
  840. package/dist/records/submit-frame.d.ts.map +0 -1
  841. package/dist/records/submit-frame.js.map +0 -1
  842. package/dist/records/unsent-count.d.ts.map +0 -1
  843. package/dist/records/unsent-count.js.map +0 -1
  844. package/dist/records/wire.d.ts.map +0 -1
  845. package/dist/records/wire.js.map +0 -1
  846. package/dist/registration/home-layout.d.ts.map +0 -1
  847. package/dist/registration/home-layout.js.map +0 -1
  848. package/dist/registration/index.d.ts.map +0 -1
  849. package/dist/registration/index.js.map +0 -1
  850. package/dist/registration/user-ground.d.ts.map +0 -1
  851. package/dist/registration/user-ground.js.map +0 -1
  852. package/dist/sharing/access.d.ts.map +0 -1
  853. package/dist/sharing/access.js.map +0 -1
  854. package/dist/sharing/cli.d.ts.map +0 -1
  855. package/dist/sharing/cli.js.map +0 -1
  856. package/dist/sharing/command-input.d.ts.map +0 -1
  857. package/dist/sharing/command-input.js +0 -63
  858. package/dist/sharing/command-input.js.map +0 -1
  859. package/dist/sharing/commands.d.ts.map +0 -1
  860. package/dist/sharing/commands.js.map +0 -1
  861. package/dist/sharing/construct.d.ts.map +0 -1
  862. package/dist/sharing/construct.js.map +0 -1
  863. package/dist/sharing/download.d.ts.map +0 -1
  864. package/dist/sharing/download.js.map +0 -1
  865. package/dist/sharing/entity.d.ts.map +0 -1
  866. package/dist/sharing/entity.js.map +0 -1
  867. package/dist/sharing/errors.d.ts.map +0 -1
  868. package/dist/sharing/errors.js.map +0 -1
  869. package/dist/sharing/grants.d.ts.map +0 -1
  870. package/dist/sharing/grants.js.map +0 -1
  871. package/dist/sharing/index.d.ts.map +0 -1
  872. package/dist/sharing/index.js.map +0 -1
  873. package/dist/sharing/mcp.d.ts.map +0 -1
  874. package/dist/sharing/mcp.js.map +0 -1
  875. package/dist/sharing/permissions.d.ts.map +0 -1
  876. package/dist/sharing/permissions.js.map +0 -1
  877. package/dist/sharing/publish.d.ts.map +0 -1
  878. package/dist/sharing/publish.js.map +0 -1
  879. package/dist/sharing/share.d.ts.map +0 -1
  880. package/dist/sharing/share.js.map +0 -1
  881. package/dist/sharing/sharing.d.ts.map +0 -1
  882. package/dist/sharing/sharing.js.map +0 -1
  883. package/dist/sharing/types.d.ts.map +0 -1
  884. package/dist/sharing/types.js.map +0 -1
  885. package/dist/steps.d.ts.map +0 -1
  886. package/dist/steps.js.map +0 -1
  887. package/dist/transfer/artifacts.d.ts.map +0 -1
  888. package/dist/transfer/artifacts.js.map +0 -1
  889. package/dist/transfer/batches.d.ts.map +0 -1
  890. package/dist/transfer/batches.js.map +0 -1
  891. package/dist/transfer/cargo-frame.d.ts +0 -42
  892. package/dist/transfer/cargo-frame.d.ts.map +0 -1
  893. package/dist/transfer/cargo-frame.js +0 -98
  894. package/dist/transfer/cargo-frame.js.map +0 -1
  895. package/dist/transfer/cargo.d.ts.map +0 -1
  896. package/dist/transfer/cargo.js.map +0 -1
  897. package/dist/transfer/download.d.ts.map +0 -1
  898. package/dist/transfer/download.js.map +0 -1
  899. package/dist/transfer/index.d.ts.map +0 -1
  900. package/dist/transfer/index.js.map +0 -1
  901. package/dist/transfer/parallel.d.ts.map +0 -1
  902. package/dist/transfer/parallel.js.map +0 -1
  903. package/dist/transfer/ranges.d.ts.map +0 -1
  904. package/dist/transfer/ranges.js.map +0 -1
  905. package/dist/transfer/refs.d.ts.map +0 -1
  906. package/dist/transfer/refs.js.map +0 -1
  907. package/dist/transfer/upload.d.ts.map +0 -1
  908. package/dist/transfer/upload.js.map +0 -1
  909. package/dist/watching/coverage.d.ts.map +0 -1
  910. package/dist/watching/coverage.js.map +0 -1
  911. package/dist/watching/index.d.ts.map +0 -1
  912. package/dist/watching/index.js.map +0 -1
  913. package/dist/watching/maintenance.d.ts.map +0 -1
  914. package/dist/watching/maintenance.js.map +0 -1
  915. package/dist/watching/suspicion.d.ts.map +0 -1
  916. package/dist/watching/suspicion.js.map +0 -1
  917. package/dist/workspace/api.d.ts.map +0 -1
  918. package/dist/workspace/api.js.map +0 -1
  919. package/dist/workspace/entries.d.ts.map +0 -1
  920. package/dist/workspace/entries.js.map +0 -1
  921. package/dist/workspace/identity.d.ts.map +0 -1
  922. package/dist/workspace/identity.js.map +0 -1
  923. package/dist/workspace/index.d.ts.map +0 -1
  924. package/dist/workspace/index.js.map +0 -1
  925. package/dist/workspace/registry.d.ts.map +0 -1
  926. package/dist/workspace/registry.js.map +0 -1
  927. package/dist/workspace/types.d.ts.map +0 -1
  928. package/dist/workspace/types.js.map +0 -1
  929. package/dist-cjs/apply/contracts.js.map +0 -1
  930. package/dist-cjs/apply/fetch-ahead.js.map +0 -1
  931. package/dist-cjs/apply/index.js.map +0 -1
  932. package/dist-cjs/apply/journey.js.map +0 -1
  933. package/dist-cjs/apply/lane.js.map +0 -1
  934. package/dist-cjs/apply/line.js.map +0 -1
  935. package/dist-cjs/apply/plans.js.map +0 -1
  936. package/dist-cjs/apply/rail.js.map +0 -1
  937. package/dist-cjs/apply/selection.js.map +0 -1
  938. package/dist-cjs/apply/settling.js.map +0 -1
  939. package/dist-cjs/apply/showing.js.map +0 -1
  940. package/dist-cjs/apply/type-adapters.js.map +0 -1
  941. package/dist-cjs/apply/window.js.map +0 -1
  942. package/dist-cjs/clash/bodmas.js.map +0 -1
  943. package/dist-cjs/clash/echo.js.map +0 -1
  944. package/dist-cjs/clash/index.js.map +0 -1
  945. package/dist-cjs/clash/local-work.js.map +0 -1
  946. package/dist-cjs/clash/resolution.js.map +0 -1
  947. package/dist-cjs/clash/tetris.js.map +0 -1
  948. package/dist-cjs/contracts/content.js.map +0 -1
  949. package/dist-cjs/contracts/index.js.map +0 -1
  950. package/dist-cjs/contracts/protection.js.map +0 -1
  951. package/dist-cjs/contracts/validate.js.map +0 -1
  952. package/dist-cjs/detection/adapter-contract.js.map +0 -1
  953. package/dist-cjs/detection/batch.js.map +0 -1
  954. package/dist-cjs/detection/classify.js.map +0 -1
  955. package/dist-cjs/detection/content.js.map +0 -1
  956. package/dist-cjs/detection/dispositions.js.map +0 -1
  957. package/dist-cjs/detection/echo.js.map +0 -1
  958. package/dist-cjs/detection/identity.js.map +0 -1
  959. package/dist-cjs/detection/ignore-lines.js.map +0 -1
  960. package/dist-cjs/detection/index.js.map +0 -1
  961. package/dist-cjs/detection/package-proposal.js.map +0 -1
  962. package/dist-cjs/detection/record-order.js.map +0 -1
  963. package/dist-cjs/detection/record-proposal.js.map +0 -1
  964. package/dist-cjs/detection/refusal.js.map +0 -1
  965. package/dist-cjs/detection/removals.js.map +0 -1
  966. package/dist-cjs/detection/scoped-identity.js.map +0 -1
  967. package/dist-cjs/detection/skip-defaults.js.map +0 -1
  968. package/dist-cjs/detection/skip-policy.js.map +0 -1
  969. package/dist-cjs/detection/watch-boundary.js.map +0 -1
  970. package/dist-cjs/drive/contracts.js.map +0 -1
  971. package/dist-cjs/drive/drive.js.map +0 -1
  972. package/dist-cjs/drive/held-removals.js.map +0 -1
  973. package/dist-cjs/drive/index.js.map +0 -1
  974. package/dist-cjs/drive/kept.js.map +0 -1
  975. package/dist-cjs/drive/listing.js.map +0 -1
  976. package/dist-cjs/drive/map-index.js.map +0 -1
  977. package/dist-cjs/drive/placements.js.map +0 -1
  978. package/dist-cjs/drive/records.js.map +0 -1
  979. package/dist-cjs/drive/where.js.map +0 -1
  980. package/dist-cjs/entities/accepted-view.js.map +0 -1
  981. package/dist-cjs/entities/bytes.js.map +0 -1
  982. package/dist-cjs/entities/cloud.js.map +0 -1
  983. package/dist-cjs/entities/graph-head.js.map +0 -1
  984. package/dist-cjs/entities/graph-pages.js.map +0 -1
  985. package/dist-cjs/entities/index.js.map +0 -1
  986. package/dist-cjs/entities/package-pages.js.map +0 -1
  987. package/dist-cjs/entities/placement-owed.js.map +0 -1
  988. package/dist-cjs/entities/reducer.js.map +0 -1
  989. package/dist-cjs/entities/registry-graph.js.map +0 -1
  990. package/dist-cjs/entities/rules.js.map +0 -1
  991. package/dist-cjs/entities/types.js.map +0 -1
  992. package/dist-cjs/entities/units.js.map +0 -1
  993. package/dist-cjs/faults/classify.js.map +0 -1
  994. package/dist-cjs/faults/index.js.map +0 -1
  995. package/dist-cjs/faults/need.js.map +0 -1
  996. package/dist-cjs/faults/recover.js.map +0 -1
  997. package/dist-cjs/faults/report.js.map +0 -1
  998. package/dist-cjs/faults/scrub.js.map +0 -1
  999. package/dist-cjs/faults/wire.js.map +0 -1
  1000. package/dist-cjs/files/accepted-files.js.map +0 -1
  1001. package/dist-cjs/files/api.js.map +0 -1
  1002. package/dist-cjs/files/browse-types.js.map +0 -1
  1003. package/dist-cjs/files/browser.js.map +0 -1
  1004. package/dist-cjs/files/cloud-files.js.map +0 -1
  1005. package/dist-cjs/files/commands.js.map +0 -1
  1006. package/dist-cjs/files/computer-address.js.map +0 -1
  1007. package/dist-cjs/files/index.js.map +0 -1
  1008. package/dist-cjs/files/local-files.js.map +0 -1
  1009. package/dist-cjs/files/media-type.js.map +0 -1
  1010. package/dist-cjs/files/own-folders.js.map +0 -1
  1011. package/dist-cjs/files/plans.js.map +0 -1
  1012. package/dist-cjs/files/trash.js.map +0 -1
  1013. package/dist-cjs/files/usage-categories.js.map +0 -1
  1014. package/dist-cjs/files/usage-chain.js.map +0 -1
  1015. package/dist-cjs/files/usage-effect.js.map +0 -1
  1016. package/dist-cjs/files/usage.js.map +0 -1
  1017. package/dist-cjs/git/alternates.js.map +0 -1
  1018. package/dist-cjs/git/artifact.js.map +0 -1
  1019. package/dist-cjs/git/chain.js.map +0 -1
  1020. package/dist-cjs/git/commands.js +0 -39
  1021. package/dist-cjs/git/commands.js.map +0 -1
  1022. package/dist-cjs/git/index.js.map +0 -1
  1023. package/dist-cjs/git/plan.js.map +0 -1
  1024. package/dist-cjs/git/play.js.map +0 -1
  1025. package/dist-cjs/git/refs.js.map +0 -1
  1026. package/dist-cjs/git/state.js.map +0 -1
  1027. package/dist-cjs/git/tag.js.map +0 -1
  1028. package/dist-cjs/git/text.js.map +0 -1
  1029. package/dist-cjs/git/turns.js.map +0 -1
  1030. package/dist-cjs/history/history.js.map +0 -1
  1031. package/dist-cjs/history/index.js.map +0 -1
  1032. package/dist-cjs/history/rule.js.map +0 -1
  1033. package/dist-cjs/history/types.js.map +0 -1
  1034. package/dist-cjs/history/version.js.map +0 -1
  1035. package/dist-cjs/index.js.map +0 -1
  1036. package/dist-cjs/records/authority.js.map +0 -1
  1037. package/dist-cjs/records/codec.js.map +0 -1
  1038. package/dist-cjs/records/contracts.js.map +0 -1
  1039. package/dist-cjs/records/inbox.js.map +0 -1
  1040. package/dist-cjs/records/index.js.map +0 -1
  1041. package/dist-cjs/records/intentional.js.map +0 -1
  1042. package/dist-cjs/records/outbox.js.map +0 -1
  1043. package/dist-cjs/records/owned-effects.js.map +0 -1
  1044. package/dist-cjs/records/publication.js.map +0 -1
  1045. package/dist-cjs/records/rail-ports.js.map +0 -1
  1046. package/dist-cjs/records/rail.js.map +0 -1
  1047. package/dist-cjs/records/receive-channel.js.map +0 -1
  1048. package/dist-cjs/records/receive-loop.js.map +0 -1
  1049. package/dist-cjs/records/receive-pages.js.map +0 -1
  1050. package/dist-cjs/records/retry-clock.js.map +0 -1
  1051. package/dist-cjs/records/send-batch.js.map +0 -1
  1052. package/dist-cjs/records/send-freeing.js.map +0 -1
  1053. package/dist-cjs/records/send-line.js.map +0 -1
  1054. package/dist-cjs/records/send-preparation.js.map +0 -1
  1055. package/dist-cjs/records/submit-frame.js.map +0 -1
  1056. package/dist-cjs/records/unsent-count.js.map +0 -1
  1057. package/dist-cjs/records/wire.js.map +0 -1
  1058. package/dist-cjs/registration/home-layout.js.map +0 -1
  1059. package/dist-cjs/registration/index.js.map +0 -1
  1060. package/dist-cjs/registration/user-ground.js.map +0 -1
  1061. package/dist-cjs/sharing/access.js.map +0 -1
  1062. package/dist-cjs/sharing/cli.js.map +0 -1
  1063. package/dist-cjs/sharing/command-input.js +0 -69
  1064. package/dist-cjs/sharing/command-input.js.map +0 -1
  1065. package/dist-cjs/sharing/commands.js.map +0 -1
  1066. package/dist-cjs/sharing/construct.js.map +0 -1
  1067. package/dist-cjs/sharing/download.js.map +0 -1
  1068. package/dist-cjs/sharing/entity.js.map +0 -1
  1069. package/dist-cjs/sharing/errors.js.map +0 -1
  1070. package/dist-cjs/sharing/grants.js.map +0 -1
  1071. package/dist-cjs/sharing/index.js.map +0 -1
  1072. package/dist-cjs/sharing/mcp.js.map +0 -1
  1073. package/dist-cjs/sharing/permissions.js.map +0 -1
  1074. package/dist-cjs/sharing/publish.js.map +0 -1
  1075. package/dist-cjs/sharing/share.js.map +0 -1
  1076. package/dist-cjs/sharing/sharing.js.map +0 -1
  1077. package/dist-cjs/sharing/types.js.map +0 -1
  1078. package/dist-cjs/steps.js.map +0 -1
  1079. package/dist-cjs/transfer/artifacts.js.map +0 -1
  1080. package/dist-cjs/transfer/batches.js.map +0 -1
  1081. package/dist-cjs/transfer/cargo-frame.js +0 -104
  1082. package/dist-cjs/transfer/cargo-frame.js.map +0 -1
  1083. package/dist-cjs/transfer/cargo.js.map +0 -1
  1084. package/dist-cjs/transfer/download.js.map +0 -1
  1085. package/dist-cjs/transfer/index.js.map +0 -1
  1086. package/dist-cjs/transfer/parallel.js.map +0 -1
  1087. package/dist-cjs/transfer/ranges.js.map +0 -1
  1088. package/dist-cjs/transfer/refs.js.map +0 -1
  1089. package/dist-cjs/transfer/upload.js.map +0 -1
  1090. package/dist-cjs/watching/coverage.js.map +0 -1
  1091. package/dist-cjs/watching/index.js.map +0 -1
  1092. package/dist-cjs/watching/maintenance.js.map +0 -1
  1093. package/dist-cjs/watching/suspicion.js.map +0 -1
  1094. package/dist-cjs/workspace/api.js.map +0 -1
  1095. package/dist-cjs/workspace/entries.js.map +0 -1
  1096. package/dist-cjs/workspace/identity.js.map +0 -1
  1097. package/dist-cjs/workspace/index.js.map +0 -1
  1098. package/dist-cjs/workspace/registry.js.map +0 -1
  1099. package/dist-cjs/workspace/types.js.map +0 -1
@@ -1,780 +1 @@
1
- "use strict";
2
- /** Event-driven Apply/Verify scheduling: one strict line per authority and
3
- * one fetch lane per unit being placed, each run one step at a time by its
4
- * own bounded pool. */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EntityApplyRail = exports.ENTITY_APPLY_QUIET_ATTEMPTS = exports.ENTITY_APPLY_RETRY_MAX_MS = exports.ENTITY_APPLY_RETRY_BASE_MS = exports.ENTITY_APPLY_DEFAULT_CONCURRENCY = void 0;
7
- const types_js_1 = require("../entities/types.js");
8
- const fetch_ahead_js_1 = require("./fetch-ahead.js");
9
- const journey_js_1 = require("./journey.js");
10
- const lane_js_1 = require("./lane.js");
11
- const line_js_1 = require("./line.js");
12
- const window_js_1 = require("./window.js");
13
- exports.ENTITY_APPLY_DEFAULT_CONCURRENCY = 8;
14
- exports.ENTITY_APPLY_RETRY_BASE_MS = 1_000;
15
- exports.ENTITY_APPLY_RETRY_MAX_MS = 30_000;
16
- /** Ground a person moves holds a line quietly while it settles; ground still
17
- * moving at this attempt is reported, so no line stalls unseen. */
18
- exports.ENTITY_APPLY_QUIET_ATTEMPTS = 8;
19
- /**
20
- * Each authority's received records change ground in delivery order. A line
21
- * reads its window (window.ts): an open one, else the fold of its unresolved
22
- * rows from its first, each member judged at its position (settling.ts). The
23
- * window runs its journey; its first member that cannot finish holds the
24
- * line until what it names changes, and nothing after it plays first. A head
25
- * that waits on a member behind it ends the window before that member
26
- * (`windowEndForWait`). While a line steps, the cargo of the records ahead of
27
- * it is fetched off the line (fetch-ahead.ts).
28
- *
29
- * One pool runs every line's steps, at most `concurrency` at once, in turn.
30
- * A line never runs two steps at once, and a fault holds only its own line.
31
- *
32
- * A fetch places one unit through its own lane (lane.ts), in a second pool
33
- * of `laneConcurrency` (by default `concurrency`), so no line step, settle
34
- * batch or held line head stands in front of it. A lane steps through the
35
- * same journey and the same park/backoff/wake clock as a line, and ends only
36
- * when its unit is placed, is nowhere, or its prerequisite failed. A lane whose unit is a root a held
37
- * reference leads to asks the host to enter it first (`enterRoot`).
38
- *
39
- * Apply has only two wake sources: Receive committed new Inbox work, or local
40
- * state changed in a way that may release a wait. A wake steps every line. A
41
- * held line runs again on its backoff, its head changing, newer local work,
42
- * its named producer, or, for a conflict, another line's progress. An idle
43
- * rail never polls.
44
- */
45
- class EntityApplyRail {
46
- #options;
47
- #concurrency;
48
- #laneConcurrency;
49
- #onBackgroundError;
50
- #onIdle;
51
- #journey;
52
- #fetchAhead;
53
- #started = false;
54
- #stopped = false;
55
- #lines = new Map();
56
- #lanes = new Map();
57
- #linePool = { queue: [], steps: new Set() };
58
- #lanePool = { queue: [], steps: new Set() };
59
- #rescan = false;
60
- #scan = null;
61
- #scanRetryAt = Infinity;
62
- #idle = [];
63
- #wakeVersion = 0;
64
- #dependencyWakes = new Map();
65
- #retry = null;
66
- constructor(options) {
67
- this.#options = options;
68
- this.#concurrency = options.concurrency ?? exports.ENTITY_APPLY_DEFAULT_CONCURRENCY;
69
- this.#laneConcurrency = options.laneConcurrency ?? this.#concurrency;
70
- this.#onBackgroundError = options.onBackgroundError ?? (() => undefined);
71
- this.#onIdle = options.onIdle ?? (() => undefined);
72
- for (const [name, size] of [['concurrency', this.#concurrency], ['lane concurrency', this.#laneConcurrency]]) {
73
- if (!Number.isSafeInteger(size) || size < 1)
74
- throw new Error(`entity Apply ${name} must be a positive integer`);
75
- }
76
- this.#journey = new journey_js_1.EntityApplyJourney(options, () => this.#wakeVersion, () => this.#stopped);
77
- this.#fetchAhead = new fetch_ahead_js_1.FetchAhead(options.cargo, { sha256Hex: options.sha256Hex, loops: options.loops });
78
- }
79
- /** Resume durable intents and then consume already-received Inbox work.
80
- * Every unit an earlier lifetime was placing gets its lane back first. */
81
- async start() {
82
- if (this.#started)
83
- throw new Error('entity Apply rail already started');
84
- if (this.#stopped)
85
- throw new Error('entity Apply rail is stopped');
86
- this.#started = true;
87
- const units = await this.#options.store.readOpenUnits();
88
- if (!Array.isArray(units) || new Set(units).size !== units.length || units.some(unit => !types_js_1.UUID_PATTERN.test(unit))) {
89
- throw new Error('entity Apply store returned an invalid open unit list');
90
- }
91
- for (const unit of units)
92
- this.#ensureLane(unit, null);
93
- await this.#untilIdle();
94
- }
95
- /**
96
- * Place one unit this computer lists at the newest version received now,
97
- * with every unit it needs placed first. It answers once: placed, nowhere,
98
- * or, when its chain makes no progress for `stall`, held naming the
99
- * deepest unit that chain waits on. Its chain moves when one of its lanes
100
- * commits a window, enters a root or places its unit, or when the host
101
- * says bytes moved for one (`progressed`); a fetch that keeps moving has
102
- * no total limit. A held lane keeps every obligation and goes on
103
- * placing.
104
- */
105
- fetch(unit, options) {
106
- if (!this.#started)
107
- return Promise.reject(new Error('entity Apply rail has not started'));
108
- if (this.#stopped)
109
- return Promise.reject(new Error('entity Apply rail is stopped'));
110
- if (!types_js_1.UUID_PATTERN.test(unit))
111
- return Promise.reject(new Error('entity Apply fetch needs a unit UUID'));
112
- if (!Number.isFinite(options.stall) || options.stall < 0) {
113
- return Promise.reject(new Error('entity Apply fetch needs a non-negative stall'));
114
- }
115
- if (options.emptied !== undefined && typeof options.emptied !== 'boolean') {
116
- return Promise.reject(new Error('entity Apply fetch emptied must be a boolean'));
117
- }
118
- return new Promise((resolve, reject) => {
119
- const lane = this.#ensureLane(unit, null, options.emptied === true);
120
- const arm = () => this.#options.schedule.schedule(options.stall, () => {
121
- if (!lane.waiters.delete(waiter))
122
- return;
123
- if (lane.emptied && ![...lane.waiters].some(other => other.emptied))
124
- lane.emptied = false;
125
- resolve(this.#heldAnswer(lane));
126
- });
127
- let timer = arm();
128
- const waiter = {
129
- emptied: options.emptied === true,
130
- answer: (answer) => { timer.cancel(); resolve(answer); },
131
- fail: (error) => { timer.cancel(); reject(error); },
132
- moved: () => { timer.cancel(); timer = arm(); },
133
- };
134
- lane.waiters.add(waiter);
135
- // A window whose prerequisite failed asks for it again.
136
- if (lane.waitsOn === null)
137
- this.#needsApplied(lane);
138
- this.#pump();
139
- });
140
- }
141
- /** The host moved `bytes` for the window placing `unit`: every byte pass
142
- * it makes there says so, its cargo landing, the reads that prove it, its
143
- * staged copy and its Verify. Every fetch whose chain waits on that lane
144
- * has moved; nothing sums the count. */
145
- progressed(unit, bytes) {
146
- if (!types_js_1.UUID_PATTERN.test(unit))
147
- throw new Error('entity Apply progress needs a unit UUID');
148
- if (!Number.isSafeInteger(bytes) || bytes < 0)
149
- throw new Error('entity Apply progress needs a byte count');
150
- if (bytes > 0 && !this.#stopped)
151
- this.#moved(unit);
152
- }
153
- /** Receive calls only after its Inbox transaction commits. */
154
- recordsAvailable() {
155
- this.#wake();
156
- }
157
- /** Record/Send or Detect calls after a local gate may have changed. Without
158
- * ids, anything may have changed, including what this computer shows. */
159
- localStateChanged(entityIds) {
160
- this.#release('detect', entityIds);
161
- this.#release('apply', entityIds);
162
- this.#wake();
163
- }
164
- /** Send sequenced these entities' local results. */
165
- sendAccepted(entityIds) {
166
- this.#release('send', entityIds);
167
- this.#wake();
168
- }
169
- /** The host re-examined a capability, for example after Git topology
170
- * changed or a workspace root returned. */
171
- capabilityChanged(entityIds) {
172
- this.#release('capability', entityIds);
173
- this.#wake();
174
- }
175
- /** Every line reads its window again. */
176
- #wake() {
177
- if (!this.#started || this.#stopped)
178
- return;
179
- this.#rescan = true;
180
- this.#pump();
181
- }
182
- /** Diagnostics are derived from the tracks, never a second wait registry. */
183
- waiting() {
184
- return this.#tracks().flatMap(track => (0, line_js_1.heldWait)(track.held) ?? []);
185
- }
186
- /**
187
- * Await work known at this boundary. It never creates an idle query loop,
188
- * and it never re-runs a held head: its wait is the rail's proof that
189
- * repeating the same attempt cannot help yet.
190
- */
191
- async flush() {
192
- if (!this.#started)
193
- throw new Error('entity Apply rail has not started');
194
- if (this.#stopped)
195
- return;
196
- await this.#untilIdle();
197
- }
198
- async stop() {
199
- if (this.#stopped)
200
- return;
201
- this.#stopped = true;
202
- this.#cancelRetry();
203
- for (const pool of [this.#linePool, this.#lanePool])
204
- for (const track of pool.queue.splice(0))
205
- track.queued = false;
206
- const stopped = new Error('entity Apply rail stopped before the fetch answered');
207
- for (const lane of this.#lanes.values())
208
- for (const waiter of lane.waiters)
209
- waiter.fail(stopped);
210
- this.#lanes.clear();
211
- while (this.#running() > 0 || this.#scan) {
212
- await Promise.allSettled([...this.#linePool.steps, ...this.#lanePool.steps, ...(this.#scan ? [this.#scan] : [])]);
213
- }
214
- await this.#fetchAhead.stop();
215
- for (const waiter of this.#idle.splice(0))
216
- waiter.resolve();
217
- }
218
- #untilIdle() {
219
- return new Promise((resolve, reject) => {
220
- this.#idle.push({ resolve, reject });
221
- this.#rescan = true;
222
- this.#pump();
223
- });
224
- }
225
- /** Start what can run now; settle waiters when nothing is left. */
226
- #pump() {
227
- if (this.#stopped)
228
- return;
229
- if (this.#rescan && this.#scan === null) {
230
- this.#rescan = false;
231
- const scan = this.#scanAuthorities();
232
- this.#scan = scan;
233
- void scan.then(() => {
234
- this.#scan = null;
235
- this.#pump();
236
- });
237
- }
238
- for (const [pool, size] of [[this.#lanePool, this.#laneConcurrency], [this.#linePool, this.#concurrency]]) {
239
- while (pool.steps.size < size && pool.queue.length > 0) {
240
- const track = pool.queue.shift();
241
- track.queued = false;
242
- this.#run(track, pool);
243
- }
244
- }
245
- if (this.#running() === 0 && this.#scan === null && !this.#rescan
246
- && this.#linePool.queue.length === 0 && this.#lanePool.queue.length === 0) {
247
- // Nothing is running, so no comparison can still need a release.
248
- this.#dependencyWakes.clear();
249
- // A wait whose time has come is work, not idleness.
250
- if (this.#elapse(this.#options.now())) {
251
- this.#pump();
252
- return;
253
- }
254
- this.#armRetry();
255
- for (const waiter of this.#idle.splice(0))
256
- waiter.resolve();
257
- this.#onIdle();
258
- }
259
- }
260
- #running() {
261
- return this.#linePool.steps.size + this.#lanePool.steps.size;
262
- }
263
- #tracks() {
264
- return [...this.#lines.values(), ...this.#lanes.values()];
265
- }
266
- /** The track still names its line or lane: an ended lane takes no step. */
267
- #current(track) {
268
- return track.kind === 'line' ? this.#lines.get(track.authorityId) === track : this.#lanes.get(track.unit) === track;
269
- }
270
- #enqueue(track) {
271
- if (this.#stopped)
272
- return;
273
- if (track.running) {
274
- track.again = true;
275
- return;
276
- }
277
- if (track.queued)
278
- return;
279
- track.queued = true;
280
- (track.kind === 'line' ? this.#linePool : this.#lanePool).queue.push(track);
281
- }
282
- /** One step, then the track goes to the back of its queue if it has more. */
283
- #run(track, pool) {
284
- track.running = true;
285
- track.again = false;
286
- const step = (track.kind === 'line' ? this.#lineStep(track) : this.#laneStep(track)).then((more) => {
287
- track.running = false;
288
- pool.steps.delete(step);
289
- if ((more || track.again) && this.#current(track)) {
290
- track.again = false;
291
- this.#enqueue(track);
292
- }
293
- this.#pump();
294
- });
295
- pool.steps.add(step);
296
- }
297
- /** Every authority with work gets a line, and every line takes a step. */
298
- async #scanAuthorities() {
299
- try {
300
- const authorities = await this.#options.store.readApplyAuthorities();
301
- if (!Array.isArray(authorities) || new Set(authorities).size !== authorities.length
302
- || authorities.some(id => typeof id !== 'string' || id.length === 0)) {
303
- throw new Error('entity Apply store returned an invalid authority list');
304
- }
305
- this.#scanRetryAt = Infinity;
306
- const present = new Set(authorities);
307
- for (const [authorityId, line] of this.#lines) {
308
- if (!present.has(authorityId) && !line.running && !line.queued)
309
- this.#lines.delete(authorityId);
310
- }
311
- for (const authorityId of authorities) {
312
- let line = this.#lines.get(authorityId);
313
- if (!line) {
314
- line = (0, line_js_1.createApplyLine)(authorityId);
315
- this.#lines.set(authorityId, line);
316
- }
317
- this.#enqueue(line);
318
- }
319
- }
320
- catch (error) {
321
- // Without the authority list no line can be stepped. Whoever awaits
322
- // this boundary learns of it; otherwise it is reported once.
323
- this.#scanRetryAt = this.#options.now() + exports.ENTITY_APPLY_RETRY_MAX_MS;
324
- const waiting = this.#idle.splice(0);
325
- if (waiting.length === 0)
326
- this.#report(error);
327
- for (const waiter of waiting)
328
- waiter.reject(error);
329
- }
330
- }
331
- /** One step of one line. It never throws: a fault holds only its line. */
332
- async #lineStep(line) {
333
- try {
334
- const held = line.held;
335
- if (held && held.entityId === null && !held.due && held.notBefore > this.#options.now())
336
- return false;
337
- const startedAt = this.#wakeVersion;
338
- const step = await this.#options.store.readApplyWindow(line.authorityId, line.endsBefore);
339
- (0, line_js_1.assertApplyLineStep)(line.authorityId, step);
340
- if (this.#stopped)
341
- return false;
342
- if (step.kind === 'end') {
343
- line.held = null;
344
- // Nothing is left before where its windows ended; the rows past it are still owed.
345
- const ended = line.endsBefore !== null;
346
- line.endsBefore = null;
347
- return ended;
348
- }
349
- // A window with no position has nothing to look ahead of.
350
- if (step.window.deliverySequence !== null)
351
- this.#fetchAhead.advance(line.authorityId, step.window.deliverySequence);
352
- return await this.#window(line, step.window, startedAt);
353
- }
354
- catch (error) {
355
- this.#fault(line, error);
356
- return false;
357
- }
358
- }
359
- /**
360
- * One step of one lane: its unit's window at the lane's position, or what
361
- * ends it. A prerequisite parks it on that unit's lane. It never throws: a
362
- * fault fails its waiters and holds only its lane.
363
- */
364
- async #laneStep(lane) {
365
- try {
366
- const held = lane.held;
367
- if (held && held.entityId === null && !held.due && held.notBefore > this.#options.now())
368
- return false;
369
- const startedAt = this.#wakeVersion;
370
- const step = await this.#options.store.readFetchWindow(lane.unit, lane.through);
371
- (0, lane_js_1.assertApplyLaneStep)(lane.unit, step);
372
- if (this.#stopped || !this.#current(lane))
373
- return false;
374
- if (lane.through !== null && step.through > lane.through)
375
- lane.met.clear();
376
- lane.through = Math.max(lane.through ?? 0, step.through);
377
- lane.waitsOn = null;
378
- // Only a window holds a window: the store answers an open one first.
379
- if (step.kind !== 'window')
380
- lane.held = null;
381
- switch (step.kind) {
382
- case 'end':
383
- this.#endLane(lane, { kind: 'placed' });
384
- return false;
385
- case 'nowhere':
386
- this.#endLane(lane, { kind: 'nowhere', reason: step.reason });
387
- return false;
388
- case 'root':
389
- return await this.#enterRoot(lane, step.through, step.reason);
390
- case 'prerequisite':
391
- return this.#awaitPrerequisite(lane, step.unit, step.reason, startedAt);
392
- case 'window':
393
- return await this.#window(lane, step.window, startedAt);
394
- }
395
- }
396
- catch (error) {
397
- this.#fault(lane, error);
398
- return false;
399
- }
400
- }
401
- /** The host enters the lane's root once at its position, then the lane
402
- * reads again; a root entered there and still not held fails the fetch. */
403
- async #enterRoot(lane, through, reason) {
404
- if (lane.met.has(lane.unit)) {
405
- this.#endLane(lane, { kind: 'held', unit: lane.unit, reason: `${lane.unit} entered and still not held: ${reason}` });
406
- return false;
407
- }
408
- await this.#options.effects.enterRoot(lane.unit, through);
409
- if (this.#stopped || !this.#current(lane))
410
- return false;
411
- if (lane.through === through)
412
- lane.met.add(lane.unit);
413
- this.#moved(lane.unit);
414
- return true;
415
- }
416
- /** A unit's lane, created at `through` or raised to it. A raised lane
417
- * reads again: its held window at the older cutoff is no longer the one
418
- * its dependent needs. */
419
- #ensureLane(unit, through, emptied = false) {
420
- let lane = this.#lanes.get(unit);
421
- if (!lane) {
422
- lane = (0, lane_js_1.createApplyLane)(unit, through, emptied);
423
- this.#lanes.set(unit, lane);
424
- this.#enqueue(lane);
425
- }
426
- else if (through !== null && (lane.through === null || lane.through < through)) {
427
- lane.through = through;
428
- lane.met.clear();
429
- this.#enqueue(lane);
430
- }
431
- return lane;
432
- }
433
- /**
434
- * The lane waits on `unit`'s lane, at least at its own position, until
435
- * that lane ends. A unit whose lane already placed it at this position
436
- * and is still needed can never be placed by its lane again, so the fetch
437
- * fails, naming it.
438
- */
439
- #awaitPrerequisite(lane, unit, reason, startedAt) {
440
- if (lane.met.has(unit)) {
441
- this.#endLane(lane, { kind: 'held', unit, reason: `${unit} placed and still needed: ${reason}` });
442
- return false;
443
- }
444
- if (!this.#needs(lane, unit, reason))
445
- return false;
446
- const dependency = { producer: 'apply', entityIds: [unit] };
447
- lane.held = {
448
- entityId: null,
449
- target: null,
450
- kept: null,
451
- cutoff: null,
452
- attempt: 1,
453
- notBefore: Infinity,
454
- releaseOnProgress: false,
455
- due: this.#dependencyChanged(dependency, startedAt),
456
- reason,
457
- dependency,
458
- };
459
- return lane.held.due;
460
- }
461
- /**
462
- * A lane whose window waits on another entity's Apply waits on that
463
- * entity's lane, a worktree on its home for one: only a lane places what
464
- * this computer does not show. A unit its lane already placed at this
465
- * position waits plainly, on the line's later rows.
466
- */
467
- #needsApplied(lane) {
468
- const held = lane.held;
469
- if (held?.dependency?.producer !== 'apply')
470
- return;
471
- for (const unit of held.dependency.entityIds) {
472
- if (unit !== lane.unit && !lane.met.has(unit) && !this.#needs(lane, unit, held.reason))
473
- return;
474
- }
475
- }
476
- /**
477
- * The lane waits on `unit`'s lane, raised to the lane's position. A chain
478
- * that comes back to this lane can never end, so every fetch in it fails,
479
- * naming the unit it waits on, and this answers false.
480
- */
481
- #needs(lane, unit, reason) {
482
- const chain = [lane];
483
- let next = this.#lanes.get(unit);
484
- while (next && next !== lane && !chain.includes(next)) {
485
- chain.push(next);
486
- next = next.waitsOn === null ? undefined : this.#lanes.get(next.waitsOn);
487
- }
488
- if (next === lane) {
489
- for (const member of chain) {
490
- this.#endLane(member, { kind: 'held', unit, reason: `prerequisite cycle through ${unit}: ${reason}` });
491
- }
492
- return false;
493
- }
494
- lane.waitsOn ??= unit;
495
- this.#enqueue(this.#ensureLane(unit, lane.through));
496
- return true;
497
- }
498
- /**
499
- * The lane's fetches are answered. A placed unit releases every lane
500
- * waiting on it; any other answer fails them, naming the unit that failed.
501
- * A lane ends unless it holds a window: that window keeps every
502
- * obligation it owns, and its lane goes on placing.
503
- */
504
- #endLane(lane, answer) {
505
- if (!this.#current(lane))
506
- return;
507
- for (const waiter of lane.waiters)
508
- waiter.answer(answer);
509
- lane.waiters.clear();
510
- lane.waitsOn = null;
511
- if (answer.kind === 'placed' || lane.held?.entityId == null)
512
- this.#lanes.delete(lane.unit);
513
- const failed = answer.kind === 'placed' || answer.kind === 'held' ? answer
514
- : { kind: 'held', unit: lane.unit, reason: `${lane.unit} is nowhere here: ${answer.reason}` };
515
- for (const dependent of [...this.#lanes.values()]) {
516
- if (dependent.waitsOn !== lane.unit)
517
- continue;
518
- if (answer.kind !== 'placed') {
519
- this.#endLane(dependent, failed);
520
- continue;
521
- }
522
- dependent.met.add(lane.unit);
523
- }
524
- if (answer.kind === 'placed') {
525
- this.#moved(lane.unit);
526
- this.#release('apply', [lane.unit]);
527
- }
528
- }
529
- /**
530
- * `unit`'s lane moved: the stall clock of every fetch whose chain reaches
531
- * it starts again. Each lane's chain is walked once across all lanes.
532
- */
533
- #moved(unit) {
534
- const reaches = new Map([[unit, true]]);
535
- for (const lane of this.#lanes.values()) {
536
- const path = new Set();
537
- let at = lane.unit;
538
- while (at !== null && !reaches.has(at) && !path.has(at)) {
539
- path.add(at);
540
- at = this.#lanes.get(at)?.waitsOn ?? null;
541
- }
542
- const result = at !== null && reaches.get(at) === true;
543
- for (const id of path)
544
- reaches.set(id, result);
545
- if (result)
546
- for (const waiter of lane.waiters)
547
- waiter.moved();
548
- }
549
- }
550
- /** What a fetch says when its stall clock runs out: the deepest lane its
551
- * chain waits on, and why that one has not finished. */
552
- #heldAnswer(lane) {
553
- let deepest = lane;
554
- const seen = new Set([lane]);
555
- for (let next = lane.waitsOn === null ? undefined : this.#lanes.get(lane.waitsOn); next && !seen.has(next); next = next.waitsOn === null ? undefined : this.#lanes.get(next.waitsOn)) {
556
- seen.add(next);
557
- deepest = next;
558
- }
559
- return { kind: 'held', unit: deepest.unit, reason: deepest.held?.reason ?? 'still placing' };
560
- }
561
- async #window(line, window, startedAt) {
562
- const first = window.members[0]?.work.entityId ?? null;
563
- // A different first member means the held one no longer heads the line.
564
- if (line.held && line.held.entityId !== null && line.held.entityId !== first)
565
- line.held = null;
566
- if (await this.#holds(line, window))
567
- return false;
568
- const outcome = await (0, journey_js_1.outcomeOf)(() => this.#journey.run(window, () => line.kind === 'lane' && line.emptied ? line.unit : null));
569
- if (outcome === 'progress')
570
- return this.#progress(line, window.members.map(member => member.work.entityId));
571
- if (outcome === 'again') {
572
- // A stale proof or a dropped member is not a wait: no backoff, and
573
- // nothing is released because nothing durable changed. The line goes
574
- // to the back of the queue, so every other line takes its turn before
575
- // this window proves again.
576
- if (line.held?.entityId === first)
577
- line.held = null;
578
- return true;
579
- }
580
- // An end that committed with its head still owed released what its
581
- // other members did; the head still waits.
582
- if (outcome.advanced?.length)
583
- this.#advanced(line, outcome.advanced);
584
- if (line.kind === 'line') {
585
- const end = (0, window_js_1.windowEndForWait)(window, outcome.dependency);
586
- if (end !== null) {
587
- line.endsBefore = end;
588
- return true;
589
- }
590
- }
591
- this.#park(line, window, outcome, startedAt);
592
- if (line.kind === 'lane')
593
- this.#needsApplied(line);
594
- return line.held.due;
595
- }
596
- /** A held window runs again only on the releases its hold names. */
597
- async #holds(line, window) {
598
- const held = line.held;
599
- const first = window.members[0];
600
- if (!held || first === undefined || held.entityId !== first.work.entityId)
601
- return false;
602
- if (held.due || held.notBefore <= this.#options.now())
603
- return false;
604
- if (this.#journey.targetOf(window) !== held.target || window.cutoff !== held.cutoff)
605
- return false;
606
- return await this.#options.store.localWorkAfter(window.authorityId, first.work.entityId, held.kept ?? held.target) === null;
607
- }
608
- /** Progress changed durable state and moved the track, so it reads its
609
- * window again. */
610
- #progress(line, entityIds) {
611
- if (line.held && (line.held.entityId === null || entityIds.includes(line.held.entityId)))
612
- line.held = null;
613
- this.#advanced(line, entityIds);
614
- return true;
615
- }
616
- /**
617
- * Durable state changed for `entityIds`, whether or not the track's head
618
- * moved. Every hold waiting on these entities, on any track, is due, and
619
- * another track's conflict may have moved. A lane's end can owe rows
620
- * again, so every line reads its window again too.
621
- */
622
- #advanced(line, entityIds) {
623
- if (line.kind === 'lane') {
624
- this.#rescan = true;
625
- this.#moved(line.unit);
626
- }
627
- this.#release('apply', entityIds);
628
- for (const other of this.#tracks()) {
629
- if (other !== line && other.held?.releaseOnProgress && !other.held.due) {
630
- other.held.due = true;
631
- this.#enqueue(other);
632
- }
633
- }
634
- }
635
- /**
636
- * The head holds its line while every other line goes on: a bound intent
637
- * keeps its ownership, and an attempt stays in memory. A wake the held
638
- * attempt caused itself, such as the Detect pass behind its own capture,
639
- * cannot re-run it.
640
- */
641
- #park(line, window, outcome, startedAt) {
642
- if (outcome.dependency)
643
- (0, line_js_1.assertApplyDependency)(outcome.dependency);
644
- if (outcome.blocker && !outcome.dependency) {
645
- throw new Error('Apply blocker must name the dependency that releases it');
646
- }
647
- const entityId = window.members[0].work.entityId;
648
- const previous = line.held;
649
- const attempt = (previous?.entityId === entityId ? previous.attempt : 0) + 1;
650
- const delay = this.#backoff(attempt);
651
- const held = {
652
- entityId,
653
- target: this.#journey.targetOf(window),
654
- kept: window.members[0].work.kept,
655
- cutoff: window.cutoff,
656
- attempt,
657
- notBefore: outcome.dependency ? Infinity : this.#options.now() + delay,
658
- releaseOnProgress: outcome.releaseOnProgress,
659
- due: outcome.dependency
660
- ? this.#dependencyChanged(outcome.dependency, outcome.comparedAt ?? startedAt) : false,
661
- reason: outcome.reason,
662
- ...(outcome.dependency ? { dependency: outcome.dependency } : {}),
663
- ...(outcome.blocker ? { blocker: outcome.blocker } : {}),
664
- };
665
- line.held = held;
666
- this.#armRetry();
667
- // A wait is reported when it appears or changes, never on each recheck.
668
- const before = (0, line_js_1.heldWait)(previous);
669
- const wait = (0, line_js_1.heldWait)(held);
670
- if (wait && JSON.stringify(wait) !== JSON.stringify(before))
671
- this.#options.onWaiting?.(wait);
672
- if (!outcome.report && attempt < exports.ENTITY_APPLY_QUIET_ATTEMPTS)
673
- return;
674
- this.#report(new Error(`${label(line)} holds at ${entityId}, which ${outcome.releaseOnProgress ? 'is parked on a conflict' : outcome.report ? 'failed' : 'stands on ground that keeps moving'}, and will retry in ${delay}ms (attempt ${attempt}): ${outcome.reason}`, outcome.cause === undefined ? undefined : { cause: outcome.cause }));
675
- }
676
- /** A store or settlement fault holds this track alone, under backoff. A
677
- * lane's waiters learn of it now; the lane goes on retrying. */
678
- #fault(line, error) {
679
- if (line.kind === 'lane') {
680
- for (const waiter of line.waiters)
681
- waiter.fail(error);
682
- line.waiters.clear();
683
- }
684
- const previous = line.held;
685
- const attempt = (previous?.entityId === null ? previous.attempt : 0) + 1;
686
- const delay = this.#backoff(attempt);
687
- const reason = error instanceof Error ? error.message : String(error);
688
- line.held = {
689
- entityId: null,
690
- target: null,
691
- kept: null,
692
- cutoff: null,
693
- attempt,
694
- notBefore: this.#options.now() + delay,
695
- releaseOnProgress: false,
696
- due: false,
697
- reason,
698
- };
699
- this.#armRetry();
700
- this.#report(new Error(`${label(line)} faulted and will retry in ${delay}ms (attempt ${attempt}): ${reason}`, { cause: error }));
701
- }
702
- #report(error) {
703
- try {
704
- this.#onBackgroundError(error);
705
- }
706
- catch {
707
- // A failing reporter cannot stop a line.
708
- }
709
- }
710
- #backoff(attempt) {
711
- const base = Math.min(exports.ENTITY_APPLY_RETRY_MAX_MS, exports.ENTITY_APPLY_RETRY_BASE_MS * (2 ** Math.min(attempt - 1, 16)));
712
- const random = Math.max(0, Math.min(1, this.#options.schedule.random()));
713
- return Math.round(base * (0.5 + random));
714
- }
715
- #release(producer, entityIds) {
716
- const revision = ++this.#wakeVersion;
717
- for (const id of entityIds ?? ['*'])
718
- this.#dependencyWakes.set(`${producer}:${id}`, revision);
719
- for (const track of this.#tracks()) {
720
- if ((0, line_js_1.releaseApplyLine)(track, producer, entityIds))
721
- this.#enqueue(track);
722
- }
723
- }
724
- #dependencyChanged(dependency, since) {
725
- return ['*', ...dependency.entityIds].some(id => (this.#dependencyWakes.get(`${dependency.producer}:${id}`) ?? 0) > since);
726
- }
727
- /**
728
- * One timer serves every held line and lane and a failed authority read:
729
- * it is armed for the earliest wait and, when it fires, steps every track
730
- * whose wait has elapsed. A wake of any other kind leaves the timer alone, so no
731
- * wake can shorten a backoff.
732
- */
733
- #armRetry() {
734
- if (this.#stopped)
735
- return;
736
- let earliest = this.#scanRetryAt;
737
- for (const track of this.#tracks()) {
738
- if (track.held && !track.held.due)
739
- earliest = Math.min(earliest, track.held.notBefore);
740
- }
741
- if (earliest === Infinity) {
742
- this.#cancelRetry();
743
- return;
744
- }
745
- if (this.#retry?.dueAt === earliest)
746
- return;
747
- this.#cancelRetry();
748
- const delay = Math.max(0, earliest - this.#options.now());
749
- const timer = this.#options.schedule.schedule(delay, () => {
750
- this.#retry = null;
751
- this.#elapse(earliest);
752
- this.#pump();
753
- });
754
- this.#retry = { dueAt: earliest, cancel: () => timer.cancel() };
755
- }
756
- /** Every wait whose time is at or before `at` is due. True when one was. */
757
- #elapse(at) {
758
- let elapsed = false;
759
- for (const track of this.#tracks()) {
760
- if (track.held && !track.held.due && track.held.notBefore <= at) {
761
- track.held.due = true;
762
- this.#enqueue(track);
763
- elapsed = true;
764
- }
765
- }
766
- if (this.#scanRetryAt <= at) {
767
- this.#scanRetryAt = Infinity;
768
- this.#rescan = true;
769
- elapsed = true;
770
- }
771
- return elapsed;
772
- }
773
- #cancelRetry() {
774
- this.#retry?.cancel();
775
- this.#retry = null;
776
- }
777
- }
778
- exports.EntityApplyRail = EntityApplyRail;
779
- const label = (track) => track.kind === 'line' ? `entity Apply line ${track.authorityId}` : `entity Apply fetch of ${track.unit}`;
780
- //# sourceMappingURL=rail.js.map
1
+ "use strict";var A=Object.defineProperty;var d=(o,e)=>A(o,"name",{value:e,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.EntityApplyRail=exports.ENTITY_APPLY_QUIET_ATTEMPTS=exports.ENTITY_APPLY_RETRY_MAX_MS=exports.ENTITY_APPLY_RETRY_BASE_MS=exports.ENTITY_APPLY_DEFAULT_CONCURRENCY=void 0;const c=require("../entities/types.js"),_=require("./fetch-ahead.js"),p=require("./journey.js"),y=require("./lane.js"),l=require("./line.js"),E=require("./window.js");exports.ENTITY_APPLY_DEFAULT_CONCURRENCY=8,exports.ENTITY_APPLY_RETRY_BASE_MS=1e3,exports.ENTITY_APPLY_RETRY_MAX_MS=3e4,exports.ENTITY_APPLY_QUIET_ATTEMPTS=8;class m{static{d(this,"EntityApplyRail")}#e;#w;#T;#O;#v;#g;#P;#f=!1;#t=!1;#a=new Map;#s=new Map;#d={queue:[],steps:new Set};#l={queue:[],steps:new Set};#r=!1;#n=null;#c=1/0;#A=[];#_=0;#k=new Map;#p=null;constructor(e){this.#e=e,this.#w=e.concurrency??exports.ENTITY_APPLY_DEFAULT_CONCURRENCY,this.#T=e.laneConcurrency??this.#w,this.#O=e.onBackgroundError??(()=>{}),this.#v=e.onIdle??(()=>{});for(const[t,s]of[["concurrency",this.#w],["lane concurrency",this.#T]])if(!Number.isSafeInteger(s)||s<1)throw new Error(`entity Apply ${t} must be a positive integer`);this.#g=new p.EntityApplyJourney(e,()=>this.#_,()=>this.#t),this.#P=new _.FetchAhead(e.cargo,{sha256Hex:e.sha256Hex,loops:e.loops})}async start(){if(this.#f)throw new Error("entity Apply rail already started");if(this.#t)throw new Error("entity Apply rail is stopped");this.#f=!0;const e=await this.#e.store.readOpenUnits();if(!Array.isArray(e)||new Set(e).size!==e.length||e.some(t=>!c.UUID_PATTERN.test(t)))throw new Error("entity Apply store returned an invalid open unit list");for(const t of e)this.#Y(t,null);await this.#N()}fetch(e,t){return this.#f?this.#t?Promise.reject(new Error("entity Apply rail is stopped")):c.UUID_PATTERN.test(e)?!Number.isFinite(t.stall)||t.stall<0?Promise.reject(new Error("entity Apply fetch needs a non-negative stall")):t.emptied!==void 0&&typeof t.emptied!="boolean"?Promise.reject(new Error("entity Apply fetch emptied must be a boolean")):new Promise((s,i)=>{const r=this.#Y(e,null,t.emptied===!0),n=d(()=>this.#e.schedule.schedule(t.stall,()=>{r.waiters.delete(u)&&(r.emptied&&![...r.waiters].some(a=>a.emptied)&&(r.emptied=!1),s(this.#Q(r)))}),"arm");let h=n();const u={emptied:t.emptied===!0,answer:d(a=>{h.cancel(),s(a)},"answer"),fail:d(a=>{h.cancel(),i(a)},"fail"),moved:d(()=>{h.cancel(),h=n()},"moved")};r.waiters.add(u),r.waitsOn===null&&this.#q(r),this.#h()}):Promise.reject(new Error("entity Apply fetch needs a unit UUID")):Promise.reject(new Error("entity Apply rail has not started"))}progressed(e,t){if(!c.UUID_PATTERN.test(e))throw new Error("entity Apply progress needs a unit UUID");if(!Number.isSafeInteger(t)||t<0)throw new Error("entity Apply progress needs a byte count");t>0&&!this.#t&&this.#I(e)}recordsAvailable(){this.#E()}localStateChanged(e){this.#u("detect",e),this.#u("apply",e),this.#E()}sendAccepted(e){this.#u("send",e),this.#E()}capabilityChanged(e){this.#u("capability",e),this.#E()}#E(){!this.#f||this.#t||(this.#r=!0,this.#h())}waiting(){return this.#y().flatMap(e=>(0,l.heldWait)(e.held)??[])}async flush(){if(!this.#f)throw new Error("entity Apply rail has not started");this.#t||await this.#N()}async stop(){if(this.#t)return;this.#t=!0,this.#M();for(const t of[this.#d,this.#l])for(const s of t.queue.splice(0))s.queued=!1;const e=new Error("entity Apply rail stopped before the fetch answered");for(const t of this.#s.values())for(const s of t.waiters)s.fail(e);for(this.#s.clear();this.#b()>0||this.#n;)await Promise.allSettled([...this.#d.steps,...this.#l.steps,...this.#n?[this.#n]:[]]);await this.#P.stop();for(const t of this.#A.splice(0))t.resolve()}#N(){return new Promise((e,t)=>{this.#A.push({resolve:e,reject:t}),this.#r=!0,this.#h()})}#h(){if(!this.#t){if(this.#r&&this.#n===null){this.#r=!1;const e=this.#x();this.#n=e,e.then(()=>{this.#n=null,this.#h()})}for(const[e,t]of[[this.#l,this.#T],[this.#d,this.#w]])for(;e.steps.size<t&&e.queue.length>0;){const s=e.queue.shift();s.queued=!1,this.#W(s,e)}if(this.#b()===0&&this.#n===null&&!this.#r&&this.#d.queue.length===0&&this.#l.queue.length===0){if(this.#k.clear(),this.#D(this.#e.now())){this.#h();return}this.#R();for(const e of this.#A.splice(0))e.resolve();this.#v()}}}#b(){return this.#d.steps.size+this.#l.steps.size}#y(){return[...this.#a.values(),...this.#s.values()]}#m(e){return e.kind==="line"?this.#a.get(e.authorityId)===e:this.#s.get(e.unit)===e}#i(e){if(!this.#t){if(e.running){e.again=!0;return}e.queued||(e.queued=!0,(e.kind==="line"?this.#d:this.#l).queue.push(e))}}#W(e,t){e.running=!0,e.again=!1;const s=(e.kind==="line"?this.#z(e):this.#F(e)).then(i=>{e.running=!1,t.steps.delete(s),(i||e.again)&&this.#m(e)&&(e.again=!1,this.#i(e)),this.#h()});t.steps.add(s)}async#x(){try{const e=await this.#e.store.readApplyAuthorities();if(!Array.isArray(e)||new Set(e).size!==e.length||e.some(s=>typeof s!="string"||s.length===0))throw new Error("entity Apply store returned an invalid authority list");this.#c=1/0;const t=new Set(e);for(const[s,i]of this.#a)!t.has(s)&&!i.running&&!i.queued&&this.#a.delete(s);for(const s of e){let i=this.#a.get(s);i||(i=(0,l.createApplyLine)(s),this.#a.set(s,i)),this.#i(i)}}catch(e){this.#c=this.#e.now()+exports.ENTITY_APPLY_RETRY_MAX_MS;const t=this.#A.splice(0);t.length===0&&this.#S(e);for(const s of t)s.reject(e)}}async#z(e){try{const t=e.held;if(t&&t.entityId===null&&!t.due&&t.notBefore>this.#e.now())return!1;const s=this.#_,i=await this.#e.store.readApplyWindow(e.authorityId,e.endsBefore);if((0,l.assertApplyLineStep)(e.authorityId,i),this.#t)return!1;if(i.kind==="end"){e.held=null;const r=e.endsBefore!==null;return e.endsBefore=null,r}return i.window.deliverySequence!==null&&this.#P.advance(e.authorityId,i.window.deliverySequence),await this.#L(e,i.window,s)}catch(t){return this.#B(e,t),!1}}async#F(e){try{const t=e.held;if(t&&t.entityId===null&&!t.due&&t.notBefore>this.#e.now())return!1;const s=this.#_,i=await this.#e.store.readFetchWindow(e.unit,e.through);if((0,y.assertApplyLaneStep)(e.unit,i),this.#t||!this.#m(e))return!1;switch(e.through!==null&&i.through>e.through&&e.met.clear(),e.through=Math.max(e.through??0,i.through),e.waitsOn=null,i.kind!=="window"&&(e.held=null),i.kind){case"end":return this.#o(e,{kind:"placed"}),!1;case"nowhere":return this.#o(e,{kind:"nowhere",reason:i.reason}),!1;case"root":return await this.#X(e,i.through,i.reason);case"prerequisite":return this.#J(e,i.unit,i.reason,s);case"window":return await this.#L(e,i.window,s)}}catch(t){return this.#B(e,t),!1}}async#X(e,t,s){return e.met.has(e.unit)?(this.#o(e,{kind:"held",unit:e.unit,reason:`${e.unit} entered and still not held: ${s}`}),!1):(await this.#e.effects.enterRoot(e.unit,t),this.#t||!this.#m(e)?!1:(e.through===t&&e.met.add(e.unit),this.#I(e.unit),!0))}#Y(e,t,s=!1){let i=this.#s.get(e);return i?t!==null&&(i.through===null||i.through<t)&&(i.through=t,i.met.clear(),this.#i(i)):(i=(0,y.createApplyLane)(e,t,s),this.#s.set(e,i),this.#i(i)),i}#J(e,t,s,i){if(e.met.has(t))return this.#o(e,{kind:"held",unit:t,reason:`${t} placed and still needed: ${s}`}),!1;if(!this.#$(e,t,s))return!1;const r={producer:"apply",entityIds:[t]};return e.held={entityId:null,target:null,kept:null,cutoff:null,attempt:1,notBefore:1/0,releaseOnProgress:!1,due:this.#C(r,i),reason:s,dependency:r},e.held.due}#q(e){const t=e.held;if(t?.dependency?.producer==="apply"){for(const s of t.dependency.entityIds)if(s!==e.unit&&!e.met.has(s)&&!this.#$(e,s,t.reason))return}}#$(e,t,s){const i=[e];let r=this.#s.get(t);for(;r&&r!==e&&!i.includes(r);)i.push(r),r=r.waitsOn===null?void 0:this.#s.get(r.waitsOn);if(r===e){for(const n of i)this.#o(n,{kind:"held",unit:t,reason:`prerequisite cycle through ${t}: ${s}`});return!1}return e.waitsOn??=t,this.#i(this.#Y(t,e.through)),!0}#o(e,t){if(!this.#m(e))return;for(const i of e.waiters)i.answer(t);e.waiters.clear(),e.waitsOn=null,(t.kind==="placed"||e.held?.entityId==null)&&this.#s.delete(e.unit);const s=t.kind==="placed"||t.kind==="held"?t:{kind:"held",unit:e.unit,reason:`${e.unit} is nowhere here: ${t.reason}`};for(const i of[...this.#s.values()])if(i.waitsOn===e.unit){if(t.kind!=="placed"){this.#o(i,s);continue}i.met.add(e.unit)}t.kind==="placed"&&(this.#I(e.unit),this.#u("apply",[e.unit]))}#I(e){const t=new Map([[e,!0]]);for(const s of this.#s.values()){const i=new Set;let r=s.unit;for(;r!==null&&!t.has(r)&&!i.has(r);)i.add(r),r=this.#s.get(r)?.waitsOn??null;const n=r!==null&&t.get(r)===!0;for(const h of i)t.set(h,n);if(n)for(const h of s.waiters)h.moved()}}#Q(e){let t=e;const s=new Set([e]);for(let i=e.waitsOn===null?void 0:this.#s.get(e.waitsOn);i&&!s.has(i);i=i.waitsOn===null?void 0:this.#s.get(i.waitsOn))s.add(i),t=i;return{kind:"held",unit:t.unit,reason:t.held?.reason??"still placing"}}async#L(e,t,s){const i=t.members[0]?.work.entityId??null;if(e.held&&e.held.entityId!==null&&e.held.entityId!==i&&(e.held=null),await this.#H(e,t))return!1;const r=await(0,p.outcomeOf)(()=>this.#g.run(t,()=>e.kind==="lane"&&e.emptied?e.unit:null));if(r==="progress")return this.#V(e,t.members.map(n=>n.work.entityId));if(r==="again")return e.held?.entityId===i&&(e.held=null),!0;if(r.advanced?.length&&this.#U(e,r.advanced),e.kind==="line"){const n=(0,E.windowEndForWait)(t,r.dependency);if(n!==null)return e.endsBefore=n,!0}return this.#G(e,t,r,s),e.kind==="lane"&&this.#q(e),e.held.due}async#H(e,t){const s=e.held,i=t.members[0];return!s||i===void 0||s.entityId!==i.work.entityId||s.due||s.notBefore<=this.#e.now()||this.#g.targetOf(t)!==s.target||t.cutoff!==s.cutoff?!1:await this.#e.store.localWorkAfter(t.authorityId,i.work.entityId,s.kept??s.target)===null}#V(e,t){return e.held&&(e.held.entityId===null||t.includes(e.held.entityId))&&(e.held=null),this.#U(e,t),!0}#U(e,t){e.kind==="lane"&&(this.#r=!0,this.#I(e.unit)),this.#u("apply",t);for(const s of this.#y())s!==e&&s.held?.releaseOnProgress&&!s.held.due&&(s.held.due=!0,this.#i(s))}#G(e,t,s,i){if(s.dependency&&(0,l.assertApplyDependency)(s.dependency),s.blocker&&!s.dependency)throw new Error("Apply blocker must name the dependency that releases it");const r=t.members[0].work.entityId,n=e.held,h=(n?.entityId===r?n.attempt:0)+1,u=this.#j(h),a={entityId:r,target:this.#g.targetOf(t),kept:t.members[0].work.kept,cutoff:t.cutoff,attempt:h,notBefore:s.dependency?1/0:this.#e.now()+u,releaseOnProgress:s.releaseOnProgress,due:s.dependency?this.#C(s.dependency,s.comparedAt??i):!1,reason:s.reason,...s.dependency?{dependency:s.dependency}:{},...s.blocker?{blocker:s.blocker}:{}};e.held=a,this.#R();const g=(0,l.heldWait)(n),f=(0,l.heldWait)(a);f&&JSON.stringify(f)!==JSON.stringify(g)&&this.#e.onWaiting?.(f),!(!s.report&&h<exports.ENTITY_APPLY_QUIET_ATTEMPTS)&&this.#S(new Error(`${w(e)} holds at ${r}, which ${s.releaseOnProgress?"is parked on a conflict":s.report?"failed":"stands on ground that keeps moving"}, and will retry in ${u}ms (attempt ${h}): ${s.reason}`,s.cause===void 0?void 0:{cause:s.cause}))}#B(e,t){if(e.kind==="lane"){for(const h of e.waiters)h.fail(t);e.waiters.clear()}const s=e.held,i=(s?.entityId===null?s.attempt:0)+1,r=this.#j(i),n=t instanceof Error?t.message:String(t);e.held={entityId:null,target:null,kept:null,cutoff:null,attempt:i,notBefore:this.#e.now()+r,releaseOnProgress:!1,due:!1,reason:n},this.#R(),this.#S(new Error(`${w(e)} faulted and will retry in ${r}ms (attempt ${i}): ${n}`,{cause:t}))}#S(e){try{this.#O(e)}catch{}}#j(e){const t=Math.min(exports.ENTITY_APPLY_RETRY_MAX_MS,exports.ENTITY_APPLY_RETRY_BASE_MS*2**Math.min(e-1,16)),s=Math.max(0,Math.min(1,this.#e.schedule.random()));return Math.round(t*(.5+s))}#u(e,t){const s=++this.#_;for(const i of t??["*"])this.#k.set(`${e}:${i}`,s);for(const i of this.#y())(0,l.releaseApplyLine)(i,e,t)&&this.#i(i)}#C(e,t){return["*",...e.entityIds].some(s=>(this.#k.get(`${e.producer}:${s}`)??0)>t)}#R(){if(this.#t)return;let e=this.#c;for(const i of this.#y())i.held&&!i.held.due&&(e=Math.min(e,i.held.notBefore));if(e===1/0){this.#M();return}if(this.#p?.dueAt===e)return;this.#M();const t=Math.max(0,e-this.#e.now()),s=this.#e.schedule.schedule(t,()=>{this.#p=null,this.#D(e),this.#h()});this.#p={dueAt:e,cancel:d(()=>s.cancel(),"cancel")}}#D(e){let t=!1;for(const s of this.#y())s.held&&!s.held.due&&s.held.notBefore<=e&&(s.held.due=!0,this.#i(s),t=!0);return this.#c<=e&&(this.#c=1/0,this.#r=!0,t=!0),t}#M(){this.#p?.cancel(),this.#p=null}}exports.EntityApplyRail=m;const w=d(o=>o.kind==="line"?`entity Apply line ${o.authorityId}`:`entity Apply fetch of ${o.unit}`,"label");