@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,248 +1 @@
1
- /**
2
- * Upload one already-captured immutable artifact.
3
- *
4
- * The source is seekable so the operation can first derive its manifest and
5
- * then reread only the chunks the authority reports missing. The manifest is
6
- * committed last; until then a partial upload is invisible.
7
- *
8
- * Content past one manifest uploads as its parts: one question names the
9
- * parts the authority has not sealed, each of those uploads exactly as
10
- * content of its own bytes would, and the list seals last, so a resumed
11
- * upload sends no part the authority already holds.
12
- */
13
- import { assertContentBytes, checkContentLayout, CONTENT_PART_BYTES, contentLayoutFrom, isContentParts, MAX_CONTENT_BLOCK_BYTES, chunkSizes, manifestFromChunks, partSizes, } from '../contracts/content.js';
14
- import { GRAPH_PAGE_BYTES } from '../entities/graph-pages.js';
15
- import { assertTransferArtifact } from './artifacts.js';
16
- import { planChunkBatches } from './batches.js';
17
- import { DEFAULT_TRANSFER_CONCURRENCY, parallelForEach } from './parallel.js';
18
- /** The seekable source no longer carries the captured artifact's exact bytes.
19
- * The bytes named by the content head cannot be produced from this source, so
20
- * the artifact must be recaptured from current ground — never resent as-is.
21
- * Hosts classify by `code` so the signal survives serialization boundaries. */
22
- export class UploadSourceMismatchError extends Error {
23
- code = 'UPLOAD_SOURCE_MISMATCH';
24
- }
25
- const planChunks = (sizes) => {
26
- let offset = 0;
27
- return sizes.map((size, index) => {
28
- const chunk = { index, offset, bytes: size };
29
- offset += size;
30
- return chunk;
31
- });
32
- };
33
- const fixedSizes = (totalBytes, partBytes) => {
34
- assertContentBytes(totalBytes);
35
- const sizes = [];
36
- for (let remaining = totalBytes; remaining > 0; remaining -= partBytes) {
37
- sizes.push(Math.min(remaining, partBytes));
38
- }
39
- return sizes;
40
- };
41
- /** Entity type selects semantic transfer framing. Files and construct
42
- * payloads use reusable Syncthing-style blocks. A link target is one literal
43
- * value. A Git artifact already carries its own native incremental pack,
44
- * so the outer wire only segments it at the maximum frame size instead of
45
- * re-chunking it as a file. This is the one layout a manifest commits to, so
46
- * a host rebuilding a lost manifest from retained bytes uses it too. */
47
- export const artifactBlockSizes = (artifact, totalBytes) => {
48
- switch (artifact.kind) {
49
- case 'file':
50
- case 'construct':
51
- return chunkSizes(totalBytes);
52
- case 'link':
53
- if (totalBytes > MAX_CONTENT_BLOCK_BYTES)
54
- throw new Error('link target exceeds the transfer frame bound');
55
- return totalBytes === 0 ? [] : [totalBytes];
56
- case 'page':
57
- // A graph page is at most one mebibyte and never empty: one block.
58
- if (totalBytes === 0 || totalBytes > GRAPH_PAGE_BYTES)
59
- throw new Error('a graph page must be one bounded block');
60
- return [totalBytes];
61
- case 'git':
62
- return fixedSizes(totalBytes, MAX_CONTENT_BLOCK_BYTES);
63
- }
64
- };
65
- /** The manifest an artifact's layout fixes without its bytes. An artifact of
66
- * at most one part is its own single block, so its content hash and size are
67
- * its whole manifest. Null when the layout has more parts: only the bytes, or
68
- * the manifest the read of them left, can answer. */
69
- export function layoutManifest(artifact, totalBytes) {
70
- const sizes = artifactBlockSizes(artifact, totalBytes);
71
- if (sizes.length > 1)
72
- return null;
73
- const checked = manifestFromChunks(artifact.contentHash, sizes.map((bytes) => ({ sha256: artifact.contentHash, bytes })));
74
- return checked.ok ? checked.value : null;
75
- }
76
- /** Derive the reusable upload evidence while capture already owns the bytes.
77
- * A host persists this beside its immutable artifact so upload never has to
78
- * rediscover block boundaries or reread the complete source just to prove the
79
- * work registration already completed. */
80
- export function deriveUploadManifest(artifact, bytes, sha256Hex) {
81
- assertTransferArtifact(artifact);
82
- if (sha256Hex(bytes) !== artifact.contentHash) {
83
- throw new UploadSourceMismatchError(`captured artifact does not match ${artifact.contentHash}`);
84
- }
85
- // A single part is the whole content, so its digest is the one just taken.
86
- const sizes = artifactBlockSizes(artifact, bytes.byteLength);
87
- const chunks = [];
88
- let offset = 0;
89
- for (const size of sizes) {
90
- const part = bytes.subarray(offset, offset + size);
91
- chunks.push({ sha256: sizes.length === 1 ? artifact.contentHash : sha256Hex(part), bytes: size });
92
- offset += size;
93
- }
94
- const checked = manifestFromChunks(artifact.contentHash, chunks);
95
- if (!checked.ok)
96
- throw new Error(checked.error);
97
- return checked.value;
98
- }
99
- const readExact = async (source, chunk) => {
100
- const bytes = await source.read(chunk.offset, chunk.bytes);
101
- if (!(bytes instanceof Uint8Array) || bytes.byteLength !== chunk.bytes) {
102
- throw new Error(`upload source returned the wrong byte count for chunk ${chunk.index}`);
103
- }
104
- return bytes;
105
- };
106
- const assertBatchChunks = (bytes, indexes, manifest, sha256Hex) => {
107
- let offset = 0;
108
- for (const index of indexes) {
109
- const expected = manifest.chunks[index];
110
- if (!expected)
111
- throw new Error(`content manifest has no chunk ${index}`);
112
- const chunk = bytes.subarray(offset, offset + expected.bytes);
113
- if (chunk.byteLength !== expected.bytes || sha256Hex(chunk) !== expected.sha256) {
114
- throw new UploadSourceMismatchError(`upload source changed while reading chunk ${index}`);
115
- }
116
- offset += expected.bytes;
117
- }
118
- if (offset !== bytes.byteLength)
119
- throw new Error('upload source returned the wrong byte count for a file batch');
120
- };
121
- /** The layout a source's cached index and part manifests state, refused
122
- * unless it is exactly the layout of this artifact's length. */
123
- const cachedLayout = (artifact, source) => {
124
- const expectedSizes = artifactBlockSizes(artifact, source.bytes);
125
- const cached = checkContentLayout(source.manifest, source.parts ?? [], artifact.contentHash);
126
- if (!cached.ok || cached.value.bytes !== source.bytes
127
- || cached.value.chunks.length !== expectedSizes.length
128
- || cached.value.chunks.some((chunk, index) => chunk.bytes !== expectedSizes[index])) {
129
- throw new Error('cached upload manifest is invalid');
130
- }
131
- return cached.value;
132
- };
133
- /** Read the whole source once, hashing it, each part and each block in the
134
- * same pass. A layout is only ever the reading of the bytes its content
135
- * hash names, so a source that changed is refused whatever the authority
136
- * already holds. */
137
- const readLayout = async (artifact, source, ports) => {
138
- const bounds = partSizes(source.bytes);
139
- const whole = ports.sha256Stream();
140
- const chunks = [];
141
- const partHashes = [];
142
- let part = bounds.length > 0 ? ports.sha256Stream() : null;
143
- let partLeft = bounds[0] ?? 0;
144
- for (const chunk of planChunks(artifactBlockSizes(artifact, source.bytes))) {
145
- const bytes = await readExact(source, chunk);
146
- whole.update(bytes);
147
- chunks.push({ sha256: ports.sha256Hex(bytes), bytes: chunk.bytes });
148
- if (part === null)
149
- continue;
150
- part.update(bytes);
151
- partLeft -= chunk.bytes;
152
- if (partLeft === 0) {
153
- partHashes.push(part.digest());
154
- partLeft = bounds[partHashes.length] ?? 0;
155
- part = partLeft > 0 ? ports.sha256Stream() : null;
156
- }
157
- }
158
- if (whole.digest() !== artifact.contentHash) {
159
- throw new UploadSourceMismatchError(`upload source does not match ${artifact.contentHash}`);
160
- }
161
- const checked = contentLayoutFrom(artifact.contentHash, chunks, partHashes);
162
- if (!checked.ok)
163
- throw new Error(checked.error);
164
- return checked.value;
165
- };
166
- /** Send one manifest's missing blocks, then seal it. */
167
- const sendManifest = async (artifact, source, manifest, ports, options) => {
168
- const plan = planChunks(manifest.chunks.map((chunk) => chunk.bytes));
169
- const reported = [...await ports.missingChunks(artifact, manifest)];
170
- if (new Set(reported).size !== reported.length
171
- || reported.some((index) => !Number.isSafeInteger(index) || index < 0 || index >= plan.length)) {
172
- throw new Error('upload authority returned invalid missing chunk indexes');
173
- }
174
- // A block is addressed by its digest, so a block the artifact repeats is
175
- // one block: it is put once, at its first missing index.
176
- const digests = new Set();
177
- const missing = reported.sort((left, right) => left - right).filter((index) => {
178
- const digest = manifest.chunks[index].sha256;
179
- if (digests.has(digest))
180
- return false;
181
- digests.add(digest);
182
- return true;
183
- });
184
- if ((artifact.kind === 'file' || artifact.kind === 'construct') && ports.putChunkBatch) {
185
- await parallelForEach(planChunkBatches(missing, manifest), options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY, async (batch) => {
186
- const bytes = await readExact(source, { index: batch.indexes[0], offset: batch.offset, bytes: batch.bytes });
187
- assertBatchChunks(bytes, batch.indexes, manifest, ports.sha256Hex);
188
- await ports.putChunkBatch(artifact, manifest, batch.indexes, bytes);
189
- });
190
- }
191
- else {
192
- await parallelForEach(missing, options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY, async (index) => {
193
- const chunk = plan[index];
194
- if (chunk === undefined)
195
- throw new Error('upload authority returned an unknown chunk index');
196
- const bytes = await readExact(source, chunk);
197
- if (ports.sha256Hex(bytes) !== manifest.chunks[index]?.sha256) {
198
- throw new UploadSourceMismatchError(`upload source changed while reading chunk ${index}`);
199
- }
200
- await ports.putChunk(artifact, manifest, index, bytes);
201
- });
202
- }
203
- await ports.putManifest(artifact, manifest);
204
- return missing.length;
205
- };
206
- /** Send the parts the authority has not sealed, each as content of its own
207
- * bytes, then seal the list. */
208
- const sendParts = async (artifact, source, layout, ports, options) => {
209
- const reported = [...await ports.missingParts(artifact, layout.index)];
210
- if (new Set(reported).size !== reported.length
211
- || reported.some((index) => !Number.isSafeInteger(index) || index < 0 || index >= layout.parts.length)) {
212
- throw new Error('upload authority returned invalid missing part indexes');
213
- }
214
- // A part is addressed by its hash, as a block is by its digest.
215
- const hashes = new Set();
216
- let uploaded = 0;
217
- for (const at of reported.sort((left, right) => left - right)) {
218
- const part = layout.parts[at];
219
- if (hashes.has(part.contentHash))
220
- continue;
221
- hashes.add(part.contentHash);
222
- const base = at * CONTENT_PART_BYTES;
223
- uploaded += await sendManifest({ ...artifact, contentHash: part.contentHash }, { bytes: part.bytes, read: (offset, bytes) => source.read(base + offset, bytes) }, part, ports, options);
224
- }
225
- await ports.putManifest(artifact, layout.index);
226
- return uploaded;
227
- };
228
- /** Upload one immutable artifact, sending only authority-declared gaps. */
229
- export async function upload(artifact, source, ports, options = {}) {
230
- assertTransferArtifact(artifact);
231
- if (!Number.isSafeInteger(source.bytes) || source.bytes < 0) {
232
- throw new Error('upload source byte count is invalid');
233
- }
234
- const layout = source.manifest !== undefined
235
- ? cachedLayout(artifact, source)
236
- : await readLayout(artifact, source, ports);
237
- const index = layout.index;
238
- const uploadedChunks = isContentParts(index)
239
- ? await sendParts(artifact, source, { ...layout, index }, ports, options)
240
- : await sendManifest(artifact, source, index, ports, options);
241
- return {
242
- artifact,
243
- layout,
244
- uploadedChunks,
245
- reusedChunks: layout.chunks.length - uploadedChunks,
246
- };
247
- }
248
- //# sourceMappingURL=upload.js.map
1
+ var x=Object.defineProperty;var d=(e,n)=>x(e,"name",{value:n,configurable:!0});import{assertContentBytes as H,checkContentLayout as v,CONTENT_PART_BYTES as L,contentLayoutFrom as T,isContentParts as _,MAX_CONTENT_BLOCK_BYTES as k,chunkSizes as z,manifestFromChunks as y,partSizes as A}from"../contracts/content.js";import{GRAPH_PAGE_BYTES as M}from"../entities/graph-pages.js";import{assertTransferArtifact as g}from"./artifacts.js";import{planChunkBatches as N}from"./batches.js";import{DEFAULT_TRANSFER_CONCURRENCY as b,parallelForEach as m}from"./parallel.js";class w extends Error{static{d(this,"UploadSourceMismatchError")}code="UPLOAD_SOURCE_MISMATCH"}const E=d(e=>{let n=0;return e.map((t,s)=>{const o={index:s,offset:n,bytes:t};return n+=t,o})},"planChunks"),P=d((e,n)=>{H(e);const t=[];for(let s=e;s>0;s-=n)t.push(Math.min(s,n));return t},"fixedSizes"),f=d((e,n)=>{switch(e.kind){case"file":case"construct":return z(n);case"link":if(n>k)throw new Error("link target exceeds the transfer frame bound");return n===0?[]:[n];case"page":if(n===0||n>M)throw new Error("a graph page must be one bounded block");return[n];case"git":return P(n,k)}},"artifactBlockSizes");function K(e,n){const t=f(e,n);if(t.length>1)return null;const s=y(e.contentHash,t.map(o=>({sha256:e.contentHash,bytes:o})));return s.ok?s.value:null}d(K,"layoutManifest");function X(e,n,t){if(g(e),t(n)!==e.contentHash)throw new w(`captured artifact does not match ${e.contentHash}`);const s=f(e,n.byteLength),o=[];let a=0;for(const u of s){const i=n.subarray(a,a+u);o.push({sha256:s.length===1?e.contentHash:t(i),bytes:u}),a+=u}const h=y(e.contentHash,o);if(!h.ok)throw new Error(h.error);return h.value}d(X,"deriveUploadManifest");const p=d(async(e,n)=>{const t=await e.read(n.offset,n.bytes);if(!(t instanceof Uint8Array)||t.byteLength!==n.bytes)throw new Error(`upload source returned the wrong byte count for chunk ${n.index}`);return t},"readExact"),R=d((e,n,t,s)=>{let o=0;for(const a of n){const h=t.chunks[a];if(!h)throw new Error(`content manifest has no chunk ${a}`);const u=e.subarray(o,o+h.bytes);if(u.byteLength!==h.bytes||s(u)!==h.sha256)throw new w(`upload source changed while reading chunk ${a}`);o+=h.bytes}if(o!==e.byteLength)throw new Error("upload source returned the wrong byte count for a file batch")},"assertBatchChunks"),U=d((e,n)=>{const t=f(e,n.bytes),s=v(n.manifest,n.parts??[],e.contentHash);if(!s.ok||s.value.bytes!==n.bytes||s.value.chunks.length!==t.length||s.value.chunks.some((o,a)=>o.bytes!==t[a]))throw new Error("cached upload manifest is invalid");return s.value},"cachedLayout"),O=d(async(e,n,t)=>{const s=A(n.bytes),o=t.sha256Stream(),a=[],h=[];let u=s.length>0?t.sha256Stream():null,i=s[0]??0;for(const c of E(f(e,n.bytes))){const l=await p(n,c);o.update(l),a.push({sha256:t.sha256Hex(l),bytes:c.bytes}),u!==null&&(u.update(l),i-=c.bytes,i===0&&(h.push(u.digest()),i=s[h.length]??0,u=i>0?t.sha256Stream():null))}if(o.digest()!==e.contentHash)throw new w(`upload source does not match ${e.contentHash}`);const r=T(e.contentHash,a,h);if(!r.ok)throw new Error(r.error);return r.value},"readLayout"),S=d(async(e,n,t,s,o)=>{const a=E(t.chunks.map(r=>r.bytes)),h=[...await s.missingChunks(e,t)];if(new Set(h).size!==h.length||h.some(r=>!Number.isSafeInteger(r)||r<0||r>=a.length))throw new Error("upload authority returned invalid missing chunk indexes");const u=new Set,i=h.sort((r,c)=>r-c).filter(r=>{const c=t.chunks[r].sha256;return u.has(c)?!1:(u.add(c),!0)});return(e.kind==="file"||e.kind==="construct")&&s.putChunkBatch?await m(N(i,t),o.concurrency??b,async r=>{const c=await p(n,{index:r.indexes[0],offset:r.offset,bytes:r.bytes});R(c,r.indexes,t,s.sha256Hex),await s.putChunkBatch(e,t,r.indexes,c)}):await m(i,o.concurrency??b,async r=>{const c=a[r];if(c===void 0)throw new Error("upload authority returned an unknown chunk index");const l=await p(n,c);if(s.sha256Hex(l)!==t.chunks[r]?.sha256)throw new w(`upload source changed while reading chunk ${r}`);await s.putChunk(e,t,r,l)}),await s.putManifest(e,t),i.length},"sendManifest"),$=d(async(e,n,t,s,o)=>{const a=[...await s.missingParts(e,t.index)];if(new Set(a).size!==a.length||a.some(i=>!Number.isSafeInteger(i)||i<0||i>=t.parts.length))throw new Error("upload authority returned invalid missing part indexes");const h=new Set;let u=0;for(const i of a.sort((r,c)=>r-c)){const r=t.parts[i];if(h.has(r.contentHash))continue;h.add(r.contentHash);const c=i*L;u+=await S({...e,contentHash:r.contentHash},{bytes:r.bytes,read:d((l,C)=>n.read(c+l,C),"read")},r,s,o)}return await s.putManifest(e,t.index),u},"sendParts");async function j(e,n,t,s={}){if(g(e),!Number.isSafeInteger(n.bytes)||n.bytes<0)throw new Error("upload source byte count is invalid");const o=n.manifest!==void 0?U(e,n):await O(e,n,t),a=o.index,h=_(a)?await $(e,n,{...o,index:a},t,s):await S(e,n,a,t,s);return{artifact:e,layout:o,uploadedChunks:h,reusedChunks:o.chunks.length-h}}d(j,"upload");export{w as UploadSourceMismatchError,f as artifactBlockSizes,X as deriveUploadManifest,K as layoutManifest,j as upload};
@@ -0,0 +1,8 @@
1
+ import type { Actor } from '../sharing/types.js';
2
+ import type { LocatedEntity, VersionPorts, VersionRole } from './ports.js';
3
+ import { type VersionService } from './services.js';
4
+ export interface Admitted {
5
+ readonly entity: LocatedEntity;
6
+ readonly role: VersionRole;
7
+ }
8
+ export declare function admit(ports: VersionPorts, service: VersionService, caller: Actor, item: string): Promise<Admitted>;
@@ -0,0 +1 @@
1
+ var w=Object.defineProperty;var t=(e,n)=>w(e,"name",{value:n,configurable:!0});import{VERSION_DEFINITIONS as h}from"../history/identity.js";import{VersionError as s}from"./errors.js";import{SERVICE_LABELS as k,SERVICE_TYPES as p}from"./services.js";const c={folder:"Folders keep no versions of their own. Ask for a file inside it.",workspace:"Workspaces keep no versions of their own. Ask for a file inside it.",reference:"Linked folders keep no versions of their own. Ask for a file inside it."};async function I(e,n,d,f){const r=t(()=>new s("not_found",`No item "${f}" in ${k[n]}.`),"notFound"),o=await e.locate(f);if(o===null)throw r();const{type:i,name:a}=o.row;if(!p[n].has(i))throw r();const l=await e.role(d,o);if(l===null)throw r();if(o.status==="deleted")throw new s("no_history",`${a} was deleted for good and keeps no versions.`);if(h[i]===null)throw new s("no_history",c[i]??`${a} keeps no versions.`);return{entity:o,role:l}}t(I,"admit");export{I as admit};
@@ -0,0 +1,3 @@
1
+ import type { VersionDoorHost } from './deliver.js';
2
+ export declare const VERSIONS_BODY_BYTES: number;
3
+ export declare function createVersionsApi(host: VersionDoorHost): (request: Request) => Promise<Response>;
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var i=(e,o)=>f(e,"name",{value:o,configurable:!0});import{commandDefinition as y,versionArgument as m}from"./commands.js";import{refusalOf as w,VERSION_ERROR_STATUS as h,VersionError as s}from"./errors.js";const u=16*1024;function T(e){const o=`/versions/${e.service}`;return async n=>{try{const{pathname:t,searchParams:r}=new URL(n.url);return t===`${o}/commands`&&n.method==="POST"?await p(e,n):t===`${o}/content`&&n.method==="GET"?await v(e,r):d(new s("not_found","There is no such version history route."))}catch(t){return t instanceof s?d(t):l(500,{error:w(t)})}}}i(T,"createVersionsApi");async function p(e,o){const n=await g(o),t=typeof n.call=="string"?n.call:"",r=await e.commands.execute(y(t).name,n.input??{});return l(200,{result:r})}i(p,"command");async function v(e,o){const n=await e.commands.execute("show",{item:o.get("item")??"",version:m(o.get("version")??"")});if(n.content.kind==="link")throw new s("invalid",`Version ${n.version.version} is a link to ${n.content.target}; it has no bytes.`);if(n.content.kind==="git")throw new s("invalid",`Version ${n.version.version} is Git's own state; it has no bytes to open.`);const t={"content-type":n.content.mediaType,"cache-control":"no-store","content-security-policy":"sandbox","x-content-type-options":"nosniff"};return n.content.bytes!==null&&(t["content-length"]=String(n.content.bytes)),new Response(await e.open(n),{status:200,headers:t})}i(v,"content");async function g(e){const o=new s("invalid",`A version history request must be under ${u/1024} KiB.`),n=[];let t=0;if(e.body!==null){const c=e.body.getReader();for(let a=await c.read();!a.done;a=await c.read()){if(t+=a.value.byteLength,t>u)throw await c.cancel(),o;n.push(a.value)}}let r;try{r=JSON.parse(new TextDecoder().decode(b(n,t)))}catch{r=null}if(r===null||typeof r!="object"||Array.isArray(r))throw new s("invalid",'Send a JSON object like {"call": "list", "input": {"item": "notes/essay.md"}}.');return r}i(g,"bodyJson");function b(e,o){const n=new Uint8Array(o);let t=0;for(const r of e)n.set(r,t),t+=r.byteLength;return n}i(b,"join");function d(e){return l(h[e.code],{error:{code:e.code,message:e.message}})}i(d,"refusal");function l(e,o){return new Response(JSON.stringify(o),{status:e,headers:{"content-type":"application/json","cache-control":"no-store"}})}i(l,"jsonValue");export{u as VERSIONS_BODY_BYTES,T as createVersionsApi};
@@ -0,0 +1,3 @@
1
+ import type { RestoreResult, VersionList } from './types.js';
2
+ export declare function listText(list: VersionList, timeZone: string): string;
3
+ export declare function restoreText(result: RestoreResult): string;
@@ -0,0 +1,5 @@
1
+ var d=Object.defineProperty;var o=(e,n)=>d(e,"name",{value:n,configurable:!0});import{groupByDay as g}from"./dates.js";function x(e,n){const t=e.versions.length,s=[`${e.item.name} ${t} ${t===1?"version":"versions"}`,""],h=Math.max(2,...e.versions.map(i=>String(i.version).length));for(const i of g(e.versions,n)){s.push(i.day);for(const r of i.versions){const a=[String(r.version).padStart(h),p(r.savedAt,n).padStart(8),v(r.bytes).padStart(8)];r.current&&a.push("current"),r.changed!==void 0&&a.push(m(r.changed)),s.push(` ${a.join(" ")}`.trimEnd())}}return e.complete||s.push("","Earlier versions may exist. This computer could not reach them."),`${s.join(`
2
+ `)}
3
+ `}o(x,"listText");function S(e){return e.restored?`Restored ${e.item.name} to version ${e.version}.
4
+ `:`${e.item.name} already has the content of version ${e.version}.
5
+ `}o(S,"restoreText");const f={refs:"branches moved",stash:"stash changed",staged:"staging changed",operation:"merge or rebase changed",settings:"settings changed"};function m(e){const n=e.map(t=>f[t]).join(", ");return n.charAt(0).toUpperCase()+n.slice(1)}o(m,"changedText");const c=new Map;function p(e,n){let t=c.get(n);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{timeZone:n,hour:"numeric",minute:"2-digit"}),c.set(n,t)),t.format(e).replace(/\s/gu," ")}o(p,"timeOfDay");const u=["KB","MB","GB","TB"];function v(e){if(e===null)return"";if(e<1024)return`${e} B`;let n=e/1024,t=0;for(;n>=1024&&t<u.length-1;)n/=1024,t+=1;return`${n.toFixed(1)} ${u[t]}`}o(v,"size");export{x as listText,S as restoreText};
@@ -0,0 +1,12 @@
1
+ import type { VersionTextHost } from './deliver.js';
2
+ export interface CliResult {
3
+ readonly exitCode: 0 | 1;
4
+ readonly stdout: string;
5
+ readonly stderr: string;
6
+ }
7
+ export interface VersionCliHost extends VersionTextHost {
8
+ resolvePath(text: string): string;
9
+ readonly timeZone: string;
10
+ }
11
+ export declare const CLI_USAGE = "amalgm files versions \u2014 earlier versions of a file, through the running Amalgm runtime\n\nUsage:\n amalgm files versions list <item> [--from DATE] [--to DATE] [--timeZone ZONE] [--json]\n amalgm files versions show <item> <version> [--save] [--json]\n amalgm files versions restore <item> <version> [--json]\n\n<item> is a path or an item's UUID. <version> is a number from list.\nDATE is a day (2026-11-12) or a time (2026-11-12T15:30:00-08:00).\nshow prints text; anything else is saved outside your Amalgm folder and its path is printed.\nrestore saves that version as the file's content again. Nothing is lost: the content\nit replaces stays in the list.\n";
12
+ export declare function runCli(argv: readonly string[], host: VersionCliHost): Promise<CliResult>;
@@ -0,0 +1,19 @@
1
+ var w=Object.defineProperty;var a=(e,n)=>w(e,"name",{value:n,configurable:!0});import{UUID_PATTERN as g}from"../entities/types.js";import{listText as v,restoreText as x}from"./cli-text.js";import{commandDefinition as $,versionArgument as y}from"./commands.js";import{deliver as T}from"./deliver.js";import{refusalOf as A,VersionError as f}from"./errors.js";const d=`amalgm files versions — earlier versions of a file, through the running Amalgm runtime
2
+
3
+ Usage:
4
+ amalgm files versions list <item> [--from DATE] [--to DATE] [--timeZone ZONE] [--json]
5
+ amalgm files versions show <item> <version> [--save] [--json]
6
+ amalgm files versions restore <item> <version> [--json]
7
+
8
+ <item> is a path or an item's UUID. <version> is a number from list.
9
+ DATE is a day (2026-11-12) or a time (2026-11-12T15:30:00-08:00).
10
+ show prints text; anything else is saved outside your Amalgm folder and its path is printed.
11
+ restore saves that version as the file's content again. Nothing is lost: the content
12
+ it replaces stays in the list.
13
+ `,E={list:["json"],show:["save","json"],restore:["json"]};async function b(e,n){const[i,...s]=e;if(i===void 0||i==="help"||i==="--help"||i==="-h")return{exitCode:0,stdout:d,stderr:""};const r=s.includes("--json");let t;try{t=C(i,s,n)}catch(o){return p(o,r,d)}try{return{exitCode:0,stdout:await U(t,n,r),stderr:""}}catch(o){return p(o,r,"")}}a(b,"runCli");async function U(e,n,i){const s=a(t=>`${JSON.stringify(t)}
14
+ `,"line"),{commands:r}=n;switch(e.name){case"list":{const t={timeZone:n.timeZone,...e.input},o=await r.execute("list",t);return i?s(o):v(o,t.timeZone)}case"show":{const t=await r.execute("show",e.input),o=await T(n,t,{save:e.switches.has("save")});return i?s({...t,delivered:o}):D(o)}case"restore":{const t=await r.execute("restore",e.input);return i?s(t):x(t)}}}a(U,"run");function C(e,n,i){const s=$(e),r=E[s.name],t={},o=new Set,m=[];for(let c=0;c<n.length;c+=1){const l=n[c];if(!l.startsWith("--")){m.push(l);continue}const u=l.slice(2);if(r.includes(u))o.add(u);else if(s.options.includes(u)){const h=n[++c];if(h===void 0)throw new f("invalid",`${l} needs a value.`);t[u]=h}else throw new f("invalid",`Unknown option for ${e}: ${l}`)}if(m.length>s.positional.length)throw new f("invalid",`Unexpected argument for ${e}: ${m[s.positional.length]}`);return m.forEach((c,l)=>{const u=s.positional[l];t[u]=u==="item"?j(c,i):y(c)}),{name:s.name,input:t,switches:o}}a(C,"parseCli");const j=a((e,n)=>g.test(e)?e:n.resolvePath(e),"itemArgument");function D(e){switch(e.kind){case"text":return e.text;case"file":return`${e.path}
15
+ `;case"link":return`${e.target}
16
+ `}}a(D,"deliveredText");function p(e,n,i){const s=A(e);return{exitCode:1,stdout:"",stderr:n?`${JSON.stringify({error:s})}
17
+ `:`${s.message}
18
+ ${i?`
19
+ ${i}`:""}`}}a(p,"refused");export{d as CLI_USAGE,b as runCli};
@@ -0,0 +1,31 @@
1
+ import type { FieldShape, JsonObjectSchema } from '../commands/input.js';
2
+ import type { CommandAnnotations } from '../commands/mcp.js';
3
+ import type { Actor } from '../sharing/types.js';
4
+ import type { RestoreResult, ShownVersion, VersionList } from './types.js';
5
+ import type { Versions } from './versions.js';
6
+ export type CommandName = 'list' | 'show' | 'restore';
7
+ export type VersionScope = 'versions:read' | 'versions:write';
8
+ export interface CommandResults {
9
+ readonly list: VersionList;
10
+ readonly show: ShownVersion;
11
+ readonly restore: RestoreResult;
12
+ }
13
+ export interface CommandDefinition {
14
+ readonly name: CommandName;
15
+ readonly scope: VersionScope;
16
+ readonly title: string;
17
+ readonly description: string;
18
+ readonly inputShape: FieldShape;
19
+ readonly positional: readonly string[];
20
+ readonly options: readonly string[];
21
+ readonly annotations: CommandAnnotations;
22
+ inputSchema(): JsonObjectSchema;
23
+ invoke(versions: Versions, caller: Actor, input: unknown): Promise<unknown>;
24
+ }
25
+ export interface Commands {
26
+ execute<N extends CommandName>(name: N, input?: unknown): Promise<CommandResults[N]>;
27
+ }
28
+ export declare const commandDefinitions: readonly CommandDefinition[];
29
+ export declare function commandDefinition(name: string): CommandDefinition;
30
+ export declare const versionArgument: (text: string) => unknown;
31
+ export declare function createCommands(versions: Versions, caller: Actor): Commands;
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var i=(e,t)=>f(e,"name",{value:t,configurable:!0});import{integer as p,jsonSchema as c,parseInput as v,string as r}from"../commands/input.js";import{VersionError as m}from"./errors.js";const s=r("A path or an item's UUID",!0),l=p("A version number from list",!0),d="a day like 2026-11-12 or a time like 2026-11-12T15:30:00-08:00",w=[a({name:"list",scope:"versions:read",title:"List versions",description:`List a file's earlier versions, newest first. Example: {"item": "notes/essay.md", "from": "2026-11-12"}. from and to keep the versions that were current at some moment between them.`,shape:{item:s,from:r(`The earliest moment: ${d}`),to:r(`The latest moment: ${d}`),timeZone:r("The time zone a day is read in, like America/Los_Angeles. Default: this computer's")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.list(t,n),"run")}),a({name:"show",scope:"versions:read",title:"Show a version",description:'Show one earlier version of a file without changing the file. Example: {"item": "notes/essay.md", "version": 3}.',shape:{item:s,version:l},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.show(t,n),"run")}),a({name:"restore",scope:"versions:write",title:"Restore a version",description:`Save an earlier version as the file's content again. Nothing is lost: the content it replaces stays in the list. Example: {"item": "notes/essay.md", "version": 3}.`,shape:{item:s,version:l},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.restore(t,n),"run")})];function y(e){const t=w.find(n=>n.name===e);if(t===void 0)throw new m("invalid",`Unknown command ${JSON.stringify(e)}. Use list, show or restore.`);return t}i(y,"commandDefinition");const x=i(e=>/^\d+$/.test(e)?Number(e):e,"versionArgument");function A(e,t){return{execute:i((n,o={})=>y(n).invoke(e,t,o),"execute")}}i(A,"createCommands");function a(e){const t=Object.keys(e.shape),n=t.filter(o=>e.shape[o].required);return{name:e.name,scope:e.scope,title:e.title,description:e.description,inputShape:e.shape,positional:n,options:t.filter(o=>!e.shape[o].required),annotations:e.annotations,inputSchema:i(()=>c(e.shape),"inputSchema"),invoke:i((o,h,u)=>e.run(o,h,H(e.shape,u)),"invoke")}}i(a,"define");function H(e,t){try{return v(e,t)}catch(n){throw new m("invalid",`${n.message}.`)}}i(H,"checked");export{y as commandDefinition,w as commandDefinitions,A as createCommands,x as versionArgument};
@@ -0,0 +1,4 @@
1
+ import type { VersionRun } from '../history/runs.js';
2
+ import type { LocatedEntity, VersionPorts } from './ports.js';
3
+ import type { VersionContent } from './types.js';
4
+ export declare function heldContent(ports: VersionPorts, entity: LocatedEntity, run: VersionRun, version: number): Promise<VersionContent>;
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var a=(r,n)=>c(r,"name",{value:n,configurable:!0});import{filesMediaType as f}from"../files/media-type.js";import{artifactForRecord as h}from"../transfer/artifacts.js";import{VersionError as s}from"./errors.js";async function u(r,n,l,o){const{row:e}=l.last;if(e.type==="link"){if(e.linkTarget===null)throw new Error(`version ${o} of ${n.entityId} is a link with no target`);return{kind:"link",target:e.linkTarget}}const t=h(e);if(t===null)throw new Error(`version ${o} of ${n.entityId} names no content`);const i=await r.hold(n,t);if(i==="gone")throw new s("gone",`Version ${o} of ${n.row.name} is no longer kept.`);if(i==="unreachable")throw new s("unavailable",`Version ${o} of ${n.row.name} is not on this computer and the cloud cannot be reached. Try again when this computer is online.`);return e.type==="repo.git"?{kind:"git",transportVersion:t.contentHash}:{kind:"bytes",contentHash:t.contentHash,bytes:e.size,mediaType:f(e.name)}}a(u,"heldContent");export{u as heldContent};
@@ -0,0 +1,15 @@
1
+ import type { ListedVersion } from './types.js';
2
+ export interface DateRange {
3
+ readonly from: number | null;
4
+ readonly to: number | null;
5
+ }
6
+ export declare function parseDateRange(input: {
7
+ readonly from?: string;
8
+ readonly to?: string;
9
+ }, timeZone: string): DateRange;
10
+ export declare function withinRange<V extends Pick<ListedVersion, 'savedAt' | 'replacedAt'>>(versions: readonly V[], range: DateRange, now: number): readonly V[];
11
+ export declare function dayOf(instant: number, timeZone: string): string;
12
+ export declare function groupByDay<V extends Pick<ListedVersion, 'savedAt'>>(versions: readonly V[], timeZone: string): readonly {
13
+ readonly day: string;
14
+ readonly versions: readonly V[];
15
+ }[];
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var a=(e,n)=>p(e,"name",{value:n,configurable:!0});import{VersionError as c}from"./errors.js";const D=/^(\d{4})-(\d{2})-(\d{2})$/,w=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})$/,d=864e5;function N(e,n){if(!A(n))throw new c("invalid","timeZone must be an IANA zone like America/Los_Angeles.");const r=e.from===void 0?null:m("from",e.from,n),t=e.to===void 0?null:m("to",e.to,n);if(r!==null&&t!==null&&r>=t)throw new c("invalid",`from ${e.from} is after to ${e.to}.`);return{from:r,to:t}}a(N,"parseDateRange");function S(e,n,r){return e.filter(t=>{const o=t.replacedAt??r,s=n.to===null||t.savedAt<n.to,u=n.from===null||t.savedAt>=n.from||o>n.from;return s&&u})}a(S,"withinRange");function l(e,n){const r=f(e,n);return`${i(r.year,4)}-${i(r.month,2)}-${i(r.day,2)}`}a(l,"dayOf");function C(e,n){const r=[];for(const t of e){const o=l(t.savedAt,n),s=r.at(-1);s!==void 0&&s.day===o?s.versions.push(t):r.push({day:o,versions:[t]})}return r}a(C,"groupByDay");function m(e,n,r){const t=D.exec(n);if(t!==null){const[o,s,u]=[Number(t[1]),Number(t[2]),Number(t[3])];if(g(o,s,u))return T(e==="from"?n:v(Date.UTC(o,s-1,u+1)),r)}else if(w.test(n)){const o=Date.parse(n);if(Number.isFinite(o))return e==="from"?o:o+1}throw new c("invalid",`${e} must be a day like 2026-11-12 or a time like 2026-11-12T15:30:00-08:00.`)}a(m,"bound");function T(e,n){const r=Date.parse(`${e}T00:00:00Z`),t=[r-d,r,r+d].map(o=>r-h(o,n)).filter(o=>l(o,n)===e);return t.length===0?r-h(r,n):Math.min(...t)}a(T,"startOfDay");function h(e,n){const r=Math.floor(e/1e3)*1e3,t=f(r,n);return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-r}a(h,"offsetAt");const y=new Map;function f(e,n){let r=y.get(n);r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),y.set(n,r));const t={};for(const o of r.formatToParts(e))o.type!=="literal"&&(t[o.type]=Number(o.value));return{year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second}}a(f,"partsOf");function A(e){try{return f(0,e),!0}catch{return!1}}a(A,"knownZone");function g(e,n,r){const t=new Date(Date.UTC(e,n-1,r));return t.getUTCFullYear()===e&&t.getUTCMonth()===n-1&&t.getUTCDate()===r}a(g,"realDay");const v=a(e=>new Date(e).toISOString().slice(0,10),"isoDay"),i=a((e,n)=>String(e).padStart(n,"0"),"pad");export{l as dayOf,C as groupByDay,N as parseDateRange,S as withinRange};
@@ -0,0 +1,25 @@
1
+ import type { Commands } from './commands.js';
2
+ import type { VersionService } from './services.js';
3
+ import type { ShownVersion } from './types.js';
4
+ export interface VersionDoorHost {
5
+ readonly service: VersionService;
6
+ readonly commands: Commands;
7
+ open(shown: ShownVersion): Promise<ReadableStream<Uint8Array>>;
8
+ }
9
+ export interface VersionTextHost extends VersionDoorHost {
10
+ scratch(name: string, body: ReadableStream<Uint8Array>): Promise<string>;
11
+ }
12
+ export declare const SHOW_INLINE_BYTES: number;
13
+ export type Delivered = {
14
+ readonly kind: 'text';
15
+ readonly text: string;
16
+ } | {
17
+ readonly kind: 'file';
18
+ readonly path: string;
19
+ } | {
20
+ readonly kind: 'link';
21
+ readonly target: string;
22
+ };
23
+ export declare function deliver(host: VersionTextHost, shown: ShownVersion, options: {
24
+ readonly save: boolean;
25
+ }): Promise<Delivered>;
@@ -0,0 +1,2 @@
1
+ var f=Object.defineProperty;var r=(t,e)=>f(t,"name",{value:e,configurable:!0});const g=262144,l=r(({item:t,version:e})=>`Version ${e.version} of ${t.name} is Git's own state: its branches, tags, stash, staged changes, unfinished merge or rebase, and settings. Restore puts them back and leaves the working files as they are.
2
+ `,"gitVersionText");async function h(t,e,c){const{content:n,version:a}=e;if(n.kind==="link")return{kind:"link",target:n.target};if(n.kind==="git")return{kind:"text",text:l(e)};const i=await t.open(e),u=n.bytes!==null&&n.bytes<=262144;if(c.save||a.type!=="file.text"||!u)return{kind:"file",path:await t.scratch(a.name,i)};const s=await new Response(i).arrayBuffer(),o=d(new Uint8Array(s));return o!==null?{kind:"text",text:o}:{kind:"file",path:await t.scratch(a.name,new Blob([s]).stream())}}r(h,"deliver");function d(t){try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{return null}}r(d,"utf8");export{g as SHOW_INLINE_BYTES,h as deliver};
@@ -0,0 +1,10 @@
1
+ export type VersionErrorCode = 'invalid' | 'not_found' | 'forbidden' | 'no_history' | 'cannot_restore' | 'gone' | 'unavailable';
2
+ export declare class VersionError extends Error {
3
+ readonly code: VersionErrorCode;
4
+ constructor(code: VersionErrorCode, message: string);
5
+ }
6
+ export declare const VERSION_ERROR_STATUS: Readonly<Record<VersionErrorCode, number>>;
7
+ export declare function refusalOf(error: unknown): {
8
+ readonly code: VersionErrorCode | 'failed';
9
+ readonly message: string;
10
+ };
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var s=(e,o)=>n(e,"name",{value:o,configurable:!0});class t extends Error{static{s(this,"VersionError")}code;constructor(o,r){super(r),this.name="VersionError",this.code=o}}const a=Object.freeze({invalid:400,not_found:404,forbidden:403,no_history:409,cannot_restore:409,gone:410,unavailable:503});function c(e){return e instanceof t?{code:e.code,message:e.message}:{code:"failed",message:"Version history request failed."}}s(c,"refusalOf");export{a as VERSION_ERROR_STATUS,t as VersionError,c as refusalOf};
@@ -0,0 +1,18 @@
1
+ export { createVersions } from './versions.js';
2
+ export type { Versions } from './versions.js';
3
+ export { VERSION_ERROR_STATUS, VersionError } from './errors.js';
4
+ export type { VersionErrorCode } from './errors.js';
5
+ export { SERVICE_LABELS, SERVICE_TYPES } from './services.js';
6
+ export type { VersionService } from './services.js';
7
+ export { dayOf, groupByDay, parseDateRange, withinRange } from './dates.js';
8
+ export type { DateRange } from './dates.js';
9
+ export { commandDefinition, commandDefinitions, createCommands } from './commands.js';
10
+ export type { CommandDefinition, CommandName, CommandResults, Commands, VersionScope } from './commands.js';
11
+ export { SHOW_INLINE_BYTES, deliver } from './deliver.js';
12
+ export type { Delivered, VersionDoorHost, VersionTextHost } from './deliver.js';
13
+ export { CLI_USAGE, runCli } from './cli.js';
14
+ export type { CliResult, VersionCliHost } from './cli.js';
15
+ export { createMcpTools } from './mcp.js';
16
+ export { VERSIONS_BODY_BYTES, createVersionsApi } from './api.js';
17
+ export type { Held, LocatedEntity, RestoreDoor, RestoreOutcome, RestoreSave, VersionLog, VersionPorts, VersionRole, } from './ports.js';
18
+ export type { ListInput, ListedVersion, RestoreResult, ShownVersion, VersionContent, VersionInput, VersionItem, VersionList, } from './types.js';
@@ -0,0 +1 @@
1
+ import{createVersions as e}from"./versions.js";import{VERSION_ERROR_STATUS as m,VersionError as i}from"./errors.js";import{SERVICE_LABELS as E,SERVICE_TYPES as a}from"./services.js";import{dayOf as S,groupByDay as f,parseDateRange as s,withinRange as x}from"./dates.js";import{commandDefinition as _,commandDefinitions as c,createCommands as I}from"./commands.js";import{SHOW_INLINE_BYTES as O,deliver as T}from"./deliver.js";import{CLI_USAGE as B,runCli as C}from"./cli.js";import{createMcpTools as A}from"./mcp.js";import{VERSIONS_BODY_BYTES as N,createVersionsApi as Y}from"./api.js";export{B as CLI_USAGE,E as SERVICE_LABELS,a as SERVICE_TYPES,O as SHOW_INLINE_BYTES,N as VERSIONS_BODY_BYTES,m as VERSION_ERROR_STATUS,i as VersionError,_ as commandDefinition,c as commandDefinitions,I as createCommands,A as createMcpTools,e as createVersions,Y as createVersionsApi,S as dayOf,T as deliver,f as groupByDay,s as parseDateRange,C as runCli,x as withinRange};
@@ -0,0 +1,8 @@
1
+ import type { Sha256Hex } from '../entities/types.js';
2
+ import type { LinePoint } from '../history/runs.js';
3
+ import type { LocatedEntity, VersionLog } from './ports.js';
4
+ export interface Line {
5
+ readonly points: readonly LinePoint[];
6
+ readonly complete: boolean;
7
+ }
8
+ export declare function readLine(log: VersionLog, entity: LocatedEntity, sha256Hex: Sha256Hex): Promise<Line>;
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var s=(e,n)=>h(e,"name",{value:n,configurable:!0});import{playChange as b}from"../clash/bodmas.js";import{assertRecord as g}from"../entities/cloud.js";import{canonicalVersion as y}from"../entities/rules.js";import{pageHolding as I,parseGraphPage as S}from"../entities/graph-pages.js";import{identityOf as v}from"../history/identity.js";import{VersionError as q}from"./errors.js";async function C(e,n,t){const{records:r,head:a}=await e.records(n);if((r.at(-1)?.globalSequence??0)!==a)return{points:[],complete:!1};const i=r.length===0?a===0:r[0].globalSequence===1,o=i&&r[0]?.change.facets.includes("create")===!0,c=i&&!o?await V(e,n,r,t)??await k(e,n,t):null,l=o||c!==null,u=l?r:r.slice(Math.max(0,r.findIndex(m)));if(!l&&!u.some(m))return{points:[],complete:l};const d=c===null?[]:[c];let f=c?.row??null;for(const p of u)f=b(f,p.change,t).row,f!==null&&d.push(w(p.globalSequence,p,f));return{points:await O(e,n,d),complete:l}}s(C,"readLine");async function O(e,n,t){const r=[...new Set(t.flatMap(({row:o})=>o.type==="repo.git"&&o.transportVersion!==null?[o.transportVersion]:[]))],a=r.length===0?new Map:await e.gitParts(n,r),i=s(o=>{const c=a.get(o);if(c===void 0)throw new q("unavailable",`The versions of ${n.row.name} cannot be read right now. Try again when this computer is online.`);return c},"gitParts");return t.map(o=>({...o,identity:v(o.row,i)}))}s(O,"identify");const m=s(e=>e.change.facets.some(n=>n==="create"||n==="content"||n==="retype"),"setsBytes"),w=s((e,n,t)=>({sequence:e,acceptedAt:n.acceptedAt,actorId:n.actorId,originDeviceId:n.originDeviceId,row:t}),"pointOf");async function V(e,n,t,r){const a=await e.origin(n);if(a===null)return null;const i=g(a.row),o=t.length===0?n.row.version:t[0].basedOnState;return y(i,r)===o?{...a,sequence:0,row:i}:null}s(V,"signInBirth");async function k(e,n,t){for await(const r of e.packages(n)){const{replay:a}=r.change;if(a.kind!=="package")continue;const i=await A(e,n,a.pages,t);if(i!==null)return w(0,r,i)}return null}s(k,"findBirth");async function A(e,n,t,r){const a=I(t,[n.row.parentUUID,n.entityId]),i=a<0?t:[t[a],...t.filter((o,c)=>c!==a)];for(const o of i){const c=await e.page(n,o);if(c===null)continue;const l=S(o,c,r).find(u=>u.uuid===n.entityId);if(l!==void 0)return g(l)}return null}s(A,"memberOf");export{C as readLine};
@@ -0,0 +1,5 @@
1
+ import type { Actor } from '../sharing/types.js';
2
+ import type { VersionPorts } from './ports.js';
3
+ import type { VersionService } from './services.js';
4
+ import type { ListInput, VersionList } from './types.js';
5
+ export declare function listVersions(ports: VersionPorts, service: VersionService, caller: Actor, input: ListInput): Promise<VersionList>;
@@ -0,0 +1 @@
1
+ var w=Object.defineProperty;var r=(e,t)=>w(e,"name",{value:t,configurable:!0});import{admit as d}from"./admit.js";import{parseDateRange as g,withinRange as l}from"./dates.js";import{itemOf as p,readVersions as v,toListed as y}from"./read.js";async function x(e,t,s,i){const m=g(i,i.timeZone??e.timeZone()),{entity:n}=await d(e,t,s,i.item),{runs:o,complete:a}=await v(e,n),c=o.map((R,f)=>y(o,f)).reverse();return{item:p(n),versions:l(c,m,e.now()),complete:a}}r(x,"listVersions");export{x as listVersions};
@@ -0,0 +1,3 @@
1
+ import type { McpTool } from '../commands/mcp.js';
2
+ import type { VersionTextHost } from './deliver.js';
3
+ export declare function createMcpTools(host: VersionTextHost): McpTool[];
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var n=(r,e)=>m(r,"name",{value:e,configurable:!0});import{mcpText as o}from"../commands/mcp.js";import{commandDefinitions as c}from"./commands.js";import{deliver as s}from"./deliver.js";import{refusalOf as u}from"./errors.js";function d(r){return c.map(e=>({name:`${r.service}_versions_${e.name}`,title:e.title,description:e.description,inputSchema:e.inputSchema(),annotations:e.annotations,async handler(t={}){try{return o(await i(r,e.name,t))}catch(a){return{...o(u(a).message),isError:!0}}}}))}n(d,"createMcpTools");async function i(r,e,t){if(e!=="show")return r.commands.execute(e,t);const a=await r.commands.execute("show",t);return{...a,delivered:await s(r,a,{save:!1})}}n(i,"result");export{d as createMcpTools};
@@ -0,0 +1,46 @@
1
+ import type { CloudEntityRecord } from '../entities/cloud.js';
2
+ import type { GraphPageRef } from '../entities/graph-pages.js';
3
+ import type { EntityStatus, EntityType, Sha256Hex } from '../entities/types.js';
4
+ import type { LinePoint } from '../history/runs.js';
5
+ import type { AcceptedEntityRecord } from '../records/contracts.js';
6
+ import type { Actor } from '../sharing/types.js';
7
+ import type { TransferArtifact } from '../transfer/artifacts.js';
8
+ import type { VersionContent } from './types.js';
9
+ export interface LocatedEntity {
10
+ readonly entityId: string;
11
+ readonly authorityId: string;
12
+ readonly row: CloudEntityRecord;
13
+ readonly status: EntityStatus;
14
+ }
15
+ export type VersionRole = 'owner' | 'editor' | 'viewer';
16
+ export interface VersionLog {
17
+ records(entity: LocatedEntity): Promise<{
18
+ readonly records: readonly AcceptedEntityRecord[];
19
+ readonly head: number;
20
+ }>;
21
+ origin(entity: LocatedEntity): Promise<Omit<LinePoint, 'sequence' | 'identity'> | null>;
22
+ packages(entity: LocatedEntity): AsyncIterable<AcceptedEntityRecord>;
23
+ page(entity: LocatedEntity, ref: GraphPageRef): Promise<Uint8Array | null>;
24
+ released(entity: LocatedEntity): Promise<number>;
25
+ gitParts(entity: LocatedEntity, transportVersions: readonly string[]): Promise<ReadonlyMap<string, string>>;
26
+ }
27
+ export type Held = 'held' | 'gone' | 'unreachable';
28
+ export interface RestoreSave {
29
+ readonly entity: LocatedEntity;
30
+ readonly content: VersionContent;
31
+ readonly mode: CloudEntityRecord['fileMode'];
32
+ }
33
+ export type RestoreOutcome = 'saved' | 'unchanged' | 'busy' | 'absent';
34
+ export interface RestoreDoor {
35
+ save(input: RestoreSave): Promise<RestoreOutcome>;
36
+ }
37
+ export interface VersionPorts {
38
+ readonly sha256Hex: Sha256Hex;
39
+ now(): number;
40
+ timeZone(): string;
41
+ locate(item: string): Promise<LocatedEntity | null>;
42
+ role(caller: Actor, entity: LocatedEntity): Promise<VersionRole | null>;
43
+ readonly log: VersionLog;
44
+ hold(entity: LocatedEntity, artifact: TransferArtifact): Promise<Held>;
45
+ door(type: EntityType): RestoreDoor | null;
46
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ import { type VersionRun } from '../history/runs.js';
2
+ import type { LocatedEntity, VersionPorts } from './ports.js';
3
+ import type { ListedVersion, VersionItem } from './types.js';
4
+ export interface ReadVersions {
5
+ readonly runs: readonly VersionRun[];
6
+ readonly complete: boolean;
7
+ readonly released: number;
8
+ }
9
+ export declare function readVersions(ports: VersionPorts, entity: LocatedEntity): Promise<ReadVersions>;
10
+ export declare function versionIndex(read: ReadVersions, version: number, name: string): number;
11
+ export declare function toListed(runs: readonly VersionRun[], index: number): ListedVersion;
12
+ export declare function itemOf(entity: LocatedEntity): VersionItem;
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var i=(e,n)=>d(e,"name",{value:n,configurable:!0});import{gitPartsChanged as l}from"../git/parts.js";import{foldRuns as f,runHolding as u}from"../history/runs.js";import{VersionError as a}from"./errors.js";import{readLine as p}from"./line.js";async function x(e,n){const t=await p(e.log,n,e.sha256Hex);if(t.points.length===0)throw new a("unavailable",`The versions of ${n.row.name} cannot be read right now. Try again when this computer is online.`);const o=await e.log.released(n);return{runs:f(t.points).filter(s=>o===0||s.last.sequence>o),complete:t.complete,released:o}}i(x,"readVersions");function I(e,n,t){const o=u(e.runs,n);if(o!==null)return e.runs.indexOf(o);if(e.released>0&&n<=e.released)throw new a("gone",`Version ${n} of ${t} is no longer kept.`);const r=e.runs[0]?.first.sequence;throw!e.complete&&r!==void 0&&n<r?new a("unavailable",`Version ${n} of ${t} cannot be read right now. Try again when this computer is online.`):new a("not_found",`${t} has no version ${n}.`)}i(I,"versionIndex");function $(e,n){const t=e[n],{row:o}=t.last,r={version:t.first.sequence,savedAt:t.first.acceptedAt,replacedAt:t.endedAt,current:t.endedAt===null,name:o.name,type:o.type,bytes:o.size,savedBy:{actorId:t.first.actorId,deviceId:t.first.originDeviceId}},s=e[n-1];return s?.last.row.type==="repo.git"&&o.type==="repo.git"?{...r,changed:l(c(s.identity),c(t.identity))}:r}i($,"toListed");const c=i(e=>e.slice(e.indexOf(":")+1),"partsOf");function b(e){const{name:n,type:t}=e.row;return{entityId:e.entityId,name:n,type:t,inTrash:e.status==="trashed"}}i(b,"itemOf");export{b as itemOf,x as readVersions,$ as toListed,I as versionIndex};
@@ -0,0 +1,5 @@
1
+ import type { Actor } from '../sharing/types.js';
2
+ import type { VersionPorts } from './ports.js';
3
+ import type { VersionService } from './services.js';
4
+ import type { RestoreResult, VersionInput } from './types.js';
5
+ export declare function restoreVersion(ports: VersionPorts, service: VersionService, caller: Actor, input: VersionInput): Promise<RestoreResult>;
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var i=(o,a)=>g(o,"name",{value:a,configurable:!0});import{artifactKindForType as u}from"../transfer/artifacts.js";import{admit as V}from"./admit.js";import{heldContent as T}from"./content.js";import{VersionError as l}from"./errors.js";import{itemOf as x,readVersions as _,versionIndex as k}from"./read.js";async function M(o,a,v,n){const{entity:t,role:$}=await V(o,a,v,n.item),{name:e,type:c}=t.row,r=i(p=>new l("cannot_restore",p),"cannot");if($==="viewer")throw new l("forbidden",`You can open ${e} but not change it.`);if(t.status==="trashed")throw r(`${e} is in Trash. Put it back, then restore.`);const m=await _(o,t),s=m.runs[k(m,n.version,e)],w=u(s.last.row.type),d=u(c);if(w!==d)throw r(`Version ${n.version} of ${e} was a ${w} and ${e} is a ${d} now.`);const f=o.door(c);if(f===null)throw r(`Restore is not available for ${e} on this computer.`);const y=await T(o,t,s,n.version),b=await f.save({entity:t,content:y,mode:s.last.row.fileMode}),h={item:x(t),version:s.first.sequence};switch(b){case"saved":return{restored:!0,...h};case"unchanged":return{restored:!1,reason:"already_current",...h};case"busy":throw r(`${e} has a change still being saved. Try again in a moment.`);case"absent":throw r(`${e} is not on this computer.`)}}i(M,"restoreVersion");export{M as restoreVersion};
@@ -0,0 +1,4 @@
1
+ import type { EntityType } from '../entities/types.js';
2
+ export type VersionService = 'files';
3
+ export declare const SERVICE_TYPES: Readonly<Record<VersionService, ReadonlySet<EntityType>>>;
4
+ export declare const SERVICE_LABELS: Readonly<Record<VersionService, string>>;
@@ -0,0 +1 @@
1
+ const e=Object.freeze({files:new Set(["workspace","folder","repo.git","file.text","file.binary","link","reference"])}),r=Object.freeze({files:"Files"});export{r as SERVICE_LABELS,e as SERVICE_TYPES};