@workflow/core 5.4.0 → 5.6.0
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/dist/attribute-changes.js +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/capture-stack.js +1 -1
- package/dist/class-serialization.js +1 -1
- package/dist/classify-error.d.ts +1 -1
- package/dist/classify-error.js +10 -5
- package/dist/context-errors.js +1 -1
- package/dist/context-violation-error.js +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/define-hook.js +1 -1
- package/dist/describe-error.js +61 -31
- package/dist/encryption.js +1 -1
- package/dist/events-consumer.js +1 -1
- package/dist/flushable-stream.js +1 -1
- package/dist/global.js +1 -1
- package/dist/index.js +1 -1
- package/dist/log-format.js +1 -1
- package/dist/logger.js +1 -1
- package/dist/private.js +11 -49
- package/dist/replay-divergence.js +1 -1
- package/dist/replay-payload-cache.d.ts +3 -0
- package/dist/replay-payload-cache.js +4 -1
- package/dist/runtime/after-terminal-write.js +1 -1
- package/dist/runtime/child-run-completion-notify.js +1 -1
- package/dist/runtime/child-run-completion.d.ts +3 -2
- package/dist/runtime/child-run-completion.js +109 -37
- package/dist/runtime/compute-instance.d.ts +6 -3
- package/dist/runtime/compute-instance.js +14 -4
- package/dist/runtime/constants.d.ts +3 -0
- package/dist/runtime/constants.js +4 -1
- package/dist/runtime/delivery.js +1 -1
- package/dist/runtime/deployment-guard.js +1 -1
- package/dist/runtime/dynamic-workflow.js +1 -1
- package/dist/runtime/event-limit-warning.js +1 -1
- package/dist/runtime/get-port-lazy.js +1 -1
- package/dist/runtime/get-world-lazy.js +1 -1
- package/dist/runtime/helpers.d.ts +4 -19
- package/dist/runtime/helpers.js +6 -21
- package/dist/runtime/hook-creation.js +1 -1
- package/dist/runtime/hook-wake.js +1 -1
- package/dist/runtime/invocations.d.ts +1 -1
- package/dist/runtime/invocations.js +1 -1
- package/dist/runtime/lifecycle-hooks.js +1 -1
- package/dist/runtime/out-of-band-observation.d.ts +25 -4
- package/dist/runtime/out-of-band-observation.js +18 -9
- package/dist/runtime/queue-auth.d.ts +53 -0
- package/dist/runtime/queue-auth.js +149 -0
- package/dist/runtime/quickjs-assets.generated.d.ts +1 -1
- package/dist/runtime/quickjs-assets.generated.js +3 -3
- package/dist/runtime/quickjs-delivery-shared.js +1 -1
- package/dist/runtime/quickjs-log-view.d.ts +42 -0
- package/dist/runtime/quickjs-log-view.js +90 -1
- package/dist/runtime/quickjs-pending-ops.js +1 -1
- package/dist/runtime/quickjs-precompiled.d.ts +31 -0
- package/dist/runtime/quickjs-precompiled.js +17 -0
- package/dist/runtime/quickjs-runtime.d.ts +32 -0
- package/dist/runtime/quickjs-runtime.js +146 -69
- package/dist/runtime/quickjs-serde.js +48 -9
- package/dist/runtime/quickjs-snapshot-codec.js +1 -1
- package/dist/runtime/replay-budget.js +1 -1
- package/dist/runtime/replay-recovery-reporter.js +1 -1
- package/dist/runtime/resume-hook.js +10 -1
- package/dist/runtime/resume-latency.js +1 -1
- package/dist/runtime/run-id-time.js +1 -1
- package/dist/runtime/run-spec-routing.js +1 -1
- package/dist/runtime/run-spec-version.js +1 -1
- package/dist/runtime/run.d.ts +3 -7
- package/dist/runtime/run.js +7 -17
- package/dist/runtime/runs.d.ts +2 -1
- package/dist/runtime/runs.js +3 -2
- package/dist/runtime/spec8/constants.d.ts +1 -49
- package/dist/runtime/spec8/constants.js +2 -65
- package/dist/runtime/spec8/count-step-started-events.js +1 -1
- package/dist/runtime/spec8/delivery.js +83 -47
- package/dist/runtime/spec8/inline-steps-in-flight.d.ts +5 -5
- package/dist/runtime/spec8/inline-steps-in-flight.js +6 -8
- package/dist/runtime/spec8/open-hook-wait-state.js +1 -1
- package/dist/runtime/spec8/quickjs-entrypoint.js +7 -3
- package/dist/runtime/spec8/step-executor.d.ts +10 -1
- package/dist/runtime/spec8/step-executor.js +19 -5
- package/dist/runtime/spec8/step-ownership.d.ts +2 -1
- package/dist/runtime/spec8/step-ownership.js +3 -2
- package/dist/runtime/spec8/step-single-flight.d.ts +40 -2
- package/dist/runtime/spec8/step-single-flight.js +20 -4
- package/dist/runtime/spec8/suspension-handler.d.ts +1 -1
- package/dist/runtime/spec8/suspension-handler.js +7 -7
- package/dist/runtime/spec9/consume-after-commit.d.ts +5 -1
- package/dist/runtime/spec9/consume-after-commit.js +8 -3
- package/dist/runtime/spec9/consumed-position.js +1 -1
- package/dist/runtime/spec9/creator-rules.js +1 -1
- package/dist/runtime/spec9/deadline.js +1 -1
- package/dist/runtime/spec9/delivery.js +288 -110
- package/dist/runtime/spec9/fence-refusals.js +1 -1
- package/dist/runtime/spec9/in-band-writer.d.ts +10 -0
- package/dist/runtime/spec9/in-band-writer.js +21 -3
- package/dist/runtime/spec9/live-feed.d.ts +55 -9
- package/dist/runtime/spec9/live-feed.js +90 -13
- package/dist/runtime/spec9/log-index.d.ts +74 -0
- package/dist/runtime/spec9/log-index.js +199 -0
- package/dist/runtime/spec9/log-state.d.ts +33 -8
- package/dist/runtime/spec9/log-state.js +43 -14
- package/dist/runtime/spec9/quickjs-entrypoint.d.ts +20 -4
- package/dist/runtime/spec9/quickjs-entrypoint.js +830 -47
- package/dist/runtime/spec9/read-deadline.js +1 -1
- package/dist/runtime/spec9/run-ahead.d.ts +11 -2
- package/dist/runtime/spec9/run-ahead.js +3 -2
- package/dist/runtime/spec9/step-delivery.d.ts +40 -1
- package/dist/runtime/spec9/step-delivery.js +52 -2
- package/dist/runtime/spec9/step-executor.d.ts +27 -2
- package/dist/runtime/spec9/step-executor.js +41 -9
- package/dist/runtime/spec9/step-handler.js +46 -4
- package/dist/runtime/spec9/step-message.js +1 -1
- package/dist/runtime/spec9/step-retention.js +1 -1
- package/dist/runtime/spec9/step-single-flight.js +1 -1
- package/dist/runtime/spec9/step-wait-creation.js +4 -4
- package/dist/runtime/spec9/suspension-handler.js +1 -1
- package/dist/runtime/spec9/wait-timer.js +1 -1
- package/dist/runtime/start-hook-binding.d.ts +7 -6
- package/dist/runtime/start-hook-binding.js +13 -10
- package/dist/runtime/start-hook-delivery.js +1 -1
- package/dist/runtime/start-hook-holder.js +1 -1
- package/dist/runtime/start.d.ts +2 -2
- package/dist/runtime/start.js +5 -3
- package/dist/runtime/step-latency.js +2 -2
- package/dist/runtime/step-single-flight.d.ts +10 -1
- package/dist/runtime/step-single-flight.js +14 -7
- package/dist/runtime/step-streams.js +1 -1
- package/dist/runtime/suspension-hooks.js +1 -1
- package/dist/runtime/unserializable-step.js +1 -1
- package/dist/runtime/vm-mode.js +1 -1
- package/dist/runtime/wait-continuation.js +1 -1
- package/dist/runtime/wait-until.d.ts +8 -0
- package/dist/runtime/wait-until.js +16 -1
- package/dist/runtime/world-compatibility.d.ts +4 -4
- package/dist/runtime/world-compatibility.js +5 -5
- package/dist/runtime/world-init.js +1 -1
- package/dist/runtime/world.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +51 -17
- package/dist/schemas.js +1 -1
- package/dist/sealed-box.js +1 -1
- package/dist/seeded-nanoid.js +1 -1
- package/dist/serialization/abort-stream.js +1 -1
- package/dist/serialization/client.js +1 -1
- package/dist/serialization/codec-devalue-vm.js +1 -1
- package/dist/serialization/codec-devalue.js +26 -1
- package/dist/serialization/codec.d.ts +15 -0
- package/dist/serialization/codec.js +1 -1
- package/dist/serialization/compression.js +1 -1
- package/dist/serialization/encryption.js +1 -1
- package/dist/serialization/errors.js +1 -1
- package/dist/serialization/format.js +1 -1
- package/dist/serialization/hardened.js +1 -1
- package/dist/serialization/index.js +1 -1
- package/dist/serialization/reducers/class-vm.js +1 -1
- package/dist/serialization/reducers/class.js +1 -1
- package/dist/serialization/reducers/common-vm.js +1 -1
- package/dist/serialization/reducers/common.js +1 -1
- package/dist/serialization/reducers/step-function-vm.js +1 -1
- package/dist/serialization/reducers/step-function.js +1 -1
- package/dist/serialization/state-recovery.d.ts +21 -0
- package/dist/serialization/state-recovery.js +104 -0
- package/dist/serialization/state-refs.d.ts +229 -0
- package/dist/serialization/state-refs.js +981 -0
- package/dist/serialization/step.js +22 -4
- package/dist/serialization/types.js +1 -1
- package/dist/serialization/workflow-vm.js +1 -1
- package/dist/serialization/workflow.js +1 -1
- package/dist/serialization-format.d.ts +8 -15
- package/dist/serialization-format.js +41 -4
- package/dist/serialization.d.ts +5 -2
- package/dist/serialization.js +108 -13
- package/dist/set-attributes.js +3 -1
- package/dist/set-error-stack.js +1 -1
- package/dist/sleep.js +1 -1
- package/dist/source-map.js +1 -1
- package/dist/state-resolver.d.ts +44 -0
- package/dist/state-resolver.js +40 -0
- package/dist/state.d.ts +56 -0
- package/dist/state.js +227 -0
- package/dist/step/context-storage.js +1 -1
- package/dist/step/get-closure-vars.js +1 -1
- package/dist/step/get-step-metadata.d.ts +11 -0
- package/dist/step/get-step-metadata.js +1 -1
- package/dist/step/get-workflow-metadata.js +1 -1
- package/dist/step/writable-stream.js +1 -1
- package/dist/step.js +1 -1
- package/dist/symbols.js +1 -1
- package/dist/telemetry/semantic-conventions.d.ts +10 -2
- package/dist/telemetry/semantic-conventions.js +9 -3
- package/dist/telemetry.d.ts +12 -0
- package/dist/telemetry.js +27 -1
- package/dist/test-support/append-only-world.d.ts +23 -2
- package/dist/test-support/append-only-world.js +34 -8
- package/dist/test-support/fence-snapshot.js +1 -1
- package/dist/test-support/load-events.js +1 -1
- package/dist/test-support/orchestrator-context.js +1 -1
- package/dist/test-support/orchestrator-harness.d.ts +2 -0
- package/dist/test-support/orchestrator-harness.js +1 -1
- package/dist/types.js +1 -1
- package/dist/util.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.js +1 -1
- package/dist/vm/script-cache.js +1 -1
- package/dist/vm/uint8array-base64.js +1 -1
- package/dist/vm/uuid.js +1 -1
- package/dist/workflow/abort-controller.js +1 -1
- package/dist/workflow/attribute-dispatcher.js +1 -1
- package/dist/workflow/create-hook.js +1 -1
- package/dist/workflow/define-hook.js +1 -1
- package/dist/workflow/get-workflow-metadata.js +1 -1
- package/dist/workflow/hook.d.ts +6 -0
- package/dist/workflow/hook.js +20 -1
- package/dist/workflow/index.js +1 -1
- package/dist/workflow/set-attributes.js +1 -1
- package/dist/workflow/sleep.js +1 -1
- package/dist/workflow/world-init-stub.js +1 -1
- package/dist/workflow/writable-stream.js +1 -1
- package/dist/workflow.js +11 -3
- package/docs/api-reference/create-hook.mdx +2 -2
- package/docs/api-reference/get-step-metadata.mdx +19 -0
- package/docs/foundations/errors-and-retries.mdx +5 -2
- package/docs/foundations/serialization.mdx +80 -0
- package/docs/how-it-works/event-sourcing.mdx +5 -4
- package/docs/how-it-works/framework-integrations.mdx +2 -2
- package/package.json +21 -21
- package/dist/attribute-changes.d.ts.map +0 -1
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/capture-stack.d.ts.map +0 -1
- package/dist/class-serialization.d.ts.map +0 -1
- package/dist/classify-error.d.ts.map +0 -1
- package/dist/context-errors.d.ts.map +0 -1
- package/dist/context-violation-error.d.ts.map +0 -1
- package/dist/create-hook.d.ts.map +0 -1
- package/dist/define-hook.d.ts.map +0 -1
- package/dist/describe-error.d.ts.map +0 -1
- package/dist/encryption.d.ts.map +0 -1
- package/dist/events-consumer.d.ts.map +0 -1
- package/dist/flushable-stream.d.ts.map +0 -1
- package/dist/global.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/log-format.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/private.d.ts.map +0 -1
- package/dist/replay-divergence.d.ts.map +0 -1
- package/dist/replay-payload-cache.d.ts.map +0 -1
- package/dist/runtime/after-terminal-write.d.ts.map +0 -1
- package/dist/runtime/child-run-completion-notify.d.ts.map +0 -1
- package/dist/runtime/child-run-completion.d.ts.map +0 -1
- package/dist/runtime/compute-instance.d.ts.map +0 -1
- package/dist/runtime/constants.d.ts.map +0 -1
- package/dist/runtime/delivery.d.ts.map +0 -1
- package/dist/runtime/deployment-guard.d.ts.map +0 -1
- package/dist/runtime/dynamic-workflow.d.ts.map +0 -1
- package/dist/runtime/event-limit-warning.d.ts.map +0 -1
- package/dist/runtime/get-port-lazy.d.ts.map +0 -1
- package/dist/runtime/get-world-lazy.d.ts.map +0 -1
- package/dist/runtime/helpers.d.ts.map +0 -1
- package/dist/runtime/hook-creation.d.ts.map +0 -1
- package/dist/runtime/hook-wake.d.ts.map +0 -1
- package/dist/runtime/invocations.d.ts.map +0 -1
- package/dist/runtime/lifecycle-hooks.d.ts.map +0 -1
- package/dist/runtime/out-of-band-observation.d.ts.map +0 -1
- package/dist/runtime/quickjs-assets.generated.d.ts.map +0 -1
- package/dist/runtime/quickjs-delivery-shared.d.ts.map +0 -1
- package/dist/runtime/quickjs-log-view.d.ts.map +0 -1
- package/dist/runtime/quickjs-pending-ops.d.ts.map +0 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +0 -1
- package/dist/runtime/quickjs-serde.d.ts.map +0 -1
- package/dist/runtime/quickjs-snapshot-codec.d.ts.map +0 -1
- package/dist/runtime/replay-budget.d.ts.map +0 -1
- package/dist/runtime/replay-recovery-reporter.d.ts.map +0 -1
- package/dist/runtime/resume-hook.d.ts.map +0 -1
- package/dist/runtime/resume-latency.d.ts.map +0 -1
- package/dist/runtime/run-id-time.d.ts.map +0 -1
- package/dist/runtime/run-spec-routing.d.ts.map +0 -1
- package/dist/runtime/run-spec-version.d.ts.map +0 -1
- package/dist/runtime/run.d.ts.map +0 -1
- package/dist/runtime/runs.d.ts.map +0 -1
- package/dist/runtime/spec8/constants.d.ts.map +0 -1
- package/dist/runtime/spec8/count-step-started-events.d.ts.map +0 -1
- package/dist/runtime/spec8/delivery.d.ts.map +0 -1
- package/dist/runtime/spec8/inline-steps-in-flight.d.ts.map +0 -1
- package/dist/runtime/spec8/open-hook-wait-state.d.ts.map +0 -1
- package/dist/runtime/spec8/quickjs-entrypoint.d.ts.map +0 -1
- package/dist/runtime/spec8/step-executor.d.ts.map +0 -1
- package/dist/runtime/spec8/step-ownership.d.ts.map +0 -1
- package/dist/runtime/spec8/step-single-flight.d.ts.map +0 -1
- package/dist/runtime/spec8/suspension-handler.d.ts.map +0 -1
- package/dist/runtime/spec9/consume-after-commit.d.ts.map +0 -1
- package/dist/runtime/spec9/consumed-position.d.ts.map +0 -1
- package/dist/runtime/spec9/creator-rules.d.ts.map +0 -1
- package/dist/runtime/spec9/deadline.d.ts.map +0 -1
- package/dist/runtime/spec9/delivery.d.ts.map +0 -1
- package/dist/runtime/spec9/fence-refusals.d.ts.map +0 -1
- package/dist/runtime/spec9/in-band-writer.d.ts.map +0 -1
- package/dist/runtime/spec9/live-feed.d.ts.map +0 -1
- package/dist/runtime/spec9/log-state.d.ts.map +0 -1
- package/dist/runtime/spec9/quickjs-entrypoint.d.ts.map +0 -1
- package/dist/runtime/spec9/read-deadline.d.ts.map +0 -1
- package/dist/runtime/spec9/run-ahead.d.ts.map +0 -1
- package/dist/runtime/spec9/step-delivery.d.ts.map +0 -1
- package/dist/runtime/spec9/step-executor.d.ts.map +0 -1
- package/dist/runtime/spec9/step-handler.d.ts.map +0 -1
- package/dist/runtime/spec9/step-message.d.ts.map +0 -1
- package/dist/runtime/spec9/step-retention.d.ts.map +0 -1
- package/dist/runtime/spec9/step-single-flight.d.ts.map +0 -1
- package/dist/runtime/spec9/step-wait-creation.d.ts.map +0 -1
- package/dist/runtime/spec9/suspension-handler.d.ts.map +0 -1
- package/dist/runtime/spec9/wait-timer.d.ts.map +0 -1
- package/dist/runtime/start-hook-binding.d.ts.map +0 -1
- package/dist/runtime/start-hook-delivery.d.ts.map +0 -1
- package/dist/runtime/start-hook-holder.d.ts.map +0 -1
- package/dist/runtime/start.d.ts.map +0 -1
- package/dist/runtime/step-latency.d.ts.map +0 -1
- package/dist/runtime/step-single-flight.d.ts.map +0 -1
- package/dist/runtime/step-streams.d.ts.map +0 -1
- package/dist/runtime/suspension-hooks.d.ts.map +0 -1
- package/dist/runtime/unserializable-step.d.ts.map +0 -1
- package/dist/runtime/vm-mode.d.ts.map +0 -1
- package/dist/runtime/wait-continuation.d.ts.map +0 -1
- package/dist/runtime/wait-until.d.ts.map +0 -1
- package/dist/runtime/world-compatibility.d.ts.map +0 -1
- package/dist/runtime/world-init.d.ts.map +0 -1
- package/dist/runtime/world.d.ts.map +0 -1
- package/dist/runtime.d.ts.map +0 -1
- package/dist/schemas.d.ts.map +0 -1
- package/dist/sealed-box.d.ts.map +0 -1
- package/dist/seeded-nanoid.d.ts.map +0 -1
- package/dist/serialization/abort-stream.d.ts.map +0 -1
- package/dist/serialization/client.d.ts.map +0 -1
- package/dist/serialization/codec-devalue-vm.d.ts.map +0 -1
- package/dist/serialization/codec-devalue.d.ts.map +0 -1
- package/dist/serialization/codec.d.ts.map +0 -1
- package/dist/serialization/compression.d.ts.map +0 -1
- package/dist/serialization/encryption.d.ts.map +0 -1
- package/dist/serialization/errors.d.ts.map +0 -1
- package/dist/serialization/format.d.ts.map +0 -1
- package/dist/serialization/hardened.d.ts.map +0 -1
- package/dist/serialization/index.d.ts.map +0 -1
- package/dist/serialization/reducers/class-vm.d.ts.map +0 -1
- package/dist/serialization/reducers/class.d.ts.map +0 -1
- package/dist/serialization/reducers/common-vm.d.ts.map +0 -1
- package/dist/serialization/reducers/common.d.ts.map +0 -1
- package/dist/serialization/reducers/step-function-vm.d.ts.map +0 -1
- package/dist/serialization/reducers/step-function.d.ts.map +0 -1
- package/dist/serialization/step.d.ts.map +0 -1
- package/dist/serialization/types.d.ts.map +0 -1
- package/dist/serialization/workflow-vm.d.ts.map +0 -1
- package/dist/serialization/workflow.d.ts.map +0 -1
- package/dist/serialization-format.d.ts.map +0 -1
- package/dist/serialization.d.ts.map +0 -1
- package/dist/set-attributes.d.ts.map +0 -1
- package/dist/set-error-stack.d.ts.map +0 -1
- package/dist/sleep.d.ts.map +0 -1
- package/dist/source-map.d.ts.map +0 -1
- package/dist/step/context-storage.d.ts.map +0 -1
- package/dist/step/get-closure-vars.d.ts.map +0 -1
- package/dist/step/get-step-metadata.d.ts.map +0 -1
- package/dist/step/get-workflow-metadata.d.ts.map +0 -1
- package/dist/step/writable-stream.d.ts.map +0 -1
- package/dist/step.d.ts.map +0 -1
- package/dist/symbols.d.ts.map +0 -1
- package/dist/telemetry/semantic-conventions.d.ts.map +0 -1
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/test-support/append-only-world.d.ts.map +0 -1
- package/dist/test-support/fence-snapshot.d.ts.map +0 -1
- package/dist/test-support/load-events.d.ts.map +0 -1
- package/dist/test-support/orchestrator-context.d.ts.map +0 -1
- package/dist/test-support/orchestrator-harness.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/util.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/vm/index.d.ts.map +0 -1
- package/dist/vm/script-cache.d.ts.map +0 -1
- package/dist/vm/uint8array-base64.d.ts.map +0 -1
- package/dist/vm/uuid.d.ts.map +0 -1
- package/dist/workflow/abort-controller.d.ts.map +0 -1
- package/dist/workflow/attribute-dispatcher.d.ts.map +0 -1
- package/dist/workflow/create-hook.d.ts.map +0 -1
- package/dist/workflow/define-hook.d.ts.map +0 -1
- package/dist/workflow/get-workflow-metadata.d.ts.map +0 -1
- package/dist/workflow/hook.d.ts.map +0 -1
- package/dist/workflow/index.d.ts.map +0 -1
- package/dist/workflow/set-attributes.d.ts.map +0 -1
- package/dist/workflow/sleep.d.ts.map +0 -1
- package/dist/workflow/world-init-stub.d.ts.map +0 -1
- package/dist/workflow/writable-stream.d.ts.map +0 -1
- package/dist/workflow.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StepExecutionResult } from './step-executor.js';
|
|
2
2
|
/**
|
|
3
3
|
* Single-flight for a step body. This is a required companion to inline step
|
|
4
|
-
* ownership (see `
|
|
4
|
+
* ownership (see `getInlineOwnershipLeaseSeconds` in `./constants.ts`): the
|
|
5
5
|
* ownership lease is a *death proof* only on platforms with a bounded
|
|
6
6
|
* invocation lifetime. On worlds without an invocation kill bound
|
|
7
7
|
* (world-local's single process, self-hosted deployments) a delayed backstop
|
|
@@ -25,10 +25,48 @@ import type { StepExecutionResult } from './step-executor.js';
|
|
|
25
25
|
* would leave the step created and never run. The loser runs its own attempt
|
|
26
26
|
* instead, which its claim gates like any other.
|
|
27
27
|
*
|
|
28
|
+
* The other exception is a winner's `retry` that was folded into the
|
|
29
|
+
* loser's own message: see `carryFoldedRetry`.
|
|
30
|
+
*
|
|
28
31
|
* Cross-instance duplicates are what the ownership lease bounds on platforms
|
|
29
32
|
* where it is a death proof, and the documented residual risk on
|
|
30
33
|
* multi-instance self-hosted worlds (mitigate by raising
|
|
31
34
|
* `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`).
|
|
32
35
|
*/
|
|
33
|
-
export declare function runStepSingleFlight(runId: string, correlationId: string, execute: () => Promise<StepExecutionResult>,
|
|
36
|
+
export declare function runStepSingleFlight(runId: string, correlationId: string, execute: () => Promise<StepExecutionResult>, options?: StepSingleFlightOptions): Promise<StepExecutionResult>;
|
|
37
|
+
export interface StepSingleFlightOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Level of the contention log when this call loses. Fresh inline claims
|
|
40
|
+
* overlap during ordinary wake replays, so they log at `debug`; recovery
|
|
41
|
+
* callers keep `warn`, since repeated overlap can indicate expiring leases.
|
|
42
|
+
*/
|
|
43
|
+
logLevel?: 'debug' | 'warn';
|
|
44
|
+
/**
|
|
45
|
+
* Set by a winner that publishes its own `retry` under the step's dispatch
|
|
46
|
+
* key (stepDispatchIdempotencyKey): the node engine's inline executions.
|
|
47
|
+
* The promise settles once that publish is durable, or once the delivery
|
|
48
|
+
* that owns the execution ended without making it (a throttled batch
|
|
49
|
+
* hands the step to its continuation's replay instead). A queued delivery
|
|
50
|
+
* of the same step that is waiting on it was published under that same key
|
|
51
|
+
* and is still in flight, so the queue folds the retry into it
|
|
52
|
+
* (world-local returns the in-flight message's id, queues dedupe a key
|
|
53
|
+
* while its message is in flight, and world-postgres replaces an unlocked
|
|
54
|
+
* job with the same key or drops a later job whose key it has already
|
|
55
|
+
* completed). The QuickJS engine publishes its retries under their own
|
|
56
|
+
* keys, so its winners leave this unset.
|
|
57
|
+
*/
|
|
58
|
+
retryPublishedUnderDispatchKeyAfter?: Promise<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Set by the queued-step delivery. When it loses to a winner that sets
|
|
61
|
+
* `retryPublishedUnderDispatchKeyAfter` and that winner returns `retry`, it
|
|
62
|
+
* waits for that promise and then returns the `retry` instead of `skipped`,
|
|
63
|
+
* so its message redelivers after the backoff and runs the attempt the
|
|
64
|
+
* folded publish can no longer drive (workflow#4728). Waiting keeps the
|
|
65
|
+
* message in flight until the publish is out, so the publish never lands on
|
|
66
|
+
* a key the message already spent by acking (a sibling of the winner that
|
|
67
|
+
* outlasts the backoff would otherwise let the carried attempt finish and
|
|
68
|
+
* ack first). At most one loser carries a given retry.
|
|
69
|
+
*/
|
|
70
|
+
carryFoldedRetry?: boolean;
|
|
71
|
+
}
|
|
34
72
|
//# sourceMappingURL=step-single-flight.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runSingleFlight } from '../step-single-flight.js';
|
|
2
2
|
/**
|
|
3
3
|
* Single-flight for a step body. This is a required companion to inline step
|
|
4
|
-
* ownership (see `
|
|
4
|
+
* ownership (see `getInlineOwnershipLeaseSeconds` in `./constants.ts`): the
|
|
5
5
|
* ownership lease is a *death proof* only on platforms with a bounded
|
|
6
6
|
* invocation lifetime. On worlds without an invocation kill bound
|
|
7
7
|
* (world-local's single process, self-hosted deployments) a delayed backstop
|
|
@@ -25,12 +25,28 @@ import { runSingleFlight } from '../step-single-flight.js';
|
|
|
25
25
|
* would leave the step created and never run. The loser runs its own attempt
|
|
26
26
|
* instead, which its claim gates like any other.
|
|
27
27
|
*
|
|
28
|
+
* The other exception is a winner's `retry` that was folded into the
|
|
29
|
+
* loser's own message: see `carryFoldedRetry`.
|
|
30
|
+
*
|
|
28
31
|
* Cross-instance duplicates are what the ownership lease bounds on platforms
|
|
29
32
|
* where it is a death proof, and the documented residual risk on
|
|
30
33
|
* multi-instance self-hosted worlds (mitigate by raising
|
|
31
34
|
* `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`).
|
|
32
35
|
*/
|
|
33
|
-
export function runStepSingleFlight(runId, correlationId, execute,
|
|
34
|
-
return runSingleFlight(runId, correlationId, execute,
|
|
36
|
+
export function runStepSingleFlight(runId, correlationId, execute, options = {}) {
|
|
37
|
+
return runSingleFlight(runId, correlationId, execute, async (winner) => {
|
|
38
|
+
if (winner?.settled.type === 'retry' &&
|
|
39
|
+
options.carryFoldedRetry &&
|
|
40
|
+
winner.state.publishedAfter &&
|
|
41
|
+
!winner.state.carried) {
|
|
42
|
+
winner.state.carried = true;
|
|
43
|
+
await winner.state.publishedAfter;
|
|
44
|
+
return winner.settled;
|
|
45
|
+
}
|
|
46
|
+
return { type: 'skipped' };
|
|
47
|
+
}, options.logLevel, (winner) => winner.type === 'skipped', {
|
|
48
|
+
publishedAfter: options.retryPublishedUnderDispatchKeyAfter,
|
|
49
|
+
carried: false,
|
|
50
|
+
});
|
|
35
51
|
}
|
|
36
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1zaW5nbGUtZmxpZ2h0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3J1bnRpbWUvc3BlYzgvc3RlcC1zaW5nbGUtZmxpZ2h0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUczRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBaUNHO0FBQ0gsTUFBTSxVQUFVLG1CQUFtQixDQUNqQyxLQUFhLEVBQ2IsYUFBcUIsRUFDckIsT0FBMkMsRUFDM0MsVUFBbUMsRUFBRTtJQUVyQyxPQUFPLGVBQWUsQ0FDcEIsS0FBSyxFQUNMLGFBQWEsRUFDYixPQUFPLEVBQ1AsS0FBSyxFQUFFLE1BQU0sRUFBRSxFQUFFO1FBQ2YsSUFDRSxNQUFNLEVBQUUsT0FBTyxDQUFDLElBQUksS0FBSyxPQUFPO1lBQ2hDLE9BQU8sQ0FBQyxnQkFBZ0I7WUFDeEIsTUFBTSxDQUFDLEtBQUssQ0FBQyxjQUFjO1lBQzNCLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQ3JCLENBQUM7WUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sR0FBRyxJQUFJLENBQUM7WUFDNUIsTUFBTSxNQUFNLENBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQztZQUNsQyxPQUFPLE1BQU0sQ0FBQyxPQUFPLENBQUM7UUFDeEIsQ0FBQztRQUNELE9BQU8sRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLENBQUM7SUFDN0IsQ0FBQyxFQUNELE9BQU8sQ0FBQyxRQUFRLEVBQ2hCLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQyxNQUFNLENBQUMsSUFBSSxLQUFLLFNBQVMsRUFDckM7UUFDRSxjQUFjLEVBQUUsT0FBTyxDQUFDLG1DQUFtQztRQUMzRCxPQUFPLEVBQUUsS0FBSztLQUNmLENBQ0YsQ0FBQztBQUNKLENBQUMifQ==
|
|
@@ -99,7 +99,7 @@ export interface SuspensionHandlerParams {
|
|
|
99
99
|
forceClaimVictimWakes?: Set<string>;
|
|
100
100
|
/**
|
|
101
101
|
* Steps this invocation is already executing inline from an earlier pass
|
|
102
|
-
* of the same delivery (
|
|
102
|
+
* of the same delivery (inline early advance). They are left
|
|
103
103
|
* out entirely: nothing is created, deferred, or reported in
|
|
104
104
|
* `pendingSteps` for them, since their own executions write their events.
|
|
105
105
|
* They still occupy inline slots, so fewer new steps are deferred for
|