@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,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay authority comes from the current descriptor, never the recorded paths.
|
|
3
|
+
* This preflight performs no host I/O; every path is checked before replay can prune.
|
|
4
|
+
* @since 1.0.0-rc.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as ArtifactStore from "@smthrs/artifacts/ArtifactStore"
|
|
8
|
+
import type { FileBoundary } from "@smthrs/flow/FileBoundary"
|
|
9
|
+
import * as FileSet from "@smthrs/plan/FileSet"
|
|
10
|
+
import * as Schema from "effect/Schema"
|
|
11
|
+
import type * as StepBoundary from "../StepBoundary.ts"
|
|
12
|
+
|
|
13
|
+
const Outputs = Schema.Struct({
|
|
14
|
+
outputs: Schema.Array(Schema.Struct({ path: Schema.String, digest: Schema.NullOr(ArtifactStore.Digest) })),
|
|
15
|
+
trees: Schema.optional(Schema.Array(Schema.Struct({ path: Schema.String, identity: Schema.String })))
|
|
16
|
+
})
|
|
17
|
+
// The existing abstract boundary protocol records its exact declared path set.
|
|
18
|
+
// Validate that format separately; it does not claim a filesystem blob manifest.
|
|
19
|
+
const DeclaredPaths = Schema.Struct({ paths: Schema.Array(FileSet.Entry) })
|
|
20
|
+
const samePaths = Schema.toEquivalence(Schema.Array(FileSet.Entry))
|
|
21
|
+
|
|
22
|
+
/** A typed refusal leaves both the evidence and the workspace intact.
|
|
23
|
+
* @category models
|
|
24
|
+
* @since 1.0.0-rc.0
|
|
25
|
+
*/
|
|
26
|
+
export type Decision =
|
|
27
|
+
| { readonly _tag: "ReplayOutputs" }
|
|
28
|
+
| { readonly _tag: "Refused"; readonly reason: "output-boundary-mismatch" | "unsupported-output-evidence" }
|
|
29
|
+
|
|
30
|
+
/** Validate all recorded writes, removals and pruning roots before materialization.
|
|
31
|
+
* Unknown output formats cannot establish current filesystem authority.
|
|
32
|
+
* @category classifiers
|
|
33
|
+
* @since 1.0.0-rc.0
|
|
34
|
+
*/
|
|
35
|
+
export const replay = (
|
|
36
|
+
descriptor: FileBoundary | undefined,
|
|
37
|
+
evidence: StepBoundary.BoundaryEvidence
|
|
38
|
+
): Decision => {
|
|
39
|
+
const mismatch = { _tag: "Refused", reason: "output-boundary-mismatch" } as const
|
|
40
|
+
if (descriptor === undefined) return mismatch
|
|
41
|
+
const decoded = Schema.decodeUnknownResult(Outputs)(evidence.declaredOutputs)
|
|
42
|
+
if (decoded._tag === "Failure") {
|
|
43
|
+
const paths = Schema.decodeUnknownResult(DeclaredPaths)(evidence.declaredOutputs)
|
|
44
|
+
// Malformed production evidence cannot downgrade itself to the abstract
|
|
45
|
+
// protocol by also supplying a matching path list.
|
|
46
|
+
if (paths._tag === "Failure" || Object.hasOwn(evidence.declaredOutputs as object, "outputs")) {
|
|
47
|
+
return { _tag: "Refused", reason: "unsupported-output-evidence" }
|
|
48
|
+
}
|
|
49
|
+
return (descriptor.removes ?? []).length === 0 && samePaths(paths.success.paths, descriptor.writeSet)
|
|
50
|
+
? { _tag: "ReplayOutputs" }
|
|
51
|
+
: mismatch
|
|
52
|
+
}
|
|
53
|
+
const { outputs, trees = [] } = decoded.success
|
|
54
|
+
const paths = [...outputs.map((output) => output.path), ...trees.map((tree) => tree.path)]
|
|
55
|
+
// Use the exact coordinate spelling that replay passes to the filesystem.
|
|
56
|
+
if (paths.some((path) => !FileSet.workspaceRelative(path) || FileSet.canonical(path) !== path)) return mismatch
|
|
57
|
+
if (new Set(outputs.map((output) => output.path)).size !== outputs.length) return mismatch
|
|
58
|
+
if (new Set(trees.map((tree) => tree.path)).size !== trees.length) return mismatch
|
|
59
|
+
const removes = descriptor.removes ?? []
|
|
60
|
+
for (const output of outputs) {
|
|
61
|
+
if (output.digest === null) {
|
|
62
|
+
if (!removes.includes(output.path)) return mismatch
|
|
63
|
+
} else if (
|
|
64
|
+
removes.includes(output.path) ||
|
|
65
|
+
!descriptor.writeSet.some((entry) => FileSet.overlaps(entry, output.path))
|
|
66
|
+
) return mismatch
|
|
67
|
+
}
|
|
68
|
+
// A tree root authorizes pruning its entire subtree. A glob or a narrower
|
|
69
|
+
// tree is never sufficient authority for a recorded broader pruning root.
|
|
70
|
+
const declaredTrees = descriptor.writeSet.filter(FileSet.isTreeArtifact)
|
|
71
|
+
// A declared tree root is a directory, never a replayable file or deletion.
|
|
72
|
+
if (declaredTrees.some((entry) => outputs.some((output) => output.path === entry.path))) return mismatch
|
|
73
|
+
if (trees.some((tree) => !declaredTrees.some((entry) => entry.path === tree.path))) return mismatch
|
|
74
|
+
if (declaredTrees.some((entry) => !trees.some((tree) => tree.path === entry.path))) return mismatch
|
|
75
|
+
if (removes.some((path) => !outputs.some((output) => output.path === path && output.digest === null))) return mismatch
|
|
76
|
+
if (
|
|
77
|
+
descriptor.writeSet.some((entry) =>
|
|
78
|
+
typeof entry === "string" && !outputs.some((output) => output.path === entry && output.digest !== null)
|
|
79
|
+
)
|
|
80
|
+
) return mismatch
|
|
81
|
+
return { _tag: "ReplayOutputs" }
|
|
82
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two-tier step-cache protocol, extracted out of `ActionPersistence`.
|
|
3
|
+
*
|
|
4
|
+
* `CacheAdmission` classifies the evidence that permits publication;
|
|
5
|
+
* `ActionPersistence` supplies the measured facts and durable ordering. This module owns *how* it becomes
|
|
6
|
+
* shareable and how a shared hit is made replayable, which is the half a
|
|
7
|
+
* two-tier composition has to be able to inject into:
|
|
8
|
+
*
|
|
9
|
+
* - {@link publishArtifacts} runs before the cache entry is written, so an
|
|
10
|
+
* entry is never observable while an artifact it references is missing
|
|
11
|
+
* (`reference/bazel/.../remote/UploadManifest.java:630-633`).
|
|
12
|
+
* - {@link publishEntry} runs after the transaction that made the local row
|
|
13
|
+
* durable, so the shared entry lands last of all — and outside the write
|
|
14
|
+
* transaction.
|
|
15
|
+
* - {@link hydrateArtifacts} runs after a replay refused for a *missing*
|
|
16
|
+
* artifact — the one refusal a shared tier can repair — so the replay is
|
|
17
|
+
* retried once against fetched bytes instead of falling straight through to
|
|
18
|
+
* a real execution.
|
|
19
|
+
*
|
|
20
|
+
* The seams are `ArtifactSync` and `CacheSync`, both resolved optionally: a
|
|
21
|
+
* composition with no shared tier gets the `makeLocal()` implementations, whose
|
|
22
|
+
* publish steps are no-ops and whose `hydrate` reports nothing was fetched.
|
|
23
|
+
* That is why a purely local engine pays nothing for this file.
|
|
24
|
+
*
|
|
25
|
+
* Every host call here stays OUTSIDE the `DurableWriter` transaction, like the
|
|
26
|
+
* Jj snapshot and the boundary prepare/settle: a host call must never be held
|
|
27
|
+
* across a write transaction.
|
|
28
|
+
*
|
|
29
|
+
* Neither publication step can fail a run. A shared cache is an accelerator,
|
|
30
|
+
* and by the time these run the result is already durably recorded on this
|
|
31
|
+
* host — failing a completed run because an optional tier is unreachable trades
|
|
32
|
+
* a real result for an unavailable one. Both report the refusal instead, and
|
|
33
|
+
* the caller journals it, exactly as an unverified read set is journaled rather
|
|
34
|
+
* than swallowed.
|
|
35
|
+
*
|
|
36
|
+
* @since 0.1.0
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
import type { CacheStore } from "@smthrs/step-cache"
|
|
40
|
+
import * as Cause from "effect/Cause"
|
|
41
|
+
import type * as Crypto from "effect/Crypto"
|
|
42
|
+
import * as Effect from "effect/Effect"
|
|
43
|
+
import * as Option from "effect/Option"
|
|
44
|
+
import * as ArtifactSync from "../ArtifactSync.ts"
|
|
45
|
+
import * as CacheSync from "../CacheSync.ts"
|
|
46
|
+
import * as StepBoundary from "../StepBoundary.ts"
|
|
47
|
+
|
|
48
|
+
/** Resolves the configured protocol, defaulting to the single-tier one. */
|
|
49
|
+
const sync: Effect.Effect<ArtifactSync.Service> = Effect.map(
|
|
50
|
+
Effect.serviceOption(ArtifactSync.ArtifactSync),
|
|
51
|
+
(configured) => Option.isSome(configured) ? configured.value : ArtifactSync.makeLocal()
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
/** Resolves the configured entry publisher, defaulting to the single-tier one. */
|
|
55
|
+
const entrySync: Effect.Effect<CacheSync.Service> = Effect.map(
|
|
56
|
+
Effect.serviceOption(CacheSync.CacheSync),
|
|
57
|
+
(configured) => Option.isSome(configured) ? configured.value : CacheSync.makeLocal()
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Why a recorded result could not be shared, when it could not be.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.1.0
|
|
64
|
+
* @category models
|
|
65
|
+
*/
|
|
66
|
+
export interface Unshareable {
|
|
67
|
+
/** Which half of the two-tier publication refused. */
|
|
68
|
+
readonly stage: "artifacts" | "entry"
|
|
69
|
+
readonly message: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Makes every artifact the evidence references durable in the shared tier,
|
|
74
|
+
* reporting a refusal rather than failing.
|
|
75
|
+
*
|
|
76
|
+
* Called immediately before the transaction that records the cache entry, and
|
|
77
|
+
* never inside it. A refusal means the entry must not be published to the
|
|
78
|
+
* shared tier — the whole point of the ordering constraint — but says nothing
|
|
79
|
+
* about the *local* row, which stays as valid as it ever was.
|
|
80
|
+
*
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
* @category protocol
|
|
83
|
+
*/
|
|
84
|
+
export const publishArtifacts = (
|
|
85
|
+
evidence: StepBoundary.BoundaryEvidence | undefined
|
|
86
|
+
): Effect.Effect<Unshareable | undefined, never, Crypto.Crypto> =>
|
|
87
|
+
Effect.gen(function*() {
|
|
88
|
+
if (evidence === undefined) return undefined
|
|
89
|
+
const digests = StepBoundary.referencedDigests(evidence)
|
|
90
|
+
if (digests.length === 0) return undefined
|
|
91
|
+
const protocol = yield* sync
|
|
92
|
+
return yield* protocol.publish(digests).pipe(
|
|
93
|
+
Effect.as(undefined),
|
|
94
|
+
Effect.catch((failure) => Effect.succeed<Unshareable>({ stage: "artifacts", message: failure.message }))
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Publishes the recorded entry to the shared step-result tier, reporting a
|
|
100
|
+
* refusal rather than failing.
|
|
101
|
+
*
|
|
102
|
+
* Called only after {@link publishArtifacts} reported success and only after
|
|
103
|
+
* the transaction that made the local row durable has committed: blobs first,
|
|
104
|
+
* entry last, and no network round trip held across a write transaction.
|
|
105
|
+
*
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
* @category protocol
|
|
108
|
+
*/
|
|
109
|
+
export const publishEntry = (
|
|
110
|
+
entry: CacheStore.CacheEntry
|
|
111
|
+
): Effect.Effect<Unshareable | undefined> =>
|
|
112
|
+
Effect.gen(function*() {
|
|
113
|
+
const protocol = yield* entrySync
|
|
114
|
+
const refused = yield* protocol.publishEntry(entry)
|
|
115
|
+
return Option.isSome(refused) ? { stage: "entry" as const, message: refused.value.message } : undefined
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Fetches the artifacts a replay could not resolve locally, reporting whether
|
|
120
|
+
* the replay is now worth retrying.
|
|
121
|
+
*
|
|
122
|
+
* @since 0.1.0
|
|
123
|
+
* @category protocol
|
|
124
|
+
*/
|
|
125
|
+
export const hydrateArtifacts = (
|
|
126
|
+
evidence: StepBoundary.BoundaryEvidence
|
|
127
|
+
): Effect.Effect<boolean, never, Crypto.Crypto> =>
|
|
128
|
+
Effect.gen(function*() {
|
|
129
|
+
const digests = StepBoundary.referencedDigests(evidence)
|
|
130
|
+
if (digests.length === 0) return false
|
|
131
|
+
const protocol = yield* sync
|
|
132
|
+
return yield* protocol.hydrate(digests)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The classification a `replayOutputs` failure needs before it can be
|
|
137
|
+
* repaired: a {@link StepBoundary.MissingArtifact} means the bytes are simply
|
|
138
|
+
* not on this host, which a shared tier may fix. Anything else — a corrupt
|
|
139
|
+
* address, a host refusal — is not a fetchable condition.
|
|
140
|
+
*
|
|
141
|
+
* @since 0.1.0
|
|
142
|
+
* @category protocol
|
|
143
|
+
*/
|
|
144
|
+
export const replayMissingArtifact = (
|
|
145
|
+
cause: Cause.Cause<unknown>
|
|
146
|
+
): StepBoundary.MissingArtifact | undefined => {
|
|
147
|
+
for (const reason of cause.reasons) {
|
|
148
|
+
if (Cause.isFailReason(reason) && reason.error instanceof StepBoundary.MissingArtifact) {
|
|
149
|
+
return reason.error
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return undefined
|
|
153
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Native call facts written by the action owner, never a harness stream consumer.
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CallFact, JournalEvent } from "@smthrs/journal"
|
|
6
|
+
import { DerivedKey, digest } from "@smthrs/keys"
|
|
7
|
+
import * as Context from "effect/Context"
|
|
8
|
+
import * as Effect from "effect/Effect"
|
|
9
|
+
import * as Option from "effect/Option"
|
|
10
|
+
import * as Schema from "effect/Schema"
|
|
11
|
+
|
|
12
|
+
const maxBytes = 65_536
|
|
13
|
+
const encoder = new TextEncoder()
|
|
14
|
+
const bounded = (value: Schema.Json) =>
|
|
15
|
+
Effect.gen(function*() {
|
|
16
|
+
const bytes = encoder.encode(typeof value === "string" ? value : JSON.stringify(value)).byteLength
|
|
17
|
+
return bytes <= maxBytes ? value : {
|
|
18
|
+
truncated: true,
|
|
19
|
+
bytes,
|
|
20
|
+
digest: digest(yield* Schema.decodeUnknownEffect(DerivedKey)(value).pipe(Effect.orDie))
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/** No new action identity, callback, table or delivery queue is introduced.
|
|
25
|
+
* @category constructors
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
*/
|
|
28
|
+
export const make = (action: unknown, runId: string) => {
|
|
29
|
+
const annotations = typeof action === "object" && action !== null && "annotations" in action
|
|
30
|
+
? action.annotations as Context.Context<never>
|
|
31
|
+
: undefined
|
|
32
|
+
const annotation = annotations === undefined ? Option.none() : Context.getOption(annotations, CallFact.Annotation)
|
|
33
|
+
const resultSchema =
|
|
34
|
+
typeof action === "object" && action !== null && "successSchema" in action && Schema.isSchema(action.successSchema)
|
|
35
|
+
? action.successSchema as Schema.Codec<unknown, unknown>
|
|
36
|
+
: undefined
|
|
37
|
+
const record = (phase: "invoked" | "settled", outcome?: unknown) =>
|
|
38
|
+
Effect.gen(function*() {
|
|
39
|
+
if (Option.isNone(annotation) || annotation.value.phase !== phase) return undefined
|
|
40
|
+
const call = yield* Schema.decodeUnknownEffect(CallFact.Call)(annotation.value.call).pipe(Effect.orDie)
|
|
41
|
+
// Production record boundaries carry a service-free success codec. Check
|
|
42
|
+
// it before publishing an older encoded row as a deliverable result: the
|
|
43
|
+
// reader would refuse a corrupt row even when its broad JSON shape fits.
|
|
44
|
+
if (phase === "settled" && resultSchema !== undefined) {
|
|
45
|
+
yield* Schema.decodeUnknownEffect(Schema.toCodecJson(resultSchema))(outcome).pipe(Effect.orDie)
|
|
46
|
+
}
|
|
47
|
+
const result = phase === "settled"
|
|
48
|
+
? yield* Schema.decodeUnknownEffect(CallFact.Result)(outcome).pipe(Effect.orDie)
|
|
49
|
+
: undefined
|
|
50
|
+
const coordinates = {
|
|
51
|
+
version: 1 as const,
|
|
52
|
+
callId: call.callId,
|
|
53
|
+
identity: call.identity,
|
|
54
|
+
flowName: call.flowName
|
|
55
|
+
}
|
|
56
|
+
const payload: CallFact.Fact = result === undefined
|
|
57
|
+
? {
|
|
58
|
+
...coordinates,
|
|
59
|
+
phase: "invoked",
|
|
60
|
+
input: yield* bounded(call.input),
|
|
61
|
+
// Never bounded: the display projection is four short fields its
|
|
62
|
+
// owner already validated, and a truncation marker in its place
|
|
63
|
+
// would read as a declaration that claimed something unreadable.
|
|
64
|
+
...(call.descriptor === undefined ? {} : { descriptor: call.descriptor })
|
|
65
|
+
}
|
|
66
|
+
: {
|
|
67
|
+
...coordinates,
|
|
68
|
+
phase: "settled",
|
|
69
|
+
outcome: result.outcome,
|
|
70
|
+
value: yield* bounded(result.value),
|
|
71
|
+
...(result.message === undefined ? {} : { message: yield* bounded(result.message) }),
|
|
72
|
+
...(result.code === undefined ? {} : { code: result.code })
|
|
73
|
+
}
|
|
74
|
+
return new JournalEvent.Input({
|
|
75
|
+
runId: JournalEvent.RunId.make(runId),
|
|
76
|
+
sourceId: JournalEvent.SourceId.make(`call-fact-v1:${call.callId}:${phase}`),
|
|
77
|
+
sourceSeq: JournalEvent.SourceSeq.make(0),
|
|
78
|
+
eventType: CallFact.eventType,
|
|
79
|
+
payload
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
return {
|
|
83
|
+
settles: Option.isSome(annotation) && annotation.value.phase === "settled",
|
|
84
|
+
invoked: record("invoked"),
|
|
85
|
+
settled: (outcome: unknown) => record("settled", outcome)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only validation of a journal record another lineage recorded under
|
|
3
|
+
* this run's producer identity.
|
|
4
|
+
*
|
|
5
|
+
* A time-travel fork copies the parent's journal rows verbatim: the copied
|
|
6
|
+
* record keeps the producer identity, but its payload names the parent run and
|
|
7
|
+
* its `meta.lineageId` is the parent's lineage, so this run's re-emission of
|
|
8
|
+
* the same record raises `idempotency_conflict` instead of collapsing into a
|
|
9
|
+
* `Duplicate`. That conflict is benign ONLY when the occupying record is the
|
|
10
|
+
* record being emitted, recorded by a validated ancestor. Anything else in the
|
|
11
|
+
* slot — an unrelated event type, another attempt's coordinates, the opposite
|
|
12
|
+
* terminal state, a record with no retained fork ancestry — is the conflict
|
|
13
|
+
* the journal reported, and it fails closed.
|
|
14
|
+
* @since 1.0.0-rc.0
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { canonicalize, isRecord } from "@smthrs/canonical"
|
|
18
|
+
import { FlowEngine } from "@smthrs/engine"
|
|
19
|
+
import { Journal, JournalEvent } from "@smthrs/journal"
|
|
20
|
+
import type { RunStore } from "@smthrs/run-store"
|
|
21
|
+
import * as Effect from "effect/Effect"
|
|
22
|
+
import * as Schema from "effect/Schema"
|
|
23
|
+
import { RunState } from "../RunState.ts"
|
|
24
|
+
|
|
25
|
+
/** Paged lookup retains only the matching record, including unexpected event types.
|
|
26
|
+
* @category accessors
|
|
27
|
+
* @since 1.0.0-rc.0
|
|
28
|
+
*/
|
|
29
|
+
export const find = (
|
|
30
|
+
journal: Journal.Service,
|
|
31
|
+
runId: string,
|
|
32
|
+
predicate: (entry: JournalEvent.Entry) => boolean
|
|
33
|
+
): Effect.Effect<JournalEvent.Entry | undefined, Journal.JournalError> =>
|
|
34
|
+
Effect.gen(function*() {
|
|
35
|
+
let after: JournalEvent.Seq | undefined
|
|
36
|
+
while (true) {
|
|
37
|
+
const page = yield* journal.entries({
|
|
38
|
+
runId: JournalEvent.RunId.make(runId),
|
|
39
|
+
limit: 128,
|
|
40
|
+
...after === undefined ? {} : { after }
|
|
41
|
+
})
|
|
42
|
+
const entry = page.entries.find(predicate)
|
|
43
|
+
if (entry !== undefined) return entry
|
|
44
|
+
if (!page.hasMore) return undefined
|
|
45
|
+
const next = page.entries.at(-1)?.seq
|
|
46
|
+
if (next === undefined || (after !== undefined && next <= after)) {
|
|
47
|
+
return yield* Effect.fail(
|
|
48
|
+
new Journal.JournalError({ code: "read_failed", message: "cache history cursor did not advance" })
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
after = next
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const sameJson = (left: unknown, right: unknown): boolean =>
|
|
56
|
+
left === undefined || right === undefined
|
|
57
|
+
? left === right
|
|
58
|
+
: canonicalize(left, { loneSurrogates: "escape" }) === canonicalize(right, { loneSurrogates: "escape" })
|
|
59
|
+
|
|
60
|
+
/** The record as the named ancestor would have emitted it: the payload's own
|
|
61
|
+
* `runId` and the lineage in `meta` name that run instead of this one. */
|
|
62
|
+
const asEmittedBy = (record: JournalEvent.Input, runId: string, ancestor: string) => ({
|
|
63
|
+
payload: isRecord(record.payload) && record.payload["runId"] === runId
|
|
64
|
+
? { ...record.payload, runId: ancestor }
|
|
65
|
+
: record.payload,
|
|
66
|
+
meta: isRecord(record.meta) ? { ...record.meta, lineageId: FlowEngine.Lineage.root(ancestor) } : record.meta
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Proves every retained fork prefix between a copied entry and its original.
|
|
71
|
+
* Callers retain their payload and metadata equality rules.
|
|
72
|
+
* @category accessors
|
|
73
|
+
* @since 1.0.0
|
|
74
|
+
*/
|
|
75
|
+
export const prove = (options: {
|
|
76
|
+
readonly journal: Journal.Service
|
|
77
|
+
readonly runs: RunStore.Service
|
|
78
|
+
readonly runId: string
|
|
79
|
+
readonly entry: JournalEvent.Entry
|
|
80
|
+
readonly conflict: Journal.JournalError
|
|
81
|
+
readonly same?: (left: unknown, right: unknown) => boolean
|
|
82
|
+
}) =>
|
|
83
|
+
Effect.gen(function*() {
|
|
84
|
+
const { conflict, journal, runs, same = sameJson } = options
|
|
85
|
+
let entry = options.entry
|
|
86
|
+
const source = (candidate: JournalEvent.Entry) =>
|
|
87
|
+
candidate.sourceId === options.entry.sourceId && candidate.sourceSeq === options.entry.sourceSeq
|
|
88
|
+
let child = options.runId
|
|
89
|
+
const visited = new Set<string>()
|
|
90
|
+
while (!visited.has(child)) {
|
|
91
|
+
visited.add(child)
|
|
92
|
+
const run = yield* runs.get(child).pipe(Effect.mapError((cause) =>
|
|
93
|
+
new Journal.JournalError({
|
|
94
|
+
code: "idempotency_conflict",
|
|
95
|
+
message: conflict.message,
|
|
96
|
+
cause
|
|
97
|
+
})
|
|
98
|
+
))
|
|
99
|
+
const parent = run.parentRunId
|
|
100
|
+
if (parent === null) return yield* Effect.fail(conflict)
|
|
101
|
+
const copied = entry
|
|
102
|
+
const marker = yield* find(journal, child, (candidate) => {
|
|
103
|
+
const value = candidate.payload as {
|
|
104
|
+
readonly childRunId?: unknown
|
|
105
|
+
readonly parentRunId?: unknown
|
|
106
|
+
readonly forkJournalOffset?: unknown
|
|
107
|
+
readonly copiedFromRunId?: unknown
|
|
108
|
+
} | null
|
|
109
|
+
return candidate.eventType === "flows.time-travel.fork-created" &&
|
|
110
|
+
candidate.sourceId === "flows/time-travel/fork" && Number(candidate.sourceSeq) === candidate.seq &&
|
|
111
|
+
value?.childRunId === child &&
|
|
112
|
+
value.parentRunId === parent && typeof value.forkJournalOffset === "number" &&
|
|
113
|
+
Number.isSafeInteger(value.forkJournalOffset) && value.forkJournalOffset >= copied.seq &&
|
|
114
|
+
candidate.seq === value.forkJournalOffset + 1 &&
|
|
115
|
+
(value.copiedFromRunId === undefined || typeof value.copiedFromRunId === "string") &&
|
|
116
|
+
same(value, {
|
|
117
|
+
childRunId: child,
|
|
118
|
+
parentRunId: parent,
|
|
119
|
+
forkJournalOffset: value.forkJournalOffset,
|
|
120
|
+
...(value.copiedFromRunId === undefined ? {} : { copiedFromRunId: value.copiedFromRunId })
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
if (marker === undefined) return yield* Effect.fail(conflict)
|
|
124
|
+
const copiedFrom = (marker.payload as { copiedFromRunId?: string }).copiedFromRunId
|
|
125
|
+
const sourceRunId = copiedFrom ?? parent
|
|
126
|
+
if (copiedFrom !== undefined) {
|
|
127
|
+
const decodeState = Schema.decodeUnknownEffect(Schema.fromJsonString(RunState))
|
|
128
|
+
const state = yield* decodeState(run.stateJson).pipe(Effect.mapError(() => conflict))
|
|
129
|
+
const sourceRun = yield* runs.get(copiedFrom).pipe(Effect.mapError(() => conflict))
|
|
130
|
+
const sourceState = yield* decodeState(sourceRun.stateJson).pipe(Effect.mapError(() => conflict))
|
|
131
|
+
const parentRun = yield* runs.get(parent).pipe(Effect.mapError(() => conflict))
|
|
132
|
+
if (
|
|
133
|
+
!state.forkKeyRunIds?.includes(copiedFrom) || state.parentExecutionId !== parent ||
|
|
134
|
+
sourceState.parentExecutionId === undefined || parentRun.parentRunId !== sourceState.parentExecutionId
|
|
135
|
+
) return yield* Effect.fail(conflict)
|
|
136
|
+
// A carried origin must belong to the run the new parent forked.
|
|
137
|
+
// Its receipt alone never grants reuse of an unrelated run's records.
|
|
138
|
+
const parentFork = yield* find(journal, parent, (candidate) => {
|
|
139
|
+
const value = candidate.payload as { childRunId?: unknown; parentRunId?: unknown } | null
|
|
140
|
+
return candidate.eventType === "flows.time-travel.fork-created" &&
|
|
141
|
+
candidate.sourceId === "flows/time-travel/fork" &&
|
|
142
|
+
Number(candidate.sourceSeq) === candidate.seq &&
|
|
143
|
+
value?.childRunId === parent && value.parentRunId === sourceState.parentExecutionId
|
|
144
|
+
})
|
|
145
|
+
if (parentFork === undefined) return yield* Effect.fail(conflict)
|
|
146
|
+
}
|
|
147
|
+
const cutoff = yield* find(journal, sourceRunId, (candidate) => candidate.seq === marker.seq - 1)
|
|
148
|
+
if (
|
|
149
|
+
cutoff === undefined ||
|
|
150
|
+
!same(marker.meta, { lineageId: (cutoff.meta as { lineageId?: unknown } | null)?.lineageId })
|
|
151
|
+
) {
|
|
152
|
+
return yield* Effect.fail(conflict)
|
|
153
|
+
}
|
|
154
|
+
const original = yield* find(journal, sourceRunId, source)
|
|
155
|
+
if (
|
|
156
|
+
original === undefined || original.seq !== copied.seq || original.emittedAtMs !== copied.emittedAtMs ||
|
|
157
|
+
original.eventType !== copied.eventType || !same(original.payload, copied.payload) ||
|
|
158
|
+
!same(original.meta, copied.meta)
|
|
159
|
+
) return yield* Effect.fail(conflict)
|
|
160
|
+
if (isRecord(original.meta) && original.meta["lineageId"] === FlowEngine.Lineage.root(sourceRunId)) {
|
|
161
|
+
return { ancestor: sourceRunId, record: original }
|
|
162
|
+
}
|
|
163
|
+
child = sourceRunId
|
|
164
|
+
entry = original
|
|
165
|
+
}
|
|
166
|
+
return yield* Effect.fail(conflict)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Accepts the occupying record only when it is `record` as a validated
|
|
171
|
+
* copied-lineage ancestor emitted it; otherwise fails with `conflict`.
|
|
172
|
+
*
|
|
173
|
+
* The shared ancestry proof requires, at each hop, the child's fork marker above the copied prefix, the parent row the
|
|
174
|
+
* marker was cut at, and the parent's own copy of the record at the same
|
|
175
|
+
* `seq`, identical in content. The walk ends at the run whose lineage the
|
|
176
|
+
* record carries, and that run's original must be the record being emitted
|
|
177
|
+
* under that run's identity: same event type, same payload with the ancestor
|
|
178
|
+
* in place of this run, same meta.
|
|
179
|
+
* @category accessors
|
|
180
|
+
* @since 1.0.0-rc.0
|
|
181
|
+
*/
|
|
182
|
+
export const accept = (options: {
|
|
183
|
+
readonly journal: Journal.Service
|
|
184
|
+
readonly runs: RunStore.Service
|
|
185
|
+
readonly runId: string
|
|
186
|
+
readonly record: JournalEvent.Input
|
|
187
|
+
readonly conflict: Journal.JournalError
|
|
188
|
+
}): Effect.Effect<void, Journal.JournalError> =>
|
|
189
|
+
Effect.gen(function*() {
|
|
190
|
+
const { conflict, journal, record } = options
|
|
191
|
+
const sourceSeq = record.sourceSeq ?? 0
|
|
192
|
+
const source = (entry: JournalEvent.Entry) =>
|
|
193
|
+
entry.sourceId === record.sourceId && Number(entry.sourceSeq) === Number(sourceSeq)
|
|
194
|
+
const entry = yield* find(journal, options.runId, source)
|
|
195
|
+
if (entry === undefined || entry.eventType !== record.eventType) return yield* Effect.fail(conflict)
|
|
196
|
+
const original = yield* prove({ ...options, entry })
|
|
197
|
+
const expected = asEmittedBy(record, options.runId, original.ancestor)
|
|
198
|
+
return sameJson(original.record.payload, expected.payload) && sameJson(original.record.meta, expected.meta)
|
|
199
|
+
? undefined
|
|
200
|
+
: yield* Effect.fail(conflict)
|
|
201
|
+
})
|