@smthrs/flow 0.0.0-stage → 1.0.0-rc.12
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 +161 -0
- package/LICENSE +21 -0
- package/README.md +212 -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 +387 -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 +110 -0
- package/dist/cjs/Deadline.d.ts.map +1 -0
- package/dist/cjs/Deadline.js +112 -0
- package/dist/cjs/Deadline.js.map +7 -0
- package/dist/cjs/DurableClock.d.ts +60 -0
- package/dist/cjs/DurableClock.d.ts.map +1 -0
- package/dist/cjs/DurableClock.js +107 -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 +339 -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 +186 -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 +135 -0
- package/dist/cjs/Flow/make.d.ts.map +1 -0
- package/dist/cjs/Flow/make.js +107 -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 +204 -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 +177 -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 +1020 -0
- package/dist/cjs/Graph.js.map +7 -0
- package/dist/cjs/HumanTask.d.ts +442 -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 +223 -0
- package/dist/cjs/Interpreter.d.ts.map +1 -0
- package/dist/cjs/Interpreter.js +908 -0
- package/dist/cjs/Interpreter.js.map +7 -0
- package/dist/cjs/Poll.d.ts +240 -0
- package/dist/cjs/Poll.d.ts.map +1 -0
- package/dist/cjs/Poll.js +154 -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 +141 -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 +413 -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 +110 -0
- package/dist/esm/Deadline.d.ts.map +1 -0
- package/dist/esm/Deadline.js +164 -0
- package/dist/esm/Deadline.js.map +1 -0
- package/dist/esm/DurableClock.d.ts +60 -0
- package/dist/esm/DurableClock.d.ts.map +1 -0
- package/dist/esm/DurableClock.js +122 -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 +252 -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 +135 -0
- package/dist/esm/Flow/make.d.ts.map +1 -0
- package/dist/esm/Flow/make.js +111 -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 +204 -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 +177 -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 +1485 -0
- package/dist/esm/Graph.js.map +1 -0
- package/dist/esm/HumanTask.d.ts +442 -0
- package/dist/esm/HumanTask.d.ts.map +1 -0
- package/dist/esm/HumanTask.js +798 -0
- package/dist/esm/HumanTask.js.map +1 -0
- package/dist/esm/Interpreter.d.ts +223 -0
- package/dist/esm/Interpreter.d.ts.map +1 -0
- package/dist/esm/Interpreter.js +1289 -0
- package/dist/esm/Interpreter.js.map +1 -0
- package/dist/esm/Poll.d.ts +240 -0
- package/dist/esm/Poll.d.ts.map +1 -0
- package/dist/esm/Poll.js +289 -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 +256 -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 +152 -0
- package/docs/api.md +440 -0
- package/docs/concepts/bodies-and-plans.md +167 -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 +164 -0
- package/docs/guides/cancel-and-roll-back.md +112 -0
- package/docs/guides/implement-an-action.md +155 -0
- package/docs/guides/inspect-the-plan.md +235 -0
- package/docs/guides/poll-until-ready.md +169 -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 +129 -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 +87 -0
- package/docs/quickstart.md +164 -0
- package/docs/reference/flow.md +1835 -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 +671 -0
- package/src/Action/raceAll.ts +48 -0
- package/src/Action/retry.ts +92 -0
- package/src/Deadline.ts +201 -0
- package/src/DurableClock.ts +176 -0
- package/src/DurableDeferred.ts +753 -0
- package/src/DurableQueue.ts +519 -0
- package/src/ExternalJob.ts +437 -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 +339 -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 +285 -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 +339 -0
- package/src/FlowRuntime/NodeRecord.ts +185 -0
- package/src/FlowRuntime/WaitingAnnotation.ts +85 -0
- package/src/FlowRuntime/index.ts +17 -0
- package/src/Graph.ts +1865 -0
- package/src/HumanTask.ts +1007 -0
- package/src/Interpreter.ts +1620 -0
- package/src/Poll.ts +420 -0
- package/src/RetryPolicy.ts +550 -0
- package/src/Sleep.ts +296 -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,1835 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "@smthrs/flow"
|
|
3
|
+
description: "What @smthrs/flow exports: the flow, action, runtime-port, and durable-primitive namespaces, with types and defaults from source."
|
|
4
|
+
area: api
|
|
5
|
+
order: 10
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Install the package with its `effect` peer:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @smthrs/flow@next effect
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Entry points
|
|
15
|
+
|
|
16
|
+
The `exports` map declares these subpaths:
|
|
17
|
+
|
|
18
|
+
| Import | Source | Platform |
|
|
19
|
+
| ------------------------------- | -------------------------------- | -------- |
|
|
20
|
+
| `@smthrs/flow` | `src/index.ts` | any |
|
|
21
|
+
| `@smthrs/flow/Action` | `src/Action/index.ts` | any |
|
|
22
|
+
| `@smthrs/flow/CacheEnvironment` | `src/Action/CacheEnvironment.ts` | any |
|
|
23
|
+
| `@smthrs/flow/FileBoundary` | `src/Action/FileBoundary.ts` | any |
|
|
24
|
+
| `@smthrs/flow/FileInput` | `src/Action/FileInput.ts` | any |
|
|
25
|
+
| `@smthrs/flow/Flow` | `src/Flow/index.ts` | any |
|
|
26
|
+
| `@smthrs/flow/FlowRuntime` | `src/FlowRuntime/index.ts` | any |
|
|
27
|
+
| `@smthrs/flow/StepIdentity` | `src/Action/StepIdentity.ts` | any |
|
|
28
|
+
| `@smthrs/flow/<Module>` | `src/<Module>.ts` | any |
|
|
29
|
+
|
|
30
|
+
`<Module>` is one of the top-level modules, each listed explicitly in the `exports` map: `Deadline`, `DurableClock`, `DurableDeferred`, `DurableQueue`, `Fault`, `Graph`, `HumanTask`, `Interpreter`, `Poll`, `RetryPolicy`, `Sleep`, `Stall`, and `WaitFor`. No `./*` wildcard is declared. The `exports` map maps `./internal/*`, `./*/index`, `./Action/*`, `./Flow/*`, and `./FlowRuntime/*` to `null`, so those paths do not resolve.
|
|
31
|
+
|
|
32
|
+
## Namespaces
|
|
33
|
+
|
|
34
|
+
The package index re-exports seventeen namespaces:
|
|
35
|
+
|
|
36
|
+
| Namespace | Summary |
|
|
37
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
38
|
+
| `Action` | Durable action definitions and combinators. |
|
|
39
|
+
| `Deadline` | The wall-clock bound one run settles by, shared across its rounds. |
|
|
40
|
+
| `DurableClock` | Durable clock and timer services. |
|
|
41
|
+
| `DurableDeferred` | Durable deferred values. |
|
|
42
|
+
| `DurableQueue` | Durable queues. |
|
|
43
|
+
| `Fault` | One typed fault class per failure, and the response ladder. |
|
|
44
|
+
| `Flow` | Durable flow definitions. |
|
|
45
|
+
| `FlowRuntime` | The execution contract flow authoring APIs are written against. |
|
|
46
|
+
| `Graph` | Plan-time graph building from flow declarations. |
|
|
47
|
+
| `HumanTask` | Asking a person something: typed answers, re-asking, and a deadline. |
|
|
48
|
+
| `Interpreter` | Execution of a flow body, and the layer that registers it. |
|
|
49
|
+
| `Poll` | The durable poller: attempts as rounds, waits as durable timers. |
|
|
50
|
+
| `RetryPolicy` | Retry policy models and constructors. |
|
|
51
|
+
| `Sleep` | The system timer action and its implementation layer. |
|
|
52
|
+
| `Stall` | The stall breaker round loops share. |
|
|
53
|
+
| `StepIdentity` | Stable step identity construction. |
|
|
54
|
+
| `WaitFor` | The system wait-point action and its implementation layer. |
|
|
55
|
+
|
|
56
|
+
## Action
|
|
57
|
+
|
|
58
|
+
`Action` exports 45 symbols. Its models and schemas are listed in one table, and constructors, combinators, layers, context references, services, and errors get their own entries:
|
|
59
|
+
|
|
60
|
+
| Name | Kind | Summary |
|
|
61
|
+
| -------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `Tier` | Schema and type | The durability and retry semantics of an action: `"sealed"`, `"compensable"`, or `"irreversible"`. It IS `@smthrs/plan`'s `Effects.Tier`. |
|
|
63
|
+
| `IdempotencyKey` | Schema and type | Caller-declared sealed action identity: a string, or a record of JSON values. |
|
|
64
|
+
| `PlannedPayload` | Type | Recursively permits planned references wherever a declared action payload accepts a concrete value. |
|
|
65
|
+
| `Requirement` | Interface | The requirement one declared action mints for itself, identified by its tag. |
|
|
66
|
+
| `Declared` | Interface | A named action declaration whose implementation attaches later through a layer. It carries `name`, `payloadSchema`, `successSchema`, `errorSchema`, `tier`, `idempotencyKey`, `nondeterministic`, `annotations`, and `requirement`, and exposes `call`, `toLayer`, `annotate`, and `annotateMerge`. |
|
|
67
|
+
| `Action` | Interface | An inline durable action that is itself an `Effect`. It carries `name`, `successSchema`, `errorSchema`, `exitSchema`, `exitSchemaPartial`, `annotations`, `tier`, `idempotencyKey`, `nondeterministic`, `metadata`, and `retryPolicy`. |
|
|
68
|
+
| `Any` | Interface | Type-erased action shape carrying only identity, name, annotations, and encoded execution. |
|
|
69
|
+
| `AnyWithProps` | Interface | Type-erased action shape that also exposes success and error schemas. |
|
|
70
|
+
| `BoundaryMode` | Schema and type | How strictly an action's filesystem boundary is enforced: `"hard"` or `"expected"`. It IS `@smthrs/plan`'s `FileSet.BoundaryMode`. |
|
|
71
|
+
| `CacheEnvironment` | Schema and type | The complete runtime environment included in every cross-run cache key: `layers` and `capabilities`. |
|
|
72
|
+
| `CacheScope` | Schema and type | How far a recorded sealed result may travel: `"run"`, `"flow"`, or `"shared"`. |
|
|
73
|
+
| `CachePolicy` | Schema and type | The caller's declaration about the decay and the reach of a sealed action's recorded result. |
|
|
74
|
+
| `FileBoundary` | Schema and type | The filesystem boundary of an action: `readSet`, `writeSet`, optional `removes`, and `boundaryMode`. |
|
|
75
|
+
| `FileInput` | Schema and type | An input file path paired with its measured content digest. |
|
|
76
|
+
| `Implementation` | Interface | One declared action's implementation as a driver consumes it: a name, and the durable action a payload produces. |
|
|
77
|
+
| `AllocationIdentity` | Interface | The declaration material an allocation scope is derived from: `kind`, `name`, optional `idempotency`, and optional `site`. |
|
|
78
|
+
|
|
79
|
+
### `Action.CachePolicyAnnotation`
|
|
80
|
+
|
|
81
|
+
- **Type:** `Context.Service<CachePolicy>`
|
|
82
|
+
- **Since:** `0.1.0`
|
|
83
|
+
- **Related:** [`Action.withCache`](#actionwithcache)
|
|
84
|
+
|
|
85
|
+
The annotation key a declaration carries its `CachePolicy` under. The policy is an annotation rather than a field on the action, so adding it changes no existing call site. Its identifier is `"@smthrs/flow/Action/CachePolicy"`.
|
|
86
|
+
|
|
87
|
+
### `Action.cachePolicyOf`
|
|
88
|
+
|
|
89
|
+
- **Signature:** `cachePolicyOf(annotations: Context.Context<never>): CachePolicy | undefined`
|
|
90
|
+
- **Since:** `0.1.0`
|
|
91
|
+
|
|
92
|
+
Reads the cache policy an annotation bag carries. Returns `undefined` when the bag carries none.
|
|
93
|
+
|
|
94
|
+
### `Action.withCache`
|
|
95
|
+
|
|
96
|
+
- **Signature:** `withCache<A extends { annotate: (key: typeof CachePolicyAnnotation, value: CachePolicy) => A }>(action: A, policy: CachePolicy): A`
|
|
97
|
+
- **Since:** `0.1.0`
|
|
98
|
+
|
|
99
|
+
Returns a copy of the action annotated with a cache policy. The action is not mutated: `annotate` returns a separate declaration, and that copy is what a plan captures. `ttlMs` bounds the age of a row the engine may serve, and `scope` narrows the address the row is stored under.
|
|
100
|
+
|
|
101
|
+
### `Action.CurrentCacheEnvironment`
|
|
102
|
+
|
|
103
|
+
- **Type:** `Context.Reference<CacheEnvironment | undefined>`
|
|
104
|
+
- **Default:** `undefined`
|
|
105
|
+
- **Since:** `0.1.0`
|
|
106
|
+
|
|
107
|
+
The complete environment folded into reusable action keys. A composition either provides a complete `CacheEnvironment` or leaves it absent. When it is absent the engine scopes action keys to the current run instead of presenting incomplete environment data as reusable identity.
|
|
108
|
+
|
|
109
|
+
### `Action.layerCacheEnvironment`
|
|
110
|
+
|
|
111
|
+
- **Signature:** `layerCacheEnvironment(environment: CacheEnvironment): Layer.Layer<never>`
|
|
112
|
+
- **Since:** `0.1.0`
|
|
113
|
+
|
|
114
|
+
Declares the complete cache environment of a composition as a layer.
|
|
115
|
+
|
|
116
|
+
### `Action.OrdinalSlot`
|
|
117
|
+
|
|
118
|
+
- **Type:** `interface OrdinalSlot { readonly values: Map<string, Array<number>>; readonly cursors: Map<string, number> }`
|
|
119
|
+
- **Since:** `0.1.0`
|
|
120
|
+
|
|
121
|
+
The ordinal slots a retry sequence shares across its attempts, keyed by allocation scope. A nested block shares the pinned `values` with the enclosing block and owns a private `cursors` view seeded at block entry.
|
|
122
|
+
|
|
123
|
+
### `Action.CurrentOrdinal`
|
|
124
|
+
|
|
125
|
+
- **Type:** `Context.Reference<OrdinalSlot | undefined>`
|
|
126
|
+
- **Default:** `undefined`
|
|
127
|
+
- **Since:** `0.1.0`
|
|
128
|
+
|
|
129
|
+
The ordinal slot of the enclosing `Action.retry` sequence, when one is present.
|
|
130
|
+
|
|
131
|
+
### `Action.CurrentAttempt`
|
|
132
|
+
|
|
133
|
+
- **Type:** `Context.Reference<number>`
|
|
134
|
+
- **Default:** `1`
|
|
135
|
+
- **Since:** `0.1.0`
|
|
136
|
+
|
|
137
|
+
The current durable retry attempt, counted from one.
|
|
138
|
+
|
|
139
|
+
### `Action.CurrentInvocationKey`
|
|
140
|
+
|
|
141
|
+
- **Type:** `Context.Reference<string | undefined>`
|
|
142
|
+
- **Default:** `undefined`
|
|
143
|
+
- **Since:** `0.1.0`
|
|
144
|
+
|
|
145
|
+
The persisted key of the dispatch an implementation is running under, when the runtime supplies one.
|
|
146
|
+
|
|
147
|
+
### `Action.DuplicateImplementation`
|
|
148
|
+
|
|
149
|
+
- **Type:** `Schema.TaggedError` with field `name: string`
|
|
150
|
+
- **Since:** `0.1.0`
|
|
151
|
+
|
|
152
|
+
The defect layer construction dies with when a second, different implementation registers for an action tag without `{ override: true }`.
|
|
153
|
+
|
|
154
|
+
### `Action.InfraInterrupt`
|
|
155
|
+
|
|
156
|
+
- **Type:** `Schema.TaggedError` with fields `code: "infra_interrupt"` and `reason?: unknown`
|
|
157
|
+
- **Since:** `0.1.0`
|
|
158
|
+
|
|
159
|
+
The marker an action implementation or adapter explicitly fails with for an infrastructure event it wants retried under the action's `interruptRetryPolicy`. The shipped engines do not synthesize it from ordinary fiber interruption.
|
|
160
|
+
|
|
161
|
+
### `Action.InfraInterruptRetriesExhausted`
|
|
162
|
+
|
|
163
|
+
- **Type:** `Schema.TaggedError` with fields `code: "infra_interrupt_retries_exhausted"`, `actionName: string`, `attempts: number`, `interrupt: InfraInterrupt`, and `message: string`
|
|
164
|
+
- **Since:** `0.1.0`
|
|
165
|
+
|
|
166
|
+
The identity an action dies with after spending its `interruptRetryPolicy` without reaching an ordinary success or failure.
|
|
167
|
+
|
|
168
|
+
### `Action.IrreversibleRetryRequiresIdempotencyKey`
|
|
169
|
+
|
|
170
|
+
- **Type:** `Schema.TaggedError` with fields `code: "irreversible_retry_requires_idempotency_key"`, `actionName: string`, and `attempt: number`
|
|
171
|
+
- **Since:** `0.1.0`
|
|
172
|
+
|
|
173
|
+
An irreversible action attempted a retry without declaring an idempotency key.
|
|
174
|
+
|
|
175
|
+
### `Action.ConcurrentKeylessDispatch`
|
|
176
|
+
|
|
177
|
+
- **Type:** `Schema.TaggedError` with fields `code: "concurrent_keyless_dispatch"` and `actionName: string`
|
|
178
|
+
- **Since:** `0.1.0`
|
|
179
|
+
|
|
180
|
+
Two ordinal-keyed invocations of one allocation scope were in flight at once, so fiber arrival order would assign their ordinals, step keys, attempt rows, and recorded outcomes. Declare an `idempotencyKey` that distinguishes the invocations to dispatch them concurrently. A sealed action with a key takes a pure cache key and is exempt.
|
|
181
|
+
|
|
182
|
+
### `Action.UncanonicalIdempotencyKey`
|
|
183
|
+
|
|
184
|
+
- **Type:** `Schema.TaggedError` with fields `code: "uncanonical_idempotency_key"`, `actionName: string`, `reason: string`, `path: string`, and `message: string`
|
|
185
|
+
- **Since:** `0.1.0`
|
|
186
|
+
|
|
187
|
+
A caller-declared object-form `idempotencyKey` carried material that canonical serialization rejects. The failure is not retryable: the same declaration derives the same rejection on every attempt, so the body never runs.
|
|
188
|
+
|
|
189
|
+
### `Action.Filegroup`
|
|
190
|
+
|
|
191
|
+
- **Type:** namespace re-exporting `Filegroup` (a `Schema.TaggedStruct` of `name` and `entries`), the type alias `Type`, and `make`
|
|
192
|
+
- **Since:** `0.1.0`
|
|
193
|
+
|
|
194
|
+
Named reusable filesystem declaration groups. `Action.Filegroup.make` creates one.
|
|
195
|
+
|
|
196
|
+
### `Action.Glob`
|
|
197
|
+
|
|
198
|
+
- **Type:** namespace re-exporting `Glob`, `Pattern`, `matchesGlob`, `matchesPattern`, and the type alias `Type`
|
|
199
|
+
- **Since:** `0.1.0`
|
|
200
|
+
|
|
201
|
+
The Bazel-style file glob vocabulary. `Glob` is a `Schema.TaggedStruct` of `include` and optional `exclude` patterns.
|
|
202
|
+
|
|
203
|
+
### `Action.idempotencyKey`
|
|
204
|
+
|
|
205
|
+
- **Signature:** `idempotencyKey(name: string, options?: { readonly includeAttempt?: boolean | undefined; readonly parentScope?: string | undefined }): Effect.Effect<string, never, FlowInstance | Crypto.Crypto>`
|
|
206
|
+
- **Since:** `0.1.0`
|
|
207
|
+
|
|
208
|
+
Computes the run-local invocation key of an internal durable operation. The key is scoped by the caller's declaration name and declared `parentScope`.
|
|
209
|
+
|
|
210
|
+
### `Action.Implementations`
|
|
211
|
+
|
|
212
|
+
- **Type:** `Context.Service` keyed `"@smthrs/flow/Action/Implementations"`
|
|
213
|
+
- **Since:** `0.1.0`
|
|
214
|
+
- **Related:** [`Action.layerImplementations`](#actionlayerimplementations)
|
|
215
|
+
|
|
216
|
+
The table holding the declared action implementations a composition wired up, keyed by action tag. A second, different implementation of one tag dies with `Action.DuplicateImplementation` unless it registers with `toLayer(handler, { override: true })`. An override shadows the earlier registration, and closing the overriding scope restores it. Registering the same implementation object again is not a conflict.
|
|
217
|
+
|
|
218
|
+
### `Action.layerImplementations`
|
|
219
|
+
|
|
220
|
+
- **Type:** `Layer.Layer<Implementations>`
|
|
221
|
+
- **Since:** `0.1.0`
|
|
222
|
+
|
|
223
|
+
The implementation table, scoped to the composition that builds it. Filing an implementation is a build-time effect, so provide this layer under the implementation layers with `Layer.provideMerge` rather than merging it beside them.
|
|
224
|
+
|
|
225
|
+
### `Action.make`
|
|
226
|
+
|
|
227
|
+
- **Signature:** `make(tag: Tag, options: { payload, declaredFrom?, implementationVersion?, success?, error?, tier?, idempotencyKey?, nondeterministic?, retryPolicy?, interruptRetryPolicy?, fileBoundary?, annotations? }): Declared<Tag, Payload, Success, Error>`
|
|
228
|
+
- **Signature:** `make(options: { name, success?, error?, execute, tier?, idempotencyKey?, nondeterministic?, metadata?, interruptRetryPolicy?, retryPolicy?, annotations? }): Action<Success, Error, R>`
|
|
229
|
+
- **Since:** `0.1.0`
|
|
230
|
+
- **Related:** [`Action.makeSystem`](#actionmakesystem)
|
|
231
|
+
|
|
232
|
+
Creates either a named action declaration or an inline executable action, selected by whether the first argument is a string. The declared form is pure data whose implementation attaches later through `Declared.toLayer`. The inline form carries its `execute` effect directly.
|
|
233
|
+
|
|
234
|
+
The declared form accepts `declaredFrom: original` to retain a native declaration's
|
|
235
|
+
diagnostic source location, including its absence. The new action owns its call
|
|
236
|
+
closures; this option changes neither dispatch identity nor key material.
|
|
237
|
+
|
|
238
|
+
| Option | Forms | Meaning |
|
|
239
|
+
| ----------------------- | -------- | ------------------------------------------------------------------------------- |
|
|
240
|
+
| `payload` | declared | Payload fields or struct schema, validated on every dispatch. |
|
|
241
|
+
| `name`, `execute` | inline | The step name and the effect it runs. |
|
|
242
|
+
| `implementationVersion` | declared | Non-empty version string; `toLayer` must pass the same value. |
|
|
243
|
+
| `success`, `error` | both | Result schemas. Default `Schema.Void` and `Schema.Never`. |
|
|
244
|
+
| `tier` | both | Durability tier. Default `"sealed"`. |
|
|
245
|
+
| `idempotencyKey` | both | Caller identity. The declared form may compute it from the decoded payload. |
|
|
246
|
+
| `nondeterministic` | both | Marks a result that replay must read from the record rather than recompute. |
|
|
247
|
+
| `retryPolicy` | both | The `RetryPolicy` the engine reads at dispatch. |
|
|
248
|
+
| `interruptRetryPolicy` | both | The `Schedule` spent on `Action.InfraInterrupt` failures. |
|
|
249
|
+
| `fileBoundary` | both | Typed file boundary. The declared form may compute it from the decoded payload. |
|
|
250
|
+
| `metadata` | inline | Free-form metadata; a historical boundary declaration is still read from it. |
|
|
251
|
+
| `annotations` | both | Context annotations carried by the action. |
|
|
252
|
+
|
|
253
|
+
`Declared.toLayer(handler, { implementationVersion?, override? })` registers the implementation. Without `override: true`, a second, different implementation of the tag dies with `Action.DuplicateImplementation`.
|
|
254
|
+
|
|
255
|
+
### `Action.makeSystem`
|
|
256
|
+
|
|
257
|
+
- **Signature:** `makeSystem(tag: Tag, options: { payload, declaredFrom?, implementationVersion?, success?, error?, tier?, idempotencyKey?, nondeterministic?, retryPolicy?, interruptRetryPolicy?, fileBoundary?, annotations? }): Declared<Tag, Payload, Success, Error, never>`
|
|
258
|
+
- **Since:** `0.1.0`
|
|
259
|
+
|
|
260
|
+
Declares a system action, one whose implementation ships with the engine rather than with the composition that calls it. It matches `Action.make`'s declared form in every respect except the requirement: a system declaration mints none, so a body using `Sleep` or `WaitFor` pushes no layer obligation onto its callers.
|
|
261
|
+
|
|
262
|
+
### `Action.raceAll`
|
|
263
|
+
|
|
264
|
+
- **Signature:** `raceAll(name: string, actions: Actions): Effect.Effect<...>`
|
|
265
|
+
- **Since:** `0.1.0`
|
|
266
|
+
|
|
267
|
+
Runs a non-empty collection of actions as a durable race and returns the first success, under the unioned success and error schemas. A losing failure is ignored while another action runs; the race fails only when every action fails. To settle on the first exit, success or failure, race `Effect.exit` of each action and unwrap the winner. One winner is persisted under `name`, so a re-driven round replays it instead of racing again. The race requires every action's services, including `Crypto`, plus the decoding and encoding services of each action's success and error schemas.
|
|
268
|
+
|
|
269
|
+
### `Action.retry`
|
|
270
|
+
|
|
271
|
+
- **Signature:** `retry(self: Effect.Effect<A, E, R>, options: O): Effect.Retry.Return<R, E, A, O>`
|
|
272
|
+
- **Since:** `0.1.0`
|
|
273
|
+
|
|
274
|
+
Retries an effect with `Effect.retry` while updating `CurrentAttempt` on each attempt. The `schedule` option of `Effect.Retry.Options` is omitted. Every attempt of one sequence reuses its own action's ordinals, and a nested block shares the enclosing block's pinned slot.
|
|
275
|
+
|
|
276
|
+
### `Action.DispatchSite`
|
|
277
|
+
|
|
278
|
+
- **Type:** `Context.Service<DispatchSite, string>` keyed `"@smthrs/flow/Action/DispatchSite"`
|
|
279
|
+
- **Since:** `0.1.0`
|
|
280
|
+
|
|
281
|
+
The interpreter graph site the running dispatch is scoped to. Distinct graph sites refine the allocation scope, so they do not contend for one ordinal counter.
|
|
282
|
+
|
|
283
|
+
### `Action.DispatchOutcome`
|
|
284
|
+
|
|
285
|
+
- **Type:** `interface DispatchOutcome { readonly outcome: "executed" | "replayed"; readonly stepKeyDigest?: string | undefined; readonly attempt?: number | undefined }`
|
|
286
|
+
- **Since:** `1.0.0`
|
|
287
|
+
|
|
288
|
+
What one dispatch tells the node that drove it. `outcome` says whether the body ran or a durable record answered. `stepKeyDigest` is the identity the rest of the engine addresses that dispatch by, the digest `flows.engine.attempt-started` carries, and `attempt` is the durable attempt it ran as. Both are optional, because a runtime that keeps no attempt rows has neither.
|
|
289
|
+
|
|
290
|
+
### `Action.DispatchReport`
|
|
291
|
+
|
|
292
|
+
- **Type:** `Context.Service<DispatchReport, { readonly dispatched: (dispatch: DispatchOutcome) => Effect.Effect<void> }>` keyed `"@smthrs/flow/Action/DispatchReport"`
|
|
293
|
+
- **Since:** `1.0.0`
|
|
294
|
+
|
|
295
|
+
Where the dispatches of one interpreter node report what happened to them. The interpreter installs one per node and reads the report back when the node settles: it is how a replayed node is told apart from one that did the work again, how a node names the step keys its attempt records were written under, and how a node's real attempt count reaches its settlement. Absent by default: a dispatch outside an interpreted graph reports to nobody, and reporting stays a side channel rather than a change to what `actionExecute` returns.
|
|
296
|
+
|
|
297
|
+
### `Action.reportDispatch`
|
|
298
|
+
|
|
299
|
+
- **Signature:** `reportDispatch(dispatch: DispatchOutcome): Effect.Effect<void>`
|
|
300
|
+
- **Since:** `1.0.0`
|
|
301
|
+
|
|
302
|
+
Reports one dispatch to the node that drove it, and does nothing where no node did.
|
|
303
|
+
|
|
304
|
+
### `Action.allocationScope`
|
|
305
|
+
|
|
306
|
+
- **Signature:** `allocationScope(identity: AllocationIdentity): Effect.Effect<string, Schema.SchemaError, Crypto.Crypto>`
|
|
307
|
+
- **Since:** `0.1.0`
|
|
308
|
+
|
|
309
|
+
Derives the ordinal allocation scope of a durable operation from its declaration material.
|
|
310
|
+
|
|
311
|
+
### `Action.invocationKey`
|
|
312
|
+
|
|
313
|
+
- **Signature:** `invocationKey(input: { readonly runId: string; readonly parentScope?: string | undefined; readonly ordinal: number; readonly tier: "unsealed" | "compensable" | "irreversible" }): Effect.Effect<StoredKey, Schema.SchemaError, Crypto.Crypto>`
|
|
314
|
+
- **Since:** `0.1.0`
|
|
315
|
+
|
|
316
|
+
Derives an invocation key from engine-generated input.
|
|
317
|
+
|
|
318
|
+
### `Action.TreeArtifact`
|
|
319
|
+
|
|
320
|
+
- **Type:** namespace re-exporting `TreeArtifact` (a `Schema.TaggedStruct` of `path`) and the type alias `Type`
|
|
321
|
+
- **Since:** `0.1.0`
|
|
322
|
+
|
|
323
|
+
A directory output captured and replayed as one tree artifact.
|
|
324
|
+
|
|
325
|
+
## Deadline
|
|
326
|
+
|
|
327
|
+
### `Deadline.start`
|
|
328
|
+
|
|
329
|
+
- **Signature:** `start(options: { readonly flowName: string; readonly deadline?: Duration.Input | undefined; readonly startedAtMs?: number | undefined }): Effect.Effect<LineageDeadline | undefined, never, FlowRuntime | FlowInstance | Crypto.Crypto>`
|
|
330
|
+
- **Since:** `1.0.0`
|
|
331
|
+
|
|
332
|
+
Starts the current execution's deadline: the lineage deadline the round inherited from a handoff, or `deadline` counted from the execution's journaled first start (or from `startedAtMs`, when the host holds a durable start of its own), with a durable clock armed at it. Answers `undefined` when neither applies. Dies with a `RangeError` when `deadline` is not a positive finite duration, `startedAtMs` is not finite, or the deadline would expire after epoch millisecond `Number.MAX_SAFE_INTEGER`. Start at most one deadline per execution.
|
|
333
|
+
|
|
334
|
+
### `Deadline.remainingMs`
|
|
335
|
+
|
|
336
|
+
- **Signature:** `remainingMs(deadline: LineageDeadline): Effect.Effect<number>`
|
|
337
|
+
- **Since:** `1.0.0`
|
|
338
|
+
|
|
339
|
+
The whole milliseconds left before the deadline passes; zero or less once it has.
|
|
340
|
+
|
|
341
|
+
### `Deadline.within`
|
|
342
|
+
|
|
343
|
+
- **Signature:** `within(deadline: LineageDeadline | undefined, flowName: string): <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R | FlowInstance>`
|
|
344
|
+
- **Since:** `1.0.0`
|
|
345
|
+
|
|
346
|
+
Races `body` against a started deadline and settles it with `Flow.DeadlineExceeded` at the deadline, at once when it has already passed. A round that hands off stamps the deadline on its `Flow.Handoff`. `undefined` runs `body` unbounded.
|
|
347
|
+
|
|
348
|
+
### `Deadline.bound`
|
|
349
|
+
|
|
350
|
+
- **Signature:** `bound(options: { readonly flowName: string; readonly deadline?: Duration.Input | undefined; readonly startedAtMs?: number | undefined }): <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R | FlowRuntime | FlowInstance | Crypto.Crypto>`
|
|
351
|
+
- **Since:** `1.0.0`
|
|
352
|
+
|
|
353
|
+
`start`, then `within`. The engine applies it to every execution of a flow that declares `deadline`.
|
|
354
|
+
|
|
355
|
+
## DurableClock
|
|
356
|
+
|
|
357
|
+
### `DurableClock.DurableClock`
|
|
358
|
+
|
|
359
|
+
- **Type:** `interface DurableClock { readonly name: string; readonly duration: Duration.Duration; readonly deferred: DurableDeferred.DurableDeferred<typeof Schema.Void> }`
|
|
360
|
+
- **Since:** `0.1.0`
|
|
361
|
+
|
|
362
|
+
A durable flow timer: a name, a duration, and the deferred that is completed when the timer wakes. The interface also carries a private type identifier.
|
|
363
|
+
|
|
364
|
+
### `DurableClock.make`
|
|
365
|
+
|
|
366
|
+
- **Signature:** `make(options: { readonly name: string; readonly duration: Duration.Input }): DurableClock`
|
|
367
|
+
- **Since:** `0.1.0`
|
|
368
|
+
|
|
369
|
+
Declares one durable clock. Throws a `RangeError` when the duration is malformed, infinite, negative, or longer than `Number.MAX_SAFE_INTEGER` milliseconds: a durable store records a clock's due time as a safe integer.
|
|
370
|
+
|
|
371
|
+
### `DurableClock.sleep`
|
|
372
|
+
|
|
373
|
+
- **Signature:** `sleep(options: { readonly name: string; readonly duration: Duration.Input; readonly inMemoryThreshold?: Duration.Input | undefined }): Effect.Effect<void, never, Crypto.Crypto | FlowRuntime | FlowInstance>`
|
|
374
|
+
- **Default:** `inMemoryThreshold` is 60 seconds
|
|
375
|
+
- **Since:** `0.1.0`
|
|
376
|
+
|
|
377
|
+
Waits inside a flow. A duration at or below `inMemoryThreshold` runs as an in-memory action. A longer duration schedules a durable clock, so the wait outlives the process holding it. Throws a `RangeError` for a duration `make` refuses or a malformed, infinite, or negative threshold. A durable sleep that would wake after epoch millisecond `Number.MAX_SAFE_INTEGER` dies with a `RangeError` instead of arming its clock.
|
|
378
|
+
|
|
379
|
+
## DurableDeferred
|
|
380
|
+
|
|
381
|
+
### `DurableDeferred.DurableDeferred`
|
|
382
|
+
|
|
383
|
+
- **Type:** `interface DurableDeferred<Success extends Schema.Constraint, Error extends Schema.Constraint = Schema.Never>` with `name`, `successSchema`, `errorSchema`, `exitSchema`, and `withActionAttempt`
|
|
384
|
+
- **Since:** `0.1.0`
|
|
385
|
+
|
|
386
|
+
A named durable deferred whose completion the flow engine persists, encoded through its success and error schemas.
|
|
387
|
+
|
|
388
|
+
### `DurableDeferred.Any`
|
|
389
|
+
|
|
390
|
+
- **Type:** `interface Any { readonly name: string }`
|
|
391
|
+
- **Since:** `0.1.0`
|
|
392
|
+
|
|
393
|
+
The type-erased deferred shape for APIs that need only the identity and the name. It also carries the private type identifier.
|
|
394
|
+
|
|
395
|
+
### `DurableDeferred.AnyWithProps`
|
|
396
|
+
|
|
397
|
+
- **Type:** `interface AnyWithProps` with `name`, `successSchema`, `errorSchema`, and `exitSchema`
|
|
398
|
+
- **Since:** `0.1.0`
|
|
399
|
+
|
|
400
|
+
The type-erased deferred shape that also exposes the schemas.
|
|
401
|
+
|
|
402
|
+
### `DurableDeferred.make`
|
|
403
|
+
|
|
404
|
+
- **Signature:** `make(name: string, options?: { readonly success?: Success | undefined; readonly error?: Error | undefined }): DurableDeferred<Success, Error>`
|
|
405
|
+
- **Default:** `success` is `Schema.Void`, `error` is `Schema.Never`
|
|
406
|
+
- **Since:** `0.1.0`
|
|
407
|
+
|
|
408
|
+
Creates a named durable deferred for a persisted completion.
|
|
409
|
+
|
|
410
|
+
### `DurableDeferred.await`
|
|
411
|
+
|
|
412
|
+
- **Signature:** `await(self: DurableDeferred<Success, Error>): Effect.Effect<Success["Type"], Error["Type"], FlowRuntime | FlowInstance | Success["DecodingServices"] | Error["DecodingServices"]>`
|
|
413
|
+
- **Since:** `0.1.0`
|
|
414
|
+
|
|
415
|
+
Waits for the durable deferred, suspending the current flow when no persisted completion is available. The first recorded exit is the one every later read replays.
|
|
416
|
+
|
|
417
|
+
### `DurableDeferred.into`
|
|
418
|
+
|
|
419
|
+
- **Signature:** `into(effect: Effect.Effect<Success["Type"], Error["Type"], R>, self: DurableDeferred<Success, Error>): Effect.Effect<Success["Type"], Error["Type"], R | FlowRuntime | FlowInstance | Success["DecodingServices"] | Success["EncodingServices"] | Error["DecodingServices"] | Error["EncodingServices"]>`
|
|
420
|
+
- **Since:** `0.1.0`
|
|
421
|
+
|
|
422
|
+
Runs an effect and records its exit into the durable deferred, resuming the flows waiting on that deferred. The data-last form takes the deferred alone.
|
|
423
|
+
|
|
424
|
+
An interrupt-only exit records nothing. Mixed causes record only their non-interrupt reasons. The effect uses the current flow instance: nested durable waits can suspend, and suspension causes, waiting annotations, and handoffs remain visible to the enclosing flow.
|
|
425
|
+
|
|
426
|
+
### `DurableDeferred.raceAll`
|
|
427
|
+
|
|
428
|
+
- **Signature:** `raceAll(options: { name: string; success: Success; error: Error; effects: Effects }): Effect.Effect<...>`
|
|
429
|
+
- **Since:** `0.1.0`
|
|
430
|
+
|
|
431
|
+
Runs effects as a durable race. A previously persisted result is returned unchanged. Otherwise the first success completes the deferred named `raceAll/<name>`, and the race fails only when every effect fails, so a re-driven round reads the recorded winner instead of racing again.
|
|
432
|
+
|
|
433
|
+
### `DurableDeferred.TokenTypeId`
|
|
434
|
+
|
|
435
|
+
- **Type:** `"@smthrs/flow/DurableDeferred/Token"`, exported as both a constant and a type
|
|
436
|
+
- **Since:** `0.1.0`
|
|
437
|
+
|
|
438
|
+
The brand identifier that distinguishes a completion token from an ordinary string.
|
|
439
|
+
|
|
440
|
+
### `DurableDeferred.Token`
|
|
441
|
+
|
|
442
|
+
- **Type:** `Brand.Branded<string, TokenTypeId>` as a type, and `Schema.brand<Schema.String, TokenTypeId>` as a schema
|
|
443
|
+
- **Since:** `0.1.0`
|
|
444
|
+
|
|
445
|
+
A branded string identifying one durable deferred of one flow execution.
|
|
446
|
+
|
|
447
|
+
A token is an address, not a credential. It is unsigned base64url JSON of the flow name, execution id, and deferred name, and `tokenFromExecutionId` and `tokenFromPayload` rebuild it from those values. Anyone who can call a completion entry point (`done`, `succeed`, `fail`, `failCause`, `HumanTask.answer`) against the run's `FlowRuntime` can complete an open wait whose address they know or derive. A host that exposes completion to other parties must authorize the caller first.
|
|
448
|
+
|
|
449
|
+
### `DurableDeferred.TokenInvalid`
|
|
450
|
+
|
|
451
|
+
- **Type:** `Schema.TaggedError` with fields `code: "malformed_token" | "deferred_mismatch"` and `message: string`
|
|
452
|
+
- **Default:** `code` defaults to `"malformed_token"`
|
|
453
|
+
- **Since:** `0.1.0`
|
|
454
|
+
|
|
455
|
+
The typed failure every completion surface returns for a token that does not parse, or that names a different deferred than the one it was submitted through.
|
|
456
|
+
|
|
457
|
+
### `DurableDeferred.TokenParsed`
|
|
458
|
+
|
|
459
|
+
- **Type:** `Schema.Class` with fields `flowName: string`, `executionId: string`, and `deferredName: string`
|
|
460
|
+
- **Since:** `0.1.0`
|
|
461
|
+
|
|
462
|
+
A decoded token. The three fields are the durable address a completion is written to.
|
|
463
|
+
|
|
464
|
+
### `DurableDeferred.token`
|
|
465
|
+
|
|
466
|
+
- **Signature:** `token(self: DurableDeferred<Success, Error>): Effect.Effect<Token, never, FlowInstance>`
|
|
467
|
+
- **Since:** `0.1.0`
|
|
468
|
+
|
|
469
|
+
Creates a token for a deferred using the running flow's own name and execution id.
|
|
470
|
+
|
|
471
|
+
### `DurableDeferred.tokenFromExecutionId`
|
|
472
|
+
|
|
473
|
+
- **Signature:** `tokenFromExecutionId(self: DurableDeferred<Success, Error>, options: { readonly flow: Flow.Any; readonly executionId: string }): Token`
|
|
474
|
+
- **Since:** `0.1.0`
|
|
475
|
+
|
|
476
|
+
Creates a token from an explicit flow and execution id, for a resolver outside the run.
|
|
477
|
+
|
|
478
|
+
### `DurableDeferred.tokenFromPayload`
|
|
479
|
+
|
|
480
|
+
- **Signature:** `tokenFromPayload(self: DurableDeferred<Success, Error>, options: { readonly flow: W; readonly payload: Flow.PayloadSchema<W>["~type.make.in"] }): Effect.Effect<Token, never, Crypto.Crypto | Flow.PayloadSchema<W>["EncodingServices"]>`
|
|
481
|
+
- **Since:** `0.1.0`
|
|
482
|
+
|
|
483
|
+
Creates a token by deriving the execution id from the flow payload. Declare an `idempotencyKey` or install the opt-in derived source for stable payload identity. The default fresh source mints a new id on each call; use `tokenFromExecutionId` with a saved id to address an existing execution.
|
|
484
|
+
|
|
485
|
+
### `DurableDeferred.done`
|
|
486
|
+
|
|
487
|
+
- **Signature:** `done(self: DurableDeferred<Success, Error>, options: { readonly token: Token; readonly exit: Exit.Exit<Success["Type"], Error["Type"]> }): Effect.Effect<void, TokenInvalid, FlowRuntime | Success["EncodingServices"] | Error["EncodingServices"]>`
|
|
488
|
+
- **Since:** `0.1.0`
|
|
489
|
+
|
|
490
|
+
Completes the deferred a token addresses with an exit, encoded through the deferred's schemas. A token whose `deferredName` is not this deferred's name fails with `TokenInvalid`. The token is not a credential: authorize the caller before completing a wait on its behalf.
|
|
491
|
+
|
|
492
|
+
### `DurableDeferred.succeed`
|
|
493
|
+
|
|
494
|
+
- **Signature:** `succeed(self: DurableDeferred<Success, Error>, options: { readonly token: Token; readonly value: Success["Type"] }): Effect.Effect<void, TokenInvalid, FlowRuntime | Success["EncodingServices"]>`
|
|
495
|
+
- **Since:** `0.1.0`
|
|
496
|
+
|
|
497
|
+
Completes the deferred with a successful value.
|
|
498
|
+
|
|
499
|
+
### `DurableDeferred.fail`
|
|
500
|
+
|
|
501
|
+
- **Signature:** `fail(self: DurableDeferred<Success, Error>, options: { readonly token: Token; readonly error: Error["Type"] }): Effect.Effect<void, TokenInvalid, FlowRuntime | Error["EncodingServices"]>`
|
|
502
|
+
- **Since:** `0.1.0`
|
|
503
|
+
|
|
504
|
+
Completes the deferred with a typed failure.
|
|
505
|
+
|
|
506
|
+
### `DurableDeferred.failCause`
|
|
507
|
+
|
|
508
|
+
- **Signature:** `failCause(self: DurableDeferred<Success, Error>, options: { readonly token: Token; readonly cause: Cause.Cause<Error["Type"]> }): Effect.Effect<void, TokenInvalid, FlowRuntime | Error["EncodingServices"]>`
|
|
509
|
+
- **Since:** `0.1.0`
|
|
510
|
+
|
|
511
|
+
Completes the deferred with a failure cause.
|
|
512
|
+
|
|
513
|
+
## DurableQueue
|
|
514
|
+
|
|
515
|
+
### `DurableQueue.TypeId`
|
|
516
|
+
|
|
517
|
+
- **Type:** `"@smthrs/flow/DurableQueue"`, exported as both a constant and a type
|
|
518
|
+
- **Since:** `0.1.0`
|
|
519
|
+
|
|
520
|
+
The identifier attached to `DurableQueue` values.
|
|
521
|
+
|
|
522
|
+
### `DurableQueue.DurableQueue`
|
|
523
|
+
|
|
524
|
+
- **Type:** `interface DurableQueue<Payload extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>` with `name`, `payloadSchema`, `idempotencyKey`, and `deferred`
|
|
525
|
+
- **Since:** `0.1.0`
|
|
526
|
+
|
|
527
|
+
A durable queue definition: the payload schema, the key that identifies one item, and the deferred a caller awaits the worker's result on.
|
|
528
|
+
|
|
529
|
+
### `DurableQueue.make`
|
|
530
|
+
|
|
531
|
+
- **Signature:** `make(options: { readonly name: string; readonly payload: Payload; readonly idempotencyKey: (payload) => string; readonly success?: Success | undefined; readonly error?: Error | undefined }): DurableQueue<...>`
|
|
532
|
+
- **Default:** `success` is `Schema.Void`, `error` is `Schema.Never`
|
|
533
|
+
- **Since:** `0.1.0`
|
|
534
|
+
|
|
535
|
+
Creates a durable queue that waits for persisted items to finish processing through a `DurableDeferred`.
|
|
536
|
+
|
|
537
|
+
### `DurableQueue.process`
|
|
538
|
+
|
|
539
|
+
- **Signature:** `process(self: DurableQueue<Payload, Success, Error>, payload: Payload["~type.make.in"], options?: { readonly retrySchedule?: Schedule.Schedule<any, PersistedQueue.PersistedQueueError> | undefined }): Effect.Effect<Success["Type"], Error["Type"], FlowRuntime | FlowInstance | Crypto.Crypto | PersistedQueue.PersistedQueueFactory | Payload["EncodingServices"] | Payload["DecodingServices"] | Success["DecodingServices"] | Error["DecodingServices"]>`
|
|
540
|
+
- **Default:** `retrySchedule` is unbounded, with exponential delays capped at one minute
|
|
541
|
+
- **Since:** `0.1.0`
|
|
542
|
+
|
|
543
|
+
Offers a payload to the queue under the name `DurableQueue/<name>`, attaches a token, and suspends until a worker records the handler's exit against it. A caller-supplied schedule may exhaust, and its final offer failure becomes a defect so the error channel stays the worker's declared error. A payload that fails the queue's schema is also a defect.
|
|
544
|
+
|
|
545
|
+
### `DurableQueue.makeWorker`
|
|
546
|
+
|
|
547
|
+
- **Signature:** `makeWorker(self: DurableQueue<Payload, Success, Error>, f: (payload: Payload["Type"]) => Effect.Effect<Success["Type"], Error["Type"], R>, options?: { readonly concurrency?: number | undefined }): Effect.Effect<never, never, ...>`
|
|
548
|
+
- **Default:** `concurrency` is `1`
|
|
549
|
+
- **Since:** `0.1.0`
|
|
550
|
+
|
|
551
|
+
Creates the worker effect that processes items from the queue. It throws a `RangeError` when `concurrency` is not a positive safe integer.
|
|
552
|
+
|
|
553
|
+
### `DurableQueue.worker`
|
|
554
|
+
|
|
555
|
+
- **Signature:** `worker(self: DurableQueue<Payload, Success, Error>, f: (payload: Payload["Type"]) => Effect.Effect<Success["Type"], Error["Type"], R>, options?: { readonly concurrency?: number | undefined }): Layer.Layer<never, never, ...>`
|
|
556
|
+
- **Default:** `concurrency` is `1`
|
|
557
|
+
- **Since:** `0.1.0`
|
|
558
|
+
|
|
559
|
+
The layer form of `DurableQueue.makeWorker`, forking the worker into the layer's scope.
|
|
560
|
+
|
|
561
|
+
## Fault
|
|
562
|
+
|
|
563
|
+
One typed fault for every failure. The owner of an error union registers each code with a class, so a failure crosses every seam as `{ class, tag }` instead of prose.
|
|
564
|
+
|
|
565
|
+
### `Fault.Class`
|
|
566
|
+
|
|
567
|
+
- **Type:** `Schema.Literals<["user", "wait", "infra", "dependency", "bug", "factory", "policy"]>`
|
|
568
|
+
- **Since:** `1.0.0`
|
|
569
|
+
|
|
570
|
+
`user`, `wait`, `infra`, `dependency`, and `bug` are the wire registry. `factory` means the factory's own work did not converge, so a replan may fix it. `policy` means a cap stopped the work.
|
|
571
|
+
|
|
572
|
+
### `Fault.Fault`
|
|
573
|
+
|
|
574
|
+
- **Type:** `Schema.Struct<{ class: Class; tag: Schema.String }>`
|
|
575
|
+
- **Since:** `1.0.0`
|
|
576
|
+
|
|
577
|
+
`tag` is `<_tag>/<code>`, or `<_tag>` for an error without a code.
|
|
578
|
+
|
|
579
|
+
### `Fault.register`
|
|
580
|
+
|
|
581
|
+
- **Signature:** `register<Code extends string>(tag: string, table: Class | Rows<Code>, field?: string): void`
|
|
582
|
+
- **Since:** `1.0.0`
|
|
583
|
+
|
|
584
|
+
Registers one class for the whole tag, or one per value of `field` (default `code`). Owners write `satisfies Fault.Rows<Code>`, so a new code without a class does not compile. A value the table does not name is `bug`. The registry is one per process, shared by the ESM and CommonJS builds. Registering a tag again with the same rows is a no-op; registering it with different rows throws.
|
|
585
|
+
|
|
586
|
+
### `Fault.of`
|
|
587
|
+
|
|
588
|
+
- **Signature:** `of(error: unknown): Fault`
|
|
589
|
+
- **Since:** `1.0.0`
|
|
590
|
+
|
|
591
|
+
Reads the error and up to 15 `cause` links beneath it and answers the innermost registered tag, because a wrapper names where a failure surfaced and its cause names why. Anything unregistered is `{ class: "bug", tag: "unregistered" }`.
|
|
592
|
+
|
|
593
|
+
### `Fault.retryTransient`
|
|
594
|
+
|
|
595
|
+
- **Signature:** `retryTransient<A, E, R>(effect: Effect<A, E, R>): Effect<A, E, R>`
|
|
596
|
+
|
|
597
|
+
Retries plain effects only while `Fault.of(error).class` is `infra`, using
|
|
598
|
+
`RetryPolicy.transient`: 5 seconds doubling to 5 minutes, expiring after 2 hours.
|
|
599
|
+
The caller guarantees the effect is safe to repeat. The final typed failure is
|
|
600
|
+
preserved, including its class. Defects and interruption are not retried.
|
|
601
|
+
|
|
602
|
+
### `Fault.respond`
|
|
603
|
+
|
|
604
|
+
- **Signature:** `respond(fault: Fault, state: State): Response`
|
|
605
|
+
- **Since:** `1.0.0`
|
|
606
|
+
|
|
607
|
+
The one response ladder, exhaustive over the classes. `wait` backs up, then parks while `parksLeft` allows, then stops. `dependency` backs up, then retries until the third attempt, then stops. `infra` retries until the third attempt, then parks. `factory` replans twice, continues once as `very_hard`, then asks for `help`. A declined request (`coding/Error/declined`) closes, any other `user` fault asks for `help`, and `policy` and `bug` stop.
|
|
608
|
+
|
|
609
|
+
### `Fault.registered`
|
|
610
|
+
|
|
611
|
+
- **Signature:** `registered(): ReadonlySet<string>`
|
|
612
|
+
- **Since:** `1.0.0`
|
|
613
|
+
|
|
614
|
+
Every registered tag. The sweep tests read it.
|
|
615
|
+
|
|
616
|
+
## Flow
|
|
617
|
+
|
|
618
|
+
`Flow` models and schemas are listed in one table, and constructors, refinements, results, resource management, annotations, and errors get their own entries:
|
|
619
|
+
|
|
620
|
+
| Name | Kind | Summary |
|
|
621
|
+
| --------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
622
|
+
| `Effects` | Schema and type | The declared filesystem effects of a flow: `reads`, `writes`, optional `removes` (workspace-relative patterns, as on an action boundary), and `boundaryMode`. It IS `@smthrs/plan`'s `Plan.NodeEffects`, not a copy of it. |
|
|
623
|
+
| `PlacementDirective` | Type | Where a node runs. It IS `@smthrs/plan`'s `Placement.Placement`, the one typed model, carried unchanged until planning reads it. |
|
|
624
|
+
| `ExecutionIdSource` | Interface | Mints the execution id of an invocation that named none, through `mint(flow, payload)`. |
|
|
625
|
+
| `BodySuccess` | Type | The values a flow body may settle one round with: a decoded success, a planned reference, or an `Outcome`. |
|
|
626
|
+
| `Flow` | Interface | A durable flow definition. It carries `_tag`, `payloadSchema`, `successSchema`, `errorSchema`, `annotations`, `body`, `idempotencyKey`, `suspendedRetryPolicy`, `maxRounds`, and `deadline`, and exposes `call`, `child`, `to`, `annotate`, `annotateMerge`, `execute`, `start`, `ensure`, `poll`, `interrupt`, `resume`, `executionId`, and `withRollback`. |
|
|
627
|
+
| `AnyStructSchema` | Interface | The constraint a flow payload schema satisfies: a `Schema.Top` that exposes `fields`. |
|
|
628
|
+
| `Execution` | Interface | A type-level marker tying a service to one flow tag. It carries no runtime value. |
|
|
629
|
+
| `Any` | Interface | The type-erased flow shape for APIs that do not preserve payload, success, or error types. |
|
|
630
|
+
| `AnyWithProps` | Interface | The type-erased flow shape that also exposes `execute` and `resume`. |
|
|
631
|
+
| `PayloadSchema` | Type | Extracts the payload schema from a `Flow`. |
|
|
632
|
+
| `Requirements` | Type | Extracts a flow's requirement channel: the action implementations its body names and does not carry. |
|
|
633
|
+
| `RequirementsClient` | Type | The schema services a client that executes or polls flows requires. |
|
|
634
|
+
| `RequirementsHandler` | Type | The schema services a handler that decodes payloads and encodes results requires. |
|
|
635
|
+
| `Done` | Interface and schema | A completed trampoline lineage value, carrying `value`. |
|
|
636
|
+
| `To` | Interface and schema | A serializable invocation of the next flow round, carrying `flow` and `payload`. |
|
|
637
|
+
| `Park` | Interface and schema | A request to durably park the current round, carrying `reason`. |
|
|
638
|
+
| `Outcome` | Type and schema | The union of `Done`, `To`, and `Park`. |
|
|
639
|
+
| `CompleteSchema` | Interface | The schema constructor for `Complete` results under supplied success and error schemas. |
|
|
640
|
+
|
|
641
|
+
### `Flow.PromptFlow`
|
|
642
|
+
|
|
643
|
+
A canonical flow with a typed `prompt(payload): string` renderer and an ordinary
|
|
644
|
+
`action` named `<tag>/prompt`. Its requirement channel carries that action's
|
|
645
|
+
implementation requirement. Annotation copies retain the prompt and action.
|
|
646
|
+
|
|
647
|
+
`Flow.ModelSelection` is a seat string or an ordered nonempty tuple.
|
|
648
|
+
`Flow.DeclarationMetadata` carries optional `model`, `effort`, `system`, `chat`,
|
|
649
|
+
and `flows` fields, interpreted by the host.
|
|
650
|
+
|
|
651
|
+
### `Flow.Capabilities`
|
|
652
|
+
|
|
653
|
+
- **Type:** `Context.Reference<ReadonlyArray<string>>`
|
|
654
|
+
- **Default:** `[]`
|
|
655
|
+
- **Since:** `0.1.0`
|
|
656
|
+
|
|
657
|
+
The capability names a flow may require. Its identifier is `"@smthrs/flow/Flow/Capabilities"`.
|
|
658
|
+
|
|
659
|
+
### `Flow.EffectsDeclaration`
|
|
660
|
+
|
|
661
|
+
- **Type:** `Context.Service<Effects>`
|
|
662
|
+
- **Since:** `0.1.0`
|
|
663
|
+
|
|
664
|
+
The annotation key for a flow's declared filesystem effects. Its identifier is `"@smthrs/flow/Flow/EffectsDeclaration"`.
|
|
665
|
+
|
|
666
|
+
### `Flow.EffectEnvelope`
|
|
667
|
+
|
|
668
|
+
- **Type:** `Context.Key<Effects.Declaration, Effects.Declaration>`
|
|
669
|
+
- **Since:** `0.1.0`
|
|
670
|
+
|
|
671
|
+
The annotation key for the effect AUTHORITY a flow declares: the ceiling every step spliced beneath it must stay inside. It IS `@smthrs/plan`'s `Effects.Envelope`, identified by `"@smthrs/plan/Effects/Envelope"`, which `@smthrs/core` also publishes as `Annotations.Effects`, so a flow annotated for either graph builder is visible to the other. Its value is the one envelope model from `@smthrs/plan/Effects`, and `Flow.make`'s `effects` literal writes it.
|
|
672
|
+
|
|
673
|
+
It answers a different question from `Flow.EffectsDeclaration`. That one says which FILES a node touches, so a plan can order writers and a sandbox can enforce a boundary at run time. This one says how much a flow is ALLOWED to touch, so `Graph.build` can refuse a composition that claims more than its caller granted, with `effect_outside_envelope`, `effect_mode_widening`, `effect_tier_widening`, or the advisory `capability_outside_grant`.
|
|
674
|
+
|
|
675
|
+
### `Flow.Placement`
|
|
676
|
+
|
|
677
|
+
- **Type:** `Context.Key<PlacementDirective, PlacementDirective>`
|
|
678
|
+
- **Since:** `0.1.0`
|
|
679
|
+
|
|
680
|
+
The annotation key for a flow's placement directive. It IS `@smthrs/plan`'s `Placement.Annotation`, identified by `"@smthrs/plan/Placement"`, which `@smthrs/core` also publishes as `Annotations.Placement`. Crossing between the two used to be a cast in `@smthrs/registry`.
|
|
681
|
+
|
|
682
|
+
### `Flow.CaptureDefects`
|
|
683
|
+
|
|
684
|
+
- **Type:** `Context.Reference<boolean>`
|
|
685
|
+
- **Default:** `true`
|
|
686
|
+
- **Since:** `0.1.0`
|
|
687
|
+
|
|
688
|
+
Whether defects are captured for a flow and included in the result of the flow or its actions.
|
|
689
|
+
|
|
690
|
+
### `Flow.SuspendOnFailure`
|
|
691
|
+
|
|
692
|
+
- **Type:** `Context.Reference<boolean>`
|
|
693
|
+
- **Default:** `false`
|
|
694
|
+
- **Since:** `0.1.0`
|
|
695
|
+
|
|
696
|
+
Whether a flow suspends when it encounters any error. A suspended execution is re-driven with the flow's `resume` method.
|
|
697
|
+
|
|
698
|
+
### `Flow.ExecutionIdRequired`
|
|
699
|
+
|
|
700
|
+
- **Type:** `Schema.TaggedError` with fields `code: "execution_id_required"` and `flowName: string`
|
|
701
|
+
- **Since:** `0.1.0`
|
|
702
|
+
|
|
703
|
+
The opt-in `derived` source dies with this defect when the payload has no canonical form. The default source mints a fresh UUID when the caller and declaration do not select an id. `FlowProxyServer` also dies with it when a configured `ExecutionIdScope` returns `undefined` for a resume request.
|
|
704
|
+
|
|
705
|
+
### `Flow.derived`
|
|
706
|
+
|
|
707
|
+
- **Type:** `ExecutionIdSource`
|
|
708
|
+
- **Since:** `0.1.0`
|
|
709
|
+
|
|
710
|
+
The opt-in deterministic execution-id source. It encodes the payload with the flow's own codec, canonicalizes it under RFC 8785, hashes it with SHA-256, and hashes that key together with the flow tag inside a JSON tuple. The same tag and encoded payload derive the same id. The preimage encoding freezes at rc.0.
|
|
711
|
+
|
|
712
|
+
### `Flow.fresh`
|
|
713
|
+
|
|
714
|
+
- **Type:** `ExecutionIdSource`
|
|
715
|
+
- **Since:** `0.1.0`
|
|
716
|
+
|
|
717
|
+
The default execution-id source. Every invocation mints an independent cryptographic
|
|
718
|
+
UUID. Save the returned execution id to reattach after a crash, or explicitly
|
|
719
|
+
choose a declared idempotency key, `ensure`, or the `derived` source.
|
|
720
|
+
|
|
721
|
+
### `Flow.CurrentExecutionIds`
|
|
722
|
+
|
|
723
|
+
- **Type:** `Context.Reference<ExecutionIdSource>`
|
|
724
|
+
- **Default:** `fresh`
|
|
725
|
+
- **Since:** `0.1.0`
|
|
726
|
+
|
|
727
|
+
The host's execution-id source. Its identifier is `"@smthrs/flow/Flow/CurrentExecutionIds"`.
|
|
728
|
+
|
|
729
|
+
### `Flow.layerExecutionIds`
|
|
730
|
+
|
|
731
|
+
- **Signature:** `layerExecutionIds(source: ExecutionIdSource): Layer.Layer<never>`
|
|
732
|
+
- **Since:** `0.1.0`
|
|
733
|
+
|
|
734
|
+
Declares the host's execution-id source as a layer. Callers that name an `executionId` and flows that declare an `idempotencyKey` are unaffected, because both are decided before the source is consulted.
|
|
735
|
+
|
|
736
|
+
### `Flow.make`
|
|
737
|
+
|
|
738
|
+
- **Signature:** `make(tag: Tag, options: { payload, declaredFrom?, description?, capabilities?, effects?, idempotencyKey?, success?, error?, suspendedRetryPolicy?, maxRounds?, deadline?, annotations?, model?, effort?, flows?, system?, chat?, body | prompt }): Flow<Tag, PayloadSchemaOf<Payload>, Success, Error, Requires>`
|
|
739
|
+
- **Default:** `success` is `Schema.Void`, `error` is `Schema.Never`, `annotations` is `Context.empty()`
|
|
740
|
+
- **Required:** `payload` and exactly one of `body` or `prompt`
|
|
741
|
+
- **Since:** `0.1.0`
|
|
742
|
+
|
|
743
|
+
Creates a durable flow definition. The `body` is the flow's one behavior, evaluated at plan time only, and it must be pure: it may not read mutable module state, clocks, random values, services, or values captured outside `payload`. A typed `prompt(payload)` lowers to one ordinary action named `<tag>/prompt`; its returned `PromptFlow` exposes the declaration as `action` and the renderer as `prompt`. The renderer runs only when the host implementation calls it. Optional `model`, `effort`, `flows`, `system`, and `chat` fields retain host metadata; annotation copies preserve them. `Flow.make` throws a `RangeError` when `maxRounds` is not a positive safe integer or `deadline` is not a positive finite duration of at most `Number.MAX_SAFE_INTEGER` milliseconds. `deadline` bounds one execution, counted from its journaled first start, so a resume after a restart honors the original deadline; on expiry the execution settles with `Flow.DeadlineExceeded` whether it was running or parked.
|
|
744
|
+
|
|
745
|
+
`Flow.make` throws `TypeError` for a missing or blank tag, or when the declaration
|
|
746
|
+
does not supply exactly one function as `body` or `prompt`.
|
|
747
|
+
|
|
748
|
+
`declaredFrom: original` retains a native declaration's diagnostic source location,
|
|
749
|
+
including its absence, while constructing a fresh flow with the supplied body.
|
|
750
|
+
It does not change key material or execution identity.
|
|
751
|
+
|
|
752
|
+
`description`, `capabilities`, and `effects` are declared as literals and lowered into the annotation bag, so a catalog reading the source text projects the same values `Graph.build` enforces. `effects` takes `{ reads, writes, mode, onConflict, tier? }` and is normalized by `Effects.make`.
|
|
753
|
+
|
|
754
|
+
### `flow.start` and `flow.ensure`
|
|
755
|
+
|
|
756
|
+
```ts
|
|
757
|
+
import { Action, Flow } from "@smthrs/flow"
|
|
758
|
+
import * as Effect from "effect/Effect"
|
|
759
|
+
import * as Schema from "effect/Schema"
|
|
760
|
+
|
|
761
|
+
const Step = Action.make("worker/step", {
|
|
762
|
+
payload: { id: Schema.String },
|
|
763
|
+
success: Schema.String
|
|
764
|
+
})
|
|
765
|
+
|
|
766
|
+
const flow = Flow.make("worker/run", {
|
|
767
|
+
payload: { id: Schema.String },
|
|
768
|
+
success: Schema.String,
|
|
769
|
+
body: (payload) => Step.call(payload)
|
|
770
|
+
})
|
|
771
|
+
|
|
772
|
+
const payload = { id: "job-1" }
|
|
773
|
+
|
|
774
|
+
export const program = Effect.gen(function*() {
|
|
775
|
+
const freshId = yield* flow.start(payload)
|
|
776
|
+
const keyedId = yield* flow.ensure(payload, { key: "worker-1" })
|
|
777
|
+
return { freshId, keyedId }
|
|
778
|
+
})
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
`start` admits a fresh execution, bypassing declared and ambient idempotency
|
|
782
|
+
policies. `ensure` admits or joins the execution identified by the flow tag and
|
|
783
|
+
caller key. Both return the execution id after admission and scheduling,
|
|
784
|
+
without waiting for the child to settle, including inside an action.
|
|
785
|
+
`execute(payload, { discard: true })` follows the same contract.
|
|
786
|
+
|
|
787
|
+
The scheduled child belongs to the engine's scope and continues after the
|
|
788
|
+
caller's action or parent round finishes. Keep that engine scope open. A memory
|
|
789
|
+
engine loses its executions when the scope closes; a durable engine retains
|
|
790
|
+
admission and progress for recovery. Explicit parent cancellation still follows
|
|
791
|
+
the engine's cancellation policy for linked children.
|
|
792
|
+
|
|
793
|
+
Use `flow.poll(id)` to observe the result, or
|
|
794
|
+
`flow.execute(payload, { executionId: id })` to await completion. The returned
|
|
795
|
+
id acknowledges admission, not a successful result or a reached wait point.
|
|
796
|
+
|
|
797
|
+
### `Flow.MaxRoundsExceeded`
|
|
798
|
+
|
|
799
|
+
- **Type:** `Schema.TaggedError` with fields `code: "max_rounds_exceeded"`, `flowName: string`, `lineageId: string`, `maxRounds: number`, `roundOrdinal: number`, and `message: string`
|
|
800
|
+
- **Since:** `0.1.0`
|
|
801
|
+
|
|
802
|
+
A lineage asked for one more round than its flow's `maxRounds` allows. It is recorded as a defect in the execution result, not as a typed `execute` failure.
|
|
803
|
+
|
|
804
|
+
### `Flow.DeadlineExceeded`
|
|
805
|
+
|
|
806
|
+
- **Type:** `Schema.TaggedError` with fields `code: "deadline_exceeded"`, `flowName: string`, `executionId: string`, `deadlineMs: number`, `startedAtMs: number`, and `message: string`
|
|
807
|
+
- **Since:** `1.0.0`
|
|
808
|
+
|
|
809
|
+
An execution was still unsettled when its flow's `deadline` elapsed. It is recorded as a defect in the execution result, not as a typed `execute` failure, and its attached children are cancelled with it.
|
|
810
|
+
|
|
811
|
+
### `Flow.done`
|
|
812
|
+
|
|
813
|
+
- **Signature:** `done<A>(value: A): Node.Node<Node.Succeed<Done<A>>>`
|
|
814
|
+
- **Since:** `0.1.0`
|
|
815
|
+
|
|
816
|
+
Ends a trampoline lineage with a value. The engine encodes the resulting value with the settling flow's success schema.
|
|
817
|
+
|
|
818
|
+
Constant values use `Node.succeed`’s JSON projection; Dates become strings or `null`. Planned references retain their upstream result type.
|
|
819
|
+
|
|
820
|
+
### `Flow.park`
|
|
821
|
+
|
|
822
|
+
- **Signature:** `park(reason: WaitingAnnotation): Node.Node<Park>`
|
|
823
|
+
- **Signature:** `park(reason: string, token?: string | undefined): Node.Node<Park>`
|
|
824
|
+
- **Since:** `0.1.0`
|
|
825
|
+
|
|
826
|
+
Parks the current round durably under a waiting reason, and an optional wake token.
|
|
827
|
+
|
|
828
|
+
### `Flow.isOutcome`
|
|
829
|
+
|
|
830
|
+
- **Signature:** `isOutcome(value: unknown): value is Outcome`
|
|
831
|
+
- **Since:** `0.1.0`
|
|
832
|
+
|
|
833
|
+
Whether a settled body value is one of the three trampoline settlements. Shape alone is deliberately insufficient, because ordinary success data may carry the same `_tag` fields. Graph construction carries a non-enumerable marker from the authoring node to its hydrated value, and the guard reads that marker.
|
|
834
|
+
|
|
835
|
+
### `Flow.isResult`
|
|
836
|
+
|
|
837
|
+
- **Signature:** `isResult<A = unknown, E = unknown>(u: unknown): u is Result<A, E>`
|
|
838
|
+
- **Since:** `0.1.0`
|
|
839
|
+
|
|
840
|
+
Whether a value is a flow `Result`.
|
|
841
|
+
|
|
842
|
+
### `Flow.Result`
|
|
843
|
+
|
|
844
|
+
- **Type:** `Complete<A, E> | Suspended | Handoff` as a type, and `Result(options: { readonly success: Success; readonly error: Error })` as a schema constructor
|
|
845
|
+
- **Since:** `0.1.0`
|
|
846
|
+
|
|
847
|
+
The result of a flow execution: a completed exit, a suspended state, or a handoff to the next round of a trampoline lineage.
|
|
848
|
+
|
|
849
|
+
### `Flow.ResultEncoded`
|
|
850
|
+
|
|
851
|
+
- **Type:** `CompleteEncoded<A, E> | typeof Suspended.Encoded | typeof Handoff.Encoded` as a type, and `Schema.Codec<ResultEncoded<any, any>>` as a schema
|
|
852
|
+
- **Since:** `0.1.0`
|
|
853
|
+
|
|
854
|
+
The encoded form of a flow `Result`, as it is stored.
|
|
855
|
+
|
|
856
|
+
### `Flow.CompleteEncoded`
|
|
857
|
+
|
|
858
|
+
- **Type:** `interface CompleteEncoded<A, E> { readonly _tag: "Complete"; readonly exit: ExitEncoded<A, E> }`
|
|
859
|
+
- **Since:** `0.1.0`
|
|
860
|
+
|
|
861
|
+
The encoded form of a completed result.
|
|
862
|
+
|
|
863
|
+
### `Flow.Complete`
|
|
864
|
+
|
|
865
|
+
- **Type:** `Data.TaggedClass("Complete")<{ readonly exit: Exit.Exit<A, E> }>`
|
|
866
|
+
- **Since:** `0.1.0`
|
|
867
|
+
|
|
868
|
+
A completed flow execution, carrying its success or failure `Exit`.
|
|
869
|
+
|
|
870
|
+
### `Flow.Suspended`
|
|
871
|
+
|
|
872
|
+
- **Type:** `Schema.Class` keyed `"@smthrs/flow/Flow/Suspended"` with fields `_tag: "Suspended"` and optional `cause`
|
|
873
|
+
- **Since:** `0.1.0`
|
|
874
|
+
|
|
875
|
+
A flow execution that parked on a durable wait. The optional `cause` carries what triggered the suspension.
|
|
876
|
+
|
|
877
|
+
### `Flow.Handoff`
|
|
878
|
+
|
|
879
|
+
- **Type:** `Schema.Class` keyed `"@smthrs/flow/Flow/Handoff"` with fields `_tag: "Handoff"`, `flow: NonEmptyString`, optional `capabilityCeilings`, `payload: Unknown`, and optional `deadline: LineageDeadline`
|
|
880
|
+
- **Since:** `0.1.0`
|
|
881
|
+
|
|
882
|
+
A round that ended by handing off to the next round of its trampoline lineage. `deadline` is the lineage deadline the next round runs under, stamped by a bounded round.
|
|
883
|
+
|
|
884
|
+
### `Flow.LineageDeadline`
|
|
885
|
+
|
|
886
|
+
- **Type:** `Schema.Struct({ startedAtMs: Number, deadlineMs: Number })`
|
|
887
|
+
- **Since:** `1.0.0`
|
|
888
|
+
|
|
889
|
+
The deadline a trampoline lineage's rounds share: the originating round's journaled first start and its bound, so every round expires at `startedAtMs + deadlineMs`.
|
|
890
|
+
|
|
891
|
+
### `Flow.intoResult`
|
|
892
|
+
|
|
893
|
+
- **Signature:** `intoResult<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<Result<A, E>, never, Exclude<R, Scope.Scope> | FlowInstance>`
|
|
894
|
+
- **Since:** `0.1.0`
|
|
895
|
+
|
|
896
|
+
Runs an effect as a flow execution and turns its outcome into a `Result`. It reads `CaptureDefects` and `SuspendOnFailure` from the flow's annotations, and closes the flow scope when the execution completes.
|
|
897
|
+
|
|
898
|
+
### `Flow.wrapActionResult`
|
|
899
|
+
|
|
900
|
+
- **Signature:** `wrapActionResult<A, E, R>(effect: Effect.Effect<A, E, R>, isSuspend: (value: A) => boolean): Effect.Effect<A, E, R | FlowInstance>`
|
|
901
|
+
- **Since:** `0.1.0`
|
|
902
|
+
|
|
903
|
+
Wraps an action-like effect so a flow suspension waits for the actions already running to finish or suspend.
|
|
904
|
+
|
|
905
|
+
### `Flow.scope`
|
|
906
|
+
|
|
907
|
+
- **Type:** `Effect.Effect<Scope.Scope, never, FlowInstance>`
|
|
908
|
+
- **Since:** `0.1.0`
|
|
909
|
+
|
|
910
|
+
The flow scope, which is closed only when the flow execution fully completes.
|
|
911
|
+
|
|
912
|
+
### `Flow.provideScope`
|
|
913
|
+
|
|
914
|
+
- **Signature:** `provideScope<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, Scope.Scope> | FlowInstance>`
|
|
915
|
+
- **Since:** `0.1.0`
|
|
916
|
+
|
|
917
|
+
Provides the flow scope to an effect, so resources it acquires live as long as the execution does.
|
|
918
|
+
|
|
919
|
+
### `Flow.addFinalizer`
|
|
920
|
+
|
|
921
|
+
- **Signature:** `addFinalizer<R>(f: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void, never, R>): Effect.Effect<void, never, FlowInstance | R>`
|
|
922
|
+
- **Since:** `0.1.0`
|
|
923
|
+
|
|
924
|
+
Adds an exit finalizer to the flow scope, preserving the services available when the finalizer is registered.
|
|
925
|
+
|
|
926
|
+
### `Flow.withRollback`
|
|
927
|
+
|
|
928
|
+
- **Signature:** `withRollback<A, E, R, R2>(effect: Effect.Effect<A, E, R>, rollback: (value: A, cause: Cause.Cause<unknown>) => Effect.Effect<void, never, R2>): Effect.Effect<A, E, R | R2 | FlowInstance | Scope.Scope>`
|
|
929
|
+
- **Since:** `0.1.0`
|
|
930
|
+
|
|
931
|
+
Runs an effect and registers how to undo its successful result if the enclosing flow later exits unsuccessfully. An effect that fails registers no rollback. A flow that succeeds discards it. The data-last form takes the rollback alone.
|
|
932
|
+
|
|
933
|
+
### `Flow.suspend`
|
|
934
|
+
|
|
935
|
+
- **Signature:** `suspend(instance: FlowInstance["Service"]): Effect.Effect<never>`
|
|
936
|
+
- **Since:** `0.1.0`
|
|
937
|
+
|
|
938
|
+
Marks a flow instance suspended and interrupts the current fiber, stopping execution until the run is resumed.
|
|
939
|
+
|
|
940
|
+
## FlowRuntime
|
|
941
|
+
|
|
942
|
+
### `FlowRuntime.CancelRequestFailed`
|
|
943
|
+
|
|
944
|
+
- **Type:** `Schema.TaggedError` with fields `code: "cancel_request_failed" | "unsafe_interrupt_unsupported"`, `executionId: string`, and `reason: string`
|
|
945
|
+
- **Since:** `0.1.0`
|
|
946
|
+
|
|
947
|
+
A runtime could not durably record a cancellation request. `cancel_request_failed` is a storage failure on a supported request. `unsafe_interrupt_unsupported` is the durable engine refusing `interruptUnsafe`, which it does not implement.
|
|
948
|
+
|
|
949
|
+
### `FlowRuntime.FlowCycleDetected`
|
|
950
|
+
|
|
951
|
+
- **Type:** `Schema.TaggedError` with fields `code: "flow_cycle_detected"` and `path: ReadonlyArray<string>`
|
|
952
|
+
- **Since:** `0.1.0`
|
|
953
|
+
|
|
954
|
+
Executing a flow would close a cycle in the persisted parent-execution chain. `path` holds the ordered execution ids from the cycle's target back to itself.
|
|
955
|
+
|
|
956
|
+
### `FlowRuntime.FlowExecutionNotFound`
|
|
957
|
+
|
|
958
|
+
- **Type:** `Schema.TaggedError` with fields `code: "execution_not_found"` and `executionId: string`
|
|
959
|
+
- **Since:** `0.1.0`
|
|
960
|
+
|
|
961
|
+
`poll` was given an execution id the runtime never recorded. `resume` has no error channel and returns without effect for an unknown id.
|
|
962
|
+
|
|
963
|
+
### `FlowRuntime.FlowInstance`
|
|
964
|
+
|
|
965
|
+
- **Type:** `Context.Service` keyed `"@smthrs/flow/FlowRuntime/FlowInstance"`
|
|
966
|
+
- **Since:** `0.1.0`
|
|
967
|
+
|
|
968
|
+
One execution's state: `executionId`, `lineageId`, `flow`, a `scope` closed only when the flow completes, the mutable `suspended`, `interrupted`, `waiting`, `handoff`, and `cause` fields, the optional `lineageDeadline` a round after a handoff inherited, and `actionState`. This package declares the contract; a runtime constructs the value. A completion wakes a parked run through `FlowRuntime.resume`.
|
|
969
|
+
|
|
970
|
+
### `FlowRuntime.DeferredDoneIfWaitingOutcome`
|
|
971
|
+
|
|
972
|
+
- **Type:** `"Completed" | "Existing" | "NotWaiting"`
|
|
973
|
+
- **Since:** `1.0.0`
|
|
974
|
+
|
|
975
|
+
The result of atomically completing a deferred only while its run is parked.
|
|
976
|
+
|
|
977
|
+
### `FlowRuntime.ResumeOptions`
|
|
978
|
+
|
|
979
|
+
- **Type:** `interface ResumeOptions { readonly delegated?: boolean | undefined }`
|
|
980
|
+
- **Since:** `1.0.0`
|
|
981
|
+
|
|
982
|
+
How a caller asks `resume` to re-drive a suspended execution. Without options, `resume` is the operator's own request, which is consent to recover a quarantined execution. `delegated: true` marks a background resume a host takes up for someone else, such as an approval decision or a saved request. A durable engine refuses it for a quarantined execution in the same transaction that reads the park, so a peer that quarantines the run after the host checked it cannot turn the delegation into recovery consent.
|
|
983
|
+
|
|
984
|
+
### `FlowRuntime.FlowRuntime`
|
|
985
|
+
|
|
986
|
+
- **Type:** `Context.Service` keyed `"@smthrs/flow/FlowRuntime"`
|
|
987
|
+
- **Since:** `0.1.0`
|
|
988
|
+
|
|
989
|
+
The port the authoring APIs are written against. It exposes `register`, `execute`, `poll`, `interrupt`, `interruptUnsafe`, `resume`, `actionExecute`, `deferredResult`, `deferredDone`, `deferredDoneIfWaiting`, `scheduleClock`, and the optional `recordNode` and `nodeRecordBytes`. This package declares the port and depends on nothing that implements it, so the dependency direction runs from `@smthrs/flow` to `@smthrs/engine` to the durable stores.
|
|
990
|
+
|
|
991
|
+
`recordNode(record: NodeRecord): Effect.Effect<void, never, FlowInstance>` is optional in the strong sense: a runtime that keeps no history leaves it absent and skips journal preflight. A recording runtime can refuse oversized node topology before the walk starts. An implementation must write the record under the record's own `sourceId` rather than minting an identity per observation, because that is what makes a resumed walk collapse onto the rows the first walk wrote instead of doubling every node.
|
|
992
|
+
|
|
993
|
+
### `FlowRuntime.NodeRecord`
|
|
994
|
+
|
|
995
|
+
- **Type:** `PlanRecorded | SubgraphAppended | NodeScheduled | NodeSettled`
|
|
996
|
+
- **Since:** `1.0.0`
|
|
997
|
+
|
|
998
|
+
What a driven graph tells its runtime about itself, and the only thing this package says about where the records go. Every record carries its own replay-stable `sourceId`, which is its producer identity. `PlanRecorded` carries `flow`, `generation`, `page`, `pages`, the whole graph's `nodeCount`, and this page's `nodes` and `edges`. `SubgraphAppended` is one further page of the same graph and carries everything but `nodeCount`. `NodeScheduled` carries `nodeId`, `kind`, `attempt`, and the optional `action`; no step key digest rides there, because the engine allocates a dispatch's ordinal when the dispatch happens, which is after the record is written. `NodeSettled` carries `nodeId`, `outcome`, `attempts`, `stepKeyDigests`, the optional `action`, and the `value` the node settled with. `attempts` is the highest durable attempt any of the node's dispatches ran as, so a node whose action was retried says two; `stepKeyDigests` names the distinct dispatches it drove, which is what joins `flows.engine.attempt-started` back to a plan node; `value` is handed over whole and unbounded, and bounding and redacting it belongs to the writer that knows where it is going. A large graph is paged rather than truncated, because a journal entry has a byte bound and a projection that clipped one would lose nodes silently.
|
|
999
|
+
|
|
1000
|
+
### `FlowRuntime.NodeSummary`
|
|
1001
|
+
|
|
1002
|
+
- **Type:** `interface NodeSummary { readonly id: string; readonly kind: string; readonly dependsOn: ReadonlyArray<string>; readonly tier: "sealed" | "compensable" | "irreversible"; readonly action?: string | undefined; readonly effects?: Plan.NodeEffects | undefined; readonly declaredAt?: { readonly path: string; readonly line: number } | undefined }`
|
|
1003
|
+
- **Since:** `1.0.0`
|
|
1004
|
+
|
|
1005
|
+
One node of the graph a run was driven from. `tier` and `effects` are the declaration's own and `dependsOn` is the material dependency set the plan compiles edges from. `action` is the tag the node dispatches, absent on every node that dispatches nothing. `declaredAt` is provenance and never identity: it is outside key material by construction, so a node recorded with it is keyed exactly as the same node without it.
|
|
1006
|
+
|
|
1007
|
+
### `FlowRuntime.EdgeSummary`
|
|
1008
|
+
|
|
1009
|
+
- **Type:** `interface EdgeSummary { readonly from: string; readonly to: string; readonly reason: "value" | "continuation" | "failure" }`
|
|
1010
|
+
- **Since:** `1.0.0`
|
|
1011
|
+
|
|
1012
|
+
One edge of the recorded graph, with the reason the builder drew it. A page carries the edges that END on its nodes, so an assembled set of pages is the whole graph and no page names an edge whose destination is missing.
|
|
1013
|
+
|
|
1014
|
+
### `FlowRuntime.NodeOutcome`
|
|
1015
|
+
|
|
1016
|
+
- **Type:** `"built" | "clean" | "failed" | "skipped"`
|
|
1017
|
+
- **Since:** `1.0.0`
|
|
1018
|
+
|
|
1019
|
+
How a node left the walk. `built` ran, `clean` was served entirely from durable records, `failed` raised, and `skipped` is a node the walk never reached: an untaken branch arm, or a dependent of something that failed.
|
|
1020
|
+
|
|
1021
|
+
### `FlowRuntime.WaitingAnnotation`
|
|
1022
|
+
|
|
1023
|
+
- **Type:** `interface WaitingAnnotation { readonly reason: string; readonly wakeAt?: number | undefined; readonly token?: string | undefined }`
|
|
1024
|
+
- **Schema:** `Schema.Struct({ reason: Schema.String, wakeAt: Schema.optional(Schema.Number), token: Schema.optional(Schema.String) })`
|
|
1025
|
+
- **Since:** `0.1.0`
|
|
1026
|
+
|
|
1027
|
+
The waiting classification a flow declares before suspending. `Flow.Park`
|
|
1028
|
+
carries this schema as its `reason`, so a parking request and the annotation
|
|
1029
|
+
that precedes a suspension cannot describe different waits.
|
|
1030
|
+
|
|
1031
|
+
### `FlowRuntime.annotateWaiting`
|
|
1032
|
+
|
|
1033
|
+
- **Signature:** `annotateWaiting(waiting: WaitingAnnotation | undefined): Effect.Effect<void, never, FlowInstance>`
|
|
1034
|
+
- **Since:** `0.1.0`
|
|
1035
|
+
|
|
1036
|
+
Declares how the flow is about to wait, so a durable driver parks the run under that reason and token instead of the derived `timer` or `event` default.
|
|
1037
|
+
|
|
1038
|
+
## Graph
|
|
1039
|
+
|
|
1040
|
+
### `Graph.EdgeReason`
|
|
1041
|
+
|
|
1042
|
+
- **Type:** `"value" | "continuation" | "failure"`
|
|
1043
|
+
- **Since:** `0.1.0`
|
|
1044
|
+
|
|
1045
|
+
Why one node depends on another. `value` consumes a result. `continuation` is the sequencing edge a builder or a branch arm records against the upstream node it was evaluated with.
|
|
1046
|
+
|
|
1047
|
+
### `Graph.Edge`
|
|
1048
|
+
|
|
1049
|
+
- **Type:** `interface Edge { readonly from: string; readonly to: string; readonly reason: EdgeReason }`
|
|
1050
|
+
- **Since:** `0.1.0`
|
|
1051
|
+
|
|
1052
|
+
A dependency edge, pointing from the node that produces to the node that consumes.
|
|
1053
|
+
|
|
1054
|
+
### `Graph.GraphNode`
|
|
1055
|
+
|
|
1056
|
+
- **Type:** `interface GraphNode` with `id`, `kind`, `dependencies`, `capabilities`, `placement`, `draft`, the authoring node it was observed at, and `declaredAt?: { readonly path: string; readonly line: number } | undefined`
|
|
1057
|
+
- **Since:** `0.1.0`
|
|
1058
|
+
|
|
1059
|
+
One observed node: its structural address, the authoring variant it came from, and the `Plan.NodeDraft` the plan is compiled from. `kind` is the authoring variant, not the plan's node kind. Every draft a graph produces is a plan `step`. `declaredAt` is where the declaration this node was observed at was written, when the runtime's stack format says so: it is provenance outside `KeyMaterial`, so a node carrying it is byte-identical to the same node without it, and it is absent for a node with no declaration to read and for a declaration the framework itself made.
|
|
1060
|
+
|
|
1061
|
+
### `Graph.LayerRequest`
|
|
1062
|
+
|
|
1063
|
+
- **Type:** `interface LayerRequest { readonly nodeId: string; readonly kind: Node.Ast["_tag"]; readonly capabilities: ReadonlyArray<string>; readonly effects: Annotations.Effects | undefined; readonly placement: unknown }`
|
|
1064
|
+
- **Since:** `0.1.0`
|
|
1065
|
+
|
|
1066
|
+
What a pure per-node layer resolver is told. It is the identity of the implementation a node would run against, never a layer value or a runtime handle.
|
|
1067
|
+
|
|
1068
|
+
### `Graph.BuildOptions`
|
|
1069
|
+
|
|
1070
|
+
- **Type:** `interface BuildOptions { readonly resolveLayers?: ((request: LayerRequest) => Iterable<string>) | undefined; readonly callbackIdentity?: "stable" | "process-local" | undefined; readonly root?: string | undefined }`
|
|
1071
|
+
- **Default:** `root` is `"root"`; `callbackIdentity` is `"process-local"`
|
|
1072
|
+
- **Since:** `0.1.0`
|
|
1073
|
+
|
|
1074
|
+
The options `Graph.build` takes. `resolveLayers` is invoked once per node and must be pure: planning performs no input or output, and a resolver that read the world would make a plan a function of more than its declarations.
|
|
1075
|
+
|
|
1076
|
+
### `Graph.Graph`
|
|
1077
|
+
|
|
1078
|
+
- **Type:** `interface Graph { readonly nodes: ReadonlyArray<GraphNode>; readonly edges: ReadonlyArray<Edge>; readonly diagnostics: ReadonlyArray<GraphBuildError> }`
|
|
1079
|
+
- **Since:** `0.1.0`
|
|
1080
|
+
|
|
1081
|
+
A built graph: the nodes in dependency order, the edges between them, and the refusals recoverable enough to report rather than throw. The drafts are deliberately not a field, because the derivation carries a refusal.
|
|
1082
|
+
|
|
1083
|
+
### `Graph.build`
|
|
1084
|
+
|
|
1085
|
+
- **Signature:** `build(flowOrNode: Flow.Any | Node.Any, payload?: unknown, options: BuildOptions = {}): Graph`
|
|
1086
|
+
- **Since:** `0.1.0`
|
|
1087
|
+
|
|
1088
|
+
Builds the graph of a flow declaration, or of a bare node, by walking the authoring tree once. Building is a pure function of the declarations and the payload, so the shape of a round is known before its first action runs. It refuses a nesting depth past its bound and a duplicate node id, because a node id is durable dispatch identity.
|
|
1089
|
+
|
|
1090
|
+
### `Graph.nodes`
|
|
1091
|
+
|
|
1092
|
+
- **Signature:** `nodes(graph: Graph): ReadonlyArray<GraphNode>`
|
|
1093
|
+
- **Since:** `0.1.0`
|
|
1094
|
+
|
|
1095
|
+
The observed nodes, children before the parents that consume them.
|
|
1096
|
+
|
|
1097
|
+
### `Graph.edges`
|
|
1098
|
+
|
|
1099
|
+
- **Signature:** `edges(graph: Graph): ReadonlyArray<Edge>`
|
|
1100
|
+
- **Since:** `0.1.0`
|
|
1101
|
+
|
|
1102
|
+
The dependency edges, in the order they were observed.
|
|
1103
|
+
|
|
1104
|
+
### `Graph.drafts`
|
|
1105
|
+
|
|
1106
|
+
- **Signature:** `drafts(graph: Graph): ReadonlyArray<Plan.NodeDraft>`
|
|
1107
|
+
- **Since:** `0.1.0`
|
|
1108
|
+
|
|
1109
|
+
The drafts, in node order, ready for `Plan.compile` or `Plan.append` unchanged. A graph carrying diagnostics is inspectable but not compilable, so this accessor throws the first typed build refusal instead of returning partial drafts.
|
|
1110
|
+
|
|
1111
|
+
### `Graph.diagnostics`
|
|
1112
|
+
|
|
1113
|
+
- **Signature:** `diagnostics(graph: Graph): ReadonlyArray<GraphBuildError>`
|
|
1114
|
+
- **Since:** `0.1.0`
|
|
1115
|
+
|
|
1116
|
+
The recoverable topology issues recorded during the build, such as a missing continuation builder or a continuation that produced no node. Fatal refusals, including computing on a planned value and a recursive inline `call`, throw from `Graph.build` and never appear here.
|
|
1117
|
+
|
|
1118
|
+
## HumanTask
|
|
1119
|
+
|
|
1120
|
+
### `HumanTask.Kind`
|
|
1121
|
+
|
|
1122
|
+
- **Type:** `"ask" | "confirm" | "select" | "json"` as a type, and `Schema.Literals(["ask", "confirm", "select", "json"])` as a schema
|
|
1123
|
+
- **Since:** `0.1.0`
|
|
1124
|
+
|
|
1125
|
+
The shape a person is asked for. `ask` wants prose, `confirm` wants a boolean, `select` wants one of the options the task names, and `json` wants a value the task's JSON Schema accepts.
|
|
1126
|
+
|
|
1127
|
+
### `HumanTask.HumanTaskFailed`
|
|
1128
|
+
|
|
1129
|
+
- **Type:** `Schema.TaggedError` with fields `code: "request_invalid" | "rejected" | "timeout"`, `task: string`, `attempts: number`, `rejections: ReadonlyArray<string>`, and `message: string`
|
|
1130
|
+
- **Since:** `0.1.0`
|
|
1131
|
+
|
|
1132
|
+
A question that ended without an answer the task could accept. `request_invalid` refuses an unanswerable question before anyone is asked. `rejected` means the attempt budget was spent on answers the task refused. `timeout` means the deadline passed with the question open.
|
|
1133
|
+
|
|
1134
|
+
### `HumanTask.HumanAnswerInvalid`
|
|
1135
|
+
|
|
1136
|
+
- **Type:** `Schema.TaggedError` with fields `code: "answer_invalid" | "answer_not_open"` and `message: string`
|
|
1137
|
+
- **Default:** `code` defaults to `"answer_invalid"`
|
|
1138
|
+
- **Since:** `1.0.0`
|
|
1139
|
+
|
|
1140
|
+
An answer refused before it could consume durable storage.
|
|
1141
|
+
|
|
1142
|
+
### `HumanTask.tag`
|
|
1143
|
+
|
|
1144
|
+
- **Type:** `"system/human-task"`
|
|
1145
|
+
- **Since:** `0.1.0`
|
|
1146
|
+
|
|
1147
|
+
The tag the human-task declaration is catalogued and resolved under.
|
|
1148
|
+
|
|
1149
|
+
### `HumanTask.defaultMaxAttempts`
|
|
1150
|
+
|
|
1151
|
+
- **Type:** `10`
|
|
1152
|
+
- **Since:** `0.1.0`
|
|
1153
|
+
|
|
1154
|
+
The attempt budget a task that names none is asked under.
|
|
1155
|
+
|
|
1156
|
+
### `HumanTask.maxSchemaDepth`
|
|
1157
|
+
|
|
1158
|
+
- **Type:** `32`
|
|
1159
|
+
- **Since:** `0.1.0`
|
|
1160
|
+
|
|
1161
|
+
The deepest supported JSON Schema path, counting the root as depth zero.
|
|
1162
|
+
|
|
1163
|
+
### `HumanTask.maxSchemaNodes`
|
|
1164
|
+
|
|
1165
|
+
- **Type:** `512`
|
|
1166
|
+
- **Since:** `0.1.0`
|
|
1167
|
+
|
|
1168
|
+
The most schema objects one human-task request may contain.
|
|
1169
|
+
|
|
1170
|
+
### `HumanTask.maxSchemaValueNodes`
|
|
1171
|
+
|
|
1172
|
+
- **Type:** `10_000`
|
|
1173
|
+
- **Since:** `1.0.0`
|
|
1174
|
+
|
|
1175
|
+
The most JSON values embedded across schema keywords such as `enum`.
|
|
1176
|
+
|
|
1177
|
+
### `HumanTask.maxSchemaValueDepth`
|
|
1178
|
+
|
|
1179
|
+
- **Type:** `64`
|
|
1180
|
+
- **Since:** `1.0.0`
|
|
1181
|
+
|
|
1182
|
+
The deepest JSON value embedded in a schema, including enum members.
|
|
1183
|
+
|
|
1184
|
+
### `HumanTask.maxAnswerNodes`
|
|
1185
|
+
|
|
1186
|
+
- **Type:** `10_000`
|
|
1187
|
+
- **Since:** `0.1.0`
|
|
1188
|
+
|
|
1189
|
+
The most JSON values one answer validation may visit.
|
|
1190
|
+
|
|
1191
|
+
### `HumanTask.maxAnswerBytes`
|
|
1192
|
+
|
|
1193
|
+
- **Type:** `256 * 1024`
|
|
1194
|
+
- **Since:** `1.0.0`
|
|
1195
|
+
|
|
1196
|
+
The largest encoded JSON answer that can enter the durable store.
|
|
1197
|
+
|
|
1198
|
+
### `HumanTask.maxSchemaBytes`
|
|
1199
|
+
|
|
1200
|
+
- **Type:** `256 * 1024`
|
|
1201
|
+
- **Since:** `1.0.0`
|
|
1202
|
+
|
|
1203
|
+
The largest encoded JSON Schema carried by one question.
|
|
1204
|
+
|
|
1205
|
+
### `HumanTask.maxAnswerDepth`
|
|
1206
|
+
|
|
1207
|
+
- **Type:** `64`
|
|
1208
|
+
- **Since:** `1.0.0`
|
|
1209
|
+
|
|
1210
|
+
The deepest admitted answer tree.
|
|
1211
|
+
|
|
1212
|
+
### `HumanTask.maxJsonStringBytes`
|
|
1213
|
+
|
|
1214
|
+
- **Type:** `128 * 1024`
|
|
1215
|
+
- **Since:** `1.0.0`
|
|
1216
|
+
|
|
1217
|
+
The largest encoded string value admitted in a request or an answer.
|
|
1218
|
+
|
|
1219
|
+
### `HumanTask.maxJsonKeyBytes`
|
|
1220
|
+
|
|
1221
|
+
- **Type:** `4 * 1024`
|
|
1222
|
+
- **Since:** `1.0.0`
|
|
1223
|
+
|
|
1224
|
+
The largest encoded object key admitted in a request or an answer.
|
|
1225
|
+
|
|
1226
|
+
### `HumanTask.maxJsonMembers`
|
|
1227
|
+
|
|
1228
|
+
- **Type:** `10_000`
|
|
1229
|
+
- **Since:** `1.0.0`
|
|
1230
|
+
|
|
1231
|
+
The most members admitted in one JSON array or object.
|
|
1232
|
+
|
|
1233
|
+
### `HumanTask.maxTaskNameBytes`
|
|
1234
|
+
|
|
1235
|
+
- **Type:** `1_024`
|
|
1236
|
+
- **Since:** `1.0.0`
|
|
1237
|
+
|
|
1238
|
+
The largest encoded task name.
|
|
1239
|
+
|
|
1240
|
+
### `HumanTask.maxPromptBytes`
|
|
1241
|
+
|
|
1242
|
+
- **Type:** `64 * 1024`
|
|
1243
|
+
- **Since:** `1.0.0`
|
|
1244
|
+
|
|
1245
|
+
The largest encoded prompt.
|
|
1246
|
+
|
|
1247
|
+
### `HumanTask.maxOptions`
|
|
1248
|
+
|
|
1249
|
+
- **Type:** `256`
|
|
1250
|
+
- **Since:** `1.0.0`
|
|
1251
|
+
|
|
1252
|
+
The largest option list on one select question.
|
|
1253
|
+
|
|
1254
|
+
### `HumanTask.maxOptionBytes`
|
|
1255
|
+
|
|
1256
|
+
- **Type:** `4 * 1024`
|
|
1257
|
+
- **Since:** `1.0.0`
|
|
1258
|
+
|
|
1259
|
+
The largest encoded select option.
|
|
1260
|
+
|
|
1261
|
+
### `HumanTask.maxAttemptBudget`
|
|
1262
|
+
|
|
1263
|
+
- **Type:** `1_000`
|
|
1264
|
+
- **Since:** `0.1.0`
|
|
1265
|
+
|
|
1266
|
+
The largest attempt budget one human task may declare.
|
|
1267
|
+
|
|
1268
|
+
### `HumanTask.maxDiagnosticChars`
|
|
1269
|
+
|
|
1270
|
+
- **Type:** `512`
|
|
1271
|
+
- **Since:** `0.1.0`
|
|
1272
|
+
|
|
1273
|
+
The most caller-supplied characters retained in one rendered diagnostic. A longer value is truncated with an explicit marker.
|
|
1274
|
+
|
|
1275
|
+
### `HumanTask.maxRetainedRejectionChars`
|
|
1276
|
+
|
|
1277
|
+
- **Type:** `8_192`
|
|
1278
|
+
- **Since:** `0.1.0`
|
|
1279
|
+
|
|
1280
|
+
The most characters retained across a terminal failure's rejection list. The list records how many further rejections it omitted, and each per-attempt journal step still holds its own full reason.
|
|
1281
|
+
|
|
1282
|
+
### `HumanTask.deferred`
|
|
1283
|
+
|
|
1284
|
+
- **Signature:** `deferred(name: string, attempt: number): DurableDeferred.DurableDeferred<typeof Schema.Json>`
|
|
1285
|
+
- **Since:** `0.1.0`
|
|
1286
|
+
|
|
1287
|
+
The durable deferred one attempt at answering resolves through, named `WaitFor/<name>#<attempt>`. Attempts are separate wait points, because a durable deferred records the first completion and replays it forever.
|
|
1288
|
+
|
|
1289
|
+
### `HumanTask.Request`
|
|
1290
|
+
|
|
1291
|
+
- **Type:** `interface Request { readonly kind: Kind; readonly options?: ReadonlyArray<string> | undefined; readonly schema?: unknown }`
|
|
1292
|
+
- **Since:** `0.1.0`
|
|
1293
|
+
|
|
1294
|
+
What `HumanTask.validate` checks an answer against. `options` is ignored for `json`, because an option list alone constrains no JSON value.
|
|
1295
|
+
|
|
1296
|
+
### `HumanTask.validateSchema`
|
|
1297
|
+
|
|
1298
|
+
- **Signature:** `validateSchema(schema: unknown, path: ReadonlyArray<string> = []): string | undefined`
|
|
1299
|
+
- **Since:** `0.1.0`
|
|
1300
|
+
|
|
1301
|
+
Checks that a JSON Schema stays inside the bounded subset at every depth. It returns the first reason the schema is out of bounds, or `undefined` when the whole tree is inside it.
|
|
1302
|
+
|
|
1303
|
+
### `HumanTask.validate`
|
|
1304
|
+
|
|
1305
|
+
- **Signature:** `validate(value: unknown, request: Request): string | undefined`
|
|
1306
|
+
- **Since:** `0.1.0`
|
|
1307
|
+
|
|
1308
|
+
Checks one answer against the question that was asked. It returns the reason the answer was refused, or `undefined`. Run it in the interface so a typo is refused while the person is still looking at it.
|
|
1309
|
+
|
|
1310
|
+
### `HumanTask.action`
|
|
1311
|
+
|
|
1312
|
+
- **Type:** `Action.Declared<typeof tag, Schema.Struct<{ name, kind, prompt, options?, schema?, timeoutMs?, maxAttempts? }>, typeof Schema.Json, typeof HumanTaskFailed, never>`
|
|
1313
|
+
- **Since:** `0.1.0`
|
|
1314
|
+
|
|
1315
|
+
The declared `system/human-task` step. `name` addresses the question, so two calls naming one question in one execution await one answer. The node settles with the answer, and `HumanTask.decode` gives that answer the caller's own type.
|
|
1316
|
+
|
|
1317
|
+
### `HumanTask.layer`
|
|
1318
|
+
|
|
1319
|
+
- **Type:** `Layer.Layer<never, never, Crypto.Crypto | FlowRuntime>`
|
|
1320
|
+
- **Since:** `0.1.0`
|
|
1321
|
+
|
|
1322
|
+
The human-task implementation: park, validate, re-ask, settle. Provide it beside the other action implementation layers, over `Action.layerImplementations`.
|
|
1323
|
+
|
|
1324
|
+
### `HumanTask.answer`
|
|
1325
|
+
|
|
1326
|
+
- **Signature:** `answer(options: { readonly token: DurableDeferred.Token; readonly value: typeof Schema.Json.Type }): Effect.Effect<void, DurableDeferred.TokenInvalid | HumanAnswerInvalid, FlowRuntime>`
|
|
1327
|
+
- **Since:** `0.1.0`
|
|
1328
|
+
|
|
1329
|
+
Records one answer to a human task. `token` is the value the run parked with. The runtime checks that exact approval wait and records the completion as one mutation, so a guessed, unopened, or stale token cannot pre-answer a run. A token whose deferred name `HumanTask.deferred` could not have written fails with `TokenInvalid` carrying `deferred_mismatch`. The token does not authorize the caller: anyone who knows or derives the open attempt's address can answer it, so the host must decide who may answer before calling `answer`.
|
|
1330
|
+
|
|
1331
|
+
### `HumanTask.decode`
|
|
1332
|
+
|
|
1333
|
+
- **Signature:** `decode<S extends Schema.ConstraintDecoder<unknown>>(schema: S): <E, R>(self: Node.Node<typeof Schema.Json.Type, E, R>) => Node.Node<S["Type"], E, R>`
|
|
1334
|
+
- **Since:** `0.1.0`
|
|
1335
|
+
|
|
1336
|
+
Gives an answer the caller's own type. The schema here and the question's own schema description must agree; a disagreement surfaces as a defect rather than a failure a body could catch.
|
|
1337
|
+
|
|
1338
|
+
## Interpreter
|
|
1339
|
+
|
|
1340
|
+
### `Interpreter.InterpreterError`
|
|
1341
|
+
|
|
1342
|
+
- **Type:** `Schema.TaggedError` with fields `code`, `flow: string`, `node: string`, and `message: string`
|
|
1343
|
+
- **Since:** `0.1.0`
|
|
1344
|
+
|
|
1345
|
+
A graph the interpreter refuses to drive. The `code` is one of `incomplete_graph`, `duplicate_node_id`, `unresolved_action`, `implementation_version_mismatch`, `missing_implementation_version`, `unresolved_reference`, `unsupported_call`, `missing_operation`, `node_record_too_large`, or `join_mismatch` (a race, any, or quorum journaled members, or a losing child boundary, its plan can no longer reproduce).
|
|
1346
|
+
|
|
1347
|
+
### `Interpreter.Interpretation`
|
|
1348
|
+
|
|
1349
|
+
- **Type:** `interface Interpretation { readonly value: unknown; readonly settled: ReadonlyMap<string, unknown>; readonly failed: ReadonlyMap<string, unknown>; readonly skipped: ReadonlyArray<string> }`
|
|
1350
|
+
- **Since:** `0.1.0`
|
|
1351
|
+
|
|
1352
|
+
What one interpretation produced: the root's value, every node that settled with the value it settled with, the typed failures observed before a catch recovered them, and the nodes the run never reached because a branch went the other way.
|
|
1353
|
+
|
|
1354
|
+
### `Interpreter.childExecutionId`
|
|
1355
|
+
|
|
1356
|
+
- **Signature:** `childExecutionId(parentExecutionId: string, nodeId: string, calleeTag: string, payload: unknown): Effect.Effect<string, never, Crypto.Crypto>`
|
|
1357
|
+
- **Since:** `0.1.0`
|
|
1358
|
+
|
|
1359
|
+
The execution id a `child` boundary runs its child under, derived from the parent execution id, the node id, the callee tag, and the payload digest.
|
|
1360
|
+
|
|
1361
|
+
### `Interpreter.maximumPageBytes`
|
|
1362
|
+
|
|
1363
|
+
- **Type:** `number`
|
|
1364
|
+
- **Default:** `12_000`
|
|
1365
|
+
- **Since:** `1.0.0`
|
|
1366
|
+
|
|
1367
|
+
The largest UTF-8 encoded plan page, including its envelope. The runtime's
|
|
1368
|
+
optional `nodeRecordBytes` hook measures a conservative complete journal entry;
|
|
1369
|
+
without a writer hook the interpreter measures the whole node record. Nothing
|
|
1370
|
+
about one node has to fit one page: a node is seated with no dependencies on
|
|
1371
|
+
it, and its dependency list and its incoming edges are spread over as many
|
|
1372
|
+
following pages as they need, so an input-driven fan-in of any width is
|
|
1373
|
+
recorded rather than refused. A continuation page re-seats the same summary
|
|
1374
|
+
with the next disjoint slice of `dependsOn`; a reader assembles pages in order,
|
|
1375
|
+
unions `dependsOn` per node id and concatenates edges. Only a node whose
|
|
1376
|
+
summary with NO dependencies on it still exceeds the budget is refused, with
|
|
1377
|
+
`node_record_too_large`, before any page or action is written. Every page has a
|
|
1378
|
+
deterministic source id across resume. The gateway refuses a bridged graph
|
|
1379
|
+
event exceeding 16 KiB including its control envelope; it never clips
|
|
1380
|
+
topology.
|
|
1381
|
+
|
|
1382
|
+
### `Interpreter.interpret`
|
|
1383
|
+
|
|
1384
|
+
- **Signature:** `interpret(flowOrNode: Flow.Any | Node.Any, payload?: unknown, options: Graph.BuildOptions = {}): Effect.Effect<Interpretation, unknown, Services>`
|
|
1385
|
+
- **Since:** `0.1.0`
|
|
1386
|
+
|
|
1387
|
+
Builds and walks the graph of a flow body, or of a bare node, against real values. The walk is demand-driven from the root rather than a sweep over the node list, because dependency order puts both branch arms before the branch that chooses between them.
|
|
1388
|
+
|
|
1389
|
+
One call is one interpretation of one execution. A runtime that implements `recordNode` addresses the records of a call by the graph's own ids under the current execution, so calling `interpret` twice inside a single execution would address the second graph's records exactly as the first graph's, and a journal that dedupes on identity would keep the first. `Interpreter.layer` gives every trampoline round its own execution id and never does this; a direct caller that wants two graphs recorded separately runs them under separate executions.
|
|
1390
|
+
|
|
1391
|
+
### `Interpreter.layer`
|
|
1392
|
+
|
|
1393
|
+
- **Type:** `Layer.Layer<never, never, FlowRuntime | Implementations | ...schema services>`
|
|
1394
|
+
- **Signature:** `layer(flow: Flow<Tag, Payload, Success, Error, any>, options: Graph.BuildOptions = {}): Layer.Layer<...>`
|
|
1395
|
+
- **Since:** `0.1.0`
|
|
1396
|
+
|
|
1397
|
+
Registers a flow with the runtime and installs the handler that drives its body. It is the only way a flow's behavior reaches the runtime, and the reason a flow has no `toLayer`. Compose it beside the action implementation layers the body calls, over `Action.layerImplementations`.
|
|
1398
|
+
|
|
1399
|
+
### `Interpreter.layerWithImplementations`
|
|
1400
|
+
|
|
1401
|
+
- **Signature:** `layerWithImplementations(flow: Flow<Tag, Payload, Success, Error, Requires>, implementations: Layer.Layer<Provided, E, R>, options: Graph.BuildOptions = {}): Layer.Layer<...>`
|
|
1402
|
+
- **Since:** `0.1.0`
|
|
1403
|
+
|
|
1404
|
+
Builds the interpreter and the action implementations against one fresh, isolated `Action.Implementations` table. The types require every action the flow names. `callbackIdentity` defaults to `"stable"`. A conflicting same-tag registration dies during layer construction unless it passes `{ override: true }`.
|
|
1405
|
+
|
|
1406
|
+
## Poll
|
|
1407
|
+
|
|
1408
|
+
### `Poll.Backoff`
|
|
1409
|
+
|
|
1410
|
+
- **Type:** `"fixed" | "linear" | "exponential"`
|
|
1411
|
+
- **Since:** `0.1.0`
|
|
1412
|
+
|
|
1413
|
+
How the wait between attempts grows.
|
|
1414
|
+
|
|
1415
|
+
### `Poll.Check`
|
|
1416
|
+
|
|
1417
|
+
- **Type:** `interface Check<out Result> { readonly satisfied: boolean; readonly output: Result }`
|
|
1418
|
+
- **Since:** `0.1.0`
|
|
1419
|
+
|
|
1420
|
+
What a check reports: whether the poll is over, and the value this attempt read.
|
|
1421
|
+
|
|
1422
|
+
### `Poll.CheckResult`
|
|
1423
|
+
|
|
1424
|
+
- **Signature:** `CheckResult<Result extends Schema.Top>(result: Result): Schema.Struct<{ readonly satisfied: typeof Schema.Boolean; readonly output: Result }>`
|
|
1425
|
+
- **Since:** `0.1.0`
|
|
1426
|
+
|
|
1427
|
+
The success schema a check action declares.
|
|
1428
|
+
|
|
1429
|
+
### `Poll.PollExhausted`
|
|
1430
|
+
|
|
1431
|
+
- **Type:** `Schema.TaggedError` with fields `code: "poll_exhausted"`, `poll: string`, `attempts: number`, and `message: string`
|
|
1432
|
+
- **Since:** `0.1.0`
|
|
1433
|
+
|
|
1434
|
+
A poll used its last attempt without a satisfied check. The wire shape freezes at 1.0.0-rc.0.
|
|
1435
|
+
|
|
1436
|
+
### `Poll.exhaustedTag`
|
|
1437
|
+
|
|
1438
|
+
- **Type:** `"system/poll-exhausted"`
|
|
1439
|
+
- **Since:** `0.1.0`
|
|
1440
|
+
|
|
1441
|
+
The tag the exhaustion step is catalogued and resolved under.
|
|
1442
|
+
|
|
1443
|
+
### `Poll.exhausted`
|
|
1444
|
+
|
|
1445
|
+
- **Type:** `Action.Declared<typeof exhaustedTag, Schema.Struct<{ readonly poll: typeof Schema.String; readonly attempts: typeof Schema.Number }>, typeof Schema.Never, typeof PollExhausted, never>`
|
|
1446
|
+
- **Since:** `0.1.0`
|
|
1447
|
+
|
|
1448
|
+
The declared step a poll takes when its last attempt was not satisfied.
|
|
1449
|
+
|
|
1450
|
+
### `Poll.delayMillis`
|
|
1451
|
+
|
|
1452
|
+
- **Signature:** `delayMillis(options: { readonly intervalMs: number; readonly backoff: Backoff; readonly attempt: number }): number`
|
|
1453
|
+
- **Since:** `0.1.0`
|
|
1454
|
+
|
|
1455
|
+
The wait before the attempt after this one, in milliseconds. `fixed` returns the interval, `linear` multiplies it by the attempt, and `exponential` multiplies it by 2 raised to the attempt minus one.
|
|
1456
|
+
|
|
1457
|
+
### `Poll.Failure`
|
|
1458
|
+
|
|
1459
|
+
- **Type:** `Schema.Union<readonly [typeof PollExhausted, typeof Sleep.SleepRequestInvalid]>`
|
|
1460
|
+
- **Since:** `0.1.0`
|
|
1461
|
+
|
|
1462
|
+
What a poll round can fail with. `SleepRequestInvalid` is part of it because the wait between attempts is an ordinary `Sleep.action` node, and a round payload can carry an attempt that derives an invalid wait.
|
|
1463
|
+
|
|
1464
|
+
### `Poll.PayloadSchema`
|
|
1465
|
+
|
|
1466
|
+
- **Type:** `Schema.Struct<Input & { readonly attempt: Schema.optional<typeof Schema.Number> }>`
|
|
1467
|
+
- **Since:** `0.1.0`
|
|
1468
|
+
|
|
1469
|
+
The payload schema `Poll.make` derives from an author's input fields: the author's own fields, plus the attempt this round is. `attempt` is optional, and the first round reads it as one.
|
|
1470
|
+
|
|
1471
|
+
### `Poll.make`
|
|
1472
|
+
|
|
1473
|
+
- **Signature:** `make(tag: Tag, options: { readonly input: Input; readonly result: Result; readonly check: (payload: Schema.Struct.Type<Input> & { readonly attempt: number }) => Node.Node<Check<Result["Type"]>, never, R>; readonly intervalMs: number; readonly maxAttempts: number; readonly backoff?: Backoff | undefined; readonly onTimeout?: "fail" | "return-last" | undefined }): Flow.Flow<Tag, PayloadSchema<Input>, Result, typeof Failure, R>`
|
|
1474
|
+
- **Required:** `input`, `result`, `check`, `intervalMs`, and `maxAttempts`
|
|
1475
|
+
- **Since:** `0.1.0`
|
|
1476
|
+
|
|
1477
|
+
Declares a durable poller and returns an ordinary flow. Its body is one attempt: run `check`, then either settle the lineage with the check's output or sleep for this attempt's delay and hand off to the next round with the attempt counter raised. `maxAttempts` is also the flow's `maxRounds`. `onTimeout` chooses between failing with `PollExhausted` at the bound and answering with the last check output. The check may not fail; state what a failure means with `Node.catch` inside the fragment.
|
|
1478
|
+
|
|
1479
|
+
`Poll.make` throws a `TypeError` when `input` declares the reserved `attempt` field, and a `RangeError` when `intervalMs` is not a duration a clock accepts, when `maxAttempts` is not a whole number of attempts of at least one, or when the interval under the declared backoff reaches a wait no clock can be armed with before the budget is spent.
|
|
1480
|
+
|
|
1481
|
+
### `Poll.layer`
|
|
1482
|
+
|
|
1483
|
+
- **Type:** `Layer.Layer<never, never, Crypto.Crypto | FlowRuntime>`
|
|
1484
|
+
- **Since:** `0.1.0`
|
|
1485
|
+
|
|
1486
|
+
The exhaustion implementation, provided beside the other action layers a poll's rounds call.
|
|
1487
|
+
|
|
1488
|
+
## RetryPolicy
|
|
1489
|
+
|
|
1490
|
+
### `RetryPolicy.RetryPolicy`
|
|
1491
|
+
|
|
1492
|
+
- **Type:** `Schema.Struct({ initialMs: Schema.Number, factor: Schema.Number, maxMs: Schema.Number, maxAttempts: Schema.optional(Schema.Number), expirationMs: Schema.optional(Schema.Number), jitterRatio: Schema.optional(Schema.Number), nonRetryable: Schema.optional(Schema.Array(Schema.String)) })` refined by a `validRetryPolicy` filter, with the type alias `typeof RetryPolicy.Type`
|
|
1493
|
+
- **Since:** `0.1.0`
|
|
1494
|
+
|
|
1495
|
+
A retry policy as plain data, so the next delay is derived from a persisted attempt count instead of fiber-local `Schedule` state. Decoding enforces the same relational contract as `RetryPolicy.make`, so persisted data cannot bypass the constructor checks.
|
|
1496
|
+
|
|
1497
|
+
### `RetryPolicy.make`
|
|
1498
|
+
|
|
1499
|
+
- **Signature:** `make(options: { readonly initialMs: number; readonly factor: number; readonly maxMs: number; readonly maxAttempts?: number | undefined; readonly expirationMs?: number | undefined; readonly jitterRatio?: number | undefined; readonly nonRetryable?: ReadonlyArray<string> | undefined }): RetryPolicy`
|
|
1500
|
+
- **Required:** `initialMs`, `factor`, and `maxMs`
|
|
1501
|
+
- **Since:** `0.1.0`
|
|
1502
|
+
|
|
1503
|
+
Creates a policy after checking every numeric bound, and throws a `RangeError` naming the field that is wrong: `initialMs` finite and greater than zero, `factor` finite and positive, `maxMs` finite and not below `initialMs`, `maxAttempts` a safe integer of at least one, `expirationMs` finite and positive, and `jitterRatio` finite and within zero and one inclusive. `initialMs: 0` is refused rather than read as an immediate retry, because every computed delay would be zero and `nextDelay` would report the policy exhausted on the first failure; use `initialMs: 1` for a near-immediate retry. `jitterRatio: 0` disables jitter. The `nonRetryable` array is copied and frozen, so a later mutation of the caller's array cannot change what a parked policy means.
|
|
1504
|
+
|
|
1505
|
+
### `RetryPolicy.transient`
|
|
1506
|
+
|
|
1507
|
+
- **Type:** `RetryPolicy`
|
|
1508
|
+
|
|
1509
|
+
Frozen infrastructure policy: `initialMs: 5000`, `factor: 2`, `maxMs: 300000`,
|
|
1510
|
+
`expirationMs: 7200000`. Dispatch uses it by default for repeat-safe typed
|
|
1511
|
+
infrastructure failures; `Fault.retryTransient` uses it for plain effects.
|
|
1512
|
+
|
|
1513
|
+
### `RetryPolicy.defaultRetryPolicy`
|
|
1514
|
+
|
|
1515
|
+
- **Type:** `RetryPolicy`
|
|
1516
|
+
- **Default:** `{ initialMs: 200, factor: 1.5, maxMs: 30000 }`
|
|
1517
|
+
- **Since:** `0.1.0`
|
|
1518
|
+
|
|
1519
|
+
The default engine retry policy. It declares neither `maxAttempts` nor `expirationMs`, so it never gives up. Bound long-lived retries with `make({ ..., expirationMs })` when a wall-clock give-up is required.
|
|
1520
|
+
|
|
1521
|
+
### `RetryPolicy.RetryAfter`
|
|
1522
|
+
|
|
1523
|
+
- **Type:** `interface RetryAfter { readonly _tag: "RetryAfter"; readonly delayMs: number }`
|
|
1524
|
+
- **Since:** `0.1.0`
|
|
1525
|
+
|
|
1526
|
+
A retry decision: wait `delayMs` before the next attempt.
|
|
1527
|
+
|
|
1528
|
+
### `RetryPolicy.GiveUp`
|
|
1529
|
+
|
|
1530
|
+
- **Type:** `interface GiveUp { readonly _tag: "GiveUp"; readonly reason: "nonRetryable" | "exhausted" | "expired" }`
|
|
1531
|
+
- **Since:** `0.1.0`
|
|
1532
|
+
|
|
1533
|
+
A retry decision: stop retrying, with the reason the policy stopped.
|
|
1534
|
+
|
|
1535
|
+
### `RetryPolicy.RetryDecision`
|
|
1536
|
+
|
|
1537
|
+
- **Type:** `RetryAfter | GiveUp`
|
|
1538
|
+
- **Since:** `0.1.0`
|
|
1539
|
+
|
|
1540
|
+
The outcome of the engine's retry decision point.
|
|
1541
|
+
|
|
1542
|
+
### `RetryPolicy.retryAfter`
|
|
1543
|
+
|
|
1544
|
+
- **Signature:** `retryAfter(delayMs: number): RetryDecision`
|
|
1545
|
+
- **Since:** `0.1.0`
|
|
1546
|
+
|
|
1547
|
+
Creates a `RetryAfter` decision.
|
|
1548
|
+
|
|
1549
|
+
### `RetryPolicy.giveUp`
|
|
1550
|
+
|
|
1551
|
+
- **Signature:** `giveUp(reason: GiveUp["reason"]): RetryDecision`
|
|
1552
|
+
- **Since:** `0.1.0`
|
|
1553
|
+
|
|
1554
|
+
Creates a `GiveUp` decision.
|
|
1555
|
+
|
|
1556
|
+
### `RetryPolicy.RetryPolicyExpired`
|
|
1557
|
+
|
|
1558
|
+
- **Type:** `Schema.TaggedError` with fields `code: "retry_policy_expired"`, `actionName: string`, `attempt: number`, `expirationMs: number`, and optional `lastError`
|
|
1559
|
+
- **Since:** `0.1.0`
|
|
1560
|
+
|
|
1561
|
+
A historical retry sequence crossed the policy's `expirationMs` wall-clock bound. Current engines preserve the final declared failure instead; the schema remains for reading old outcomes.
|
|
1562
|
+
|
|
1563
|
+
### `RetryPolicy.RetryAttemptsExhausted`
|
|
1564
|
+
|
|
1565
|
+
- **Type:** `Schema.TaggedError` with fields `code: "retry_attempts_exhausted"`, `actionName: string`, `attempt: number`, `maxAttempts: number`, and optional `lastError`
|
|
1566
|
+
- **Since:** `0.1.0`
|
|
1567
|
+
|
|
1568
|
+
A historical retry sequence exhausted the policy's `maxAttempts` bound. Current engines preserve the final declared failure instead; the schema remains for reading old outcomes.
|
|
1569
|
+
|
|
1570
|
+
### `RetryPolicy.nextDelay`
|
|
1571
|
+
|
|
1572
|
+
- **Signature:** `nextDelay(policy: RetryPolicy, attempt: number, options?: { readonly random?: number | undefined; readonly elapsedMs?: number | undefined }): Option.Option<number>`
|
|
1573
|
+
- **Default:** `random` is `1`, which leaves the delay un-jittered
|
|
1574
|
+
- **Since:** `0.1.0`
|
|
1575
|
+
|
|
1576
|
+
Computes the delay before attempt `attempt + 1` from the persisted attempt count, mirroring Temporal's `ComputeNextDelay`. `attempt` is the one-based attempt that failed. It returns `None` when the policy gives up: `maxAttempts` reached, a non-positive computed interval, a cap below the initial interval, or an elapsed duration past `expirationMs`. It is total even for a policy decoded from a persisted row, so a non-finite attempt, elapsed time, bound, or computed delay answers `None` rather than handing the engine a negative or `NaN` duration.
|
|
1577
|
+
|
|
1578
|
+
### `RetryPolicy.nextDelayEffect`
|
|
1579
|
+
|
|
1580
|
+
- **Signature:** `nextDelayEffect(policy: RetryPolicy, attempt: number, options?: { readonly elapsedMs?: number | undefined }): Effect.Effect<Option.Option<number>>`
|
|
1581
|
+
- **Since:** `0.1.0`
|
|
1582
|
+
|
|
1583
|
+
Computes the next delay, sampling the `Random` service for jitter. A policy with no `jitterRatio`, or one at or below zero, skips the sample.
|
|
1584
|
+
|
|
1585
|
+
### `RetryPolicy.errorTag`
|
|
1586
|
+
|
|
1587
|
+
- **Signature:** `errorTag(error: unknown): string | undefined`
|
|
1588
|
+
- **Since:** `0.1.0`
|
|
1589
|
+
|
|
1590
|
+
Extracts the stable identity tag of an error for non-retryable matching: an own string `_tag` when present, otherwise the first own `name` descriptor found while walking a bounded prototype chain. That first descriptor decides the result, and only a string data value is a tag.
|
|
1591
|
+
|
|
1592
|
+
### `RetryPolicy.defaultNonRetryable`
|
|
1593
|
+
|
|
1594
|
+
- **Type:** `ReadonlyArray<string>`
|
|
1595
|
+
- **Default:** `["@smthrs/engine-store/CacheCorruptionDetected", "@smthrs/engine-store/AttemptEvidenceQuarantined"]`
|
|
1596
|
+
- **Since:** `0.1.0`
|
|
1597
|
+
|
|
1598
|
+
The error tags that are non-retryable by type, under every policy. They are integrity verdicts that must reach the driver without an action-level retry hiding the first detection. There is no per-callsite or per-policy opt-out.
|
|
1599
|
+
|
|
1600
|
+
### `RetryPolicy.isNonRetryable`
|
|
1601
|
+
|
|
1602
|
+
- **Signature:** `isNonRetryable(policy: RetryPolicy, error: unknown): boolean`
|
|
1603
|
+
- **Since:** `0.1.0`
|
|
1604
|
+
|
|
1605
|
+
Whether an error is classified non-retryable, by `defaultNonRetryable` or by the policy's declared tag list.
|
|
1606
|
+
|
|
1607
|
+
### `RetryPolicy.decide`
|
|
1608
|
+
|
|
1609
|
+
- **Signature:** `decide(policy: RetryPolicy, options: { readonly attempt: number; readonly error: unknown; readonly random?: number | undefined; readonly elapsedMs?: number | undefined }): RetryDecision`
|
|
1610
|
+
- **Since:** `0.1.0`
|
|
1611
|
+
|
|
1612
|
+
The pure core of the engine's single retry decision point. Non-retryable errors are classified here and nowhere else.
|
|
1613
|
+
|
|
1614
|
+
### `RetryPolicy.decideEffect`
|
|
1615
|
+
|
|
1616
|
+
- **Signature:** `decideEffect(policy: RetryPolicy, options: { readonly attempt: number; readonly error: unknown; readonly elapsedMs?: number | undefined }): Effect.Effect<RetryDecision>`
|
|
1617
|
+
- **Since:** `0.1.0`
|
|
1618
|
+
|
|
1619
|
+
The effect form of `RetryPolicy.decide`, sampling the `Random` service for jitter. It is the engine-facing decision function.
|
|
1620
|
+
|
|
1621
|
+
## Sleep
|
|
1622
|
+
|
|
1623
|
+
### `Sleep.SleepRequestInvalid`
|
|
1624
|
+
|
|
1625
|
+
- **Type:** `Schema.TaggedError` with fields `code: "missing_deadline" | "ambiguous_deadline" | "invalid_deadline"` and `message: string`
|
|
1626
|
+
- **Since:** `0.1.0`
|
|
1627
|
+
|
|
1628
|
+
A sleep whose payload does not name exactly one deadline. `missing_deadline` names neither `millis` nor `until`. `ambiguous_deadline` names both. `invalid_deadline` names a number that is not a length of time: a non-finite or negative `millis`, a non-finite `until`, or an addition that overflows.
|
|
1629
|
+
|
|
1630
|
+
### `Sleep.tag`
|
|
1631
|
+
|
|
1632
|
+
- **Type:** `"system/sleep"`
|
|
1633
|
+
- **Since:** `0.1.0`
|
|
1634
|
+
|
|
1635
|
+
The tag the sleep declaration is catalogued and resolved under.
|
|
1636
|
+
|
|
1637
|
+
### `Sleep.action`
|
|
1638
|
+
|
|
1639
|
+
- **Type:** `Action.Declared<typeof tag, Schema.Struct<{ readonly millis: Schema.optional<Schema.Number>; readonly until: Schema.optional<Schema.Number> }>, typeof Schema.Void, typeof SleepRequestInvalid, never>`
|
|
1640
|
+
- **Since:** `0.1.0`
|
|
1641
|
+
|
|
1642
|
+
The declared `system/sleep` step: a relative `millis` from now, or an absolute `until` in epoch milliseconds. Each call is its own keyed node with its own identity, so two waits of the same length are two waits. A deadline that has already passed settles the node instead of parking it.
|
|
1643
|
+
|
|
1644
|
+
### `Sleep.layer`
|
|
1645
|
+
|
|
1646
|
+
- **Type:** `Layer.Layer<never, never, Crypto.Crypto | FlowRuntime>`
|
|
1647
|
+
- **Since:** `0.1.0`
|
|
1648
|
+
|
|
1649
|
+
The sleep implementation: arm the durable clock, park under `timer`, wake. Provide it beside the other action implementation layers, over `Action.layerImplementations`.
|
|
1650
|
+
|
|
1651
|
+
## Stall
|
|
1652
|
+
|
|
1653
|
+
`Stall` is the stall breaker round loops share. `@smthrs/patterns` loops and the coding correction flow use it.
|
|
1654
|
+
|
|
1655
|
+
### `Stall.policy`
|
|
1656
|
+
|
|
1657
|
+
- **Signature:** `policy(options: Options): Policy`
|
|
1658
|
+
- **Since:** `1.0.0`
|
|
1659
|
+
|
|
1660
|
+
Resolves `rounds` (at least two) and `on`: `stop` (the default), `park`, or `escalate`. The loop decides what `on` means.
|
|
1661
|
+
|
|
1662
|
+
### `Stall.observe`
|
|
1663
|
+
|
|
1664
|
+
- **Since:** `1.0.0`
|
|
1665
|
+
|
|
1666
|
+
`Stall.observe(policy, state, observation)` folds one round into the carried `State`. It returns the next state, with a `Stalled` verdict once one signal held for `rounds` rounds in a row. An observation reports any of `tree` (a tree fingerprint), `checks` (failing check ids, order ignored, empty not compared), and `output` (compared by the SHA-256 of its canonical JSON; a value with no canonical form is not compared).
|
|
1667
|
+
|
|
1668
|
+
### `Stall.initial`
|
|
1669
|
+
|
|
1670
|
+
- **Type:** `State`
|
|
1671
|
+
- **Since:** `1.0.0`
|
|
1672
|
+
|
|
1673
|
+
The state before the first round. `State`, `Policy`, and `Stalled` are schemas, so a trampoline carries the state in its payload and replay reads the same verdict.
|
|
1674
|
+
|
|
1675
|
+
## StepIdentity
|
|
1676
|
+
|
|
1677
|
+
`StepIdentity` is the module `Action` also re-exports, so `StepIdentity.DispatchSite` and `Action.DispatchSite` are one symbol.
|
|
1678
|
+
|
|
1679
|
+
### `StepIdentity.DispatchSite`
|
|
1680
|
+
|
|
1681
|
+
- **Type:** `Context.Service<DispatchSite, string>` keyed `"@smthrs/flow/Action/DispatchSite"`
|
|
1682
|
+
- **Since:** `0.1.0`
|
|
1683
|
+
|
|
1684
|
+
The interpreter graph site the running dispatch is scoped to.
|
|
1685
|
+
|
|
1686
|
+
### `StepIdentity.DispatchOutcome`
|
|
1687
|
+
|
|
1688
|
+
- **Type:** `interface DispatchOutcome { readonly outcome: "executed" | "replayed"; readonly stepKeyDigest?: string | undefined; readonly attempt?: number | undefined }`
|
|
1689
|
+
- **Since:** `1.0.0`
|
|
1690
|
+
|
|
1691
|
+
What one dispatch tells the node that drove it: whether the body ran, the step key digest it ran under, and the durable attempt it was.
|
|
1692
|
+
|
|
1693
|
+
### `StepIdentity.DispatchReport`
|
|
1694
|
+
|
|
1695
|
+
- **Type:** `Context.Service<DispatchReport, { readonly dispatched: (dispatch: DispatchOutcome) => Effect.Effect<void> }>` keyed `"@smthrs/flow/Action/DispatchReport"`
|
|
1696
|
+
- **Since:** `1.0.0`
|
|
1697
|
+
|
|
1698
|
+
Where the dispatches of one interpreter node report what happened to them.
|
|
1699
|
+
|
|
1700
|
+
### `StepIdentity.reportDispatch`
|
|
1701
|
+
|
|
1702
|
+
- **Signature:** `reportDispatch(dispatch: DispatchOutcome): Effect.Effect<void>`
|
|
1703
|
+
- **Since:** `1.0.0`
|
|
1704
|
+
|
|
1705
|
+
Reports one dispatch to the node that drove it, and does nothing where no node did.
|
|
1706
|
+
|
|
1707
|
+
### `StepIdentity.AllocationIdentity`
|
|
1708
|
+
|
|
1709
|
+
- **Type:** `interface AllocationIdentity { readonly kind: "action" | "internal"; readonly name: string; readonly idempotency?: string | Schema.JsonObject | undefined; readonly site?: string | undefined }`
|
|
1710
|
+
- **Since:** `0.1.0`
|
|
1711
|
+
|
|
1712
|
+
The declaration material an allocation scope is derived from. `kind` is `"action"` for user-declared dispatches and `"internal"` for engine-owned durable operations, and the two own disjoint counter namespaces. `name` is the stable declaration identity, never a diagnostic name. `idempotency` refines the scope so two concurrent invocations of one name with distinguishable inputs own separate counters. `site` is the replay-stable address of the graph node driving the dispatch, and is absent for handler-driven dispatches.
|
|
1713
|
+
|
|
1714
|
+
### `StepIdentity.allocationScope`
|
|
1715
|
+
|
|
1716
|
+
- **Signature:** `allocationScope(identity: AllocationIdentity): Effect.Effect<string, Schema.SchemaError, Crypto.Crypto>`
|
|
1717
|
+
- **Since:** `0.1.0`
|
|
1718
|
+
|
|
1719
|
+
Derives the ordinal allocation scope of a durable operation.
|
|
1720
|
+
|
|
1721
|
+
### `StepIdentity.invocationKey`
|
|
1722
|
+
|
|
1723
|
+
- **Signature:** `invocationKey(input: { readonly runId: string; readonly parentScope?: string | undefined; readonly ordinal: number; readonly tier: "unsealed" | "compensable" | "irreversible" }): Effect.Effect<StoredKey, Schema.SchemaError, Crypto.Crypto>`
|
|
1724
|
+
- **Since:** `0.1.0`
|
|
1725
|
+
|
|
1726
|
+
Derives an invocation key from engine-generated input.
|
|
1727
|
+
|
|
1728
|
+
## WaitFor
|
|
1729
|
+
|
|
1730
|
+
### `WaitFor.WaitForRequestInvalid`
|
|
1731
|
+
|
|
1732
|
+
- **Type:** `Schema.TaggedError` with fields `code: "missing_target" | "ambiguous_target" | "malformed_token" | "foreign_execution"` and `message: string`
|
|
1733
|
+
- **Since:** `0.1.0`
|
|
1734
|
+
|
|
1735
|
+
A wait whose payload does not name exactly one reachable wait point. `missing_target` and `ambiguous_target` cover a payload naming neither or both. `malformed_token` covers a token that does not parse. `foreign_execution` covers a token addressed to another flow or another execution.
|
|
1736
|
+
|
|
1737
|
+
### `WaitFor.tag`
|
|
1738
|
+
|
|
1739
|
+
- **Type:** `"system/wait-for"`
|
|
1740
|
+
- **Since:** `0.1.0`
|
|
1741
|
+
|
|
1742
|
+
The tag the wait declaration is catalogued and resolved under.
|
|
1743
|
+
|
|
1744
|
+
### `WaitFor.deferred`
|
|
1745
|
+
|
|
1746
|
+
- **Signature:** `deferred(name: string): DurableDeferred.DurableDeferred<typeof Schema.Json>`
|
|
1747
|
+
- **Since:** `0.1.0`
|
|
1748
|
+
|
|
1749
|
+
The durable deferred a named wait point resolves through, named `WaitFor/<name>`. It is the resolver's half of `WaitFor.action`: the value to hand `DurableDeferred.tokenFromExecutionId` and `DurableDeferred.succeed`.
|
|
1750
|
+
|
|
1751
|
+
### `WaitFor.action`
|
|
1752
|
+
|
|
1753
|
+
- **Type:** `Action.Declared<typeof tag, Schema.Struct<{ readonly token: Schema.optional<Schema.String>; readonly name: Schema.optional<Schema.String> }>, typeof Schema.Json, typeof WaitForRequestInvalid, never>`
|
|
1754
|
+
- **Since:** `0.1.0`
|
|
1755
|
+
|
|
1756
|
+
The declared `system/wait-for` step: a rendezvous with something outside the run, named by `name` relative to the running execution, or by an absolute `token`.
|
|
1757
|
+
|
|
1758
|
+
### `WaitFor.layer`
|
|
1759
|
+
|
|
1760
|
+
- **Type:** `Layer.Layer<never, never, Crypto.Crypto | FlowRuntime>`
|
|
1761
|
+
- **Since:** `0.1.0`
|
|
1762
|
+
|
|
1763
|
+
The wait implementation: park under `event` with the wake token, and settle with the value that resolved the wait. Provide it beside the other action implementation layers, over `Action.layerImplementations`.
|
|
1764
|
+
|
|
1765
|
+
## Errors
|
|
1766
|
+
|
|
1767
|
+
Every failure the package defines is a `Schema.TaggedError` carrying a stable `code`:
|
|
1768
|
+
|
|
1769
|
+
| Tag | Raised when | Fields |
|
|
1770
|
+
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
1771
|
+
| `@smthrs/flow/InfraInterrupt` | An action adapter explicitly marks an infrastructure event for `interruptRetryPolicy`; engines do not synthesize it. | `code`, `reason` |
|
|
1772
|
+
| `@smthrs/flow/InfraInterruptRetriesExhausted` | An action spends its `interruptRetryPolicy` without reaching an ordinary success or failure. | `code`, `actionName`, `attempts`, `interrupt`, `message` |
|
|
1773
|
+
| `@smthrs/flow/IrreversibleRetryRequiresIdempotencyKey` | An irreversible action attempts a retry without a declared idempotency key. | `code`, `actionName`, `attempt` |
|
|
1774
|
+
| `@smthrs/flow/ConcurrentKeylessDispatch` | Two ordinal-keyed invocations of one allocation scope are in flight at once. | `code`, `actionName` |
|
|
1775
|
+
| `@smthrs/flow/UncanonicalIdempotencyKey` | A caller-declared object-form `idempotencyKey` carries material canonical serialization rejects. | `code`, `actionName`, `reason`, `path`, `message` |
|
|
1776
|
+
| `@smthrs/flow/DurableDeferred/TokenInvalid` | A completion token does not parse, or names a different deferred than the surface it was submitted through. | `code`, `message` |
|
|
1777
|
+
| `@smthrs/flow/ExecutionIdRequired` | Opt-in derivation could not canonicalize the payload, or a served resume was not scoped to an id. | `code`, `flowName` |
|
|
1778
|
+
| `@smthrs/flow/MaxRoundsExceeded` | A trampoline lineage opens a round past its flow's `maxRounds` budget. | `code`, `flowName`, `lineageId`, `maxRounds`, `roundOrdinal`, `message` |
|
|
1779
|
+
| `@smthrs/flow/DeadlineExceeded` | An execution is still unsettled when its flow's `deadline` elapses. | `code`, `flowName`, `executionId`, `deadlineMs`, `startedAtMs`, `message` |
|
|
1780
|
+
| `@smthrs/flow/CancelRequestFailed` | `interrupt` cannot durably record its cancellation request, or a durable engine is asked for `interruptUnsafe`. | `code`, `executionId`, `reason` |
|
|
1781
|
+
| `@smthrs/flow/FlowCycleDetected` | Executing a flow would close a cycle in the persisted parent-execution chain. | `code`, `path` |
|
|
1782
|
+
| `@smthrs/flow/FlowExecutionNotFound` | `poll` names an execution id the runtime never recorded. | `code`, `executionId` |
|
|
1783
|
+
| `@smthrs/flow/HumanTaskFailed` | A question is unanswerable, spends its attempt budget on refused answers, or passes its deadline while open. | `code`, `task`, `attempts`, `rejections`, `message` |
|
|
1784
|
+
| `@smthrs/flow/HumanAnswerInvalid` | An answer is outside the durable JSON boundary, or the attempt it addresses is not open. | `code`, `message` |
|
|
1785
|
+
| `@smthrs/flow/InterpreterError` | The interpreter refuses a graph it cannot drive. | `code`, `flow`, `node`, `message` |
|
|
1786
|
+
| `@smthrs/flow/PollExhausted` | A poll uses its last attempt without a satisfied check, under `onTimeout: "fail"`. | `code`, `poll`, `attempts`, `message` |
|
|
1787
|
+
| `@smthrs/flow/RetryPolicyExpired` | A historical retry sequence crossed the policy's `expirationMs` wall-clock bound. | `code`, `actionName`, `attempt`, `expirationMs`, `lastError` |
|
|
1788
|
+
| `@smthrs/flow/RetryAttemptsExhausted` | A historical retry sequence exhausted the policy's `maxAttempts` bound. | `code`, `actionName`, `attempt`, `maxAttempts`, `lastError` |
|
|
1789
|
+
| `@smthrs/flow/SleepRequestInvalid` | A sleep payload names no deadline, two deadlines, or a value that is not a length of time. | `code`, `message` |
|
|
1790
|
+
| `@smthrs/flow/WaitForRequestInvalid` | A wait payload names no target, two targets, a token that does not parse, or a token addressed to another execution. | `code`, `message` |
|
|
1791
|
+
|
|
1792
|
+
`Flow.make`, `Poll.make`, `RetryPolicy.make`, and `DurableQueue.makeWorker` refuse invalid static configuration by throwing a `RangeError` at construction, and `Poll.make` throws a `TypeError` for an `input` that declares the reserved `attempt` field. Those are programmer errors, not typed failures.
|
|
1793
|
+
|
|
1794
|
+
## Example
|
|
1795
|
+
|
|
1796
|
+
An action carries an implementation attached as a layer, a flow carries a pure body, and `Interpreter.layer` makes the flow executable:
|
|
1797
|
+
|
|
1798
|
+
```ts
|
|
1799
|
+
import { Action, Flow, Interpreter } from "@smthrs/flow"
|
|
1800
|
+
import * as Effect from "effect/Effect"
|
|
1801
|
+
import * as Layer from "effect/Layer"
|
|
1802
|
+
import * as Schema from "effect/Schema"
|
|
1803
|
+
|
|
1804
|
+
const Status = Action.make("deploy/status", {
|
|
1805
|
+
payload: { id: Schema.String },
|
|
1806
|
+
success: Schema.String,
|
|
1807
|
+
tier: "sealed"
|
|
1808
|
+
})
|
|
1809
|
+
|
|
1810
|
+
const Deploy = Flow.make("deploy/watch", {
|
|
1811
|
+
payload: { id: Schema.String },
|
|
1812
|
+
success: Schema.String,
|
|
1813
|
+
idempotencyKey: ({ id }) => id,
|
|
1814
|
+
body: (payload) => Status.call(payload)
|
|
1815
|
+
})
|
|
1816
|
+
|
|
1817
|
+
// `layerImplementations` goes UNDER the implementation layers, because an
|
|
1818
|
+
// implementation files itself in the table while its layer is built.
|
|
1819
|
+
export const layer = Layer.mergeAll(
|
|
1820
|
+
Status.toLayer(({ id }) => Effect.succeed(`${id} is live`)),
|
|
1821
|
+
Interpreter.layer(Deploy)
|
|
1822
|
+
).pipe(Layer.provideMerge(Action.layerImplementations))
|
|
1823
|
+
```
|
|
1824
|
+
|
|
1825
|
+
Provide a runtime that implements `FlowRuntime`, then run `Deploy.execute({ id: "greeting-ada-1" }, { executionId: "deploy-greeting-ada-1" })`.
|
|
1826
|
+
|
|
1827
|
+
## See also
|
|
1828
|
+
|
|
1829
|
+
- [`@smthrs/engine`](/api/engine), which implements the `FlowRuntime` port
|
|
1830
|
+
- [`@smthrs/engine-store`](/api/engine-store), which makes that implementation durable
|
|
1831
|
+
- [`@smthrs/plan`](/api/plan), whose `Node` and `FileSet` vocabulary a body is written in
|
|
1832
|
+
- [`@smthrs/crypto`](/api/crypto) and [`@smthrs/keys`](/api/keys), the digest and key derivations identity is built from
|
|
1833
|
+
- [Durable execution](/docs/concepts/durable-execution/), for why a journaled side effect resumes
|
|
1834
|
+
- [Flows, actions, and plans](/docs/concepts/flows-actions-plans/), for the division between a body and an implementation
|
|
1835
|
+
- [Retries](/docs/concepts/retries/), for how a policy value becomes a durable decision
|