@smthrs/flow 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 +160 -0
- package/LICENSE +21 -0
- package/README.md +210 -2
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/cjs/Action/Action.d.ts +250 -0
- package/dist/cjs/Action/Action.d.ts.map +1 -0
- package/dist/cjs/Action/Action.js +42 -0
- package/dist/cjs/Action/Action.js.map +7 -0
- package/dist/cjs/Action/AttemptTimedOut.d.ts +33 -0
- package/dist/cjs/Action/AttemptTimedOut.d.ts.map +1 -0
- package/dist/cjs/Action/AttemptTimedOut.js +51 -0
- package/dist/cjs/Action/AttemptTimedOut.js.map +7 -0
- package/dist/cjs/Action/BoundaryMode.d.ts +29 -0
- package/dist/cjs/Action/BoundaryMode.d.ts.map +1 -0
- package/dist/cjs/Action/BoundaryMode.js +36 -0
- package/dist/cjs/Action/BoundaryMode.js.map +7 -0
- package/dist/cjs/Action/CacheEnvironment.d.ts +158 -0
- package/dist/cjs/Action/CacheEnvironment.d.ts.map +1 -0
- package/dist/cjs/Action/CacheEnvironment.js +57 -0
- package/dist/cjs/Action/CacheEnvironment.js.map +7 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.d.ts +34 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.d.ts.map +1 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.js +46 -0
- package/dist/cjs/Action/ConcurrentKeylessDispatch.js.map +7 -0
- package/dist/cjs/Action/Context.d.ts +131 -0
- package/dist/cjs/Action/Context.d.ts.map +1 -0
- package/dist/cjs/Action/Context.js +68 -0
- package/dist/cjs/Action/Context.js.map +7 -0
- package/dist/cjs/Action/DuplicateImplementation.d.ts +20 -0
- package/dist/cjs/Action/DuplicateImplementation.d.ts.map +1 -0
- package/dist/cjs/Action/DuplicateImplementation.js +46 -0
- package/dist/cjs/Action/DuplicateImplementation.js.map +7 -0
- package/dist/cjs/Action/FileBoundary.d.ts +59 -0
- package/dist/cjs/Action/FileBoundary.d.ts.map +1 -0
- package/dist/cjs/Action/FileBoundary.js +81 -0
- package/dist/cjs/Action/FileBoundary.js.map +7 -0
- package/dist/cjs/Action/FileInput.d.ts +28 -0
- package/dist/cjs/Action/FileInput.d.ts.map +1 -0
- package/dist/cjs/Action/FileInput.js +42 -0
- package/dist/cjs/Action/FileInput.js.map +7 -0
- package/dist/cjs/Action/Filegroup.d.ts +16 -0
- package/dist/cjs/Action/Filegroup.d.ts.map +1 -0
- package/dist/cjs/Action/Filegroup.js +27 -0
- package/dist/cjs/Action/Filegroup.js.map +7 -0
- package/dist/cjs/Action/Glob.d.ts +8 -0
- package/dist/cjs/Action/Glob.d.ts.map +1 -0
- package/dist/cjs/Action/Glob.js +28 -0
- package/dist/cjs/Action/Glob.js.map +7 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.d.ts +26 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.d.ts.map +1 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.js +45 -0
- package/dist/cjs/Action/ImplementationVersionMismatch.js.map +7 -0
- package/dist/cjs/Action/Implementations.d.ts +114 -0
- package/dist/cjs/Action/Implementations.d.ts.map +1 -0
- package/dist/cjs/Action/Implementations.js +65 -0
- package/dist/cjs/Action/Implementations.js.map +7 -0
- package/dist/cjs/Action/InfraInterrupt.d.ts +26 -0
- package/dist/cjs/Action/InfraInterrupt.d.ts.map +1 -0
- package/dist/cjs/Action/InfraInterrupt.js +46 -0
- package/dist/cjs/Action/InfraInterrupt.js.map +7 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.d.ts +33 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.d.ts.map +1 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.js +54 -0
- package/dist/cjs/Action/InfraInterruptRetriesExhausted.js.map +7 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts +26 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.js +47 -0
- package/dist/cjs/Action/IrreversibleRetryRequiresIdempotencyKey.js.map +7 -0
- package/dist/cjs/Action/StepIdentity.d.ts +153 -0
- package/dist/cjs/Action/StepIdentity.d.ts.map +1 -0
- package/dist/cjs/Action/StepIdentity.js +75 -0
- package/dist/cjs/Action/StepIdentity.js.map +7 -0
- package/dist/cjs/Action/TreeArtifact.d.ts +8 -0
- package/dist/cjs/Action/TreeArtifact.d.ts.map +1 -0
- package/dist/cjs/Action/TreeArtifact.js +25 -0
- package/dist/cjs/Action/TreeArtifact.js.map +7 -0
- package/dist/cjs/Action/TypeId.d.ts +8 -0
- package/dist/cjs/Action/TypeId.d.ts.map +1 -0
- package/dist/cjs/Action/TypeId.js +25 -0
- package/dist/cjs/Action/TypeId.js.map +7 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.d.ts +32 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.js +51 -0
- package/dist/cjs/Action/UncanonicalIdempotencyKey.js.map +7 -0
- package/dist/cjs/Action/idempotencyKey.d.ts +21 -0
- package/dist/cjs/Action/idempotencyKey.d.ts.map +1 -0
- package/dist/cjs/Action/idempotencyKey.js +59 -0
- package/dist/cjs/Action/idempotencyKey.js.map +7 -0
- package/dist/cjs/Action/index.d.ts +29 -0
- package/dist/cjs/Action/index.d.ts.map +1 -0
- package/dist/cjs/Action/index.js +60 -0
- package/dist/cjs/Action/index.js.map +7 -0
- package/dist/cjs/Action/make.d.ts +128 -0
- package/dist/cjs/Action/make.d.ts.map +1 -0
- package/dist/cjs/Action/make.js +373 -0
- package/dist/cjs/Action/make.js.map +7 -0
- package/dist/cjs/Action/raceAll.d.ts +21 -0
- package/dist/cjs/Action/raceAll.d.ts.map +1 -0
- package/dist/cjs/Action/raceAll.js +46 -0
- package/dist/cjs/Action/raceAll.js.map +7 -0
- package/dist/cjs/Action/retry.d.ts +19 -0
- package/dist/cjs/Action/retry.d.ts.map +1 -0
- package/dist/cjs/Action/retry.js +75 -0
- package/dist/cjs/Action/retry.js.map +7 -0
- package/dist/cjs/Deadline.d.ts +105 -0
- package/dist/cjs/Deadline.d.ts.map +1 -0
- package/dist/cjs/Deadline.js +104 -0
- package/dist/cjs/Deadline.js.map +7 -0
- package/dist/cjs/DurableClock.d.ts +61 -0
- package/dist/cjs/DurableClock.d.ts.map +1 -0
- package/dist/cjs/DurableClock.js +90 -0
- package/dist/cjs/DurableClock.js.map +7 -0
- package/dist/cjs/DurableDeferred.d.ts +311 -0
- package/dist/cjs/DurableDeferred.d.ts.map +1 -0
- package/dist/cjs/DurableDeferred.js +322 -0
- package/dist/cjs/DurableDeferred.js.map +7 -0
- package/dist/cjs/DurableQueue.d.ts +160 -0
- package/dist/cjs/DurableQueue.d.ts.map +1 -0
- package/dist/cjs/DurableQueue.js +229 -0
- package/dist/cjs/DurableQueue.js.map +7 -0
- package/dist/cjs/ExternalJob.d.ts +179 -0
- package/dist/cjs/ExternalJob.d.ts.map +1 -0
- package/dist/cjs/ExternalJob.js +338 -0
- package/dist/cjs/ExternalJob.js.map +7 -0
- package/dist/cjs/Fault.d.ts +131 -0
- package/dist/cjs/Fault.d.ts.map +1 -0
- package/dist/cjs/Fault.js +157 -0
- package/dist/cjs/Fault.js.map +7 -0
- package/dist/cjs/Flow/Annotations.d.ts +245 -0
- package/dist/cjs/Flow/Annotations.d.ts.map +1 -0
- package/dist/cjs/Flow/Annotations.js +72 -0
- package/dist/cjs/Flow/Annotations.js.map +7 -0
- package/dist/cjs/Flow/CapabilityCeiling.d.ts +21 -0
- package/dist/cjs/Flow/CapabilityCeiling.d.ts.map +1 -0
- package/dist/cjs/Flow/CapabilityCeiling.js +49 -0
- package/dist/cjs/Flow/CapabilityCeiling.js.map +7 -0
- package/dist/cjs/Flow/DeadlineExceeded.d.ts +33 -0
- package/dist/cjs/Flow/DeadlineExceeded.d.ts.map +1 -0
- package/dist/cjs/Flow/DeadlineExceeded.js +52 -0
- package/dist/cjs/Flow/DeadlineExceeded.js.map +7 -0
- package/dist/cjs/Flow/ExecutionIdRequired.d.ts +25 -0
- package/dist/cjs/Flow/ExecutionIdRequired.d.ts.map +1 -0
- package/dist/cjs/Flow/ExecutionIdRequired.js +46 -0
- package/dist/cjs/Flow/ExecutionIdRequired.js.map +7 -0
- package/dist/cjs/Flow/ExecutionIds.d.ts +80 -0
- package/dist/cjs/Flow/ExecutionIds.d.ts.map +1 -0
- package/dist/cjs/Flow/ExecutionIds.js +66 -0
- package/dist/cjs/Flow/ExecutionIds.js.map +7 -0
- package/dist/cjs/Flow/Flow.d.ts +422 -0
- package/dist/cjs/Flow/Flow.d.ts.map +1 -0
- package/dist/cjs/Flow/Flow.js +17 -0
- package/dist/cjs/Flow/Flow.js.map +7 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.d.ts +35 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.d.ts.map +1 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.js +50 -0
- package/dist/cjs/Flow/MaxRoundsExceeded.js.map +7 -0
- package/dist/cjs/Flow/Outcome.d.ts +162 -0
- package/dist/cjs/Flow/Outcome.d.ts.map +1 -0
- package/dist/cjs/Flow/Outcome.js +80 -0
- package/dist/cjs/Flow/Outcome.js.map +7 -0
- package/dist/cjs/Flow/Result.d.ts +186 -0
- package/dist/cjs/Flow/Result.d.ts.map +1 -0
- package/dist/cjs/Flow/Result.js +159 -0
- package/dist/cjs/Flow/Result.js.map +7 -0
- package/dist/cjs/Flow/Runtime.d.ts +98 -0
- package/dist/cjs/Flow/Runtime.d.ts.map +1 -0
- package/dist/cjs/Flow/Runtime.js +160 -0
- package/dist/cjs/Flow/Runtime.js.map +7 -0
- package/dist/cjs/Flow/TypeId.d.ts +8 -0
- package/dist/cjs/Flow/TypeId.d.ts.map +1 -0
- package/dist/cjs/Flow/TypeId.js +25 -0
- package/dist/cjs/Flow/TypeId.js.map +7 -0
- package/dist/cjs/Flow/index.d.ts +17 -0
- package/dist/cjs/Flow/index.d.ts.map +1 -0
- package/dist/cjs/Flow/index.js +29 -0
- package/dist/cjs/Flow/index.js.map +7 -0
- package/dist/cjs/Flow/internal.d.ts +34 -0
- package/dist/cjs/Flow/internal.d.ts.map +1 -0
- package/dist/cjs/Flow/internal.js +187 -0
- package/dist/cjs/Flow/internal.js.map +7 -0
- package/dist/cjs/Flow/make.d.ts +134 -0
- package/dist/cjs/Flow/make.d.ts.map +1 -0
- package/dist/cjs/Flow/make.js +104 -0
- package/dist/cjs/Flow/make.js.map +7 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.d.ts +55 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.js +51 -0
- package/dist/cjs/FlowRuntime/CancelRequestFailed.js.map +7 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.d.ts +23 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.js +55 -0
- package/dist/cjs/FlowRuntime/ExecutionIdentityConflict.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.d.ts +28 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.js +49 -0
- package/dist/cjs/FlowRuntime/FlowCycleDetected.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.d.ts +38 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.js +53 -0
- package/dist/cjs/FlowRuntime/FlowExecutionNotFound.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowInstance.d.ts +115 -0
- package/dist/cjs/FlowRuntime/FlowInstance.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowInstance.js +37 -0
- package/dist/cjs/FlowRuntime/FlowInstance.js.map +7 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.d.ts +198 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.js +37 -0
- package/dist/cjs/FlowRuntime/FlowRuntime.js.map +7 -0
- package/dist/cjs/FlowRuntime/NodeRecord.d.ts +175 -0
- package/dist/cjs/FlowRuntime/NodeRecord.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/NodeRecord.js +17 -0
- package/dist/cjs/FlowRuntime/NodeRecord.js.map +7 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.d.ts +69 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.js +53 -0
- package/dist/cjs/FlowRuntime/WaitingAnnotation.js.map +7 -0
- package/dist/cjs/FlowRuntime/index.d.ts +14 -0
- package/dist/cjs/FlowRuntime/index.d.ts.map +1 -0
- package/dist/cjs/FlowRuntime/index.js +26 -0
- package/dist/cjs/FlowRuntime/index.js.map +7 -0
- package/dist/cjs/Graph.d.ts +325 -0
- package/dist/cjs/Graph.d.ts.map +1 -0
- package/dist/cjs/Graph.js +1021 -0
- package/dist/cjs/Graph.js.map +7 -0
- package/dist/cjs/HumanTask.d.ts +440 -0
- package/dist/cjs/HumanTask.d.ts.map +1 -0
- package/dist/cjs/HumanTask.js +413 -0
- package/dist/cjs/HumanTask.js.map +7 -0
- package/dist/cjs/Interpreter.d.ts +222 -0
- package/dist/cjs/Interpreter.d.ts.map +1 -0
- package/dist/cjs/Interpreter.js +888 -0
- package/dist/cjs/Interpreter.js.map +7 -0
- package/dist/cjs/Poll.d.ts +238 -0
- package/dist/cjs/Poll.d.ts.map +1 -0
- package/dist/cjs/Poll.js +150 -0
- package/dist/cjs/Poll.js.map +7 -0
- package/dist/cjs/RetryPolicy.d.ts +273 -0
- package/dist/cjs/RetryPolicy.d.ts.map +1 -0
- package/dist/cjs/RetryPolicy.js +251 -0
- package/dist/cjs/RetryPolicy.js.map +7 -0
- package/dist/cjs/Sleep.d.ts +98 -0
- package/dist/cjs/Sleep.d.ts.map +1 -0
- package/dist/cjs/Sleep.js +133 -0
- package/dist/cjs/Sleep.js.map +7 -0
- package/dist/cjs/Stall.d.ts +173 -0
- package/dist/cjs/Stall.d.ts.map +1 -0
- package/dist/cjs/Stall.js +92 -0
- package/dist/cjs/Stall.js.map +7 -0
- package/dist/cjs/WaitFor.d.ts +109 -0
- package/dist/cjs/WaitFor.d.ts.map +1 -0
- package/dist/cjs/WaitFor.js +117 -0
- package/dist/cjs/WaitFor.js.map +7 -0
- package/dist/cjs/index.d.ts +107 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +69 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/BoundedJson.d.ts +48 -0
- package/dist/cjs/internal/BoundedJson.d.ts.map +1 -0
- package/dist/cjs/internal/BoundedJson.js +96 -0
- package/dist/cjs/internal/BoundedJson.js.map +7 -0
- package/dist/cjs/internal/DeclarationSite.d.ts +135 -0
- package/dist/cjs/internal/DeclarationSite.d.ts.map +1 -0
- package/dist/cjs/internal/DeclarationSite.js +89 -0
- package/dist/cjs/internal/DeclarationSite.js.map +7 -0
- package/dist/cjs/internal/Declarations.d.ts +35 -0
- package/dist/cjs/internal/Declarations.d.ts.map +1 -0
- package/dist/cjs/internal/Declarations.js +50 -0
- package/dist/cjs/internal/Declarations.js.map +7 -0
- package/dist/cjs/internal/ExecutionMiddleware.d.ts +21 -0
- package/dist/cjs/internal/ExecutionMiddleware.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionMiddleware.js +39 -0
- package/dist/cjs/internal/ExecutionMiddleware.js.map +7 -0
- package/dist/cjs/internal/JsonSchemaSubset.d.ts +133 -0
- package/dist/cjs/internal/JsonSchemaSubset.d.ts.map +1 -0
- package/dist/cjs/internal/JsonSchemaSubset.js +229 -0
- package/dist/cjs/internal/JsonSchemaSubset.js.map +7 -0
- package/dist/cjs/internal/OutcomeMarker.d.ts +18 -0
- package/dist/cjs/internal/OutcomeMarker.d.ts.map +1 -0
- package/dist/cjs/internal/OutcomeMarker.js +27 -0
- package/dist/cjs/internal/OutcomeMarker.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/Action/Action.d.ts +250 -0
- package/dist/esm/Action/Action.d.ts.map +1 -0
- package/dist/esm/Action/Action.js +30 -0
- package/dist/esm/Action/Action.js.map +1 -0
- package/dist/esm/Action/AttemptTimedOut.d.ts +33 -0
- package/dist/esm/Action/AttemptTimedOut.d.ts.map +1 -0
- package/dist/esm/Action/AttemptTimedOut.js +32 -0
- package/dist/esm/Action/AttemptTimedOut.js.map +1 -0
- package/dist/esm/Action/BoundaryMode.d.ts +29 -0
- package/dist/esm/Action/BoundaryMode.d.ts.map +1 -0
- package/dist/esm/Action/BoundaryMode.js +23 -0
- package/dist/esm/Action/BoundaryMode.js.map +1 -0
- package/dist/esm/Action/CacheEnvironment.d.ts +158 -0
- package/dist/esm/Action/CacheEnvironment.d.ts.map +1 -0
- package/dist/esm/Action/CacheEnvironment.js +130 -0
- package/dist/esm/Action/CacheEnvironment.js.map +1 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.d.ts +34 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.d.ts.map +1 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.js +33 -0
- package/dist/esm/Action/ConcurrentKeylessDispatch.js.map +1 -0
- package/dist/esm/Action/Context.d.ts +131 -0
- package/dist/esm/Action/Context.d.ts.map +1 -0
- package/dist/esm/Action/Context.js +99 -0
- package/dist/esm/Action/Context.js.map +1 -0
- package/dist/esm/Action/DuplicateImplementation.d.ts +20 -0
- package/dist/esm/Action/DuplicateImplementation.d.ts.map +1 -0
- package/dist/esm/Action/DuplicateImplementation.js +20 -0
- package/dist/esm/Action/DuplicateImplementation.js.map +1 -0
- package/dist/esm/Action/FileBoundary.d.ts +59 -0
- package/dist/esm/Action/FileBoundary.d.ts.map +1 -0
- package/dist/esm/Action/FileBoundary.js +60 -0
- package/dist/esm/Action/FileBoundary.js.map +1 -0
- package/dist/esm/Action/FileInput.d.ts +28 -0
- package/dist/esm/Action/FileInput.d.ts.map +1 -0
- package/dist/esm/Action/FileInput.js +32 -0
- package/dist/esm/Action/FileInput.js.map +1 -0
- package/dist/esm/Action/Filegroup.d.ts +16 -0
- package/dist/esm/Action/Filegroup.d.ts.map +1 -0
- package/dist/esm/Action/Filegroup.js +15 -0
- package/dist/esm/Action/Filegroup.js.map +1 -0
- package/dist/esm/Action/Glob.d.ts +8 -0
- package/dist/esm/Action/Glob.d.ts.map +1 -0
- package/dist/esm/Action/Glob.js +7 -0
- package/dist/esm/Action/Glob.js.map +1 -0
- package/dist/esm/Action/ImplementationVersionMismatch.d.ts +26 -0
- package/dist/esm/Action/ImplementationVersionMismatch.d.ts.map +1 -0
- package/dist/esm/Action/ImplementationVersionMismatch.js +24 -0
- package/dist/esm/Action/ImplementationVersionMismatch.js.map +1 -0
- package/dist/esm/Action/Implementations.d.ts +114 -0
- package/dist/esm/Action/Implementations.d.ts.map +1 -0
- package/dist/esm/Action/Implementations.js +94 -0
- package/dist/esm/Action/Implementations.js.map +1 -0
- package/dist/esm/Action/InfraInterrupt.d.ts +26 -0
- package/dist/esm/Action/InfraInterrupt.d.ts.map +1 -0
- package/dist/esm/Action/InfraInterrupt.js +25 -0
- package/dist/esm/Action/InfraInterrupt.js.map +1 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.d.ts +33 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.d.ts.map +1 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.js +32 -0
- package/dist/esm/Action/InfraInterruptRetriesExhausted.js.map +1 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts +26 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.js +25 -0
- package/dist/esm/Action/IrreversibleRetryRequiresIdempotencyKey.js.map +1 -0
- package/dist/esm/Action/StepIdentity.d.ts +153 -0
- package/dist/esm/Action/StepIdentity.d.ts.map +1 -0
- package/dist/esm/Action/StepIdentity.js +139 -0
- package/dist/esm/Action/StepIdentity.js.map +1 -0
- package/dist/esm/Action/TreeArtifact.d.ts +8 -0
- package/dist/esm/Action/TreeArtifact.d.ts.map +1 -0
- package/dist/esm/Action/TreeArtifact.js +7 -0
- package/dist/esm/Action/TreeArtifact.js.map +1 -0
- package/dist/esm/Action/TypeId.d.ts +8 -0
- package/dist/esm/Action/TypeId.d.ts.map +1 -0
- package/dist/esm/Action/TypeId.js +9 -0
- package/dist/esm/Action/TypeId.js.map +1 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.d.ts +32 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.js +31 -0
- package/dist/esm/Action/UncanonicalIdempotencyKey.js.map +1 -0
- package/dist/esm/Action/idempotencyKey.d.ts +21 -0
- package/dist/esm/Action/idempotencyKey.d.ts.map +1 -0
- package/dist/esm/Action/idempotencyKey.js +50 -0
- package/dist/esm/Action/idempotencyKey.js.map +1 -0
- package/dist/esm/Action/index.d.ts +29 -0
- package/dist/esm/Action/index.d.ts.map +1 -0
- package/dist/esm/Action/index.js +30 -0
- package/dist/esm/Action/index.js.map +1 -0
- package/dist/esm/Action/make.d.ts +128 -0
- package/dist/esm/Action/make.d.ts.map +1 -0
- package/dist/esm/Action/make.js +405 -0
- package/dist/esm/Action/make.js.map +1 -0
- package/dist/esm/Action/raceAll.d.ts +21 -0
- package/dist/esm/Action/raceAll.d.ts.map +1 -0
- package/dist/esm/Action/raceAll.js +20 -0
- package/dist/esm/Action/raceAll.js.map +1 -0
- package/dist/esm/Action/retry.d.ts +19 -0
- package/dist/esm/Action/retry.d.ts.map +1 -0
- package/dist/esm/Action/retry.js +72 -0
- package/dist/esm/Action/retry.js.map +1 -0
- package/dist/esm/Deadline.d.ts +105 -0
- package/dist/esm/Deadline.d.ts.map +1 -0
- package/dist/esm/Deadline.js +152 -0
- package/dist/esm/Deadline.js.map +1 -0
- package/dist/esm/DurableClock.d.ts +61 -0
- package/dist/esm/DurableClock.d.ts.map +1 -0
- package/dist/esm/DurableClock.js +75 -0
- package/dist/esm/DurableClock.js.map +1 -0
- package/dist/esm/DurableDeferred.d.ts +311 -0
- package/dist/esm/DurableDeferred.d.ts.map +1 -0
- package/dist/esm/DurableDeferred.js +357 -0
- package/dist/esm/DurableDeferred.js.map +1 -0
- package/dist/esm/DurableQueue.d.ts +160 -0
- package/dist/esm/DurableQueue.d.ts.map +1 -0
- package/dist/esm/DurableQueue.js +303 -0
- package/dist/esm/DurableQueue.js.map +1 -0
- package/dist/esm/ExternalJob.d.ts +179 -0
- package/dist/esm/ExternalJob.d.ts.map +1 -0
- package/dist/esm/ExternalJob.js +296 -0
- package/dist/esm/ExternalJob.js.map +1 -0
- package/dist/esm/Fault.d.ts +131 -0
- package/dist/esm/Fault.d.ts.map +1 -0
- package/dist/esm/Fault.js +198 -0
- package/dist/esm/Fault.js.map +1 -0
- package/dist/esm/Flow/Annotations.d.ts +245 -0
- package/dist/esm/Flow/Annotations.d.ts.map +1 -0
- package/dist/esm/Flow/Annotations.js +110 -0
- package/dist/esm/Flow/Annotations.js.map +1 -0
- package/dist/esm/Flow/CapabilityCeiling.d.ts +21 -0
- package/dist/esm/Flow/CapabilityCeiling.d.ts.map +1 -0
- package/dist/esm/Flow/CapabilityCeiling.js +27 -0
- package/dist/esm/Flow/CapabilityCeiling.js.map +1 -0
- package/dist/esm/Flow/DeadlineExceeded.d.ts +33 -0
- package/dist/esm/Flow/DeadlineExceeded.d.ts.map +1 -0
- package/dist/esm/Flow/DeadlineExceeded.js +34 -0
- package/dist/esm/Flow/DeadlineExceeded.js.map +1 -0
- package/dist/esm/Flow/ExecutionIdRequired.d.ts +25 -0
- package/dist/esm/Flow/ExecutionIdRequired.d.ts.map +1 -0
- package/dist/esm/Flow/ExecutionIdRequired.js +30 -0
- package/dist/esm/Flow/ExecutionIdRequired.js.map +1 -0
- package/dist/esm/Flow/ExecutionIds.d.ts +80 -0
- package/dist/esm/Flow/ExecutionIds.d.ts.map +1 -0
- package/dist/esm/Flow/ExecutionIds.js +91 -0
- package/dist/esm/Flow/ExecutionIds.js.map +1 -0
- package/dist/esm/Flow/Flow.d.ts +422 -0
- package/dist/esm/Flow/Flow.d.ts.map +1 -0
- package/dist/esm/Flow/Flow.js +3 -0
- package/dist/esm/Flow/Flow.js.map +1 -0
- package/dist/esm/Flow/MaxRoundsExceeded.d.ts +35 -0
- package/dist/esm/Flow/MaxRoundsExceeded.d.ts.map +1 -0
- package/dist/esm/Flow/MaxRoundsExceeded.js +34 -0
- package/dist/esm/Flow/MaxRoundsExceeded.js.map +1 -0
- package/dist/esm/Flow/Outcome.d.ts +162 -0
- package/dist/esm/Flow/Outcome.d.ts.map +1 -0
- package/dist/esm/Flow/Outcome.js +115 -0
- package/dist/esm/Flow/Outcome.js.map +1 -0
- package/dist/esm/Flow/Result.d.ts +186 -0
- package/dist/esm/Flow/Result.d.ts.map +1 -0
- package/dist/esm/Flow/Result.js +171 -0
- package/dist/esm/Flow/Result.js.map +1 -0
- package/dist/esm/Flow/Runtime.d.ts +98 -0
- package/dist/esm/Flow/Runtime.d.ts.map +1 -0
- package/dist/esm/Flow/Runtime.js +231 -0
- package/dist/esm/Flow/Runtime.js.map +1 -0
- package/dist/esm/Flow/TypeId.d.ts +8 -0
- package/dist/esm/Flow/TypeId.d.ts.map +1 -0
- package/dist/esm/Flow/TypeId.js +9 -0
- package/dist/esm/Flow/TypeId.js.map +1 -0
- package/dist/esm/Flow/index.d.ts +17 -0
- package/dist/esm/Flow/index.d.ts.map +1 -0
- package/dist/esm/Flow/index.js +18 -0
- package/dist/esm/Flow/index.js.map +1 -0
- package/dist/esm/Flow/internal.d.ts +34 -0
- package/dist/esm/Flow/internal.d.ts.map +1 -0
- package/dist/esm/Flow/internal.js +149 -0
- package/dist/esm/Flow/internal.js.map +1 -0
- package/dist/esm/Flow/make.d.ts +134 -0
- package/dist/esm/Flow/make.d.ts.map +1 -0
- package/dist/esm/Flow/make.js +106 -0
- package/dist/esm/Flow/make.js.map +1 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.d.ts +55 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.js +53 -0
- package/dist/esm/FlowRuntime/CancelRequestFailed.js.map +1 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.d.ts +23 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.js +24 -0
- package/dist/esm/FlowRuntime/ExecutionIdentityConflict.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.d.ts +28 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.js +35 -0
- package/dist/esm/FlowRuntime/FlowCycleDetected.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.d.ts +38 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.js +40 -0
- package/dist/esm/FlowRuntime/FlowExecutionNotFound.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowInstance.d.ts +115 -0
- package/dist/esm/FlowRuntime/FlowInstance.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowInstance.js +24 -0
- package/dist/esm/FlowRuntime/FlowInstance.js.map +1 -0
- package/dist/esm/FlowRuntime/FlowRuntime.d.ts +198 -0
- package/dist/esm/FlowRuntime/FlowRuntime.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/FlowRuntime.js +34 -0
- package/dist/esm/FlowRuntime/FlowRuntime.js.map +1 -0
- package/dist/esm/FlowRuntime/NodeRecord.d.ts +175 -0
- package/dist/esm/FlowRuntime/NodeRecord.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/NodeRecord.js +21 -0
- package/dist/esm/FlowRuntime/NodeRecord.js.map +1 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.d.ts +69 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.js +53 -0
- package/dist/esm/FlowRuntime/WaitingAnnotation.js.map +1 -0
- package/dist/esm/FlowRuntime/index.d.ts +14 -0
- package/dist/esm/FlowRuntime/index.d.ts.map +1 -0
- package/dist/esm/FlowRuntime/index.js +15 -0
- package/dist/esm/FlowRuntime/index.js.map +1 -0
- package/dist/esm/Graph.d.ts +325 -0
- package/dist/esm/Graph.d.ts.map +1 -0
- package/dist/esm/Graph.js +1483 -0
- package/dist/esm/Graph.js.map +1 -0
- package/dist/esm/HumanTask.d.ts +440 -0
- package/dist/esm/HumanTask.d.ts.map +1 -0
- package/dist/esm/HumanTask.js +794 -0
- package/dist/esm/HumanTask.js.map +1 -0
- package/dist/esm/Interpreter.d.ts +222 -0
- package/dist/esm/Interpreter.d.ts.map +1 -0
- package/dist/esm/Interpreter.js +1269 -0
- package/dist/esm/Interpreter.js.map +1 -0
- package/dist/esm/Poll.d.ts +238 -0
- package/dist/esm/Poll.d.ts.map +1 -0
- package/dist/esm/Poll.js +282 -0
- package/dist/esm/Poll.js.map +1 -0
- package/dist/esm/RetryPolicy.d.ts +273 -0
- package/dist/esm/RetryPolicy.d.ts.map +1 -0
- package/dist/esm/RetryPolicy.js +429 -0
- package/dist/esm/RetryPolicy.js.map +1 -0
- package/dist/esm/Sleep.d.ts +98 -0
- package/dist/esm/Sleep.d.ts.map +1 -0
- package/dist/esm/Sleep.js +230 -0
- package/dist/esm/Sleep.js.map +1 -0
- package/dist/esm/Stall.d.ts +173 -0
- package/dist/esm/Stall.d.ts.map +1 -0
- package/dist/esm/Stall.js +138 -0
- package/dist/esm/Stall.js.map +1 -0
- package/dist/esm/WaitFor.d.ts +109 -0
- package/dist/esm/WaitFor.d.ts.map +1 -0
- package/dist/esm/WaitFor.js +184 -0
- package/dist/esm/WaitFor.js.map +1 -0
- package/dist/esm/index.d.ts +107 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +108 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/BoundedJson.d.ts +48 -0
- package/dist/esm/internal/BoundedJson.d.ts.map +1 -0
- package/dist/esm/internal/BoundedJson.js +107 -0
- package/dist/esm/internal/BoundedJson.js.map +1 -0
- package/dist/esm/internal/DeclarationSite.d.ts +135 -0
- package/dist/esm/internal/DeclarationSite.d.ts.map +1 -0
- package/dist/esm/internal/DeclarationSite.js +196 -0
- package/dist/esm/internal/DeclarationSite.js.map +1 -0
- package/dist/esm/internal/Declarations.d.ts +35 -0
- package/dist/esm/internal/Declarations.d.ts.map +1 -0
- package/dist/esm/internal/Declarations.js +43 -0
- package/dist/esm/internal/Declarations.js.map +1 -0
- package/dist/esm/internal/ExecutionMiddleware.d.ts +21 -0
- package/dist/esm/internal/ExecutionMiddleware.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionMiddleware.js +13 -0
- package/dist/esm/internal/ExecutionMiddleware.js.map +1 -0
- package/dist/esm/internal/JsonSchemaSubset.d.ts +133 -0
- package/dist/esm/internal/JsonSchemaSubset.d.ts.map +1 -0
- package/dist/esm/internal/JsonSchemaSubset.js +363 -0
- package/dist/esm/internal/JsonSchemaSubset.js.map +1 -0
- package/dist/esm/internal/OutcomeMarker.d.ts +18 -0
- package/dist/esm/internal/OutcomeMarker.d.ts.map +1 -0
- package/dist/esm/internal/OutcomeMarker.js +18 -0
- package/dist/esm/internal/OutcomeMarker.js.map +1 -0
- package/docs/README.md +150 -0
- package/docs/api.md +436 -0
- package/docs/concepts/bodies-and-plans.md +157 -0
- package/docs/concepts/execution-identity.md +142 -0
- package/docs/concepts/flows-and-actions.md +129 -0
- package/docs/concepts/suspension-and-replay.md +130 -0
- package/docs/concepts/the-runtime-port.md +110 -0
- package/docs/concepts/trampoline-rounds.md +151 -0
- package/docs/guides/ask-a-person.md +184 -0
- package/docs/guides/build-a-body.md +161 -0
- package/docs/guides/cancel-and-roll-back.md +112 -0
- package/docs/guides/implement-an-action.md +147 -0
- package/docs/guides/inspect-the-plan.md +154 -0
- package/docs/guides/poll-until-ready.md +167 -0
- package/docs/guides/queue-work-to-a-worker.md +122 -0
- package/docs/guides/retry-a-failing-action.md +243 -0
- package/docs/guides/reuse-a-recorded-result.md +122 -0
- package/docs/guides/run-a-child-flow.md +108 -0
- package/docs/guides/run-an-external-job.md +86 -0
- package/docs/guides/use-a-prompt.md +38 -0
- package/docs/guides/wait-for-a-deadline.md +141 -0
- package/docs/guides/wait-for-an-external-signal.md +151 -0
- package/docs/installation.md +82 -0
- package/docs/quickstart.md +155 -0
- package/docs/reference/flow.md +1831 -0
- package/docs/testing.md +157 -0
- package/docs/troubleshooting.md +286 -0
- package/package.json +327 -3
- package/src/Action/Action.ts +333 -0
- package/src/Action/AttemptTimedOut.ts +37 -0
- package/src/Action/BoundaryMode.ts +33 -0
- package/src/Action/CacheEnvironment.ts +170 -0
- package/src/Action/ConcurrentKeylessDispatch.ts +38 -0
- package/src/Action/Context.ts +156 -0
- package/src/Action/DuplicateImplementation.ts +24 -0
- package/src/Action/FileBoundary.ts +77 -0
- package/src/Action/FileInput.ts +42 -0
- package/src/Action/Filegroup.ts +16 -0
- package/src/Action/Glob.ts +8 -0
- package/src/Action/ImplementationVersionMismatch.ts +27 -0
- package/src/Action/Implementations.ts +149 -0
- package/src/Action/InfraInterrupt.ts +30 -0
- package/src/Action/InfraInterruptRetriesExhausted.ts +37 -0
- package/src/Action/IrreversibleRetryRequiresIdempotencyKey.ts +32 -0
- package/src/Action/StepIdentity.ts +219 -0
- package/src/Action/TreeArtifact.ts +8 -0
- package/src/Action/TypeId.ts +9 -0
- package/src/Action/UncanonicalIdempotencyKey.ts +36 -0
- package/src/Action/idempotencyKey.ts +67 -0
- package/src/Action/index.ts +31 -0
- package/src/Action/make.ts +657 -0
- package/src/Action/raceAll.ts +48 -0
- package/src/Action/retry.ts +92 -0
- package/src/Deadline.ts +185 -0
- package/src/DurableClock.ts +133 -0
- package/src/DurableDeferred.ts +753 -0
- package/src/DurableQueue.ts +519 -0
- package/src/ExternalJob.ts +432 -0
- package/src/Fault.ts +279 -0
- package/src/Flow/Annotations.ts +151 -0
- package/src/Flow/CapabilityCeiling.ts +37 -0
- package/src/Flow/DeadlineExceeded.ts +40 -0
- package/src/Flow/ExecutionIdRequired.ts +36 -0
- package/src/Flow/ExecutionIds.ts +133 -0
- package/src/Flow/Flow.ts +576 -0
- package/src/Flow/MaxRoundsExceeded.ts +39 -0
- package/src/Flow/Outcome.ts +179 -0
- package/src/Flow/Result.ts +284 -0
- package/src/Flow/Runtime.ts +309 -0
- package/src/Flow/TypeId.ts +9 -0
- package/src/Flow/index.ts +19 -0
- package/src/Flow/internal.ts +237 -0
- package/src/Flow/make.ts +279 -0
- package/src/FlowRuntime/CancelRequestFailed.ts +56 -0
- package/src/FlowRuntime/ExecutionIdentityConflict.ts +32 -0
- package/src/FlowRuntime/FlowCycleDetected.ts +41 -0
- package/src/FlowRuntime/FlowExecutionNotFound.ts +46 -0
- package/src/FlowRuntime/FlowInstance.ts +128 -0
- package/src/FlowRuntime/FlowRuntime.ts +333 -0
- package/src/FlowRuntime/NodeRecord.ts +183 -0
- package/src/FlowRuntime/WaitingAnnotation.ts +85 -0
- package/src/FlowRuntime/index.ts +17 -0
- package/src/Graph.ts +1862 -0
- package/src/HumanTask.ts +1003 -0
- package/src/Interpreter.ts +1593 -0
- package/src/Poll.ts +414 -0
- package/src/RetryPolicy.ts +550 -0
- package/src/Sleep.ts +267 -0
- package/src/Stall.ts +217 -0
- package/src/WaitFor.ts +228 -0
- package/src/index.ts +125 -0
- package/src/internal/BoundedJson.ts +109 -0
- package/src/internal/DeclarationSite.ts +214 -0
- package/src/internal/Declarations.ts +49 -0
- package/src/internal/ExecutionMiddleware.ts +29 -0
- package/src/internal/JsonSchemaSubset.ts +392 -0
- package/src/internal/OutcomeMarker.ts +19 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
// Deep reviewed and polished by a human on 2026-08-10.
|
|
2
|
+
import * as Node from "@smthrs/plan/Node";
|
|
3
|
+
import * as Cause from "effect/Cause";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
|
+
import * as Deferred from "effect/Deferred";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Effectable from "effect/Effectable";
|
|
8
|
+
import * as Exit from "effect/Exit";
|
|
9
|
+
import * as Fiber from "effect/Fiber";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import * as Predicate from "effect/Predicate";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import { makeProto } from "../Flow/internal.js";
|
|
15
|
+
import * as FlowHelpers from "../Flow/Runtime.js";
|
|
16
|
+
import { FlowInstance } from "../FlowRuntime/FlowInstance.js";
|
|
17
|
+
import { FlowRuntime } from "../FlowRuntime/FlowRuntime.js";
|
|
18
|
+
import { lowerDeclarations } from "../internal/Declarations.js";
|
|
19
|
+
import * as DeclarationSite from "../internal/DeclarationSite.js";
|
|
20
|
+
import { AttemptTimedOut } from "./AttemptTimedOut.js";
|
|
21
|
+
import { CurrentAttempt, CurrentHeartbeat } from "./Context.js";
|
|
22
|
+
import { FileBoundary } from "./FileBoundary.js";
|
|
23
|
+
import { Implementations } from "./Implementations.js";
|
|
24
|
+
import { ImplementationVersionMismatch } from "./ImplementationVersionMismatch.js";
|
|
25
|
+
import { InfraInterruptRetriesExhausted } from "./InfraInterruptRetriesExhausted.js";
|
|
26
|
+
import { TypeId } from "./TypeId.js";
|
|
27
|
+
// A declared action mints a fresh inline action per dispatch. Effect caches
|
|
28
|
+
// compiled parsers by AST identity, so the exit schemas are shared per
|
|
29
|
+
// (success, error) pair rather than rebuilt on every dispatch.
|
|
30
|
+
const exitSchemaCache = new WeakMap();
|
|
31
|
+
const exitSchemasFor = (success, error, successJson, errorJson) => {
|
|
32
|
+
let byError = exitSchemaCache.get(success);
|
|
33
|
+
if (byError === undefined) {
|
|
34
|
+
byError = new WeakMap();
|
|
35
|
+
exitSchemaCache.set(success, byError);
|
|
36
|
+
}
|
|
37
|
+
let cached = byError.get(error);
|
|
38
|
+
if (cached === undefined) {
|
|
39
|
+
cached = {
|
|
40
|
+
exitSchema: Schema.Exit(successJson, errorJson, Schema.Defect()),
|
|
41
|
+
exitSchemaPartial: Schema.Exit(successJson, errorJson, Schema.Unknown)
|
|
42
|
+
};
|
|
43
|
+
byError.set(error, cached);
|
|
44
|
+
}
|
|
45
|
+
return cached;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Creates a flow action from an effect, using the provided schemas to
|
|
49
|
+
* encode successes and failures for durable execution.
|
|
50
|
+
*
|
|
51
|
+
* @category constructors
|
|
52
|
+
* @since 0.1.0
|
|
53
|
+
*/
|
|
54
|
+
const makeInline = (options) => {
|
|
55
|
+
const implementationVersion = options.implementationVersion === undefined
|
|
56
|
+
? undefined
|
|
57
|
+
: Schema.decodeUnknownSync(Schema.NonEmptyString)(options.implementationVersion);
|
|
58
|
+
const successSchema = options.success ?? Schema.Void;
|
|
59
|
+
const errorSchema = options.error ?? Schema.Never;
|
|
60
|
+
const successSchemaJson = Schema.toCodecJson(successSchema);
|
|
61
|
+
const errorSchemaJson = Schema.toCodecJson(errorSchema);
|
|
62
|
+
const exitSchemas = exitSchemasFor(successSchema, errorSchema, successSchemaJson, errorSchemaJson);
|
|
63
|
+
let execute;
|
|
64
|
+
const attemptTimeoutMs = timeoutMs(options.name, "attemptTimeoutMs", options.attemptTimeoutMs);
|
|
65
|
+
const heartbeatTimeoutMs = timeoutMs(options.name, "heartbeatTimeoutMs", options.heartbeatTimeoutMs);
|
|
66
|
+
const executeWithInfraRetry = boundAttempt(options.name, attemptTimeoutMs, heartbeatTimeoutMs)(retryInfraInterrupt(options.name, options.interruptRetryPolicy)(options.execute));
|
|
67
|
+
const self = {
|
|
68
|
+
...Effectable.Prototype({
|
|
69
|
+
label: "Action",
|
|
70
|
+
evaluate(_) {
|
|
71
|
+
return execute;
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
[TypeId]: TypeId,
|
|
75
|
+
name: options.name,
|
|
76
|
+
implementationVersion,
|
|
77
|
+
successSchema,
|
|
78
|
+
errorSchema,
|
|
79
|
+
exitSchema: exitSchemas.exitSchema,
|
|
80
|
+
exitSchemaPartial: exitSchemas.exitSchemaPartial,
|
|
81
|
+
annotations: options.annotations ?? Context.empty(),
|
|
82
|
+
tier: options.tier ?? "sealed",
|
|
83
|
+
idempotencyKey: options.idempotencyKey,
|
|
84
|
+
nondeterministic: options.nondeterministic,
|
|
85
|
+
metadata: options.fileBoundary === undefined ? options.metadata : FileBoundary.make(options.fileBoundary),
|
|
86
|
+
fileBoundary: options.fileBoundary === undefined ? undefined : FileBoundary.make(options.fileBoundary),
|
|
87
|
+
retryPolicy: options.retryPolicy,
|
|
88
|
+
attemptTimeoutMs,
|
|
89
|
+
heartbeatTimeoutMs,
|
|
90
|
+
annotate(tag, value) {
|
|
91
|
+
return makeInline({
|
|
92
|
+
...options,
|
|
93
|
+
annotations: Context.add(self.annotations, tag, value)
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
annotateMerge(context) {
|
|
97
|
+
return makeInline({
|
|
98
|
+
...options,
|
|
99
|
+
annotations: Context.merge(self.annotations, context)
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
execute: executeWithInfraRetry,
|
|
103
|
+
executeEncoded: Effect.matchEffect(executeWithInfraRetry, {
|
|
104
|
+
onFailure: (error) => Effect.flatMap(Effect.orDie(Schema.encodeEffect(errorSchemaJson)(error)), Effect.fail),
|
|
105
|
+
onSuccess: (value) => Effect.orDie(Schema.encodeEffect(successSchemaJson)(value))
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
execute = makeExecute(self);
|
|
109
|
+
return self;
|
|
110
|
+
};
|
|
111
|
+
const makeDeclared = (tag, options, site) => {
|
|
112
|
+
const payloadSchema = (Schema.isSchema(options.payload)
|
|
113
|
+
? options.payload
|
|
114
|
+
: Schema.Struct(options.payload));
|
|
115
|
+
const implementationVersion = options.implementationVersion === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: Schema.decodeUnknownSync(Schema.NonEmptyString)(options.implementationVersion);
|
|
118
|
+
const successSchema = options.success ?? Schema.Void;
|
|
119
|
+
const errorSchema = options.error ?? Schema.Never;
|
|
120
|
+
const attemptTimeoutMs = timeoutMs(tag, "attemptTimeoutMs", options.attemptTimeoutMs);
|
|
121
|
+
const heartbeatTimeoutMs = timeoutMs(tag, "heartbeatTimeoutMs", options.heartbeatTimeoutMs);
|
|
122
|
+
const annotations = lowerDeclarations(options);
|
|
123
|
+
// The literals are already in the bag above, so an annotated copy rebuilds
|
|
124
|
+
// from options WITHOUT them: re-lowering would overwrite a `Capabilities` or
|
|
125
|
+
// `EffectEnvelope` the caller annotated on top of the declared one.
|
|
126
|
+
const lowered = {
|
|
127
|
+
...options,
|
|
128
|
+
capabilities: undefined,
|
|
129
|
+
effects: undefined
|
|
130
|
+
};
|
|
131
|
+
// The requirement this declaration mints for itself. Context keys are
|
|
132
|
+
// compared by their string key, so re-minting one for an annotated copy of
|
|
133
|
+
// this declaration names the same slot the original does.
|
|
134
|
+
const requirement = Context.Service(`@smthrs/flow/Action/Requirement/${tag}`);
|
|
135
|
+
const self = {
|
|
136
|
+
[TypeId]: TypeId,
|
|
137
|
+
name: tag,
|
|
138
|
+
implementationVersion,
|
|
139
|
+
payloadSchema,
|
|
140
|
+
successSchema,
|
|
141
|
+
errorSchema,
|
|
142
|
+
tier: options.tier ?? "sealed",
|
|
143
|
+
idempotencyKey: options.idempotencyKey,
|
|
144
|
+
nondeterministic: options.nondeterministic,
|
|
145
|
+
retryPolicy: options.retryPolicy,
|
|
146
|
+
attemptTimeoutMs,
|
|
147
|
+
heartbeatTimeoutMs,
|
|
148
|
+
fileBoundary: options.fileBoundary,
|
|
149
|
+
annotations,
|
|
150
|
+
requirement,
|
|
151
|
+
annotate(key, value) {
|
|
152
|
+
return makeDeclared(tag, {
|
|
153
|
+
...lowered,
|
|
154
|
+
annotations: Context.add(annotations, key, value)
|
|
155
|
+
}, site);
|
|
156
|
+
},
|
|
157
|
+
annotateMerge(context) {
|
|
158
|
+
return makeDeclared(tag, {
|
|
159
|
+
...lowered,
|
|
160
|
+
annotations: Context.merge(annotations, context)
|
|
161
|
+
}, site);
|
|
162
|
+
},
|
|
163
|
+
call(payload) {
|
|
164
|
+
return Node.actionCall(self, tag, payload);
|
|
165
|
+
},
|
|
166
|
+
toLayer(execute, registrationOptions) {
|
|
167
|
+
if (registrationOptions?.implementationVersion !== implementationVersion) {
|
|
168
|
+
throw new ImplementationVersionMismatch({
|
|
169
|
+
actionName: tag,
|
|
170
|
+
declaredVersion: implementationVersion ?? null,
|
|
171
|
+
registeredVersion: registrationOptions?.implementationVersion ?? null,
|
|
172
|
+
message: `Action "${tag}" requires its declared implementationVersion at registration.`
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
// The flow form of this action: same tag, same schemas, and a body that
|
|
176
|
+
// is the one call to it. Registering that flow is what lets a caller
|
|
177
|
+
// `execute` the action as a durable execution of its own, and the body
|
|
178
|
+
// says truthfully what such an execution does. It stays INTERNAL — a flow
|
|
179
|
+
// carries a body and never a handler, so `Flow` has no `toLayer` for an
|
|
180
|
+
// author to reach this seam with.
|
|
181
|
+
//
|
|
182
|
+
// The private constructor preserves the ordinary flow representation
|
|
183
|
+
// without importing the public constructor back through this action.
|
|
184
|
+
const registration = DeclarationSite.annotate(makeProto({
|
|
185
|
+
_tag: tag,
|
|
186
|
+
payloadSchema,
|
|
187
|
+
successSchema,
|
|
188
|
+
errorSchema,
|
|
189
|
+
annotations,
|
|
190
|
+
body: (payload) => Node.actionCall(self, tag, payload)
|
|
191
|
+
}), DeclarationSite.capture());
|
|
192
|
+
const action = (payload) => makeInline({
|
|
193
|
+
name: tag,
|
|
194
|
+
implementationVersion,
|
|
195
|
+
success: successSchema,
|
|
196
|
+
error: errorSchema,
|
|
197
|
+
tier: self.tier,
|
|
198
|
+
idempotencyKey: typeof self.idempotencyKey === "function"
|
|
199
|
+
? self.idempotencyKey(payload)
|
|
200
|
+
: self.idempotencyKey,
|
|
201
|
+
nondeterministic: self.nondeterministic,
|
|
202
|
+
retryPolicy: options.retryPolicy,
|
|
203
|
+
attemptTimeoutMs,
|
|
204
|
+
heartbeatTimeoutMs,
|
|
205
|
+
interruptRetryPolicy: options.interruptRetryPolicy,
|
|
206
|
+
fileBoundary: typeof options.fileBoundary === "function"
|
|
207
|
+
? options.fileBoundary(payload)
|
|
208
|
+
: options.fileBoundary,
|
|
209
|
+
annotations,
|
|
210
|
+
execute: execute(payload)
|
|
211
|
+
});
|
|
212
|
+
// The implementation, provided under the requirement this declaration
|
|
213
|
+
// minted. That is the compile-time half: a body that called this action
|
|
214
|
+
// produced a node requiring the tag, and this layer is the only thing
|
|
215
|
+
// that answers it, so a plan cannot reach `execute` without its code.
|
|
216
|
+
//
|
|
217
|
+
// The name-keyed table is the run-time half and stays exactly as it was.
|
|
218
|
+
// A driver expanding a persisted plan has no types left to consult and
|
|
219
|
+
// resolves by tag, so the same implementation is filed there when a
|
|
220
|
+
// composition wired a table up. The table is optional on purpose: a
|
|
221
|
+
// composition that only executes handlers registered directly with the
|
|
222
|
+
// runtime has no use for it, and requiring it would change what every
|
|
223
|
+
// existing `toLayer` call site must provide.
|
|
224
|
+
const implement = Layer.effect(requirement)(Effect.gen(function* () {
|
|
225
|
+
const services = yield* Effect.context();
|
|
226
|
+
// The captured context is what the runtime's own `register` captures
|
|
227
|
+
// for the handler path: the services the implementation was wired with,
|
|
228
|
+
// overridable by whatever the run provides on top of them.
|
|
229
|
+
const provided = (payload) => Effect.flatMap(
|
|
230
|
+
// A driver assembles this payload from plan values rather than from
|
|
231
|
+
// a typed call site, so the declaration validates it exactly as
|
|
232
|
+
// `Flow.execute` validates a caller's. The cast is the erasure that
|
|
233
|
+
// hands an unknown to the constructor; `makeEffect` is what decides
|
|
234
|
+
// whether it was one.
|
|
235
|
+
Effect.orDie(payloadSchema.makeEffect(payload)), (decoded) => action(decoded)).pipe(Effect.updateContext((input) => Context.merge(services, input)));
|
|
236
|
+
const implementation = {
|
|
237
|
+
name: tag,
|
|
238
|
+
...(implementationVersion === undefined ? {} : { implementationVersion }),
|
|
239
|
+
action: provided
|
|
240
|
+
};
|
|
241
|
+
const table = yield* Effect.serviceOption(Implementations);
|
|
242
|
+
if (Option.isSome(table))
|
|
243
|
+
yield* table.value.add(implementation, registrationOptions);
|
|
244
|
+
return implementation;
|
|
245
|
+
}));
|
|
246
|
+
return Layer.merge(Layer.effectDiscard(Effect.flatMap(FlowRuntime, (engine) => engine.register(registration, action))), implement);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
return DeclarationSite.annotate(self, site);
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Creates either an inline executable action or a named action
|
|
253
|
+
* declaration, selected by whether the first argument is a string.
|
|
254
|
+
*
|
|
255
|
+
* @category constructors
|
|
256
|
+
* @since 0.1.0
|
|
257
|
+
*/
|
|
258
|
+
export const make = ((first, second) => {
|
|
259
|
+
if (typeof first !== "string")
|
|
260
|
+
return makeInline(first);
|
|
261
|
+
const options = second;
|
|
262
|
+
return makeDeclared(first, options, options.declaredFrom === undefined ? DeclarationSite.capture() : DeclarationSite.declaredAt(options.declaredFrom));
|
|
263
|
+
});
|
|
264
|
+
/**
|
|
265
|
+
* Declares a SYSTEM action: one whose implementation ships with the engine
|
|
266
|
+
* rather than with the composition that calls it.
|
|
267
|
+
*
|
|
268
|
+
* It is {@link make}'s declared form in every respect except the requirement.
|
|
269
|
+
* A system declaration mints none, so `.call()` records a node that demands
|
|
270
|
+
* nothing and a body using {@link module:Sleep} or {@link module:WaitFor} does
|
|
271
|
+
* not push a layer obligation onto its callers. That is the whole difference,
|
|
272
|
+
* and it is a deliberate hole in the compile-time enforcement: the engine owns
|
|
273
|
+
* these implementations, so an author cannot be the one who forgot them.
|
|
274
|
+
*
|
|
275
|
+
* Everything else is unchanged — the layer still registers with the runtime and
|
|
276
|
+
* still files itself in {@link module:Implementations.Implementations}, so a
|
|
277
|
+
* driver resolves a system action by tag exactly like any other.
|
|
278
|
+
*
|
|
279
|
+
* @category constructors
|
|
280
|
+
* @since 0.1.0
|
|
281
|
+
*/
|
|
282
|
+
export const makeSystem = (tag, options) =>
|
|
283
|
+
// The erasure IS the declaration: the value still provides its requirement
|
|
284
|
+
// from `toLayer`, and dropping it from `call` only means nothing asks for it.
|
|
285
|
+
// Providing a service no one requires is always sound; the reverse would not
|
|
286
|
+
// be, which is why this is the one place the channel is written off.
|
|
287
|
+
makeDeclared(tag, options, options.declaredFrom === undefined ? DeclarationSite.capture() : DeclarationSite.declaredAt(options.declaredFrom));
|
|
288
|
+
/**
|
|
289
|
+
* Validates one declared attempt bound. An invalid bound is a programmer
|
|
290
|
+
* error thrown at declaration, like `Flow.make`'s `maxRounds`.
|
|
291
|
+
*/
|
|
292
|
+
const timeoutMs = (name, field, value) => {
|
|
293
|
+
if (value === undefined)
|
|
294
|
+
return undefined;
|
|
295
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
296
|
+
throw new RangeError(`Action.make: "${name}" ${field} must be a positive safe integer`);
|
|
297
|
+
}
|
|
298
|
+
return value;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Bounds one attempt by its declared timeouts. An expired bound interrupts the
|
|
302
|
+
* body and dies with {@link AttemptTimedOut}, which the engine's retry
|
|
303
|
+
* decision point counts as a retryable attempt failure. A defect the body
|
|
304
|
+
* raises while it is being interrupted is kept beside the timeout, so the
|
|
305
|
+
* attempt is not mistaken for a clean timeout and retried past it.
|
|
306
|
+
*
|
|
307
|
+
* Every attempt gets its own heartbeat, a no-op without `heartbeatTimeoutMs`,
|
|
308
|
+
* so a nested action never feeds the watchdog of the action that called it.
|
|
309
|
+
*/
|
|
310
|
+
const boundAttempt = (name, attemptTimeoutMs, heartbeatTimeoutMs) => (effect) => heartbeatTimeoutMs === undefined && attemptTimeoutMs === undefined
|
|
311
|
+
? Effect.provideService(effect, CurrentHeartbeat, Effect.void)
|
|
312
|
+
: Effect.gen(function* () {
|
|
313
|
+
const attempt = yield* CurrentAttempt;
|
|
314
|
+
// Each heartbeat completes the signal the watchdog is waiting on and
|
|
315
|
+
// installs a fresh one. Waiting on sleeps rather than reading the clock
|
|
316
|
+
// keeps the gap immune to wall-clock adjustments.
|
|
317
|
+
let signal = Deferred.makeUnsafe();
|
|
318
|
+
const beat = Effect.sync(() => {
|
|
319
|
+
const done = signal;
|
|
320
|
+
signal = Deferred.makeUnsafe();
|
|
321
|
+
Deferred.doneUnsafe(done, Exit.void);
|
|
322
|
+
});
|
|
323
|
+
const expiries = [];
|
|
324
|
+
if (attemptTimeoutMs !== undefined) {
|
|
325
|
+
expiries.push(Effect.as(Effect.sleep(attemptTimeoutMs), "attempt"));
|
|
326
|
+
}
|
|
327
|
+
if (heartbeatTimeoutMs !== undefined) {
|
|
328
|
+
expiries.push(Effect.gen(function* () {
|
|
329
|
+
while (true) {
|
|
330
|
+
const beaten = yield* Effect.raceFirst(Effect.as(Deferred.await(signal), true), Effect.as(Effect.sleep(heartbeatTimeoutMs), false));
|
|
331
|
+
if (!beaten)
|
|
332
|
+
return "heartbeat";
|
|
333
|
+
}
|
|
334
|
+
}));
|
|
335
|
+
}
|
|
336
|
+
const body = yield* Effect.forkChild(Effect.provideService(effect, CurrentHeartbeat, heartbeatTimeoutMs === undefined ? Effect.void : beat), { startImmediately: true });
|
|
337
|
+
const outcome = yield* Effect.raceFirst(Fiber.await(body), Effect.raceAll(expiries));
|
|
338
|
+
if (typeof outcome !== "string")
|
|
339
|
+
return yield* outcome;
|
|
340
|
+
yield* Fiber.interrupt(body);
|
|
341
|
+
// The interruption was requested, so the body cannot settle with an
|
|
342
|
+
// answer: an uninterruptible region it was in ends in the interrupt.
|
|
343
|
+
// What remains beside the interrupt is a defect its cleanup raised.
|
|
344
|
+
const cleanup = yield* Fiber.join(body).pipe(Effect.as([]), Effect.catchCause((cause) => Effect.succeed(cause.reasons.filter((reason) => !Cause.isInterruptReason(reason)))));
|
|
345
|
+
const timeoutMs = outcome === "attempt" ? attemptTimeoutMs : heartbeatTimeoutMs;
|
|
346
|
+
const timedOut = new AttemptTimedOut({
|
|
347
|
+
actionName: name,
|
|
348
|
+
attempt,
|
|
349
|
+
bound: outcome,
|
|
350
|
+
timeoutMs,
|
|
351
|
+
message: `Action "${name}" attempt ${attempt} ` +
|
|
352
|
+
(outcome === "attempt" ? `ran past ${timeoutMs}ms` : `sent no heartbeat for ${timeoutMs}ms`)
|
|
353
|
+
});
|
|
354
|
+
return yield* Effect.failCause(Cause.fromReasons([Cause.makeDieReason(timedOut), ...cleanup]));
|
|
355
|
+
});
|
|
356
|
+
const isInfraInterrupt = (value) => Predicate.isTagged("@smthrs/flow/InfraInterrupt")(value);
|
|
357
|
+
const retryInfraInterrupt = (name, policy) => (effect) => policy === undefined
|
|
358
|
+
? effect
|
|
359
|
+
: Effect.suspend(() => {
|
|
360
|
+
let attempts = 0;
|
|
361
|
+
return effect.pipe(
|
|
362
|
+
// Each failed execution reaches this tap once, including the final
|
|
363
|
+
// failure the schedule declines to retry, so this is the real attempt
|
|
364
|
+
// count rather than an estimate derived from schedule shape.
|
|
365
|
+
Effect.tapError((error) => isInfraInterrupt(error)
|
|
366
|
+
? Effect.sync(() => void attempts++)
|
|
367
|
+
: Effect.void), Effect.retry({
|
|
368
|
+
schedule: policy,
|
|
369
|
+
while: isInfraInterrupt
|
|
370
|
+
}), Effect.catch((error) => isInfraInterrupt(error)
|
|
371
|
+
? Effect.die(new InfraInterruptRetriesExhausted({
|
|
372
|
+
actionName: name,
|
|
373
|
+
attempts,
|
|
374
|
+
interrupt: error,
|
|
375
|
+
message: `Action "${name}" infrastructure interrupt retry attempts exhausted after ` +
|
|
376
|
+
`${attempts} attempts.`
|
|
377
|
+
}))
|
|
378
|
+
: Effect.fail(error)));
|
|
379
|
+
});
|
|
380
|
+
// Untraced because action execution is retried in the flow hot path.
|
|
381
|
+
const makeExecute = Effect.fnUntraced(function* (action) {
|
|
382
|
+
const engine = yield* FlowRuntime;
|
|
383
|
+
const instance = yield* FlowInstance;
|
|
384
|
+
const attempt = yield* CurrentAttempt;
|
|
385
|
+
yield* Effect.annotateCurrentSpan({
|
|
386
|
+
executionId: instance.executionId,
|
|
387
|
+
action: action.name,
|
|
388
|
+
attempt,
|
|
389
|
+
tier: action.tier
|
|
390
|
+
});
|
|
391
|
+
const result = yield* FlowHelpers.wrapActionResult(engine.actionExecute(action, attempt), (_) => _._tag === "Suspended");
|
|
392
|
+
// An action settles with an exit or with a suspension; a handoff is a
|
|
393
|
+
// FLOW settlement, and the engine's action path never produces one. The
|
|
394
|
+
// narrowing is written as "not complete" so the third result variant needs
|
|
395
|
+
// no unreachable arm of its own.
|
|
396
|
+
if (result._tag !== "Complete") {
|
|
397
|
+
yield* Effect.annotateCurrentSpan({ outcome: "suspended" });
|
|
398
|
+
return yield* FlowHelpers.suspend(instance);
|
|
399
|
+
}
|
|
400
|
+
yield* Effect.annotateCurrentSpan({ outcome: result.exit._tag === "Success" ? "success" : "failure" });
|
|
401
|
+
return yield* result.exit;
|
|
402
|
+
}, (effect) => Effect.withSpan(effect, "Action.execute", {
|
|
403
|
+
captureStackTrace: false
|
|
404
|
+
}));
|
|
405
|
+
//# sourceMappingURL=make.js.map
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,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAC9B,CAAA;IACD,sEAAsE;IACtE,wEAAwE;IACxE,2EAA2E;IAC3E,iCAAiC;IACjC,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;QAC3D,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC7C,CAAC;IACD,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;IACtG,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAA;AAC3B,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CACZ,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,EAAE;IACxC,iBAAiB,EAAE,KAAK;CACzB,CAAC,CAAC,CAAA","sourcesContent":["// Deep reviewed and polished by a human on 2026-08-10.\n\n/**\n * Constructs executable durable action values.\n *\n * @since 0.1.0\n */\n\nimport type * as Effects from \"@smthrs/plan/Effects\"\nimport * as Node from \"@smthrs/plan/Node\"\nimport * as Cause from \"effect/Cause\"\nimport * as Context from \"effect/Context\"\nimport * as Deferred from \"effect/Deferred\"\nimport * as Effect from \"effect/Effect\"\nimport * as Effectable from \"effect/Effectable\"\nimport * as Exit from \"effect/Exit\"\nimport * as Fiber from \"effect/Fiber\"\nimport * as Layer from \"effect/Layer\"\nimport * as Option from \"effect/Option\"\nimport * as Predicate from \"effect/Predicate\"\nimport type * as Schedule from \"effect/Schedule\"\nimport * as Schema from \"effect/Schema\"\nimport type { Scope } from \"effect/Scope\"\nimport type * as Flow from \"../Flow/Flow.ts\"\nimport { makeProto } from \"../Flow/internal.ts\"\nimport * as FlowHelpers from \"../Flow/Runtime.ts\"\nimport { FlowInstance } from \"../FlowRuntime/FlowInstance.ts\"\nimport { FlowRuntime } from \"../FlowRuntime/FlowRuntime.ts\"\nimport { lowerDeclarations } from \"../internal/Declarations.ts\"\nimport * as DeclarationSite from \"../internal/DeclarationSite.ts\"\nimport type * as RetryPolicy from \"../RetryPolicy.ts\"\nimport type { Action, Declared, IdempotencyKey, Requirement, Tier } from \"./Action.ts\"\nimport { AttemptTimedOut } from \"./AttemptTimedOut.ts\"\nimport { CurrentAttempt, CurrentHeartbeat } from \"./Context.ts\"\nimport { FileBoundary } from \"./FileBoundary.ts\"\nimport { type Implementation, Implementations } from \"./Implementations.ts\"\nimport { ImplementationVersionMismatch } from \"./ImplementationVersionMismatch.ts\"\nimport type { InfraInterrupt } from \"./InfraInterrupt.ts\"\nimport { InfraInterruptRetriesExhausted } from \"./InfraInterruptRetriesExhausted.ts\"\nimport { TypeId } from \"./TypeId.ts\"\n\ninterface ExitSchemas {\n readonly exitSchema: Schema.Exit<any, any, any>\n readonly exitSchemaPartial: Schema.Exit<any, any, any>\n}\n\n// A declared action mints a fresh inline action per dispatch. Effect caches\n// compiled parsers by AST identity, so the exit schemas are shared per\n// (success, error) pair rather than rebuilt on every dispatch.\nconst exitSchemaCache = new WeakMap<object, WeakMap<object, ExitSchemas>>()\n\nconst exitSchemasFor = (\n success: Schema.Constraint,\n error: Schema.Constraint,\n successJson: Schema.Top,\n errorJson: Schema.Top\n): ExitSchemas => {\n let byError = exitSchemaCache.get(success)\n if (byError === undefined) {\n byError = new WeakMap()\n exitSchemaCache.set(success, byError)\n }\n let cached = byError.get(error)\n if (cached === undefined) {\n cached = {\n exitSchema: Schema.Exit(successJson, errorJson, Schema.Defect()),\n exitSchemaPartial: Schema.Exit(successJson, errorJson, Schema.Unknown)\n }\n byError.set(error, cached)\n }\n return cached\n}\n\n/**\n * The options of a declared action, shared by {@link make}'s declared form and\n * {@link makeSystem}.\n */\ninterface DeclaredOptions<\n Payload extends Schema.Struct.Fields | Flow.AnyStructSchema,\n Success extends Schema.Top,\n Error extends Schema.Top\n> {\n readonly payload: Payload\n /**\n * Native declaration whose source location this reconstructed action retains.\n * A source with no recorded location preserves that absence. This affects\n * diagnostics only, never identity; calls still refer to the new declaration.\n */\n readonly declaredFrom?: object | undefined\n readonly implementationVersion?: string | undefined\n readonly success?: Success | undefined\n readonly error?: Error | undefined\n /**\n * The capability ceiling this action dispatches under, as string literals.\n *\n * It is the same ceiling {@link module:Flow/Annotations.Capabilities}\n * carries, and declaring it here is what makes it READABLE without importing\n * the module, exactly as `Flow.make`'s option is: a catalog projects a\n * discovered declaration's authority from the source text of this literal,\n * and an annotation built at run time is invisible to that projection.\n *\n * {@link module:Graph.build} records a `capability_outside_grant` refusal for\n * every capability named here that the calling flow does not hold. The\n * refusal is advisory: execution intersects this ceiling with every caller ceiling.\n */\n readonly capabilities?: ReadonlyArray<string> | undefined\n /**\n * The effect envelope this action dispatches under, as a literal.\n *\n * It is the same declaration {@link module:Flow/Annotations.EffectEnvelope}\n * carries, declared here for the same reason `capabilities` is.\n *\n * An action is a leaf, so this envelope encloses nothing; it is checked\n * against the envelope the calling flow granted, and\n * {@link module:Graph.build} refuses a dispatch that reads or writes outside\n * that grant, loosens `hermetic` to `expected`, or raises the tier. `reads`\n * and `writes` are normalized to sorted, duplicate-free arrays.\n */\n readonly effects?: Effects.MakeOptions | undefined\n readonly tier?: Tier | undefined\n readonly idempotencyKey?:\n | IdempotencyKey\n | ((payload: (Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload)[\"Type\"]) => IdempotencyKey)\n | undefined\n readonly nondeterministic?: true | undefined\n readonly retryPolicy?: RetryPolicy.RetryPolicy | undefined\n /**\n * Milliseconds one attempt may run. A longer attempt is interrupted and\n * fails with {@link module:AttemptTimedOut.AttemptTimedOut}, which\n * `retryPolicy` retries like any other attempt failure.\n */\n readonly attemptTimeoutMs?: number | undefined\n /**\n * Milliseconds one attempt may go without calling\n * {@link module:Context.heartbeat}, measured from the attempt's start and\n * then from each heartbeat. A missed heartbeat fails the attempt like\n * `attemptTimeoutMs`.\n */\n readonly heartbeatTimeoutMs?: number | undefined\n readonly interruptRetryPolicy?: Schedule.Schedule<any, unknown> | undefined\n readonly fileBoundary?:\n | FileBoundary\n | ((payload: (Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload)[\"Type\"]) => FileBoundary)\n | undefined\n readonly annotations?: Context.Context<never> | undefined\n}\n\n/**\n * Creates a flow action from an effect, using the provided schemas to\n * encode successes and failures for durable execution.\n *\n * @category constructors\n * @since 0.1.0\n */\nconst makeInline = <\n R,\n Success extends Schema.Constraint = Schema.Void,\n Error extends Schema.Constraint = Schema.Never\n>(options: {\n readonly name: string\n readonly implementationVersion?: string | undefined\n readonly success?: Success | undefined\n readonly error?: Error | undefined\n readonly execute: Effect.Effect<Success[\"Type\"], Error[\"Type\"], R>\n readonly tier?: Tier | undefined\n readonly idempotencyKey?: IdempotencyKey | undefined\n readonly nondeterministic?: true | undefined\n readonly metadata?: unknown\n readonly fileBoundary?: FileBoundary | undefined\n readonly interruptRetryPolicy?: Schedule.Schedule<any, unknown> | undefined\n readonly retryPolicy?: RetryPolicy.RetryPolicy | undefined\n readonly attemptTimeoutMs?: number | undefined\n readonly heartbeatTimeoutMs?: number | undefined\n readonly annotations?: Context.Context<never> | undefined\n}): Action<Success, Error, Exclude<R, FlowInstance | FlowRuntime | Scope>> => {\n const implementationVersion = options.implementationVersion === undefined\n ? undefined\n : Schema.decodeUnknownSync(Schema.NonEmptyString)(options.implementationVersion)\n const successSchema = options.success ?? (Schema.Void as any as Success)\n const errorSchema = options.error ?? (Schema.Never as any as Error)\n const successSchemaJson = Schema.toCodecJson(successSchema)\n const errorSchemaJson = Schema.toCodecJson(errorSchema)\n const exitSchemas = exitSchemasFor(successSchema, errorSchema, successSchemaJson, errorSchemaJson)\n let execute!: Effect.Effect<Success[\"Type\"], Error[\"Type\"], any>\n const attemptTimeoutMs = timeoutMs(options.name, \"attemptTimeoutMs\", options.attemptTimeoutMs)\n const heartbeatTimeoutMs = timeoutMs(options.name, \"heartbeatTimeoutMs\", options.heartbeatTimeoutMs)\n const executeWithInfraRetry = boundAttempt(options.name, attemptTimeoutMs, heartbeatTimeoutMs)(\n retryInfraInterrupt(\n options.name,\n options.interruptRetryPolicy\n )(options.execute)\n )\n const self: Action<Success, Error, Exclude<R, FlowInstance | FlowRuntime>> = {\n ...Effectable.Prototype<Action<Success, Error, R>>({\n label: \"Action\",\n evaluate(_) {\n return execute\n }\n }),\n [TypeId]: TypeId,\n name: options.name,\n implementationVersion,\n successSchema,\n errorSchema,\n exitSchema: exitSchemas.exitSchema,\n exitSchemaPartial: exitSchemas.exitSchemaPartial,\n annotations: options.annotations ?? Context.empty(),\n tier: options.tier ?? \"sealed\",\n idempotencyKey: options.idempotencyKey,\n nondeterministic: options.nondeterministic,\n metadata: options.fileBoundary === undefined ? options.metadata : FileBoundary.make(options.fileBoundary),\n fileBoundary: options.fileBoundary === undefined ? undefined : FileBoundary.make(options.fileBoundary),\n retryPolicy: options.retryPolicy,\n attemptTimeoutMs,\n heartbeatTimeoutMs,\n annotate(tag: Context.Key<any, any>, value: any) {\n return makeInline({\n ...options,\n annotations: Context.add(self.annotations, tag, value)\n })\n },\n annotateMerge(context: Context.Context<any>) {\n return makeInline({\n ...options,\n annotations: Context.merge(self.annotations, context)\n })\n },\n execute: executeWithInfraRetry,\n executeEncoded: Effect.matchEffect(executeWithInfraRetry, {\n onFailure: (error) => Effect.flatMap(Effect.orDie(Schema.encodeEffect(errorSchemaJson)(error)), Effect.fail),\n onSuccess: (value) => Effect.orDie(Schema.encodeEffect(successSchemaJson)(value))\n })\n } as any\n execute = makeExecute(self)\n return self\n}\n\nconst makeDeclared = <\n const Tag extends string,\n Payload extends Schema.Struct.Fields | Flow.AnyStructSchema,\n Success extends Schema.Top = Schema.Void,\n Error extends Schema.Top = Schema.Never\n>(tag: Tag, options: DeclaredOptions<Payload, Success, Error>, site: DeclarationSite.DeclaredAt | undefined): Declared<\n Tag,\n Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload,\n Success,\n Error\n> => {\n type PayloadSchema = Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload\n const payloadSchema = (Schema.isSchema(options.payload)\n ? options.payload\n : Schema.Struct(options.payload)) as PayloadSchema\n const implementationVersion = options.implementationVersion === undefined\n ? undefined\n : Schema.decodeUnknownSync(Schema.NonEmptyString)(options.implementationVersion)\n const successSchema = options.success ?? (Schema.Void as unknown as Success)\n const errorSchema = options.error ?? (Schema.Never as unknown as Error)\n const attemptTimeoutMs = timeoutMs(tag, \"attemptTimeoutMs\", options.attemptTimeoutMs)\n const heartbeatTimeoutMs = timeoutMs(tag, \"heartbeatTimeoutMs\", options.heartbeatTimeoutMs)\n const annotations = lowerDeclarations(options)\n // The literals are already in the bag above, so an annotated copy rebuilds\n // from options WITHOUT them: re-lowering would overwrite a `Capabilities` or\n // `EffectEnvelope` the caller annotated on top of the declared one.\n const lowered: DeclaredOptions<Payload, Success, Error> = {\n ...options,\n capabilities: undefined,\n effects: undefined\n }\n // The requirement this declaration mints for itself. Context keys are\n // compared by their string key, so re-minting one for an annotated copy of\n // this declaration names the same slot the original does.\n const requirement = Context.Service<Requirement<Tag>, Implementation>(\n `@smthrs/flow/Action/Requirement/${tag}`\n )\n const self: Declared<Tag, PayloadSchema, Success, Error> = {\n [TypeId]: TypeId,\n name: tag,\n implementationVersion,\n payloadSchema,\n successSchema,\n errorSchema,\n tier: options.tier ?? \"sealed\",\n idempotencyKey: options.idempotencyKey,\n nondeterministic: options.nondeterministic,\n retryPolicy: options.retryPolicy,\n attemptTimeoutMs,\n heartbeatTimeoutMs,\n fileBoundary: options.fileBoundary,\n annotations,\n requirement,\n annotate(key: Context.Key<any, any>, value: any) {\n return makeDeclared(tag, {\n ...lowered,\n annotations: Context.add(annotations, key, value)\n }, site)\n },\n annotateMerge(context: Context.Context<any>) {\n return makeDeclared(tag, {\n ...lowered,\n annotations: Context.merge(annotations, context)\n }, site)\n },\n call(payload) {\n return Node.actionCall<Success[\"Type\"], Error[\"Type\"]>(self, tag, payload)\n },\n toLayer(execute, registrationOptions) {\n if (registrationOptions?.implementationVersion !== implementationVersion) {\n throw new ImplementationVersionMismatch({\n actionName: tag,\n declaredVersion: implementationVersion ?? null,\n registeredVersion: registrationOptions?.implementationVersion ?? null,\n message: `Action \"${tag}\" requires its declared implementationVersion at registration.`\n })\n }\n // The flow form of this action: same tag, same schemas, and a body that\n // is the one call to it. Registering that flow is what lets a caller\n // `execute` the action as a durable execution of its own, and the body\n // says truthfully what such an execution does. It stays INTERNAL — a flow\n // carries a body and never a handler, so `Flow` has no `toLayer` for an\n // author to reach this seam with.\n //\n // The private constructor preserves the ordinary flow representation\n // without importing the public constructor back through this action.\n const registration = DeclarationSite.annotate(\n makeProto({\n _tag: tag,\n payloadSchema,\n successSchema,\n errorSchema,\n annotations,\n body: (payload) => Node.actionCall<Success[\"Type\"], Error[\"Type\"]>(self, tag, payload)\n }),\n DeclarationSite.capture()\n )\n const action = (payload: PayloadSchema[\"Type\"]) =>\n makeInline({\n name: tag,\n implementationVersion,\n success: successSchema,\n error: errorSchema,\n tier: self.tier,\n idempotencyKey: typeof self.idempotencyKey === \"function\"\n ? self.idempotencyKey(payload)\n : self.idempotencyKey,\n nondeterministic: self.nondeterministic,\n retryPolicy: options.retryPolicy,\n attemptTimeoutMs,\n heartbeatTimeoutMs,\n interruptRetryPolicy: options.interruptRetryPolicy,\n fileBoundary: typeof options.fileBoundary === \"function\"\n ? options.fileBoundary(payload)\n : options.fileBoundary,\n annotations,\n execute: execute(payload)\n })\n // The implementation, provided under the requirement this declaration\n // minted. That is the compile-time half: a body that called this action\n // produced a node requiring the tag, and this layer is the only thing\n // that answers it, so a plan cannot reach `execute` without its code.\n //\n // The name-keyed table is the run-time half and stays exactly as it was.\n // A driver expanding a persisted plan has no types left to consult and\n // resolves by tag, so the same implementation is filed there when a\n // composition wired a table up. The table is optional on purpose: a\n // composition that only executes handlers registered directly with the\n // runtime has no use for it, and requiring it would change what every\n // existing `toLayer` call site must provide.\n const implement = Layer.effect(requirement)(Effect.gen(function*() {\n const services = yield* Effect.context<never>()\n // The captured context is what the runtime's own `register` captures\n // for the handler path: the services the implementation was wired with,\n // overridable by whatever the run provides on top of them.\n const provided = (payload: unknown) =>\n Effect.flatMap(\n // A driver assembles this payload from plan values rather than from\n // a typed call site, so the declaration validates it exactly as\n // `Flow.execute` validates a caller's. The cast is the erasure that\n // hands an unknown to the constructor; `makeEffect` is what decides\n // whether it was one.\n Effect.orDie(payloadSchema.makeEffect(payload as never)),\n (decoded) => action(decoded)\n ).pipe(Effect.updateContext((input) => Context.merge(services, input) as Context.Context<any>))\n const implementation: Implementation = {\n name: tag,\n ...(implementationVersion === undefined ? {} : { implementationVersion }),\n action: provided as Implementation[\"action\"]\n }\n const table = yield* Effect.serviceOption(Implementations)\n if (Option.isSome(table)) yield* table.value.add(implementation, registrationOptions)\n return implementation\n }))\n return Layer.merge(\n Layer.effectDiscard(\n Effect.flatMap(FlowRuntime, (engine) => engine.register(registration, action))\n ),\n implement\n )\n }\n }\n return DeclarationSite.annotate(self, site)\n}\n\n/**\n * Creates either an inline executable action or a named action\n * declaration, selected by whether the first argument is a string.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const make: {\n <\n const Tag extends string,\n Payload extends Schema.Struct.Fields | Flow.AnyStructSchema,\n Success extends Schema.Top = Schema.Void,\n Error extends Schema.Top = Schema.Never\n >(tag: Tag, options: DeclaredOptions<Payload, Success, Error>): Declared<\n Tag,\n Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload,\n Success,\n Error\n >\n <\n R,\n Success extends Schema.Constraint = Schema.Void,\n Error extends Schema.Constraint = Schema.Never\n >(options: {\n readonly name: string\n readonly implementationVersion?: string | undefined\n readonly success?: Success | undefined\n readonly error?: Error | undefined\n readonly execute: Effect.Effect<Success[\"Type\"], Error[\"Type\"], R>\n readonly tier?: Tier | undefined\n readonly idempotencyKey?: IdempotencyKey | undefined\n readonly nondeterministic?: true | undefined\n readonly metadata?: unknown\n readonly fileBoundary?: FileBoundary | undefined\n readonly interruptRetryPolicy?: Schedule.Schedule<any, unknown> | undefined\n readonly retryPolicy?: RetryPolicy.RetryPolicy | undefined\n readonly attemptTimeoutMs?: number | undefined\n readonly heartbeatTimeoutMs?: number | undefined\n readonly annotations?: Context.Context<never> | undefined\n }): Action<Success, Error, Exclude<R, FlowInstance | FlowRuntime | Scope>>\n} = ((first: string | Parameters<typeof makeInline>[0], second?: object) => {\n if (typeof first !== \"string\") return makeInline(first)\n const options = second as Parameters<typeof makeDeclared>[1]\n return makeDeclared(\n first,\n options,\n options.declaredFrom === undefined ? DeclarationSite.capture() : DeclarationSite.declaredAt(options.declaredFrom)\n )\n}) as any\n\n/**\n * Declares a SYSTEM action: one whose implementation ships with the engine\n * rather than with the composition that calls it.\n *\n * It is {@link make}'s declared form in every respect except the requirement.\n * A system declaration mints none, so `.call()` records a node that demands\n * nothing and a body using {@link module:Sleep} or {@link module:WaitFor} does\n * not push a layer obligation onto its callers. That is the whole difference,\n * and it is a deliberate hole in the compile-time enforcement: the engine owns\n * these implementations, so an author cannot be the one who forgot them.\n *\n * Everything else is unchanged — the layer still registers with the runtime and\n * still files itself in {@link module:Implementations.Implementations}, so a\n * driver resolves a system action by tag exactly like any other.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const makeSystem = <\n const Tag extends string,\n Payload extends Schema.Struct.Fields | Flow.AnyStructSchema,\n Success extends Schema.Top = Schema.Void,\n Error extends Schema.Top = Schema.Never\n>(tag: Tag, options: DeclaredOptions<Payload, Success, Error>): Declared<\n Tag,\n Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload,\n Success,\n Error,\n never\n> =>\n // The erasure IS the declaration: the value still provides its requirement\n // from `toLayer`, and dropping it from `call` only means nothing asks for it.\n // Providing a service no one requires is always sound; the reverse would not\n // be, which is why this is the one place the channel is written off.\n makeDeclared(\n tag,\n options,\n options.declaredFrom === undefined ? DeclarationSite.capture() : DeclarationSite.declaredAt(options.declaredFrom)\n ) as unknown as Declared<\n Tag,\n Payload extends Schema.Struct.Fields ? Schema.Struct<Payload> : Payload,\n Success,\n Error,\n never\n >\n\n/**\n * Validates one declared attempt bound. An invalid bound is a programmer\n * error thrown at declaration, like `Flow.make`'s `maxRounds`.\n */\nconst timeoutMs = (name: string, field: string, value: number | undefined): number | undefined => {\n if (value === undefined) return undefined\n if (!Number.isSafeInteger(value) || value < 1) {\n throw new RangeError(`Action.make: \"${name}\" ${field} must be a positive safe integer`)\n }\n return value\n}\n\n/**\n * Bounds one attempt by its declared timeouts. An expired bound interrupts the\n * body and dies with {@link AttemptTimedOut}, which the engine's retry\n * decision point counts as a retryable attempt failure. A defect the body\n * raises while it is being interrupted is kept beside the timeout, so the\n * attempt is not mistaken for a clean timeout and retried past it.\n *\n * Every attempt gets its own heartbeat, a no-op without `heartbeatTimeoutMs`,\n * so a nested action never feeds the watchdog of the action that called it.\n */\nconst boundAttempt = (\n name: string,\n attemptTimeoutMs: number | undefined,\n heartbeatTimeoutMs: number | undefined\n) =>\n<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n heartbeatTimeoutMs === undefined && attemptTimeoutMs === undefined\n ? Effect.provideService(effect, CurrentHeartbeat, Effect.void)\n : Effect.gen(function*() {\n const attempt = yield* CurrentAttempt\n // Each heartbeat completes the signal the watchdog is waiting on and\n // installs a fresh one. Waiting on sleeps rather than reading the clock\n // keeps the gap immune to wall-clock adjustments.\n let signal = Deferred.makeUnsafe<void>()\n const beat = Effect.sync(() => {\n const done = signal\n signal = Deferred.makeUnsafe<void>()\n Deferred.doneUnsafe(done, Exit.void)\n })\n const expiries: Array<Effect.Effect<AttemptTimedOut[\"bound\"]>> = []\n if (attemptTimeoutMs !== undefined) {\n expiries.push(Effect.as(Effect.sleep(attemptTimeoutMs), \"attempt\" as const))\n }\n if (heartbeatTimeoutMs !== undefined) {\n expiries.push(Effect.gen(function*() {\n while (true) {\n const beaten = yield* Effect.raceFirst(\n Effect.as(Deferred.await(signal), true),\n Effect.as(Effect.sleep(heartbeatTimeoutMs), false)\n )\n if (!beaten) return \"heartbeat\" as const\n }\n }))\n }\n const body = yield* Effect.forkChild(\n Effect.provideService(effect, CurrentHeartbeat, heartbeatTimeoutMs === undefined ? Effect.void : beat),\n { startImmediately: true }\n )\n const outcome = yield* Effect.raceFirst(\n Fiber.await(body),\n Effect.raceAll(expiries)\n )\n if (typeof outcome !== \"string\") return yield* outcome\n yield* Fiber.interrupt(body)\n // The interruption was requested, so the body cannot settle with an\n // answer: an uninterruptible region it was in ends in the interrupt.\n // What remains beside the interrupt is a defect its cleanup raised.\n const cleanup = yield* Fiber.join(body).pipe(\n Effect.as([]),\n Effect.catchCause((cause) => Effect.succeed(cause.reasons.filter((reason) => !Cause.isInterruptReason(reason))))\n )\n const timeoutMs = outcome === \"attempt\" ? attemptTimeoutMs! : heartbeatTimeoutMs!\n const timedOut = new AttemptTimedOut({\n actionName: name,\n attempt,\n bound: outcome,\n timeoutMs,\n message: `Action \"${name}\" attempt ${attempt} ` +\n (outcome === \"attempt\" ? `ran past ${timeoutMs}ms` : `sent no heartbeat for ${timeoutMs}ms`)\n })\n return yield* Effect.failCause(Cause.fromReasons([Cause.makeDieReason(timedOut), ...cleanup]))\n })\n\nconst isInfraInterrupt = (value: unknown): value is InfraInterrupt =>\n Predicate.isTagged(\"@smthrs/flow/InfraInterrupt\")(value)\n\nconst retryInfraInterrupt = (\n name: string,\n policy: Schedule.Schedule<any, unknown> | undefined\n) =>\n<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n policy === undefined\n ? effect\n : Effect.suspend(() => {\n let attempts = 0\n return effect.pipe(\n // Each failed execution reaches this tap once, including the final\n // failure the schedule declines to retry, so this is the real attempt\n // count rather than an estimate derived from schedule shape.\n Effect.tapError((error) =>\n isInfraInterrupt(error)\n ? Effect.sync(() => void attempts++)\n : Effect.void\n ),\n Effect.retry({\n schedule: policy,\n while: isInfraInterrupt\n }),\n Effect.catch((error) =>\n isInfraInterrupt(error)\n ? Effect.die(\n new InfraInterruptRetriesExhausted({\n actionName: name,\n attempts,\n interrupt: error,\n message: `Action \"${name}\" infrastructure interrupt retry attempts exhausted after ` +\n `${attempts} attempts.`\n })\n )\n : Effect.fail(error)\n )\n )\n })\n\n// Untraced because action execution is retried in the flow hot path.\nconst makeExecute = Effect.fnUntraced(function*<\n R,\n Success extends Schema.Constraint = typeof Schema.Void,\n Error extends Schema.Constraint = typeof Schema.Never\n>(action: Action<Success, Error, R>) {\n const engine = yield* FlowRuntime\n const instance = yield* FlowInstance\n const attempt = yield* CurrentAttempt\n yield* Effect.annotateCurrentSpan({\n executionId: instance.executionId,\n action: action.name,\n attempt,\n tier: action.tier\n })\n const result = yield* FlowHelpers.wrapActionResult(\n engine.actionExecute(action, attempt),\n (_) => _._tag === \"Suspended\"\n )\n // An action settles with an exit or with a suspension; a handoff is a\n // FLOW settlement, and the engine's action path never produces one. The\n // narrowing is written as \"not complete\" so the third result variant needs\n // no unreachable arm of its own.\n if (result._tag !== \"Complete\") {\n yield* Effect.annotateCurrentSpan({ outcome: \"suspended\" })\n return yield* FlowHelpers.suspend(instance)\n }\n yield* Effect.annotateCurrentSpan({ outcome: result.exit._tag === \"Success\" ? \"success\" : \"failure\" })\n return yield* result.exit\n}, (effect) =>\n Effect.withSpan(effect, \"Action.execute\", {\n captureStackTrace: false\n }))\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Races actions through durable deferred execution.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import type { NonEmptyReadonlyArray } from "effect/Array";
|
|
7
|
+
import type * as Effect from "effect/Effect";
|
|
8
|
+
import type { FlowInstance, FlowRuntime } from "../FlowRuntime/index.ts";
|
|
9
|
+
import type { Action, Any } from "./Action.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Runs a non-empty collection of actions as a durable race and returns the
|
|
12
|
+
* first success using unioned success and error schemas. A losing failure is
|
|
13
|
+
* ignored while another action is still running; the race fails only when
|
|
14
|
+
* every action fails. To settle on whichever action exits first, success or
|
|
15
|
+
* failure, race `Effect.exit` of each action and unwrap the winning exit.
|
|
16
|
+
*
|
|
17
|
+
* @category racing
|
|
18
|
+
* @since 0.1.0
|
|
19
|
+
*/
|
|
20
|
+
export declare const raceAll: <const Actions extends NonEmptyReadonlyArray<Any>>(name: string, actions: Actions) => Effect.Effect<Actions[number] extends Action<infer _A, infer _E, infer _R> ? _A["Type"] : never, Actions[number] extends Action<infer _A, infer _E_1, infer _R_1> ? _E_1["Type"] : never, Effect.Services<Actions[number]> | (Actions[number] extends Action<infer Success, infer Error, infer _R_2> ? Success["DecodingServices"] | Success["EncodingServices"] | Error["DecodingServices"] | Error["EncodingServices"] : never) | FlowRuntime | FlowInstance>;
|
|
21
|
+
//# sourceMappingURL=raceAll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raceAll.d.ts","sourceRoot":"","sources":["../../../src/Action/raceAll.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAI,KAAK,CAAC,OAAO,SAAS,qBAAqB,CAAC,GAAG,CAAC,EACtE,MAAM,MAAM,EACZ,SAAS,OAAO,KACf,MAAM,CAAC,MAAM,CACd,OAAO,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,EACjF,OAAO,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,IAAE,EAAE,MAAM,IAAE,CAAC,GAAG,IAAE,CAAC,MAAM,CAAC,GAAG,KAAK,EAC/E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAChC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,OAAO,EAAE,MAAM,KAAK,EAAE,MAAM,IAAE,CAAC,GACnE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,GACjH,KAAK,CAAC,GACR,WAAW,GACX,YAAY,CAWL,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Deep reviewed and polished by a human on 2026-08-10.
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as DurableDeferred from "../DurableDeferred.js";
|
|
4
|
+
/**
|
|
5
|
+
* Runs a non-empty collection of actions as a durable race and returns the
|
|
6
|
+
* first success using unioned success and error schemas. A losing failure is
|
|
7
|
+
* ignored while another action is still running; the race fails only when
|
|
8
|
+
* every action fails. To settle on whichever action exits first, success or
|
|
9
|
+
* failure, race `Effect.exit` of each action and unwrap the winning exit.
|
|
10
|
+
*
|
|
11
|
+
* @category racing
|
|
12
|
+
* @since 0.1.0
|
|
13
|
+
*/
|
|
14
|
+
export const raceAll = (name, actions) => DurableDeferred.raceAll({
|
|
15
|
+
name: `Action/${name}`,
|
|
16
|
+
success: Schema.Union(actions.map((action) => action.successSchema)),
|
|
17
|
+
error: Schema.Union(actions.map((action) => action.errorSchema)),
|
|
18
|
+
effects: actions.map((action) => action)
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=raceAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raceAll.js","sourceRoot":"","sources":["../../../src/Action/raceAll.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAUvD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AAIxD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,IAAY,EACZ,OAAgB,EAUhB,EAAE,CACF,eAAe,CAAC,OAAO,CAAC;IACtB,IAAI,EAAE,UAAU,IAAI,EAAE;IACtB,OAAO,EAAE,MAAM,CAAC,KAAK,CACnB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAE,MAAc,CAAC,aAAa,CAAC,CACvD;IACD,KAAK,EAAE,MAAM,CAAC,KAAK,CACjB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAE,MAAc,CAAC,WAAW,CAAC,CACrD;IACD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAE,MAAc,CAAQ;CACzD,CAAQ,CAAA","sourcesContent":["// Deep reviewed and polished by a human on 2026-08-10.\n\n/**\n * Races actions through durable deferred execution.\n *\n * @since 0.1.0\n */\n\nimport type { NonEmptyReadonlyArray } from \"effect/Array\"\nimport type * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport * as DurableDeferred from \"../DurableDeferred.ts\"\nimport type { FlowInstance, FlowRuntime } from \"../FlowRuntime/index.ts\"\nimport type { Action, Any } from \"./Action.ts\"\n\n/**\n * Runs a non-empty collection of actions as a durable race and returns the\n * first success using unioned success and error schemas. A losing failure is\n * ignored while another action is still running; the race fails only when\n * every action fails. To settle on whichever action exits first, success or\n * failure, race `Effect.exit` of each action and unwrap the winning exit.\n *\n * @category racing\n * @since 0.1.0\n */\nexport const raceAll = <const Actions extends NonEmptyReadonlyArray<Any>>(\n name: string,\n actions: Actions\n): Effect.Effect<\n Actions[number] extends Action<infer _A, infer _E, infer _R> ? _A[\"Type\"] : never,\n Actions[number] extends Action<infer _A, infer _E, infer _R> ? _E[\"Type\"] : never,\n | Effect.Services<Actions[number]>\n | (Actions[number] extends Action<infer Success, infer Error, infer _R>\n ? Success[\"DecodingServices\"] | Success[\"EncodingServices\"] | Error[\"DecodingServices\"] | Error[\"EncodingServices\"]\n : never)\n | FlowRuntime\n | FlowInstance\n> =>\n DurableDeferred.raceAll({\n name: `Action/${name}`,\n success: Schema.Union(\n actions.map((action) => (action as any).successSchema)\n ),\n error: Schema.Union(\n actions.map((action) => (action as any).errorSchema)\n ),\n effects: actions.map((action) => (action as any)) as any\n }) as any\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retries effects while preserving durable action identity.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import type * as Types from "effect/Types";
|
|
8
|
+
/**
|
|
9
|
+
* Retries an effect with `Effect.retry` while updating `CurrentAttempt` for
|
|
10
|
+
* each attempt.
|
|
11
|
+
*
|
|
12
|
+
* @category error handling
|
|
13
|
+
* @since 0.1.0
|
|
14
|
+
*/
|
|
15
|
+
export declare const retry: {
|
|
16
|
+
<E, O extends Types.NoExcessProperties<Omit<Effect.Retry.Options<E>, "schedule">, O>>(options: O): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Retry.Return<R, E, A, O>;
|
|
17
|
+
<A, E, R, O extends Types.NoExcessProperties<Omit<Effect.Retry.Options<E>, "schedule">, O>>(self: Effect.Effect<A, E, R>, options: O): Effect.Retry.Return<R, E, A, O>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/Action/retry.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAG1C;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE;IAClB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,EAClF,OAAO,EAAE,CAAC,GACT,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,EACxF,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,OAAO,EAAE,CAAC,GACT,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAgEnC,CAAA"}
|