@smthrs/engine-store 0.0.0-stage → 1.0.0-rc.4

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 (787) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/LICENSE +21 -0
  3. package/README.md +146 -2
  4. package/dist/cjs/ArtifactGc.d.ts +235 -0
  5. package/dist/cjs/ArtifactGc.d.ts.map +1 -0
  6. package/dist/cjs/ArtifactGc.js +183 -0
  7. package/dist/cjs/ArtifactGc.js.map +7 -0
  8. package/dist/cjs/ArtifactSync.d.ts +164 -0
  9. package/dist/cjs/ArtifactSync.d.ts.map +1 -0
  10. package/dist/cjs/ArtifactSync.js +144 -0
  11. package/dist/cjs/ArtifactSync.js.map +7 -0
  12. package/dist/cjs/CacheSync.d.ts +112 -0
  13. package/dist/cjs/CacheSync.d.ts.map +1 -0
  14. package/dist/cjs/CacheSync.js +64 -0
  15. package/dist/cjs/CacheSync.js.map +7 -0
  16. package/dist/cjs/DeferredClockFold.d.ts +354 -0
  17. package/dist/cjs/DeferredClockFold.d.ts.map +1 -0
  18. package/dist/cjs/DeferredClockFold.js +335 -0
  19. package/dist/cjs/DeferredClockFold.js.map +7 -0
  20. package/dist/cjs/DisasterRecovery.d.ts +431 -0
  21. package/dist/cjs/DisasterRecovery.d.ts.map +1 -0
  22. package/dist/cjs/DisasterRecovery.js +453 -0
  23. package/dist/cjs/DisasterRecovery.js.map +7 -0
  24. package/dist/cjs/DurableEngineState.d.ts +776 -0
  25. package/dist/cjs/DurableEngineState.d.ts.map +1 -0
  26. package/dist/cjs/DurableEngineState.js +1536 -0
  27. package/dist/cjs/DurableEngineState.js.map +7 -0
  28. package/dist/cjs/EngineStore.d.ts +158 -0
  29. package/dist/cjs/EngineStore.d.ts.map +1 -0
  30. package/dist/cjs/EngineStore.js +398 -0
  31. package/dist/cjs/EngineStore.js.map +7 -0
  32. package/dist/cjs/EngineStoreMetrics.d.ts +276 -0
  33. package/dist/cjs/EngineStoreMetrics.d.ts.map +1 -0
  34. package/dist/cjs/EngineStoreMetrics.js +135 -0
  35. package/dist/cjs/EngineStoreMetrics.js.map +7 -0
  36. package/dist/cjs/Errors.d.ts +22 -0
  37. package/dist/cjs/Errors.d.ts.map +1 -0
  38. package/dist/cjs/Errors.js +39 -0
  39. package/dist/cjs/Errors.js.map +7 -0
  40. package/dist/cjs/EventTypes.d.ts +27 -0
  41. package/dist/cjs/EventTypes.d.ts.map +1 -0
  42. package/dist/cjs/EventTypes.js +37 -0
  43. package/dist/cjs/EventTypes.js.map +7 -0
  44. package/dist/cjs/ExecutionFacts.d.ts +59 -0
  45. package/dist/cjs/ExecutionFacts.d.ts.map +1 -0
  46. package/dist/cjs/ExecutionFacts.js +123 -0
  47. package/dist/cjs/ExecutionFacts.js.map +7 -0
  48. package/dist/cjs/ExecutionSnapshot.d.ts +117 -0
  49. package/dist/cjs/ExecutionSnapshot.d.ts.map +1 -0
  50. package/dist/cjs/ExecutionSnapshot.js +111 -0
  51. package/dist/cjs/ExecutionSnapshot.js.map +7 -0
  52. package/dist/cjs/Inconsistency.d.ts +154 -0
  53. package/dist/cjs/Inconsistency.d.ts.map +1 -0
  54. package/dist/cjs/Inconsistency.js +135 -0
  55. package/dist/cjs/Inconsistency.js.map +7 -0
  56. package/dist/cjs/Migrations.d.ts +56 -0
  57. package/dist/cjs/Migrations.d.ts.map +1 -0
  58. package/dist/cjs/Migrations.js +78 -0
  59. package/dist/cjs/Migrations.js.map +7 -0
  60. package/dist/cjs/OwnerIdentity.d.ts +91 -0
  61. package/dist/cjs/OwnerIdentity.d.ts.map +1 -0
  62. package/dist/cjs/OwnerIdentity.js +65 -0
  63. package/dist/cjs/OwnerIdentity.js.map +7 -0
  64. package/dist/cjs/PlanInputStore.d.ts +110 -0
  65. package/dist/cjs/PlanInputStore.d.ts.map +1 -0
  66. package/dist/cjs/PlanInputStore.js +224 -0
  67. package/dist/cjs/PlanInputStore.js.map +7 -0
  68. package/dist/cjs/PlanMergeStore.d.ts +113 -0
  69. package/dist/cjs/PlanMergeStore.d.ts.map +1 -0
  70. package/dist/cjs/PlanMergeStore.js +255 -0
  71. package/dist/cjs/PlanMergeStore.js.map +7 -0
  72. package/dist/cjs/PlanScheduler.d.ts +363 -0
  73. package/dist/cjs/PlanScheduler.d.ts.map +1 -0
  74. package/dist/cjs/PlanScheduler.js +1090 -0
  75. package/dist/cjs/PlanScheduler.js.map +7 -0
  76. package/dist/cjs/Reconciliation.d.ts +175 -0
  77. package/dist/cjs/Reconciliation.d.ts.map +1 -0
  78. package/dist/cjs/Reconciliation.js +119 -0
  79. package/dist/cjs/Reconciliation.js.map +7 -0
  80. package/dist/cjs/ReplayOnly.d.ts +91 -0
  81. package/dist/cjs/ReplayOnly.d.ts.map +1 -0
  82. package/dist/cjs/ReplayOnly.js +52 -0
  83. package/dist/cjs/ReplayOnly.js.map +7 -0
  84. package/dist/cjs/Retention.d.ts +113 -0
  85. package/dist/cjs/Retention.d.ts.map +1 -0
  86. package/dist/cjs/Retention.js +99 -0
  87. package/dist/cjs/Retention.js.map +7 -0
  88. package/dist/cjs/RunCatalogRead.d.ts +17 -0
  89. package/dist/cjs/RunCatalogRead.d.ts.map +1 -0
  90. package/dist/cjs/RunCatalogRead.js +33 -0
  91. package/dist/cjs/RunCatalogRead.js.map +7 -0
  92. package/dist/cjs/RunChangeFeed.d.ts +75 -0
  93. package/dist/cjs/RunChangeFeed.d.ts.map +1 -0
  94. package/dist/cjs/RunChangeFeed.js +96 -0
  95. package/dist/cjs/RunChangeFeed.js.map +7 -0
  96. package/dist/cjs/RunState.d.ts +116 -0
  97. package/dist/cjs/RunState.d.ts.map +1 -0
  98. package/dist/cjs/RunState.js +76 -0
  99. package/dist/cjs/RunState.js.map +7 -0
  100. package/dist/cjs/Selection.d.ts +495 -0
  101. package/dist/cjs/Selection.d.ts.map +1 -0
  102. package/dist/cjs/Selection.js +288 -0
  103. package/dist/cjs/Selection.js.map +7 -0
  104. package/dist/cjs/SelectionStore.d.ts +141 -0
  105. package/dist/cjs/SelectionStore.d.ts.map +1 -0
  106. package/dist/cjs/SelectionStore.js +229 -0
  107. package/dist/cjs/SelectionStore.js.map +7 -0
  108. package/dist/cjs/StepBoundary.d.ts +501 -0
  109. package/dist/cjs/StepBoundary.d.ts.map +1 -0
  110. package/dist/cjs/StepBoundary.js +619 -0
  111. package/dist/cjs/StepBoundary.js.map +7 -0
  112. package/dist/cjs/StepCacheFold.d.ts +148 -0
  113. package/dist/cjs/StepCacheFold.d.ts.map +1 -0
  114. package/dist/cjs/StepCacheFold.js +131 -0
  115. package/dist/cjs/StepCacheFold.js.map +7 -0
  116. package/dist/cjs/StepSandbox.d.ts +78 -0
  117. package/dist/cjs/StepSandbox.d.ts.map +1 -0
  118. package/dist/cjs/StepSandbox.js +75 -0
  119. package/dist/cjs/StepSandbox.js.map +7 -0
  120. package/dist/cjs/WakeBus.d.ts +116 -0
  121. package/dist/cjs/WakeBus.d.ts.map +1 -0
  122. package/dist/cjs/WakeBus.js +89 -0
  123. package/dist/cjs/WakeBus.js.map +7 -0
  124. package/dist/cjs/WorkspaceSandbox.d.ts +619 -0
  125. package/dist/cjs/WorkspaceSandbox.d.ts.map +1 -0
  126. package/dist/cjs/WorkspaceSandbox.js +711 -0
  127. package/dist/cjs/WorkspaceSandbox.js.map +7 -0
  128. package/dist/cjs/index.d.ts +157 -0
  129. package/dist/cjs/index.d.ts.map +1 -0
  130. package/dist/cjs/index.js +95 -0
  131. package/dist/cjs/index.js.map +7 -0
  132. package/dist/cjs/internal/ActionPersistence.d.ts +276 -0
  133. package/dist/cjs/internal/ActionPersistence.d.ts.map +1 -0
  134. package/dist/cjs/internal/ActionPersistence.js +1395 -0
  135. package/dist/cjs/internal/ActionPersistence.js.map +7 -0
  136. package/dist/cjs/internal/ArtifactRoots.d.ts +38 -0
  137. package/dist/cjs/internal/ArtifactRoots.d.ts.map +1 -0
  138. package/dist/cjs/internal/ArtifactRoots.js +89 -0
  139. package/dist/cjs/internal/ArtifactRoots.js.map +7 -0
  140. package/dist/cjs/internal/AttemptAdmission.d.ts +53 -0
  141. package/dist/cjs/internal/AttemptAdmission.d.ts.map +1 -0
  142. package/dist/cjs/internal/AttemptAdmission.js +52 -0
  143. package/dist/cjs/internal/AttemptAdmission.js.map +7 -0
  144. package/dist/cjs/internal/AttemptLifecycle.d.ts +245 -0
  145. package/dist/cjs/internal/AttemptLifecycle.d.ts.map +1 -0
  146. package/dist/cjs/internal/AttemptLifecycle.js +112 -0
  147. package/dist/cjs/internal/AttemptLifecycle.js.map +7 -0
  148. package/dist/cjs/internal/AttemptProbe.d.ts +53 -0
  149. package/dist/cjs/internal/AttemptProbe.d.ts.map +1 -0
  150. package/dist/cjs/internal/AttemptProbe.js +66 -0
  151. package/dist/cjs/internal/AttemptProbe.js.map +7 -0
  152. package/dist/cjs/internal/CacheAdmission.d.ts +79 -0
  153. package/dist/cjs/internal/CacheAdmission.d.ts.map +1 -0
  154. package/dist/cjs/internal/CacheAdmission.js +71 -0
  155. package/dist/cjs/internal/CacheAdmission.js.map +7 -0
  156. package/dist/cjs/internal/CacheAgeHistory.d.ts +27 -0
  157. package/dist/cjs/internal/CacheAgeHistory.d.ts.map +1 -0
  158. package/dist/cjs/internal/CacheAgeHistory.js +61 -0
  159. package/dist/cjs/internal/CacheAgeHistory.js.map +7 -0
  160. package/dist/cjs/internal/CacheAgeVerdicts.d.ts +15 -0
  161. package/dist/cjs/internal/CacheAgeVerdicts.d.ts.map +1 -0
  162. package/dist/cjs/internal/CacheAgeVerdicts.js +73 -0
  163. package/dist/cjs/internal/CacheAgeVerdicts.js.map +7 -0
  164. package/dist/cjs/internal/CacheOutputPolicy.d.ts +24 -0
  165. package/dist/cjs/internal/CacheOutputPolicy.d.ts.map +1 -0
  166. package/dist/cjs/internal/CacheOutputPolicy.js +75 -0
  167. package/dist/cjs/internal/CacheOutputPolicy.js.map +7 -0
  168. package/dist/cjs/internal/CachePublication.d.ts +97 -0
  169. package/dist/cjs/internal/CachePublication.d.ts.map +1 -0
  170. package/dist/cjs/internal/CachePublication.js +80 -0
  171. package/dist/cjs/internal/CachePublication.js.map +7 -0
  172. package/dist/cjs/internal/CallFacts.d.ts +15 -0
  173. package/dist/cjs/internal/CallFacts.d.ts.map +1 -0
  174. package/dist/cjs/internal/CallFacts.js +97 -0
  175. package/dist/cjs/internal/CallFacts.js.map +7 -0
  176. package/dist/cjs/internal/CopiedRecord.d.ts +61 -0
  177. package/dist/cjs/internal/CopiedRecord.d.ts.map +1 -0
  178. package/dist/cjs/internal/CopiedRecord.js +134 -0
  179. package/dist/cjs/internal/CopiedRecord.js.map +7 -0
  180. package/dist/cjs/internal/DeferredPersistence.d.ts +108 -0
  181. package/dist/cjs/internal/DeferredPersistence.d.ts.map +1 -0
  182. package/dist/cjs/internal/DeferredPersistence.js +270 -0
  183. package/dist/cjs/internal/DeferredPersistence.js.map +7 -0
  184. package/dist/cjs/internal/EffectRecords.d.ts +92 -0
  185. package/dist/cjs/internal/EffectRecords.d.ts.map +1 -0
  186. package/dist/cjs/internal/EffectRecords.js +63 -0
  187. package/dist/cjs/internal/EffectRecords.js.map +7 -0
  188. package/dist/cjs/internal/EngineJj.d.ts +30 -0
  189. package/dist/cjs/internal/EngineJj.d.ts.map +1 -0
  190. package/dist/cjs/internal/EngineJj.js +42 -0
  191. package/dist/cjs/internal/EngineJj.js.map +7 -0
  192. package/dist/cjs/internal/EngineStateSchema.d.ts +68 -0
  193. package/dist/cjs/internal/EngineStateSchema.d.ts.map +1 -0
  194. package/dist/cjs/internal/EngineStateSchema.js +58 -0
  195. package/dist/cjs/internal/EngineStateSchema.js.map +7 -0
  196. package/dist/cjs/internal/ExecutionSnapshotRead.d.ts +162 -0
  197. package/dist/cjs/internal/ExecutionSnapshotRead.d.ts.map +1 -0
  198. package/dist/cjs/internal/ExecutionSnapshotRead.js +201 -0
  199. package/dist/cjs/internal/ExecutionSnapshotRead.js.map +7 -0
  200. package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts +39 -0
  201. package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
  202. package/dist/cjs/internal/ExecutionSnapshotRelations.js +105 -0
  203. package/dist/cjs/internal/ExecutionSnapshotRelations.js.map +7 -0
  204. package/dist/cjs/internal/ExitEncoding.d.ts +180 -0
  205. package/dist/cjs/internal/ExitEncoding.d.ts.map +1 -0
  206. package/dist/cjs/internal/ExitEncoding.js +236 -0
  207. package/dist/cjs/internal/ExitEncoding.js.map +7 -0
  208. package/dist/cjs/internal/FileBoundarySnapshot.d.ts +14 -0
  209. package/dist/cjs/internal/FileBoundarySnapshot.d.ts.map +1 -0
  210. package/dist/cjs/internal/FileBoundarySnapshot.js +51 -0
  211. package/dist/cjs/internal/FileBoundarySnapshot.js.map +7 -0
  212. package/dist/cjs/internal/FileEnumeration.d.ts +127 -0
  213. package/dist/cjs/internal/FileEnumeration.d.ts.map +1 -0
  214. package/dist/cjs/internal/FileEnumeration.js +194 -0
  215. package/dist/cjs/internal/FileEnumeration.js.map +7 -0
  216. package/dist/cjs/internal/HostReflection.d.ts +80 -0
  217. package/dist/cjs/internal/HostReflection.d.ts.map +1 -0
  218. package/dist/cjs/internal/HostReflection.js +43 -0
  219. package/dist/cjs/internal/HostReflection.js.map +7 -0
  220. package/dist/cjs/internal/JournalRecords.d.ts +325 -0
  221. package/dist/cjs/internal/JournalRecords.d.ts.map +1 -0
  222. package/dist/cjs/internal/JournalRecords.js +122 -0
  223. package/dist/cjs/internal/JournalRecords.js.map +7 -0
  224. package/dist/cjs/internal/NodeJournal.d.ts +157 -0
  225. package/dist/cjs/internal/NodeJournal.d.ts.map +1 -0
  226. package/dist/cjs/internal/NodeJournal.js +192 -0
  227. package/dist/cjs/internal/NodeJournal.js.map +7 -0
  228. package/dist/cjs/internal/Ordering.d.ts +14 -0
  229. package/dist/cjs/internal/Ordering.d.ts.map +1 -0
  230. package/dist/cjs/internal/Ordering.js +25 -0
  231. package/dist/cjs/internal/Ordering.js.map +7 -0
  232. package/dist/cjs/internal/PlanInputs.d.ts +14 -0
  233. package/dist/cjs/internal/PlanInputs.d.ts.map +1 -0
  234. package/dist/cjs/internal/PlanInputs.js +78 -0
  235. package/dist/cjs/internal/PlanInputs.js.map +7 -0
  236. package/dist/cjs/internal/PlanMerges.d.ts +178 -0
  237. package/dist/cjs/internal/PlanMerges.d.ts.map +1 -0
  238. package/dist/cjs/internal/PlanMerges.js +125 -0
  239. package/dist/cjs/internal/PlanMerges.js.map +7 -0
  240. package/dist/cjs/internal/ProvenanceSlot.d.ts +30 -0
  241. package/dist/cjs/internal/ProvenanceSlot.d.ts.map +1 -0
  242. package/dist/cjs/internal/ProvenanceSlot.js +53 -0
  243. package/dist/cjs/internal/ProvenanceSlot.js.map +7 -0
  244. package/dist/cjs/internal/ResultEnvelope.d.ts +88 -0
  245. package/dist/cjs/internal/ResultEnvelope.d.ts.map +1 -0
  246. package/dist/cjs/internal/ResultEnvelope.js +90 -0
  247. package/dist/cjs/internal/ResultEnvelope.js.map +7 -0
  248. package/dist/cjs/internal/RetentionOps.d.ts +414 -0
  249. package/dist/cjs/internal/RetentionOps.d.ts.map +1 -0
  250. package/dist/cjs/internal/RetentionOps.js +354 -0
  251. package/dist/cjs/internal/RetentionOps.js.map +7 -0
  252. package/dist/cjs/internal/RunCatalogOps.d.ts +118 -0
  253. package/dist/cjs/internal/RunCatalogOps.d.ts.map +1 -0
  254. package/dist/cjs/internal/RunCatalogOps.js +85 -0
  255. package/dist/cjs/internal/RunCatalogOps.js.map +7 -0
  256. package/dist/cjs/internal/RunCoordinator.d.ts +78 -0
  257. package/dist/cjs/internal/RunCoordinator.d.ts.map +1 -0
  258. package/dist/cjs/internal/RunCoordinator.js +123 -0
  259. package/dist/cjs/internal/RunCoordinator.js.map +7 -0
  260. package/dist/cjs/internal/RunDriver.d.ts +192 -0
  261. package/dist/cjs/internal/RunDriver.d.ts.map +1 -0
  262. package/dist/cjs/internal/RunDriver.js +1586 -0
  263. package/dist/cjs/internal/RunDriver.js.map +7 -0
  264. package/dist/cjs/internal/RunLifecycle.d.ts +22 -0
  265. package/dist/cjs/internal/RunLifecycle.d.ts.map +1 -0
  266. package/dist/cjs/internal/RunLifecycle.js +63 -0
  267. package/dist/cjs/internal/RunLifecycle.js.map +7 -0
  268. package/dist/cjs/internal/RunListing.d.ts +78 -0
  269. package/dist/cjs/internal/RunListing.d.ts.map +1 -0
  270. package/dist/cjs/internal/RunListing.js +171 -0
  271. package/dist/cjs/internal/RunListing.js.map +7 -0
  272. package/dist/cjs/internal/RunListingError.d.ts +35 -0
  273. package/dist/cjs/internal/RunListingError.d.ts.map +1 -0
  274. package/dist/cjs/internal/RunListingError.js +47 -0
  275. package/dist/cjs/internal/RunListingError.js.map +7 -0
  276. package/dist/cjs/internal/RuntimeGraph.d.ts +73 -0
  277. package/dist/cjs/internal/RuntimeGraph.d.ts.map +1 -0
  278. package/dist/cjs/internal/RuntimeGraph.js +180 -0
  279. package/dist/cjs/internal/RuntimeGraph.js.map +7 -0
  280. package/dist/cjs/internal/SandboxedExecution.d.ts +80 -0
  281. package/dist/cjs/internal/SandboxedExecution.d.ts.map +1 -0
  282. package/dist/cjs/internal/SandboxedExecution.js +104 -0
  283. package/dist/cjs/internal/SandboxedExecution.js.map +7 -0
  284. package/dist/cjs/internal/StateTransaction.d.ts +44 -0
  285. package/dist/cjs/internal/StateTransaction.d.ts.map +1 -0
  286. package/dist/cjs/internal/StateTransaction.js +52 -0
  287. package/dist/cjs/internal/StateTransaction.js.map +7 -0
  288. package/dist/cjs/internal/StepFacts.d.ts +14 -0
  289. package/dist/cjs/internal/StepFacts.d.ts.map +1 -0
  290. package/dist/cjs/internal/StepFacts.js +58 -0
  291. package/dist/cjs/internal/StepFacts.js.map +7 -0
  292. package/dist/cjs/internal/TypedEvents.d.ts +14 -0
  293. package/dist/cjs/internal/TypedEvents.d.ts.map +1 -0
  294. package/dist/cjs/internal/TypedEvents.js +37 -0
  295. package/dist/cjs/internal/TypedEvents.js.map +7 -0
  296. package/dist/cjs/migrations/0001_initial.d.ts +17 -0
  297. package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
  298. package/dist/cjs/migrations/0001_initial.js +61 -0
  299. package/dist/cjs/migrations/0001_initial.js.map +7 -0
  300. package/dist/cjs/migrations/0002_selection_store.d.ts +15 -0
  301. package/dist/cjs/migrations/0002_selection_store.d.ts.map +1 -0
  302. package/dist/cjs/migrations/0002_selection_store.js +56 -0
  303. package/dist/cjs/migrations/0002_selection_store.js.map +7 -0
  304. package/dist/cjs/migrations/0003_plan_inputs.d.ts +13 -0
  305. package/dist/cjs/migrations/0003_plan_inputs.d.ts.map +1 -0
  306. package/dist/cjs/migrations/0003_plan_inputs.js +90 -0
  307. package/dist/cjs/migrations/0003_plan_inputs.js.map +7 -0
  308. package/dist/cjs/migrations/0004_plan_environment.d.ts +14 -0
  309. package/dist/cjs/migrations/0004_plan_environment.d.ts.map +1 -0
  310. package/dist/cjs/migrations/0004_plan_environment.js +56 -0
  311. package/dist/cjs/migrations/0004_plan_environment.js.map +7 -0
  312. package/dist/cjs/migrations/0005_plan_merges.d.ts +14 -0
  313. package/dist/cjs/migrations/0005_plan_merges.d.ts.map +1 -0
  314. package/dist/cjs/migrations/0005_plan_merges.js +82 -0
  315. package/dist/cjs/migrations/0005_plan_merges.js.map +7 -0
  316. package/dist/cjs/migrations/0006_execution_listing.d.ts +15 -0
  317. package/dist/cjs/migrations/0006_execution_listing.d.ts.map +1 -0
  318. package/dist/cjs/migrations/0006_execution_listing.js +101 -0
  319. package/dist/cjs/migrations/0006_execution_listing.js.map +7 -0
  320. package/dist/cjs/migrations/0007_run_parent_sequence.d.ts +15 -0
  321. package/dist/cjs/migrations/0007_run_parent_sequence.d.ts.map +1 -0
  322. package/dist/cjs/migrations/0007_run_parent_sequence.js +40 -0
  323. package/dist/cjs/migrations/0007_run_parent_sequence.js.map +7 -0
  324. package/dist/cjs/migrations/0008_deferred_consumption.d.ts +16 -0
  325. package/dist/cjs/migrations/0008_deferred_consumption.d.ts.map +1 -0
  326. package/dist/cjs/migrations/0008_deferred_consumption.js +45 -0
  327. package/dist/cjs/migrations/0008_deferred_consumption.js.map +7 -0
  328. package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts +24 -0
  329. package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
  330. package/dist/cjs/migrations/0009_deferred_clock_facts.js +141 -0
  331. package/dist/cjs/migrations/0009_deferred_clock_facts.js.map +7 -0
  332. package/dist/cjs/migrations/0010_pending_cancellation.d.ts +15 -0
  333. package/dist/cjs/migrations/0010_pending_cancellation.d.ts.map +1 -0
  334. package/dist/cjs/migrations/0010_pending_cancellation.js +41 -0
  335. package/dist/cjs/migrations/0010_pending_cancellation.js.map +7 -0
  336. package/dist/cjs/package.json +1 -0
  337. package/dist/cjs/test/TestStores.d.ts +89 -0
  338. package/dist/cjs/test/TestStores.d.ts.map +1 -0
  339. package/dist/cjs/test/TestStores.js +98 -0
  340. package/dist/cjs/test/TestStores.js.map +7 -0
  341. package/dist/esm/ArtifactGc.d.ts +235 -0
  342. package/dist/esm/ArtifactGc.d.ts.map +1 -0
  343. package/dist/esm/ArtifactGc.js +268 -0
  344. package/dist/esm/ArtifactGc.js.map +1 -0
  345. package/dist/esm/ArtifactSync.d.ts +164 -0
  346. package/dist/esm/ArtifactSync.d.ts.map +1 -0
  347. package/dist/esm/ArtifactSync.js +176 -0
  348. package/dist/esm/ArtifactSync.js.map +1 -0
  349. package/dist/esm/CacheSync.d.ts +112 -0
  350. package/dist/esm/CacheSync.d.ts.map +1 -0
  351. package/dist/esm/CacheSync.js +94 -0
  352. package/dist/esm/CacheSync.js.map +1 -0
  353. package/dist/esm/DeferredClockFold.d.ts +354 -0
  354. package/dist/esm/DeferredClockFold.d.ts.map +1 -0
  355. package/dist/esm/DeferredClockFold.js +472 -0
  356. package/dist/esm/DeferredClockFold.js.map +1 -0
  357. package/dist/esm/DisasterRecovery.d.ts +431 -0
  358. package/dist/esm/DisasterRecovery.d.ts.map +1 -0
  359. package/dist/esm/DisasterRecovery.js +523 -0
  360. package/dist/esm/DisasterRecovery.js.map +1 -0
  361. package/dist/esm/DurableEngineState.d.ts +776 -0
  362. package/dist/esm/DurableEngineState.d.ts.map +1 -0
  363. package/dist/esm/DurableEngineState.js +1648 -0
  364. package/dist/esm/DurableEngineState.js.map +1 -0
  365. package/dist/esm/EngineStore.d.ts +158 -0
  366. package/dist/esm/EngineStore.d.ts.map +1 -0
  367. package/dist/esm/EngineStore.js +403 -0
  368. package/dist/esm/EngineStore.js.map +1 -0
  369. package/dist/esm/EngineStoreMetrics.d.ts +276 -0
  370. package/dist/esm/EngineStoreMetrics.d.ts.map +1 -0
  371. package/dist/esm/EngineStoreMetrics.js +260 -0
  372. package/dist/esm/EngineStoreMetrics.js.map +1 -0
  373. package/dist/esm/Errors.d.ts +22 -0
  374. package/dist/esm/Errors.d.ts.map +1 -0
  375. package/dist/esm/Errors.js +22 -0
  376. package/dist/esm/Errors.js.map +1 -0
  377. package/dist/esm/EventTypes.d.ts +27 -0
  378. package/dist/esm/EventTypes.d.ts.map +1 -0
  379. package/dist/esm/EventTypes.js +27 -0
  380. package/dist/esm/EventTypes.js.map +1 -0
  381. package/dist/esm/ExecutionFacts.d.ts +59 -0
  382. package/dist/esm/ExecutionFacts.d.ts.map +1 -0
  383. package/dist/esm/ExecutionFacts.js +96 -0
  384. package/dist/esm/ExecutionFacts.js.map +1 -0
  385. package/dist/esm/ExecutionSnapshot.d.ts +117 -0
  386. package/dist/esm/ExecutionSnapshot.d.ts.map +1 -0
  387. package/dist/esm/ExecutionSnapshot.js +95 -0
  388. package/dist/esm/ExecutionSnapshot.js.map +1 -0
  389. package/dist/esm/Inconsistency.d.ts +154 -0
  390. package/dist/esm/Inconsistency.d.ts.map +1 -0
  391. package/dist/esm/Inconsistency.js +133 -0
  392. package/dist/esm/Inconsistency.js.map +1 -0
  393. package/dist/esm/Migrations.d.ts +56 -0
  394. package/dist/esm/Migrations.d.ts.map +1 -0
  395. package/dist/esm/Migrations.js +91 -0
  396. package/dist/esm/Migrations.js.map +1 -0
  397. package/dist/esm/OwnerIdentity.d.ts +91 -0
  398. package/dist/esm/OwnerIdentity.d.ts.map +1 -0
  399. package/dist/esm/OwnerIdentity.js +99 -0
  400. package/dist/esm/OwnerIdentity.js.map +1 -0
  401. package/dist/esm/PlanInputStore.d.ts +110 -0
  402. package/dist/esm/PlanInputStore.d.ts.map +1 -0
  403. package/dist/esm/PlanInputStore.js +207 -0
  404. package/dist/esm/PlanInputStore.js.map +1 -0
  405. package/dist/esm/PlanMergeStore.d.ts +113 -0
  406. package/dist/esm/PlanMergeStore.d.ts.map +1 -0
  407. package/dist/esm/PlanMergeStore.js +244 -0
  408. package/dist/esm/PlanMergeStore.js.map +1 -0
  409. package/dist/esm/PlanScheduler.d.ts +363 -0
  410. package/dist/esm/PlanScheduler.d.ts.map +1 -0
  411. package/dist/esm/PlanScheduler.js +1321 -0
  412. package/dist/esm/PlanScheduler.js.map +1 -0
  413. package/dist/esm/Reconciliation.d.ts +175 -0
  414. package/dist/esm/Reconciliation.d.ts.map +1 -0
  415. package/dist/esm/Reconciliation.js +175 -0
  416. package/dist/esm/Reconciliation.js.map +1 -0
  417. package/dist/esm/ReplayOnly.d.ts +91 -0
  418. package/dist/esm/ReplayOnly.d.ts.map +1 -0
  419. package/dist/esm/ReplayOnly.js +59 -0
  420. package/dist/esm/ReplayOnly.js.map +1 -0
  421. package/dist/esm/Retention.d.ts +113 -0
  422. package/dist/esm/Retention.d.ts.map +1 -0
  423. package/dist/esm/Retention.js +139 -0
  424. package/dist/esm/Retention.js.map +1 -0
  425. package/dist/esm/RunCatalogRead.d.ts +17 -0
  426. package/dist/esm/RunCatalogRead.d.ts.map +1 -0
  427. package/dist/esm/RunCatalogRead.js +17 -0
  428. package/dist/esm/RunCatalogRead.js.map +1 -0
  429. package/dist/esm/RunChangeFeed.d.ts +75 -0
  430. package/dist/esm/RunChangeFeed.d.ts.map +1 -0
  431. package/dist/esm/RunChangeFeed.js +81 -0
  432. package/dist/esm/RunChangeFeed.js.map +1 -0
  433. package/dist/esm/RunState.d.ts +116 -0
  434. package/dist/esm/RunState.d.ts.map +1 -0
  435. package/dist/esm/RunState.js +109 -0
  436. package/dist/esm/RunState.js.map +1 -0
  437. package/dist/esm/Selection.d.ts +495 -0
  438. package/dist/esm/Selection.d.ts.map +1 -0
  439. package/dist/esm/Selection.js +482 -0
  440. package/dist/esm/Selection.js.map +1 -0
  441. package/dist/esm/SelectionStore.d.ts +141 -0
  442. package/dist/esm/SelectionStore.d.ts.map +1 -0
  443. package/dist/esm/SelectionStore.js +215 -0
  444. package/dist/esm/SelectionStore.js.map +1 -0
  445. package/dist/esm/StepBoundary.d.ts +501 -0
  446. package/dist/esm/StepBoundary.d.ts.map +1 -0
  447. package/dist/esm/StepBoundary.js +919 -0
  448. package/dist/esm/StepBoundary.js.map +1 -0
  449. package/dist/esm/StepCacheFold.d.ts +148 -0
  450. package/dist/esm/StepCacheFold.d.ts.map +1 -0
  451. package/dist/esm/StepCacheFold.js +201 -0
  452. package/dist/esm/StepCacheFold.js.map +1 -0
  453. package/dist/esm/StepSandbox.d.ts +78 -0
  454. package/dist/esm/StepSandbox.d.ts.map +1 -0
  455. package/dist/esm/StepSandbox.js +70 -0
  456. package/dist/esm/StepSandbox.js.map +1 -0
  457. package/dist/esm/WakeBus.d.ts +116 -0
  458. package/dist/esm/WakeBus.d.ts.map +1 -0
  459. package/dist/esm/WakeBus.js +121 -0
  460. package/dist/esm/WakeBus.js.map +1 -0
  461. package/dist/esm/WorkspaceSandbox.d.ts +619 -0
  462. package/dist/esm/WorkspaceSandbox.d.ts.map +1 -0
  463. package/dist/esm/WorkspaceSandbox.js +985 -0
  464. package/dist/esm/WorkspaceSandbox.js.map +1 -0
  465. package/dist/esm/index.d.ts +157 -0
  466. package/dist/esm/index.d.ts.map +1 -0
  467. package/dist/esm/index.js +157 -0
  468. package/dist/esm/index.js.map +1 -0
  469. package/dist/esm/internal/ActionPersistence.d.ts +276 -0
  470. package/dist/esm/internal/ActionPersistence.d.ts.map +1 -0
  471. package/dist/esm/internal/ActionPersistence.js +2306 -0
  472. package/dist/esm/internal/ActionPersistence.js.map +1 -0
  473. package/dist/esm/internal/ArtifactRoots.d.ts +38 -0
  474. package/dist/esm/internal/ArtifactRoots.d.ts.map +1 -0
  475. package/dist/esm/internal/ArtifactRoots.js +76 -0
  476. package/dist/esm/internal/ArtifactRoots.js.map +1 -0
  477. package/dist/esm/internal/AttemptAdmission.d.ts +53 -0
  478. package/dist/esm/internal/AttemptAdmission.d.ts.map +1 -0
  479. package/dist/esm/internal/AttemptAdmission.js +52 -0
  480. package/dist/esm/internal/AttemptAdmission.js.map +1 -0
  481. package/dist/esm/internal/AttemptLifecycle.d.ts +245 -0
  482. package/dist/esm/internal/AttemptLifecycle.d.ts.map +1 -0
  483. package/dist/esm/internal/AttemptLifecycle.js +104 -0
  484. package/dist/esm/internal/AttemptLifecycle.js.map +1 -0
  485. package/dist/esm/internal/AttemptProbe.d.ts +53 -0
  486. package/dist/esm/internal/AttemptProbe.d.ts.map +1 -0
  487. package/dist/esm/internal/AttemptProbe.js +83 -0
  488. package/dist/esm/internal/AttemptProbe.js.map +1 -0
  489. package/dist/esm/internal/CacheAdmission.d.ts +79 -0
  490. package/dist/esm/internal/CacheAdmission.d.ts.map +1 -0
  491. package/dist/esm/internal/CacheAdmission.js +72 -0
  492. package/dist/esm/internal/CacheAdmission.js.map +1 -0
  493. package/dist/esm/internal/CacheAgeHistory.d.ts +27 -0
  494. package/dist/esm/internal/CacheAgeHistory.d.ts.map +1 -0
  495. package/dist/esm/internal/CacheAgeHistory.js +49 -0
  496. package/dist/esm/internal/CacheAgeHistory.js.map +1 -0
  497. package/dist/esm/internal/CacheAgeVerdicts.d.ts +15 -0
  498. package/dist/esm/internal/CacheAgeVerdicts.d.ts.map +1 -0
  499. package/dist/esm/internal/CacheAgeVerdicts.js +54 -0
  500. package/dist/esm/internal/CacheAgeVerdicts.js.map +1 -0
  501. package/dist/esm/internal/CacheOutputPolicy.d.ts +24 -0
  502. package/dist/esm/internal/CacheOutputPolicy.d.ts.map +1 -0
  503. package/dist/esm/internal/CacheOutputPolicy.js +73 -0
  504. package/dist/esm/internal/CacheOutputPolicy.js.map +1 -0
  505. package/dist/esm/internal/CachePublication.d.ts +97 -0
  506. package/dist/esm/internal/CachePublication.d.ts.map +1 -0
  507. package/dist/esm/internal/CachePublication.js +116 -0
  508. package/dist/esm/internal/CachePublication.js.map +1 -0
  509. package/dist/esm/internal/CallFacts.d.ts +15 -0
  510. package/dist/esm/internal/CallFacts.d.ts.map +1 -0
  511. package/dist/esm/internal/CallFacts.js +83 -0
  512. package/dist/esm/internal/CallFacts.js.map +1 -0
  513. package/dist/esm/internal/CopiedRecord.d.ts +61 -0
  514. package/dist/esm/internal/CopiedRecord.d.ts.map +1 -0
  515. package/dist/esm/internal/CopiedRecord.js +165 -0
  516. package/dist/esm/internal/CopiedRecord.js.map +1 -0
  517. package/dist/esm/internal/DeferredPersistence.d.ts +108 -0
  518. package/dist/esm/internal/DeferredPersistence.d.ts.map +1 -0
  519. package/dist/esm/internal/DeferredPersistence.js +240 -0
  520. package/dist/esm/internal/DeferredPersistence.js.map +1 -0
  521. package/dist/esm/internal/EffectRecords.d.ts +92 -0
  522. package/dist/esm/internal/EffectRecords.d.ts.map +1 -0
  523. package/dist/esm/internal/EffectRecords.js +94 -0
  524. package/dist/esm/internal/EffectRecords.js.map +1 -0
  525. package/dist/esm/internal/EngineJj.d.ts +30 -0
  526. package/dist/esm/internal/EngineJj.d.ts.map +1 -0
  527. package/dist/esm/internal/EngineJj.js +29 -0
  528. package/dist/esm/internal/EngineJj.js.map +1 -0
  529. package/dist/esm/internal/EngineStateSchema.d.ts +68 -0
  530. package/dist/esm/internal/EngineStateSchema.d.ts.map +1 -0
  531. package/dist/esm/internal/EngineStateSchema.js +53 -0
  532. package/dist/esm/internal/EngineStateSchema.js.map +1 -0
  533. package/dist/esm/internal/ExecutionSnapshotRead.d.ts +162 -0
  534. package/dist/esm/internal/ExecutionSnapshotRead.d.ts.map +1 -0
  535. package/dist/esm/internal/ExecutionSnapshotRead.js +218 -0
  536. package/dist/esm/internal/ExecutionSnapshotRead.js.map +1 -0
  537. package/dist/esm/internal/ExecutionSnapshotRelations.d.ts +39 -0
  538. package/dist/esm/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
  539. package/dist/esm/internal/ExecutionSnapshotRelations.js +81 -0
  540. package/dist/esm/internal/ExecutionSnapshotRelations.js.map +1 -0
  541. package/dist/esm/internal/ExitEncoding.d.ts +180 -0
  542. package/dist/esm/internal/ExitEncoding.d.ts.map +1 -0
  543. package/dist/esm/internal/ExitEncoding.js +361 -0
  544. package/dist/esm/internal/ExitEncoding.js.map +1 -0
  545. package/dist/esm/internal/FileBoundarySnapshot.d.ts +14 -0
  546. package/dist/esm/internal/FileBoundarySnapshot.d.ts.map +1 -0
  547. package/dist/esm/internal/FileBoundarySnapshot.js +29 -0
  548. package/dist/esm/internal/FileBoundarySnapshot.js.map +1 -0
  549. package/dist/esm/internal/FileEnumeration.d.ts +127 -0
  550. package/dist/esm/internal/FileEnumeration.d.ts.map +1 -0
  551. package/dist/esm/internal/FileEnumeration.js +236 -0
  552. package/dist/esm/internal/FileEnumeration.js.map +1 -0
  553. package/dist/esm/internal/HostReflection.d.ts +80 -0
  554. package/dist/esm/internal/HostReflection.d.ts.map +1 -0
  555. package/dist/esm/internal/HostReflection.js +98 -0
  556. package/dist/esm/internal/HostReflection.js.map +1 -0
  557. package/dist/esm/internal/JournalRecords.d.ts +325 -0
  558. package/dist/esm/internal/JournalRecords.d.ts.map +1 -0
  559. package/dist/esm/internal/JournalRecords.js +306 -0
  560. package/dist/esm/internal/JournalRecords.js.map +1 -0
  561. package/dist/esm/internal/NodeJournal.d.ts +157 -0
  562. package/dist/esm/internal/NodeJournal.d.ts.map +1 -0
  563. package/dist/esm/internal/NodeJournal.js +298 -0
  564. package/dist/esm/internal/NodeJournal.js.map +1 -0
  565. package/dist/esm/internal/Ordering.d.ts +14 -0
  566. package/dist/esm/internal/Ordering.d.ts.map +1 -0
  567. package/dist/esm/internal/Ordering.js +14 -0
  568. package/dist/esm/internal/Ordering.js.map +1 -0
  569. package/dist/esm/internal/PlanInputs.d.ts +14 -0
  570. package/dist/esm/internal/PlanInputs.d.ts.map +1 -0
  571. package/dist/esm/internal/PlanInputs.js +57 -0
  572. package/dist/esm/internal/PlanInputs.js.map +1 -0
  573. package/dist/esm/internal/PlanMerges.d.ts +178 -0
  574. package/dist/esm/internal/PlanMerges.d.ts.map +1 -0
  575. package/dist/esm/internal/PlanMerges.js +113 -0
  576. package/dist/esm/internal/PlanMerges.js.map +1 -0
  577. package/dist/esm/internal/ProvenanceSlot.d.ts +30 -0
  578. package/dist/esm/internal/ProvenanceSlot.d.ts.map +1 -0
  579. package/dist/esm/internal/ProvenanceSlot.js +39 -0
  580. package/dist/esm/internal/ProvenanceSlot.js.map +1 -0
  581. package/dist/esm/internal/ResultEnvelope.d.ts +88 -0
  582. package/dist/esm/internal/ResultEnvelope.d.ts.map +1 -0
  583. package/dist/esm/internal/ResultEnvelope.js +83 -0
  584. package/dist/esm/internal/ResultEnvelope.js.map +1 -0
  585. package/dist/esm/internal/RetentionOps.d.ts +414 -0
  586. package/dist/esm/internal/RetentionOps.d.ts.map +1 -0
  587. package/dist/esm/internal/RetentionOps.js +576 -0
  588. package/dist/esm/internal/RetentionOps.js.map +1 -0
  589. package/dist/esm/internal/RunCatalogOps.d.ts +118 -0
  590. package/dist/esm/internal/RunCatalogOps.d.ts.map +1 -0
  591. package/dist/esm/internal/RunCatalogOps.js +120 -0
  592. package/dist/esm/internal/RunCatalogOps.js.map +1 -0
  593. package/dist/esm/internal/RunCoordinator.d.ts +78 -0
  594. package/dist/esm/internal/RunCoordinator.d.ts.map +1 -0
  595. package/dist/esm/internal/RunCoordinator.js +115 -0
  596. package/dist/esm/internal/RunCoordinator.js.map +1 -0
  597. package/dist/esm/internal/RunDriver.d.ts +192 -0
  598. package/dist/esm/internal/RunDriver.d.ts.map +1 -0
  599. package/dist/esm/internal/RunDriver.js +2334 -0
  600. package/dist/esm/internal/RunDriver.js.map +1 -0
  601. package/dist/esm/internal/RunLifecycle.d.ts +22 -0
  602. package/dist/esm/internal/RunLifecycle.d.ts.map +1 -0
  603. package/dist/esm/internal/RunLifecycle.js +49 -0
  604. package/dist/esm/internal/RunLifecycle.js.map +1 -0
  605. package/dist/esm/internal/RunListing.d.ts +78 -0
  606. package/dist/esm/internal/RunListing.d.ts.map +1 -0
  607. package/dist/esm/internal/RunListing.js +146 -0
  608. package/dist/esm/internal/RunListing.js.map +1 -0
  609. package/dist/esm/internal/RunListingError.d.ts +35 -0
  610. package/dist/esm/internal/RunListingError.d.ts.map +1 -0
  611. package/dist/esm/internal/RunListingError.js +27 -0
  612. package/dist/esm/internal/RunListingError.js.map +1 -0
  613. package/dist/esm/internal/RuntimeGraph.d.ts +73 -0
  614. package/dist/esm/internal/RuntimeGraph.d.ts.map +1 -0
  615. package/dist/esm/internal/RuntimeGraph.js +182 -0
  616. package/dist/esm/internal/RuntimeGraph.js.map +1 -0
  617. package/dist/esm/internal/SandboxedExecution.d.ts +80 -0
  618. package/dist/esm/internal/SandboxedExecution.d.ts.map +1 -0
  619. package/dist/esm/internal/SandboxedExecution.js +107 -0
  620. package/dist/esm/internal/SandboxedExecution.js.map +1 -0
  621. package/dist/esm/internal/StateTransaction.d.ts +44 -0
  622. package/dist/esm/internal/StateTransaction.d.ts.map +1 -0
  623. package/dist/esm/internal/StateTransaction.js +54 -0
  624. package/dist/esm/internal/StateTransaction.js.map +1 -0
  625. package/dist/esm/internal/StepFacts.d.ts +14 -0
  626. package/dist/esm/internal/StepFacts.d.ts.map +1 -0
  627. package/dist/esm/internal/StepFacts.js +35 -0
  628. package/dist/esm/internal/StepFacts.js.map +1 -0
  629. package/dist/esm/internal/TypedEvents.d.ts +14 -0
  630. package/dist/esm/internal/TypedEvents.d.ts.map +1 -0
  631. package/dist/esm/internal/TypedEvents.js +14 -0
  632. package/dist/esm/internal/TypedEvents.js.map +1 -0
  633. package/dist/esm/migrations/0001_initial.d.ts +17 -0
  634. package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
  635. package/dist/esm/migrations/0001_initial.js +41 -0
  636. package/dist/esm/migrations/0001_initial.js.map +1 -0
  637. package/dist/esm/migrations/0002_selection_store.d.ts +15 -0
  638. package/dist/esm/migrations/0002_selection_store.d.ts.map +1 -0
  639. package/dist/esm/migrations/0002_selection_store.js +34 -0
  640. package/dist/esm/migrations/0002_selection_store.js.map +1 -0
  641. package/dist/esm/migrations/0003_plan_inputs.d.ts +13 -0
  642. package/dist/esm/migrations/0003_plan_inputs.d.ts.map +1 -0
  643. package/dist/esm/migrations/0003_plan_inputs.js +70 -0
  644. package/dist/esm/migrations/0003_plan_inputs.js.map +1 -0
  645. package/dist/esm/migrations/0004_plan_environment.d.ts +14 -0
  646. package/dist/esm/migrations/0004_plan_environment.d.ts.map +1 -0
  647. package/dist/esm/migrations/0004_plan_environment.js +33 -0
  648. package/dist/esm/migrations/0004_plan_environment.js.map +1 -0
  649. package/dist/esm/migrations/0005_plan_merges.d.ts +14 -0
  650. package/dist/esm/migrations/0005_plan_merges.d.ts.map +1 -0
  651. package/dist/esm/migrations/0005_plan_merges.js +59 -0
  652. package/dist/esm/migrations/0005_plan_merges.js.map +1 -0
  653. package/dist/esm/migrations/0006_execution_listing.d.ts +15 -0
  654. package/dist/esm/migrations/0006_execution_listing.d.ts.map +1 -0
  655. package/dist/esm/migrations/0006_execution_listing.js +81 -0
  656. package/dist/esm/migrations/0006_execution_listing.js.map +1 -0
  657. package/dist/esm/migrations/0007_run_parent_sequence.d.ts +15 -0
  658. package/dist/esm/migrations/0007_run_parent_sequence.d.ts.map +1 -0
  659. package/dist/esm/migrations/0007_run_parent_sequence.js +18 -0
  660. package/dist/esm/migrations/0007_run_parent_sequence.js.map +1 -0
  661. package/dist/esm/migrations/0008_deferred_consumption.d.ts +16 -0
  662. package/dist/esm/migrations/0008_deferred_consumption.d.ts.map +1 -0
  663. package/dist/esm/migrations/0008_deferred_consumption.js +24 -0
  664. package/dist/esm/migrations/0008_deferred_consumption.js.map +1 -0
  665. package/dist/esm/migrations/0009_deferred_clock_facts.d.ts +24 -0
  666. package/dist/esm/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
  667. package/dist/esm/migrations/0009_deferred_clock_facts.js +127 -0
  668. package/dist/esm/migrations/0009_deferred_clock_facts.js.map +1 -0
  669. package/dist/esm/migrations/0010_pending_cancellation.d.ts +15 -0
  670. package/dist/esm/migrations/0010_pending_cancellation.d.ts.map +1 -0
  671. package/dist/esm/migrations/0010_pending_cancellation.js +19 -0
  672. package/dist/esm/migrations/0010_pending_cancellation.js.map +1 -0
  673. package/dist/esm/test/TestStores.d.ts +89 -0
  674. package/dist/esm/test/TestStores.d.ts.map +1 -0
  675. package/dist/esm/test/TestStores.js +103 -0
  676. package/dist/esm/test/TestStores.js.map +1 -0
  677. package/docs/README.md +113 -0
  678. package/docs/api.md +1494 -0
  679. package/docs/concepts/attempts-and-replay.md +149 -0
  680. package/docs/concepts/cache-admission.md +265 -0
  681. package/docs/concepts/call-facts.md +86 -0
  682. package/docs/concepts/durable-waits.md +175 -0
  683. package/docs/concepts/execution-facts.md +90 -0
  684. package/docs/concepts/ownership-and-fencing.md +128 -0
  685. package/docs/concepts/step-boundaries.md +148 -0
  686. package/docs/concepts/workspace-transactions.md +199 -0
  687. package/docs/event-types.md +14 -0
  688. package/docs/guides/back-up-and-restore.md +164 -0
  689. package/docs/guides/collect-unreferenced-artifacts.md +128 -0
  690. package/docs/guides/compose-a-durable-engine.md +146 -0
  691. package/docs/guides/coordinate-two-processes.md +120 -0
  692. package/docs/guides/defer-work-with-selection.md +171 -0
  693. package/docs/guides/delete-old-run-history.md +154 -0
  694. package/docs/guides/drive-a-plan.md +314 -0
  695. package/docs/guides/observe-engine-metrics.md +98 -0
  696. package/docs/guides/observe-executions.md +187 -0
  697. package/docs/guides/reclaim-runs-from-a-dead-host.md +133 -0
  698. package/docs/guides/share-a-cache-across-machines.md +134 -0
  699. package/docs/guides/testing.md +123 -0
  700. package/docs/installation.md +102 -0
  701. package/docs/quickstart.md +215 -0
  702. package/docs/troubleshooting.md +347 -0
  703. package/package.json +438 -3
  704. package/src/ArtifactGc.ts +408 -0
  705. package/src/ArtifactSync.ts +278 -0
  706. package/src/CacheSync.ts +131 -0
  707. package/src/DeferredClockFold.ts +586 -0
  708. package/src/DisasterRecovery.ts +888 -0
  709. package/src/DurableEngineState.ts +2656 -0
  710. package/src/EngineStore.ts +656 -0
  711. package/src/EngineStoreMetrics.ts +331 -0
  712. package/src/Errors.ts +28 -0
  713. package/src/EventTypes.ts +27 -0
  714. package/src/ExecutionFacts.ts +125 -0
  715. package/src/ExecutionSnapshot.ts +186 -0
  716. package/src/Inconsistency.ts +253 -0
  717. package/src/Migrations.ts +95 -0
  718. package/src/OwnerIdentity.ts +125 -0
  719. package/src/PlanInputStore.ts +292 -0
  720. package/src/PlanMergeStore.ts +330 -0
  721. package/src/PlanScheduler.ts +1806 -0
  722. package/src/Reconciliation.ts +224 -0
  723. package/src/ReplayOnly.ts +95 -0
  724. package/src/Retention.ts +214 -0
  725. package/src/RunCatalogRead.ts +27 -0
  726. package/src/RunChangeFeed.ts +125 -0
  727. package/src/RunState.ts +137 -0
  728. package/src/Selection.ts +683 -0
  729. package/src/SelectionStore.ts +353 -0
  730. package/src/StepBoundary.ts +1165 -0
  731. package/src/StepCacheFold.ts +244 -0
  732. package/src/StepSandbox.ts +110 -0
  733. package/src/WakeBus.ts +167 -0
  734. package/src/WorkspaceSandbox.ts +1604 -0
  735. package/src/index.ts +185 -0
  736. package/src/internal/ActionPersistence.ts +2687 -0
  737. package/src/internal/ArtifactRoots.ts +92 -0
  738. package/src/internal/AttemptAdmission.ts +76 -0
  739. package/src/internal/AttemptLifecycle.ts +163 -0
  740. package/src/internal/AttemptProbe.ts +90 -0
  741. package/src/internal/CacheAdmission.ts +133 -0
  742. package/src/internal/CacheAgeHistory.ts +58 -0
  743. package/src/internal/CacheAgeVerdicts.ts +61 -0
  744. package/src/internal/CacheOutputPolicy.ts +82 -0
  745. package/src/internal/CachePublication.ts +153 -0
  746. package/src/internal/CallFacts.ts +87 -0
  747. package/src/internal/CopiedRecord.ts +201 -0
  748. package/src/internal/DeferredPersistence.ts +459 -0
  749. package/src/internal/EffectRecords.ts +136 -0
  750. package/src/internal/EngineJj.ts +30 -0
  751. package/src/internal/EngineStateSchema.ts +92 -0
  752. package/src/internal/ExecutionSnapshotRead.ts +300 -0
  753. package/src/internal/ExecutionSnapshotRelations.ts +121 -0
  754. package/src/internal/ExitEncoding.ts +453 -0
  755. package/src/internal/FileBoundarySnapshot.ts +39 -0
  756. package/src/internal/FileEnumeration.ts +334 -0
  757. package/src/internal/HostReflection.ts +128 -0
  758. package/src/internal/JournalRecords.ts +396 -0
  759. package/src/internal/NodeJournal.ts +340 -0
  760. package/src/internal/Ordering.ts +14 -0
  761. package/src/internal/PlanInputs.ts +62 -0
  762. package/src/internal/PlanMerges.ts +123 -0
  763. package/src/internal/ProvenanceSlot.ts +52 -0
  764. package/src/internal/ResultEnvelope.ts +118 -0
  765. package/src/internal/RetentionOps.ts +865 -0
  766. package/src/internal/RunCatalogOps.ts +174 -0
  767. package/src/internal/RunCoordinator.ts +215 -0
  768. package/src/internal/RunDriver.ts +3154 -0
  769. package/src/internal/RunLifecycle.ts +53 -0
  770. package/src/internal/RunListing.ts +210 -0
  771. package/src/internal/RunListingError.ts +37 -0
  772. package/src/internal/RuntimeGraph.ts +253 -0
  773. package/src/internal/SandboxedExecution.ts +165 -0
  774. package/src/internal/StateTransaction.ts +71 -0
  775. package/src/internal/StepFacts.ts +36 -0
  776. package/src/internal/TypedEvents.ts +29 -0
  777. package/src/migrations/0001_initial.ts +51 -0
  778. package/src/migrations/0002_selection_store.ts +38 -0
  779. package/src/migrations/0003_plan_inputs.ts +75 -0
  780. package/src/migrations/0004_plan_environment.ts +34 -0
  781. package/src/migrations/0005_plan_merges.ts +60 -0
  782. package/src/migrations/0006_execution_listing.ts +86 -0
  783. package/src/migrations/0007_run_parent_sequence.ts +19 -0
  784. package/src/migrations/0008_deferred_consumption.ts +27 -0
  785. package/src/migrations/0009_deferred_clock_facts.ts +163 -0
  786. package/src/migrations/0010_pending_cancellation.ts +20 -0
  787. package/src/test/TestStores.ts +145 -0
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Mark/sweep garbage collection for the content-addressed artifact store.
3
+ *
4
+ * The artifact tier is the one store in the composition with true *garbage*:
5
+ * every output over the inline bound is spilled to `.flows/objects` by digest
6
+ * (`StepBoundary`), nothing ever deletes a published blob, and a blob whose
7
+ * every referencing row is gone is unreachable forever. The step cache is
8
+ * deliberately NOT collected here — its rows are the *roots* of this graph,
9
+ * they never become unreachable, and removing one is the policy decision
10
+ * `CacheStore.evict` already serves.
11
+ *
12
+ * The design combines the two prior arts on the shelf:
13
+ *
14
+ * - **Reachability from durable roots** — git's `git gc` marks from refs;
15
+ * Skyframe deletes what a keyed graph walk cannot reach. Here the roots are
16
+ * every attempt row of every existing (never-deleted) run and every step
17
+ * cache entry; each carries boundary evidence, and
18
+ * `StepBoundary.referencedDigests` names the blobs that evidence needs.
19
+ * Attempt checkpoints are roots too: they are opaque executable state, so
20
+ * the mark keeps digest-shaped strings found in their JSON.
21
+ * - **A grace period over mtime** — git refuses to prune unreachable objects
22
+ * younger than `gc.pruneExpire` (two weeks), jj keeps operations newer than
23
+ * its keep bound, and Bazel's disk-cache collector
24
+ * (`reference/bazel/.../remote/disk/DiskCacheGarbageCollector.java`) fences
25
+ * on mtime. The cutoff is the collection start time minus the grace period,
26
+ * sampled before resolving policy pins or scanning roots and held fixed
27
+ * through inventory and deletion. Only mtimes strictly before it are
28
+ * eligible: a blob published — or freshened by a dedupe `put` — at or after
29
+ * collection start survives, including same-millisecond writes at zero
30
+ * grace, no lock required.
31
+ *
32
+ * Collection NEVER runs automatically. `gc()` is an explicit verb because
33
+ * deletion is irreversible, and a human approving a plan must approve the
34
+ * deletions too. The opt-in {@link ArtifactGcPolicy} layer
35
+ * configures *how* an invocation collects (grace bound, pinned digests); it
36
+ * does not schedule anything.
37
+ *
38
+ * @since 0.1.0
39
+ */
40
+
41
+ import * as ArtifactSweep from "@smthrs/artifacts/ArtifactSweep"
42
+ import * as Clock from "effect/Clock"
43
+ import * as Context from "effect/Context"
44
+ import * as Effect from "effect/Effect"
45
+ import type * as FileSystem from "effect/FileSystem"
46
+ import * as Layer from "effect/Layer"
47
+ import * as Option from "effect/Option"
48
+ import * as Schema from "effect/Schema"
49
+ import * as SqlClient from "effect/unstable/sql/SqlClient"
50
+ import * as ArtifactRoots from "./internal/ArtifactRoots.ts"
51
+
52
+ /**
53
+ * Stable error codes returned by artifact garbage collection.
54
+ *
55
+ * @category models
56
+ * @since 0.1.0
57
+ */
58
+ export const ArtifactGcErrorCode = Schema.Literals(["invalid_options", "mark_failed", "sweep_failed"])
59
+
60
+ /**
61
+ * Stable error codes returned by artifact garbage collection.
62
+ *
63
+ * @category models
64
+ * @since 0.1.0
65
+ */
66
+ export type ArtifactGcErrorCode = typeof ArtifactGcErrorCode.Type
67
+
68
+ /**
69
+ * A collection that could not complete. `mark_failed` means the live set
70
+ * could not be computed — nothing was deleted. `sweep_failed` means the live
71
+ * set held but a deletion refused; everything already swept was garbage, so a
72
+ * re-run converges from wherever the failure stopped it.
73
+ *
74
+ * @category errors
75
+ * @since 0.1.0
76
+ */
77
+ export class ArtifactGcError extends Schema.TaggedError<ArtifactGcError>()(
78
+ "@smthrs/engine-store/ArtifactGcError",
79
+ {
80
+ code: ArtifactGcErrorCode,
81
+ message: Schema.String,
82
+ cause: Schema.optional(Schema.Unknown)
83
+ }
84
+ ) {}
85
+
86
+ /**
87
+ * The opt-in collection policy. Explicit {@link GcOptions} on a `gc()` call
88
+ * override the installed policy; the policy overrides the defaults.
89
+ *
90
+ * @category models
91
+ * @since 0.1.0
92
+ */
93
+ export interface Policy {
94
+ /** Grace bound applied when a `gc()` call does not name one. */
95
+ readonly graceMs?: number | undefined
96
+ /**
97
+ * Digests held live regardless of reachability — the seam for references
98
+ * this composition's tables cannot see (an external index, an export a
99
+ * human wants kept). Resolved fresh on every collection.
100
+ */
101
+ readonly pins?: Effect.Effect<ReadonlyArray<string>> | undefined
102
+ }
103
+
104
+ /**
105
+ * Service tag for the opt-in collection policy.
106
+ *
107
+ * @category services
108
+ * @since 0.1.0
109
+ */
110
+ export class ArtifactGcPolicy extends Context.Service<ArtifactGcPolicy, Policy>()(
111
+ "@smthrs/engine-store/ArtifactGcPolicy"
112
+ ) {}
113
+
114
+ /**
115
+ * Installs a collection policy.
116
+ *
117
+ * @category layers
118
+ * @since 0.1.0
119
+ */
120
+ export const layerPolicy = (policy: Policy): Layer.Layer<ArtifactGcPolicy> => Layer.succeed(ArtifactGcPolicy)(policy)
121
+
122
+ /**
123
+ * Options for one explicit collection.
124
+ *
125
+ * @category models
126
+ * @since 0.1.0
127
+ */
128
+ export interface GcOptions {
129
+ /**
130
+ * How recently a blob must have been written or freshened to survive
131
+ * unreferenced. Defaults to the installed {@link ArtifactGcPolicy}'s bound,
132
+ * then to {@link defaultGraceMs}.
133
+ */
134
+ readonly graceMs?: number | undefined
135
+ /** Digests held live for this collection, unioned with the policy's pins. */
136
+ readonly pins?: ReadonlyArray<string> | undefined
137
+ /** Compute and report without deleting anything. */
138
+ readonly dryRun?: boolean | undefined
139
+ }
140
+
141
+ /**
142
+ * What one collection did.
143
+ *
144
+ * @category models
145
+ * @since 0.1.0
146
+ */
147
+ export interface GcReport {
148
+ /** Blobs the inventory enumerated. */
149
+ readonly scannedBlobs: number
150
+ /** Distinct digests the mark phase proved live, pins included. */
151
+ readonly liveDigests: number
152
+ /** Digests deleted — or, under `dryRun`, the ones a real run would delete. */
153
+ readonly sweptDigests: ReadonlyArray<string>
154
+ /** Bytes the swept blobs held. */
155
+ readonly reclaimedBytes: number
156
+ /** Unreferenced blobs retained by the grace bound or a freshen race. */
157
+ readonly keptByGrace: number
158
+ readonly dryRun: boolean
159
+ }
160
+
161
+ /**
162
+ * Explicit artifact garbage collection.
163
+ *
164
+ * @category models
165
+ * @since 0.1.0
166
+ */
167
+ export interface Service {
168
+ /**
169
+ * Marks the live set from the durable roots, then sweeps every blob that
170
+ * is both outside it and older than the grace bound. Explicit only —
171
+ * nothing in the engine composition ever calls this.
172
+ */
173
+ readonly gc: (options?: GcOptions) => Effect.Effect<GcReport, ArtifactGcError>
174
+ }
175
+
176
+ /**
177
+ * Service tag for artifact garbage collection.
178
+ *
179
+ * @category services
180
+ * @since 0.1.0
181
+ */
182
+ export class ArtifactGc extends Context.Service<ArtifactGc, Service>()("@smthrs/engine-store/ArtifactGc") {}
183
+
184
+ /**
185
+ * Two weeks, git's `gc.pruneExpire` default. The bound is deliberately far
186
+ * beyond any live attempt's duration: a blob spilled by a running step is
187
+ * unreferenced until its attempt row finishes, and the grace period is the
188
+ * only thing protecting it in that window.
189
+ *
190
+ * @category constants
191
+ * @since 0.1.0
192
+ */
193
+ export const defaultGraceMs = 14 * 24 * 60 * 60 * 1000
194
+
195
+ /**
196
+ * Construction options.
197
+ *
198
+ * @category models
199
+ * @since 0.1.0
200
+ */
201
+ export interface MakeOptions {
202
+ /** Rows per mark-phase page. Defaults to 500. */
203
+ readonly pageSize?: number | undefined
204
+ }
205
+
206
+ const markFailed = (message: string, cause: unknown): ArtifactGcError =>
207
+ new ArtifactGcError({ code: "mark_failed", message, cause })
208
+
209
+ const sweepFailed = (message: string, cause: unknown): ArtifactGcError =>
210
+ new ArtifactGcError({ code: "sweep_failed", message, cause })
211
+
212
+ const invalidOptions = (message: string): ArtifactGcError => new ArtifactGcError({ code: "invalid_options", message })
213
+
214
+ /**
215
+ * Extracts the digests one root row keeps live, FAIL-SAFE: a row whose
216
+ * metadata carries a `boundary` this build cannot decode aborts the
217
+ * collection rather than contributing nothing. Silently reading such a row as
218
+ * "references no artifacts" is exactly how a live blob gets collected; a
219
+ * metadata shape with no `boundary` key at all is the ordinary
220
+ * foreign-evidence case `referencedDigests` already defines as empty.
221
+ */
222
+ const rootDigests = (table: string, metaJson: string): Effect.Effect<ReadonlyArray<string>, ArtifactGcError> =>
223
+ ArtifactRoots.rootDigests(table, metaJson).pipe(
224
+ Effect.mapError((cause) => markFailed(cause.message, cause.cause))
225
+ )
226
+
227
+ const checkpointDigests = (checkpointJson: string | null): Effect.Effect<ReadonlyArray<string>, ArtifactGcError> =>
228
+ ArtifactRoots.checkpointDigests(checkpointJson).pipe(
229
+ Effect.mapError((cause) => markFailed(cause.message, cause.cause))
230
+ )
231
+
232
+ /**
233
+ * Builds the collector over the composition's own durable tables and the
234
+ * host-local sweep surface.
235
+ *
236
+ * The mark phase reads `flows_step_cache` and `flows_attempts` directly, the
237
+ * same way `DurableEngineState` range-scans `flows_runs`: this package
238
+ * composes every one of those migrations, so the schema is its own. Every run
239
+ * present in `flows_runs` is a live root — there is no deleted state, and the
240
+ * attempt table's foreign key guarantees each attempt's run exists — so the
241
+ * scan is simply *all* attempt rows plus *all* cache entries, paged by
242
+ * primary key so no page holds more than `pageSize` rows in memory.
243
+ *
244
+ * Ordering is the safety argument. The live set is computed BEFORE the
245
+ * inventory, so a root recorded during the sweep can only be missed, never
246
+ * half-seen — and the blob such a root references is protected anyway: a
247
+ * fresh publication carries a fresh mtime, a re-publication of existing bytes
248
+ * freshens the blob's mtime (`ArtifactStore.put`), and the sweep's deletion
249
+ * is fenced on that mtime (`ArtifactSweep.remove`'s `ifUnmodifiedSinceMs`).
250
+ * A crash mid-sweep deletes some garbage and no live blobs; re-running
251
+ * converges.
252
+ *
253
+ * @category constructors
254
+ * @since 0.1.0
255
+ */
256
+ export const make = (
257
+ options: MakeOptions = {}
258
+ ): Effect.Effect<Service, never, SqlClient.SqlClient | ArtifactSweep.ArtifactSweep> =>
259
+ Effect.gen(function*() {
260
+ const sql = yield* Effect.service(SqlClient.SqlClient)
261
+ const sweeper = yield* ArtifactSweep.ArtifactSweep
262
+ const policy = yield* Effect.serviceOption(ArtifactGcPolicy)
263
+ const pageSize = options.pageSize ?? 500
264
+
265
+ const markCacheEntries = (live: Set<string>) =>
266
+ Effect.gen(function*() {
267
+ let after = ""
268
+ for (;;) {
269
+ const rows = yield* sql<{ readonly key_digest: string; readonly meta_json: string }>`
270
+ SELECT key_digest, meta_json FROM flows_step_cache
271
+ WHERE key_digest > ${after}
272
+ ORDER BY key_digest
273
+ LIMIT ${pageSize}
274
+ `.pipe(Effect.mapError((cause) => markFailed("the step cache could not be scanned", cause)))
275
+ for (const row of rows) {
276
+ for (const digest of yield* rootDigests("flows_step_cache", row.meta_json)) {
277
+ live.add(digest)
278
+ }
279
+ }
280
+ if (rows.length < pageSize) return
281
+ after = rows[rows.length - 1]!.key_digest
282
+ }
283
+ })
284
+
285
+ const markAttempts = (live: Set<string>) =>
286
+ Effect.gen(function*() {
287
+ let after = { runId: "", stepKeyDigest: "", attempt: -1 }
288
+ for (;;) {
289
+ const rows = yield* sql<{
290
+ readonly run_id: string
291
+ readonly step_key_digest: string
292
+ readonly attempt: number
293
+ readonly checkpoint_json: string | null
294
+ readonly meta_json: string
295
+ }>`
296
+ SELECT run_id, step_key_digest, attempt, checkpoint_json, meta_json FROM flows_attempts
297
+ WHERE (run_id, step_key_digest, attempt) > (${after.runId}, ${after.stepKeyDigest}, ${after.attempt})
298
+ ORDER BY run_id, step_key_digest, attempt
299
+ LIMIT ${pageSize}
300
+ `.pipe(Effect.mapError((cause) => markFailed("the attempt table could not be scanned", cause)))
301
+ for (const row of rows) {
302
+ for (const digest of yield* rootDigests("flows_attempts", row.meta_json)) {
303
+ live.add(digest)
304
+ }
305
+ for (const digest of yield* checkpointDigests(row.checkpoint_json)) {
306
+ live.add(digest)
307
+ }
308
+ }
309
+ if (rows.length < pageSize) return
310
+ const last = rows[rows.length - 1]!
311
+ after = { runId: last.run_id, stepKeyDigest: last.step_key_digest, attempt: last.attempt }
312
+ }
313
+ })
314
+
315
+ const gc: Service["gc"] = Effect.fn("ArtifactGc.gc")((gcOptions) =>
316
+ Effect.gen(function*() {
317
+ if (!Number.isSafeInteger(pageSize) || pageSize < 1) {
318
+ return yield* Effect.fail(invalidOptions("artifact GC pageSize must be a positive safe integer"))
319
+ }
320
+ const grace = gcOptions?.graceMs ??
321
+ (Option.isSome(policy) ? policy.value.graceMs : undefined) ??
322
+ defaultGraceMs
323
+ if (!Number.isSafeInteger(grace) || grace < 0) {
324
+ return yield* Effect.fail(invalidOptions("artifact GC graceMs must be a non-negative safe integer"))
325
+ }
326
+ const startedAtMs = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor))
327
+ const bound = startedAtMs - grace
328
+ const live = new Set<string>(gcOptions?.pins ?? [])
329
+ if (Option.isSome(policy) && policy.value.pins !== undefined) {
330
+ for (const digest of yield* policy.value.pins) live.add(digest)
331
+ }
332
+ yield* markCacheEntries(live)
333
+ yield* markAttempts(live)
334
+ const blobs = yield* sweeper.inventory.pipe(
335
+ Effect.mapError((cause) => sweepFailed(`the blob inventory refused: ${cause.message}`, cause))
336
+ )
337
+ const swept: Array<string> = []
338
+ let reclaimedBytes = 0
339
+ let keptByGrace = 0
340
+ for (const blob of blobs) {
341
+ if (live.has(blob.digest)) continue
342
+ if (blob.modifiedAtMs >= bound) {
343
+ keptByGrace++
344
+ continue
345
+ }
346
+ if (gcOptions?.dryRun === true) {
347
+ swept.push(blob.digest)
348
+ reclaimedBytes += blob.sizeBytes
349
+ continue
350
+ }
351
+ // The fence re-reads the blob's age inside the deletion: an
352
+ // unreferenced-at-mark blob a concurrent `put` freshened since the
353
+ // inventory fails the fence and is retained, exactly as a fresher
354
+ // cache row survives a laggard's fenced evict (issue #119).
355
+ // remove's fence is inclusive; mtimes have millisecond resolution,
356
+ // so exclude cutoff equality there just as in the inventory check.
357
+ const removed = yield* sweeper.remove(blob.digest, { ifUnmodifiedSinceMs: bound - 1 }).pipe(
358
+ Effect.mapError((cause) => sweepFailed(`sweeping ${blob.digest} refused: ${cause.message}`, cause))
359
+ )
360
+ if (removed) {
361
+ swept.push(blob.digest)
362
+ reclaimedBytes += blob.sizeBytes
363
+ } else {
364
+ keptByGrace++
365
+ }
366
+ }
367
+ return {
368
+ scannedBlobs: blobs.length,
369
+ liveDigests: live.size,
370
+ sweptDigests: swept,
371
+ reclaimedBytes,
372
+ keptByGrace,
373
+ dryRun: gcOptions?.dryRun === true
374
+ }
375
+ })
376
+ )
377
+
378
+ return { gc }
379
+ })
380
+
381
+ /**
382
+ * Provides the artifact garbage collector. Install {@link layerPolicy} into
383
+ * this layer's inputs to configure collection; nothing schedules `gc()` —
384
+ * invoking it stays an explicit caller decision.
385
+ *
386
+ * @category layers
387
+ * @since 0.1.0
388
+ */
389
+ export const layer = (
390
+ options: MakeOptions = {}
391
+ ): Layer.Layer<ArtifactGc, never, SqlClient.SqlClient | ArtifactSweep.ArtifactSweep> =>
392
+ Layer.effect(ArtifactGc)(make(options))
393
+
394
+ /**
395
+ * Provides the artifact garbage collector over a filesystem objects directory:
396
+ * {@link layer} with `ArtifactSweep.layerFileSystem` beneath it. Pass the same
397
+ * `directory` and `coordination` the paired `ArtifactStore.layerFileSystem`
398
+ * publishes with.
399
+ *
400
+ * @category layers
401
+ * @since 1.0.0
402
+ */
403
+ export const layerFileSystem = (
404
+ options: MakeOptions & ArtifactSweep.SweepOptions = {}
405
+ ): Layer.Layer<ArtifactGc, never, SqlClient.SqlClient | FileSystem.FileSystem> =>
406
+ layer(options).pipe(
407
+ Layer.provide(ArtifactSweep.layerFileSystem({ directory: options.directory, coordination: options.coordination }))
408
+ )
@@ -0,0 +1,278 @@
1
+ /**
2
+ * The two-tier artifact protocol the step cache rides on: publish before the
3
+ * entry, fetch on demand after it.
4
+ *
5
+ * This is the seam that makes a shared cache safe. A cache entry references
6
+ * its large outputs by digest, so an entry that becomes observable while one
7
+ * of those artifacts is still missing hands the next machine a hit it cannot
8
+ * materialize. Bazel states the constraint at
9
+ * `reference/bazel/.../remote/UploadManifest.java:630-633` — "action results
10
+ * may fail to validate server-side if they are accessed before all blobs they
11
+ * refer to are present" — and enforces it by ordering:
12
+ * `findMissingDigests` → upload the missing → upload the `ActionResult` LAST.
13
+ * {@link Service.publish} is that ordering, and `ActionPersistence` calls it
14
+ * before `CacheStore.put`.
15
+ *
16
+ * The read direction is the same protocol in reverse, and how eagerly it runs
17
+ * is the {@link DownloadPolicy}, declared on the shared tier itself
18
+ * (`RemoteArtifacts.Options.downloadPolicy`) and split across two seams.
19
+ * `all` fetches every referenced artifact into this host's store while
20
+ * admitting the replay. `toplevel` and `minimal` fetch nothing here: one
21
+ * batched probe establishes that the shared tier can serve them and the
22
+ * transfer is left to the first read through `CombinedArtifacts`, which then
23
+ * writes the blob back under `toplevel` and does not under `minimal`. This is
24
+ * Bazel's `RemoteOutputChecker` dial
25
+ * (`--remote_download_{all,toplevel,minimal}`) split the way our two seams
26
+ * split: what a replay prefetches is this module's decision, what a read
27
+ * materializes is the combined store's.
28
+ *
29
+ * Governing design: `packages/smithers/flows/artifacts/docs/api.md`.
30
+ *
31
+ * @since 0.1.0
32
+ */
33
+
34
+ import * as ArtifactStore from "@smthrs/artifacts/ArtifactStore"
35
+ import * as RemoteArtifacts from "@smthrs/artifacts/RemoteArtifacts"
36
+ import * as Context from "effect/Context"
37
+ import type * as Crypto from "effect/Crypto"
38
+ import * as Effect from "effect/Effect"
39
+ import * as Layer from "effect/Layer"
40
+ import * as Schema from "effect/Schema"
41
+
42
+ /**
43
+ * A referenced artifact could not be made durable in the shared tier, so the
44
+ * cache entry that references it must not be published.
45
+ *
46
+ * Failing here is the point: silently publishing the entry anyway is exactly
47
+ * the state the REAPI ordering constraint exists to prevent.
48
+ *
49
+ * @since 0.1.0
50
+ * @category errors
51
+ */
52
+ export class ArtifactPublicationFailed extends Schema.TaggedError<ArtifactPublicationFailed>()(
53
+ "@smthrs/engine-store/ArtifactPublicationFailed",
54
+ {
55
+ code: Schema.Literal("artifact_publication_failed"),
56
+ digests: Schema.Array(Schema.String),
57
+ message: Schema.String,
58
+ cause: Schema.optional(
59
+ Schema.Union([
60
+ ArtifactStore.ArtifactStoreError,
61
+ ArtifactStore.ArtifactMissing,
62
+ ArtifactStore.ArtifactCorruption
63
+ ])
64
+ )
65
+ }
66
+ ) {}
67
+
68
+ /**
69
+ * How eagerly a replay materializes the artifacts it references.
70
+ *
71
+ * `all` downloads every referenced artifact into this host's local store while
72
+ * the replay is admitted, so every later read is local and a shared tier that
73
+ * goes down afterwards costs nothing. `minimal` downloads none of them: it
74
+ * establishes that each digest is resolvable — locally, or from the shared tier
75
+ * — and lets the first actual read fetch the bytes.
76
+ *
77
+ * `minimal` is only sound when the store the replay reads through can reach the
78
+ * shared tier, which means `CombinedArtifacts` with the same remote tier. Under
79
+ * a purely local `ArtifactStore` an admitted `minimal` replay would later read
80
+ * an artifact this host never fetched.
81
+ *
82
+ * @since 0.1.0
83
+ * @category models
84
+ */
85
+ export type DownloadPolicy = RemoteArtifacts.DownloadPolicy
86
+
87
+ /**
88
+ * The two directions of the artifact protocol: {@link Service.publish} before a
89
+ * cache entry becomes observable, {@link Service.hydrate} when a replay needs
90
+ * bytes this host does not have.
91
+ *
92
+ * The asymmetry in their error types is the design: publishing may fail,
93
+ * because publishing an entry whose artifacts are missing is the unsafe state;
94
+ * hydrating never fails, because a shared tier that is down should cost a run
95
+ * a cache hit, not the run itself.
96
+ *
97
+ * @since 0.1.0
98
+ * @category services
99
+ */
100
+ export interface Service {
101
+ /**
102
+ * Makes every digest durable in the shared tier, in REAPI order:
103
+ * `findMissing`, upload what is missing, then confirm nothing is missing
104
+ * any more. Returns only once the shared tier can serve all of them.
105
+ */
106
+ readonly publish: (
107
+ digests: ReadonlyArray<string>
108
+ ) => Effect.Effect<void, ArtifactPublicationFailed, Crypto.Crypto>
109
+ /**
110
+ * Fetches the digests this host is missing from the shared tier and writes
111
+ * them into the local store, reporting whether every digest is now locally
112
+ * resolvable.
113
+ *
114
+ * Best-effort by construction: `false` means "replay still cannot be
115
+ * satisfied", which the caller turns into a real execution. A shared tier
116
+ * that is down must never fail a run that can simply do the work.
117
+ */
118
+ readonly hydrate: (
119
+ digests: ReadonlyArray<string>
120
+ ) => Effect.Effect<boolean, never, Crypto.Crypto>
121
+ }
122
+
123
+ /**
124
+ * Service tag for the two-tier artifact protocol.
125
+ *
126
+ * @since 0.1.0
127
+ * @category services
128
+ */
129
+ export class ArtifactSync extends Context.Service<ArtifactSync, Service>()("@smthrs/engine-store/ArtifactSync") {}
130
+
131
+ /**
132
+ * The single-tier implementation: there is no shared artifact store, so there
133
+ * is nothing to publish and nothing to fetch.
134
+ *
135
+ * This is the default `ActionPersistence` falls back to when the tag is
136
+ * absent, which is what keeps a purely local composition free of any
137
+ * remote-cache machinery.
138
+ *
139
+ * @since 0.1.0
140
+ * @category constructors
141
+ */
142
+ export const makeLocal = (): Service => ({
143
+ publish: Effect.fn("ArtifactSync.publish")(() => Effect.void),
144
+ hydrate: Effect.fn("ArtifactSync.hydrate")((digests) => Effect.succeed(digests.length === 0))
145
+ })
146
+
147
+ /**
148
+ * Provides the single-tier (no shared artifact store) protocol.
149
+ *
150
+ * @since 0.1.0
151
+ * @category layers
152
+ */
153
+ export const layerLocal: Layer.Layer<ArtifactSync> = Layer.succeed(ArtifactSync)(makeLocal())
154
+
155
+ /**
156
+ * Builds the two-tier protocol over a local and a shared artifact store.
157
+ *
158
+ * @since 0.1.0
159
+ * @category constructors
160
+ */
161
+ export const make = (options: {
162
+ readonly local: ArtifactStore.Service
163
+ readonly remote: ArtifactStore.Service
164
+ /**
165
+ * Defaults to the policy the shared tier declares, and to `all` for a tier
166
+ * that declares none: every referenced artifact is fetched at hydrate.
167
+ */
168
+ readonly downloadPolicy?: DownloadPolicy | undefined
169
+ }): Service => {
170
+ const { local, remote } = options
171
+ const downloadPolicy = options.downloadPolicy ?? RemoteArtifacts.downloadPolicyOf(remote) ?? "all"
172
+ const publicationFailed = (
173
+ digests: ReadonlyArray<string>,
174
+ message: string,
175
+ cause?: ArtifactStore.ArtifactStoreError | ArtifactStore.ArtifactMissing | ArtifactStore.ArtifactCorruption
176
+ ) => new ArtifactPublicationFailed({ code: "artifact_publication_failed", digests, message, cause })
177
+ return {
178
+ publish: Effect.fn("ArtifactSync.publish")(function*(digests) {
179
+ if (digests.length === 0) return
180
+ const missing = yield* remote.findMissing(digests).pipe(
181
+ Effect.mapError((cause) => publicationFailed(digests, "the shared tier refused a probe", cause))
182
+ )
183
+ for (const digest of missing) {
184
+ const bytes = yield* local.get(digest).pipe(
185
+ Effect.mapError((cause) =>
186
+ // The blob is referenced by evidence this host just produced, so
187
+ // it should be in this host's own store. If it is not, the
188
+ // evidence is not publishable — and saying so is far better than
189
+ // publishing an entry nobody can replay.
190
+ publicationFailed([digest], "this host cannot read the artifact it recorded", cause)
191
+ )
192
+ )
193
+ yield* remote.put(bytes).pipe(
194
+ Effect.mapError((cause) => publicationFailed([digest], "the shared tier refused an upload", cause))
195
+ )
196
+ }
197
+ if (missing.length === 0) return
198
+ // The confirming re-probe is not paranoia: a tier that accepted the
199
+ // upload but did not durably store it is exactly the state that makes a
200
+ // published entry unreplayable, and it is cheap to rule out — one
201
+ // batched round trip over the set we just wrote.
202
+ const stillMissing = yield* remote.findMissing(missing).pipe(
203
+ Effect.mapError((cause) => publicationFailed(missing, "the shared tier refused a probe", cause))
204
+ )
205
+ if (stillMissing.length > 0) {
206
+ return yield* Effect.fail(
207
+ publicationFailed(stillMissing, "the shared tier did not retain the uploaded artifacts")
208
+ )
209
+ }
210
+ }),
211
+ hydrate: Effect.fn("ArtifactSync.hydrate")(function*(digests) {
212
+ // Every refusal below falls back to re-executing the step, which is
213
+ // correct and silent. The warning is the operator's only signal that a
214
+ // tier stopped serving replays.
215
+ const fallBack = (message: string, digests: ReadonlyArray<string>) => (cause: { readonly message: string }) =>
216
+ Effect.logWarning(`artifact hydration falls back to re-execution: ${message}: ${digests.join(", ")}`).pipe(
217
+ Effect.annotateLogs({ reason: cause.message })
218
+ )
219
+ const missing = yield* local.findMissing(digests).pipe(
220
+ Effect.tapError(fallBack("the local tier refused a probe", digests)),
221
+ Effect.option
222
+ )
223
+ if (missing._tag === "None") return false
224
+ if (downloadPolicy !== "all") {
225
+ if (missing.value.length === 0) return true
226
+ // One batched probe, no body transfer: the answer these policies owe
227
+ // the caller is "can this replay be satisfied", and `findMissing`
228
+ // answers exactly that. A tier that refuses the probe is
229
+ // indistinguishable from one that holds nothing, so the replay is
230
+ // refused either way.
231
+ const elsewhere = yield* remote.findMissing(missing.value).pipe(
232
+ Effect.tapError(fallBack("the shared tier refused a probe", missing.value)),
233
+ Effect.option
234
+ )
235
+ return elsewhere._tag === "Some" && elsewhere.value.length === 0
236
+ }
237
+ for (const digest of missing.value) {
238
+ // Read-through, one artifact at a time and only on demand: the remote
239
+ // read is digest-verified by `RemoteArtifacts`, and the local `put`
240
+ // re-addresses the bytes, so a tier serving wrong content cannot get
241
+ // them written into this workspace.
242
+ const written = yield* remote.get(digest).pipe(
243
+ Effect.flatMap((bytes) => local.put(bytes)),
244
+ Effect.tapError(fallBack("the artifact could not be fetched", [digest])),
245
+ Effect.option
246
+ )
247
+ if (written._tag === "None") return false
248
+ }
249
+ return true
250
+ })
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Provides the two-tier protocol, taking the local store from the
256
+ * `ArtifactStore` tag and the shared store from the supplied effect.
257
+ *
258
+ * The two tiers cannot both be layers: they inhabit the same tag, so composing
259
+ * them would shadow one with the other.
260
+ *
261
+ * @since 0.1.0
262
+ * @category layers
263
+ */
264
+ export const layer = <E, R>(
265
+ remote: Effect.Effect<ArtifactStore.Service, E, R>,
266
+ options?: { readonly downloadPolicy?: DownloadPolicy | undefined } | undefined
267
+ ): Layer.Layer<ArtifactSync, E, ArtifactStore.ArtifactStore | R> =>
268
+ Layer.effect(ArtifactSync)(
269
+ Effect.gen(function*() {
270
+ const local = yield* ArtifactStore.ArtifactStore
271
+ const shared = yield* remote
272
+ return make({
273
+ local,
274
+ remote: shared,
275
+ ...(options?.downloadPolicy === undefined ? {} : { downloadPolicy: options.downloadPolicy })
276
+ })
277
+ })
278
+ )