@smthrs/engine-store 0.0.0-stage → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +146 -2
- package/dist/cjs/ArtifactGc.d.ts +235 -0
- package/dist/cjs/ArtifactGc.d.ts.map +1 -0
- package/dist/cjs/ArtifactGc.js +183 -0
- package/dist/cjs/ArtifactGc.js.map +7 -0
- package/dist/cjs/ArtifactSync.d.ts +164 -0
- package/dist/cjs/ArtifactSync.d.ts.map +1 -0
- package/dist/cjs/ArtifactSync.js +144 -0
- package/dist/cjs/ArtifactSync.js.map +7 -0
- package/dist/cjs/CacheSync.d.ts +112 -0
- package/dist/cjs/CacheSync.d.ts.map +1 -0
- package/dist/cjs/CacheSync.js +64 -0
- package/dist/cjs/CacheSync.js.map +7 -0
- package/dist/cjs/DeferredClockFold.d.ts +354 -0
- package/dist/cjs/DeferredClockFold.d.ts.map +1 -0
- package/dist/cjs/DeferredClockFold.js +335 -0
- package/dist/cjs/DeferredClockFold.js.map +7 -0
- package/dist/cjs/DisasterRecovery.d.ts +431 -0
- package/dist/cjs/DisasterRecovery.d.ts.map +1 -0
- package/dist/cjs/DisasterRecovery.js +453 -0
- package/dist/cjs/DisasterRecovery.js.map +7 -0
- package/dist/cjs/DurableEngineState.d.ts +776 -0
- package/dist/cjs/DurableEngineState.d.ts.map +1 -0
- package/dist/cjs/DurableEngineState.js +1536 -0
- package/dist/cjs/DurableEngineState.js.map +7 -0
- package/dist/cjs/EngineStore.d.ts +158 -0
- package/dist/cjs/EngineStore.d.ts.map +1 -0
- package/dist/cjs/EngineStore.js +398 -0
- package/dist/cjs/EngineStore.js.map +7 -0
- package/dist/cjs/EngineStoreMetrics.d.ts +276 -0
- package/dist/cjs/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/cjs/EngineStoreMetrics.js +135 -0
- package/dist/cjs/EngineStoreMetrics.js.map +7 -0
- package/dist/cjs/Errors.d.ts +22 -0
- package/dist/cjs/Errors.d.ts.map +1 -0
- package/dist/cjs/Errors.js +39 -0
- package/dist/cjs/Errors.js.map +7 -0
- package/dist/cjs/EventTypes.d.ts +27 -0
- package/dist/cjs/EventTypes.d.ts.map +1 -0
- package/dist/cjs/EventTypes.js +37 -0
- package/dist/cjs/EventTypes.js.map +7 -0
- package/dist/cjs/ExecutionFacts.d.ts +59 -0
- package/dist/cjs/ExecutionFacts.d.ts.map +1 -0
- package/dist/cjs/ExecutionFacts.js +123 -0
- package/dist/cjs/ExecutionFacts.js.map +7 -0
- package/dist/cjs/ExecutionSnapshot.d.ts +117 -0
- package/dist/cjs/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/cjs/ExecutionSnapshot.js +111 -0
- package/dist/cjs/ExecutionSnapshot.js.map +7 -0
- package/dist/cjs/Inconsistency.d.ts +154 -0
- package/dist/cjs/Inconsistency.d.ts.map +1 -0
- package/dist/cjs/Inconsistency.js +135 -0
- package/dist/cjs/Inconsistency.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +56 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +78 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/OwnerIdentity.d.ts +91 -0
- package/dist/cjs/OwnerIdentity.d.ts.map +1 -0
- package/dist/cjs/OwnerIdentity.js +65 -0
- package/dist/cjs/OwnerIdentity.js.map +7 -0
- package/dist/cjs/PlanInputStore.d.ts +110 -0
- package/dist/cjs/PlanInputStore.d.ts.map +1 -0
- package/dist/cjs/PlanInputStore.js +224 -0
- package/dist/cjs/PlanInputStore.js.map +7 -0
- package/dist/cjs/PlanMergeStore.d.ts +113 -0
- package/dist/cjs/PlanMergeStore.d.ts.map +1 -0
- package/dist/cjs/PlanMergeStore.js +255 -0
- package/dist/cjs/PlanMergeStore.js.map +7 -0
- package/dist/cjs/PlanScheduler.d.ts +363 -0
- package/dist/cjs/PlanScheduler.d.ts.map +1 -0
- package/dist/cjs/PlanScheduler.js +1090 -0
- package/dist/cjs/PlanScheduler.js.map +7 -0
- package/dist/cjs/Reconciliation.d.ts +175 -0
- package/dist/cjs/Reconciliation.d.ts.map +1 -0
- package/dist/cjs/Reconciliation.js +119 -0
- package/dist/cjs/Reconciliation.js.map +7 -0
- package/dist/cjs/ReplayOnly.d.ts +91 -0
- package/dist/cjs/ReplayOnly.d.ts.map +1 -0
- package/dist/cjs/ReplayOnly.js +52 -0
- package/dist/cjs/ReplayOnly.js.map +7 -0
- package/dist/cjs/Retention.d.ts +113 -0
- package/dist/cjs/Retention.d.ts.map +1 -0
- package/dist/cjs/Retention.js +99 -0
- package/dist/cjs/Retention.js.map +7 -0
- package/dist/cjs/RunCatalogRead.d.ts +17 -0
- package/dist/cjs/RunCatalogRead.d.ts.map +1 -0
- package/dist/cjs/RunCatalogRead.js +33 -0
- package/dist/cjs/RunCatalogRead.js.map +7 -0
- package/dist/cjs/RunChangeFeed.d.ts +75 -0
- package/dist/cjs/RunChangeFeed.d.ts.map +1 -0
- package/dist/cjs/RunChangeFeed.js +96 -0
- package/dist/cjs/RunChangeFeed.js.map +7 -0
- package/dist/cjs/RunState.d.ts +116 -0
- package/dist/cjs/RunState.d.ts.map +1 -0
- package/dist/cjs/RunState.js +76 -0
- package/dist/cjs/RunState.js.map +7 -0
- package/dist/cjs/Selection.d.ts +495 -0
- package/dist/cjs/Selection.d.ts.map +1 -0
- package/dist/cjs/Selection.js +288 -0
- package/dist/cjs/Selection.js.map +7 -0
- package/dist/cjs/SelectionStore.d.ts +141 -0
- package/dist/cjs/SelectionStore.d.ts.map +1 -0
- package/dist/cjs/SelectionStore.js +229 -0
- package/dist/cjs/SelectionStore.js.map +7 -0
- package/dist/cjs/StepBoundary.d.ts +501 -0
- package/dist/cjs/StepBoundary.d.ts.map +1 -0
- package/dist/cjs/StepBoundary.js +619 -0
- package/dist/cjs/StepBoundary.js.map +7 -0
- package/dist/cjs/StepCacheFold.d.ts +148 -0
- package/dist/cjs/StepCacheFold.d.ts.map +1 -0
- package/dist/cjs/StepCacheFold.js +131 -0
- package/dist/cjs/StepCacheFold.js.map +7 -0
- package/dist/cjs/StepSandbox.d.ts +78 -0
- package/dist/cjs/StepSandbox.d.ts.map +1 -0
- package/dist/cjs/StepSandbox.js +75 -0
- package/dist/cjs/StepSandbox.js.map +7 -0
- package/dist/cjs/WakeBus.d.ts +116 -0
- package/dist/cjs/WakeBus.d.ts.map +1 -0
- package/dist/cjs/WakeBus.js +89 -0
- package/dist/cjs/WakeBus.js.map +7 -0
- package/dist/cjs/WorkspaceSandbox.d.ts +619 -0
- package/dist/cjs/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/cjs/WorkspaceSandbox.js +711 -0
- package/dist/cjs/WorkspaceSandbox.js.map +7 -0
- package/dist/cjs/index.d.ts +157 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +95 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ActionPersistence.d.ts +276 -0
- package/dist/cjs/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/ActionPersistence.js +1395 -0
- package/dist/cjs/internal/ActionPersistence.js.map +7 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts +38 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/cjs/internal/ArtifactRoots.js +89 -0
- package/dist/cjs/internal/ArtifactRoots.js.map +7 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts +53 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptAdmission.js +52 -0
- package/dist/cjs/internal/AttemptAdmission.js.map +7 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptLifecycle.js +112 -0
- package/dist/cjs/internal/AttemptLifecycle.js.map +7 -0
- package/dist/cjs/internal/AttemptProbe.d.ts +53 -0
- package/dist/cjs/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptProbe.js +66 -0
- package/dist/cjs/internal/AttemptProbe.js.map +7 -0
- package/dist/cjs/internal/CacheAdmission.d.ts +79 -0
- package/dist/cjs/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAdmission.js +71 -0
- package/dist/cjs/internal/CacheAdmission.js.map +7 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeHistory.js +61 -0
- package/dist/cjs/internal/CacheAgeHistory.js.map +7 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js +73 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js.map +7 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/cjs/internal/CacheOutputPolicy.js +75 -0
- package/dist/cjs/internal/CacheOutputPolicy.js.map +7 -0
- package/dist/cjs/internal/CachePublication.d.ts +97 -0
- package/dist/cjs/internal/CachePublication.d.ts.map +1 -0
- package/dist/cjs/internal/CachePublication.js +80 -0
- package/dist/cjs/internal/CachePublication.js.map +7 -0
- package/dist/cjs/internal/CallFacts.d.ts +15 -0
- package/dist/cjs/internal/CallFacts.d.ts.map +1 -0
- package/dist/cjs/internal/CallFacts.js +97 -0
- package/dist/cjs/internal/CallFacts.js.map +7 -0
- package/dist/cjs/internal/CopiedRecord.d.ts +61 -0
- package/dist/cjs/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/cjs/internal/CopiedRecord.js +134 -0
- package/dist/cjs/internal/CopiedRecord.js.map +7 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts +108 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/DeferredPersistence.js +270 -0
- package/dist/cjs/internal/DeferredPersistence.js.map +7 -0
- package/dist/cjs/internal/EffectRecords.d.ts +92 -0
- package/dist/cjs/internal/EffectRecords.d.ts.map +1 -0
- package/dist/cjs/internal/EffectRecords.js +63 -0
- package/dist/cjs/internal/EffectRecords.js.map +7 -0
- package/dist/cjs/internal/EngineJj.d.ts +30 -0
- package/dist/cjs/internal/EngineJj.d.ts.map +1 -0
- package/dist/cjs/internal/EngineJj.js +42 -0
- package/dist/cjs/internal/EngineJj.js.map +7 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts +68 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/cjs/internal/EngineStateSchema.js +58 -0
- package/dist/cjs/internal/EngineStateSchema.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js +199 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js +105 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js.map +7 -0
- package/dist/cjs/internal/ExitEncoding.d.ts +180 -0
- package/dist/cjs/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/cjs/internal/ExitEncoding.js +236 -0
- package/dist/cjs/internal/ExitEncoding.js.map +7 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js +51 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js.map +7 -0
- package/dist/cjs/internal/FileEnumeration.d.ts +127 -0
- package/dist/cjs/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/cjs/internal/FileEnumeration.js +194 -0
- package/dist/cjs/internal/FileEnumeration.js.map +7 -0
- package/dist/cjs/internal/HostReflection.d.ts +80 -0
- package/dist/cjs/internal/HostReflection.d.ts.map +1 -0
- package/dist/cjs/internal/HostReflection.js +43 -0
- package/dist/cjs/internal/HostReflection.js.map +7 -0
- package/dist/cjs/internal/JournalRecords.d.ts +325 -0
- package/dist/cjs/internal/JournalRecords.d.ts.map +1 -0
- package/dist/cjs/internal/JournalRecords.js +122 -0
- package/dist/cjs/internal/JournalRecords.js.map +7 -0
- package/dist/cjs/internal/NodeJournal.d.ts +157 -0
- package/dist/cjs/internal/NodeJournal.d.ts.map +1 -0
- package/dist/cjs/internal/NodeJournal.js +192 -0
- package/dist/cjs/internal/NodeJournal.js.map +7 -0
- package/dist/cjs/internal/Ordering.d.ts +14 -0
- package/dist/cjs/internal/Ordering.d.ts.map +1 -0
- package/dist/cjs/internal/Ordering.js +25 -0
- package/dist/cjs/internal/Ordering.js.map +7 -0
- package/dist/cjs/internal/PlanInputs.d.ts +14 -0
- package/dist/cjs/internal/PlanInputs.d.ts.map +1 -0
- package/dist/cjs/internal/PlanInputs.js +78 -0
- package/dist/cjs/internal/PlanInputs.js.map +7 -0
- package/dist/cjs/internal/PlanMerges.d.ts +178 -0
- package/dist/cjs/internal/PlanMerges.d.ts.map +1 -0
- package/dist/cjs/internal/PlanMerges.js +125 -0
- package/dist/cjs/internal/PlanMerges.js.map +7 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/cjs/internal/ProvenanceSlot.js +53 -0
- package/dist/cjs/internal/ProvenanceSlot.js.map +7 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts +88 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/cjs/internal/ResultEnvelope.js +90 -0
- package/dist/cjs/internal/ResultEnvelope.js.map +7 -0
- package/dist/cjs/internal/RetentionOps.d.ts +414 -0
- package/dist/cjs/internal/RetentionOps.d.ts.map +1 -0
- package/dist/cjs/internal/RetentionOps.js +354 -0
- package/dist/cjs/internal/RetentionOps.js.map +7 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts +118 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/cjs/internal/RunCatalogOps.js +85 -0
- package/dist/cjs/internal/RunCatalogOps.js.map +7 -0
- package/dist/cjs/internal/RunCoordinator.d.ts +78 -0
- package/dist/cjs/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/cjs/internal/RunCoordinator.js +123 -0
- package/dist/cjs/internal/RunCoordinator.js.map +7 -0
- package/dist/cjs/internal/RunDriver.d.ts +192 -0
- package/dist/cjs/internal/RunDriver.d.ts.map +1 -0
- package/dist/cjs/internal/RunDriver.js +1584 -0
- package/dist/cjs/internal/RunDriver.js.map +7 -0
- package/dist/cjs/internal/RunLifecycle.d.ts +22 -0
- package/dist/cjs/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/RunLifecycle.js +63 -0
- package/dist/cjs/internal/RunLifecycle.js.map +7 -0
- package/dist/cjs/internal/RunListing.d.ts +78 -0
- package/dist/cjs/internal/RunListing.d.ts.map +1 -0
- package/dist/cjs/internal/RunListing.js +171 -0
- package/dist/cjs/internal/RunListing.js.map +7 -0
- package/dist/cjs/internal/RunListingError.d.ts +35 -0
- package/dist/cjs/internal/RunListingError.d.ts.map +1 -0
- package/dist/cjs/internal/RunListingError.js +47 -0
- package/dist/cjs/internal/RunListingError.js.map +7 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts +73 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/cjs/internal/RuntimeGraph.js +180 -0
- package/dist/cjs/internal/RuntimeGraph.js.map +7 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts +80 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/cjs/internal/SandboxedExecution.js +104 -0
- package/dist/cjs/internal/SandboxedExecution.js.map +7 -0
- package/dist/cjs/internal/StateTransaction.d.ts +44 -0
- package/dist/cjs/internal/StateTransaction.d.ts.map +1 -0
- package/dist/cjs/internal/StateTransaction.js +52 -0
- package/dist/cjs/internal/StateTransaction.js.map +7 -0
- package/dist/cjs/internal/StepFacts.d.ts +14 -0
- package/dist/cjs/internal/StepFacts.d.ts.map +1 -0
- package/dist/cjs/internal/StepFacts.js +58 -0
- package/dist/cjs/internal/StepFacts.js.map +7 -0
- package/dist/cjs/internal/TypedEvents.d.ts +14 -0
- package/dist/cjs/internal/TypedEvents.d.ts.map +1 -0
- package/dist/cjs/internal/TypedEvents.js +37 -0
- package/dist/cjs/internal/TypedEvents.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +17 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +61 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts +15 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_selection_store.js +56 -0
- package/dist/cjs/migrations/0002_selection_store.js.map +7 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_plan_inputs.js +90 -0
- package/dist/cjs/migrations/0003_plan_inputs.js.map +7 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_plan_environment.js +56 -0
- package/dist/cjs/migrations/0004_plan_environment.js.map +7 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_plan_merges.js +82 -0
- package/dist/cjs/migrations/0005_plan_merges.js.map +7 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_execution_listing.js +101 -0
- package/dist/cjs/migrations/0006_execution_listing.js.map +7 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js +40 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js.map +7 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js +45 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js.map +7 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js +141 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js.map +7 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js +41 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/TestStores.d.ts +89 -0
- package/dist/cjs/test/TestStores.d.ts.map +1 -0
- package/dist/cjs/test/TestStores.js +98 -0
- package/dist/cjs/test/TestStores.js.map +7 -0
- package/dist/esm/ArtifactGc.d.ts +235 -0
- package/dist/esm/ArtifactGc.d.ts.map +1 -0
- package/dist/esm/ArtifactGc.js +268 -0
- package/dist/esm/ArtifactGc.js.map +1 -0
- package/dist/esm/ArtifactSync.d.ts +164 -0
- package/dist/esm/ArtifactSync.d.ts.map +1 -0
- package/dist/esm/ArtifactSync.js +176 -0
- package/dist/esm/ArtifactSync.js.map +1 -0
- package/dist/esm/CacheSync.d.ts +112 -0
- package/dist/esm/CacheSync.d.ts.map +1 -0
- package/dist/esm/CacheSync.js +94 -0
- package/dist/esm/CacheSync.js.map +1 -0
- package/dist/esm/DeferredClockFold.d.ts +354 -0
- package/dist/esm/DeferredClockFold.d.ts.map +1 -0
- package/dist/esm/DeferredClockFold.js +472 -0
- package/dist/esm/DeferredClockFold.js.map +1 -0
- package/dist/esm/DisasterRecovery.d.ts +431 -0
- package/dist/esm/DisasterRecovery.d.ts.map +1 -0
- package/dist/esm/DisasterRecovery.js +523 -0
- package/dist/esm/DisasterRecovery.js.map +1 -0
- package/dist/esm/DurableEngineState.d.ts +776 -0
- package/dist/esm/DurableEngineState.d.ts.map +1 -0
- package/dist/esm/DurableEngineState.js +1648 -0
- package/dist/esm/DurableEngineState.js.map +1 -0
- package/dist/esm/EngineStore.d.ts +158 -0
- package/dist/esm/EngineStore.d.ts.map +1 -0
- package/dist/esm/EngineStore.js +403 -0
- package/dist/esm/EngineStore.js.map +1 -0
- package/dist/esm/EngineStoreMetrics.d.ts +276 -0
- package/dist/esm/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/esm/EngineStoreMetrics.js +260 -0
- package/dist/esm/EngineStoreMetrics.js.map +1 -0
- package/dist/esm/Errors.d.ts +22 -0
- package/dist/esm/Errors.d.ts.map +1 -0
- package/dist/esm/Errors.js +22 -0
- package/dist/esm/Errors.js.map +1 -0
- package/dist/esm/EventTypes.d.ts +27 -0
- package/dist/esm/EventTypes.d.ts.map +1 -0
- package/dist/esm/EventTypes.js +27 -0
- package/dist/esm/EventTypes.js.map +1 -0
- package/dist/esm/ExecutionFacts.d.ts +59 -0
- package/dist/esm/ExecutionFacts.d.ts.map +1 -0
- package/dist/esm/ExecutionFacts.js +96 -0
- package/dist/esm/ExecutionFacts.js.map +1 -0
- package/dist/esm/ExecutionSnapshot.d.ts +117 -0
- package/dist/esm/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/esm/ExecutionSnapshot.js +95 -0
- package/dist/esm/ExecutionSnapshot.js.map +1 -0
- package/dist/esm/Inconsistency.d.ts +154 -0
- package/dist/esm/Inconsistency.d.ts.map +1 -0
- package/dist/esm/Inconsistency.js +133 -0
- package/dist/esm/Inconsistency.js.map +1 -0
- package/dist/esm/Migrations.d.ts +56 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +91 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/OwnerIdentity.d.ts +91 -0
- package/dist/esm/OwnerIdentity.d.ts.map +1 -0
- package/dist/esm/OwnerIdentity.js +99 -0
- package/dist/esm/OwnerIdentity.js.map +1 -0
- package/dist/esm/PlanInputStore.d.ts +110 -0
- package/dist/esm/PlanInputStore.d.ts.map +1 -0
- package/dist/esm/PlanInputStore.js +207 -0
- package/dist/esm/PlanInputStore.js.map +1 -0
- package/dist/esm/PlanMergeStore.d.ts +113 -0
- package/dist/esm/PlanMergeStore.d.ts.map +1 -0
- package/dist/esm/PlanMergeStore.js +244 -0
- package/dist/esm/PlanMergeStore.js.map +1 -0
- package/dist/esm/PlanScheduler.d.ts +363 -0
- package/dist/esm/PlanScheduler.d.ts.map +1 -0
- package/dist/esm/PlanScheduler.js +1321 -0
- package/dist/esm/PlanScheduler.js.map +1 -0
- package/dist/esm/Reconciliation.d.ts +175 -0
- package/dist/esm/Reconciliation.d.ts.map +1 -0
- package/dist/esm/Reconciliation.js +175 -0
- package/dist/esm/Reconciliation.js.map +1 -0
- package/dist/esm/ReplayOnly.d.ts +91 -0
- package/dist/esm/ReplayOnly.d.ts.map +1 -0
- package/dist/esm/ReplayOnly.js +59 -0
- package/dist/esm/ReplayOnly.js.map +1 -0
- package/dist/esm/Retention.d.ts +113 -0
- package/dist/esm/Retention.d.ts.map +1 -0
- package/dist/esm/Retention.js +139 -0
- package/dist/esm/Retention.js.map +1 -0
- package/dist/esm/RunCatalogRead.d.ts +17 -0
- package/dist/esm/RunCatalogRead.d.ts.map +1 -0
- package/dist/esm/RunCatalogRead.js +17 -0
- package/dist/esm/RunCatalogRead.js.map +1 -0
- package/dist/esm/RunChangeFeed.d.ts +75 -0
- package/dist/esm/RunChangeFeed.d.ts.map +1 -0
- package/dist/esm/RunChangeFeed.js +81 -0
- package/dist/esm/RunChangeFeed.js.map +1 -0
- package/dist/esm/RunState.d.ts +116 -0
- package/dist/esm/RunState.d.ts.map +1 -0
- package/dist/esm/RunState.js +109 -0
- package/dist/esm/RunState.js.map +1 -0
- package/dist/esm/Selection.d.ts +495 -0
- package/dist/esm/Selection.d.ts.map +1 -0
- package/dist/esm/Selection.js +482 -0
- package/dist/esm/Selection.js.map +1 -0
- package/dist/esm/SelectionStore.d.ts +141 -0
- package/dist/esm/SelectionStore.d.ts.map +1 -0
- package/dist/esm/SelectionStore.js +215 -0
- package/dist/esm/SelectionStore.js.map +1 -0
- package/dist/esm/StepBoundary.d.ts +501 -0
- package/dist/esm/StepBoundary.d.ts.map +1 -0
- package/dist/esm/StepBoundary.js +919 -0
- package/dist/esm/StepBoundary.js.map +1 -0
- package/dist/esm/StepCacheFold.d.ts +148 -0
- package/dist/esm/StepCacheFold.d.ts.map +1 -0
- package/dist/esm/StepCacheFold.js +201 -0
- package/dist/esm/StepCacheFold.js.map +1 -0
- package/dist/esm/StepSandbox.d.ts +78 -0
- package/dist/esm/StepSandbox.d.ts.map +1 -0
- package/dist/esm/StepSandbox.js +70 -0
- package/dist/esm/StepSandbox.js.map +1 -0
- package/dist/esm/WakeBus.d.ts +116 -0
- package/dist/esm/WakeBus.d.ts.map +1 -0
- package/dist/esm/WakeBus.js +121 -0
- package/dist/esm/WakeBus.js.map +1 -0
- package/dist/esm/WorkspaceSandbox.d.ts +619 -0
- package/dist/esm/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/esm/WorkspaceSandbox.js +985 -0
- package/dist/esm/WorkspaceSandbox.js.map +1 -0
- package/dist/esm/index.d.ts +157 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +157 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ActionPersistence.d.ts +276 -0
- package/dist/esm/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/esm/internal/ActionPersistence.js +2306 -0
- package/dist/esm/internal/ActionPersistence.js.map +1 -0
- package/dist/esm/internal/ArtifactRoots.d.ts +38 -0
- package/dist/esm/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/esm/internal/ArtifactRoots.js +76 -0
- package/dist/esm/internal/ArtifactRoots.js.map +1 -0
- package/dist/esm/internal/AttemptAdmission.d.ts +53 -0
- package/dist/esm/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/esm/internal/AttemptAdmission.js +52 -0
- package/dist/esm/internal/AttemptAdmission.js.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.js +104 -0
- package/dist/esm/internal/AttemptLifecycle.js.map +1 -0
- package/dist/esm/internal/AttemptProbe.d.ts +53 -0
- package/dist/esm/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/esm/internal/AttemptProbe.js +83 -0
- package/dist/esm/internal/AttemptProbe.js.map +1 -0
- package/dist/esm/internal/CacheAdmission.d.ts +79 -0
- package/dist/esm/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/esm/internal/CacheAdmission.js +72 -0
- package/dist/esm/internal/CacheAdmission.js.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.js +49 -0
- package/dist/esm/internal/CacheAgeHistory.js.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.js +54 -0
- package/dist/esm/internal/CacheAgeVerdicts.js.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.js +73 -0
- package/dist/esm/internal/CacheOutputPolicy.js.map +1 -0
- package/dist/esm/internal/CachePublication.d.ts +97 -0
- package/dist/esm/internal/CachePublication.d.ts.map +1 -0
- package/dist/esm/internal/CachePublication.js +116 -0
- package/dist/esm/internal/CachePublication.js.map +1 -0
- package/dist/esm/internal/CallFacts.d.ts +15 -0
- package/dist/esm/internal/CallFacts.d.ts.map +1 -0
- package/dist/esm/internal/CallFacts.js +83 -0
- package/dist/esm/internal/CallFacts.js.map +1 -0
- package/dist/esm/internal/CopiedRecord.d.ts +61 -0
- package/dist/esm/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/esm/internal/CopiedRecord.js +165 -0
- package/dist/esm/internal/CopiedRecord.js.map +1 -0
- package/dist/esm/internal/DeferredPersistence.d.ts +108 -0
- package/dist/esm/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/esm/internal/DeferredPersistence.js +240 -0
- package/dist/esm/internal/DeferredPersistence.js.map +1 -0
- package/dist/esm/internal/EffectRecords.d.ts +92 -0
- package/dist/esm/internal/EffectRecords.d.ts.map +1 -0
- package/dist/esm/internal/EffectRecords.js +94 -0
- package/dist/esm/internal/EffectRecords.js.map +1 -0
- package/dist/esm/internal/EngineJj.d.ts +30 -0
- package/dist/esm/internal/EngineJj.d.ts.map +1 -0
- package/dist/esm/internal/EngineJj.js +29 -0
- package/dist/esm/internal/EngineJj.js.map +1 -0
- package/dist/esm/internal/EngineStateSchema.d.ts +68 -0
- package/dist/esm/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/esm/internal/EngineStateSchema.js +53 -0
- package/dist/esm/internal/EngineStateSchema.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js +218 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js +81 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js.map +1 -0
- package/dist/esm/internal/ExitEncoding.d.ts +180 -0
- package/dist/esm/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/esm/internal/ExitEncoding.js +361 -0
- package/dist/esm/internal/ExitEncoding.js.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.js +29 -0
- package/dist/esm/internal/FileBoundarySnapshot.js.map +1 -0
- package/dist/esm/internal/FileEnumeration.d.ts +127 -0
- package/dist/esm/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/esm/internal/FileEnumeration.js +236 -0
- package/dist/esm/internal/FileEnumeration.js.map +1 -0
- package/dist/esm/internal/HostReflection.d.ts +80 -0
- package/dist/esm/internal/HostReflection.d.ts.map +1 -0
- package/dist/esm/internal/HostReflection.js +98 -0
- package/dist/esm/internal/HostReflection.js.map +1 -0
- package/dist/esm/internal/JournalRecords.d.ts +325 -0
- package/dist/esm/internal/JournalRecords.d.ts.map +1 -0
- package/dist/esm/internal/JournalRecords.js +306 -0
- package/dist/esm/internal/JournalRecords.js.map +1 -0
- package/dist/esm/internal/NodeJournal.d.ts +157 -0
- package/dist/esm/internal/NodeJournal.d.ts.map +1 -0
- package/dist/esm/internal/NodeJournal.js +298 -0
- package/dist/esm/internal/NodeJournal.js.map +1 -0
- package/dist/esm/internal/Ordering.d.ts +14 -0
- package/dist/esm/internal/Ordering.d.ts.map +1 -0
- package/dist/esm/internal/Ordering.js +14 -0
- package/dist/esm/internal/Ordering.js.map +1 -0
- package/dist/esm/internal/PlanInputs.d.ts +14 -0
- package/dist/esm/internal/PlanInputs.d.ts.map +1 -0
- package/dist/esm/internal/PlanInputs.js +57 -0
- package/dist/esm/internal/PlanInputs.js.map +1 -0
- package/dist/esm/internal/PlanMerges.d.ts +178 -0
- package/dist/esm/internal/PlanMerges.d.ts.map +1 -0
- package/dist/esm/internal/PlanMerges.js +113 -0
- package/dist/esm/internal/PlanMerges.js.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.js +39 -0
- package/dist/esm/internal/ProvenanceSlot.js.map +1 -0
- package/dist/esm/internal/ResultEnvelope.d.ts +88 -0
- package/dist/esm/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/esm/internal/ResultEnvelope.js +83 -0
- package/dist/esm/internal/ResultEnvelope.js.map +1 -0
- package/dist/esm/internal/RetentionOps.d.ts +414 -0
- package/dist/esm/internal/RetentionOps.d.ts.map +1 -0
- package/dist/esm/internal/RetentionOps.js +576 -0
- package/dist/esm/internal/RetentionOps.js.map +1 -0
- package/dist/esm/internal/RunCatalogOps.d.ts +118 -0
- package/dist/esm/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/esm/internal/RunCatalogOps.js +120 -0
- package/dist/esm/internal/RunCatalogOps.js.map +1 -0
- package/dist/esm/internal/RunCoordinator.d.ts +78 -0
- package/dist/esm/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/esm/internal/RunCoordinator.js +115 -0
- package/dist/esm/internal/RunCoordinator.js.map +1 -0
- package/dist/esm/internal/RunDriver.d.ts +192 -0
- package/dist/esm/internal/RunDriver.d.ts.map +1 -0
- package/dist/esm/internal/RunDriver.js +2334 -0
- package/dist/esm/internal/RunDriver.js.map +1 -0
- package/dist/esm/internal/RunLifecycle.d.ts +22 -0
- package/dist/esm/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/RunLifecycle.js +49 -0
- package/dist/esm/internal/RunLifecycle.js.map +1 -0
- package/dist/esm/internal/RunListing.d.ts +78 -0
- package/dist/esm/internal/RunListing.d.ts.map +1 -0
- package/dist/esm/internal/RunListing.js +146 -0
- package/dist/esm/internal/RunListing.js.map +1 -0
- package/dist/esm/internal/RunListingError.d.ts +35 -0
- package/dist/esm/internal/RunListingError.d.ts.map +1 -0
- package/dist/esm/internal/RunListingError.js +27 -0
- package/dist/esm/internal/RunListingError.js.map +1 -0
- package/dist/esm/internal/RuntimeGraph.d.ts +73 -0
- package/dist/esm/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/esm/internal/RuntimeGraph.js +182 -0
- package/dist/esm/internal/RuntimeGraph.js.map +1 -0
- package/dist/esm/internal/SandboxedExecution.d.ts +80 -0
- package/dist/esm/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/esm/internal/SandboxedExecution.js +107 -0
- package/dist/esm/internal/SandboxedExecution.js.map +1 -0
- package/dist/esm/internal/StateTransaction.d.ts +44 -0
- package/dist/esm/internal/StateTransaction.d.ts.map +1 -0
- package/dist/esm/internal/StateTransaction.js +54 -0
- package/dist/esm/internal/StateTransaction.js.map +1 -0
- package/dist/esm/internal/StepFacts.d.ts +14 -0
- package/dist/esm/internal/StepFacts.d.ts.map +1 -0
- package/dist/esm/internal/StepFacts.js +35 -0
- package/dist/esm/internal/StepFacts.js.map +1 -0
- package/dist/esm/internal/TypedEvents.d.ts +14 -0
- package/dist/esm/internal/TypedEvents.d.ts.map +1 -0
- package/dist/esm/internal/TypedEvents.js +14 -0
- package/dist/esm/internal/TypedEvents.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +17 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +41 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_selection_store.d.ts +15 -0
- package/dist/esm/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/esm/migrations/0002_selection_store.js +34 -0
- package/dist/esm/migrations/0002_selection_store.js.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.js +70 -0
- package/dist/esm/migrations/0003_plan_inputs.js.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.js +33 -0
- package/dist/esm/migrations/0004_plan_environment.js.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.js +59 -0
- package/dist/esm/migrations/0005_plan_merges.js.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.js +81 -0
- package/dist/esm/migrations/0006_execution_listing.js.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js +18 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.js +24 -0
- package/dist/esm/migrations/0008_deferred_consumption.js.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js +127 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.js +19 -0
- package/dist/esm/migrations/0010_pending_cancellation.js.map +1 -0
- package/dist/esm/test/TestStores.d.ts +89 -0
- package/dist/esm/test/TestStores.d.ts.map +1 -0
- package/dist/esm/test/TestStores.js +103 -0
- package/dist/esm/test/TestStores.js.map +1 -0
- package/docs/README.md +113 -0
- package/docs/api.md +1494 -0
- package/docs/concepts/attempts-and-replay.md +149 -0
- package/docs/concepts/cache-admission.md +265 -0
- package/docs/concepts/call-facts.md +86 -0
- package/docs/concepts/durable-waits.md +175 -0
- package/docs/concepts/execution-facts.md +90 -0
- package/docs/concepts/ownership-and-fencing.md +128 -0
- package/docs/concepts/step-boundaries.md +148 -0
- package/docs/concepts/workspace-transactions.md +199 -0
- package/docs/event-types.md +14 -0
- package/docs/guides/back-up-and-restore.md +164 -0
- package/docs/guides/collect-unreferenced-artifacts.md +128 -0
- package/docs/guides/compose-a-durable-engine.md +146 -0
- package/docs/guides/coordinate-two-processes.md +120 -0
- package/docs/guides/defer-work-with-selection.md +171 -0
- package/docs/guides/delete-old-run-history.md +154 -0
- package/docs/guides/drive-a-plan.md +314 -0
- package/docs/guides/observe-engine-metrics.md +98 -0
- package/docs/guides/observe-executions.md +187 -0
- package/docs/guides/reclaim-runs-from-a-dead-host.md +133 -0
- package/docs/guides/share-a-cache-across-machines.md +134 -0
- package/docs/guides/testing.md +123 -0
- package/docs/installation.md +102 -0
- package/docs/quickstart.md +215 -0
- package/docs/troubleshooting.md +347 -0
- package/package.json +438 -3
- package/src/ArtifactGc.ts +408 -0
- package/src/ArtifactSync.ts +278 -0
- package/src/CacheSync.ts +131 -0
- package/src/DeferredClockFold.ts +586 -0
- package/src/DisasterRecovery.ts +888 -0
- package/src/DurableEngineState.ts +2656 -0
- package/src/EngineStore.ts +656 -0
- package/src/EngineStoreMetrics.ts +331 -0
- package/src/Errors.ts +28 -0
- package/src/EventTypes.ts +27 -0
- package/src/ExecutionFacts.ts +125 -0
- package/src/ExecutionSnapshot.ts +186 -0
- package/src/Inconsistency.ts +253 -0
- package/src/Migrations.ts +95 -0
- package/src/OwnerIdentity.ts +125 -0
- package/src/PlanInputStore.ts +292 -0
- package/src/PlanMergeStore.ts +330 -0
- package/src/PlanScheduler.ts +1806 -0
- package/src/Reconciliation.ts +224 -0
- package/src/ReplayOnly.ts +95 -0
- package/src/Retention.ts +214 -0
- package/src/RunCatalogRead.ts +27 -0
- package/src/RunChangeFeed.ts +125 -0
- package/src/RunState.ts +137 -0
- package/src/Selection.ts +683 -0
- package/src/SelectionStore.ts +353 -0
- package/src/StepBoundary.ts +1165 -0
- package/src/StepCacheFold.ts +244 -0
- package/src/StepSandbox.ts +110 -0
- package/src/WakeBus.ts +167 -0
- package/src/WorkspaceSandbox.ts +1604 -0
- package/src/index.ts +185 -0
- package/src/internal/ActionPersistence.ts +2687 -0
- package/src/internal/ArtifactRoots.ts +92 -0
- package/src/internal/AttemptAdmission.ts +76 -0
- package/src/internal/AttemptLifecycle.ts +163 -0
- package/src/internal/AttemptProbe.ts +90 -0
- package/src/internal/CacheAdmission.ts +133 -0
- package/src/internal/CacheAgeHistory.ts +58 -0
- package/src/internal/CacheAgeVerdicts.ts +61 -0
- package/src/internal/CacheOutputPolicy.ts +82 -0
- package/src/internal/CachePublication.ts +153 -0
- package/src/internal/CallFacts.ts +87 -0
- package/src/internal/CopiedRecord.ts +201 -0
- package/src/internal/DeferredPersistence.ts +459 -0
- package/src/internal/EffectRecords.ts +136 -0
- package/src/internal/EngineJj.ts +30 -0
- package/src/internal/EngineStateSchema.ts +92 -0
- package/src/internal/ExecutionSnapshotRead.ts +298 -0
- package/src/internal/ExecutionSnapshotRelations.ts +121 -0
- package/src/internal/ExitEncoding.ts +453 -0
- package/src/internal/FileBoundarySnapshot.ts +39 -0
- package/src/internal/FileEnumeration.ts +334 -0
- package/src/internal/HostReflection.ts +128 -0
- package/src/internal/JournalRecords.ts +396 -0
- package/src/internal/NodeJournal.ts +340 -0
- package/src/internal/Ordering.ts +14 -0
- package/src/internal/PlanInputs.ts +62 -0
- package/src/internal/PlanMerges.ts +123 -0
- package/src/internal/ProvenanceSlot.ts +52 -0
- package/src/internal/ResultEnvelope.ts +118 -0
- package/src/internal/RetentionOps.ts +865 -0
- package/src/internal/RunCatalogOps.ts +174 -0
- package/src/internal/RunCoordinator.ts +215 -0
- package/src/internal/RunDriver.ts +3152 -0
- package/src/internal/RunLifecycle.ts +53 -0
- package/src/internal/RunListing.ts +210 -0
- package/src/internal/RunListingError.ts +37 -0
- package/src/internal/RuntimeGraph.ts +253 -0
- package/src/internal/SandboxedExecution.ts +165 -0
- package/src/internal/StateTransaction.ts +71 -0
- package/src/internal/StepFacts.ts +36 -0
- package/src/internal/TypedEvents.ts +29 -0
- package/src/migrations/0001_initial.ts +51 -0
- package/src/migrations/0002_selection_store.ts +38 -0
- package/src/migrations/0003_plan_inputs.ts +75 -0
- package/src/migrations/0004_plan_environment.ts +34 -0
- package/src/migrations/0005_plan_merges.ts +60 -0
- package/src/migrations/0006_execution_listing.ts +86 -0
- package/src/migrations/0007_run_parent_sequence.ts +19 -0
- package/src/migrations/0008_deferred_consumption.ts +27 -0
- package/src/migrations/0009_deferred_clock_facts.ts +163 -0
- package/src/migrations/0010_pending_cancellation.ts +20 -0
- package/src/test/TestStores.ts +145 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interpreter's node records, as journal entries.
|
|
3
|
+
*
|
|
4
|
+
* `@smthrs/flow` builds a record for the graph it drove and for every node it
|
|
5
|
+
* scheduled and settled, and says nothing about where they go. This module is
|
|
6
|
+
* the durable store's answer: one journal entry per record, addressed by the
|
|
7
|
+
* record's own `sourceId`, typed by the payload schemas `@smthrs/journal`
|
|
8
|
+
* publishes, and carrying the same event types the plan scheduler writes so a
|
|
9
|
+
* reader folds both executors with one decoder.
|
|
10
|
+
*
|
|
11
|
+
* Two facts live here rather than in the interpreter. The journal's producer
|
|
12
|
+
* identity is `(runId, sourceId, sourceSeq)`, so a resumed walk that
|
|
13
|
+
* re-derives the same `sourceId` collapses onto the row the first walk wrote:
|
|
14
|
+
* that is the exactly-once contract, and it holds because the identity is the
|
|
15
|
+
* record's, never a fresh one minted per observation. And a declaration site
|
|
16
|
+
* is made repo-relative here, because only the writer knows the root: a
|
|
17
|
+
* journal is read on machines that did not write it, and an absolute path is
|
|
18
|
+
* at best noise and at worst an operator's home directory published into a
|
|
19
|
+
* run's history.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.1.0
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { FlowRuntime } from "@smthrs/flow"
|
|
25
|
+
import { EngineEvent, JournalEvent, Redaction } from "@smthrs/journal"
|
|
26
|
+
import type * as Schema from "effect/Schema"
|
|
27
|
+
import * as JournalRecords from "./JournalRecords.ts"
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Where the records of one run are addressed from.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
* @category models
|
|
34
|
+
*/
|
|
35
|
+
export interface Scope {
|
|
36
|
+
readonly runId: string
|
|
37
|
+
/** The host's journal source, which every record of this run hangs under. */
|
|
38
|
+
readonly sourceId: string
|
|
39
|
+
readonly lineageId: string
|
|
40
|
+
/**
|
|
41
|
+
* The directory a declaration path is made relative to, when one is known.
|
|
42
|
+
*
|
|
43
|
+
* `undefined` means no path is recorded at all. That is the honest answer
|
|
44
|
+
* for a host that cannot say where its sources live, and it is better than
|
|
45
|
+
* a path a reader would have to guess the meaning of.
|
|
46
|
+
*/
|
|
47
|
+
readonly root?: string | undefined
|
|
48
|
+
/**
|
|
49
|
+
* The revision the sources those declaration paths point into were read
|
|
50
|
+
* at, when the host can name one.
|
|
51
|
+
*
|
|
52
|
+
* It lives here for the reason `root` does: a journal is read on machines
|
|
53
|
+
* that did not write it, and only the writer knows which tree it loaded.
|
|
54
|
+
* A path alone says where a node was declared and never which bytes were
|
|
55
|
+
* at that line, so a reader without this opens no code at all rather than
|
|
56
|
+
* whatever the working tree holds when they look (D-068).
|
|
57
|
+
*/
|
|
58
|
+
readonly sourceRevision?: string | undefined
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A declaration path as a journal may carry it: relative to the root, or
|
|
63
|
+
* nothing.
|
|
64
|
+
*
|
|
65
|
+
* The rule lives with the schema that refuses an absolute path
|
|
66
|
+
* (`@smthrs/journal`'s `EngineEvent.DeclaredAt`), so every writer of a
|
|
67
|
+
* declaration site obeys it the same way. It is named here because this is
|
|
68
|
+
* the module that applies it, and because the store's own tests are written
|
|
69
|
+
* against it.
|
|
70
|
+
*
|
|
71
|
+
* @since 0.1.0
|
|
72
|
+
* @category accessors
|
|
73
|
+
*/
|
|
74
|
+
export const relativePath = EngineEvent.relativePath
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A value the journal will serialize, typed as what it will be.
|
|
78
|
+
*
|
|
79
|
+
* A node's effects are JSON by construction, but an optional member spelled
|
|
80
|
+
* `undefined` is not assignable to `Json` under `exactOptionalPropertyTypes`,
|
|
81
|
+
* and serialization is exactly what drops it. This is the journal's own
|
|
82
|
+
* encoding performed one step early, so the type says what the stored value
|
|
83
|
+
* is rather than asserting it. @private
|
|
84
|
+
*/
|
|
85
|
+
const asJson = (value: unknown): typeof Schema.Json.Type => JSON.parse(JSON.stringify(value))
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The directory declaration paths are recorded relative to.
|
|
89
|
+
*
|
|
90
|
+
* `process` is absent in a worker and in a browser, and a host that cannot
|
|
91
|
+
* name its own working directory records no declaration path at all rather
|
|
92
|
+
* than one a reader would have to guess the meaning of. `host` is the global
|
|
93
|
+
* object by default and is named here so both answers are reachable without
|
|
94
|
+
* taking the real one away from the runtime.
|
|
95
|
+
*
|
|
96
|
+
* @since 0.1.0
|
|
97
|
+
* @category accessors
|
|
98
|
+
*/
|
|
99
|
+
export const hostRoot = (
|
|
100
|
+
explicit: string | undefined,
|
|
101
|
+
host: { readonly process?: { readonly cwd?: () => string } | undefined } = globalThis
|
|
102
|
+
): string | undefined => {
|
|
103
|
+
if (explicit !== undefined) return explicit
|
|
104
|
+
return typeof host.process?.cwd === "function" ? host.process.cwd() : undefined
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const summary = (scope: Scope, node: FlowRuntime.NodeSummary) => {
|
|
108
|
+
const path = node.declaredAt === undefined ? undefined : relativePath(scope.root, node.declaredAt.path)
|
|
109
|
+
return {
|
|
110
|
+
id: node.id,
|
|
111
|
+
kind: node.kind,
|
|
112
|
+
dependsOn: node.dependsOn,
|
|
113
|
+
tier: node.tier,
|
|
114
|
+
...(node.action === undefined ? {} : { action: node.action }),
|
|
115
|
+
...(node.effects === undefined ? {} : { effects: asJson(node.effects) }),
|
|
116
|
+
...(path === undefined ? {} : { declaredAt: { path, line: node.declaredAt!.line } })
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const graph = (scope: Scope, record: FlowRuntime.PlanRecorded | FlowRuntime.SubgraphAppended) => ({
|
|
121
|
+
nodes: record.nodes.map((node) => summary(scope, node)),
|
|
122
|
+
edges: record.edges,
|
|
123
|
+
// On every page, because every page carries its own sites.
|
|
124
|
+
...(scope.sourceRevision === undefined ? {} : { sourceRevision: scope.sourceRevision })
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* How many bytes of a node's settled value a journal row keeps.
|
|
129
|
+
*
|
|
130
|
+
* A node record is a small row beside the plan record's 12,000-byte page
|
|
131
|
+
* budget, and it is written once per node of every graph: a value kept whole
|
|
132
|
+
* would put an agent transcript in a permanent row and a projection would
|
|
133
|
+
* clip it without saying so. Two kibibytes is enough to read what a node
|
|
134
|
+
* produced and small enough that the settlement stays a summary.
|
|
135
|
+
*
|
|
136
|
+
* @since 0.1.0
|
|
137
|
+
* @category constants
|
|
138
|
+
*/
|
|
139
|
+
export const maximumResultBytes = 2_048
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* How large a settled value may be before it is summarized at all.
|
|
143
|
+
*
|
|
144
|
+
* Redacting a value rebuilds every member of it and runs the textual rules
|
|
145
|
+
* over every string, on the journal write path, for every node of every
|
|
146
|
+
* graph. Past this ceiling the walk is the cost rather than the row, and the
|
|
147
|
+
* honest answer is the size alone: the encoding is measured, `preview` is
|
|
148
|
+
* empty, and `truncated` says the text was cut to nothing. Anything below it
|
|
149
|
+
* is redacted whole and then cut.
|
|
150
|
+
*
|
|
151
|
+
* @since 0.1.0
|
|
152
|
+
* @category constants
|
|
153
|
+
*/
|
|
154
|
+
export const maximumSummarizedBytes = 65_536
|
|
155
|
+
|
|
156
|
+
/** The redactor a node summary is scrubbed with, built once. @private */
|
|
157
|
+
const redactor = Redaction.make({ onTooDeep: "name" })
|
|
158
|
+
|
|
159
|
+
/** UTF-8 bytes of a string, without allocating the encoding. @private */
|
|
160
|
+
const utf8Bytes = (text: string): number => {
|
|
161
|
+
let bytes = 0
|
|
162
|
+
for (let index = 0; index < text.length; index++) {
|
|
163
|
+
const code = text.charCodeAt(index)
|
|
164
|
+
if (code < 0x80) bytes += 1
|
|
165
|
+
else if (code < 0x800) bytes += 2
|
|
166
|
+
else if (code >= 0xd800 && code <= 0xdbff && index + 1 < text.length) {
|
|
167
|
+
bytes += 4
|
|
168
|
+
index++
|
|
169
|
+
} else bytes += 3
|
|
170
|
+
}
|
|
171
|
+
return bytes
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The longest prefix of `text` within `limit` UTF-8 bytes, never splitting a
|
|
176
|
+
* pair.
|
|
177
|
+
*
|
|
178
|
+
* One cut, taken where the walk stopped, because the walk stops for two
|
|
179
|
+
* reasons and only one of them can happen: the caller asks only for text it
|
|
180
|
+
* has already measured as over the limit, so a second exit for text that fits
|
|
181
|
+
* whole would be a line no run reaches. @private
|
|
182
|
+
*/
|
|
183
|
+
const clampToBytes = (text: string, limit: number): string => {
|
|
184
|
+
let bytes = 0
|
|
185
|
+
let index = 0
|
|
186
|
+
while (index < text.length) {
|
|
187
|
+
const code = text.charCodeAt(index)
|
|
188
|
+
const pair = code >= 0xd800 && code <= 0xdbff && index + 1 < text.length
|
|
189
|
+
const size = code < 0x80 ? 1 : code < 0x800 ? 2 : pair ? 4 : 3
|
|
190
|
+
if (bytes + size > limit) break
|
|
191
|
+
bytes += size
|
|
192
|
+
index += pair ? 2 : 1
|
|
193
|
+
}
|
|
194
|
+
return text.slice(0, index)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* What a node settled with, redacted and then bounded.
|
|
199
|
+
*
|
|
200
|
+
* REDACTION COMES FIRST. `Redaction.redact` is the journal's own write-path
|
|
201
|
+
* scrubber, and it is the one that reads a field NAME: `{ apiKey: "sk-..." }`
|
|
202
|
+
* is a credential because of the key, which no rule over encoded text can see
|
|
203
|
+
* once the value is a string inside a larger string. Running it over the
|
|
204
|
+
* decoded value also collapses cycles and names functions, so the encoding
|
|
205
|
+
* that follows always succeeds. Cutting the text first would be worse than
|
|
206
|
+
* useless: a credential split across the boundary is a credential the textual
|
|
207
|
+
* rules no longer recognise, and half of it would be kept.
|
|
208
|
+
*
|
|
209
|
+
* A value that will not encode even after redaction — a bigint, a value whose
|
|
210
|
+
* own `toJSON` throws — gets no summary at all rather than a fabricated one.
|
|
211
|
+
*
|
|
212
|
+
* `bytes` is the size of the encoding `preview` was cut from, which for a
|
|
213
|
+
* value past {@link maximumSummarizedBytes} is the value's own encoding: that
|
|
214
|
+
* branch keeps nothing, so there is no second number to disagree with.
|
|
215
|
+
*
|
|
216
|
+
* @since 0.1.0
|
|
217
|
+
* @category constructors
|
|
218
|
+
*/
|
|
219
|
+
export const resultSummary = (value: unknown): {
|
|
220
|
+
readonly preview: string
|
|
221
|
+
readonly bytes: number
|
|
222
|
+
readonly truncated: boolean
|
|
223
|
+
} | undefined => {
|
|
224
|
+
// The size first, from the value's own encoding, because it is the cheap
|
|
225
|
+
// half: a value this row will not keep is named by its size and never
|
|
226
|
+
// walked. A value that will not encode at all — a cycle, a bigint, a
|
|
227
|
+
// throwing `toJSON` — says nothing here, and the redactor below is asked,
|
|
228
|
+
// because it collapses cycles and names what it cannot rewrite.
|
|
229
|
+
let raw: string | undefined
|
|
230
|
+
try {
|
|
231
|
+
raw = JSON.stringify(value)
|
|
232
|
+
} catch {
|
|
233
|
+
raw = undefined
|
|
234
|
+
}
|
|
235
|
+
if (raw !== undefined) {
|
|
236
|
+
const rawBytes = utf8Bytes(raw)
|
|
237
|
+
if (rawBytes > maximumSummarizedBytes) return { preview: "", bytes: rawBytes, truncated: true }
|
|
238
|
+
}
|
|
239
|
+
let encoded: string | undefined
|
|
240
|
+
try {
|
|
241
|
+
encoded = JSON.stringify(redactor(value))
|
|
242
|
+
} catch {
|
|
243
|
+
return undefined
|
|
244
|
+
}
|
|
245
|
+
if (encoded === undefined) return undefined
|
|
246
|
+
const bytes = utf8Bytes(encoded)
|
|
247
|
+
if (bytes > maximumSummarizedBytes) return { preview: "", bytes, truncated: true }
|
|
248
|
+
if (bytes <= maximumResultBytes) return { preview: encoded, bytes, truncated: false }
|
|
249
|
+
return { preview: clampToBytes(encoded, maximumResultBytes), bytes, truncated: true }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The journal entry one node record is written as.
|
|
254
|
+
*
|
|
255
|
+
* @since 0.1.0
|
|
256
|
+
* @category constructors
|
|
257
|
+
*/
|
|
258
|
+
export const entry = (scope: Scope, record: FlowRuntime.NodeRecord): JournalEvent.Input => {
|
|
259
|
+
const options = {
|
|
260
|
+
runId: scope.runId,
|
|
261
|
+
sourceId: `${scope.sourceId}/${record.sourceId}`,
|
|
262
|
+
lineageId: scope.lineageId,
|
|
263
|
+
// Without an explicit sequence the journal ALLOCATES the next one for the
|
|
264
|
+
// source, so a resumed walk would write a second row for every node it
|
|
265
|
+
// re-derived. Pinning it to zero makes the re-emission an exact producer
|
|
266
|
+
// retry, which is the whole of the exactly-once contract.
|
|
267
|
+
sourceSeq: 0,
|
|
268
|
+
// The sequence is derived from the record's own identity, so a collision
|
|
269
|
+
// is the same node observed twice rather than two nodes wearing one
|
|
270
|
+
// address. What differs between the observations is metadata ABOUT the
|
|
271
|
+
// observation — a node the first walk BUILT settles CLEAN on the walk
|
|
272
|
+
// that replayed it — and the first row, the one that says what actually
|
|
273
|
+
// happened, stands.
|
|
274
|
+
dedupe: "identity" as const
|
|
275
|
+
}
|
|
276
|
+
switch (record._tag) {
|
|
277
|
+
case "PlanRecorded":
|
|
278
|
+
return JournalRecords.planRecorded(options, {
|
|
279
|
+
flow: record.flow,
|
|
280
|
+
generation: record.generation,
|
|
281
|
+
// The node COUNT of the whole graph, which is what this field has
|
|
282
|
+
// always meant; the node LIST rides beside it as `graph`.
|
|
283
|
+
nodes: record.nodeCount,
|
|
284
|
+
page: record.page,
|
|
285
|
+
pages: record.pages,
|
|
286
|
+
graph: graph(scope, record)
|
|
287
|
+
})
|
|
288
|
+
case "SubgraphAppended":
|
|
289
|
+
return JournalRecords.subgraphAppended(options, {
|
|
290
|
+
flow: record.flow,
|
|
291
|
+
generation: record.generation,
|
|
292
|
+
nodeIds: record.nodes.map((node) => node.id),
|
|
293
|
+
page: record.page,
|
|
294
|
+
pages: record.pages,
|
|
295
|
+
graph: graph(scope, record)
|
|
296
|
+
})
|
|
297
|
+
case "NodeScheduled":
|
|
298
|
+
return JournalRecords.nodeScheduled(options, {
|
|
299
|
+
nodeId: record.nodeId,
|
|
300
|
+
kind: record.kind,
|
|
301
|
+
attempt: record.attempt,
|
|
302
|
+
...(record.action === undefined ? {} : { action: record.action })
|
|
303
|
+
})
|
|
304
|
+
case "NodeSettled": {
|
|
305
|
+
const result = record.value === undefined ? undefined : resultSummary(record.value)
|
|
306
|
+
return JournalRecords.nodeSettled(options, {
|
|
307
|
+
nodeId: record.nodeId,
|
|
308
|
+
outcome: record.outcome,
|
|
309
|
+
attempts: record.attempts,
|
|
310
|
+
stepKeyDigests: record.stepKeyDigests,
|
|
311
|
+
...(record.action === undefined ? {} : { action: record.action }),
|
|
312
|
+
...(result === undefined ? {} : { result })
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* UTF-8 upper bound for the durable entry, including allocated envelope fields.
|
|
320
|
+
*
|
|
321
|
+
* Sequence/time reserve their largest JSON encodings so page boundaries never
|
|
322
|
+
* depend on the current journal position or clock, including after a resume.
|
|
323
|
+
* @since 1.0.0
|
|
324
|
+
* @category accessors
|
|
325
|
+
*/
|
|
326
|
+
export const encodedBytes = (scope: Scope, record: FlowRuntime.NodeRecord): number => {
|
|
327
|
+
const input = entry(scope, record)
|
|
328
|
+
const sourceSeq = JournalEvent.SourceSeq.make(0)
|
|
329
|
+
return new TextEncoder().encode(JSON.stringify({
|
|
330
|
+
runId: input.runId,
|
|
331
|
+
seq: Number.MAX_SAFE_INTEGER - 1,
|
|
332
|
+
eventId: JournalEvent.makeEventId(input.runId, input.sourceId, sourceSeq),
|
|
333
|
+
sourceId: input.sourceId,
|
|
334
|
+
sourceSeq,
|
|
335
|
+
emittedAtMs: Number.MAX_VALUE,
|
|
336
|
+
eventType: input.eventType,
|
|
337
|
+
payload: redactor(input.payload),
|
|
338
|
+
meta: redactor(input.meta)
|
|
339
|
+
})).byteLength
|
|
340
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-locale-independent UTF-16 code-unit ordering for durable material.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Compares two strings by JavaScript's locale-independent UTF-16 relational
|
|
9
|
+
* order.
|
|
10
|
+
*
|
|
11
|
+
* @category ordering
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
*/
|
|
14
|
+
export const compareText = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-check stored or newly measured observations against a verified plan.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { FileSet, type Plan } from "@smthrs/plan"
|
|
7
|
+
import { Effect, Schema } from "effect"
|
|
8
|
+
import * as PlanInputStore from "../PlanInputStore.ts"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Validates without publishing or mutating either the old pins or observations.
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category validation
|
|
14
|
+
*/
|
|
15
|
+
export const validate = (
|
|
16
|
+
snapshot: PlanInputStore.Snapshot,
|
|
17
|
+
nodes: ReadonlyArray<Plan.PlanNode>,
|
|
18
|
+
pinned: ReadonlyMap<string, string>,
|
|
19
|
+
writerScopesBefore: (node: Plan.PlanNode) => ReadonlyArray<FileSet.Entry>
|
|
20
|
+
): Effect.Effect<Map<string, string>, PlanInputStore.PlanInputError> =>
|
|
21
|
+
Effect.gen(function*() {
|
|
22
|
+
const corrupt = (message: string) =>
|
|
23
|
+
Effect.fail(new PlanInputStore.PlanInputError({ code: "corrupt_state", message }))
|
|
24
|
+
if (snapshot.nodes.length !== nodes.length) return yield* corrupt("source observation node count changed")
|
|
25
|
+
const nextPins = new Map(pinned)
|
|
26
|
+
const newPins = new Set<string>()
|
|
27
|
+
for (const pin of snapshot.pins) {
|
|
28
|
+
if (nextPins.has(pin.path)) return yield* corrupt("a later generation replaced an existing source pin")
|
|
29
|
+
nextPins.set(pin.path, pin.digest)
|
|
30
|
+
newPins.add(pin.path)
|
|
31
|
+
}
|
|
32
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
33
|
+
const node = nodes[index]!
|
|
34
|
+
const recorded = snapshot.nodes[index]!
|
|
35
|
+
const reads = FileSet.expandReads(node.effects.reads)
|
|
36
|
+
const writerScopes = reads.length === 0 ? [] : writerScopesBefore(node)
|
|
37
|
+
if (recorded.id !== node.id || recorded.key !== node.key || recorded.reads.length !== reads.length) {
|
|
38
|
+
return yield* corrupt("source observation does not match its plan node")
|
|
39
|
+
}
|
|
40
|
+
for (let readIndex = 0; readIndex < reads.length; readIndex++) {
|
|
41
|
+
const expected = Schema.decodeUnknownSync(FileSet.ReadEntry)(reads[readIndex]!)
|
|
42
|
+
const read = recorded.reads[readIndex]!
|
|
43
|
+
if (JSON.stringify(read.entry) !== JSON.stringify(expected)) {
|
|
44
|
+
return yield* corrupt("source observation declaration changed")
|
|
45
|
+
}
|
|
46
|
+
if (typeof expected === "string") {
|
|
47
|
+
const source = !writerScopes.some((scope) => FileSet.overlaps(scope, expected))
|
|
48
|
+
if (read.sourcePaths.length !== (source ? 1 : 0)) {
|
|
49
|
+
return yield* corrupt("source observation selects the wrong file version")
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const path of read.sourcePaths) {
|
|
53
|
+
if (!nextPins.has(path) || writerScopes.some((scope) => FileSet.overlaps(scope, path))) {
|
|
54
|
+
return yield* corrupt("source observation has a missing pin or preceding writer")
|
|
55
|
+
}
|
|
56
|
+
newPins.delete(path)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (newPins.size > 0) return yield* corrupt("source observation contains unreferenced pins")
|
|
61
|
+
return nextPins
|
|
62
|
+
})
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Durable merge recovery and generated identity, independent of dispatch.
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { KeyMaterial, Plan } from "@smthrs/plan"
|
|
6
|
+
import { Effect } from "effect"
|
|
7
|
+
import * as PlanMergeStore from "../PlanMergeStore.ts"
|
|
8
|
+
|
|
9
|
+
const invalid = (message: string, cause?: unknown) =>
|
|
10
|
+
new PlanMergeStore.PlanMergeError({
|
|
11
|
+
code: "corrupt_state",
|
|
12
|
+
message,
|
|
13
|
+
...(cause === undefined ? {} : { cause })
|
|
14
|
+
})
|
|
15
|
+
/** Chooses a free display ID; ownership comes from the durable decision, not this spelling.
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category identity
|
|
18
|
+
*/
|
|
19
|
+
export const allocateId = (plan: Plan.Plan, nodeId: string): string => {
|
|
20
|
+
const occupied = new Set(plan.nodes.map((node) => node.id))
|
|
21
|
+
const base = `${nodeId}+merge`
|
|
22
|
+
let candidate = base
|
|
23
|
+
for (let suffix = 1; occupied.has(candidate); suffix++) candidate = `${base}#${suffix}`
|
|
24
|
+
return candidate
|
|
25
|
+
}
|
|
26
|
+
/** The single declaration used both when appending and when recovering an extension.
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
* @category constructors
|
|
29
|
+
*/
|
|
30
|
+
export const draft = (node: Plan.PlanNode, mergeId: string, winners: ReadonlyArray<string>): Plan.NodeDraft => ({
|
|
31
|
+
id: mergeId,
|
|
32
|
+
kind: "merge",
|
|
33
|
+
material: {
|
|
34
|
+
version: KeyMaterial.version,
|
|
35
|
+
kind: node.material.kind,
|
|
36
|
+
body: { merge: { stopped: node.id, winners } },
|
|
37
|
+
inputs: winners.map((id) => ({ _tag: "Pending", from: id })),
|
|
38
|
+
layers: [],
|
|
39
|
+
capabilities: []
|
|
40
|
+
},
|
|
41
|
+
effects: node.effects
|
|
42
|
+
})
|
|
43
|
+
/** Checks that an intent names a permissible stopped node and its actual conflict peers.
|
|
44
|
+
* @since 1.0.0
|
|
45
|
+
* @category validation
|
|
46
|
+
*/
|
|
47
|
+
export const validateIntent = (plan: Plan.Plan, intent: PlanMergeStore.Intent) =>
|
|
48
|
+
Effect.gen(function*() {
|
|
49
|
+
const node = plan.nodes.find((candidate) => candidate.id === intent.nodeId)
|
|
50
|
+
if (
|
|
51
|
+
node === undefined || node.key !== intent.nodeKey || node.material.kind === "irreversible" ||
|
|
52
|
+
(node.runtime !== "stop-merge" && !node.conflicts.some((conflict) => conflict.runtime === "stop-merge")) ||
|
|
53
|
+
intent.peers.some((id) => !node.conflicts.some((conflict) => conflict.with === id))
|
|
54
|
+
) {
|
|
55
|
+
return yield* Effect.fail(invalid("merge intent does not match its approved stopped node"))
|
|
56
|
+
}
|
|
57
|
+
return node
|
|
58
|
+
})
|
|
59
|
+
/** Recovers only recorded merge extensions, never unrelated/unapproved appended work.
|
|
60
|
+
* @since 1.0.0
|
|
61
|
+
* @category recovery
|
|
62
|
+
*/
|
|
63
|
+
export const recover = (candidate: Plan.Plan, decisions: ReadonlyArray<PlanMergeStore.Decision>) =>
|
|
64
|
+
Effect.gen(function*() {
|
|
65
|
+
const byGeneration = new Map(
|
|
66
|
+
decisions.flatMap((decision) =>
|
|
67
|
+
decision.completion === undefined ? [] : [[decision.completion.generation, decision] as const]
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
let plan = candidate
|
|
71
|
+
if (byGeneration.size > 0) {
|
|
72
|
+
// Rebuild each prefix once. Re-verifying every complete prefix separately
|
|
73
|
+
// would multiply the compiler's overlap work across a long merge history.
|
|
74
|
+
plan = yield* Plan.verify({
|
|
75
|
+
...candidate,
|
|
76
|
+
generation: 0,
|
|
77
|
+
digest: candidate.baseDigest,
|
|
78
|
+
nodes: candidate.nodes.filter((node) => node.generation === 0)
|
|
79
|
+
})
|
|
80
|
+
.pipe(Effect.mapError((cause) => invalid("merge recovery has an invalid approved base", cause)))
|
|
81
|
+
const last = Math.max(candidate.generation, ...byGeneration.keys())
|
|
82
|
+
if (last > Plan.maximumPlanNodes) return yield* Effect.fail(invalid("merge generation exceeds the plan limit"))
|
|
83
|
+
for (let generation = 1; generation <= last; generation++) {
|
|
84
|
+
const decision = byGeneration.get(generation)
|
|
85
|
+
let drafts: ReadonlyArray<Plan.NodeDraft>
|
|
86
|
+
if (decision?.completion !== undefined) {
|
|
87
|
+
const stopped = yield* validateIntent(plan, decision.intent)
|
|
88
|
+
if (decision.completion.parentDigest !== plan.digest) {
|
|
89
|
+
return yield* Effect.fail(invalid("merge parent digest changed"))
|
|
90
|
+
}
|
|
91
|
+
drafts = [draft(stopped, decision.completion.mergeId, decision.completion.winners)]
|
|
92
|
+
} else {
|
|
93
|
+
drafts = candidate.nodes.filter((node) => node.generation === generation).map((node) => ({
|
|
94
|
+
id: node.id,
|
|
95
|
+
kind: node.kind,
|
|
96
|
+
material: node.material,
|
|
97
|
+
effects: node.effects,
|
|
98
|
+
priority: node.priority,
|
|
99
|
+
conflictStrategy: node.strategy,
|
|
100
|
+
runtimeStrategy: node.runtime
|
|
101
|
+
}))
|
|
102
|
+
if (drafts.length === 0) {
|
|
103
|
+
return yield* Effect.fail(invalid("merge recovery requires the approved intervening plan generations"))
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
plan = yield* Plan.append(plan, drafts).pipe(
|
|
107
|
+
Effect.mapError((cause) => invalid("stored merge extension cannot be reconstructed", cause))
|
|
108
|
+
)
|
|
109
|
+
if (
|
|
110
|
+
decision?.completion !== undefined &&
|
|
111
|
+
(plan.digest !== decision.completion.planDigest ||
|
|
112
|
+
Plan.generationNodes(plan)[0]!.key !== decision.completion.mergeKey)
|
|
113
|
+
) {
|
|
114
|
+
return yield* Effect.fail(invalid("merge decision does not identify its generated node"))
|
|
115
|
+
}
|
|
116
|
+
if (generation === candidate.generation && plan.digest !== candidate.digest) {
|
|
117
|
+
return yield* Effect.fail(invalid("merge decisions disagree with the supplied plan"))
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (const decision of decisions) yield* validateIntent(plan, decision.intent)
|
|
122
|
+
return plan
|
|
123
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only validation of the cache-provenance record occupying a producer
|
|
3
|
+
* slot this run re-emits into.
|
|
4
|
+
*
|
|
5
|
+
* A provenance producer identity (`cache:<digest>:<action>[:<run>:<seq>]`,
|
|
6
|
+
* `sourceSeq` 0) names ONE fact about one cache row — this key expired, this
|
|
7
|
+
* row was served, this replay failed — so a re-emission after a resume or in
|
|
8
|
+
* a fork child records the same fact with fresh measurements (`ageMs`, the
|
|
9
|
+
* clock, a later `reason`) and collapses onto the row already there. That
|
|
10
|
+
* collapse is legitimate only while the occupying record IS that fact: the
|
|
11
|
+
* same event type, the same key, the same action, and the same recorded row
|
|
12
|
+
* when the record names one. Anything else in the slot is the conflict the
|
|
13
|
+
* journal reported.
|
|
14
|
+
* @since 1.0.0-rc.0
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { Journal, JournalEvent } from "@smthrs/journal"
|
|
18
|
+
import * as Effect from "effect/Effect"
|
|
19
|
+
import * as CacheAgeHistory from "./CacheAgeHistory.ts"
|
|
20
|
+
|
|
21
|
+
const identity = ["keyDigest", "action", "recordedRunId", "recordedEventSeq"] as const
|
|
22
|
+
|
|
23
|
+
const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>
|
|
24
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Accepts the occupying record only when it states the same provenance fact
|
|
28
|
+
* as `record`; otherwise fails with `conflict`.
|
|
29
|
+
* @category accessors
|
|
30
|
+
* @since 1.0.0-rc.0
|
|
31
|
+
*/
|
|
32
|
+
export const accept = (options: {
|
|
33
|
+
readonly journal: Journal.Service
|
|
34
|
+
readonly runId: string
|
|
35
|
+
readonly record: JournalEvent.Input
|
|
36
|
+
readonly conflict: Journal.JournalError
|
|
37
|
+
}): Effect.Effect<void, Journal.JournalError> =>
|
|
38
|
+
Effect.gen(function*() {
|
|
39
|
+
const { conflict, journal, record } = options
|
|
40
|
+
const sourceSeq = record.sourceSeq ?? 0
|
|
41
|
+
const entry = yield* CacheAgeHistory.find(
|
|
42
|
+
journal,
|
|
43
|
+
options.runId,
|
|
44
|
+
(candidate) => candidate.sourceId === record.sourceId && Number(candidate.sourceSeq) === Number(sourceSeq)
|
|
45
|
+
)
|
|
46
|
+
if (entry === undefined || entry.eventType !== record.eventType) return yield* Effect.fail(conflict)
|
|
47
|
+
const attempted = record.payload
|
|
48
|
+
const occupying = entry.payload
|
|
49
|
+
if (!isRecord(attempted) || !isRecord(occupying)) return yield* Effect.fail(conflict)
|
|
50
|
+
const same = identity.every((field) => !(field in attempted) || attempted[field] === occupying[field])
|
|
51
|
+
return same ? undefined : yield* Effect.fail(conflict)
|
|
52
|
+
})
|