@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,1090 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var PlanScheduler_exports = {};
|
|
30
|
+
__export(PlanScheduler_exports, {
|
|
31
|
+
NodeExecutor: () => NodeExecutor,
|
|
32
|
+
PlanScheduler: () => PlanScheduler,
|
|
33
|
+
SchedulerError: () => SchedulerError,
|
|
34
|
+
layer: () => layer,
|
|
35
|
+
layerExecutor: () => layerExecutor,
|
|
36
|
+
make: () => make,
|
|
37
|
+
recertify: () => recertify
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(PlanScheduler_exports);
|
|
40
|
+
var import_crypto = require("@smthrs/crypto");
|
|
41
|
+
var import_engine = require("@smthrs/engine");
|
|
42
|
+
var import_journal = require("@smthrs/journal");
|
|
43
|
+
var import_plan = require("@smthrs/plan");
|
|
44
|
+
var import_plan_store = require("@smthrs/plan-store");
|
|
45
|
+
var FileSet = __toESM(require("@smthrs/plan/FileSet"), 1);
|
|
46
|
+
var import_run_store = require("@smthrs/run-store");
|
|
47
|
+
var Cause = __toESM(require("effect/Cause"), 1);
|
|
48
|
+
var Clock = __toESM(require("effect/Clock"), 1);
|
|
49
|
+
var Context = __toESM(require("effect/Context"), 1);
|
|
50
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
51
|
+
var Exit = __toESM(require("effect/Exit"), 1);
|
|
52
|
+
var FileSystem = __toESM(require("effect/FileSystem"), 1);
|
|
53
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
54
|
+
var Metric = __toESM(require("effect/Metric"), 1);
|
|
55
|
+
var Option = __toESM(require("effect/Option"), 1);
|
|
56
|
+
var Queue = __toESM(require("effect/Queue"), 1);
|
|
57
|
+
var Ref = __toESM(require("effect/Ref"), 1);
|
|
58
|
+
var Result = __toESM(require("effect/Result"), 1);
|
|
59
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
60
|
+
var EngineStoreMetrics = __toESM(require("./EngineStoreMetrics.js"), 1);
|
|
61
|
+
var ActionPersistence = __toESM(require("./internal/ActionPersistence.js"), 1);
|
|
62
|
+
var AttemptAdmission = __toESM(require("./internal/AttemptAdmission.js"), 1);
|
|
63
|
+
var CacheAgeVerdicts = __toESM(require("./internal/CacheAgeVerdicts.js"), 1);
|
|
64
|
+
var FileEnumeration = __toESM(require("./internal/FileEnumeration.js"), 1);
|
|
65
|
+
var JournalRecords = __toESM(require("./internal/JournalRecords.js"), 1);
|
|
66
|
+
var import_Ordering = require("./internal/Ordering.js");
|
|
67
|
+
var PlanInputs = __toESM(require("./internal/PlanInputs.js"), 1);
|
|
68
|
+
var PlanMerges = __toESM(require("./internal/PlanMerges.js"), 1);
|
|
69
|
+
var RuntimeGraph = __toESM(require("./internal/RuntimeGraph.js"), 1);
|
|
70
|
+
var PlanInputStore = __toESM(require("./PlanInputStore.js"), 1);
|
|
71
|
+
var PlanMergeStore = __toESM(require("./PlanMergeStore.js"), 1);
|
|
72
|
+
var Reconciliation = __toESM(require("./Reconciliation.js"), 1);
|
|
73
|
+
var ReplayOnly = __toESM(require("./ReplayOnly.js"), 1);
|
|
74
|
+
var Selection = __toESM(require("./Selection.js"), 1);
|
|
75
|
+
var StepBoundary = __toESM(require("./StepBoundary.js"), 1);
|
|
76
|
+
var WorkspaceSandbox = __toESM(require("./WorkspaceSandbox.js"), 1);
|
|
77
|
+
class NodeExecutor extends Context.Service()("@smthrs/engine-store/NodeExecutor") {
|
|
78
|
+
}
|
|
79
|
+
const layerExecutor = (executor) => Layer.succeed(NodeExecutor, executor);
|
|
80
|
+
class SchedulerError extends Schema.TaggedError()("@smthrs/engine-store/SchedulerError", {
|
|
81
|
+
code: Schema.Literals([
|
|
82
|
+
"invalid_plan",
|
|
83
|
+
"boundary_unavailable",
|
|
84
|
+
"key_uncomputable",
|
|
85
|
+
"elaboration_failed",
|
|
86
|
+
"store_failed"
|
|
87
|
+
]),
|
|
88
|
+
message: Schema.String,
|
|
89
|
+
cause: Schema.optional(Schema.Unknown),
|
|
90
|
+
/** Failures while settling siblings after the primary scheduler failure. */
|
|
91
|
+
cleanupErrors: Schema.optional(Schema.Array(Schema.Unknown))
|
|
92
|
+
}) {
|
|
93
|
+
}
|
|
94
|
+
class PlanScheduler extends Context.Service()("@smthrs/engine-store/PlanScheduler") {
|
|
95
|
+
}
|
|
96
|
+
const actionOf = (node) => {
|
|
97
|
+
const body = node.material.body;
|
|
98
|
+
if (typeof body !== "object" || body === null) return void 0;
|
|
99
|
+
const fields = body;
|
|
100
|
+
const named = typeof fields["action"] === "string" ? fields["action"] : fields["flow"];
|
|
101
|
+
return typeof named === "string" && named !== "" ? named : void 0;
|
|
102
|
+
};
|
|
103
|
+
const nodeSummary = (node) => {
|
|
104
|
+
const action = actionOf(node);
|
|
105
|
+
return {
|
|
106
|
+
id: node.id,
|
|
107
|
+
kind: node.kind,
|
|
108
|
+
dependsOn: node.dependsOn,
|
|
109
|
+
tier: node.material.kind,
|
|
110
|
+
key: node.key,
|
|
111
|
+
generation: node.generation,
|
|
112
|
+
...action === void 0 ? {} : { action }
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
const unmeasured = "unmeasured";
|
|
116
|
+
const isConflict = (cause) => cause.reasons.some((reason) => Cause.isFailReason(reason) && WorkspaceSandbox.isMaterializationConflict(reason.error));
|
|
117
|
+
const DeviationPayload = Schema.Struct({
|
|
118
|
+
stepKeyDigest: Schema.NonEmptyString,
|
|
119
|
+
attempt: Schema.Int,
|
|
120
|
+
paths: Schema.Array(Schema.String),
|
|
121
|
+
diffIdentity: Schema.String
|
|
122
|
+
});
|
|
123
|
+
const decodeDeviation = Schema.decodeUnknownOption(DeviationPayload);
|
|
124
|
+
const digestOf = Schema.decodeUnknownEffect(import_crypto.Sha256);
|
|
125
|
+
const storeFailure = (message) => (cause) => new SchedulerError({ code: "store_failed", message, cause });
|
|
126
|
+
const nonNegativeSafeInteger = (name, value) => {
|
|
127
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
128
|
+
throw new RangeError(`${name} must be a non-negative safe integer`);
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
};
|
|
132
|
+
const make = (options) => {
|
|
133
|
+
const admission = AttemptAdmission.makeUnsafe();
|
|
134
|
+
const cacheAgeVerdict = CacheAgeVerdicts.make(options.runId);
|
|
135
|
+
const rebaseLimit = nonNegativeSafeInteger("rebaseLimit", options.rebaseLimit ?? 3);
|
|
136
|
+
const scheduling = import_plan.Scheduling.make(options.concurrency);
|
|
137
|
+
const capturedEnvironment = Result.try(
|
|
138
|
+
() => Schema.decodeUnknownSync(Schema.UndefinedOr(import_plan.StepKey.EnvironmentIdentity))(
|
|
139
|
+
options.environment,
|
|
140
|
+
{ onExcessProperty: "error" }
|
|
141
|
+
)
|
|
142
|
+
);
|
|
143
|
+
const lineageId = import_engine.FlowEngine.Lineage.root(options.runId);
|
|
144
|
+
const source = (suffix) => ({ runId: options.runId, sourceId: `${options.sourceId}/${suffix}`, lineageId });
|
|
145
|
+
const emit = (record2) => Effect.flatMap(import_journal.Journal.Journal, (journal) => journal.emitDurable(record2, options.owner)).pipe(
|
|
146
|
+
Effect.catch(
|
|
147
|
+
(error) => error.code === "fence_lost" ? Effect.interrupt : Effect.fail(storeFailure("the scheduler could not journal a record")(error))
|
|
148
|
+
)
|
|
149
|
+
);
|
|
150
|
+
const atomically = (message, effect) => Effect.flatMap(import_journal.Journal.Journal, (journal) => journal.transact(effect)).pipe(
|
|
151
|
+
Effect.mapError((error) => error instanceof SchedulerError ? error : storeFailure(message)(error))
|
|
152
|
+
);
|
|
153
|
+
const verifyPlan = (candidate) => import_plan.Plan.verify(candidate).pipe(
|
|
154
|
+
Effect.mapError(
|
|
155
|
+
(cause) => new SchedulerError({ code: "invalid_plan", message: "the scheduler requires a verified plan", cause })
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
const record = Effect.fn("PlanScheduler.record")(
|
|
159
|
+
(candidate) => Effect.gen(function* () {
|
|
160
|
+
const plan = yield* verifyPlan(candidate);
|
|
161
|
+
yield* Effect.annotateCurrentSpan({
|
|
162
|
+
runId: options.runId,
|
|
163
|
+
planId: plan.planId,
|
|
164
|
+
digest: plan.digest,
|
|
165
|
+
generation: plan.generation
|
|
166
|
+
});
|
|
167
|
+
const store = yield* import_plan_store.PlanStore.PlanStore;
|
|
168
|
+
const now = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor));
|
|
169
|
+
const outcome = yield* atomically(
|
|
170
|
+
"could not atomically record the plan",
|
|
171
|
+
Effect.gen(function* () {
|
|
172
|
+
const recorded = yield* store.record(plan, now).pipe(
|
|
173
|
+
Effect.mapError(storeFailure("could not record the plan"))
|
|
174
|
+
);
|
|
175
|
+
yield* emit(JournalRecords.planRecorded(source(`plan/${plan.planId}`), {
|
|
176
|
+
planId: plan.planId,
|
|
177
|
+
flow: plan.flow,
|
|
178
|
+
digest: plan.digest,
|
|
179
|
+
baseDigest: plan.baseDigest,
|
|
180
|
+
generation: plan.generation,
|
|
181
|
+
nodes: plan.nodes.length,
|
|
182
|
+
outcome: recorded._tag,
|
|
183
|
+
// The graph itself, beside the count it has always carried. A
|
|
184
|
+
// reader that only knows how MANY nodes ran cannot show which
|
|
185
|
+
// ones, and the count stays because the CLI's run progress reads
|
|
186
|
+
// it as a number.
|
|
187
|
+
graph: { nodes: plan.nodes.map(nodeSummary) }
|
|
188
|
+
}));
|
|
189
|
+
return recorded;
|
|
190
|
+
})
|
|
191
|
+
);
|
|
192
|
+
yield* Effect.annotateCurrentSpan({ outcome: outcome._tag });
|
|
193
|
+
return outcome;
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
const append = Effect.fn("PlanScheduler.append")(
|
|
197
|
+
(candidate) => Effect.gen(function* () {
|
|
198
|
+
const plan = yield* verifyPlan(candidate);
|
|
199
|
+
yield* Effect.annotateCurrentSpan({
|
|
200
|
+
runId: options.runId,
|
|
201
|
+
planId: plan.planId,
|
|
202
|
+
digest: plan.digest,
|
|
203
|
+
generation: plan.generation
|
|
204
|
+
});
|
|
205
|
+
const store = yield* import_plan_store.PlanStore.PlanStore;
|
|
206
|
+
yield* atomically(
|
|
207
|
+
"could not atomically append the subgraph",
|
|
208
|
+
Effect.gen(function* () {
|
|
209
|
+
yield* store.append(plan).pipe(Effect.mapError(storeFailure("could not append the subgraph")));
|
|
210
|
+
yield* emit(JournalRecords.subgraphAppended(source(`plan/${plan.planId}/${plan.generation}`), {
|
|
211
|
+
planId: plan.planId,
|
|
212
|
+
digest: plan.digest,
|
|
213
|
+
baseDigest: plan.baseDigest,
|
|
214
|
+
generation: plan.generation,
|
|
215
|
+
nodeIds: import_plan.Plan.generationNodes(plan).map((node) => node.id),
|
|
216
|
+
graph: { nodes: import_plan.Plan.generationNodes(plan).map(nodeSummary) }
|
|
217
|
+
}));
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
yield* Effect.annotateCurrentSpan({ outcome: "appended" });
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
const run = Effect.fn("PlanScheduler.run")(
|
|
224
|
+
(candidate) => Effect.gen(function* () {
|
|
225
|
+
if (Result.isFailure(capturedEnvironment)) {
|
|
226
|
+
return yield* Effect.fail(
|
|
227
|
+
new SchedulerError({
|
|
228
|
+
code: "key_uncomputable",
|
|
229
|
+
message: "the scheduler requires a valid execution environment identity"
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const environment = capturedEnvironment.success;
|
|
234
|
+
const environmentDigest = yield* import_plan.StepKey.environmentIdentity(environment).pipe(Effect.mapError(
|
|
235
|
+
(cause) => new SchedulerError({ code: "key_uncomputable", message: "could not bind the execution environment", cause })
|
|
236
|
+
));
|
|
237
|
+
const initial = yield* verifyPlan(candidate);
|
|
238
|
+
yield* Effect.annotateCurrentSpan({
|
|
239
|
+
runId: options.runId,
|
|
240
|
+
planId: initial.planId,
|
|
241
|
+
digest: initial.digest,
|
|
242
|
+
nodes: initial.nodes.length
|
|
243
|
+
});
|
|
244
|
+
const boundaries = yield* StepBoundary.StepBoundary;
|
|
245
|
+
const fileSystem = yield* Effect.serviceOption(FileSystem.FileSystem);
|
|
246
|
+
const executor = yield* NodeExecutor;
|
|
247
|
+
const journal = yield* import_journal.Journal.Journal;
|
|
248
|
+
const inputStore = yield* PlanInputStore.PlanInputStore;
|
|
249
|
+
const mergeStore = yield* PlanMergeStore.PlanMergeStore;
|
|
250
|
+
const mergeIdentity = {
|
|
251
|
+
runId: options.runId,
|
|
252
|
+
planId: initial.planId,
|
|
253
|
+
baseDigest: initial.baseDigest,
|
|
254
|
+
environmentDigest
|
|
255
|
+
};
|
|
256
|
+
const mergeFailure = (cause) => cause.code === "fence_lost" ? Effect.interrupt : Effect.fail(storeFailure("could not recover or persist the plan's merge decisions")(cause));
|
|
257
|
+
const recoveredMerges = yield* mergeStore.list(mergeIdentity, options.owner).pipe(Effect.catch(mergeFailure));
|
|
258
|
+
const reconciler = Option.getOrElse(
|
|
259
|
+
yield* Effect.serviceOption(Reconciliation.Reconciliation),
|
|
260
|
+
Reconciliation.makeDefault
|
|
261
|
+
);
|
|
262
|
+
const selector = Option.getOrElse(
|
|
263
|
+
yield* Effect.serviceOption(Selection.Selection),
|
|
264
|
+
Selection.makeNoop
|
|
265
|
+
);
|
|
266
|
+
const replayOnly = Option.getOrUndefined(yield* Effect.serviceOption(ReplayOnly.ReplayOnly));
|
|
267
|
+
yield* Effect.logDebug("scheduler run started", {
|
|
268
|
+
digest: initial.digest,
|
|
269
|
+
nodes: initial.nodes.length
|
|
270
|
+
});
|
|
271
|
+
let abortedForFailure = false;
|
|
272
|
+
const cleanupErrors = [];
|
|
273
|
+
let plan = yield* PlanMerges.recover(initial, recoveredMerges).pipe(Effect.catch(mergeFailure));
|
|
274
|
+
const graph = RuntimeGraph.make(plan.nodes);
|
|
275
|
+
const states = graph.states;
|
|
276
|
+
const results = /* @__PURE__ */ new Map();
|
|
277
|
+
const digestMemo = import_plan.StepKey.makeDigestMemo();
|
|
278
|
+
const verdicts = [];
|
|
279
|
+
const appended = [];
|
|
280
|
+
const digestToNode = /* @__PURE__ */ new Map();
|
|
281
|
+
const deviationSignatures = /* @__PURE__ */ new Map();
|
|
282
|
+
const writers = /* @__PURE__ */ new Map();
|
|
283
|
+
const writerEntries = [];
|
|
284
|
+
const nodesById = /* @__PURE__ */ new Map();
|
|
285
|
+
let cursor = void 0;
|
|
286
|
+
const events = yield* Queue.unbounded();
|
|
287
|
+
const stateOf = (node) => states.get(node.id);
|
|
288
|
+
const indexWriters = (nodes) => {
|
|
289
|
+
for (const node of nodes) {
|
|
290
|
+
nodesById.set(node.id, node);
|
|
291
|
+
for (const entry of [...FileSet.expand(node.effects.writes), ...node.effects.removes ?? []]) {
|
|
292
|
+
writerEntries.push({ entry, nodeId: node.id });
|
|
293
|
+
if (typeof entry === "string" && !writers.has(entry)) {
|
|
294
|
+
writers.set(entry, node.id);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
indexWriters(plan.nodes);
|
|
300
|
+
const writerFor = (path) => writers.get(path) ?? writerEntries.find(({ entry }) => FileSet.overlaps(entry, path))?.nodeId;
|
|
301
|
+
const writerScopesBefore = (node) => {
|
|
302
|
+
const scopes = [];
|
|
303
|
+
graph.visitAncestors(node, (predecessor) => {
|
|
304
|
+
scopes.push(...FileSet.expand(predecessor.effects.writes), ...predecessor.effects.removes ?? []);
|
|
305
|
+
});
|
|
306
|
+
return scopes;
|
|
307
|
+
};
|
|
308
|
+
const expandReads = (entries, what) => Effect.gen(function* () {
|
|
309
|
+
const expanded = [];
|
|
310
|
+
for (const entry of entries) {
|
|
311
|
+
if (typeof entry === "string") {
|
|
312
|
+
expanded.push({ entry, paths: [entry] });
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (Option.isNone(fileSystem)) {
|
|
316
|
+
return yield* Effect.fail(
|
|
317
|
+
new SchedulerError({
|
|
318
|
+
code: "boundary_unavailable",
|
|
319
|
+
message: `the host cannot expand ${what} without a FileSystem`
|
|
320
|
+
})
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
const matches = yield* FileEnumeration.expandGlob(fileSystem.value, entry).pipe(
|
|
324
|
+
Effect.mapError(
|
|
325
|
+
(cause) => new SchedulerError({
|
|
326
|
+
code: "boundary_unavailable",
|
|
327
|
+
message: `the host could not expand ${what}`,
|
|
328
|
+
cause
|
|
329
|
+
})
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
expanded.push({ entry, paths: matches });
|
|
333
|
+
}
|
|
334
|
+
return expanded;
|
|
335
|
+
});
|
|
336
|
+
const prepare = (paths, what) => boundaries.prepare({
|
|
337
|
+
readSet: [...new Set(paths)].sort().map((path) => ({ path, digest: unmeasured })),
|
|
338
|
+
writeSet: [],
|
|
339
|
+
boundaryMode: "hard"
|
|
340
|
+
}).pipe(
|
|
341
|
+
Effect.mapError(
|
|
342
|
+
(cause) => new SchedulerError({
|
|
343
|
+
code: "boundary_unavailable",
|
|
344
|
+
message: `the host could not measure ${what}`,
|
|
345
|
+
cause
|
|
346
|
+
})
|
|
347
|
+
)
|
|
348
|
+
);
|
|
349
|
+
const expandProducedMatches = (glob, writerScopes, what) => Effect.gen(function* () {
|
|
350
|
+
const scopes = writerScopes.filter((entry) => FileSet.overlaps(glob, entry));
|
|
351
|
+
if (scopes.length === 0) return [];
|
|
352
|
+
if (Option.isNone(fileSystem)) {
|
|
353
|
+
return yield* Effect.fail(
|
|
354
|
+
new SchedulerError({
|
|
355
|
+
code: "boundary_unavailable",
|
|
356
|
+
message: `the host cannot expand ${what} without a FileSystem`
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
const paths = /* @__PURE__ */ new Set();
|
|
361
|
+
for (const entry of scopes) {
|
|
362
|
+
if (typeof entry === "string") {
|
|
363
|
+
const info = yield* fileSystem.value.stat(entry).pipe(
|
|
364
|
+
Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(void 0)),
|
|
365
|
+
Effect.mapError(
|
|
366
|
+
(cause) => new SchedulerError({
|
|
367
|
+
code: "boundary_unavailable",
|
|
368
|
+
message: `the host could not expand ${what}`,
|
|
369
|
+
cause
|
|
370
|
+
})
|
|
371
|
+
)
|
|
372
|
+
);
|
|
373
|
+
if (info?.type === "File") paths.add(entry);
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const matches = FileSet.isGlob(entry) ? yield* FileEnumeration.expandGlob(fileSystem.value, entry).pipe(
|
|
377
|
+
Effect.mapError(
|
|
378
|
+
(cause) => new SchedulerError({
|
|
379
|
+
code: "boundary_unavailable",
|
|
380
|
+
message: `the host could not expand ${what}`,
|
|
381
|
+
cause
|
|
382
|
+
})
|
|
383
|
+
)
|
|
384
|
+
) : yield* FileEnumeration.filesUnder(fileSystem.value, entry.path).pipe(
|
|
385
|
+
Effect.mapError(
|
|
386
|
+
(cause) => new SchedulerError({
|
|
387
|
+
code: "boundary_unavailable",
|
|
388
|
+
message: `the host could not expand ${what}`,
|
|
389
|
+
cause
|
|
390
|
+
})
|
|
391
|
+
)
|
|
392
|
+
);
|
|
393
|
+
for (const path of matches) {
|
|
394
|
+
if (FileSet.matchesGlob(glob, path)) paths.add(path);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return [...paths].sort();
|
|
398
|
+
});
|
|
399
|
+
const pinned = /* @__PURE__ */ new Map();
|
|
400
|
+
const observedReads = /* @__PURE__ */ new Map();
|
|
401
|
+
const inputFailure = (cause) => cause.code === "fence_lost" ? Effect.interrupt : Effect.fail(storeFailure("could not recover or persist the plan's source observations")(cause));
|
|
402
|
+
const observeReads = (nodes, generation, what, commit) => Effect.gen(function* () {
|
|
403
|
+
const address = {
|
|
404
|
+
runId: options.runId,
|
|
405
|
+
planId: initial.planId,
|
|
406
|
+
baseDigest: initial.baseDigest,
|
|
407
|
+
environmentDigest,
|
|
408
|
+
generation
|
|
409
|
+
};
|
|
410
|
+
const stored = yield* inputStore.get(address, options.owner).pipe(Effect.catch(inputFailure));
|
|
411
|
+
let snapshot;
|
|
412
|
+
if (Option.isSome(stored)) {
|
|
413
|
+
snapshot = stored.value;
|
|
414
|
+
} else {
|
|
415
|
+
const unpinned = /* @__PURE__ */ new Set();
|
|
416
|
+
const observedNodes = [];
|
|
417
|
+
for (const node of nodes) {
|
|
418
|
+
const observed = [];
|
|
419
|
+
const reads = FileSet.expandReads(node.effects.reads);
|
|
420
|
+
const writerScopes = reads.length === 0 ? [] : writerScopesBefore(node);
|
|
421
|
+
for (const { entry, paths } of yield* expandReads(reads, what)) {
|
|
422
|
+
const sourcePaths = paths.filter((path) => !writerScopes.some((scope) => FileSet.overlaps(scope, path)));
|
|
423
|
+
for (const path of sourcePaths) {
|
|
424
|
+
if (!pinned.has(path)) unpinned.add(path);
|
|
425
|
+
}
|
|
426
|
+
observed.push({ entry, sourcePaths });
|
|
427
|
+
}
|
|
428
|
+
observedNodes.push({ id: node.id, key: node.key, reads: observed });
|
|
429
|
+
}
|
|
430
|
+
const pins = unpinned.size === 0 ? [] : (yield* prepare([...unpinned], what)).readSnapshot;
|
|
431
|
+
const measured = {
|
|
432
|
+
version: 1,
|
|
433
|
+
generation,
|
|
434
|
+
nodes: observedNodes,
|
|
435
|
+
pins
|
|
436
|
+
};
|
|
437
|
+
yield* PlanInputs.validate(measured, nodes, pinned, writerScopesBefore).pipe(Effect.catch(inputFailure));
|
|
438
|
+
snapshot = commit === void 0 ? yield* inputStore.record(address, measured, options.owner).pipe(Effect.catch(inputFailure)) : measured;
|
|
439
|
+
}
|
|
440
|
+
if (commit !== void 0) snapshot = yield* commit(snapshot);
|
|
441
|
+
const nextPins = yield* PlanInputs.validate(snapshot, nodes, pinned, writerScopesBefore).pipe(
|
|
442
|
+
Effect.catch(inputFailure)
|
|
443
|
+
);
|
|
444
|
+
for (const node of snapshot.nodes) observedReads.set(node.id, node.reads);
|
|
445
|
+
for (const [path, digest] of nextPins) pinned.set(path, digest);
|
|
446
|
+
});
|
|
447
|
+
for (let generation = 0; generation <= plan.generation; generation++) {
|
|
448
|
+
yield* observeReads(
|
|
449
|
+
plan.nodes.filter((node) => node.generation === generation),
|
|
450
|
+
generation,
|
|
451
|
+
"the plan's source inputs"
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
for (const { intent } of recoveredMerges) {
|
|
455
|
+
const state = stateOf(nodesById.get(intent.nodeId));
|
|
456
|
+
graph.stage(intent.nodeId, "skipped");
|
|
457
|
+
state.dispatchKey = intent.dispatchKey;
|
|
458
|
+
state.attempts = intent.attempts;
|
|
459
|
+
state.rebases = intent.rebases;
|
|
460
|
+
}
|
|
461
|
+
graph.reconcile();
|
|
462
|
+
const measure = (node) => Effect.gen(function* () {
|
|
463
|
+
const measured = /* @__PURE__ */ new Map();
|
|
464
|
+
const produced = /* @__PURE__ */ new Set();
|
|
465
|
+
const observed = observedReads.get(node.id);
|
|
466
|
+
const writerScopes = observed.length === 0 ? [] : writerScopesBefore(node);
|
|
467
|
+
for (const read of observed) {
|
|
468
|
+
if (typeof read.entry === "string") {
|
|
469
|
+
if (read.sourcePaths.length === 0) produced.add(read.entry);
|
|
470
|
+
else measured.set(read.entry, pinned.get(read.entry));
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
for (const path of read.sourcePaths) measured.set(path, pinned.get(path));
|
|
474
|
+
for (const path of yield* expandProducedMatches(read.entry, writerScopes, `the inputs of ${node.id}`)) {
|
|
475
|
+
produced.add(path);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (produced.size > 0) {
|
|
479
|
+
const prepared = yield* prepare([...produced], `the inputs of ${node.id}`);
|
|
480
|
+
for (const entry of prepared.readSnapshot) measured.set(entry.path, entry.digest);
|
|
481
|
+
}
|
|
482
|
+
return {
|
|
483
|
+
readSet: [...measured].sort(([left], [right]) => (0, import_Ordering.compareText)(left, right)).map(([path, digest]) => ({
|
|
484
|
+
path,
|
|
485
|
+
digest
|
|
486
|
+
})),
|
|
487
|
+
writeSet: FileSet.expand(node.effects.writes),
|
|
488
|
+
// Declared removals travel with the boundary: they are what makes
|
|
489
|
+
// an absent declared output legitimate rather than a defect.
|
|
490
|
+
...node.effects.removes === void 0 ? {} : { removes: node.effects.removes },
|
|
491
|
+
boundaryMode: node.effects.boundaryMode
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
const dispatchKeyFor = (node, boundary, settledResults) => (node.material.kind === "sealed" ? import_plan.StepKey.dispatchIdentity({
|
|
495
|
+
material: node.material,
|
|
496
|
+
results: Object.fromEntries(
|
|
497
|
+
node.material.inputs.flatMap(
|
|
498
|
+
(input) => input._tag === "Ref" ? [[input.from, settledResults.get(input.from)]] : []
|
|
499
|
+
)
|
|
500
|
+
),
|
|
501
|
+
digestMemo,
|
|
502
|
+
environment,
|
|
503
|
+
hermetic: {
|
|
504
|
+
...boundary,
|
|
505
|
+
readSet: StepBoundary.exactReads(boundary)
|
|
506
|
+
}
|
|
507
|
+
}) : import_plan.StepKey.ordinal({
|
|
508
|
+
runId: options.runId,
|
|
509
|
+
// Stable structural scope, never admission order. The declaration
|
|
510
|
+
// fingerprint prevents a changed plan from reusing an old attempt.
|
|
511
|
+
parentScope: JSON.stringify(["plan-node/v1", initial.planId, node.id, node.key]),
|
|
512
|
+
ordinal: 0,
|
|
513
|
+
tier: node.material.kind
|
|
514
|
+
})).pipe(
|
|
515
|
+
/* v8 ignore next 3 -- verified plans have serializable material, admission resolves every dependency, and successful upstream values already crossed durable serialization; key derivation still exposes its honest failure channel */
|
|
516
|
+
Effect.mapError(
|
|
517
|
+
(cause) => new SchedulerError({ code: "key_uncomputable", message: `could not key ${node.id}`, cause })
|
|
518
|
+
)
|
|
519
|
+
);
|
|
520
|
+
const runtimeStrategyOf = (node) => node.conflicts.some((conflict) => conflict.runtime === "stop-merge") ? "stop-merge" : node.runtime;
|
|
521
|
+
const markSettled = (node, outcome) => {
|
|
522
|
+
graph.stage(node.id, outcome);
|
|
523
|
+
};
|
|
524
|
+
const emitSettlement = (node, sourceSeq) => Effect.gen(function* () {
|
|
525
|
+
const state = stateOf(node);
|
|
526
|
+
const action = actionOf(node);
|
|
527
|
+
yield* emit(JournalRecords.nodeSettled({ ...source(`node/${node.id}/settled`), sourceSeq }, {
|
|
528
|
+
planId: plan.planId,
|
|
529
|
+
nodeId: node.id,
|
|
530
|
+
planKey: node.key,
|
|
531
|
+
dispatchKey: state.dispatchKey,
|
|
532
|
+
outcome: state.outcome,
|
|
533
|
+
attempts: state.attempts,
|
|
534
|
+
rebases: state.rebases,
|
|
535
|
+
...action === void 0 ? {} : { action }
|
|
536
|
+
}));
|
|
537
|
+
yield* Metric.update(EngineStoreMetrics.node[state.outcome], 1);
|
|
538
|
+
});
|
|
539
|
+
const settle = (node, outcome) => {
|
|
540
|
+
markSettled(node, outcome);
|
|
541
|
+
graph.reconcile();
|
|
542
|
+
return emitSettlement(node);
|
|
543
|
+
};
|
|
544
|
+
const applyVerdict = (nodeId, verdict, trigger) => Effect.gen(function* () {
|
|
545
|
+
verdicts.push({ nodeId, verdict });
|
|
546
|
+
yield* emit(JournalRecords.nodeReconciled(source(`node/${nodeId}/reconciled/${verdicts.length}`), {
|
|
547
|
+
planId: plan.planId,
|
|
548
|
+
nodeId,
|
|
549
|
+
trigger,
|
|
550
|
+
verdict
|
|
551
|
+
}));
|
|
552
|
+
if (verdict._tag === "Fail") {
|
|
553
|
+
graph.stage(nodeId, "failed");
|
|
554
|
+
results.delete(nodeId);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (verdict._tag === "Reorder") {
|
|
558
|
+
graph.reorder(nodeId, verdict.dependsOn);
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
const dispatch = Effect.fn(
|
|
562
|
+
"PlanScheduler.dispatch"
|
|
563
|
+
)(function* (node, start) {
|
|
564
|
+
return yield* Effect.gen(function* () {
|
|
565
|
+
yield* Effect.annotateCurrentSpan({
|
|
566
|
+
runId: options.runId,
|
|
567
|
+
planId: plan.planId,
|
|
568
|
+
nodeId: node.id,
|
|
569
|
+
kind: node.kind,
|
|
570
|
+
planKey: node.key
|
|
571
|
+
});
|
|
572
|
+
let dispatchKey = start.dispatchKey;
|
|
573
|
+
let attempts = start.attempts;
|
|
574
|
+
let rebases = start.rebases;
|
|
575
|
+
while (true) {
|
|
576
|
+
const boundary = yield* measure(node);
|
|
577
|
+
const measuredKey = yield* dispatchKeyFor(node, boundary, start.results);
|
|
578
|
+
if (dispatchKey !== "" && dispatchKey !== measuredKey) {
|
|
579
|
+
yield* emit(JournalRecords.nodeInvalidated(source(`node/${node.id}/${attempts}/invalidated`), {
|
|
580
|
+
planId: plan.planId,
|
|
581
|
+
nodeId: node.id,
|
|
582
|
+
planKey: node.key,
|
|
583
|
+
from: dispatchKey,
|
|
584
|
+
to: measuredKey,
|
|
585
|
+
reason: "measured-inputs-changed"
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
dispatchKey = measuredKey;
|
|
589
|
+
attempts = attempts + 1;
|
|
590
|
+
yield* Effect.annotateCurrentSpan({ dispatchKey, attempt: attempts });
|
|
591
|
+
const action = actionOf(node);
|
|
592
|
+
yield* emit(JournalRecords.nodeScheduled(source(`node/${node.id}/${attempts}`), {
|
|
593
|
+
planId: plan.planId,
|
|
594
|
+
nodeId: node.id,
|
|
595
|
+
kind: node.kind,
|
|
596
|
+
planKey: node.key,
|
|
597
|
+
dispatchKey,
|
|
598
|
+
attempt: attempts,
|
|
599
|
+
priority: node.priority,
|
|
600
|
+
waited: start.waited,
|
|
601
|
+
...action === void 0 ? {} : { action }
|
|
602
|
+
}));
|
|
603
|
+
const dispatchDigest = yield* Effect.orDie(digestOf(dispatchKey));
|
|
604
|
+
yield* Queue.offer(events, { _tag: "AttemptKeyed", nodeId: node.id, digest: dispatchDigest });
|
|
605
|
+
const ran = yield* Ref.make(false);
|
|
606
|
+
const exit = yield* ActionPersistence.make({
|
|
607
|
+
runId: options.runId,
|
|
608
|
+
owner: options.owner,
|
|
609
|
+
admission,
|
|
610
|
+
cacheAgeVerdict,
|
|
611
|
+
replayOnly,
|
|
612
|
+
sourceId: `${options.sourceId}/node/${node.id}`,
|
|
613
|
+
execute: () => Ref.set(ran, true).pipe(
|
|
614
|
+
Effect.andThen(executor.execute({ node, attempt: attempts, boundary, inputs: start.inputs }))
|
|
615
|
+
)
|
|
616
|
+
})({
|
|
617
|
+
action: {},
|
|
618
|
+
attempt: attempts,
|
|
619
|
+
key: dispatchKey,
|
|
620
|
+
tier: node.material.kind,
|
|
621
|
+
nondeterministic: node.material.nondeterministic,
|
|
622
|
+
metadata: boundary
|
|
623
|
+
}).pipe(
|
|
624
|
+
Effect.onInterrupt(
|
|
625
|
+
() => abortedForFailure ? atomically(
|
|
626
|
+
"could not settle a sibling aborted by scheduler failure",
|
|
627
|
+
Effect.gen(function* () {
|
|
628
|
+
const store = yield* import_run_store.AttemptStore.AttemptStore;
|
|
629
|
+
const finishedAtMs = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor));
|
|
630
|
+
const identity = { runId: options.runId, stepKeyDigest: dispatchDigest, attempt: attempts };
|
|
631
|
+
const finished = yield* store.finish({
|
|
632
|
+
...identity,
|
|
633
|
+
state: "failed",
|
|
634
|
+
finishedAtMs,
|
|
635
|
+
error: { code: "scheduler_aborted", message: "A scheduler failure interrupted this attempt" }
|
|
636
|
+
}, options.owner);
|
|
637
|
+
if (finished._tag === "Finished") {
|
|
638
|
+
yield* emit(JournalRecords.attemptFinished(source(`node/${node.id}/${attempts}/aborted`), {
|
|
639
|
+
...identity,
|
|
640
|
+
state: "failed",
|
|
641
|
+
reason: "scheduler_aborted"
|
|
642
|
+
}));
|
|
643
|
+
}
|
|
644
|
+
})
|
|
645
|
+
).pipe(Effect.catch(
|
|
646
|
+
(cause) => Effect.sync(() => {
|
|
647
|
+
cleanupErrors.push(cause);
|
|
648
|
+
})
|
|
649
|
+
)) : Effect.void
|
|
650
|
+
),
|
|
651
|
+
Effect.exit
|
|
652
|
+
);
|
|
653
|
+
if (Exit.isSuccess(exit)) {
|
|
654
|
+
return {
|
|
655
|
+
outcome: (yield* Ref.get(ran)) ? "built" : "clean",
|
|
656
|
+
result: exit.value,
|
|
657
|
+
dispatchKey,
|
|
658
|
+
attempts,
|
|
659
|
+
rebases
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
if (Cause.hasInterrupts(exit.cause)) return yield* Effect.interrupt;
|
|
663
|
+
if (!isConflict(exit.cause) || node.material.kind === "irreversible") {
|
|
664
|
+
return { outcome: "failed", dispatchKey, attempts, rebases };
|
|
665
|
+
}
|
|
666
|
+
const strategy = runtimeStrategyOf(node);
|
|
667
|
+
if (strategy === "delay-rebase" && rebases < rebaseLimit) {
|
|
668
|
+
rebases = rebases + 1;
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
return { outcome: "conflicted", strategy, dispatchKey, attempts, rebases };
|
|
672
|
+
}
|
|
673
|
+
}).pipe(
|
|
674
|
+
Effect.tap((result) => Effect.annotateCurrentSpan({ outcome: result.outcome }))
|
|
675
|
+
);
|
|
676
|
+
});
|
|
677
|
+
const appendMerge = (intent) => Effect.gen(function* () {
|
|
678
|
+
const node = yield* PlanMerges.validateIntent(plan, intent).pipe(Effect.catch(mergeFailure));
|
|
679
|
+
const winners = intent.peers.filter((id) => results.has(id));
|
|
680
|
+
const mergeId = PlanMerges.allocateId(plan, node.id);
|
|
681
|
+
const parentDigest = plan.digest;
|
|
682
|
+
const grown = yield* import_plan.Plan.append(plan, [PlanMerges.draft(node, mergeId, winners)]).pipe(
|
|
683
|
+
Effect.mapError(
|
|
684
|
+
(cause) => new SchedulerError({
|
|
685
|
+
code: "elaboration_failed",
|
|
686
|
+
message: `could not append the merge node for ${node.id}`,
|
|
687
|
+
cause
|
|
688
|
+
})
|
|
689
|
+
)
|
|
690
|
+
);
|
|
691
|
+
yield* observeReads(
|
|
692
|
+
import_plan.Plan.generationNodes(grown),
|
|
693
|
+
grown.generation,
|
|
694
|
+
`generation ${grown.generation}'s source inputs`,
|
|
695
|
+
(snapshot) => atomically(
|
|
696
|
+
"could not atomically commit the merge extension",
|
|
697
|
+
Effect.gen(function* () {
|
|
698
|
+
const recorded = yield* inputStore.record(
|
|
699
|
+
{ ...mergeIdentity, generation: grown.generation },
|
|
700
|
+
snapshot,
|
|
701
|
+
options.owner
|
|
702
|
+
).pipe(Effect.catch(inputFailure));
|
|
703
|
+
yield* append(grown);
|
|
704
|
+
yield* mergeStore.complete(mergeIdentity, intent.nodeId, {
|
|
705
|
+
version: 1,
|
|
706
|
+
generation: grown.generation,
|
|
707
|
+
parentDigest,
|
|
708
|
+
planDigest: grown.digest,
|
|
709
|
+
mergeId,
|
|
710
|
+
mergeKey: import_plan.Plan.generationNodes(grown)[0].key,
|
|
711
|
+
winners
|
|
712
|
+
}, options.owner).pipe(Effect.catch(mergeFailure));
|
|
713
|
+
return recorded;
|
|
714
|
+
})
|
|
715
|
+
)
|
|
716
|
+
);
|
|
717
|
+
const suffix = import_plan.Plan.generationNodes(grown);
|
|
718
|
+
graph.append(suffix);
|
|
719
|
+
plan = grown;
|
|
720
|
+
indexWriters(suffix);
|
|
721
|
+
appended.push(mergeId);
|
|
722
|
+
});
|
|
723
|
+
const pendingSettlements = [];
|
|
724
|
+
const registerAttempt = (event) => {
|
|
725
|
+
const dispatchedUnder = digestToNode.get(event.digest);
|
|
726
|
+
if (dispatchedUnder === void 0) {
|
|
727
|
+
digestToNode.set(event.digest, [event.nodeId]);
|
|
728
|
+
} else if (!dispatchedUnder.includes(event.nodeId)) {
|
|
729
|
+
digestToNode.set(event.digest, [...dispatchedUnder, event.nodeId]);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
const drainReportedEvents = Effect.gen(function* () {
|
|
733
|
+
while (true) {
|
|
734
|
+
const next = yield* Queue.poll(events);
|
|
735
|
+
if (Option.isNone(next)) return;
|
|
736
|
+
if (next.value._tag === "AttemptKeyed") registerAttempt(next.value);
|
|
737
|
+
else pendingSettlements.push(next.value);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
const nextSettlement = Effect.gen(function* () {
|
|
741
|
+
const pending = pendingSettlements.shift();
|
|
742
|
+
if (pending !== void 0) return pending;
|
|
743
|
+
while (true) {
|
|
744
|
+
const event = yield* Queue.take(events);
|
|
745
|
+
if (event._tag === "DispatchSettled") return event;
|
|
746
|
+
registerAttempt(event);
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
const pendingDeviations = [];
|
|
750
|
+
const drainDeviations = Effect.gen(function* () {
|
|
751
|
+
let hasMore = true;
|
|
752
|
+
while (hasMore) {
|
|
753
|
+
const page = yield* journal.entries({
|
|
754
|
+
runId: options.runId,
|
|
755
|
+
...cursor === void 0 ? {} : { after: cursor },
|
|
756
|
+
limit: 512
|
|
757
|
+
}).pipe(Effect.mapError(storeFailure("could not read the run's journal")));
|
|
758
|
+
yield* drainReportedEvents;
|
|
759
|
+
const attributed = [];
|
|
760
|
+
for (const entry of page.entries) {
|
|
761
|
+
cursor = entry.seq;
|
|
762
|
+
if (entry.eventType !== "flows.engine.expected-set-deviation") continue;
|
|
763
|
+
const payload = decodeDeviation(entry.payload);
|
|
764
|
+
if (Option.isNone(payload)) continue;
|
|
765
|
+
const nodeIds = digestToNode.get(payload.value.stepKeyDigest);
|
|
766
|
+
if (nodeIds === void 0) continue;
|
|
767
|
+
const nodeId = nodeIds.find((candidate2) => states.get(candidate2).outcome === "built") ?? nodeIds[0];
|
|
768
|
+
const signature = JSON.stringify([
|
|
769
|
+
"expected-set-deviation/v1",
|
|
770
|
+
[...new Set(payload.value.paths)].sort(import_Ordering.compareText)
|
|
771
|
+
]);
|
|
772
|
+
deviationSignatures.set(nodeId, signature);
|
|
773
|
+
attributed.push({ nodeId, signature, payload: payload.value });
|
|
774
|
+
}
|
|
775
|
+
pendingDeviations.push(...attributed);
|
|
776
|
+
for (let index = 0; index < pendingDeviations.length; ) {
|
|
777
|
+
const { nodeId, payload, signature } = pendingDeviations[index];
|
|
778
|
+
if (states.get(nodeId)?.status !== "settled") {
|
|
779
|
+
index = index + 1;
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
const alsoDeviatedBy = [...deviationSignatures.entries()].filter(([other, otherSignature]) => other !== nodeId && otherSignature === signature).map(([other]) => other);
|
|
783
|
+
const declaredBy = Object.assign(
|
|
784
|
+
/* @__PURE__ */ Object.create(null),
|
|
785
|
+
Object.fromEntries(
|
|
786
|
+
payload.paths.flatMap((path) => {
|
|
787
|
+
const owner = writerFor(path);
|
|
788
|
+
return owner === void 0 ? [] : [[path, owner]];
|
|
789
|
+
})
|
|
790
|
+
)
|
|
791
|
+
);
|
|
792
|
+
const verdict = yield* reconciler.onDeviation({
|
|
793
|
+
nodeId,
|
|
794
|
+
keyDigest: payload.stepKeyDigest,
|
|
795
|
+
attempt: payload.attempt,
|
|
796
|
+
paths: payload.paths,
|
|
797
|
+
diffIdentity: payload.diffIdentity,
|
|
798
|
+
declaredBy,
|
|
799
|
+
alsoDeviatedBy
|
|
800
|
+
});
|
|
801
|
+
yield* applyVerdict(nodeId, verdict, "deviation");
|
|
802
|
+
pendingDeviations.splice(index, 1);
|
|
803
|
+
}
|
|
804
|
+
hasMore = page.hasMore;
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
const deferrals = /* @__PURE__ */ new Map();
|
|
808
|
+
if (options.selection?.full === true) {
|
|
809
|
+
yield* emit(JournalRecords.selectionOverridden(source("selection/override"), {
|
|
810
|
+
planId: plan.planId,
|
|
811
|
+
mode: "full"
|
|
812
|
+
}));
|
|
813
|
+
} else {
|
|
814
|
+
const dependedOn = new Set(plan.nodes.flatMap((node) => node.dependsOn));
|
|
815
|
+
const sinks = plan.nodes.filter((node) => !dependedOn.has(node.id));
|
|
816
|
+
const present = /* @__PURE__ */ new Set([plan.flow, ...plan.nodes.map((node) => node.id)]);
|
|
817
|
+
const sinkIds = new Set(sinks.map((node) => node.id));
|
|
818
|
+
const selected = yield* selector.select({
|
|
819
|
+
changed: options.selection?.changed ?? [],
|
|
820
|
+
sinks: sinks.map((node) => ({ nodeId: node.id, planKey: node.key })),
|
|
821
|
+
present: [...present],
|
|
822
|
+
beliefs: options.selection?.beliefs ?? { pinnedAtMs: 0, edges: [] },
|
|
823
|
+
policy: options.selection?.policy ?? { deferBelow: 0 }
|
|
824
|
+
});
|
|
825
|
+
for (let index = 0; index < selected.length; index++) {
|
|
826
|
+
const { nodeId, verdict } = selected[index];
|
|
827
|
+
if (verdict._tag === "Admit") continue;
|
|
828
|
+
if (verdict._tag === "Defer" && sinkIds.has(nodeId)) {
|
|
829
|
+
deferrals.set(nodeId, { edge: verdict.edge, likelihood: verdict.likelihood });
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
if (verdict._tag === "Propose" && !present.has(nodeId)) {
|
|
833
|
+
yield* emit(JournalRecords.selectionProposed(source(`selection/proposed/${index}`), {
|
|
834
|
+
planId: plan.planId,
|
|
835
|
+
flow: verdict.flow,
|
|
836
|
+
edge: verdict.edge,
|
|
837
|
+
confidence: verdict.confidence
|
|
838
|
+
}));
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
yield* emit(JournalRecords.selectionInconsistent(source(`selection/inconsistent/${index}`), {
|
|
842
|
+
planId: plan.planId,
|
|
843
|
+
nodeId,
|
|
844
|
+
verdict: verdict._tag,
|
|
845
|
+
reason: verdict._tag === "Defer" ? "not-a-deferrable-sink" : "proposes-a-present-node"
|
|
846
|
+
}));
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const passiveSettlements = Effect.gen(function* () {
|
|
850
|
+
while (true) {
|
|
851
|
+
const blocked = graph.blocked();
|
|
852
|
+
for (const node of blocked) yield* settle(node, "skipped");
|
|
853
|
+
if (blocked.length > 0) continue;
|
|
854
|
+
const ready = graph.ready();
|
|
855
|
+
const postponed = ready.filter((node) => deferrals.has(node.id));
|
|
856
|
+
for (const node of postponed) {
|
|
857
|
+
const debt = deferrals.get(node.id);
|
|
858
|
+
yield* emit(JournalRecords.selectionDeferred(source(`node/${node.id}/selection-deferred`), {
|
|
859
|
+
planId: plan.planId,
|
|
860
|
+
nodeId: node.id,
|
|
861
|
+
planKey: node.key,
|
|
862
|
+
edge: debt.edge,
|
|
863
|
+
likelihood: debt.likelihood
|
|
864
|
+
}));
|
|
865
|
+
yield* settle(node, "deferred");
|
|
866
|
+
}
|
|
867
|
+
if (postponed.length > 0) continue;
|
|
868
|
+
return ready;
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
const dispatchStart = (node) => {
|
|
872
|
+
const state = stateOf(node);
|
|
873
|
+
const settledResults = /* @__PURE__ */ new Map();
|
|
874
|
+
const inputs = [];
|
|
875
|
+
for (const input of node.material.inputs) {
|
|
876
|
+
if (input._tag !== "Ref") continue;
|
|
877
|
+
const value = results.get(input.from);
|
|
878
|
+
settledResults.set(input.from, value);
|
|
879
|
+
inputs.push({ from: input.from, path: input.path, value: import_plan.StepKey.project(value, input.path) });
|
|
880
|
+
}
|
|
881
|
+
return {
|
|
882
|
+
dispatchKey: state.dispatchKey,
|
|
883
|
+
attempts: state.attempts,
|
|
884
|
+
rebases: state.rebases,
|
|
885
|
+
waited: state.waited,
|
|
886
|
+
results: settledResults,
|
|
887
|
+
inputs
|
|
888
|
+
};
|
|
889
|
+
};
|
|
890
|
+
let admissions = 0;
|
|
891
|
+
yield* Effect.scoped(
|
|
892
|
+
Effect.gen(function* () {
|
|
893
|
+
let inFlightSteps = 0;
|
|
894
|
+
let inFlightAgents = 0;
|
|
895
|
+
const pendingMerges = recoveredMerges.filter((decision) => decision.completion === void 0).map((decision) => decision.intent);
|
|
896
|
+
const appendReadyMerges = Effect.gen(function* () {
|
|
897
|
+
for (let index = 0; index < pendingMerges.length; ) {
|
|
898
|
+
const pending = pendingMerges[index];
|
|
899
|
+
if (pending.peers.some((peer) => states.get(peer)?.status !== "settled")) {
|
|
900
|
+
index = index + 1;
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
yield* appendMerge(pending);
|
|
904
|
+
pendingMerges.splice(index, 1);
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
const advance = Effect.gen(function* () {
|
|
908
|
+
while (true) {
|
|
909
|
+
const ready = yield* passiveSettlements;
|
|
910
|
+
const before = plan.generation;
|
|
911
|
+
yield* appendReadyMerges;
|
|
912
|
+
if (plan.generation === before) return ready;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
const admit = (ready) => Effect.gen(function* () {
|
|
916
|
+
const decision = scheduling.admit(
|
|
917
|
+
graph.candidates(ready),
|
|
918
|
+
{ steps: inFlightSteps, agents: inFlightAgents }
|
|
919
|
+
);
|
|
920
|
+
const admitted = decision.admitted.map(({ node }) => node);
|
|
921
|
+
for (const { node, waited } of decision.deferred) {
|
|
922
|
+
stateOf(node).waited = waited;
|
|
923
|
+
}
|
|
924
|
+
if (admitted.length > 0) {
|
|
925
|
+
admissions = admissions + 1;
|
|
926
|
+
yield* Effect.annotateCurrentSpan({ admissions });
|
|
927
|
+
yield* Metric.update(EngineStoreMetrics.schedulerAdmissions, 1);
|
|
928
|
+
yield* Effect.logDebug("scheduler admission launched", {
|
|
929
|
+
admission: admissions,
|
|
930
|
+
ready: ready.length,
|
|
931
|
+
admitted: admitted.length,
|
|
932
|
+
agents: decision.agents,
|
|
933
|
+
inFlightSteps,
|
|
934
|
+
inFlightAgents
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
const launches = admitted.map((node) => {
|
|
938
|
+
const start = dispatchStart(node);
|
|
939
|
+
graph.start(node.id);
|
|
940
|
+
inFlightSteps = inFlightSteps + 1;
|
|
941
|
+
if (node.kind === "agent") inFlightAgents = inFlightAgents + 1;
|
|
942
|
+
return { node, start };
|
|
943
|
+
});
|
|
944
|
+
for (const { node, start } of launches) {
|
|
945
|
+
yield* dispatch(node, start).pipe(
|
|
946
|
+
Effect.trackDuration(EngineStoreMetrics.schedulerDispatchDuration),
|
|
947
|
+
Effect.exit,
|
|
948
|
+
Effect.flatMap((exit) => Queue.offer(events, { _tag: "DispatchSettled", node, exit })),
|
|
949
|
+
Effect.asVoid,
|
|
950
|
+
Effect.forkScoped({ startImmediately: true })
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
for (const { intent } of recoveredMerges) yield* emitSettlement(nodesById.get(intent.nodeId), 0);
|
|
955
|
+
yield* Effect.flatMap(advance, admit);
|
|
956
|
+
while (graph.remaining > 0) {
|
|
957
|
+
if (inFlightSteps === 0) {
|
|
958
|
+
return yield* Effect.die(
|
|
959
|
+
new Error(
|
|
960
|
+
`PlanScheduler invariant broken: ${graph.remaining} nodes are pending and nothing is in flight`
|
|
961
|
+
)
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
const event = yield* nextSettlement;
|
|
965
|
+
if (Exit.isFailure(event.exit)) return yield* Effect.failCause(event.exit.cause);
|
|
966
|
+
const node = event.node;
|
|
967
|
+
const result = event.exit.value;
|
|
968
|
+
const state = stateOf(node);
|
|
969
|
+
inFlightSteps = inFlightSteps - 1;
|
|
970
|
+
if (node.kind === "agent") inFlightAgents = inFlightAgents - 1;
|
|
971
|
+
state.dispatchKey = result.dispatchKey;
|
|
972
|
+
state.attempts = result.attempts;
|
|
973
|
+
state.rebases = result.rebases;
|
|
974
|
+
switch (result.outcome) {
|
|
975
|
+
case "built":
|
|
976
|
+
case "clean":
|
|
977
|
+
results.set(node.id, result.result);
|
|
978
|
+
markSettled(node, result.outcome);
|
|
979
|
+
break;
|
|
980
|
+
case "failed":
|
|
981
|
+
markSettled(node, "failed");
|
|
982
|
+
break;
|
|
983
|
+
case "conflicted": {
|
|
984
|
+
if (result.strategy === "stop-merge") {
|
|
985
|
+
const intent = yield* atomically(
|
|
986
|
+
"could not persist the stopped-attempt decision",
|
|
987
|
+
Effect.gen(function* () {
|
|
988
|
+
const intent2 = yield* mergeStore.intend(mergeIdentity, {
|
|
989
|
+
version: 1,
|
|
990
|
+
nodeId: node.id,
|
|
991
|
+
nodeKey: node.key,
|
|
992
|
+
dispatchKey: state.dispatchKey,
|
|
993
|
+
attempts: state.attempts,
|
|
994
|
+
rebases: state.rebases,
|
|
995
|
+
peers: node.conflicts.map((conflict) => conflict.with).filter((peer) => states.get(peer)?.status === "running" || results.has(peer))
|
|
996
|
+
}, options.owner).pipe(Effect.catch(mergeFailure));
|
|
997
|
+
yield* PlanMerges.validateIntent(plan, intent2).pipe(Effect.catch(mergeFailure));
|
|
998
|
+
return intent2;
|
|
999
|
+
})
|
|
1000
|
+
);
|
|
1001
|
+
markSettled(node, "skipped");
|
|
1002
|
+
state.dispatchKey = intent.dispatchKey;
|
|
1003
|
+
state.attempts = intent.attempts;
|
|
1004
|
+
state.rebases = intent.rebases;
|
|
1005
|
+
pendingMerges.push(intent);
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
const verdict = yield* reconciler.onConflict({
|
|
1009
|
+
nodeId: node.id,
|
|
1010
|
+
keyDigest: state.dispatchKey,
|
|
1011
|
+
attempt: state.attempts,
|
|
1012
|
+
rebases: state.rebases,
|
|
1013
|
+
strategy: result.strategy,
|
|
1014
|
+
conflictsWith: node.conflicts.map((conflict) => conflict.with)
|
|
1015
|
+
});
|
|
1016
|
+
markSettled(node, "failed");
|
|
1017
|
+
yield* applyVerdict(node.id, verdict, "materialization-conflict");
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
yield* appendReadyMerges;
|
|
1022
|
+
yield* drainDeviations;
|
|
1023
|
+
yield* emitSettlement(node);
|
|
1024
|
+
graph.reconcile();
|
|
1025
|
+
const ready = yield* advance;
|
|
1026
|
+
if (pendingSettlements.length === 0) yield* admit(ready);
|
|
1027
|
+
}
|
|
1028
|
+
}).pipe(Effect.onError(
|
|
1029
|
+
(cause) => Effect.sync(() => {
|
|
1030
|
+
abortedForFailure = cause.reasons.some((reason) => reason._tag === "Fail");
|
|
1031
|
+
})
|
|
1032
|
+
))
|
|
1033
|
+
).pipe(Effect.catch(
|
|
1034
|
+
(error) => Effect.fail(
|
|
1035
|
+
cleanupErrors.length === 0 ? error : new SchedulerError({
|
|
1036
|
+
code: error.code,
|
|
1037
|
+
message: error.message,
|
|
1038
|
+
cause: error.cause,
|
|
1039
|
+
cleanupErrors
|
|
1040
|
+
})
|
|
1041
|
+
)
|
|
1042
|
+
));
|
|
1043
|
+
const settlements = plan.nodes.map((node) => {
|
|
1044
|
+
const state = stateOf(node);
|
|
1045
|
+
return {
|
|
1046
|
+
nodeId: node.id,
|
|
1047
|
+
planKey: node.key,
|
|
1048
|
+
dispatchKey: state.dispatchKey,
|
|
1049
|
+
outcome: state.outcome,
|
|
1050
|
+
attempts: state.attempts,
|
|
1051
|
+
rebases: state.rebases
|
|
1052
|
+
};
|
|
1053
|
+
});
|
|
1054
|
+
yield* Effect.logDebug("scheduler run completed", {
|
|
1055
|
+
admissions,
|
|
1056
|
+
built: settlements.filter((settlement) => settlement.outcome === "built").length,
|
|
1057
|
+
clean: settlements.filter((settlement) => settlement.outcome === "clean").length,
|
|
1058
|
+
failed: settlements.filter((settlement) => settlement.outcome === "failed").length,
|
|
1059
|
+
skipped: settlements.filter((settlement) => settlement.outcome === "skipped").length,
|
|
1060
|
+
deferred: settlements.filter((settlement) => settlement.outcome === "deferred").length
|
|
1061
|
+
});
|
|
1062
|
+
return {
|
|
1063
|
+
planId: plan.planId,
|
|
1064
|
+
digest: plan.digest,
|
|
1065
|
+
settlements,
|
|
1066
|
+
results: Object.fromEntries(results),
|
|
1067
|
+
verdicts,
|
|
1068
|
+
appended
|
|
1069
|
+
};
|
|
1070
|
+
}).pipe(
|
|
1071
|
+
Effect.annotateSpans({ runId: options.runId }),
|
|
1072
|
+
Effect.annotateLogs({ runId: options.runId }),
|
|
1073
|
+
Effect.onExit((exit) => Effect.annotateCurrentSpan({ outcome: EngineStoreMetrics.exitTag(exit).toLowerCase() }))
|
|
1074
|
+
)
|
|
1075
|
+
);
|
|
1076
|
+
return { record, append, run };
|
|
1077
|
+
};
|
|
1078
|
+
const layer = (options) => Layer.succeed(PlanScheduler, make(options));
|
|
1079
|
+
const recertify = Effect.fn("PlanScheduler.recertify")(
|
|
1080
|
+
(input) => Effect.gen(function* () {
|
|
1081
|
+
const scheduler = make({
|
|
1082
|
+
...input.options,
|
|
1083
|
+
selection: { ...input.options.selection, full: true }
|
|
1084
|
+
});
|
|
1085
|
+
const report = yield* scheduler.run(input.plan);
|
|
1086
|
+
const remaining = yield* Selection.debt(input.deferringRunId, { repaidBy: [input.options.runId] });
|
|
1087
|
+
return { runId: input.options.runId, report, remaining };
|
|
1088
|
+
})
|
|
1089
|
+
);
|
|
1090
|
+
//# sourceMappingURL=PlanScheduler.js.map
|