@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.
- 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 +201 -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 +1586 -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 +300 -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 +3154 -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,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The step-cache fold: `flows_step_cache` heads rebuilt from the journal.
|
|
3
|
+
*
|
|
4
|
+
* A head exists only because a `CacheStore.put` inserted it, and
|
|
5
|
+
* `ActionPersistence` journals exactly that insertion as a
|
|
6
|
+
* `flows.engine.cache-provenance` entry with action `admitted`, in the same
|
|
7
|
+
* `journal.transact` as the `put`. A duplicate or a losing first-writer race
|
|
8
|
+
* writes a ledger row but no head, so it journals no `admitted` entry. Every
|
|
9
|
+
* engine eviction is journalled before the fenced `CacheStore.evict` that
|
|
10
|
+
* performs it: `expired`, `stale_read_set`, and `replay_failed` with reason
|
|
11
|
+
* `corruption`, each naming the row it retires. The fold retires a row on any
|
|
12
|
+
* `replay_failed` that names it: a producer slot keeps the first reason it
|
|
13
|
+
* journalled, so a corruption can hide behind an earlier host failure. A row
|
|
14
|
+
* whose replay failed only on the host is then a miss.
|
|
15
|
+
*
|
|
16
|
+
* The fold keeps the admitted rows no eviction retired. A key with one such
|
|
17
|
+
* row gets it back as its head. A key with several lost at least one of them
|
|
18
|
+
* without a journal entry (`sweepExpired`, retention, an unfenced `evict`), and
|
|
19
|
+
* the journal cannot say which one the store still held, so it gets no head.
|
|
20
|
+
*
|
|
21
|
+
* Cache results stay in the append-only `flows_step_cache_recorded` ledger
|
|
22
|
+
* that the `admitted` entry addresses. The journal is redacted and replayed to
|
|
23
|
+
* sync subscribers, so it carries the decision and the provenance, never the
|
|
24
|
+
* executable result (issue #72).
|
|
25
|
+
*
|
|
26
|
+
* A rebuild writes a subset of the live heads, apart from rows removed without
|
|
27
|
+
* a journal entry, whose restored hits still pass the engine's age, read-set,
|
|
28
|
+
* and digest checks. Shared-tier write-backs have no local entry and are not
|
|
29
|
+
* rebuilt. Compaction and rewind delete eviction entries, so a store holding
|
|
30
|
+
* a compacted run, or one where any run was ever rewound, gets no heads at all.
|
|
31
|
+
* Retention is not yet covered: it deletes a run's entries, and with them the
|
|
32
|
+
* compaction floor and any eviction that run journalled of another run's row,
|
|
33
|
+
* so a rebuild after retention can restore a row the engine evicted (issue
|
|
34
|
+
* #2053). A convergence re-record that reuses an evicted row's provenance stays
|
|
35
|
+
* retired, so that key misses.
|
|
36
|
+
*
|
|
37
|
+
* @since 1.0.0
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
import { Journal, type JournalEvent, Projection } from "@smthrs/journal"
|
|
41
|
+
import { CacheStore } from "@smthrs/step-cache"
|
|
42
|
+
import * as Effect from "effect/Effect"
|
|
43
|
+
import * as HashMap from "effect/HashMap"
|
|
44
|
+
import * as HashSet from "effect/HashSet"
|
|
45
|
+
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The journal event type the fold reads.
|
|
49
|
+
*
|
|
50
|
+
* @category constants
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
*/
|
|
53
|
+
export const eventType = "flows.engine.cache-provenance"
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Provenance actions that retire the row they name.
|
|
57
|
+
*
|
|
58
|
+
* @category constants
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
*/
|
|
61
|
+
export const retiringActions: ReadonlyArray<string> = ["expired", "stale_read_set", "replay_failed"]
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Admitted rows folded so far, and the ones the journal retired.
|
|
65
|
+
*
|
|
66
|
+
* @category models
|
|
67
|
+
* @since 1.0.0
|
|
68
|
+
*/
|
|
69
|
+
export interface State {
|
|
70
|
+
/** Every row a `put` inserted as a head, by {@link refId}. */
|
|
71
|
+
readonly admitted: HashMap.HashMap<string, CacheStore.RecordedRef>
|
|
72
|
+
/** Rows an engine eviction retired, by {@link refId}. */
|
|
73
|
+
readonly retired: HashSet.HashSet<string>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The stable identity of a recorded row.
|
|
78
|
+
*
|
|
79
|
+
* @category models
|
|
80
|
+
* @since 1.0.0
|
|
81
|
+
*/
|
|
82
|
+
export const refId = (ref: CacheStore.RecordedRef): string =>
|
|
83
|
+
JSON.stringify([ref.keyDigest, ref.recordedRunId, ref.recordedEventSeq])
|
|
84
|
+
|
|
85
|
+
const record = (value: unknown): Readonly<Record<string, unknown>> | undefined =>
|
|
86
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
87
|
+
? value as Readonly<Record<string, unknown>>
|
|
88
|
+
: undefined
|
|
89
|
+
|
|
90
|
+
/** The row a payload names by `keyDigest`/`recordedRunId`/`recordedEventSeq`, if it names one. */
|
|
91
|
+
const named = (payload: Readonly<Record<string, unknown>>): CacheStore.RecordedRef | undefined =>
|
|
92
|
+
typeof payload.keyDigest === "string" && typeof payload.recordedRunId === "string" &&
|
|
93
|
+
typeof payload.recordedEventSeq === "number"
|
|
94
|
+
? {
|
|
95
|
+
keyDigest: payload.keyDigest,
|
|
96
|
+
recordedRunId: payload.recordedRunId,
|
|
97
|
+
recordedEventSeq: payload.recordedEventSeq
|
|
98
|
+
}
|
|
99
|
+
: undefined
|
|
100
|
+
|
|
101
|
+
const retires = (payload: Readonly<Record<string, unknown>>): boolean =>
|
|
102
|
+
retiringActions.includes(payload.action as string)
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Folds one committed journal entry.
|
|
106
|
+
*
|
|
107
|
+
* @category folds
|
|
108
|
+
* @since 1.0.0
|
|
109
|
+
*/
|
|
110
|
+
export const reduce = (state: State, entry: JournalEvent.Entry): State => {
|
|
111
|
+
const payload = record(entry.payload)
|
|
112
|
+
const ref = entry.eventType === eventType && payload !== undefined ? named(payload) : undefined
|
|
113
|
+
if (ref === undefined) return state
|
|
114
|
+
if (payload!.action === "admitted") return { ...state, admitted: HashMap.set(state.admitted, refId(ref), ref) }
|
|
115
|
+
return retires(payload!) ? { ...state, retired: HashSet.add(state.retired, refId(ref)) } : state
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The empty fold.
|
|
120
|
+
*
|
|
121
|
+
* @category constants
|
|
122
|
+
* @since 1.0.0
|
|
123
|
+
*/
|
|
124
|
+
export const initial: State = { admitted: HashMap.empty(), retired: HashSet.empty() }
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The fold as a journal projection, for `Journal.project` over one run.
|
|
128
|
+
*
|
|
129
|
+
* @category folds
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
*/
|
|
132
|
+
export const projection: Projection.Projection<State> = Projection.make({
|
|
133
|
+
name: "flows.engine.step-cache",
|
|
134
|
+
initial,
|
|
135
|
+
reduce: (state, entry) => Effect.succeed(reduce(state, entry))
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The head each key may be rebuilt with: its one admitted row no eviction
|
|
140
|
+
* retired. A key with more than one such row gets none.
|
|
141
|
+
*
|
|
142
|
+
* @category folds
|
|
143
|
+
* @since 1.0.0
|
|
144
|
+
*/
|
|
145
|
+
export const candidates = (state: State): ReadonlyArray<CacheStore.RecordedRef> => {
|
|
146
|
+
const byKey = new Map<string, Array<CacheStore.RecordedRef>>()
|
|
147
|
+
for (const [id, ref] of state.admitted) {
|
|
148
|
+
if (HashSet.has(state.retired, id)) continue
|
|
149
|
+
const refs = byKey.get(ref.keyDigest)
|
|
150
|
+
if (refs === undefined) byKey.set(ref.keyDigest, [ref])
|
|
151
|
+
else refs.push(ref)
|
|
152
|
+
}
|
|
153
|
+
return [...byKey.values()].flatMap((refs) => refs.length === 1 ? refs : [])
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* What a {@link rebuild} read and wrote.
|
|
158
|
+
*
|
|
159
|
+
* @category models
|
|
160
|
+
* @since 1.0.0
|
|
161
|
+
*/
|
|
162
|
+
export interface Rebuilt {
|
|
163
|
+
/** Runs with cache provenance entries. */
|
|
164
|
+
readonly runs: number
|
|
165
|
+
/** Runs with a compaction floor. Any makes the rebuild write no heads. */
|
|
166
|
+
readonly compacted: number
|
|
167
|
+
/** Runs a rewind truncated. Any makes the rebuild write no heads. */
|
|
168
|
+
readonly rewound: number
|
|
169
|
+
readonly admitted: number
|
|
170
|
+
readonly retired: number
|
|
171
|
+
readonly heads: number
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const pageSize = 512
|
|
175
|
+
|
|
176
|
+
/** Folds one run's cache provenance entries into `state`, in sequence order. */
|
|
177
|
+
const foldRun = (journal: Journal.Service, runId: string, start: State) =>
|
|
178
|
+
Effect.gen(function*() {
|
|
179
|
+
let state = start
|
|
180
|
+
let after: JournalEvent.Seq | undefined
|
|
181
|
+
while (true) {
|
|
182
|
+
const page = yield* journal.entries({
|
|
183
|
+
runId: runId as JournalEvent.RunId,
|
|
184
|
+
eventTypes: [eventType],
|
|
185
|
+
limit: pageSize,
|
|
186
|
+
...(after === undefined ? {} : { after })
|
|
187
|
+
})
|
|
188
|
+
for (const entry of page.entries) {
|
|
189
|
+
state = reduce(state, entry)
|
|
190
|
+
after = entry.seq
|
|
191
|
+
}
|
|
192
|
+
if (!page.hasMore) return state
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Rebuilds every `flows_step_cache` head from the journal.
|
|
198
|
+
*
|
|
199
|
+
* Reads each run's cache provenance entries in sequence order, folds them,
|
|
200
|
+
* and replaces the heads through `CacheStore.rebuildHeads` in one writer
|
|
201
|
+
* transaction. A store with a compacted or rewound run clears the heads
|
|
202
|
+
* instead: the eviction that retired a row may be gone. A journal read failure, including
|
|
203
|
+
* a compaction that lands during the read, leaves the heads untouched.
|
|
204
|
+
*
|
|
205
|
+
* Run it on a quiescent store, as a restore does: a cache write that commits
|
|
206
|
+
* between the journal read and the rewrite is dropped from the heads (a miss,
|
|
207
|
+
* never a wrong hit).
|
|
208
|
+
*
|
|
209
|
+
* @category operations
|
|
210
|
+
* @since 1.0.0
|
|
211
|
+
*/
|
|
212
|
+
export const rebuild = Effect.fn("StepCacheFold.rebuild")(function*() {
|
|
213
|
+
const journal = yield* Journal.Journal
|
|
214
|
+
const sql = yield* SqlClient.SqlClient
|
|
215
|
+
const floors = yield* sql<{ readonly compacted: number | string }>`
|
|
216
|
+
SELECT COUNT(DISTINCT run_id) AS compacted FROM flows_journal_checkpoints
|
|
217
|
+
WHERE compacted_at_ms IS NOT NULL
|
|
218
|
+
`
|
|
219
|
+
const compacted = Number(floors[0]!.compacted)
|
|
220
|
+
const generations = yield* sql<{ readonly rewound: number | string }>`
|
|
221
|
+
SELECT COUNT(*) AS rewound FROM flows_journal_generations
|
|
222
|
+
`
|
|
223
|
+
const rewound = Number(generations[0]!.rewound)
|
|
224
|
+
const runs = yield* sql<{ readonly run_id: string }>`
|
|
225
|
+
SELECT DISTINCT run_id FROM flows_journal_events
|
|
226
|
+
WHERE event_type = ${eventType}
|
|
227
|
+
ORDER BY run_id
|
|
228
|
+
`
|
|
229
|
+
let state = initial
|
|
230
|
+
if (compacted === 0 && rewound === 0) {
|
|
231
|
+
for (const { run_id } of runs) {
|
|
232
|
+
state = yield* foldRun(journal, run_id, state)
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const heads = yield* CacheStore.rebuildHeads(candidates(state))
|
|
236
|
+
return {
|
|
237
|
+
runs: runs.length,
|
|
238
|
+
compacted,
|
|
239
|
+
rewound,
|
|
240
|
+
admitted: HashMap.size(state.admitted),
|
|
241
|
+
retired: HashSet.size(state.retired),
|
|
242
|
+
heads
|
|
243
|
+
} satisfies Rebuilt
|
|
244
|
+
})
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injectable, scope-safe step sandboxing over the workspace transaction.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type * as ArtifactStore from "@smthrs/artifacts/ArtifactStore"
|
|
8
|
+
import type * as KernelWorkspace from "@smthrs/kernel/Workspace"
|
|
9
|
+
import * as Context from "effect/Context"
|
|
10
|
+
import type * as Crypto from "effect/Crypto"
|
|
11
|
+
import * as Effect from "effect/Effect"
|
|
12
|
+
import type * as FileSystem from "effect/FileSystem"
|
|
13
|
+
import * as Layer from "effect/Layer"
|
|
14
|
+
import type * as Path from "effect/Path"
|
|
15
|
+
import * as Schema from "effect/Schema"
|
|
16
|
+
import * as StepBoundary from "./StepBoundary.ts"
|
|
17
|
+
import * as WorkspaceSandbox from "./WorkspaceSandbox.ts"
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A hermetic body attempted to read a path outside its declared read set.
|
|
21
|
+
*
|
|
22
|
+
* @category errors
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
*/
|
|
25
|
+
export class UndeclaredRead extends Schema.TaggedError<UndeclaredRead>()(
|
|
26
|
+
"@smthrs/engine-store/UndeclaredRead",
|
|
27
|
+
{
|
|
28
|
+
code: Schema.Literal("undeclared_read"),
|
|
29
|
+
paths: Schema.Array(Schema.String),
|
|
30
|
+
diffIdentity: Schema.NonEmptyString
|
|
31
|
+
}
|
|
32
|
+
) {}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A sandbox that can acquire an isolated workspace for one step.
|
|
36
|
+
*
|
|
37
|
+
* @category models
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
*/
|
|
40
|
+
export interface Service {
|
|
41
|
+
readonly open: Effect.Effect<WorkspaceSandbox.Service, StepBoundary.UnsupportedBoundary>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Injectable step-sandbox service.
|
|
46
|
+
*
|
|
47
|
+
* @category services
|
|
48
|
+
* @since 0.1.0
|
|
49
|
+
*/
|
|
50
|
+
export const StepSandbox: Context.Service<Service, Service> = Context.Service<Service>(
|
|
51
|
+
"@smthrs/engine-store/StepSandbox"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a step sandbox around a workspace transaction backend.
|
|
56
|
+
*
|
|
57
|
+
* @category constructors
|
|
58
|
+
* @since 0.1.0
|
|
59
|
+
*/
|
|
60
|
+
export const make = (workspace: WorkspaceSandbox.Service): Service =>
|
|
61
|
+
StepSandbox.of({
|
|
62
|
+
open: Effect.succeed(workspace)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Filesystem-backed sandbox layer. The workspace transaction seeds only the
|
|
67
|
+
* declared reads, exposes its scoped FileSystem to the body, observes every
|
|
68
|
+
* mutation, and performs atomic copy-back on release. Built from
|
|
69
|
+
* `WorkspaceSandbox.layerFileSystem`, so it refuses a path-based host the same way.
|
|
70
|
+
*
|
|
71
|
+
* @category layers
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
*/
|
|
74
|
+
export const layer: Layer.Layer<
|
|
75
|
+
Service,
|
|
76
|
+
WorkspaceSandbox.WorkspaceError,
|
|
77
|
+
FileSystem.FileSystem | Path.Path | ArtifactStore.ArtifactStore | KernelWorkspace.Workspace
|
|
78
|
+
> = Layer.effect(
|
|
79
|
+
StepSandbox,
|
|
80
|
+
Effect.map(WorkspaceSandbox.WorkspaceSandbox, make)
|
|
81
|
+
).pipe(Layer.provide(WorkspaceSandbox.layerFileSystem()))
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Deterministic in-memory sandbox layer for tests.
|
|
85
|
+
*
|
|
86
|
+
* @category layers
|
|
87
|
+
* @since 0.1.0
|
|
88
|
+
*/
|
|
89
|
+
export const layerTest = (
|
|
90
|
+
initialFiles: WorkspaceSandbox.InitialFiles = {}
|
|
91
|
+
): Layer.Layer<Service, WorkspaceSandbox.WorkspaceError, Crypto.Crypto> =>
|
|
92
|
+
Layer.effect(StepSandbox, Effect.map(WorkspaceSandbox.makeMemory(initialFiles), (sandbox) => make(sandbox.service)))
|
|
93
|
+
|
|
94
|
+
const unsupported = new StepBoundary.UnsupportedBoundary({
|
|
95
|
+
code: "unsupported_boundary",
|
|
96
|
+
message: "this host cannot provide a hermetic step sandbox"
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Fail-closed host layer for environments that cannot sandbox (for example browsers).
|
|
101
|
+
*
|
|
102
|
+
* @category layers
|
|
103
|
+
* @since 0.1.0
|
|
104
|
+
*/
|
|
105
|
+
export const layerNoop: Layer.Layer<Service> = Layer.succeed(
|
|
106
|
+
StepSandbox,
|
|
107
|
+
StepSandbox.of({
|
|
108
|
+
open: Effect.fail(unsupported)
|
|
109
|
+
})
|
|
110
|
+
)
|
package/src/WakeBus.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-process wake bus: durable writes that make a run runnable — a
|
|
3
|
+
* deferred completed, a durable clock fired, an operator resume — announce
|
|
4
|
+
* the run id here, and in-process waiters parked on that run resume
|
|
5
|
+
* immediately instead of waiting out a poll tick.
|
|
6
|
+
*
|
|
7
|
+
* The bus is EDGE-TRIGGERED and MISS-TOLERANT by design. A wake published
|
|
8
|
+
* while nobody waits is dropped, not queued: durable state already records
|
|
9
|
+
* that the run is runnable, and the engine's suspension polling schedule
|
|
10
|
+
* (`suspendedRetryPolicy`) remains the bounded fallback that re-drives any
|
|
11
|
+
* run whose wake the bus missed. Temporal's scheduled task queue takes the
|
|
12
|
+
* same position — `NotifyNewTasks` is a coalesced, non-blocking channel send
|
|
13
|
+
* and `MaxPollInterval` bounds the polling fallback (`reference/temporal`
|
|
14
|
+
* `service/history/queues/queue_scheduled.go`) — because a lossless bus
|
|
15
|
+
* would have to be durable, and the durable record already exists. Waiter
|
|
16
|
+
* registration follows opencode's in-process job registry: one `Deferred`
|
|
17
|
+
* per waiter, succeeded on completion, removed when the waiter's own scope
|
|
18
|
+
* closes (`reference/opencode` `packages/smithers/flows/core/src/background-job.ts`).
|
|
19
|
+
*
|
|
20
|
+
* Cross-process wakes never reach this bus: another process's deferred
|
|
21
|
+
* completion is observed through the store, on the polling schedule and the
|
|
22
|
+
* heartbeat sweeps. That split is deliberate v1 scope — an event-driven
|
|
23
|
+
* cross-process wake needs a committed journal subscription, which is a
|
|
24
|
+
* separate seam.
|
|
25
|
+
*
|
|
26
|
+
* The bus holds no host access at all — a `Map` of `Deferred`s — so it is
|
|
27
|
+
* browser-safe without a platform layer.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import * as Context from "effect/Context"
|
|
33
|
+
import * as Deferred from "effect/Deferred"
|
|
34
|
+
import * as Effect from "effect/Effect"
|
|
35
|
+
import * as Layer from "effect/Layer"
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Wake bus operations.
|
|
39
|
+
*
|
|
40
|
+
* @category models
|
|
41
|
+
* @since 0.1.0
|
|
42
|
+
*/
|
|
43
|
+
export interface Service {
|
|
44
|
+
/**
|
|
45
|
+
* Announces that a durable write made the run runnable. Every waiter
|
|
46
|
+
* currently parked on `executionId` resumes; with no waiters the wake is
|
|
47
|
+
* dropped and the polling fallback covers the run.
|
|
48
|
+
*/
|
|
49
|
+
readonly wake: (executionId: string) => Effect.Effect<void>
|
|
50
|
+
/**
|
|
51
|
+
* Parks until the next {@link wake} for `executionId`. Registration is
|
|
52
|
+
* removed when the waiting fiber is interrupted — including scope closure
|
|
53
|
+
* and losing a race against the polling sleep — so an abandoned wait
|
|
54
|
+
* leaks nothing.
|
|
55
|
+
*
|
|
56
|
+
* The wait is keyed by execution id alone: execution ids are unique
|
|
57
|
+
* across flows, so the flow tag adds no discrimination.
|
|
58
|
+
*/
|
|
59
|
+
readonly awaitWake: (executionId: string) => Effect.Effect<void>
|
|
60
|
+
/**
|
|
61
|
+
* How many waiters are currently parked on `executionId`. This is
|
|
62
|
+
* observability for tests and diagnostics, not a coordination primitive:
|
|
63
|
+
* a count observed now says nothing about a moment later.
|
|
64
|
+
*/
|
|
65
|
+
readonly waiters: (executionId: string) => Effect.Effect<number>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Service tag for the in-process wake bus.
|
|
70
|
+
*
|
|
71
|
+
* @category services
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
*/
|
|
74
|
+
export class WakeBus extends Context.Service<WakeBus, Service>()("@smthrs/engine-store/WakeBus") {}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Constructs a wake bus. Registration and delivery are plain in-memory
|
|
78
|
+
* operations on the constructing process; nothing is durable.
|
|
79
|
+
*
|
|
80
|
+
* @category constructors
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
*/
|
|
83
|
+
export const makeUnsafe = (): Service => {
|
|
84
|
+
const parked = new Map<string, Set<Deferred.Deferred<void>>>()
|
|
85
|
+
return WakeBus.of({
|
|
86
|
+
wake: (executionId) =>
|
|
87
|
+
Effect.suspend(() => {
|
|
88
|
+
const waiters = parked.get(executionId)
|
|
89
|
+
if (waiters === undefined) return Effect.void
|
|
90
|
+
// Snapshot before succeeding: each woken waiter's release removes it
|
|
91
|
+
// from the live set, and delivery must not observe that mutation.
|
|
92
|
+
return Effect.forEach(
|
|
93
|
+
Array.from(waiters),
|
|
94
|
+
(waiter) => Deferred.succeed(waiter, undefined),
|
|
95
|
+
{ discard: true }
|
|
96
|
+
)
|
|
97
|
+
}),
|
|
98
|
+
awaitWake: (executionId) =>
|
|
99
|
+
Effect.acquireUseRelease(
|
|
100
|
+
Effect.sync(() => {
|
|
101
|
+
const waiter = Deferred.makeUnsafe<void>()
|
|
102
|
+
let waiters = parked.get(executionId)
|
|
103
|
+
if (waiters === undefined) {
|
|
104
|
+
waiters = new Set()
|
|
105
|
+
parked.set(executionId, waiters)
|
|
106
|
+
}
|
|
107
|
+
waiters.add(waiter)
|
|
108
|
+
return { waiter, waiters }
|
|
109
|
+
}),
|
|
110
|
+
({ waiter }) => Deferred.await(waiter),
|
|
111
|
+
// The registration's own set is closed over rather than re-fetched:
|
|
112
|
+
// the map entry can only be deleted by the release that empties it,
|
|
113
|
+
// so the set this waiter joined is the set it must leave.
|
|
114
|
+
({ waiter, waiters }) =>
|
|
115
|
+
Effect.sync(() => {
|
|
116
|
+
waiters.delete(waiter)
|
|
117
|
+
if (waiters.size === 0) parked.delete(executionId)
|
|
118
|
+
})
|
|
119
|
+
),
|
|
120
|
+
waiters: (executionId) => Effect.sync(() => parked.get(executionId)?.size ?? 0)
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Constructs a wake bus effectfully. Prefer this in compositions;
|
|
126
|
+
* {@link makeUnsafe} exists for construction outside a fiber.
|
|
127
|
+
*
|
|
128
|
+
* @category constructors
|
|
129
|
+
* @since 0.1.0
|
|
130
|
+
*/
|
|
131
|
+
export const make: Effect.Effect<Service> = Effect.sync(makeUnsafe)
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A bus that never delivers: wakes are dropped and waiters park forever.
|
|
135
|
+
* With it in place every resume travels the polling fallback — which is
|
|
136
|
+
* exactly what a test asserting the fallback provides it for.
|
|
137
|
+
*
|
|
138
|
+
* @category constructors
|
|
139
|
+
* @since 0.1.0
|
|
140
|
+
*/
|
|
141
|
+
export const makeNoop = (overrides?: Partial<Service>): Service =>
|
|
142
|
+
WakeBus.of({
|
|
143
|
+
wake: () => Effect.void,
|
|
144
|
+
awaitWake: () => Effect.never,
|
|
145
|
+
waiters: () => Effect.succeed(0),
|
|
146
|
+
...overrides
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Provides a fresh wake bus. An engine composition resolves the bus
|
|
151
|
+
* optionally, so providing this layer is how a host shares one bus between
|
|
152
|
+
* the engine and its own wake sources; a composition given none builds a
|
|
153
|
+
* private bus.
|
|
154
|
+
*
|
|
155
|
+
* @category layers
|
|
156
|
+
* @since 0.1.0
|
|
157
|
+
*/
|
|
158
|
+
export const layer: Layer.Layer<WakeBus> = Layer.sync(WakeBus)(makeUnsafe)
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Provides {@link makeNoop}.
|
|
162
|
+
*
|
|
163
|
+
* @category layers
|
|
164
|
+
* @since 0.1.0
|
|
165
|
+
*/
|
|
166
|
+
export const layerNoop = (overrides?: Partial<Service>): Layer.Layer<WakeBus> =>
|
|
167
|
+
Layer.sync(WakeBus)(() => makeNoop(overrides))
|