@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 @@
|
|
|
1
|
+
{"version":3,"file":"JournalRecords.js","sourceRoot":"","sources":["../../../src/internal/JournalRecords.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAgD7C;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,OAAqB,EAAqC,EAAE,CAAC,CAAC;IAC1E,SAAS,EAAE,OAAO,CAAC,SAAS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,EAAE,qCAAqC,EAAE,OAAO,CAAC,CAAA;AAChE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAqB,EAAE,OAAgB,EAAE,EAAE,CACzE,KAAK,CAAC,OAAO,EAAE,+BAA+B,EAAE,OAAO,CAAC,CAAA;AAC1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAqB,EAAE,OAAgB,EAAE,EAAE,CACvE,KAAK,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,CAAC,CAAA;AACxD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAqB,EAAE,OAAgB,EAAE,EAAE,CACzE,KAAK,CAAC,OAAO,EAAE,+BAA+B,EAAE,OAAO,CAAC,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,KAAyB,EAAE,KAAa,EAAE,EAAE,CACjF,MAAM,CAAC,OAAO,CACZ,OAAO,CAAC,OAAO,EACf,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,OAAO,CAAC;IACd,KAAK,EAAE,KAA2B;IAClC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAyB,EAAE,CAAC;IACpE,KAAK;CACN,CAAC,CACL,CAAA","sourcesContent":["/**\n * Stable engine event constructors over the open journal envelope.\n *\n * @since 0.1.0\n */\n\nimport { Journal, JournalEvent } from \"@smthrs/journal\"\nimport type { EngineEvent } from \"@smthrs/journal\"\nimport * as Effect from \"effect/Effect\"\nimport { EventTypes } from \"../EventTypes.ts\"\n\n/**\n * The addressing every engine record shares: which run wrote it, which source\n * inside that run, and which journal lineage it belongs to.\n *\n * Only `lineageId` is a semantic requirement rather than bookkeeping — a\n * record without one is a record no time-travel frame can address — which is\n * why it is required here rather than optional.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface EventOptions {\n readonly runId: string\n readonly sourceId: string\n readonly sourceSeq?: number | undefined\n /**\n * The journal lineage this record addresses itself to — minted by the engine\n * (`FlowEngine.Lineage`) and carried on every engine record.\n *\n * Time travel (`packages/smithers/flows/time-travel/docs/README.md`) makes a frame the position\n * `(lineageId, seq)`, and time travel's replay skips any entry whose\n * `meta.lineageId` names a different lineage. An engine record without it is\n * a record no frame can address, which is why this is required rather than\n * optional: the omission used to make `TimeTravel.inspect` fail `not_found`\n * on every journal the production composition wrote.\n */\n readonly lineageId: string\n /**\n * The step-cache key whose sealed row holds this record's result, when one\n * exists. Replay reads it to hand the projection the sealed value instead of\n * re-deriving it.\n */\n readonly cacheKey?: string | undefined\n /**\n * What a re-emission of this producer identity means.\n *\n * The default, `content`, is the strict reading: the identity names one set\n * of bytes. `identity` is for a record whose sequence is derived from the\n * event itself, where a collision IS the same event observed twice and the\n * bytes that differ are metadata about the observation — a node settled\n * `built` by the walk that ran it and `clean` by the resumed walk that\n * replayed it is one node settling once, seen twice.\n */\n readonly dedupe?: JournalEvent.Dedupe | undefined\n}\n\n/**\n * The additive envelope every engine record carries.\n *\n * Kept a plain open record on purpose: `meta` is the journal's forward-compatible\n * side channel, so a consumer that does not know a key ignores it.\n */\nconst meta = (options: EventOptions): Readonly<Record<string, unknown>> => ({\n lineageId: options.lineageId,\n ...(options.cacheKey === undefined ? {} : { cacheKey: options.cacheKey })\n})\n\nconst event = (options: EventOptions, eventType: string, payload: unknown): JournalEvent.Input =>\n new JournalEvent.Input({\n runId: options.runId as JournalEvent.RunId,\n sourceId: options.sourceId as JournalEvent.SourceId,\n ...(options.sourceSeq === undefined ? {} : { sourceSeq: options.sourceSeq as JournalEvent.SourceSeq }),\n ...(options.dedupe === undefined ? {} : { dedupe: options.dedupe }),\n eventType,\n payload,\n meta: meta(options)\n })\n\n/**\n * The run's state advanced. Replaying these records in order is how time\n * travel derives the state AT a frame, rather than reading the run row's\n * latest value.\n *\n * @since 0.1.0\n * @category events\n */\nexport const runDecision = (options: EventOptions, payload: unknown) => event(options, EventTypes.runDecision, payload)\n/**\n * An action attempt was admitted and its body is about to run. Paired with\n * {@link attemptFinished}; an unmatched one is crash evidence.\n *\n * @since 0.1.0\n * @category events\n */\nexport const attemptStarted = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.attemptStarted, payload)\n/**\n * An action attempt settled, successfully or not. Closes the span opened by\n * {@link attemptStarted}.\n *\n * @since 0.1.0\n * @category events\n */\nexport const attemptFinished = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.attemptFinished, payload)\n/**\n * A durable deferred was resolved from outside the run. Journaled because the\n * resolution is the only evidence of it — a replay cannot re-derive a value\n * that arrived over the network. The record names the completion row and the\n * digests of its encoded `exit` and `metadata`; the values stay in the row,\n * because the journal is redacted and replayed to subscribers.\n *\n * @since 0.1.0\n * @category events\n */\nexport const deferredCompleted = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.deferredCompleted, payload)\n/**\n * A run observed a deferred's result, so registration sweeps stop waking it\n * for that result. The result itself stays in its row for replay.\n *\n * @since 1.0.0\n * @category events\n */\nexport const deferredConsumed = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.deferredConsumed, payload)\n/**\n * A durable timer stopped being pending: it fired, or its run settled first.\n * Without it a rebuilt deadline index would re-arm a clock that already\n * completed (issue #2037).\n *\n * @since 1.0.0\n * @category events\n */\nexport const clockCompleted = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.clockCompleted, payload)\n/**\n * The {@link clockCompleted} record for one clock, under the producer identity\n * every completer of that clock shares, so a retried completion collapses.\n *\n * @since 1.0.0\n * @category events\n */\nexport const clockCompletedFor = (\n journalSource: string,\n lineageId: string,\n clock: { readonly flowName: string; readonly executionId: string; readonly clockName: string },\n completedAtMs: number\n) =>\n clockCompleted({\n runId: clock.executionId,\n lineageId,\n sourceId: `${journalSource}:clock-completed:${\n JSON.stringify([clock.flowName, clock.executionId, clock.clockName])\n }`,\n sourceSeq: 0\n }, {\n flowName: clock.flowName,\n executionId: clock.executionId,\n clockName: clock.clockName,\n completedAtMs\n })\n/**\n * A durable timer was armed. Journaling the schedule rather than the firing is\n * what lets a resumed run re-arm the same deadline instead of restarting the\n * wait.\n *\n * @since 0.1.0\n * @category events\n */\nexport const clockScheduled = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.clockScheduled, payload)\n/**\n * The run was interrupted — cancelled, fenced out, or torn down — as opposed\n * to failing. Recorded so a later reader can tell a cancelled run from a\n * broken one.\n *\n * @since 0.1.0\n * @category events\n */\nexport const interrupted = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.interrupted\", payload)\n/**\n * The jj pointer and plan digest in force at this point in the journal. These\n * are the two tier-2 facts replay cannot derive, which is why the engine emits\n * them and time travel's snapshot projector folds them into frame anchors.\n *\n * @since 0.1.0\n * @category events\n */\nexport const snapshotIdentified = (options: EventOptions, payload: unknown) =>\n event(options, EventTypes.snapshotIdentified, payload)\n/**\n * A hard-mode step wrote outside its declared write set, so its result was\n * refused. The record is the forensic trail for a declaration that does not\n * match what the step actually does.\n *\n * @since 0.1.0\n * @category events\n */\nexport const hardViolation = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.hard-violation\", payload)\n/**\n * An expected-mode step wrote paths its declaration did not predict. Unlike\n * {@link hardViolation} the result still stands — the declaration was a\n * prediction, and this is the record of it being wrong.\n *\n * @since 0.1.0\n * @category events\n */\nexport const expectedSetDeviation = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.expected-set-deviation\", payload)\n/**\n * An isolated execution produced a diff bundle: its content address, the paths\n * it changed, and the deviations the declaration did not predict. One of the\n * two record types copy-back writes.\n *\n * It is written once the attempt's copy-back has settled, not before it — the\n * rebase loop owns the window in between, and a bundle that lost every race\n * was never a proposal the host saw. A crash inside that window leaves the\n * attempt row unfinished, so the replay re-executes and journals the bundle it\n * actually applies. An execution the declaration invalidated journals nothing\n * here at all; its `hard-violation` record carries the identity instead.\n *\n * @since 0.1.0\n * @category events\n */\nexport const diffBundleCaptured = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.diff-bundle-captured\", payload)\n/**\n * A diff bundle reached the host. Carries the rebase count, the deduplicated\n * `queued` effect keys, and the `dispatched` keys the delivery stage sent.\n * `dispatched` is present and empty when no `EffectDispatcher` is composed, so\n * the absence of delivery is a journal fact rather than an inference.\n *\n * @since 0.1.0\n * @category events\n */\nexport const copyBackSettled = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.copy-back-settled\", payload)\n/**\n * A plan was recorded and a run is about to be driven under it. Carries the\n * plan id, its generation-0 digest, and its node count, so\n * `packages/smithers/flows/plan/docs/api.md` asks the audit question, \"show me the plan this ran\n * under\". This record answers it exactly rather than reconstructing it.\n *\n * @since 0.1.0\n * @category events\n */\nexport const planRecorded = (options: EventOptions, payload: EngineEvent.PlanRecordedPayload) =>\n event(options, EventTypes.planRecorded, payload)\n/**\n * An elaboration appended a pre-keyed subgraph to the SAME plan. The plan\n * grows; it is never invalidated, so this record names the new generation, the\n * advanced digest, and the node ids added — never a replacement graph.\n *\n * @since 0.1.0\n * @category events\n */\nexport const subgraphAppended = (options: EventOptions, payload: EngineEvent.SubgraphAppendedPayload) =>\n event(options, EventTypes.subgraphAppended, payload)\n/**\n * A plan node was admitted to the scheduler: its caps and seats allowed it,\n * and its effective priority selected it. Paired with `node-settled`, this is\n * the queue-time evidence the journal measures.\n *\n * @since 0.1.0\n * @category events\n */\nexport const nodeScheduled = (options: EventOptions, payload: EngineEvent.NodeScheduledPayload) =>\n event(options, \"flows.engine.node-scheduled\", payload)\n/**\n * A plan node reached an evaluation outcome. Skyframe's\n * `EvaluationProgressReceiver.EvaluationState` is the prior art:\n * `SUCCESS_VERSION_CHANGED`/`SUCCESS_VERSION_UNCHANGED` map onto `built`/\n * `clean`, and where Skyframe splits failure by version we use `failed` and\n * `skipped` — a content-addressed store never serves a failure from cache, so\n * `FAIL_VERSION_UNCHANGED` has no analogue, while a dependent that never ran\n * because its cone failed does. `deferred` is the one outcome outside the\n * Skyframe quadruple: a scheduling debt recorded by probabilistic selection,\n * not an evaluation state.\n *\n * @since 0.1.0\n * @category events\n */\nexport const nodeSettled = (options: EventOptions, payload: EngineEvent.NodeSettledPayload) =>\n event(options, \"flows.engine.node-settled\", payload)\n/**\n * A scheduled node's dispatch identity was invalidated: its measured inputs no\n * longer match the ones its key was computed from, so it is re-keyed and\n * re-dispatched. Invalidation is re-keying — there is no dirty bit and no\n * invalidating visitor to journal.\n *\n * @since 0.1.0\n * @category events\n */\nexport const nodeInvalidated = (options: EventOptions, payload: EngineEvent.NodeInvalidatedPayload) =>\n event(options, \"flows.engine.node-invalidated\", payload)\n/**\n * The reconciliation seam returned a verdict for a deviation or an unabsorbed\n * materialization conflict.\n *\n * @since 0.1.0\n * @category events\n */\nexport const nodeReconciled = (options: EventOptions, payload: EngineEvent.NodeReconciledPayload) =>\n event(options, \"flows.engine.node-reconciled\", payload)\n/**\n * A selection guess postponed a sink node: it did not execute, wrote no cache\n * row, and this record is the debt — node id, plan key, the suspected edge,\n * and the likelihood — that a later guess-free pass repays. `Selection.debt`\n * folds these against {@link nodeSettled} records to list what is still owed.\n *\n * @since 0.1.0\n * @category events\n */\nexport const selectionDeferred = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.selection-deferred\", payload)\n/**\n * A selection guess proposed a flow no real dependency reaches. V1 records\n * and surfaces the proposal; it never auto-appends plan nodes, so this record\n * is the proposal's only artifact.\n *\n * @since 0.1.0\n * @category events\n */\nexport const selectionProposed = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.selection-proposed\", payload)\n/**\n * A run forced full selection: every verdict was treated as `Admit`, the way\n * `--fresh` ignores the cache. Journaled so a report can say the guesses were\n * overridden rather than absent.\n *\n * @since 0.1.0\n * @category events\n */\nexport const selectionOverridden = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.selection-overridden\", payload)\n/**\n * A selection layer returned a Defer or Propose verdict naming a non-sink.\n * The verdict is ignored — only sinks are deferrable — and this observation\n * records the layer disagreeing with the plan's shape, in the pattern of\n * Skyframe's `GraphInconsistencyReceiver`: note it, never wire the detector\n * to /dev/null.\n *\n * @since 0.1.0\n * @category events\n */\nexport const selectionInconsistent = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.selection-inconsistent\", payload)\n/**\n * Where a reused result came from: which run first produced it and under which\n * key. A cache hit is otherwise invisible in the journal, and provenance is\n * what makes one auditable after the fact.\n *\n * @since 0.1.0\n * @category events\n */\nexport const cacheProvenance = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.cache-provenance\", payload)\n/**\n * Two runs recorded different results under one step key — the journaled form\n * of an under-specified declaration.\n *\n * @since 0.1.0\n * @category events\n */\nexport const cacheConflict = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.cache-conflict\", payload)\n/**\n * A cached output failed its digest check and the entry was evicted. Journaled\n * because a repeat is a failing disk, not a coincidence.\n *\n * @since 0.1.0\n * @category events\n */\nexport const cacheCorruption = (options: EventOptions, payload: unknown) =>\n event(options, \"flows.engine.cache-corruption\", payload)\n\n/**\n * Reads a page of engine records without imposing an agent-shaped event union.\n *\n * @since 0.1.0\n * @category queries\n */\nexport const entries = (runId: string, after: number | undefined, limit: number) =>\n Effect.flatMap(\n Journal.Journal,\n (journal) =>\n journal.entries({\n runId: runId as JournalEvent.RunId,\n ...(after === undefined ? {} : { after: after as JournalEvent.Seq }),\n limit\n })\n )\n"]}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
import type { FlowRuntime } from "@smthrs/flow";
|
|
24
|
+
import { JournalEvent } from "@smthrs/journal";
|
|
25
|
+
/**
|
|
26
|
+
* Where the records of one run are addressed from.
|
|
27
|
+
*
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
* @category models
|
|
30
|
+
*/
|
|
31
|
+
export interface Scope {
|
|
32
|
+
readonly runId: string;
|
|
33
|
+
/** The host's journal source, which every record of this run hangs under. */
|
|
34
|
+
readonly sourceId: string;
|
|
35
|
+
readonly lineageId: string;
|
|
36
|
+
/**
|
|
37
|
+
* The directory a declaration path is made relative to, when one is known.
|
|
38
|
+
*
|
|
39
|
+
* `undefined` means no path is recorded at all. That is the honest answer
|
|
40
|
+
* for a host that cannot say where its sources live, and it is better than
|
|
41
|
+
* a path a reader would have to guess the meaning of.
|
|
42
|
+
*/
|
|
43
|
+
readonly root?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The revision the sources those declaration paths point into were read
|
|
46
|
+
* at, when the host can name one.
|
|
47
|
+
*
|
|
48
|
+
* It lives here for the reason `root` does: a journal is read on machines
|
|
49
|
+
* that did not write it, and only the writer knows which tree it loaded.
|
|
50
|
+
* A path alone says where a node was declared and never which bytes were
|
|
51
|
+
* at that line, so a reader without this opens no code at all rather than
|
|
52
|
+
* whatever the working tree holds when they look (D-068).
|
|
53
|
+
*/
|
|
54
|
+
readonly sourceRevision?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A declaration path as a journal may carry it: relative to the root, or
|
|
58
|
+
* nothing.
|
|
59
|
+
*
|
|
60
|
+
* The rule lives with the schema that refuses an absolute path
|
|
61
|
+
* (`@smthrs/journal`'s `EngineEvent.DeclaredAt`), so every writer of a
|
|
62
|
+
* declaration site obeys it the same way. It is named here because this is
|
|
63
|
+
* the module that applies it, and because the store's own tests are written
|
|
64
|
+
* against it.
|
|
65
|
+
*
|
|
66
|
+
* @since 0.1.0
|
|
67
|
+
* @category accessors
|
|
68
|
+
*/
|
|
69
|
+
export declare const relativePath: (root: string | undefined, path: string) => string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The directory declaration paths are recorded relative to.
|
|
72
|
+
*
|
|
73
|
+
* `process` is absent in a worker and in a browser, and a host that cannot
|
|
74
|
+
* name its own working directory records no declaration path at all rather
|
|
75
|
+
* than one a reader would have to guess the meaning of. `host` is the global
|
|
76
|
+
* object by default and is named here so both answers are reachable without
|
|
77
|
+
* taking the real one away from the runtime.
|
|
78
|
+
*
|
|
79
|
+
* @since 0.1.0
|
|
80
|
+
* @category accessors
|
|
81
|
+
*/
|
|
82
|
+
export declare const hostRoot: (explicit: string | undefined, host?: {
|
|
83
|
+
readonly process?: {
|
|
84
|
+
readonly cwd?: () => string;
|
|
85
|
+
} | undefined;
|
|
86
|
+
}) => string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* How many bytes of a node's settled value a journal row keeps.
|
|
89
|
+
*
|
|
90
|
+
* A node record is a small row beside the plan record's 12,000-byte page
|
|
91
|
+
* budget, and it is written once per node of every graph: a value kept whole
|
|
92
|
+
* would put an agent transcript in a permanent row and a projection would
|
|
93
|
+
* clip it without saying so. Two kibibytes is enough to read what a node
|
|
94
|
+
* produced and small enough that the settlement stays a summary.
|
|
95
|
+
*
|
|
96
|
+
* @since 0.1.0
|
|
97
|
+
* @category constants
|
|
98
|
+
*/
|
|
99
|
+
export declare const maximumResultBytes = 2048;
|
|
100
|
+
/**
|
|
101
|
+
* How large a settled value may be before it is summarized at all.
|
|
102
|
+
*
|
|
103
|
+
* Redacting a value rebuilds every member of it and runs the textual rules
|
|
104
|
+
* over every string, on the journal write path, for every node of every
|
|
105
|
+
* graph. Past this ceiling the walk is the cost rather than the row, and the
|
|
106
|
+
* honest answer is the size alone: the encoding is measured, `preview` is
|
|
107
|
+
* empty, and `truncated` says the text was cut to nothing. Anything below it
|
|
108
|
+
* is redacted whole and then cut.
|
|
109
|
+
*
|
|
110
|
+
* @since 0.1.0
|
|
111
|
+
* @category constants
|
|
112
|
+
*/
|
|
113
|
+
export declare const maximumSummarizedBytes = 65536;
|
|
114
|
+
/**
|
|
115
|
+
* What a node settled with, redacted and then bounded.
|
|
116
|
+
*
|
|
117
|
+
* REDACTION COMES FIRST. `Redaction.redact` is the journal's own write-path
|
|
118
|
+
* scrubber, and it is the one that reads a field NAME: `{ apiKey: "sk-..." }`
|
|
119
|
+
* is a credential because of the key, which no rule over encoded text can see
|
|
120
|
+
* once the value is a string inside a larger string. Running it over the
|
|
121
|
+
* decoded value also collapses cycles and names functions, so the encoding
|
|
122
|
+
* that follows always succeeds. Cutting the text first would be worse than
|
|
123
|
+
* useless: a credential split across the boundary is a credential the textual
|
|
124
|
+
* rules no longer recognise, and half of it would be kept.
|
|
125
|
+
*
|
|
126
|
+
* A value that will not encode even after redaction — a bigint, a value whose
|
|
127
|
+
* own `toJSON` throws — gets no summary at all rather than a fabricated one.
|
|
128
|
+
*
|
|
129
|
+
* `bytes` is the size of the encoding `preview` was cut from, which for a
|
|
130
|
+
* value past {@link maximumSummarizedBytes} is the value's own encoding: that
|
|
131
|
+
* branch keeps nothing, so there is no second number to disagree with.
|
|
132
|
+
*
|
|
133
|
+
* @since 0.1.0
|
|
134
|
+
* @category constructors
|
|
135
|
+
*/
|
|
136
|
+
export declare const resultSummary: (value: unknown) => {
|
|
137
|
+
readonly preview: string;
|
|
138
|
+
readonly bytes: number;
|
|
139
|
+
readonly truncated: boolean;
|
|
140
|
+
} | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* The journal entry one node record is written as.
|
|
143
|
+
*
|
|
144
|
+
* @since 0.1.0
|
|
145
|
+
* @category constructors
|
|
146
|
+
*/
|
|
147
|
+
export declare const entry: (scope: Scope, record: FlowRuntime.NodeRecord) => JournalEvent.Input;
|
|
148
|
+
/**
|
|
149
|
+
* UTF-8 upper bound for the durable entry, including allocated envelope fields.
|
|
150
|
+
*
|
|
151
|
+
* Sequence/time reserve their largest JSON encodings so page boundaries never
|
|
152
|
+
* depend on the current journal position or clock, including after a resume.
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
* @category accessors
|
|
155
|
+
*/
|
|
156
|
+
export declare const encodedBytes: (scope: Scope, record: FlowRuntime.NodeRecord) => number;
|
|
157
|
+
//# sourceMappingURL=NodeJournal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeJournal.d.ts","sourceRoot":"","sources":["../../../src/internal/NodeJournal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAe,YAAY,EAAa,MAAM,iBAAiB,CAAA;AAItE;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,gEAA2B,CAAA;AAapD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,GAAG,SAAS,EAC5B,OAAM;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CAAe,KACpF,MAAM,GAAG,SAGX,CAAA;AAsBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AAEvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAS,CAAA;AA2C5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B,GAAG,SA2BH,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,KAAK,EAAE,QAAQ,WAAW,CAAC,UAAU,KAAG,YAAY,CAAC,KA0DjF,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,KAAK,EAAE,QAAQ,WAAW,CAAC,UAAU,KAAG,MAc3E,CAAA"}
|
|
@@ -0,0 +1,298 @@
|
|
|
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
|
+
import { EngineEvent, JournalEvent, Redaction } from "@smthrs/journal";
|
|
24
|
+
import * as JournalRecords from "./JournalRecords.js";
|
|
25
|
+
/**
|
|
26
|
+
* A declaration path as a journal may carry it: relative to the root, or
|
|
27
|
+
* nothing.
|
|
28
|
+
*
|
|
29
|
+
* The rule lives with the schema that refuses an absolute path
|
|
30
|
+
* (`@smthrs/journal`'s `EngineEvent.DeclaredAt`), so every writer of a
|
|
31
|
+
* declaration site obeys it the same way. It is named here because this is
|
|
32
|
+
* the module that applies it, and because the store's own tests are written
|
|
33
|
+
* against it.
|
|
34
|
+
*
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
* @category accessors
|
|
37
|
+
*/
|
|
38
|
+
export const relativePath = EngineEvent.relativePath;
|
|
39
|
+
/**
|
|
40
|
+
* A value the journal will serialize, typed as what it will be.
|
|
41
|
+
*
|
|
42
|
+
* A node's effects are JSON by construction, but an optional member spelled
|
|
43
|
+
* `undefined` is not assignable to `Json` under `exactOptionalPropertyTypes`,
|
|
44
|
+
* and serialization is exactly what drops it. This is the journal's own
|
|
45
|
+
* encoding performed one step early, so the type says what the stored value
|
|
46
|
+
* is rather than asserting it. @private
|
|
47
|
+
*/
|
|
48
|
+
const asJson = (value) => JSON.parse(JSON.stringify(value));
|
|
49
|
+
/**
|
|
50
|
+
* The directory declaration paths are recorded relative to.
|
|
51
|
+
*
|
|
52
|
+
* `process` is absent in a worker and in a browser, and a host that cannot
|
|
53
|
+
* name its own working directory records no declaration path at all rather
|
|
54
|
+
* than one a reader would have to guess the meaning of. `host` is the global
|
|
55
|
+
* object by default and is named here so both answers are reachable without
|
|
56
|
+
* taking the real one away from the runtime.
|
|
57
|
+
*
|
|
58
|
+
* @since 0.1.0
|
|
59
|
+
* @category accessors
|
|
60
|
+
*/
|
|
61
|
+
export const hostRoot = (explicit, host = globalThis) => {
|
|
62
|
+
if (explicit !== undefined)
|
|
63
|
+
return explicit;
|
|
64
|
+
return typeof host.process?.cwd === "function" ? host.process.cwd() : undefined;
|
|
65
|
+
};
|
|
66
|
+
const summary = (scope, node) => {
|
|
67
|
+
const path = node.declaredAt === undefined ? undefined : relativePath(scope.root, node.declaredAt.path);
|
|
68
|
+
return {
|
|
69
|
+
id: node.id,
|
|
70
|
+
kind: node.kind,
|
|
71
|
+
dependsOn: node.dependsOn,
|
|
72
|
+
tier: node.tier,
|
|
73
|
+
...(node.action === undefined ? {} : { action: node.action }),
|
|
74
|
+
...(node.effects === undefined ? {} : { effects: asJson(node.effects) }),
|
|
75
|
+
...(path === undefined ? {} : { declaredAt: { path, line: node.declaredAt.line } })
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
const graph = (scope, record) => ({
|
|
79
|
+
nodes: record.nodes.map((node) => summary(scope, node)),
|
|
80
|
+
edges: record.edges,
|
|
81
|
+
// On every page, because every page carries its own sites.
|
|
82
|
+
...(scope.sourceRevision === undefined ? {} : { sourceRevision: scope.sourceRevision })
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* How many bytes of a node's settled value a journal row keeps.
|
|
86
|
+
*
|
|
87
|
+
* A node record is a small row beside the plan record's 12,000-byte page
|
|
88
|
+
* budget, and it is written once per node of every graph: a value kept whole
|
|
89
|
+
* would put an agent transcript in a permanent row and a projection would
|
|
90
|
+
* clip it without saying so. Two kibibytes is enough to read what a node
|
|
91
|
+
* produced and small enough that the settlement stays a summary.
|
|
92
|
+
*
|
|
93
|
+
* @since 0.1.0
|
|
94
|
+
* @category constants
|
|
95
|
+
*/
|
|
96
|
+
export const maximumResultBytes = 2_048;
|
|
97
|
+
/**
|
|
98
|
+
* How large a settled value may be before it is summarized at all.
|
|
99
|
+
*
|
|
100
|
+
* Redacting a value rebuilds every member of it and runs the textual rules
|
|
101
|
+
* over every string, on the journal write path, for every node of every
|
|
102
|
+
* graph. Past this ceiling the walk is the cost rather than the row, and the
|
|
103
|
+
* honest answer is the size alone: the encoding is measured, `preview` is
|
|
104
|
+
* empty, and `truncated` says the text was cut to nothing. Anything below it
|
|
105
|
+
* is redacted whole and then cut.
|
|
106
|
+
*
|
|
107
|
+
* @since 0.1.0
|
|
108
|
+
* @category constants
|
|
109
|
+
*/
|
|
110
|
+
export const maximumSummarizedBytes = 65_536;
|
|
111
|
+
/** The redactor a node summary is scrubbed with, built once. @private */
|
|
112
|
+
const redactor = Redaction.make({ onTooDeep: "name" });
|
|
113
|
+
/** UTF-8 bytes of a string, without allocating the encoding. @private */
|
|
114
|
+
const utf8Bytes = (text) => {
|
|
115
|
+
let bytes = 0;
|
|
116
|
+
for (let index = 0; index < text.length; index++) {
|
|
117
|
+
const code = text.charCodeAt(index);
|
|
118
|
+
if (code < 0x80)
|
|
119
|
+
bytes += 1;
|
|
120
|
+
else if (code < 0x800)
|
|
121
|
+
bytes += 2;
|
|
122
|
+
else if (code >= 0xd800 && code <= 0xdbff && index + 1 < text.length) {
|
|
123
|
+
bytes += 4;
|
|
124
|
+
index++;
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
bytes += 3;
|
|
128
|
+
}
|
|
129
|
+
return bytes;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* The longest prefix of `text` within `limit` UTF-8 bytes, never splitting a
|
|
133
|
+
* pair.
|
|
134
|
+
*
|
|
135
|
+
* One cut, taken where the walk stopped, because the walk stops for two
|
|
136
|
+
* reasons and only one of them can happen: the caller asks only for text it
|
|
137
|
+
* has already measured as over the limit, so a second exit for text that fits
|
|
138
|
+
* whole would be a line no run reaches. @private
|
|
139
|
+
*/
|
|
140
|
+
const clampToBytes = (text, limit) => {
|
|
141
|
+
let bytes = 0;
|
|
142
|
+
let index = 0;
|
|
143
|
+
while (index < text.length) {
|
|
144
|
+
const code = text.charCodeAt(index);
|
|
145
|
+
const pair = code >= 0xd800 && code <= 0xdbff && index + 1 < text.length;
|
|
146
|
+
const size = code < 0x80 ? 1 : code < 0x800 ? 2 : pair ? 4 : 3;
|
|
147
|
+
if (bytes + size > limit)
|
|
148
|
+
break;
|
|
149
|
+
bytes += size;
|
|
150
|
+
index += pair ? 2 : 1;
|
|
151
|
+
}
|
|
152
|
+
return text.slice(0, index);
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* What a node settled with, redacted and then bounded.
|
|
156
|
+
*
|
|
157
|
+
* REDACTION COMES FIRST. `Redaction.redact` is the journal's own write-path
|
|
158
|
+
* scrubber, and it is the one that reads a field NAME: `{ apiKey: "sk-..." }`
|
|
159
|
+
* is a credential because of the key, which no rule over encoded text can see
|
|
160
|
+
* once the value is a string inside a larger string. Running it over the
|
|
161
|
+
* decoded value also collapses cycles and names functions, so the encoding
|
|
162
|
+
* that follows always succeeds. Cutting the text first would be worse than
|
|
163
|
+
* useless: a credential split across the boundary is a credential the textual
|
|
164
|
+
* rules no longer recognise, and half of it would be kept.
|
|
165
|
+
*
|
|
166
|
+
* A value that will not encode even after redaction — a bigint, a value whose
|
|
167
|
+
* own `toJSON` throws — gets no summary at all rather than a fabricated one.
|
|
168
|
+
*
|
|
169
|
+
* `bytes` is the size of the encoding `preview` was cut from, which for a
|
|
170
|
+
* value past {@link maximumSummarizedBytes} is the value's own encoding: that
|
|
171
|
+
* branch keeps nothing, so there is no second number to disagree with.
|
|
172
|
+
*
|
|
173
|
+
* @since 0.1.0
|
|
174
|
+
* @category constructors
|
|
175
|
+
*/
|
|
176
|
+
export const resultSummary = (value) => {
|
|
177
|
+
// The size first, from the value's own encoding, because it is the cheap
|
|
178
|
+
// half: a value this row will not keep is named by its size and never
|
|
179
|
+
// walked. A value that will not encode at all — a cycle, a bigint, a
|
|
180
|
+
// throwing `toJSON` — says nothing here, and the redactor below is asked,
|
|
181
|
+
// because it collapses cycles and names what it cannot rewrite.
|
|
182
|
+
let raw;
|
|
183
|
+
try {
|
|
184
|
+
raw = JSON.stringify(value);
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
raw = undefined;
|
|
188
|
+
}
|
|
189
|
+
if (raw !== undefined) {
|
|
190
|
+
const rawBytes = utf8Bytes(raw);
|
|
191
|
+
if (rawBytes > maximumSummarizedBytes)
|
|
192
|
+
return { preview: "", bytes: rawBytes, truncated: true };
|
|
193
|
+
}
|
|
194
|
+
let encoded;
|
|
195
|
+
try {
|
|
196
|
+
encoded = JSON.stringify(redactor(value));
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
if (encoded === undefined)
|
|
202
|
+
return undefined;
|
|
203
|
+
const bytes = utf8Bytes(encoded);
|
|
204
|
+
if (bytes > maximumSummarizedBytes)
|
|
205
|
+
return { preview: "", bytes, truncated: true };
|
|
206
|
+
if (bytes <= maximumResultBytes)
|
|
207
|
+
return { preview: encoded, bytes, truncated: false };
|
|
208
|
+
return { preview: clampToBytes(encoded, maximumResultBytes), bytes, truncated: true };
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* The journal entry one node record is written as.
|
|
212
|
+
*
|
|
213
|
+
* @since 0.1.0
|
|
214
|
+
* @category constructors
|
|
215
|
+
*/
|
|
216
|
+
export const entry = (scope, record) => {
|
|
217
|
+
const options = {
|
|
218
|
+
runId: scope.runId,
|
|
219
|
+
sourceId: `${scope.sourceId}/${record.sourceId}`,
|
|
220
|
+
lineageId: scope.lineageId,
|
|
221
|
+
// Without an explicit sequence the journal ALLOCATES the next one for the
|
|
222
|
+
// source, so a resumed walk would write a second row for every node it
|
|
223
|
+
// re-derived. Pinning it to zero makes the re-emission an exact producer
|
|
224
|
+
// retry, which is the whole of the exactly-once contract.
|
|
225
|
+
sourceSeq: 0,
|
|
226
|
+
// The sequence is derived from the record's own identity, so a collision
|
|
227
|
+
// is the same node observed twice rather than two nodes wearing one
|
|
228
|
+
// address. What differs between the observations is metadata ABOUT the
|
|
229
|
+
// observation — a node the first walk BUILT settles CLEAN on the walk
|
|
230
|
+
// that replayed it — and the first row, the one that says what actually
|
|
231
|
+
// happened, stands.
|
|
232
|
+
dedupe: "identity"
|
|
233
|
+
};
|
|
234
|
+
switch (record._tag) {
|
|
235
|
+
case "PlanRecorded":
|
|
236
|
+
return JournalRecords.planRecorded(options, {
|
|
237
|
+
flow: record.flow,
|
|
238
|
+
generation: record.generation,
|
|
239
|
+
// The node COUNT of the whole graph, which is what this field has
|
|
240
|
+
// always meant; the node LIST rides beside it as `graph`.
|
|
241
|
+
nodes: record.nodeCount,
|
|
242
|
+
page: record.page,
|
|
243
|
+
pages: record.pages,
|
|
244
|
+
graph: graph(scope, record)
|
|
245
|
+
});
|
|
246
|
+
case "SubgraphAppended":
|
|
247
|
+
return JournalRecords.subgraphAppended(options, {
|
|
248
|
+
flow: record.flow,
|
|
249
|
+
generation: record.generation,
|
|
250
|
+
nodeIds: record.nodes.map((node) => node.id),
|
|
251
|
+
page: record.page,
|
|
252
|
+
pages: record.pages,
|
|
253
|
+
graph: graph(scope, record)
|
|
254
|
+
});
|
|
255
|
+
case "NodeScheduled":
|
|
256
|
+
return JournalRecords.nodeScheduled(options, {
|
|
257
|
+
nodeId: record.nodeId,
|
|
258
|
+
kind: record.kind,
|
|
259
|
+
attempt: record.attempt,
|
|
260
|
+
...(record.action === undefined ? {} : { action: record.action })
|
|
261
|
+
});
|
|
262
|
+
case "NodeSettled": {
|
|
263
|
+
const result = record.value === undefined ? undefined : resultSummary(record.value);
|
|
264
|
+
return JournalRecords.nodeSettled(options, {
|
|
265
|
+
nodeId: record.nodeId,
|
|
266
|
+
outcome: record.outcome,
|
|
267
|
+
attempts: record.attempts,
|
|
268
|
+
stepKeyDigests: record.stepKeyDigests,
|
|
269
|
+
...(record.action === undefined ? {} : { action: record.action }),
|
|
270
|
+
...(result === undefined ? {} : { result })
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* UTF-8 upper bound for the durable entry, including allocated envelope fields.
|
|
277
|
+
*
|
|
278
|
+
* Sequence/time reserve their largest JSON encodings so page boundaries never
|
|
279
|
+
* depend on the current journal position or clock, including after a resume.
|
|
280
|
+
* @since 1.0.0
|
|
281
|
+
* @category accessors
|
|
282
|
+
*/
|
|
283
|
+
export const encodedBytes = (scope, record) => {
|
|
284
|
+
const input = entry(scope, record);
|
|
285
|
+
const sourceSeq = JournalEvent.SourceSeq.make(0);
|
|
286
|
+
return new TextEncoder().encode(JSON.stringify({
|
|
287
|
+
runId: input.runId,
|
|
288
|
+
seq: Number.MAX_SAFE_INTEGER - 1,
|
|
289
|
+
eventId: JournalEvent.makeEventId(input.runId, input.sourceId, sourceSeq),
|
|
290
|
+
sourceId: input.sourceId,
|
|
291
|
+
sourceSeq,
|
|
292
|
+
emittedAtMs: Number.MAX_VALUE,
|
|
293
|
+
eventType: input.eventType,
|
|
294
|
+
payload: redactor(input.payload),
|
|
295
|
+
meta: redactor(input.meta)
|
|
296
|
+
})).byteLength;
|
|
297
|
+
};
|
|
298
|
+
//# sourceMappingURL=NodeJournal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeJournal.js","sourceRoot":"","sources":["../../../src/internal/NodeJournal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;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,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QAC7C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,GAAG,EAAE,MAAM,CAAC,gBAAgB,GAAG,CAAC;QAChC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC;QACzE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS;QACT,WAAW,EAAE,MAAM,CAAC,SAAS;QAC7B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC,CAAC,UAAU,CAAA;AAChB,CAAC,CAAA","sourcesContent":["/**\n * The interpreter's node records, as journal entries.\n *\n * `@smthrs/flow` builds a record for the graph it drove and for every node it\n * scheduled and settled, and says nothing about where they go. This module is\n * the durable store's answer: one journal entry per record, addressed by the\n * record's own `sourceId`, typed by the payload schemas `@smthrs/journal`\n * publishes, and carrying the same event types the plan scheduler writes so a\n * reader folds both executors with one decoder.\n *\n * Two facts live here rather than in the interpreter. The journal's producer\n * identity is `(runId, sourceId, sourceSeq)`, so a resumed walk that\n * re-derives the same `sourceId` collapses onto the row the first walk wrote:\n * that is the exactly-once contract, and it holds because the identity is the\n * record's, never a fresh one minted per observation. And a declaration site\n * is made repo-relative here, because only the writer knows the root: a\n * journal is read on machines that did not write it, and an absolute path is\n * at best noise and at worst an operator's home directory published into a\n * run's history.\n *\n * @since 0.1.0\n */\n\nimport type { FlowRuntime } from \"@smthrs/flow\"\nimport { EngineEvent, JournalEvent, Redaction } from \"@smthrs/journal\"\nimport type * as Schema from \"effect/Schema\"\nimport * as JournalRecords from \"./JournalRecords.ts\"\n\n/**\n * Where the records of one run are addressed from.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface Scope {\n readonly runId: string\n /** The host's journal source, which every record of this run hangs under. */\n readonly sourceId: string\n readonly lineageId: string\n /**\n * The directory a declaration path is made relative to, when one is known.\n *\n * `undefined` means no path is recorded at all. That is the honest answer\n * for a host that cannot say where its sources live, and it is better than\n * a path a reader would have to guess the meaning of.\n */\n readonly root?: string | undefined\n /**\n * The revision the sources those declaration paths point into were read\n * at, when the host can name one.\n *\n * It lives here for the reason `root` does: a journal is read on machines\n * that did not write it, and only the writer knows which tree it loaded.\n * A path alone says where a node was declared and never which bytes were\n * at that line, so a reader without this opens no code at all rather than\n * whatever the working tree holds when they look (D-068).\n */\n readonly sourceRevision?: string | undefined\n}\n\n/**\n * A declaration path as a journal may carry it: relative to the root, or\n * nothing.\n *\n * The rule lives with the schema that refuses an absolute path\n * (`@smthrs/journal`'s `EngineEvent.DeclaredAt`), so every writer of a\n * declaration site obeys it the same way. It is named here because this is\n * the module that applies it, and because the store's own tests are written\n * against it.\n *\n * @since 0.1.0\n * @category accessors\n */\nexport const relativePath = EngineEvent.relativePath\n\n/**\n * A value the journal will serialize, typed as what it will be.\n *\n * A node's effects are JSON by construction, but an optional member spelled\n * `undefined` is not assignable to `Json` under `exactOptionalPropertyTypes`,\n * and serialization is exactly what drops it. This is the journal's own\n * encoding performed one step early, so the type says what the stored value\n * is rather than asserting it. @private\n */\nconst asJson = (value: unknown): typeof Schema.Json.Type => JSON.parse(JSON.stringify(value))\n\n/**\n * The directory declaration paths are recorded relative to.\n *\n * `process` is absent in a worker and in a browser, and a host that cannot\n * name its own working directory records no declaration path at all rather\n * than one a reader would have to guess the meaning of. `host` is the global\n * object by default and is named here so both answers are reachable without\n * taking the real one away from the runtime.\n *\n * @since 0.1.0\n * @category accessors\n */\nexport const hostRoot = (\n explicit: string | undefined,\n host: { readonly process?: { readonly cwd?: () => string } | undefined } = globalThis\n): string | undefined => {\n if (explicit !== undefined) return explicit\n return typeof host.process?.cwd === \"function\" ? host.process.cwd() : undefined\n}\n\nconst summary = (scope: Scope, node: FlowRuntime.NodeSummary) => {\n const path = node.declaredAt === undefined ? undefined : relativePath(scope.root, node.declaredAt.path)\n return {\n id: node.id,\n kind: node.kind,\n dependsOn: node.dependsOn,\n tier: node.tier,\n ...(node.action === undefined ? {} : { action: node.action }),\n ...(node.effects === undefined ? {} : { effects: asJson(node.effects) }),\n ...(path === undefined ? {} : { declaredAt: { path, line: node.declaredAt!.line } })\n }\n}\n\nconst graph = (scope: Scope, record: FlowRuntime.PlanRecorded | FlowRuntime.SubgraphAppended) => ({\n nodes: record.nodes.map((node) => summary(scope, node)),\n edges: record.edges,\n // On every page, because every page carries its own sites.\n ...(scope.sourceRevision === undefined ? {} : { sourceRevision: scope.sourceRevision })\n})\n\n/**\n * How many bytes of a node's settled value a journal row keeps.\n *\n * A node record is a small row beside the plan record's 12,000-byte page\n * budget, and it is written once per node of every graph: a value kept whole\n * would put an agent transcript in a permanent row and a projection would\n * clip it without saying so. Two kibibytes is enough to read what a node\n * produced and small enough that the settlement stays a summary.\n *\n * @since 0.1.0\n * @category constants\n */\nexport const maximumResultBytes = 2_048\n\n/**\n * How large a settled value may be before it is summarized at all.\n *\n * Redacting a value rebuilds every member of it and runs the textual rules\n * over every string, on the journal write path, for every node of every\n * graph. Past this ceiling the walk is the cost rather than the row, and the\n * honest answer is the size alone: the encoding is measured, `preview` is\n * empty, and `truncated` says the text was cut to nothing. Anything below it\n * is redacted whole and then cut.\n *\n * @since 0.1.0\n * @category constants\n */\nexport const maximumSummarizedBytes = 65_536\n\n/** The redactor a node summary is scrubbed with, built once. @private */\nconst redactor = Redaction.make({ onTooDeep: \"name\" })\n\n/** UTF-8 bytes of a string, without allocating the encoding. @private */\nconst utf8Bytes = (text: string): number => {\n let bytes = 0\n for (let index = 0; index < text.length; index++) {\n const code = text.charCodeAt(index)\n if (code < 0x80) bytes += 1\n else if (code < 0x800) bytes += 2\n else if (code >= 0xd800 && code <= 0xdbff && index + 1 < text.length) {\n bytes += 4\n index++\n } else bytes += 3\n }\n return bytes\n}\n\n/**\n * The longest prefix of `text` within `limit` UTF-8 bytes, never splitting a\n * pair.\n *\n * One cut, taken where the walk stopped, because the walk stops for two\n * reasons and only one of them can happen: the caller asks only for text it\n * has already measured as over the limit, so a second exit for text that fits\n * whole would be a line no run reaches. @private\n */\nconst clampToBytes = (text: string, limit: number): string => {\n let bytes = 0\n let index = 0\n while (index < text.length) {\n const code = text.charCodeAt(index)\n const pair = code >= 0xd800 && code <= 0xdbff && index + 1 < text.length\n const size = code < 0x80 ? 1 : code < 0x800 ? 2 : pair ? 4 : 3\n if (bytes + size > limit) break\n bytes += size\n index += pair ? 2 : 1\n }\n return text.slice(0, index)\n}\n\n/**\n * What a node settled with, redacted and then bounded.\n *\n * REDACTION COMES FIRST. `Redaction.redact` is the journal's own write-path\n * scrubber, and it is the one that reads a field NAME: `{ apiKey: \"sk-...\" }`\n * is a credential because of the key, which no rule over encoded text can see\n * once the value is a string inside a larger string. Running it over the\n * decoded value also collapses cycles and names functions, so the encoding\n * that follows always succeeds. Cutting the text first would be worse than\n * useless: a credential split across the boundary is a credential the textual\n * rules no longer recognise, and half of it would be kept.\n *\n * A value that will not encode even after redaction — a bigint, a value whose\n * own `toJSON` throws — gets no summary at all rather than a fabricated one.\n *\n * `bytes` is the size of the encoding `preview` was cut from, which for a\n * value past {@link maximumSummarizedBytes} is the value's own encoding: that\n * branch keeps nothing, so there is no second number to disagree with.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const resultSummary = (value: unknown): {\n readonly preview: string\n readonly bytes: number\n readonly truncated: boolean\n} | undefined => {\n // The size first, from the value's own encoding, because it is the cheap\n // half: a value this row will not keep is named by its size and never\n // walked. A value that will not encode at all — a cycle, a bigint, a\n // throwing `toJSON` — says nothing here, and the redactor below is asked,\n // because it collapses cycles and names what it cannot rewrite.\n let raw: string | undefined\n try {\n raw = JSON.stringify(value)\n } catch {\n raw = undefined\n }\n if (raw !== undefined) {\n const rawBytes = utf8Bytes(raw)\n if (rawBytes > maximumSummarizedBytes) return { preview: \"\", bytes: rawBytes, truncated: true }\n }\n let encoded: string | undefined\n try {\n encoded = JSON.stringify(redactor(value))\n } catch {\n return undefined\n }\n if (encoded === undefined) return undefined\n const bytes = utf8Bytes(encoded)\n if (bytes > maximumSummarizedBytes) return { preview: \"\", bytes, truncated: true }\n if (bytes <= maximumResultBytes) return { preview: encoded, bytes, truncated: false }\n return { preview: clampToBytes(encoded, maximumResultBytes), bytes, truncated: true }\n}\n\n/**\n * The journal entry one node record is written as.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const entry = (scope: Scope, record: FlowRuntime.NodeRecord): JournalEvent.Input => {\n const options = {\n runId: scope.runId,\n sourceId: `${scope.sourceId}/${record.sourceId}`,\n lineageId: scope.lineageId,\n // Without an explicit sequence the journal ALLOCATES the next one for the\n // source, so a resumed walk would write a second row for every node it\n // re-derived. Pinning it to zero makes the re-emission an exact producer\n // retry, which is the whole of the exactly-once contract.\n sourceSeq: 0,\n // The sequence is derived from the record's own identity, so a collision\n // is the same node observed twice rather than two nodes wearing one\n // address. What differs between the observations is metadata ABOUT the\n // observation — a node the first walk BUILT settles CLEAN on the walk\n // that replayed it — and the first row, the one that says what actually\n // happened, stands.\n dedupe: \"identity\" as const\n }\n switch (record._tag) {\n case \"PlanRecorded\":\n return JournalRecords.planRecorded(options, {\n flow: record.flow,\n generation: record.generation,\n // The node COUNT of the whole graph, which is what this field has\n // always meant; the node LIST rides beside it as `graph`.\n nodes: record.nodeCount,\n page: record.page,\n pages: record.pages,\n graph: graph(scope, record)\n })\n case \"SubgraphAppended\":\n return JournalRecords.subgraphAppended(options, {\n flow: record.flow,\n generation: record.generation,\n nodeIds: record.nodes.map((node) => node.id),\n page: record.page,\n pages: record.pages,\n graph: graph(scope, record)\n })\n case \"NodeScheduled\":\n return JournalRecords.nodeScheduled(options, {\n nodeId: record.nodeId,\n kind: record.kind,\n attempt: record.attempt,\n ...(record.action === undefined ? {} : { action: record.action })\n })\n case \"NodeSettled\": {\n const result = record.value === undefined ? undefined : resultSummary(record.value)\n return JournalRecords.nodeSettled(options, {\n nodeId: record.nodeId,\n outcome: record.outcome,\n attempts: record.attempts,\n stepKeyDigests: record.stepKeyDigests,\n ...(record.action === undefined ? {} : { action: record.action }),\n ...(result === undefined ? {} : { result })\n })\n }\n }\n}\n\n/**\n * UTF-8 upper bound for the durable entry, including allocated envelope fields.\n *\n * Sequence/time reserve their largest JSON encodings so page boundaries never\n * depend on the current journal position or clock, including after a resume.\n * @since 1.0.0\n * @category accessors\n */\nexport const encodedBytes = (scope: Scope, record: FlowRuntime.NodeRecord): number => {\n const input = entry(scope, record)\n const sourceSeq = JournalEvent.SourceSeq.make(0)\n return new TextEncoder().encode(JSON.stringify({\n runId: input.runId,\n seq: Number.MAX_SAFE_INTEGER - 1,\n eventId: JournalEvent.makeEventId(input.runId, input.sourceId, sourceSeq),\n sourceId: input.sourceId,\n sourceSeq,\n emittedAtMs: Number.MAX_VALUE,\n eventType: input.eventType,\n payload: redactor(input.payload),\n meta: redactor(input.meta)\n })).byteLength\n}\n"]}
|
|
@@ -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
|
+
* Compares two strings by JavaScript's locale-independent UTF-16 relational
|
|
8
|
+
* order.
|
|
9
|
+
*
|
|
10
|
+
* @category ordering
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export declare const compareText: (left: string, right: string) => number;
|
|
14
|
+
//# sourceMappingURL=Ordering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ordering.d.ts","sourceRoot":"","sources":["../../../src/internal/Ordering.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAkD,CAAA"}
|
|
@@ -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
|
+
* Compares two strings by JavaScript's locale-independent UTF-16 relational
|
|
8
|
+
* order.
|
|
9
|
+
*
|
|
10
|
+
* @category ordering
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
14
|
+
//# sourceMappingURL=Ordering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ordering.js","sourceRoot":"","sources":["../../../src/internal/Ordering.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Host-locale-independent UTF-16 code-unit ordering for durable material.\n *\n * @since 1.0.0\n */\n\n/**\n * Compares two strings by JavaScript's locale-independent UTF-16 relational\n * order.\n *\n * @category ordering\n * @since 1.0.0\n */\nexport const compareText = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-check stored or newly measured observations against a verified plan.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
import { FileSet, type Plan } from "@smthrs/plan";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import * as PlanInputStore from "../PlanInputStore.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Validates without publishing or mutating either the old pins or observations.
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category validation
|
|
12
|
+
*/
|
|
13
|
+
export declare const validate: (snapshot: PlanInputStore.Snapshot, nodes: ReadonlyArray<Plan.PlanNode>, pinned: ReadonlyMap<string, string>, writerScopesBefore: (node: Plan.PlanNode) => ReadonlyArray<FileSet.Entry>) => Effect.Effect<Map<string, string>, PlanInputStore.PlanInputError>;
|
|
14
|
+
//# sourceMappingURL=PlanInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanInputs.d.ts","sourceRoot":"","sources":["../../../src/internal/PlanInputs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,cAAc,CAAC,QAAQ,EACjC,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EACnC,QAAQ,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,KAAK,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KACxE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,cAAc,CA0C/D,CAAA"}
|