@smthrs/engine-store 0.0.0-stage → 1.0.0-rc.3
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.
- package/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +146 -2
- package/dist/cjs/ArtifactGc.d.ts +235 -0
- package/dist/cjs/ArtifactGc.d.ts.map +1 -0
- package/dist/cjs/ArtifactGc.js +183 -0
- package/dist/cjs/ArtifactGc.js.map +7 -0
- package/dist/cjs/ArtifactSync.d.ts +164 -0
- package/dist/cjs/ArtifactSync.d.ts.map +1 -0
- package/dist/cjs/ArtifactSync.js +144 -0
- package/dist/cjs/ArtifactSync.js.map +7 -0
- package/dist/cjs/CacheSync.d.ts +112 -0
- package/dist/cjs/CacheSync.d.ts.map +1 -0
- package/dist/cjs/CacheSync.js +64 -0
- package/dist/cjs/CacheSync.js.map +7 -0
- package/dist/cjs/DeferredClockFold.d.ts +354 -0
- package/dist/cjs/DeferredClockFold.d.ts.map +1 -0
- package/dist/cjs/DeferredClockFold.js +335 -0
- package/dist/cjs/DeferredClockFold.js.map +7 -0
- package/dist/cjs/DisasterRecovery.d.ts +431 -0
- package/dist/cjs/DisasterRecovery.d.ts.map +1 -0
- package/dist/cjs/DisasterRecovery.js +453 -0
- package/dist/cjs/DisasterRecovery.js.map +7 -0
- package/dist/cjs/DurableEngineState.d.ts +776 -0
- package/dist/cjs/DurableEngineState.d.ts.map +1 -0
- package/dist/cjs/DurableEngineState.js +1536 -0
- package/dist/cjs/DurableEngineState.js.map +7 -0
- package/dist/cjs/EngineStore.d.ts +158 -0
- package/dist/cjs/EngineStore.d.ts.map +1 -0
- package/dist/cjs/EngineStore.js +398 -0
- package/dist/cjs/EngineStore.js.map +7 -0
- package/dist/cjs/EngineStoreMetrics.d.ts +276 -0
- package/dist/cjs/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/cjs/EngineStoreMetrics.js +135 -0
- package/dist/cjs/EngineStoreMetrics.js.map +7 -0
- package/dist/cjs/Errors.d.ts +22 -0
- package/dist/cjs/Errors.d.ts.map +1 -0
- package/dist/cjs/Errors.js +39 -0
- package/dist/cjs/Errors.js.map +7 -0
- package/dist/cjs/EventTypes.d.ts +27 -0
- package/dist/cjs/EventTypes.d.ts.map +1 -0
- package/dist/cjs/EventTypes.js +37 -0
- package/dist/cjs/EventTypes.js.map +7 -0
- package/dist/cjs/ExecutionFacts.d.ts +59 -0
- package/dist/cjs/ExecutionFacts.d.ts.map +1 -0
- package/dist/cjs/ExecutionFacts.js +123 -0
- package/dist/cjs/ExecutionFacts.js.map +7 -0
- package/dist/cjs/ExecutionSnapshot.d.ts +117 -0
- package/dist/cjs/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/cjs/ExecutionSnapshot.js +111 -0
- package/dist/cjs/ExecutionSnapshot.js.map +7 -0
- package/dist/cjs/Inconsistency.d.ts +154 -0
- package/dist/cjs/Inconsistency.d.ts.map +1 -0
- package/dist/cjs/Inconsistency.js +135 -0
- package/dist/cjs/Inconsistency.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +56 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +78 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/OwnerIdentity.d.ts +91 -0
- package/dist/cjs/OwnerIdentity.d.ts.map +1 -0
- package/dist/cjs/OwnerIdentity.js +65 -0
- package/dist/cjs/OwnerIdentity.js.map +7 -0
- package/dist/cjs/PlanInputStore.d.ts +110 -0
- package/dist/cjs/PlanInputStore.d.ts.map +1 -0
- package/dist/cjs/PlanInputStore.js +224 -0
- package/dist/cjs/PlanInputStore.js.map +7 -0
- package/dist/cjs/PlanMergeStore.d.ts +113 -0
- package/dist/cjs/PlanMergeStore.d.ts.map +1 -0
- package/dist/cjs/PlanMergeStore.js +255 -0
- package/dist/cjs/PlanMergeStore.js.map +7 -0
- package/dist/cjs/PlanScheduler.d.ts +363 -0
- package/dist/cjs/PlanScheduler.d.ts.map +1 -0
- package/dist/cjs/PlanScheduler.js +1090 -0
- package/dist/cjs/PlanScheduler.js.map +7 -0
- package/dist/cjs/Reconciliation.d.ts +175 -0
- package/dist/cjs/Reconciliation.d.ts.map +1 -0
- package/dist/cjs/Reconciliation.js +119 -0
- package/dist/cjs/Reconciliation.js.map +7 -0
- package/dist/cjs/ReplayOnly.d.ts +91 -0
- package/dist/cjs/ReplayOnly.d.ts.map +1 -0
- package/dist/cjs/ReplayOnly.js +52 -0
- package/dist/cjs/ReplayOnly.js.map +7 -0
- package/dist/cjs/Retention.d.ts +113 -0
- package/dist/cjs/Retention.d.ts.map +1 -0
- package/dist/cjs/Retention.js +99 -0
- package/dist/cjs/Retention.js.map +7 -0
- package/dist/cjs/RunCatalogRead.d.ts +17 -0
- package/dist/cjs/RunCatalogRead.d.ts.map +1 -0
- package/dist/cjs/RunCatalogRead.js +33 -0
- package/dist/cjs/RunCatalogRead.js.map +7 -0
- package/dist/cjs/RunChangeFeed.d.ts +75 -0
- package/dist/cjs/RunChangeFeed.d.ts.map +1 -0
- package/dist/cjs/RunChangeFeed.js +96 -0
- package/dist/cjs/RunChangeFeed.js.map +7 -0
- package/dist/cjs/RunState.d.ts +116 -0
- package/dist/cjs/RunState.d.ts.map +1 -0
- package/dist/cjs/RunState.js +76 -0
- package/dist/cjs/RunState.js.map +7 -0
- package/dist/cjs/Selection.d.ts +495 -0
- package/dist/cjs/Selection.d.ts.map +1 -0
- package/dist/cjs/Selection.js +288 -0
- package/dist/cjs/Selection.js.map +7 -0
- package/dist/cjs/SelectionStore.d.ts +141 -0
- package/dist/cjs/SelectionStore.d.ts.map +1 -0
- package/dist/cjs/SelectionStore.js +229 -0
- package/dist/cjs/SelectionStore.js.map +7 -0
- package/dist/cjs/StepBoundary.d.ts +501 -0
- package/dist/cjs/StepBoundary.d.ts.map +1 -0
- package/dist/cjs/StepBoundary.js +619 -0
- package/dist/cjs/StepBoundary.js.map +7 -0
- package/dist/cjs/StepCacheFold.d.ts +148 -0
- package/dist/cjs/StepCacheFold.d.ts.map +1 -0
- package/dist/cjs/StepCacheFold.js +131 -0
- package/dist/cjs/StepCacheFold.js.map +7 -0
- package/dist/cjs/StepSandbox.d.ts +78 -0
- package/dist/cjs/StepSandbox.d.ts.map +1 -0
- package/dist/cjs/StepSandbox.js +75 -0
- package/dist/cjs/StepSandbox.js.map +7 -0
- package/dist/cjs/WakeBus.d.ts +116 -0
- package/dist/cjs/WakeBus.d.ts.map +1 -0
- package/dist/cjs/WakeBus.js +89 -0
- package/dist/cjs/WakeBus.js.map +7 -0
- package/dist/cjs/WorkspaceSandbox.d.ts +619 -0
- package/dist/cjs/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/cjs/WorkspaceSandbox.js +711 -0
- package/dist/cjs/WorkspaceSandbox.js.map +7 -0
- package/dist/cjs/index.d.ts +157 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +95 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ActionPersistence.d.ts +276 -0
- package/dist/cjs/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/ActionPersistence.js +1395 -0
- package/dist/cjs/internal/ActionPersistence.js.map +7 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts +38 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/cjs/internal/ArtifactRoots.js +89 -0
- package/dist/cjs/internal/ArtifactRoots.js.map +7 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts +53 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptAdmission.js +52 -0
- package/dist/cjs/internal/AttemptAdmission.js.map +7 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptLifecycle.js +112 -0
- package/dist/cjs/internal/AttemptLifecycle.js.map +7 -0
- package/dist/cjs/internal/AttemptProbe.d.ts +53 -0
- package/dist/cjs/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptProbe.js +66 -0
- package/dist/cjs/internal/AttemptProbe.js.map +7 -0
- package/dist/cjs/internal/CacheAdmission.d.ts +79 -0
- package/dist/cjs/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAdmission.js +71 -0
- package/dist/cjs/internal/CacheAdmission.js.map +7 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeHistory.js +61 -0
- package/dist/cjs/internal/CacheAgeHistory.js.map +7 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js +73 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js.map +7 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/cjs/internal/CacheOutputPolicy.js +75 -0
- package/dist/cjs/internal/CacheOutputPolicy.js.map +7 -0
- package/dist/cjs/internal/CachePublication.d.ts +97 -0
- package/dist/cjs/internal/CachePublication.d.ts.map +1 -0
- package/dist/cjs/internal/CachePublication.js +80 -0
- package/dist/cjs/internal/CachePublication.js.map +7 -0
- package/dist/cjs/internal/CallFacts.d.ts +15 -0
- package/dist/cjs/internal/CallFacts.d.ts.map +1 -0
- package/dist/cjs/internal/CallFacts.js +97 -0
- package/dist/cjs/internal/CallFacts.js.map +7 -0
- package/dist/cjs/internal/CopiedRecord.d.ts +61 -0
- package/dist/cjs/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/cjs/internal/CopiedRecord.js +134 -0
- package/dist/cjs/internal/CopiedRecord.js.map +7 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts +108 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/DeferredPersistence.js +270 -0
- package/dist/cjs/internal/DeferredPersistence.js.map +7 -0
- package/dist/cjs/internal/EffectRecords.d.ts +92 -0
- package/dist/cjs/internal/EffectRecords.d.ts.map +1 -0
- package/dist/cjs/internal/EffectRecords.js +63 -0
- package/dist/cjs/internal/EffectRecords.js.map +7 -0
- package/dist/cjs/internal/EngineJj.d.ts +30 -0
- package/dist/cjs/internal/EngineJj.d.ts.map +1 -0
- package/dist/cjs/internal/EngineJj.js +42 -0
- package/dist/cjs/internal/EngineJj.js.map +7 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts +68 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/cjs/internal/EngineStateSchema.js +58 -0
- package/dist/cjs/internal/EngineStateSchema.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js +199 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js +105 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js.map +7 -0
- package/dist/cjs/internal/ExitEncoding.d.ts +180 -0
- package/dist/cjs/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/cjs/internal/ExitEncoding.js +236 -0
- package/dist/cjs/internal/ExitEncoding.js.map +7 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js +51 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js.map +7 -0
- package/dist/cjs/internal/FileEnumeration.d.ts +127 -0
- package/dist/cjs/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/cjs/internal/FileEnumeration.js +194 -0
- package/dist/cjs/internal/FileEnumeration.js.map +7 -0
- package/dist/cjs/internal/HostReflection.d.ts +80 -0
- package/dist/cjs/internal/HostReflection.d.ts.map +1 -0
- package/dist/cjs/internal/HostReflection.js +43 -0
- package/dist/cjs/internal/HostReflection.js.map +7 -0
- package/dist/cjs/internal/JournalRecords.d.ts +325 -0
- package/dist/cjs/internal/JournalRecords.d.ts.map +1 -0
- package/dist/cjs/internal/JournalRecords.js +122 -0
- package/dist/cjs/internal/JournalRecords.js.map +7 -0
- package/dist/cjs/internal/NodeJournal.d.ts +157 -0
- package/dist/cjs/internal/NodeJournal.d.ts.map +1 -0
- package/dist/cjs/internal/NodeJournal.js +192 -0
- package/dist/cjs/internal/NodeJournal.js.map +7 -0
- package/dist/cjs/internal/Ordering.d.ts +14 -0
- package/dist/cjs/internal/Ordering.d.ts.map +1 -0
- package/dist/cjs/internal/Ordering.js +25 -0
- package/dist/cjs/internal/Ordering.js.map +7 -0
- package/dist/cjs/internal/PlanInputs.d.ts +14 -0
- package/dist/cjs/internal/PlanInputs.d.ts.map +1 -0
- package/dist/cjs/internal/PlanInputs.js +78 -0
- package/dist/cjs/internal/PlanInputs.js.map +7 -0
- package/dist/cjs/internal/PlanMerges.d.ts +178 -0
- package/dist/cjs/internal/PlanMerges.d.ts.map +1 -0
- package/dist/cjs/internal/PlanMerges.js +125 -0
- package/dist/cjs/internal/PlanMerges.js.map +7 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/cjs/internal/ProvenanceSlot.js +53 -0
- package/dist/cjs/internal/ProvenanceSlot.js.map +7 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts +88 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/cjs/internal/ResultEnvelope.js +90 -0
- package/dist/cjs/internal/ResultEnvelope.js.map +7 -0
- package/dist/cjs/internal/RetentionOps.d.ts +414 -0
- package/dist/cjs/internal/RetentionOps.d.ts.map +1 -0
- package/dist/cjs/internal/RetentionOps.js +354 -0
- package/dist/cjs/internal/RetentionOps.js.map +7 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts +118 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/cjs/internal/RunCatalogOps.js +85 -0
- package/dist/cjs/internal/RunCatalogOps.js.map +7 -0
- package/dist/cjs/internal/RunCoordinator.d.ts +78 -0
- package/dist/cjs/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/cjs/internal/RunCoordinator.js +123 -0
- package/dist/cjs/internal/RunCoordinator.js.map +7 -0
- package/dist/cjs/internal/RunDriver.d.ts +192 -0
- package/dist/cjs/internal/RunDriver.d.ts.map +1 -0
- package/dist/cjs/internal/RunDriver.js +1584 -0
- package/dist/cjs/internal/RunDriver.js.map +7 -0
- package/dist/cjs/internal/RunLifecycle.d.ts +22 -0
- package/dist/cjs/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/RunLifecycle.js +63 -0
- package/dist/cjs/internal/RunLifecycle.js.map +7 -0
- package/dist/cjs/internal/RunListing.d.ts +78 -0
- package/dist/cjs/internal/RunListing.d.ts.map +1 -0
- package/dist/cjs/internal/RunListing.js +171 -0
- package/dist/cjs/internal/RunListing.js.map +7 -0
- package/dist/cjs/internal/RunListingError.d.ts +35 -0
- package/dist/cjs/internal/RunListingError.d.ts.map +1 -0
- package/dist/cjs/internal/RunListingError.js +47 -0
- package/dist/cjs/internal/RunListingError.js.map +7 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts +73 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/cjs/internal/RuntimeGraph.js +180 -0
- package/dist/cjs/internal/RuntimeGraph.js.map +7 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts +80 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/cjs/internal/SandboxedExecution.js +104 -0
- package/dist/cjs/internal/SandboxedExecution.js.map +7 -0
- package/dist/cjs/internal/StateTransaction.d.ts +44 -0
- package/dist/cjs/internal/StateTransaction.d.ts.map +1 -0
- package/dist/cjs/internal/StateTransaction.js +52 -0
- package/dist/cjs/internal/StateTransaction.js.map +7 -0
- package/dist/cjs/internal/StepFacts.d.ts +14 -0
- package/dist/cjs/internal/StepFacts.d.ts.map +1 -0
- package/dist/cjs/internal/StepFacts.js +58 -0
- package/dist/cjs/internal/StepFacts.js.map +7 -0
- package/dist/cjs/internal/TypedEvents.d.ts +14 -0
- package/dist/cjs/internal/TypedEvents.d.ts.map +1 -0
- package/dist/cjs/internal/TypedEvents.js +37 -0
- package/dist/cjs/internal/TypedEvents.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +17 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +61 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts +15 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_selection_store.js +56 -0
- package/dist/cjs/migrations/0002_selection_store.js.map +7 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_plan_inputs.js +90 -0
- package/dist/cjs/migrations/0003_plan_inputs.js.map +7 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_plan_environment.js +56 -0
- package/dist/cjs/migrations/0004_plan_environment.js.map +7 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_plan_merges.js +82 -0
- package/dist/cjs/migrations/0005_plan_merges.js.map +7 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_execution_listing.js +101 -0
- package/dist/cjs/migrations/0006_execution_listing.js.map +7 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js +40 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js.map +7 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js +45 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js.map +7 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js +141 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js.map +7 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js +41 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/TestStores.d.ts +89 -0
- package/dist/cjs/test/TestStores.d.ts.map +1 -0
- package/dist/cjs/test/TestStores.js +98 -0
- package/dist/cjs/test/TestStores.js.map +7 -0
- package/dist/esm/ArtifactGc.d.ts +235 -0
- package/dist/esm/ArtifactGc.d.ts.map +1 -0
- package/dist/esm/ArtifactGc.js +268 -0
- package/dist/esm/ArtifactGc.js.map +1 -0
- package/dist/esm/ArtifactSync.d.ts +164 -0
- package/dist/esm/ArtifactSync.d.ts.map +1 -0
- package/dist/esm/ArtifactSync.js +176 -0
- package/dist/esm/ArtifactSync.js.map +1 -0
- package/dist/esm/CacheSync.d.ts +112 -0
- package/dist/esm/CacheSync.d.ts.map +1 -0
- package/dist/esm/CacheSync.js +94 -0
- package/dist/esm/CacheSync.js.map +1 -0
- package/dist/esm/DeferredClockFold.d.ts +354 -0
- package/dist/esm/DeferredClockFold.d.ts.map +1 -0
- package/dist/esm/DeferredClockFold.js +472 -0
- package/dist/esm/DeferredClockFold.js.map +1 -0
- package/dist/esm/DisasterRecovery.d.ts +431 -0
- package/dist/esm/DisasterRecovery.d.ts.map +1 -0
- package/dist/esm/DisasterRecovery.js +523 -0
- package/dist/esm/DisasterRecovery.js.map +1 -0
- package/dist/esm/DurableEngineState.d.ts +776 -0
- package/dist/esm/DurableEngineState.d.ts.map +1 -0
- package/dist/esm/DurableEngineState.js +1648 -0
- package/dist/esm/DurableEngineState.js.map +1 -0
- package/dist/esm/EngineStore.d.ts +158 -0
- package/dist/esm/EngineStore.d.ts.map +1 -0
- package/dist/esm/EngineStore.js +403 -0
- package/dist/esm/EngineStore.js.map +1 -0
- package/dist/esm/EngineStoreMetrics.d.ts +276 -0
- package/dist/esm/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/esm/EngineStoreMetrics.js +260 -0
- package/dist/esm/EngineStoreMetrics.js.map +1 -0
- package/dist/esm/Errors.d.ts +22 -0
- package/dist/esm/Errors.d.ts.map +1 -0
- package/dist/esm/Errors.js +22 -0
- package/dist/esm/Errors.js.map +1 -0
- package/dist/esm/EventTypes.d.ts +27 -0
- package/dist/esm/EventTypes.d.ts.map +1 -0
- package/dist/esm/EventTypes.js +27 -0
- package/dist/esm/EventTypes.js.map +1 -0
- package/dist/esm/ExecutionFacts.d.ts +59 -0
- package/dist/esm/ExecutionFacts.d.ts.map +1 -0
- package/dist/esm/ExecutionFacts.js +96 -0
- package/dist/esm/ExecutionFacts.js.map +1 -0
- package/dist/esm/ExecutionSnapshot.d.ts +117 -0
- package/dist/esm/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/esm/ExecutionSnapshot.js +95 -0
- package/dist/esm/ExecutionSnapshot.js.map +1 -0
- package/dist/esm/Inconsistency.d.ts +154 -0
- package/dist/esm/Inconsistency.d.ts.map +1 -0
- package/dist/esm/Inconsistency.js +133 -0
- package/dist/esm/Inconsistency.js.map +1 -0
- package/dist/esm/Migrations.d.ts +56 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +91 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/OwnerIdentity.d.ts +91 -0
- package/dist/esm/OwnerIdentity.d.ts.map +1 -0
- package/dist/esm/OwnerIdentity.js +99 -0
- package/dist/esm/OwnerIdentity.js.map +1 -0
- package/dist/esm/PlanInputStore.d.ts +110 -0
- package/dist/esm/PlanInputStore.d.ts.map +1 -0
- package/dist/esm/PlanInputStore.js +207 -0
- package/dist/esm/PlanInputStore.js.map +1 -0
- package/dist/esm/PlanMergeStore.d.ts +113 -0
- package/dist/esm/PlanMergeStore.d.ts.map +1 -0
- package/dist/esm/PlanMergeStore.js +244 -0
- package/dist/esm/PlanMergeStore.js.map +1 -0
- package/dist/esm/PlanScheduler.d.ts +363 -0
- package/dist/esm/PlanScheduler.d.ts.map +1 -0
- package/dist/esm/PlanScheduler.js +1321 -0
- package/dist/esm/PlanScheduler.js.map +1 -0
- package/dist/esm/Reconciliation.d.ts +175 -0
- package/dist/esm/Reconciliation.d.ts.map +1 -0
- package/dist/esm/Reconciliation.js +175 -0
- package/dist/esm/Reconciliation.js.map +1 -0
- package/dist/esm/ReplayOnly.d.ts +91 -0
- package/dist/esm/ReplayOnly.d.ts.map +1 -0
- package/dist/esm/ReplayOnly.js +59 -0
- package/dist/esm/ReplayOnly.js.map +1 -0
- package/dist/esm/Retention.d.ts +113 -0
- package/dist/esm/Retention.d.ts.map +1 -0
- package/dist/esm/Retention.js +139 -0
- package/dist/esm/Retention.js.map +1 -0
- package/dist/esm/RunCatalogRead.d.ts +17 -0
- package/dist/esm/RunCatalogRead.d.ts.map +1 -0
- package/dist/esm/RunCatalogRead.js +17 -0
- package/dist/esm/RunCatalogRead.js.map +1 -0
- package/dist/esm/RunChangeFeed.d.ts +75 -0
- package/dist/esm/RunChangeFeed.d.ts.map +1 -0
- package/dist/esm/RunChangeFeed.js +81 -0
- package/dist/esm/RunChangeFeed.js.map +1 -0
- package/dist/esm/RunState.d.ts +116 -0
- package/dist/esm/RunState.d.ts.map +1 -0
- package/dist/esm/RunState.js +109 -0
- package/dist/esm/RunState.js.map +1 -0
- package/dist/esm/Selection.d.ts +495 -0
- package/dist/esm/Selection.d.ts.map +1 -0
- package/dist/esm/Selection.js +482 -0
- package/dist/esm/Selection.js.map +1 -0
- package/dist/esm/SelectionStore.d.ts +141 -0
- package/dist/esm/SelectionStore.d.ts.map +1 -0
- package/dist/esm/SelectionStore.js +215 -0
- package/dist/esm/SelectionStore.js.map +1 -0
- package/dist/esm/StepBoundary.d.ts +501 -0
- package/dist/esm/StepBoundary.d.ts.map +1 -0
- package/dist/esm/StepBoundary.js +919 -0
- package/dist/esm/StepBoundary.js.map +1 -0
- package/dist/esm/StepCacheFold.d.ts +148 -0
- package/dist/esm/StepCacheFold.d.ts.map +1 -0
- package/dist/esm/StepCacheFold.js +201 -0
- package/dist/esm/StepCacheFold.js.map +1 -0
- package/dist/esm/StepSandbox.d.ts +78 -0
- package/dist/esm/StepSandbox.d.ts.map +1 -0
- package/dist/esm/StepSandbox.js +70 -0
- package/dist/esm/StepSandbox.js.map +1 -0
- package/dist/esm/WakeBus.d.ts +116 -0
- package/dist/esm/WakeBus.d.ts.map +1 -0
- package/dist/esm/WakeBus.js +121 -0
- package/dist/esm/WakeBus.js.map +1 -0
- package/dist/esm/WorkspaceSandbox.d.ts +619 -0
- package/dist/esm/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/esm/WorkspaceSandbox.js +985 -0
- package/dist/esm/WorkspaceSandbox.js.map +1 -0
- package/dist/esm/index.d.ts +157 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +157 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ActionPersistence.d.ts +276 -0
- package/dist/esm/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/esm/internal/ActionPersistence.js +2306 -0
- package/dist/esm/internal/ActionPersistence.js.map +1 -0
- package/dist/esm/internal/ArtifactRoots.d.ts +38 -0
- package/dist/esm/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/esm/internal/ArtifactRoots.js +76 -0
- package/dist/esm/internal/ArtifactRoots.js.map +1 -0
- package/dist/esm/internal/AttemptAdmission.d.ts +53 -0
- package/dist/esm/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/esm/internal/AttemptAdmission.js +52 -0
- package/dist/esm/internal/AttemptAdmission.js.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.js +104 -0
- package/dist/esm/internal/AttemptLifecycle.js.map +1 -0
- package/dist/esm/internal/AttemptProbe.d.ts +53 -0
- package/dist/esm/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/esm/internal/AttemptProbe.js +83 -0
- package/dist/esm/internal/AttemptProbe.js.map +1 -0
- package/dist/esm/internal/CacheAdmission.d.ts +79 -0
- package/dist/esm/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/esm/internal/CacheAdmission.js +72 -0
- package/dist/esm/internal/CacheAdmission.js.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.js +49 -0
- package/dist/esm/internal/CacheAgeHistory.js.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.js +54 -0
- package/dist/esm/internal/CacheAgeVerdicts.js.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.js +73 -0
- package/dist/esm/internal/CacheOutputPolicy.js.map +1 -0
- package/dist/esm/internal/CachePublication.d.ts +97 -0
- package/dist/esm/internal/CachePublication.d.ts.map +1 -0
- package/dist/esm/internal/CachePublication.js +116 -0
- package/dist/esm/internal/CachePublication.js.map +1 -0
- package/dist/esm/internal/CallFacts.d.ts +15 -0
- package/dist/esm/internal/CallFacts.d.ts.map +1 -0
- package/dist/esm/internal/CallFacts.js +83 -0
- package/dist/esm/internal/CallFacts.js.map +1 -0
- package/dist/esm/internal/CopiedRecord.d.ts +61 -0
- package/dist/esm/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/esm/internal/CopiedRecord.js +165 -0
- package/dist/esm/internal/CopiedRecord.js.map +1 -0
- package/dist/esm/internal/DeferredPersistence.d.ts +108 -0
- package/dist/esm/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/esm/internal/DeferredPersistence.js +240 -0
- package/dist/esm/internal/DeferredPersistence.js.map +1 -0
- package/dist/esm/internal/EffectRecords.d.ts +92 -0
- package/dist/esm/internal/EffectRecords.d.ts.map +1 -0
- package/dist/esm/internal/EffectRecords.js +94 -0
- package/dist/esm/internal/EffectRecords.js.map +1 -0
- package/dist/esm/internal/EngineJj.d.ts +30 -0
- package/dist/esm/internal/EngineJj.d.ts.map +1 -0
- package/dist/esm/internal/EngineJj.js +29 -0
- package/dist/esm/internal/EngineJj.js.map +1 -0
- package/dist/esm/internal/EngineStateSchema.d.ts +68 -0
- package/dist/esm/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/esm/internal/EngineStateSchema.js +53 -0
- package/dist/esm/internal/EngineStateSchema.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js +218 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js +81 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js.map +1 -0
- package/dist/esm/internal/ExitEncoding.d.ts +180 -0
- package/dist/esm/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/esm/internal/ExitEncoding.js +361 -0
- package/dist/esm/internal/ExitEncoding.js.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.js +29 -0
- package/dist/esm/internal/FileBoundarySnapshot.js.map +1 -0
- package/dist/esm/internal/FileEnumeration.d.ts +127 -0
- package/dist/esm/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/esm/internal/FileEnumeration.js +236 -0
- package/dist/esm/internal/FileEnumeration.js.map +1 -0
- package/dist/esm/internal/HostReflection.d.ts +80 -0
- package/dist/esm/internal/HostReflection.d.ts.map +1 -0
- package/dist/esm/internal/HostReflection.js +98 -0
- package/dist/esm/internal/HostReflection.js.map +1 -0
- package/dist/esm/internal/JournalRecords.d.ts +325 -0
- package/dist/esm/internal/JournalRecords.d.ts.map +1 -0
- package/dist/esm/internal/JournalRecords.js +306 -0
- package/dist/esm/internal/JournalRecords.js.map +1 -0
- package/dist/esm/internal/NodeJournal.d.ts +157 -0
- package/dist/esm/internal/NodeJournal.d.ts.map +1 -0
- package/dist/esm/internal/NodeJournal.js +298 -0
- package/dist/esm/internal/NodeJournal.js.map +1 -0
- package/dist/esm/internal/Ordering.d.ts +14 -0
- package/dist/esm/internal/Ordering.d.ts.map +1 -0
- package/dist/esm/internal/Ordering.js +14 -0
- package/dist/esm/internal/Ordering.js.map +1 -0
- package/dist/esm/internal/PlanInputs.d.ts +14 -0
- package/dist/esm/internal/PlanInputs.d.ts.map +1 -0
- package/dist/esm/internal/PlanInputs.js +57 -0
- package/dist/esm/internal/PlanInputs.js.map +1 -0
- package/dist/esm/internal/PlanMerges.d.ts +178 -0
- package/dist/esm/internal/PlanMerges.d.ts.map +1 -0
- package/dist/esm/internal/PlanMerges.js +113 -0
- package/dist/esm/internal/PlanMerges.js.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.js +39 -0
- package/dist/esm/internal/ProvenanceSlot.js.map +1 -0
- package/dist/esm/internal/ResultEnvelope.d.ts +88 -0
- package/dist/esm/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/esm/internal/ResultEnvelope.js +83 -0
- package/dist/esm/internal/ResultEnvelope.js.map +1 -0
- package/dist/esm/internal/RetentionOps.d.ts +414 -0
- package/dist/esm/internal/RetentionOps.d.ts.map +1 -0
- package/dist/esm/internal/RetentionOps.js +576 -0
- package/dist/esm/internal/RetentionOps.js.map +1 -0
- package/dist/esm/internal/RunCatalogOps.d.ts +118 -0
- package/dist/esm/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/esm/internal/RunCatalogOps.js +120 -0
- package/dist/esm/internal/RunCatalogOps.js.map +1 -0
- package/dist/esm/internal/RunCoordinator.d.ts +78 -0
- package/dist/esm/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/esm/internal/RunCoordinator.js +115 -0
- package/dist/esm/internal/RunCoordinator.js.map +1 -0
- package/dist/esm/internal/RunDriver.d.ts +192 -0
- package/dist/esm/internal/RunDriver.d.ts.map +1 -0
- package/dist/esm/internal/RunDriver.js +2334 -0
- package/dist/esm/internal/RunDriver.js.map +1 -0
- package/dist/esm/internal/RunLifecycle.d.ts +22 -0
- package/dist/esm/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/RunLifecycle.js +49 -0
- package/dist/esm/internal/RunLifecycle.js.map +1 -0
- package/dist/esm/internal/RunListing.d.ts +78 -0
- package/dist/esm/internal/RunListing.d.ts.map +1 -0
- package/dist/esm/internal/RunListing.js +146 -0
- package/dist/esm/internal/RunListing.js.map +1 -0
- package/dist/esm/internal/RunListingError.d.ts +35 -0
- package/dist/esm/internal/RunListingError.d.ts.map +1 -0
- package/dist/esm/internal/RunListingError.js +27 -0
- package/dist/esm/internal/RunListingError.js.map +1 -0
- package/dist/esm/internal/RuntimeGraph.d.ts +73 -0
- package/dist/esm/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/esm/internal/RuntimeGraph.js +182 -0
- package/dist/esm/internal/RuntimeGraph.js.map +1 -0
- package/dist/esm/internal/SandboxedExecution.d.ts +80 -0
- package/dist/esm/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/esm/internal/SandboxedExecution.js +107 -0
- package/dist/esm/internal/SandboxedExecution.js.map +1 -0
- package/dist/esm/internal/StateTransaction.d.ts +44 -0
- package/dist/esm/internal/StateTransaction.d.ts.map +1 -0
- package/dist/esm/internal/StateTransaction.js +54 -0
- package/dist/esm/internal/StateTransaction.js.map +1 -0
- package/dist/esm/internal/StepFacts.d.ts +14 -0
- package/dist/esm/internal/StepFacts.d.ts.map +1 -0
- package/dist/esm/internal/StepFacts.js +35 -0
- package/dist/esm/internal/StepFacts.js.map +1 -0
- package/dist/esm/internal/TypedEvents.d.ts +14 -0
- package/dist/esm/internal/TypedEvents.d.ts.map +1 -0
- package/dist/esm/internal/TypedEvents.js +14 -0
- package/dist/esm/internal/TypedEvents.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +17 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +41 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_selection_store.d.ts +15 -0
- package/dist/esm/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/esm/migrations/0002_selection_store.js +34 -0
- package/dist/esm/migrations/0002_selection_store.js.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.js +70 -0
- package/dist/esm/migrations/0003_plan_inputs.js.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.js +33 -0
- package/dist/esm/migrations/0004_plan_environment.js.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.js +59 -0
- package/dist/esm/migrations/0005_plan_merges.js.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.js +81 -0
- package/dist/esm/migrations/0006_execution_listing.js.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js +18 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.js +24 -0
- package/dist/esm/migrations/0008_deferred_consumption.js.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js +127 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.js +19 -0
- package/dist/esm/migrations/0010_pending_cancellation.js.map +1 -0
- package/dist/esm/test/TestStores.d.ts +89 -0
- package/dist/esm/test/TestStores.d.ts.map +1 -0
- package/dist/esm/test/TestStores.js +103 -0
- package/dist/esm/test/TestStores.js.map +1 -0
- package/docs/README.md +113 -0
- package/docs/api.md +1494 -0
- package/docs/concepts/attempts-and-replay.md +149 -0
- package/docs/concepts/cache-admission.md +265 -0
- package/docs/concepts/call-facts.md +86 -0
- package/docs/concepts/durable-waits.md +175 -0
- package/docs/concepts/execution-facts.md +90 -0
- package/docs/concepts/ownership-and-fencing.md +128 -0
- package/docs/concepts/step-boundaries.md +148 -0
- package/docs/concepts/workspace-transactions.md +199 -0
- package/docs/event-types.md +14 -0
- package/docs/guides/back-up-and-restore.md +164 -0
- package/docs/guides/collect-unreferenced-artifacts.md +128 -0
- package/docs/guides/compose-a-durable-engine.md +146 -0
- package/docs/guides/coordinate-two-processes.md +120 -0
- package/docs/guides/defer-work-with-selection.md +171 -0
- package/docs/guides/delete-old-run-history.md +154 -0
- package/docs/guides/drive-a-plan.md +314 -0
- package/docs/guides/observe-engine-metrics.md +98 -0
- package/docs/guides/observe-executions.md +187 -0
- package/docs/guides/reclaim-runs-from-a-dead-host.md +133 -0
- package/docs/guides/share-a-cache-across-machines.md +134 -0
- package/docs/guides/testing.md +123 -0
- package/docs/installation.md +102 -0
- package/docs/quickstart.md +215 -0
- package/docs/troubleshooting.md +347 -0
- package/package.json +438 -3
- package/src/ArtifactGc.ts +408 -0
- package/src/ArtifactSync.ts +278 -0
- package/src/CacheSync.ts +131 -0
- package/src/DeferredClockFold.ts +586 -0
- package/src/DisasterRecovery.ts +888 -0
- package/src/DurableEngineState.ts +2656 -0
- package/src/EngineStore.ts +656 -0
- package/src/EngineStoreMetrics.ts +331 -0
- package/src/Errors.ts +28 -0
- package/src/EventTypes.ts +27 -0
- package/src/ExecutionFacts.ts +125 -0
- package/src/ExecutionSnapshot.ts +186 -0
- package/src/Inconsistency.ts +253 -0
- package/src/Migrations.ts +95 -0
- package/src/OwnerIdentity.ts +125 -0
- package/src/PlanInputStore.ts +292 -0
- package/src/PlanMergeStore.ts +330 -0
- package/src/PlanScheduler.ts +1806 -0
- package/src/Reconciliation.ts +224 -0
- package/src/ReplayOnly.ts +95 -0
- package/src/Retention.ts +214 -0
- package/src/RunCatalogRead.ts +27 -0
- package/src/RunChangeFeed.ts +125 -0
- package/src/RunState.ts +137 -0
- package/src/Selection.ts +683 -0
- package/src/SelectionStore.ts +353 -0
- package/src/StepBoundary.ts +1165 -0
- package/src/StepCacheFold.ts +244 -0
- package/src/StepSandbox.ts +110 -0
- package/src/WakeBus.ts +167 -0
- package/src/WorkspaceSandbox.ts +1604 -0
- package/src/index.ts +185 -0
- package/src/internal/ActionPersistence.ts +2687 -0
- package/src/internal/ArtifactRoots.ts +92 -0
- package/src/internal/AttemptAdmission.ts +76 -0
- package/src/internal/AttemptLifecycle.ts +163 -0
- package/src/internal/AttemptProbe.ts +90 -0
- package/src/internal/CacheAdmission.ts +133 -0
- package/src/internal/CacheAgeHistory.ts +58 -0
- package/src/internal/CacheAgeVerdicts.ts +61 -0
- package/src/internal/CacheOutputPolicy.ts +82 -0
- package/src/internal/CachePublication.ts +153 -0
- package/src/internal/CallFacts.ts +87 -0
- package/src/internal/CopiedRecord.ts +201 -0
- package/src/internal/DeferredPersistence.ts +459 -0
- package/src/internal/EffectRecords.ts +136 -0
- package/src/internal/EngineJj.ts +30 -0
- package/src/internal/EngineStateSchema.ts +92 -0
- package/src/internal/ExecutionSnapshotRead.ts +298 -0
- package/src/internal/ExecutionSnapshotRelations.ts +121 -0
- package/src/internal/ExitEncoding.ts +453 -0
- package/src/internal/FileBoundarySnapshot.ts +39 -0
- package/src/internal/FileEnumeration.ts +334 -0
- package/src/internal/HostReflection.ts +128 -0
- package/src/internal/JournalRecords.ts +396 -0
- package/src/internal/NodeJournal.ts +340 -0
- package/src/internal/Ordering.ts +14 -0
- package/src/internal/PlanInputs.ts +62 -0
- package/src/internal/PlanMerges.ts +123 -0
- package/src/internal/ProvenanceSlot.ts +52 -0
- package/src/internal/ResultEnvelope.ts +118 -0
- package/src/internal/RetentionOps.ts +865 -0
- package/src/internal/RunCatalogOps.ts +174 -0
- package/src/internal/RunCoordinator.ts +215 -0
- package/src/internal/RunDriver.ts +3152 -0
- package/src/internal/RunLifecycle.ts +53 -0
- package/src/internal/RunListing.ts +210 -0
- package/src/internal/RunListingError.ts +37 -0
- package/src/internal/RuntimeGraph.ts +253 -0
- package/src/internal/SandboxedExecution.ts +165 -0
- package/src/internal/StateTransaction.ts +71 -0
- package/src/internal/StepFacts.ts +36 -0
- package/src/internal/TypedEvents.ts +29 -0
- package/src/migrations/0001_initial.ts +51 -0
- package/src/migrations/0002_selection_store.ts +38 -0
- package/src/migrations/0003_plan_inputs.ts +75 -0
- package/src/migrations/0004_plan_environment.ts +34 -0
- package/src/migrations/0005_plan_merges.ts +60 -0
- package/src/migrations/0006_execution_listing.ts +86 -0
- package/src/migrations/0007_run_parent_sequence.ts +19 -0
- package/src/migrations/0008_deferred_consumption.ts +27 -0
- package/src/migrations/0009_deferred_clock_facts.ts +163 -0
- package/src/migrations/0010_pending_cancellation.ts +20 -0
- package/src/test/TestStores.ts +145 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retention: the one operation that deletes finished run state.
|
|
3
|
+
*
|
|
4
|
+
* Nothing in the composition removed a `flows_runs` row or anything that hangs
|
|
5
|
+
* off one. Every run a workspace ever finished stayed in `.flows/engine.db`
|
|
6
|
+
* with its attempts, its persisted deferred completions and clock deadlines,
|
|
7
|
+
* its journal entries, and its checkpoints, and journal compaction is off by
|
|
8
|
+
* default (`SqlJournal` `Options.compaction`), so the file only grew. This
|
|
9
|
+
* module is the deletion side, and the whole of it: one operation, run
|
|
10
|
+
* explicitly.
|
|
11
|
+
*
|
|
12
|
+
* Three properties make it safe to run against a live workspace.
|
|
13
|
+
*
|
|
14
|
+
* - **One transaction.** Every delete runs inside a single `journal.transact`,
|
|
15
|
+
* so a crash leaves either a run with all of its rows or none of them —
|
|
16
|
+
* never a run row whose history is gone, or history whose run row is gone.
|
|
17
|
+
* - **Terminal and aged only.** A run is a candidate only when its status is
|
|
18
|
+
* `completed`, `failed`, or `cancelled` AND it finished before the cutoff.
|
|
19
|
+
* A running, pending, or suspended run is never a candidate at any age.
|
|
20
|
+
* - **Nothing a live run still needs.** A candidate is retained when a live
|
|
21
|
+
* run stands on either side of it in the lineage, over BOTH relations that
|
|
22
|
+
* make one run the parent of another: the `flows_run_parents` edge a spawned
|
|
23
|
+
* child is recorded under, and the reserved `parent_run_id` column the
|
|
24
|
+
* rounds of one trampoline lineage are chained through. Upward: an aged
|
|
25
|
+
* terminal run with a live ancestor stays, because a parent reads a settled
|
|
26
|
+
* child's result out of its run row (`agent/await`) and a parent parked on
|
|
27
|
+
* an approval, a deferred, or a timer can be parked for longer than the
|
|
28
|
+
* threshold before it ever asks. Downward: an aged terminal run whose
|
|
29
|
+
* descendant is still live stays, because deleting it would leave that
|
|
30
|
+
* descendant's `parent_run_id` pointing at nothing and would drop the live
|
|
31
|
+
* descendant's lineage edges with the `flows_run_parents_gc` trigger.
|
|
32
|
+
* - **Explicit.** Nothing schedules this. Automatic retention stays opt-in,
|
|
33
|
+
* for the reason `ArtifactGc` states: deletion is the irreversible
|
|
34
|
+
* direction, and a human approving a plan must be approving the deletions.
|
|
35
|
+
*
|
|
36
|
+
* Journal history is deleted outright rather than compacted to a checkpoint.
|
|
37
|
+
* `Journal.checkpoint` and `Journal.compact` are owner-fenced — `SqlJournal`'s
|
|
38
|
+
* `fenceGuard` requires a consensus lease held by the exact owner passed in —
|
|
39
|
+
* so neither can be called for a finished, ownerless run at all. Deleting the run's entries and checkpoints is strictly stronger than
|
|
40
|
+
* compacting them to a checkpoint, and it happens in the same transaction as
|
|
41
|
+
* the run row, which is the property a compaction could not have given.
|
|
42
|
+
*
|
|
43
|
+
* The operation is idempotent. With a positive integer limit and a fixed,
|
|
44
|
+
* finite, acyclic run lineage, each successful non-dry pass deletes at least
|
|
45
|
+
* one collectable run until none remain. Continuation children are selected
|
|
46
|
+
* before parents; parents pinned by excluded children do not consume the
|
|
47
|
+
* bound. Runs protected by age or live lineage remain until eligible.
|
|
48
|
+
*
|
|
49
|
+
* @since 0.1.0
|
|
50
|
+
*/
|
|
51
|
+
import * as Dialect from "@smthrs/database/Dialect";
|
|
52
|
+
import * as Journal from "@smthrs/journal/Journal";
|
|
53
|
+
import * as JournalEvent from "@smthrs/journal/JournalEvent";
|
|
54
|
+
import * as RunStore from "@smthrs/run-store/RunStore";
|
|
55
|
+
import * as Clock from "effect/Clock";
|
|
56
|
+
import * as Context from "effect/Context";
|
|
57
|
+
import * as Effect from "effect/Effect";
|
|
58
|
+
import * as Layer from "effect/Layer";
|
|
59
|
+
import * as Schema from "effect/Schema";
|
|
60
|
+
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
61
|
+
/**
|
|
62
|
+
* Stable error codes returned by retention.
|
|
63
|
+
*
|
|
64
|
+
* @category models
|
|
65
|
+
* @since 0.1.0
|
|
66
|
+
*/
|
|
67
|
+
export const RetentionErrorCode = Schema.Literals(["scan_failed", "delete_failed"]);
|
|
68
|
+
/**
|
|
69
|
+
* A retention pass that could not complete.
|
|
70
|
+
*
|
|
71
|
+
* `scan_failed` means the candidate set could not be computed and nothing was
|
|
72
|
+
* deleted. `delete_failed` means the candidate set held but a delete refused;
|
|
73
|
+
* the transaction rolled back, so nothing was deleted then either, and
|
|
74
|
+
* re-running converges once the cause is fixed.
|
|
75
|
+
*
|
|
76
|
+
* @category errors
|
|
77
|
+
* @since 0.1.0
|
|
78
|
+
*/
|
|
79
|
+
export class RetentionError extends Schema.TaggedError()("@smthrs/engine-store/RetentionError", {
|
|
80
|
+
code: RetentionErrorCode,
|
|
81
|
+
message: Schema.String,
|
|
82
|
+
cause: Schema.optional(Schema.Unknown)
|
|
83
|
+
}) {
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Service tag for run retention.
|
|
87
|
+
*
|
|
88
|
+
* @category services
|
|
89
|
+
* @since 0.1.0
|
|
90
|
+
*/
|
|
91
|
+
export class Retention extends Context.Service()("@smthrs/engine-store/Retention") {
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Runs deleted by one pass when the caller names no bound. Large enough that
|
|
95
|
+
* an ordinary workspace finishes in one pass, small enough that the write
|
|
96
|
+
* transaction stays short on a workspace that has never been collected.
|
|
97
|
+
*
|
|
98
|
+
* @category constants
|
|
99
|
+
* @since 0.1.0
|
|
100
|
+
*/
|
|
101
|
+
export const defaultLimit = 1000;
|
|
102
|
+
/**
|
|
103
|
+
* Run ids per `IN (...)` list. SQLite's default host-parameter ceiling is 999.
|
|
104
|
+
*
|
|
105
|
+
* @category constants
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
*/
|
|
108
|
+
const chunkSize = 500;
|
|
109
|
+
/**
|
|
110
|
+
* The journal companion streams a run owns beside its own stream. A deleted
|
|
111
|
+
* run's companion streams go with it.
|
|
112
|
+
*
|
|
113
|
+
* @category constants
|
|
114
|
+
* @since 1.0.0
|
|
115
|
+
*/
|
|
116
|
+
export const companionStreams = [RunStore.companionStream];
|
|
117
|
+
/**
|
|
118
|
+
* Every table a deleted run leaves rows in, and the column naming the run.
|
|
119
|
+
*
|
|
120
|
+
* ONE inventory, because two passes read it: {@link Service.retain} over the
|
|
121
|
+
* engine ladder, and `Retention.collect` over whatever a host's file holds. A
|
|
122
|
+
* table listed by only one of them is a table the other leaks forever. Tables
|
|
123
|
+
* are listed rather than discovered from foreign keys because the set spans
|
|
124
|
+
* six packages that migrate into one database, and a silently missing entry is
|
|
125
|
+
* exactly that leak.
|
|
126
|
+
*
|
|
127
|
+
* The run rows themselves are not here: they go last and in generation order,
|
|
128
|
+
* which {@link deleteRuns} does after this list.
|
|
129
|
+
* `flows_time_travel_receipts` is reached through its audit rather than listed
|
|
130
|
+
* here because the upstream table has no run column: its `audit_id` points to
|
|
131
|
+
* `flows_time_travel_audits.id`, whose row carries `run_id`.
|
|
132
|
+
*
|
|
133
|
+
* @category constants
|
|
134
|
+
* @since 0.1.0
|
|
135
|
+
*/
|
|
136
|
+
export const runScopedTables = [
|
|
137
|
+
{ table: "flows_deferred_completions", column: "execution_id", ladder: true },
|
|
138
|
+
{ table: "flows_clock_deadlines", column: "execution_id", ladder: true },
|
|
139
|
+
{ table: "flows_attempts", column: "run_id", ladder: true },
|
|
140
|
+
{ table: "flows_journal_events", column: "run_id", ladder: true, companions: true },
|
|
141
|
+
{ table: "flows_journal_checkpoints", column: "run_id", ladder: true, companions: true },
|
|
142
|
+
{ table: "flows_journal_dedup", column: "run_id", ladder: true, companions: true },
|
|
143
|
+
{ table: "flows_consensus_leases", column: "run_id", ladder: true },
|
|
144
|
+
{ table: "flows_step_cache_recorded", column: "recorded_run_id", ladder: true },
|
|
145
|
+
{ table: "flows_time_travel_archive", column: "run_id", ladder: false },
|
|
146
|
+
{ table: "flows_time_travel_snapshots", column: "run_id", ladder: false },
|
|
147
|
+
{ table: "flows_time_travel_audits", column: "run_id", ladder: false },
|
|
148
|
+
{ table: "flows_time_travel_edges", column: "child_run_id", ladder: false },
|
|
149
|
+
{ table: "control_run_messages", column: "run_id", ladder: false },
|
|
150
|
+
{ table: "control_runs", column: "run_id", ladder: false }
|
|
151
|
+
];
|
|
152
|
+
/**
|
|
153
|
+
* The statuses a run can never leave.
|
|
154
|
+
*
|
|
155
|
+
* @category constants
|
|
156
|
+
* @since 1.0.0
|
|
157
|
+
*/
|
|
158
|
+
export const terminalStatuses = ["completed", "failed", "cancelled"];
|
|
159
|
+
/** `terminalStatuses` as a SQL list, for the lineage prelude below. */
|
|
160
|
+
const terminalList = terminalStatuses.map((status) => `'${status}'`).join(", ");
|
|
161
|
+
/**
|
|
162
|
+
* The prelude every scan opens with: which runs a live run stands above, and
|
|
163
|
+
* which it stands below.
|
|
164
|
+
*
|
|
165
|
+
* Two relations make one run the parent of another, and a walk over either one
|
|
166
|
+
* alone misses half the lineage. A SPAWNED child records its parent as a
|
|
167
|
+
* `flows_run_parents` edge, one row per parent so a diamond records both, and
|
|
168
|
+
* leaves `parent_run_id` NULL: the engine reserves that column for the rounds
|
|
169
|
+
* of one trampoline lineage (`RunDriver.continueLineage`). The edge is the
|
|
170
|
+
* relation every `agent/await` depends on. `link` is both relations as one
|
|
171
|
+
* edge list.
|
|
172
|
+
*
|
|
173
|
+
* `under_live` is every run reachable downward from a run that is not
|
|
174
|
+
* terminal. Those runs have a live ancestor, which can still read a settled
|
|
175
|
+
* result out of their run row. `over_live` is every run reachable upward from
|
|
176
|
+
* one. Those runs have a live descendant, whose own lineage the
|
|
177
|
+
* `flows_run_parents_gc` trigger would drop with them. An edge whose parent
|
|
178
|
+
* row is gone is not reachable from `live` at all, so it holds nothing back,
|
|
179
|
+
* and since only terminal runs are ever deleted it never can.
|
|
180
|
+
*
|
|
181
|
+
* The walks carry run ids and nothing else, so `UNION` makes them terminate on
|
|
182
|
+
* their own: a corrupt edge that closed a cycle adds a row the set already
|
|
183
|
+
* holds, and the walk stops. That matters because these reads run inside the
|
|
184
|
+
* pass's write transaction. They are SQLite-specific, like the `sqlite_master`
|
|
185
|
+
* probe below, and rc.0 is SQLite-only.
|
|
186
|
+
*
|
|
187
|
+
* `parentEdges: false` drops the `flows_run_parents` half of `link`. A
|
|
188
|
+
* database that carries the run rows but not the engine's edge table — the
|
|
189
|
+
* control plane's, which migrates the run store and the journal and nothing
|
|
190
|
+
* else — has no edges to walk, and reading the missing table would fail the
|
|
191
|
+
* whole scan. The `parent_run_id` half still runs, so the continuation
|
|
192
|
+
* lineage is guarded there too. The retention pass itself always walks both.
|
|
193
|
+
*
|
|
194
|
+
* @category constructors
|
|
195
|
+
* @since 0.1.0
|
|
196
|
+
*/
|
|
197
|
+
export const lineagePrelude = (options) => `
|
|
198
|
+
WITH RECURSIVE
|
|
199
|
+
link(child_id, parent_id) AS (
|
|
200
|
+
${options.parentEdges
|
|
201
|
+
? `SELECT child_id, parent_id FROM flows_run_parents
|
|
202
|
+
UNION
|
|
203
|
+
`
|
|
204
|
+
: ``}SELECT run_id, parent_run_id FROM flows_runs WHERE parent_run_id IS NOT NULL
|
|
205
|
+
),
|
|
206
|
+
live(run_id) AS (
|
|
207
|
+
SELECT run_id FROM flows_runs WHERE status NOT IN (${terminalList})
|
|
208
|
+
),
|
|
209
|
+
under_live(run_id) AS (
|
|
210
|
+
SELECT link.child_id FROM link JOIN live ON live.run_id = link.parent_id
|
|
211
|
+
UNION
|
|
212
|
+
SELECT link.child_id FROM link JOIN under_live ON under_live.run_id = link.parent_id
|
|
213
|
+
),
|
|
214
|
+
over_live(run_id) AS (
|
|
215
|
+
SELECT link.parent_id FROM link JOIN live ON live.run_id = link.child_id
|
|
216
|
+
UNION
|
|
217
|
+
SELECT link.parent_id FROM link JOIN over_live ON over_live.run_id = link.child_id
|
|
218
|
+
)
|
|
219
|
+
`;
|
|
220
|
+
/**
|
|
221
|
+
* The bound one pass may delete, as both passes read it.
|
|
222
|
+
*
|
|
223
|
+
* Clamped, not interpolated: SQLite reads a negative `LIMIT` as no limit at
|
|
224
|
+
* all, which would make a mistyped bound a full sweep, and rejects `NaN` or a
|
|
225
|
+
* fraction as a datatype mismatch. Anything that is not a non-negative safe
|
|
226
|
+
* integer is read as zero, so the pass deletes nothing.
|
|
227
|
+
*
|
|
228
|
+
* @category constructors
|
|
229
|
+
* @since 1.0.0
|
|
230
|
+
*/
|
|
231
|
+
export const normalizeLimit = (limit) => {
|
|
232
|
+
const bound = limit ?? defaultLimit;
|
|
233
|
+
return Number.isSafeInteger(bound) && bound >= 0 ? bound : 0;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Which runs a pass may delete, and which it must keep, as CTEs.
|
|
237
|
+
*
|
|
238
|
+
* `eligible` is every terminal run older than the cutoff that no live run
|
|
239
|
+
* stands above or below. `blocked` is every other run plus every ancestor of
|
|
240
|
+
* one over `parent_run_id`: a continuation parent must outlive every child
|
|
241
|
+
* excluded by age or live lineage, and this propagates that exclusion before
|
|
242
|
+
* any bound is applied. `inclusive` says whether a run finished exactly at
|
|
243
|
+
* the cutoff is old enough.
|
|
244
|
+
*/
|
|
245
|
+
const scanPrelude = (sql, options) => sql `
|
|
246
|
+
${sql.unsafe(lineagePrelude({ parentEdges: options.parentEdges }))},
|
|
247
|
+
eligible(run_id) AS (
|
|
248
|
+
SELECT run_id FROM flows_runs
|
|
249
|
+
WHERE ${sql.in("status", terminalStatuses)}
|
|
250
|
+
AND ${options.inclusive
|
|
251
|
+
? sql `COALESCE(finished_at_ms, created_at_ms) <= ${options.cutoffMs}`
|
|
252
|
+
: sql `COALESCE(finished_at_ms, created_at_ms) < ${options.cutoffMs}`}
|
|
253
|
+
AND run_id NOT IN (SELECT run_id FROM under_live)
|
|
254
|
+
AND run_id NOT IN (SELECT run_id FROM over_live)
|
|
255
|
+
AND ${options.pins === undefined || options.pins.length === 0 ?
|
|
256
|
+
sql.literal("1 = 1")
|
|
257
|
+
: sql `run_id NOT IN ${sql.in(options.pins)}`}
|
|
258
|
+
),
|
|
259
|
+
blocked(run_id) AS (
|
|
260
|
+
SELECT run_id FROM flows_runs WHERE run_id NOT IN (SELECT run_id FROM eligible)
|
|
261
|
+
UNION
|
|
262
|
+
SELECT runs.parent_run_id FROM flows_runs AS runs
|
|
263
|
+
JOIN blocked ON blocked.run_id = runs.run_id
|
|
264
|
+
WHERE runs.parent_run_id IS NOT NULL
|
|
265
|
+
)
|
|
266
|
+
`;
|
|
267
|
+
/**
|
|
268
|
+
* The runs one pass deletes: at most `limit` of them, children before parents.
|
|
269
|
+
*
|
|
270
|
+
* The one candidate query, shared by {@link Service.retain} and
|
|
271
|
+
* `Retention.collect`. A trampoline parent always finishes before its
|
|
272
|
+
* successor, so an oldest-first window over a lineage longer than the bound
|
|
273
|
+
* held only ancestors, each pinned by the round just outside the window, and
|
|
274
|
+
* every later pass selected the same window and deleted nothing. Depth walks
|
|
275
|
+
* from roots, visiting each continuation row once; corrupt cycles have no
|
|
276
|
+
* root and cannot enter the deletion set. Excluded runs and their ancestors
|
|
277
|
+
* are dropped before the bound, so pinned parents cannot consume it. The
|
|
278
|
+
* result is presented oldest first.
|
|
279
|
+
*
|
|
280
|
+
* @category getters
|
|
281
|
+
* @since 1.0.0
|
|
282
|
+
*/
|
|
283
|
+
export const candidatesOf = (sql, options) => sql `
|
|
284
|
+
${scanPrelude(sql, options)},
|
|
285
|
+
depths(run_id, depth) AS (
|
|
286
|
+
SELECT run_id, 0 FROM flows_runs WHERE parent_run_id IS NULL
|
|
287
|
+
UNION ALL
|
|
288
|
+
SELECT runs.run_id, depths.depth + 1 FROM flows_runs AS runs
|
|
289
|
+
JOIN depths ON runs.parent_run_id = depths.run_id
|
|
290
|
+
),
|
|
291
|
+
selected AS (
|
|
292
|
+
SELECT runs.run_id, runs.parent_run_id,
|
|
293
|
+
COALESCE(runs.finished_at_ms, runs.created_at_ms) AS finished_at_ms
|
|
294
|
+
FROM flows_runs AS runs JOIN depths ON depths.run_id = runs.run_id
|
|
295
|
+
WHERE runs.run_id NOT IN (SELECT run_id FROM blocked)
|
|
296
|
+
ORDER BY depths.depth DESC, COALESCE(runs.finished_at_ms, runs.created_at_ms), runs.run_id
|
|
297
|
+
LIMIT ${normalizeLimit(options.limit)}
|
|
298
|
+
)
|
|
299
|
+
SELECT run_id, parent_run_id FROM selected ORDER BY finished_at_ms, run_id
|
|
300
|
+
`.pipe(Effect.map((rows) => rows.map((row) => ({ runId: row.run_id, parentRunId: row.parent_run_id }))));
|
|
301
|
+
/** Classifies a read of the scan phase, where nothing has been deleted yet. */
|
|
302
|
+
const scanning = (what) => (cause) => new RetentionError({ code: "scan_failed", message: `${what} could not be read`, cause });
|
|
303
|
+
/** Classifies a statement of the delete phase, which rolls the pass back. */
|
|
304
|
+
const deleting = (what) => (cause) => new RetentionError({ code: "delete_failed", message: `${what} could not be collected`, cause });
|
|
305
|
+
const chunksOf = (ids) => {
|
|
306
|
+
const chunks = [];
|
|
307
|
+
for (let offset = 0; offset < ids.length; offset += chunkSize) {
|
|
308
|
+
chunks.push(ids.slice(offset, offset + chunkSize));
|
|
309
|
+
}
|
|
310
|
+
return chunks;
|
|
311
|
+
};
|
|
312
|
+
/** Reads the installed SQLite table names once for inventory decisions. */
|
|
313
|
+
const installedTableNames = (sql) => Dialect.tables(sql).pipe(Effect.map((rows) => new Set(rows.map((row) => row.name))), Effect.mapError(scanning("the schema catalog")));
|
|
314
|
+
/**
|
|
315
|
+
* The {@link runScopedTables} entries this database actually has.
|
|
316
|
+
*
|
|
317
|
+
* `assumeLadder` keeps every entry the ladder installs whether the catalog
|
|
318
|
+
* lists it or not. {@link Service.retain} passes `true`: this package composes
|
|
319
|
+
* the run-store, journal, step-cache and engine migrations, so a ladder table
|
|
320
|
+
* missing from the file it is pointed at is a broken schema, and a delete that
|
|
321
|
+
* refuses says so. `Retention.collect` passes `false`, because it also runs
|
|
322
|
+
* against the control plane's database, which migrates the run store and the
|
|
323
|
+
* journal and nothing else; there a missing ladder table is a host that
|
|
324
|
+
* composed fewer stores, and the pass still owes it a complete sweep of what
|
|
325
|
+
* it has.
|
|
326
|
+
*
|
|
327
|
+
* The catalog read is SQLite-specific, like the lineage prelude above and the
|
|
328
|
+
* `flows_run_parents_gc` trigger this package ships. rc.0 is SQLite-only.
|
|
329
|
+
*
|
|
330
|
+
* @category getters
|
|
331
|
+
* @since 0.1.0
|
|
332
|
+
*/
|
|
333
|
+
export const installedTables = (sql, options) => installedTableNames(sql).pipe(Effect.map((present) => runScopedTables.filter((entry) => (options.assumeLadder && entry.ladder) || present.has(entry.table))));
|
|
334
|
+
const countIn = (sql, table, column, ids) => Effect.reduce(chunksOf(ids), () => 0, (total, chunk) => sql `
|
|
335
|
+
SELECT COUNT(*) AS total FROM ${sql.unsafe(table)} WHERE ${sql.in(column, chunk)}
|
|
336
|
+
`.pipe(Effect.map((rows) => rows.reduce((sum, row) => sum + Number(row.total), total)), Effect.mapError(deleting(table))));
|
|
337
|
+
const deleteIn = (sql, table, column, ids) => Effect.forEach(chunksOf(ids), (chunk) => sql `DELETE FROM ${sql.unsafe(table)} WHERE ${sql.in(column, chunk)}`.pipe(Effect.mapError(deleting(table))), { discard: true });
|
|
338
|
+
const countTimeTravelReceipts = (sql, ids) => Effect.reduce(chunksOf(ids), () => 0, (total, chunk) => sql `
|
|
339
|
+
SELECT COUNT(*) AS total
|
|
340
|
+
FROM flows_time_travel_receipts
|
|
341
|
+
WHERE audit_id IN (
|
|
342
|
+
SELECT id FROM flows_time_travel_audits WHERE ${sql.in("run_id", chunk)}
|
|
343
|
+
)
|
|
344
|
+
`.pipe(Effect.map((rows) => rows.reduce((sum, row) => sum + Number(row.total), total)), Effect.mapError(deleting("flows_time_travel_receipts"))));
|
|
345
|
+
const deleteTimeTravelReceipts = (sql, ids) => Effect.forEach(chunksOf(ids), (chunk) => sql `
|
|
346
|
+
DELETE FROM flows_time_travel_receipts
|
|
347
|
+
WHERE audit_id IN (
|
|
348
|
+
SELECT id FROM flows_time_travel_audits WHERE ${sql.in("run_id", chunk)}
|
|
349
|
+
)
|
|
350
|
+
`.pipe(Effect.mapError(deleting("flows_time_travel_receipts"))), { discard: true });
|
|
351
|
+
/** Every run whose parent is a candidate, candidates included. */
|
|
352
|
+
const childrenOf = (sql, candidateIds) => Effect.reduce(chunksOf(candidateIds), () => [], (accumulated, chunk) =>
|
|
353
|
+
// `parent_run_id` is the match predicate, so every row this returns
|
|
354
|
+
// has one.
|
|
355
|
+
sql `
|
|
356
|
+
SELECT run_id, parent_run_id FROM flows_runs WHERE ${sql.in("parent_run_id", chunk)}
|
|
357
|
+
`.pipe(Effect.map((rows) => {
|
|
358
|
+
for (const row of rows) {
|
|
359
|
+
accumulated.push({ runId: row.run_id, parentRunId: row.parent_run_id });
|
|
360
|
+
}
|
|
361
|
+
return accumulated;
|
|
362
|
+
}), Effect.mapError(scanning("the run lineage"))));
|
|
363
|
+
/**
|
|
364
|
+
* Drops from `doomed` every candidate that must outlive this pass, and
|
|
365
|
+
* every ancestor of one.
|
|
366
|
+
*
|
|
367
|
+
* A candidate whose child is not being deleted has to stay: `flows_runs`
|
|
368
|
+
* carries a self-referential foreign key on `parent_run_id`, so deleting
|
|
369
|
+
* it would orphan a row that still exists. Retention is upward-closed for
|
|
370
|
+
* the same reason — once a candidate is retained, the candidate it points
|
|
371
|
+
* at is still referenced and is retained too.
|
|
372
|
+
*/
|
|
373
|
+
const pinAncestors = (doomed, retained, parentOf, from) => {
|
|
374
|
+
let current = from;
|
|
375
|
+
while (current !== undefined && doomed.has(current)) {
|
|
376
|
+
doomed.delete(current);
|
|
377
|
+
retained.add(current);
|
|
378
|
+
current = parentOf.get(current) ?? undefined;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Groups the doomed runs so that no group holds a run and one of its
|
|
383
|
+
* doomed descendants. Deleting a parent while its child row still exists
|
|
384
|
+
* violates the foreign key, and SQLite evaluates it per row rather than at
|
|
385
|
+
* commit, so the delete runs deepest generation first.
|
|
386
|
+
*/
|
|
387
|
+
const generations = (doomed, parentOf) => {
|
|
388
|
+
const depths = new Map();
|
|
389
|
+
const depthOf = (runId) => {
|
|
390
|
+
const known = depths.get(runId);
|
|
391
|
+
if (known !== undefined)
|
|
392
|
+
return known;
|
|
393
|
+
const parent = parentOf.get(runId) ?? undefined;
|
|
394
|
+
const depth = parent !== undefined && doomed.has(parent) ? depthOf(parent) + 1 : 0;
|
|
395
|
+
depths.set(runId, depth);
|
|
396
|
+
return depth;
|
|
397
|
+
};
|
|
398
|
+
const byDepth = new Map();
|
|
399
|
+
for (const runId of doomed) {
|
|
400
|
+
const depth = depthOf(runId);
|
|
401
|
+
const bucket = byDepth.get(depth);
|
|
402
|
+
if (bucket === undefined)
|
|
403
|
+
byDepth.set(depth, [runId]);
|
|
404
|
+
else
|
|
405
|
+
bucket.push(runId);
|
|
406
|
+
}
|
|
407
|
+
return Array.from(byDepth.keys())
|
|
408
|
+
.sort((left, right) => right - left)
|
|
409
|
+
.map((depth) => byDepth.get(depth));
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* Deletes `candidates` and every row the inventory says names them.
|
|
413
|
+
*
|
|
414
|
+
* The one deletion in this package. Both passes call it, so neither can be
|
|
415
|
+
* holding a shorter table list than the other, and neither can be deleting
|
|
416
|
+
* run rows in an order the self-referential foreign key refuses: a handoff
|
|
417
|
+
* parent always sorts before its successor, so a pass that deleted in age
|
|
418
|
+
* order broke as soon as one lineage straddled a chunk boundary.
|
|
419
|
+
*
|
|
420
|
+
* The caller owns the transaction. Nothing here is atomic on its own, and a
|
|
421
|
+
* pass that removed the dependents of every candidate and then refused on the
|
|
422
|
+
* run rows would have destroyed history it could not put back.
|
|
423
|
+
*
|
|
424
|
+
* @category constructors
|
|
425
|
+
* @since 0.1.0
|
|
426
|
+
*/
|
|
427
|
+
export const deleteRuns = (sql, candidates, options) => Effect.gen(function* () {
|
|
428
|
+
const installed = yield* installedTableNames(sql);
|
|
429
|
+
const tables = runScopedTables.filter((entry) => (options.assumeLadder && entry.ladder) || installed.has(entry.table));
|
|
430
|
+
const hasTimeTravelReceipts = installed.has("flows_time_travel_receipts") &&
|
|
431
|
+
installed.has("flows_time_travel_audits");
|
|
432
|
+
const candidateIds = candidates.map((candidate) => candidate.runId);
|
|
433
|
+
const parentOf = new Map(candidates.map((candidate) => [candidate.runId, candidate.parentRunId]));
|
|
434
|
+
const doomed = new Set(candidateIds);
|
|
435
|
+
const pinned = new Set();
|
|
436
|
+
const candidateSet = new Set(candidateIds);
|
|
437
|
+
// The foreign key, which no lineage filter covers: a child row that is
|
|
438
|
+
// terminal and simply outside this pass — younger than the cutoff, or past
|
|
439
|
+
// the bound — still points at its parent.
|
|
440
|
+
for (const child of yield* childrenOf(sql, candidateIds)) {
|
|
441
|
+
if (candidateSet.has(child.runId))
|
|
442
|
+
continue;
|
|
443
|
+
pinAncestors(doomed, pinned, parentOf, child.parentRunId);
|
|
444
|
+
}
|
|
445
|
+
// `candidates` arrives oldest first, so this reads in the order the pass
|
|
446
|
+
// collected.
|
|
447
|
+
const runIds = candidateIds.filter((runId) => doomed.has(runId));
|
|
448
|
+
const companionIds = runIds.flatMap((runId) => companionStreams.map((stream) => JournalEvent.companionRunId(stream, runId)));
|
|
449
|
+
const idsFor = (entry) => entry.companions === true ? [...runIds, ...companionIds] : runIds;
|
|
450
|
+
const deleted = {};
|
|
451
|
+
if (hasTimeTravelReceipts) {
|
|
452
|
+
const total = yield* countTimeTravelReceipts(sql, runIds);
|
|
453
|
+
if (total > 0)
|
|
454
|
+
deleted["flows_time_travel_receipts"] = total;
|
|
455
|
+
}
|
|
456
|
+
for (const entry of tables) {
|
|
457
|
+
const total = yield* countIn(sql, entry.table, entry.column, idsFor(entry));
|
|
458
|
+
if (total > 0)
|
|
459
|
+
deleted[entry.table] = total;
|
|
460
|
+
}
|
|
461
|
+
if (runIds.length > 0)
|
|
462
|
+
deleted["flows_runs"] = runIds.length;
|
|
463
|
+
if (!options.dryRun) {
|
|
464
|
+
// Receipts have no run column, so remove them through their audits
|
|
465
|
+
// before the ordinary inventory reaches and deletes those audit rows.
|
|
466
|
+
if (hasTimeTravelReceipts)
|
|
467
|
+
yield* deleteTimeTravelReceipts(sql, runIds);
|
|
468
|
+
for (const entry of tables)
|
|
469
|
+
yield* deleteIn(sql, entry.table, entry.column, idsFor(entry));
|
|
470
|
+
// Last, and deepest generation first. The `flows_run_parents_gc`
|
|
471
|
+
// trigger drops each run's DAG edges as its row goes.
|
|
472
|
+
for (const generation of generations(doomed, parentOf)) {
|
|
473
|
+
yield* deleteIn(sql, "flows_runs", "run_id", generation);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return { runIds, pinned: Array.from(pinned), deleted };
|
|
477
|
+
});
|
|
478
|
+
/**
|
|
479
|
+
* Builds the retention operation over the composition's own durable tables.
|
|
480
|
+
*
|
|
481
|
+
* The scan reads `flows_runs` directly, the way `DurableEngineState` and
|
|
482
|
+
* `ArtifactGc` do: this package composes the run-store, journal, and engine
|
|
483
|
+
* migrations, so the schema is its own.
|
|
484
|
+
*
|
|
485
|
+
* @category constructors
|
|
486
|
+
* @since 0.1.0
|
|
487
|
+
*/
|
|
488
|
+
export const make = () => Effect.gen(function* () {
|
|
489
|
+
const sql = yield* Effect.service(SqlClient.SqlClient);
|
|
490
|
+
const journal = yield* Journal.Journal;
|
|
491
|
+
/**
|
|
492
|
+
* Aged terminal runs held by live lineage or an excluded continuation
|
|
493
|
+
* descendant. An upward exclusion takes precedence over a live ancestor.
|
|
494
|
+
*
|
|
495
|
+
* These runs are never candidates — `candidatesOf` excludes them — so this
|
|
496
|
+
* read exists to say WHY a workspace with aged runs collected fewer than
|
|
497
|
+
* it holds. It carries the pass's own bound so the report costs no more
|
|
498
|
+
* than the pass does.
|
|
499
|
+
*/
|
|
500
|
+
const retainedByLineage = (cutoffMs, limit) => sql `
|
|
501
|
+
${scanPrelude(sql, { cutoffMs, inclusive: true, parentEdges: true })}
|
|
502
|
+
SELECT
|
|
503
|
+
run_id,
|
|
504
|
+
(run_id IN (SELECT run_id FROM over_live) OR EXISTS (
|
|
505
|
+
SELECT 1 FROM flows_runs AS child
|
|
506
|
+
WHERE child.parent_run_id = flows_runs.run_id
|
|
507
|
+
AND child.run_id IN (SELECT run_id FROM blocked)
|
|
508
|
+
)) AS live_descendant
|
|
509
|
+
FROM flows_runs
|
|
510
|
+
WHERE ${sql.in("status", terminalStatuses)}
|
|
511
|
+
AND COALESCE(finished_at_ms, created_at_ms) <= ${cutoffMs}
|
|
512
|
+
AND run_id IN (SELECT run_id FROM blocked)
|
|
513
|
+
ORDER BY COALESCE(finished_at_ms, created_at_ms), run_id
|
|
514
|
+
LIMIT ${limit}
|
|
515
|
+
`.pipe(Effect.mapError(scanning("the run lineage")));
|
|
516
|
+
const pass = (options, cutoffMs) => Effect.gen(function* () {
|
|
517
|
+
const limit = normalizeLimit(options.limit);
|
|
518
|
+
const candidates = yield* candidatesOf(sql, { cutoffMs, inclusive: true, parentEdges: true, limit }).pipe(Effect.mapError(scanning("the run table")));
|
|
519
|
+
const retained = new Set();
|
|
520
|
+
const retainedAbove = new Set();
|
|
521
|
+
// Why the workspace kept aged runs this pass. These never entered the
|
|
522
|
+
// candidate set, so this only classifies them. It runs before the
|
|
523
|
+
// deletes so the report describes the file the pass was handed.
|
|
524
|
+
for (const held of yield* retainedByLineage(cutoffMs, limit)) {
|
|
525
|
+
if (Number(held.live_descendant) > 0)
|
|
526
|
+
retained.add(held.run_id);
|
|
527
|
+
else
|
|
528
|
+
retainedAbove.add(held.run_id);
|
|
529
|
+
}
|
|
530
|
+
// The whole deletion, shared with `Retention.collect` so the two
|
|
531
|
+
// passes cannot hold different table lists or different orders. This
|
|
532
|
+
// database is the engine's own ladder, so a table of it that the
|
|
533
|
+
// catalog does not list is a broken schema and the delete says so.
|
|
534
|
+
const removed = yield* deleteRuns(sql, candidates, {
|
|
535
|
+
dryRun: options.dryRun === true,
|
|
536
|
+
assumeLadder: true
|
|
537
|
+
});
|
|
538
|
+
return {
|
|
539
|
+
cutoffMs,
|
|
540
|
+
runIds: removed.runIds,
|
|
541
|
+
retainedForLiveDescendants: Array.from(retained).sort(),
|
|
542
|
+
retainedForLiveAncestors: Array.from(retainedAbove).sort(),
|
|
543
|
+
runs: removed.runIds.length,
|
|
544
|
+
attempts: removed.deleted["flows_attempts"] ?? 0,
|
|
545
|
+
clockDeadlines: removed.deleted["flows_clock_deadlines"] ?? 0,
|
|
546
|
+
deferredCompletions: removed.deleted["flows_deferred_completions"] ?? 0,
|
|
547
|
+
journalEntries: removed.deleted["flows_journal_events"] ?? 0,
|
|
548
|
+
journalCheckpoints: removed.deleted["flows_journal_checkpoints"] ?? 0,
|
|
549
|
+
journalIdentities: removed.deleted["flows_journal_dedup"] ?? 0,
|
|
550
|
+
archiveEntries: removed.deleted["flows_time_travel_archive"] ?? 0,
|
|
551
|
+
timeTravelReceipts: removed.deleted["flows_time_travel_receipts"] ?? 0,
|
|
552
|
+
dryRun: options.dryRun === true
|
|
553
|
+
};
|
|
554
|
+
});
|
|
555
|
+
const retain = Effect.fn("Retention.retain")((options) => Effect.gen(function* () {
|
|
556
|
+
const nowMs = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor));
|
|
557
|
+
const cutoffMs = nowMs - Math.max(0, options.olderThanMs);
|
|
558
|
+
// One commit: `transact` joins the run-row deletes, the dependent
|
|
559
|
+
// deletes, and the journal truncation into a single write transaction,
|
|
560
|
+
// so a crash can never leave a run without its history or history
|
|
561
|
+
// without its run. A transaction that cannot commit fails as the
|
|
562
|
+
// `JournalError` it is rather than being laundered into a retention
|
|
563
|
+
// code that would claim to know why.
|
|
564
|
+
return yield* journal.transact(pass(options, cutoffMs));
|
|
565
|
+
}));
|
|
566
|
+
return { retain };
|
|
567
|
+
});
|
|
568
|
+
/**
|
|
569
|
+
* Provides run retention. Nothing schedules `retain()`; invoking it stays an
|
|
570
|
+
* explicit caller decision.
|
|
571
|
+
*
|
|
572
|
+
* @category layers
|
|
573
|
+
* @since 0.1.0
|
|
574
|
+
*/
|
|
575
|
+
export const layer = Layer.effect(Retention)(make());
|
|
576
|
+
//# sourceMappingURL=RetentionOps.js.map
|