@amalgm/shell 0.1.164-preview.36072132286 → 0.1.164-preview.36809057014

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 (475) hide show
  1. package/PURPOSE.md +642 -128
  2. package/README.md +10 -8
  3. package/dist/accepted-tail.d.ts +26 -0
  4. package/dist/accepted-tail.js +37 -0
  5. package/dist/accepted-tail.js.map +1 -0
  6. package/dist/agent-execution.d.ts +16 -1
  7. package/dist/agent-execution.js +13 -5
  8. package/dist/agent-execution.js.map +1 -1
  9. package/dist/apply-cleanup.d.ts +28 -0
  10. package/dist/apply-cleanup.js +166 -0
  11. package/dist/apply-cleanup.js.map +1 -0
  12. package/dist/apply-recovery.d.ts +47 -0
  13. package/dist/apply-recovery.js +99 -0
  14. package/dist/apply-recovery.js.map +1 -0
  15. package/dist/apply-rows.d.ts +72 -0
  16. package/dist/apply-rows.js +150 -0
  17. package/dist/apply-rows.js.map +1 -0
  18. package/dist/apply-saves.d.ts +85 -0
  19. package/dist/apply-saves.js +238 -0
  20. package/dist/apply-saves.js.map +1 -0
  21. package/dist/boot.js +2 -1
  22. package/dist/boot.js.map +1 -1
  23. package/dist/capture-work.d.ts +8 -0
  24. package/dist/capture-work.js +67 -0
  25. package/dist/capture-work.js.map +1 -0
  26. package/dist/cargo-group.d.ts +45 -0
  27. package/dist/cargo-group.js +88 -0
  28. package/dist/cargo-group.js.map +1 -0
  29. package/dist/channel-session.d.ts +4 -2
  30. package/dist/channel-session.js +4 -3
  31. package/dist/channel-session.js.map +1 -1
  32. package/dist/chat-composition.d.ts +2 -0
  33. package/dist/chat-composition.js +1 -0
  34. package/dist/chat-composition.js.map +1 -1
  35. package/dist/cli.js +20 -1
  36. package/dist/cli.js.map +1 -1
  37. package/dist/construct-apply-host.d.ts +4 -2
  38. package/dist/construct-apply-host.js +8 -3
  39. package/dist/construct-apply-host.js.map +1 -1
  40. package/dist/construct-door.js +1 -1
  41. package/dist/construct-door.js.map +1 -1
  42. package/dist/construct-ledger.d.ts +6 -1
  43. package/dist/construct-ledger.js +21 -33
  44. package/dist/construct-ledger.js.map +1 -1
  45. package/dist/content-cache-collection.d.ts +18 -0
  46. package/dist/content-cache-collection.js +99 -0
  47. package/dist/content-cache-collection.js.map +1 -0
  48. package/dist/content-cache-host.d.ts +83 -17
  49. package/dist/content-cache-host.js +335 -95
  50. package/dist/content-cache-host.js.map +1 -1
  51. package/dist/content-cache-namespace.d.ts +59 -0
  52. package/dist/content-cache-namespace.js +210 -0
  53. package/dist/content-cache-namespace.js.map +1 -0
  54. package/dist/content-cache-ownership.d.ts +13 -0
  55. package/dist/content-cache-ownership.js +75 -0
  56. package/dist/content-cache-ownership.js.map +1 -0
  57. package/dist/content-cache-retention.d.ts +23 -0
  58. package/dist/content-cache-retention.js +195 -0
  59. package/dist/content-cache-retention.js.map +1 -0
  60. package/dist/content-capture-pool.d.ts +287 -0
  61. package/dist/content-capture-pool.js +461 -0
  62. package/dist/content-capture-pool.js.map +1 -0
  63. package/dist/content-capture-worker.d.ts +8 -0
  64. package/dist/content-capture-worker.js +109 -0
  65. package/dist/content-capture-worker.js.map +1 -0
  66. package/dist/content-clock.d.ts +42 -0
  67. package/dist/content-clock.js +166 -0
  68. package/dist/content-clock.js.map +1 -0
  69. package/dist/content-direct.d.ts +2 -0
  70. package/dist/content-direct.js +12 -0
  71. package/dist/content-direct.js.map +1 -1
  72. package/dist/content-failure.d.ts +18 -0
  73. package/dist/content-failure.js +38 -0
  74. package/dist/content-failure.js.map +1 -0
  75. package/dist/content-stream-thread.d.ts +60 -0
  76. package/dist/content-stream-thread.js +95 -0
  77. package/dist/content-stream-thread.js.map +1 -0
  78. package/dist/content-stream-worker.d.ts +7 -0
  79. package/dist/content-stream-worker.js +52 -0
  80. package/dist/content-stream-worker.js.map +1 -0
  81. package/dist/declaration-absorption.d.ts +37 -0
  82. package/dist/declaration-absorption.js +119 -0
  83. package/dist/declaration-absorption.js.map +1 -0
  84. package/dist/declaration-chain.d.ts +36 -0
  85. package/dist/declaration-chain.js +96 -0
  86. package/dist/declaration-chain.js.map +1 -0
  87. package/dist/declaration-commit.d.ts +31 -0
  88. package/dist/declaration-commit.js +49 -0
  89. package/dist/declaration-commit.js.map +1 -0
  90. package/dist/declaration-hold.d.ts +22 -0
  91. package/dist/declaration-hold.js +24 -0
  92. package/dist/declaration-hold.js.map +1 -0
  93. package/dist/declaration-journal.d.ts +62 -0
  94. package/dist/declaration-journal.js +99 -0
  95. package/dist/declaration-journal.js.map +1 -0
  96. package/dist/declaration-save.d.ts +31 -0
  97. package/dist/declaration-save.js +134 -0
  98. package/dist/declaration-save.js.map +1 -0
  99. package/dist/detection/accepted-result.d.ts +19 -1
  100. package/dist/detection/accepted-result.js +36 -5
  101. package/dist/detection/accepted-result.js.map +1 -1
  102. package/dist/detection/admission-save.d.ts +55 -0
  103. package/dist/detection/admission-save.js +48 -0
  104. package/dist/detection/admission-save.js.map +1 -0
  105. package/dist/detection/admission-units.d.ts +66 -0
  106. package/dist/detection/admission-units.js +322 -0
  107. package/dist/detection/admission-units.js.map +1 -0
  108. package/dist/detection/alias-discovery.d.ts +12 -0
  109. package/dist/detection/alias-discovery.js +80 -0
  110. package/dist/detection/alias-discovery.js.map +1 -0
  111. package/dist/detection/alias-examination.d.ts +30 -0
  112. package/dist/detection/alias-examination.js +49 -0
  113. package/dist/detection/alias-examination.js.map +1 -0
  114. package/dist/detection/apply-ownership.d.ts +81 -0
  115. package/dist/detection/apply-ownership.js +232 -0
  116. package/dist/detection/apply-ownership.js.map +1 -0
  117. package/dist/detection/basis-advanced.d.ts +11 -0
  118. package/dist/detection/basis-advanced.js +26 -0
  119. package/dist/detection/basis-advanced.js.map +1 -0
  120. package/dist/detection/capture-outcome.d.ts +16 -0
  121. package/dist/detection/capture-outcome.js +92 -0
  122. package/dist/detection/capture-outcome.js.map +1 -0
  123. package/dist/detection/container-membership.d.ts +32 -0
  124. package/dist/detection/container-membership.js +49 -0
  125. package/dist/detection/container-membership.js.map +1 -0
  126. package/dist/detection/detect-cancelled.d.ts +6 -0
  127. package/dist/detection/detect-cancelled.js +10 -0
  128. package/dist/detection/detect-cancelled.js.map +1 -0
  129. package/dist/detection/directory-proof.d.ts +47 -0
  130. package/dist/detection/directory-proof.js +77 -0
  131. package/dist/detection/directory-proof.js.map +1 -0
  132. package/dist/detection/disposition-rows.d.ts +18 -0
  133. package/dist/detection/disposition-rows.js +29 -0
  134. package/dist/detection/disposition-rows.js.map +1 -0
  135. package/dist/detection/dispositions.d.ts +130 -0
  136. package/dist/detection/dispositions.js +248 -0
  137. package/dist/detection/dispositions.js.map +1 -0
  138. package/dist/detection/git-notice.d.ts +88 -0
  139. package/dist/detection/git-notice.js +444 -0
  140. package/dist/detection/git-notice.js.map +1 -0
  141. package/dist/detection/ground-proof.d.ts +130 -0
  142. package/dist/detection/ground-proof.js +274 -0
  143. package/dist/detection/ground-proof.js.map +1 -0
  144. package/dist/detection/ground-reader.d.ts +29 -0
  145. package/dist/detection/ground-reader.js +102 -0
  146. package/dist/detection/ground-reader.js.map +1 -0
  147. package/dist/detection/held-territory.d.ts +51 -0
  148. package/dist/detection/held-territory.js +205 -0
  149. package/dist/detection/held-territory.js.map +1 -0
  150. package/dist/detection/identity-discovery.d.ts +45 -0
  151. package/dist/detection/identity-discovery.js +287 -0
  152. package/dist/detection/identity-discovery.js.map +1 -0
  153. package/dist/detection/maintenance-sweep.d.ts +108 -0
  154. package/dist/detection/maintenance-sweep.js +325 -0
  155. package/dist/detection/maintenance-sweep.js.map +1 -0
  156. package/dist/detection/name-reach.d.ts +12 -0
  157. package/dist/detection/name-reach.js +28 -0
  158. package/dist/detection/name-reach.js.map +1 -0
  159. package/dist/detection/notebook-basis.d.ts +5 -7
  160. package/dist/detection/notebook-basis.js +6 -7
  161. package/dist/detection/notebook-basis.js.map +1 -1
  162. package/dist/detection/owed-selection.d.ts +51 -0
  163. package/dist/detection/owed-selection.js +169 -0
  164. package/dist/detection/owed-selection.js.map +1 -0
  165. package/dist/detection/portable.d.ts +34 -34
  166. package/dist/detection/portable.js +67 -93
  167. package/dist/detection/portable.js.map +1 -1
  168. package/dist/detection/reconciliation-coverage.d.ts +7 -0
  169. package/dist/detection/reconciliation-coverage.js +16 -0
  170. package/dist/detection/reconciliation-coverage.js.map +1 -0
  171. package/dist/detection/repository-publication.d.ts +20 -0
  172. package/dist/detection/repository-publication.js +79 -0
  173. package/dist/detection/repository-publication.js.map +1 -0
  174. package/dist/detection/repository-routes.d.ts +43 -0
  175. package/dist/detection/repository-routes.js +97 -0
  176. package/dist/detection/repository-routes.js.map +1 -0
  177. package/dist/detection/root-examination.d.ts +94 -0
  178. package/dist/detection/root-examination.js +523 -0
  179. package/dist/detection/root-examination.js.map +1 -0
  180. package/dist/detection/runtime.d.ts +131 -64
  181. package/dist/detection/runtime.js +808 -1103
  182. package/dist/detection/runtime.js.map +1 -1
  183. package/dist/detection/scoped-identity-port.d.ts +34 -0
  184. package/dist/detection/scoped-identity-port.js +81 -0
  185. package/dist/detection/scoped-identity-port.js.map +1 -0
  186. package/dist/detection/seal-law.d.ts +66 -0
  187. package/dist/detection/seal-law.js +116 -0
  188. package/dist/detection/seal-law.js.map +1 -0
  189. package/dist/detection/sharing-policy.d.ts +11 -0
  190. package/dist/detection/sharing-policy.js +32 -0
  191. package/dist/detection/sharing-policy.js.map +1 -0
  192. package/dist/detection/thread-database.d.ts +4 -0
  193. package/dist/detection/thread-database.js +30 -0
  194. package/dist/detection/thread-database.js.map +1 -0
  195. package/dist/detection/unreadable.d.ts +11 -0
  196. package/dist/detection/unreadable.js +9 -0
  197. package/dist/detection/unreadable.js.map +1 -0
  198. package/dist/detection/verified-content.d.ts +6 -0
  199. package/dist/detection/verified-content.js +12 -0
  200. package/dist/detection/verified-content.js.map +1 -0
  201. package/dist/detection/walk-law.d.ts +34 -0
  202. package/dist/detection/walk-law.js +55 -0
  203. package/dist/detection/walk-law.js.map +1 -0
  204. package/dist/development/fly-guest.js +2 -1
  205. package/dist/development/fly-guest.js.map +1 -1
  206. package/dist/entity-apply-host.d.ts +29 -13
  207. package/dist/entity-apply-host.js +1426 -461
  208. package/dist/entity-apply-host.js.map +1 -1
  209. package/dist/entity-apply-store.d.ts +77 -30
  210. package/dist/entity-apply-store.js +221 -516
  211. package/dist/entity-apply-store.js.map +1 -1
  212. package/dist/entity-record-observability.js +2 -0
  213. package/dist/entity-record-observability.js.map +1 -1
  214. package/dist/entity-record-saves.d.ts +20 -0
  215. package/dist/entity-record-saves.js +91 -0
  216. package/dist/entity-record-saves.js.map +1 -0
  217. package/dist/entity-record-store.d.ts +15 -7
  218. package/dist/entity-record-store.js +57 -117
  219. package/dist/entity-record-store.js.map +1 -1
  220. package/dist/files-register-host.d.ts +22 -3
  221. package/dist/files-register-host.js +70 -31
  222. package/dist/files-register-host.js.map +1 -1
  223. package/dist/filesystem.js +3 -2
  224. package/dist/filesystem.js.map +1 -1
  225. package/dist/git-binding.d.ts +65 -0
  226. package/dist/git-binding.js +220 -0
  227. package/dist/git-binding.js.map +1 -0
  228. package/dist/git-capture.d.ts +39 -0
  229. package/dist/git-capture.js +86 -0
  230. package/dist/git-capture.js.map +1 -0
  231. package/dist/git-card.d.ts +12 -0
  232. package/dist/git-card.js +123 -0
  233. package/dist/git-card.js.map +1 -0
  234. package/dist/git-checkpoint-construction.d.ts +41 -0
  235. package/dist/git-checkpoint-construction.js +96 -0
  236. package/dist/git-checkpoint-construction.js.map +1 -0
  237. package/dist/git-checkpoint-preparation.d.ts +37 -0
  238. package/dist/git-checkpoint-preparation.js +145 -0
  239. package/dist/git-checkpoint-preparation.js.map +1 -0
  240. package/dist/git-command.d.ts +61 -8
  241. package/dist/git-command.js +217 -63
  242. package/dist/git-command.js.map +1 -1
  243. package/dist/git-configuration.d.ts +40 -0
  244. package/dist/git-configuration.js +217 -0
  245. package/dist/git-configuration.js.map +1 -0
  246. package/dist/git-evidence.d.ts +61 -0
  247. package/dist/git-evidence.js +181 -0
  248. package/dist/git-evidence.js.map +1 -0
  249. package/dist/git-index-entries.d.ts +15 -0
  250. package/dist/git-index-entries.js +44 -0
  251. package/dist/git-index-entries.js.map +1 -0
  252. package/dist/git-index-format.d.ts +35 -0
  253. package/dist/git-index-format.js +293 -0
  254. package/dist/git-index-format.js.map +1 -0
  255. package/dist/git-index-witness.d.ts +33 -0
  256. package/dist/git-index-witness.js +69 -0
  257. package/dist/git-index-witness.js.map +1 -0
  258. package/dist/git-literal-host.d.ts +82 -0
  259. package/dist/git-literal-host.js +172 -0
  260. package/dist/git-literal-host.js.map +1 -0
  261. package/dist/git-literal-read.d.ts +88 -0
  262. package/dist/git-literal-read.js +170 -0
  263. package/dist/git-literal-read.js.map +1 -0
  264. package/dist/git-literal-replay.d.ts +33 -0
  265. package/dist/git-literal-replay.js +268 -0
  266. package/dist/git-literal-replay.js.map +1 -0
  267. package/dist/git-native-file.d.ts +42 -0
  268. package/dist/git-native-file.js +145 -0
  269. package/dist/git-native-file.js.map +1 -0
  270. package/dist/git-native-index.d.ts +21 -0
  271. package/dist/git-native-index.js +44 -0
  272. package/dist/git-native-index.js.map +1 -0
  273. package/dist/git-operation-host.d.ts +48 -0
  274. package/dist/git-operation-host.js +127 -0
  275. package/dist/git-operation-host.js.map +1 -0
  276. package/dist/git-private-index.d.ts +11 -0
  277. package/dist/git-private-index.js +42 -0
  278. package/dist/git-private-index.js.map +1 -0
  279. package/dist/git-private-repository.d.ts +4 -0
  280. package/dist/git-private-repository.js +69 -0
  281. package/dist/git-private-repository.js.map +1 -0
  282. package/dist/git-private-view.d.ts +39 -0
  283. package/dist/git-private-view.js +162 -0
  284. package/dist/git-private-view.js.map +1 -0
  285. package/dist/git-ref-store.d.ts +12 -0
  286. package/dist/git-ref-store.js +68 -0
  287. package/dist/git-ref-store.js.map +1 -0
  288. package/dist/git-registration-host.d.ts +20 -30
  289. package/dist/git-registration-host.js +86 -249
  290. package/dist/git-registration-host.js.map +1 -1
  291. package/dist/git-repository-host.d.ts +148 -22
  292. package/dist/git-repository-host.js +633 -650
  293. package/dist/git-repository-host.js.map +1 -1
  294. package/dist/git-worktree-host.d.ts +2 -0
  295. package/dist/git-worktree-host.js +16 -0
  296. package/dist/git-worktree-host.js.map +1 -0
  297. package/dist/graph-publication.d.ts +75 -0
  298. package/dist/graph-publication.js +203 -0
  299. package/dist/graph-publication.js.map +1 -0
  300. package/dist/ground-basis.d.ts +242 -0
  301. package/dist/ground-basis.js +1023 -0
  302. package/dist/ground-basis.js.map +1 -0
  303. package/dist/ground-checkpoint-worker.d.ts +1 -0
  304. package/dist/ground-checkpoint-worker.js +84 -0
  305. package/dist/ground-checkpoint-worker.js.map +1 -0
  306. package/dist/ground-checkpoints.d.ts +16 -0
  307. package/dist/ground-checkpoints.js +45 -0
  308. package/dist/ground-checkpoints.js.map +1 -0
  309. package/dist/ground-coordination.d.ts +107 -3
  310. package/dist/ground-coordination.js +249 -24
  311. package/dist/ground-coordination.js.map +1 -1
  312. package/dist/ground-database.d.ts +42 -0
  313. package/dist/ground-database.js +290 -0
  314. package/dist/ground-database.js.map +1 -0
  315. package/dist/ground-differences.d.ts +23 -0
  316. package/dist/ground-differences.js +47 -0
  317. package/dist/ground-differences.js.map +1 -0
  318. package/dist/ground-holders.d.ts +4 -0
  319. package/dist/ground-holders.js +15 -0
  320. package/dist/ground-holders.js.map +1 -0
  321. package/dist/ground-initialization-worker.d.ts +1 -0
  322. package/dist/ground-initialization-worker.js +20 -0
  323. package/dist/ground-initialization-worker.js.map +1 -0
  324. package/dist/ground-initialization.d.ts +35 -0
  325. package/dist/ground-initialization.js +102 -0
  326. package/dist/ground-initialization.js.map +1 -0
  327. package/dist/ground-install-saves.d.ts +63 -0
  328. package/dist/ground-install-saves.js +139 -0
  329. package/dist/ground-install-saves.js.map +1 -0
  330. package/dist/ground-inventory-schema.d.ts +18 -0
  331. package/dist/ground-inventory-schema.js +168 -0
  332. package/dist/ground-inventory-schema.js.map +1 -0
  333. package/dist/ground-profile.d.ts +7 -0
  334. package/dist/ground-profile.js +52 -0
  335. package/dist/ground-profile.js.map +1 -0
  336. package/dist/ground-root-index.d.ts +2 -1
  337. package/dist/ground-root-index.js +16 -14
  338. package/dist/ground-root-index.js.map +1 -1
  339. package/dist/ground-row.d.ts +62 -0
  340. package/dist/ground-row.js +70 -0
  341. package/dist/ground-row.js.map +1 -0
  342. package/dist/ground-save-ops.d.ts +44 -0
  343. package/dist/ground-save-ops.js +41 -0
  344. package/dist/ground-save-ops.js.map +1 -0
  345. package/dist/ground-saver-worker.d.ts +1 -0
  346. package/dist/ground-saver-worker.js +156 -0
  347. package/dist/ground-saver-worker.js.map +1 -0
  348. package/dist/ground-saver.d.ts +75 -0
  349. package/dist/ground-saver.js +216 -0
  350. package/dist/ground-saver.js.map +1 -0
  351. package/dist/ground-store.d.ts +84 -0
  352. package/dist/ground-store.js +473 -0
  353. package/dist/ground-store.js.map +1 -0
  354. package/dist/ground-territory.d.ts +130 -0
  355. package/dist/ground-territory.js +511 -0
  356. package/dist/ground-territory.js.map +1 -0
  357. package/dist/index.d.ts +1 -1
  358. package/dist/index.js.map +1 -1
  359. package/dist/installation/ownership.d.ts +0 -2
  360. package/dist/installation/ownership.js +3 -15
  361. package/dist/installation/ownership.js.map +1 -1
  362. package/dist/machine-host.d.ts +3 -2
  363. package/dist/machine-host.js +28 -16
  364. package/dist/machine-host.js.map +1 -1
  365. package/dist/materialized-graph.d.ts +7 -7
  366. package/dist/materialized-graph.js +11 -23
  367. package/dist/materialized-graph.js.map +1 -1
  368. package/dist/module-thread.d.ts +9 -0
  369. package/dist/module-thread.js +10 -0
  370. package/dist/module-thread.js.map +1 -0
  371. package/dist/native/fsevents-stream.node +0 -0
  372. package/dist/physical-path-witness.d.ts +64 -0
  373. package/dist/physical-path-witness.js +168 -0
  374. package/dist/physical-path-witness.js.map +1 -0
  375. package/dist/register-upload-fusion.d.ts +5 -4
  376. package/dist/register-upload-fusion.js +9 -6
  377. package/dist/register-upload-fusion.js.map +1 -1
  378. package/dist/registry-graph.d.ts +3 -2
  379. package/dist/registry-graph.js +9 -6
  380. package/dist/registry-graph.js.map +1 -1
  381. package/dist/registry-page-cache.d.ts +5 -2
  382. package/dist/registry-page-cache.js.map +1 -1
  383. package/dist/repository-identity-steps.d.ts +5 -0
  384. package/dist/repository-identity-steps.js +33 -0
  385. package/dist/repository-identity-steps.js.map +1 -0
  386. package/dist/runtime-node-flags.d.ts +10 -0
  387. package/dist/runtime-node-flags.js +11 -0
  388. package/dist/runtime-node-flags.js.map +1 -0
  389. package/dist/service/adapter.d.ts +1 -1
  390. package/dist/service/adapter.js +1 -1
  391. package/dist/service/adapter.js.map +1 -1
  392. package/dist/service/cli.js +16 -20
  393. package/dist/service/cli.js.map +1 -1
  394. package/dist/service/control.d.ts +2 -2
  395. package/dist/service/keepalive.d.ts +4 -11
  396. package/dist/service/keepalive.js +65 -118
  397. package/dist/service/keepalive.js.map +1 -1
  398. package/dist/service/policy.d.ts +36 -0
  399. package/dist/service/policy.js +25 -0
  400. package/dist/service/policy.js.map +1 -0
  401. package/dist/service/portable.d.ts +1 -1
  402. package/dist/service/portable.js +1 -1
  403. package/dist/service/portable.js.map +1 -1
  404. package/dist/service/recovery.d.ts +10 -9
  405. package/dist/service/recovery.js +29 -19
  406. package/dist/service/recovery.js.map +1 -1
  407. package/dist/service/windows-action.d.ts +5 -3
  408. package/dist/service/windows-action.js +6 -9
  409. package/dist/service/windows-action.js.map +1 -1
  410. package/dist/service/windows-task.js +5 -5
  411. package/dist/service/windows-task.js.map +1 -1
  412. package/dist/sharing-admission.d.ts +17 -0
  413. package/dist/sharing-admission.js +128 -0
  414. package/dist/sharing-admission.js.map +1 -0
  415. package/dist/snapshot-delivery-baseline.d.ts +12 -3
  416. package/dist/snapshot-delivery-baseline.js +41 -42
  417. package/dist/snapshot-delivery-baseline.js.map +1 -1
  418. package/dist/source-proof.d.ts +36 -0
  419. package/dist/source-proof.js +70 -0
  420. package/dist/source-proof.js.map +1 -0
  421. package/dist/source-signature.d.ts +56 -0
  422. package/dist/source-signature.js +56 -0
  423. package/dist/source-signature.js.map +1 -0
  424. package/dist/source-witness.d.ts +15 -0
  425. package/dist/source-witness.js +29 -0
  426. package/dist/source-witness.js.map +1 -0
  427. package/dist/sqlite-durability.d.ts +31 -0
  428. package/dist/sqlite-durability.js +28 -0
  429. package/dist/sqlite-durability.js.map +1 -0
  430. package/dist/sqlite.d.ts +8 -2
  431. package/dist/sqlite.js +27 -4
  432. package/dist/sqlite.js.map +1 -1
  433. package/dist/sync-address.d.ts +19 -0
  434. package/dist/sync-address.js +52 -0
  435. package/dist/sync-address.js.map +1 -0
  436. package/dist/sync-setting.d.ts +15 -0
  437. package/dist/sync-setting.js +13 -0
  438. package/dist/sync-setting.js.map +1 -1
  439. package/dist/turns.d.ts +42 -0
  440. package/dist/turns.js +112 -0
  441. package/dist/turns.js.map +1 -0
  442. package/dist/updates/bootstrap.d.ts +53 -7
  443. package/dist/updates/bootstrap.js +224 -137
  444. package/dist/updates/bootstrap.js.map +1 -1
  445. package/dist/updates/controller.d.ts +8 -0
  446. package/dist/updates/controller.js +27 -3
  447. package/dist/updates/controller.js.map +1 -1
  448. package/dist/updates/store.d.ts +3 -0
  449. package/dist/updates/store.js +12 -0
  450. package/dist/updates/store.js.map +1 -1
  451. package/dist/user-ground-host.d.ts +364 -69
  452. package/dist/user-ground-host.js +5231 -3366
  453. package/dist/user-ground-host.js.map +1 -1
  454. package/dist/watching/fsevents.d.ts +52 -1
  455. package/dist/watching/fsevents.js +60 -25
  456. package/dist/watching/fsevents.js.map +1 -1
  457. package/dist/watching/host.d.ts +129 -5
  458. package/dist/watching/host.js +433 -80
  459. package/dist/watching/host.js.map +1 -1
  460. package/dist/watching/index.d.ts +1 -1
  461. package/dist/wire-binary.d.ts +3 -2
  462. package/dist/wire-binary.js +10 -8
  463. package/dist/wire-binary.js.map +1 -1
  464. package/dist/wire-client.d.ts +3 -4
  465. package/dist/wire-client.js +18 -44
  466. package/dist/wire-client.js.map +1 -1
  467. package/dist/wire-outbox.d.ts +34 -0
  468. package/dist/wire-outbox.js +127 -0
  469. package/dist/wire-outbox.js.map +1 -0
  470. package/dist/workspace-host.d.ts +4 -0
  471. package/dist/workspace-host.js +12 -1
  472. package/dist/workspace-host.js.map +1 -1
  473. package/examinations/fixtures/private-wire-authority.js +133 -10
  474. package/npm-shrinkwrap.json +43 -56
  475. package/package.json +26 -13
@@ -10,6 +10,8 @@
10
10
  * The product owns what it runs; this ledger owns what the rails said. They
11
11
  * are different questions, and Apply asks the product, never this table.
12
12
  */
13
+ import { save } from "./ground-saver.js";
14
+ import { cachedStatement } from "./sqlite.js";
13
15
  const record = (row) => Object.freeze({
14
16
  uuid: row.uuid,
15
17
  type: row.type,
@@ -23,37 +25,31 @@ const record = (row) => Object.freeze({
23
25
  fileMode: null,
24
26
  transportVersion: null,
25
27
  });
28
+ /** The ledger's one write, run only by the ground file's saver thread. */
29
+ export function rememberConstruct(database, input) {
30
+ const { entity } = input;
31
+ cachedStatement(database, `
32
+ INSERT INTO constructs(uuid, type, name, status, version, payload_version, updated_at_ms)
33
+ VALUES(?, ?, ?, ?, ?, ?, ?)
34
+ ON CONFLICT(uuid) DO UPDATE SET
35
+ type = excluded.type,
36
+ name = excluded.name,
37
+ status = excluded.status,
38
+ version = excluded.version,
39
+ payload_version = excluded.payload_version,
40
+ updated_at_ms = excluded.updated_at_ms
41
+ `).run(entity.uuid, entity.type, entity.name, entity.status, entity.version, entity.payloadVersion, input.updatedAtMs);
42
+ }
26
43
  export class ConstructLedger {
44
+ #file;
27
45
  #read;
28
- #write;
29
46
  #now;
30
47
  constructor(database, now = Date.now) {
31
- database.exec(`
32
- CREATE TABLE IF NOT EXISTS constructs (
33
- uuid TEXT PRIMARY KEY,
34
- type TEXT NOT NULL,
35
- name TEXT NOT NULL,
36
- status TEXT NOT NULL,
37
- version TEXT NOT NULL,
38
- payload_version TEXT,
39
- updated_at_ms INTEGER NOT NULL
40
- )
41
- `);
48
+ this.#file = database.name;
42
49
  this.#read = database.prepare(`
43
50
  SELECT uuid, type, name, status, version, payload_version
44
51
  FROM constructs
45
52
  WHERE uuid = ?
46
- `);
47
- this.#write = database.prepare(`
48
- INSERT INTO constructs(uuid, type, name, status, version, payload_version, updated_at_ms)
49
- VALUES(@uuid, @type, @name, @status, @version, @payloadVersion, @updatedAtMs)
50
- ON CONFLICT(uuid) DO UPDATE SET
51
- type = excluded.type,
52
- name = excluded.name,
53
- status = excluded.status,
54
- version = excluded.version,
55
- payload_version = excluded.payload_version,
56
- updated_at_ms = excluded.updated_at_ms
57
53
  `);
58
54
  this.#now = now;
59
55
  }
@@ -71,16 +67,8 @@ export class ConstructLedger {
71
67
  return this.record(uuid)?.status === "active";
72
68
  }
73
69
  /** Remember one record, whether this computer recorded it or received it. */
74
- remember(entity) {
75
- this.#write.run({
76
- uuid: entity.uuid,
77
- type: entity.type,
78
- name: entity.name,
79
- status: entity.status,
80
- version: entity.version,
81
- payloadVersion: entity.payloadVersion,
82
- updatedAtMs: this.#now(),
83
- });
70
+ async remember(entity) {
71
+ await save(this.#file, "constructs.remember", { entity, updatedAtMs: this.#now() });
84
72
  }
85
73
  }
86
74
  //# sourceMappingURL=construct-ledger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"construct-ledger.js","sourceRoot":"","sources":["../src/construct-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH,MAAM,MAAM,GAAG,CAAC,GAAiB,EAAqB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,GAAG,CAAC,IAAI;IACd,IAAI,EAAE,GAAG,CAAC,IAAiC;IAC3C,0EAA0E;IAC1E,+CAA+C;IAC/C,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,GAAG,CAAC,IAAI;IACd,MAAM,EAAE,GAAG,CAAC,MAAqC;IACjD,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,cAAc,EAAE,GAAG,CAAC,eAAe;IACnC,QAAQ,EAAE,IAAI;IACd,gBAA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C,IAAI,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;;;;KAI7B,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,6EAA6E;IAC7E,MAAM,CAAC,IAAY;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAA6B,CAAC;QAC7D,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,0EAA0E;IAC1E,IAAI,CAAC,IAAY;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;IACzC,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,IAAY;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,QAAQ,CAAC;IAChD,CAAC;IAED,6EAA6E;IAC7E,KAAK,CAAC,QAAQ,CAAC,MAAyB;QACtC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAqB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ export interface CollectionReport {
2
+ readonly outcome: "committed" | "deferred" | "invalidated" | "failed";
3
+ readonly examined: number;
4
+ readonly deleted: number;
5
+ readonly ms: number;
6
+ readonly error?: string;
7
+ }
8
+ export interface CollectionOptions {
9
+ readonly cacheDir: string;
10
+ /** Which cached objects no durable owner retains; null defers. */
11
+ readonly unowned: (current: () => boolean) => Promise<{
12
+ readonly examined: number;
13
+ readonly unowned: readonly string[];
14
+ } | null>;
15
+ readonly report: (report: CollectionReport) => void;
16
+ }
17
+ /** Start collecting one cache; the returned stop waits out a running attempt. */
18
+ export declare function collectContentCache({ cacheDir, unowned, report }: CollectionOptions): () => Promise<void>;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * When the content cache collects what no durable owner retains.
3
+ *
4
+ * Prior art is `git gc --auto`: collection is due once enough new objects
5
+ * have arrived, or once a period has passed; nothing collects per commit, so
6
+ * an acknowledgment never starts one. A cache whose objects are all retained
7
+ * stays quiet until more arrive, however large it is. A proof that a recovery
8
+ * owner defers, or that a new cache user invalidates, retries after a
9
+ * doubling delay, never on every idle edge. Collection waits for a quiet
10
+ * cache and yields between its bounded chunks and deletion steps.
11
+ */
12
+ import { performance } from "node:perf_hooks";
13
+ import { pruneUnownedContentCache } from "./content-cache-host.js";
14
+ import { cacheNamespace } from "./content-cache-namespace.js";
15
+ import { contentCacheOwnership } from "./content-cache-ownership.js";
16
+ /** Names created since the last attempt that make collection due. */
17
+ const PRESSURE = 1024;
18
+ const PERIOD_MS = 60 * 60 * 1000;
19
+ /** Cache uses arrive in bursts; a quiet quarter second lets one finish. */
20
+ const QUIET_MS = 250;
21
+ const FIRST_RETRY_MS = 1000;
22
+ /** Hashes whose evidence one synchronous deletion step removes. */
23
+ const STEP = 64;
24
+ /** Start collecting one cache; the returned stop waits out a running attempt. */
25
+ export function collectContentCache({ cacheDir, unowned, report }) {
26
+ const owner = contentCacheOwnership(cacheDir);
27
+ const namespace = cacheNamespace(cacheDir);
28
+ let due = true;
29
+ let createdAtAttempt = namespace.created;
30
+ let retryMs = FIRST_RETRY_MS;
31
+ let retryAt = 0;
32
+ let timer = null;
33
+ let running = null;
34
+ let stopped = false;
35
+ const consider = () => {
36
+ if (stopped || timer || running)
37
+ return;
38
+ if (!due && namespace.created - createdAtAttempt >= PRESSURE)
39
+ due = true;
40
+ if (!due || !owner.unused)
41
+ return;
42
+ timer = setTimeout(attempt, Math.max(QUIET_MS, retryAt - performance.now()));
43
+ timer.unref();
44
+ };
45
+ const attempt = () => {
46
+ timer = null;
47
+ if (stopped || !owner.unused)
48
+ return; // the next idle edge reconsiders
49
+ createdAtAttempt = namespace.created;
50
+ const started = performance.now();
51
+ let examined = 0;
52
+ let deleted = 0;
53
+ running = owner.maintain(async (current) => {
54
+ const proof = await unowned(current);
55
+ if (proof === null)
56
+ return null;
57
+ examined = proof.examined;
58
+ const steps = [];
59
+ for (let start = 0; start === 0 || start < proof.unowned.length; start += STEP) {
60
+ const batch = proof.unowned.slice(start, start + STEP);
61
+ steps.push(() => { pruneUnownedContentCache(cacheDir, batch); deleted += batch.length; });
62
+ }
63
+ return steps;
64
+ }).then(outcome => {
65
+ if (outcome === "committed") {
66
+ due = false;
67
+ retryMs = FIRST_RETRY_MS;
68
+ retryAt = 0;
69
+ }
70
+ else {
71
+ retryAt = performance.now() + retryMs;
72
+ retryMs = Math.min(retryMs * 2, PERIOD_MS);
73
+ }
74
+ if (outcome !== "busy")
75
+ report({ outcome, examined, deleted, ms: performance.now() - started });
76
+ }, error => {
77
+ due = false;
78
+ report({ outcome: "failed", examined, deleted, ms: performance.now() - started,
79
+ error: error instanceof Error ? error.message : String(error) });
80
+ }).finally(() => { running = null; consider(); });
81
+ };
82
+ const period = setInterval(() => { due = true; consider(); }, PERIOD_MS);
83
+ period.unref();
84
+ owner.onIdle(consider);
85
+ consider();
86
+ return async () => {
87
+ stopped = true;
88
+ owner.onIdle(null);
89
+ clearInterval(period);
90
+ if (timer)
91
+ clearTimeout(timer);
92
+ timer = null;
93
+ // A new use invalidates any proof or deletion step still to run.
94
+ const release = owner.use();
95
+ release();
96
+ await running;
97
+ };
98
+ }
99
+ //# sourceMappingURL=content-cache-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-cache-collection.js","sourceRoot":"","sources":["../src/content-cache-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OA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CAAC,CAAC;QAC/B,KAAK,GAAG,IAAI,CAAC;QACb,iEAAiE;QACjE,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QAAC,OAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -7,9 +7,9 @@
7
7
  * files. The portable transfer law remains in @amalgm/live; this module owns
8
8
  * only Node filesystem effects.
9
9
  */
10
- import { type Stats } from "node:fs";
11
10
  import { type ContentChunk, type ContentManifest, type TransferArtifact } from "@amalgm/live";
12
11
  import { ContentCacheIndex } from "./content-cache-index.js";
12
+ import { type SourceStat } from "./source-signature.js";
13
13
  export interface SealedContentFile {
14
14
  readonly file: string;
15
15
  readonly bytes: number;
@@ -21,6 +21,20 @@ export interface CapturedFileContent {
21
21
  readonly manifest: ContentManifest;
22
22
  readonly binary: boolean;
23
23
  }
24
+ /** What a content-thread cargo writer leaves the main thread to publish: a
25
+ * qualified name it found standing, or bytes it staged written through,
26
+ * which receive their name only after a barrier makes them durable. */
27
+ export type CacheStage = {
28
+ readonly kind: "reused";
29
+ } | {
30
+ readonly kind: "staged";
31
+ readonly temporary: string;
32
+ };
33
+ /** A content-thread capture also says what it left for the cache name, so
34
+ * the main thread publishes it and accounts for its directory durability. */
35
+ export interface CacheCapture extends CapturedFileContent {
36
+ readonly cache: CacheStage | null;
37
+ }
24
38
  export interface ContentBlockSource {
25
39
  readonly bytes: number;
26
40
  read(offset: number, bytes: number): Promise<Uint8Array>;
@@ -34,38 +48,90 @@ export interface ContentBlockSink {
34
48
  export declare class CaptureSourceChangedError extends Error {
35
49
  readonly code = "CAPTURE_SOURCE_CHANGED";
36
50
  }
51
+ /** Where the cache keeps one artifact's sealed bytes. */
52
+ export declare const contentFile: (cacheDir: string, contentHash: string) => string;
53
+ /** Every content hash the cache holds any sealed evidence for. */
54
+ export declare function listCachedContent(cacheDir: string): Promise<ReadonlySet<string>>;
37
55
  /**
38
- * Remove sealed cache evidence that no durable retry or current replay base
39
- * retains. The caller owns that reference set; this filesystem effect owns
40
- * only the disposable bytes. Downloads and captures currently in progress live
41
- * in their dedicated partial/capture directories and are never inspected here.
56
+ * Remove the sealed cache evidence of exactly these hashes, which the caller
57
+ * proved no durable owner retains. A name the proof never examined is never
58
+ * removed. Callers must hold the cache's final maintenance fence: a capture can
59
+ * already occupy its final filename before Record owns it. Every staging
60
+ * temporary goes too: each writer holds a cache use until its attempt settles,
61
+ * so under the fence none belongs to a live attempt. Resumable download
62
+ * partials remain outside this deletion surface.
42
63
  */
43
- export declare function pruneSettledContentCache(cacheDir: string, retainedContentHashes: ReadonlySet<string>): void;
64
+ export declare function pruneUnownedContentCache(cacheDir: string, unowned: readonly string[]): void;
65
+ /** Remove a cached artifact whose bytes no longer prove its hash, with its
66
+ * hint. The name is forgotten, so if it reappears it is a new publication. */
67
+ export declare function discardCachedArtifact(cacheDir: string, contentHash: string): void;
44
68
  /** True when the machine cache already holds this artifact sealed whole.
45
69
  * Cold Add routes such artifacts through the cache rail so a warm re-Add
46
70
  * stays a local clone instead of a fresh download. */
47
71
  export declare function hasSealedContent(cacheDir: string, contentHash: string, bytes: number): boolean;
48
- /** Seal bytes once in the machine content cache. Capture paths share this
49
- * effect so file and repository Detect cannot invent different cache laws. */
50
- export declare function sealCapturedArtifact(cacheDir: string, artifact: TransferArtifact, bytes: Uint8Array): void;
72
+ /**
73
+ * Publish what a content thread left for one cargo name, on the main thread:
74
+ * a staged file receives its name once content-cache-namespace's group
75
+ * barrier made it durable; a reused name is adopted. Either way the namespace
76
+ * learns the name, so a Record requiring it knows whether its directory entry
77
+ * still needs a flush. A staged file that cannot be named is removed.
78
+ */
79
+ export declare function publishCargo(cacheDir: string, contentHash: string, stage: CacheStage): Promise<void>;
80
+ /**
81
+ * A hint is reconstructible evidence, not cargo: no record commits to it, and
82
+ * its exact bytes follow from retained immutable content. So a hint is written
83
+ * without any flush and may be lost or torn by a crash; every reader validates
84
+ * it and otherwise derives it again. A failure to write one loses only the
85
+ * hint. Manifests and repository identity frontiers are hints.
86
+ */
87
+ export declare function writeCacheHint(cacheDir: string, file: string, text: Uint8Array): Promise<void>;
88
+ /** A cached manifest hint, or null unless it is exactly the manifest this
89
+ * artifact's current contract and layout commit to. The read never runs on
90
+ * the main thread: a slow page-in stalls only this reader. */
91
+ export declare function readManifestHint(cacheDir: string, artifact: TransferArtifact): Promise<ContentManifest | null>;
92
+ /** Every valid hint this cache holds for one set, keyed by content hash. A
93
+ * missing or invalid hint is simply absent; its reader re-derives or fetches
94
+ * the manifest exactly as before. */
95
+ export declare function readManifestHints(cacheDir: string, artifacts: readonly TransferArtifact[]): Promise<ReadonlyMap<string, ContentManifest>>;
96
+ /** Derive a manifest again from the retained immutable bytes, never from the
97
+ * user's filesystem, in the layout the artifact commits to, and restore the
98
+ * hint. Only a content thread runs this; callers reach it through
99
+ * content-capture-pool's `contentManifest`. */
100
+ export declare function deriveCachedManifest(cacheDir: string, artifact: TransferArtifact): Promise<ContentManifest>;
101
+ /** Seal bytes once in the machine content cache: verify them against the
102
+ * artifact, derive the manifest, stage the bytes for publication under the
103
+ * one law and leave the manifest as a hint. Only a content thread runs this;
104
+ * the main thread reaches it through content-capture-pool's `sealContent`,
105
+ * which publishes what it staged. */
106
+ export declare function sealCapturedArtifact(cacheDir: string, artifact: TransferArtifact, bytes: Uint8Array): Promise<CacheStage>;
107
+ /** Every cargo name appears only over durable bytes. Before Record promises
108
+ * cached content, its names' directory entries must be durable too; the
109
+ * namespace flushes the cache directory only when some required name is not
110
+ * yet known durable. The flush runs off the event loop, before admission. */
111
+ export declare function makeRecordContentDurable(cacheDir: string, artifacts: readonly TransferArtifact[]): Promise<void>;
51
112
  /**
52
113
  * Capture an ordinary file in bounded blocks. The same bytes feed whole-file
53
114
  * identity, block identity, text/binary evidence, and the optional immutable
54
115
  * cache sink. No caller may need a complete-file Buffer.
55
116
  */
56
117
  export declare function captureContentBlocks(source: ContentBlockSource, sink: ContentBlockSink | null): Promise<CapturedFileContent>;
57
- export declare const sameCaptureFingerprint: (left: Stats, right: Stats) => boolean;
118
+ /** One capture is pinned to one unchanged regular file. The expected stat is
119
+ * plain data, so a capture thread receives exactly what its caller observed. */
120
+ export declare const sameCaptureSource: (left: SourceStat, right: SourceStat) => boolean;
58
121
  /**
59
- * Stream one stable filesystem file. Non-repository files are sealed directly
60
- * into the immutable cache during that read; repository-owned leaves use the
61
- * same capture primitive without a redundant second cache artifact. An
122
+ * Stream one stable filesystem file, optionally staging it for the immutable
123
+ * cache during that read; the main thread publishes what it staged. Only a
124
+ * capture thread runs this; every caller goes through content-capture-pool
125
+ * so no read or hash occupies the main thread. An
62
126
  * optional collect sink receives the same blocks during the one read, valid
63
127
  * only when capture succeeds — a churned capture throws and its blocks are
64
- * discarded with it.
128
+ * discarded with it. Observation can omit the sink; a later selected content
129
+ * promise must seal and prove its bytes before Record.
65
130
  */
66
- export declare function captureContentFile(sourceFile: string, expected: Stats, cacheDir: string | null, collect?: ContentBlockSink | null): Promise<CapturedFileContent>;
131
+ export declare function captureContentFile(sourceFile: string, expected: SourceStat, cacheDir: string | null, collect?: ContentBlockSink | null): Promise<CacheCapture>;
67
132
  /** Collect a capture's blocks into one contiguous Buffer, so a fused caller
68
- * owns the exact bytes the capture read without reading the file again. */
133
+ * owns the exact bytes the capture read without reading the file again. The
134
+ * Buffer owns its whole ArrayBuffer, so a capture thread can transfer it. */
69
135
  export declare function contentBlockCollector(bytes: number): ContentBlockSink & {
70
136
  readonly collected: Buffer;
71
137
  };
@@ -83,7 +149,7 @@ export interface CaptureStreamTransport {
83
149
  * the authority, never a sealed identity, and surfaces as the walk's
84
150
  * ordinary CaptureSourceChangedError.
85
151
  */
86
- export declare function captureContentFileStream(sourceFile: string, expected: Stats, transport: CaptureStreamTransport): Promise<CapturedFileContent>;
152
+ export declare function captureContentFileStream(sourceFile: string, expected: SourceStat, transport: CaptureStreamTransport): Promise<CapturedFileContent>;
87
153
  /** One artifact download. Calls may write different block indexes in
88
154
  * parallel; sealing is legal only after the portable download operation has
89
155
  * awaited them all. Targets retain metadata, never OS handles or chunk bytes. */