@lostgradient/weft 0.23.1 → 0.24.1
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/README.md +72 -4
- package/dist/cli/codegen-emit-dedup.d.ts +81 -0
- package/dist/cli/codegen-emit-dedup.js +45 -0
- package/dist/cli/codegen-emit-registry.d.ts +90 -0
- package/dist/cli/codegen-emit-registry.js +50 -0
- package/dist/cli/codegen-emit.d.ts +26 -39
- package/dist/cli/codegen-emit.js +4 -27
- package/dist/cli/codegen-validate.d.ts +49 -0
- package/dist/cli/codegen-validate.js +186 -0
- package/dist/cli/codegen.js +6 -87
- package/dist/cli/conformance.js +5 -2
- package/dist/cli/generated/operation-catalog.snapshot.json +381 -3
- package/dist/cli/generated/operation-client.generated.d.ts +350 -10
- package/dist/cli/generated/operation-client.generated.js +14 -0
- package/dist/cli/output.js +1 -1
- package/dist/cli/parse-schedule-arguments.js +15 -3
- package/dist/cli/schedule.js +2 -1
- package/dist/cli/storage-factory.js +2 -0
- package/dist/cli/types.d.ts +2 -1
- package/dist/cli/workflow-commands.js +2 -0
- package/dist/cli-main.js +1 -1
- package/dist/client/http-client-requests.js +6 -9
- package/dist/client/start-body.js +1 -0
- package/dist/core/application-payload-digest.d.ts +42 -0
- package/dist/core/application-payload-digest.js +76 -0
- package/dist/core/application-primitive-abort.d.ts +50 -0
- package/dist/core/application-primitive-abort.js +40 -0
- package/dist/core/application-primitive-attempt-registry.d.ts +74 -0
- package/dist/core/application-primitive-attempt-registry.js +73 -0
- package/dist/core/application-primitive-codec.d.ts +36 -0
- package/dist/core/application-primitive-codec.js +56 -0
- package/dist/core/application-primitive-commit.d.ts +67 -0
- package/dist/core/application-primitive-commit.js +66 -0
- package/dist/core/application-primitive-guards.d.ts +62 -0
- package/dist/core/application-primitive-guards.js +89 -0
- package/dist/core/application-primitive-payload.d.ts +29 -0
- package/dist/core/application-primitive-payload.js +65 -0
- package/dist/core/application-primitive-timing.d.ts +18 -0
- package/dist/core/application-primitive-timing.js +22 -0
- package/dist/core/atomic-state.js +2 -0
- package/dist/core/catalog/codec.d.ts +40 -0
- package/dist/core/catalog/codec.js +45 -0
- package/dist/core/catalog/errors.d.ts +104 -0
- package/dist/core/catalog/errors.js +41 -0
- package/dist/core/catalog/index.d.ts +25 -0
- package/dist/core/catalog/index.js +22 -0
- package/dist/core/catalog/reference-counts.d.ts +120 -0
- package/dist/core/catalog/reference-counts.js +28 -0
- package/dist/core/catalog/removal.d.ts +105 -0
- package/dist/core/catalog/removal.js +30 -0
- package/dist/core/catalog/storage-io.d.ts +101 -0
- package/dist/core/catalog/storage-io.js +106 -0
- package/dist/core/catalog/types.d.ts +108 -0
- package/dist/core/catalog/types.js +0 -0
- package/dist/core/catalog/workflow-catalog.d.ts +165 -0
- package/dist/core/catalog/workflow-catalog.js +198 -0
- package/dist/core/compare-codepoint.d.ts +13 -0
- package/dist/core/compare-codepoint.js +7 -0
- package/dist/core/compression.js +2 -0
- package/dist/core/context/attributes.d.ts +1 -1
- package/dist/core/context/durable-operations.d.ts +2 -2
- package/dist/core/context/index.js +5 -3
- package/dist/core/context/state-namespace.d.ts +1 -1
- package/dist/core/contract/build.d.ts +64 -0
- package/dist/core/contract/build.js +99 -0
- package/dist/core/contract/compatibility.d.ts +187 -0
- package/dist/core/contract/compatibility.js +37 -0
- package/dist/core/contract/failure.d.ts +64 -0
- package/dist/core/contract/failure.js +4 -0
- package/dist/core/contract/hash.d.ts +92 -0
- package/dist/core/contract/hash.js +34 -0
- package/dist/core/contract/index.d.ts +21 -0
- package/dist/core/contract/index.js +22 -0
- package/dist/core/contract/limits.d.ts +74 -0
- package/dist/core/contract/limits.js +1 -0
- package/dist/core/contract/manifest-parse-schema.d.ts +37 -0
- package/dist/core/contract/manifest-parse-schema.js +106 -0
- package/dist/core/contract/manifest-parse.d.ts +76 -0
- package/dist/core/contract/manifest-parse.js +189 -0
- package/dist/core/contract/manifest.d.ts +56 -0
- package/dist/core/contract/manifest.js +31 -0
- package/dist/core/contract/normalize.d.ts +97 -0
- package/dist/core/contract/normalize.js +127 -0
- package/dist/core/contract/revision.d.ts +29 -0
- package/dist/core/contract/revision.js +5 -0
- package/dist/core/contract/types.d.ts +274 -0
- package/dist/core/contract/types.js +1 -0
- package/dist/core/engine/activity-resolution.js +17 -17
- package/dist/core/engine/bulk-operations-purge.js +14 -20
- package/dist/core/engine/bulk-operations-retry.d.ts +9 -0
- package/dist/core/engine/bulk-operations-retry.js +177 -0
- package/dist/core/engine/bulk-operations-shared.d.ts +18 -0
- package/dist/core/engine/bulk-operations-shared.js +14 -0
- package/dist/core/engine/bulk-operations.js +8 -167
- package/dist/core/engine/callback-creators-bundles.js +4 -2
- package/dist/core/engine/callback-creators-core.js +9 -1
- package/dist/core/engine/callback-creators-schedule.js +2 -2
- package/dist/core/engine/catalog-activation.d.ts +40 -0
- package/dist/core/engine/catalog-activation.js +17 -0
- package/dist/core/engine/catalog-events.d.ts +36 -0
- package/dist/core/engine/catalog-events.js +15 -0
- package/dist/core/engine/catalog-readiness.d.ts +49 -0
- package/dist/core/engine/catalog-readiness.js +61 -0
- package/dist/core/engine/catalog-removal.d.ts +236 -0
- package/dist/core/engine/catalog-removal.js +123 -0
- package/dist/core/engine/catalog-tombstone-recovery.d.ts +56 -0
- package/dist/core/engine/catalog-tombstone-recovery.js +39 -0
- package/dist/core/engine/constraints.js +5 -1
- package/dist/core/engine/construction.d.ts +2 -2
- package/dist/core/engine/construction.js +4 -2
- package/dist/core/engine/decode-revision.d.ts +32 -0
- package/dist/core/engine/decode-revision.js +9 -0
- package/dist/core/engine/disposal.d.ts +6 -2
- package/dist/core/engine/disposal.js +26 -3
- package/dist/core/engine/dynamic-source-errors.d.ts +81 -0
- package/dist/core/engine/dynamic-source-errors.js +25 -0
- package/dist/core/engine/dynamic-source-execution.d.ts +173 -0
- package/dist/core/engine/dynamic-source-execution.js +108 -0
- package/dist/core/engine/engine-internal-types.d.ts +16 -0
- package/dist/core/engine/engine-workflows-namespace.d.ts +140 -0
- package/dist/core/engine/engine-workflows-namespace.js +51 -0
- package/dist/core/engine/finalizer-metadata.d.ts +22 -0
- package/dist/core/engine/finalizer-metadata.js +12 -0
- package/dist/core/engine/handle-result.js +2 -0
- package/dist/core/engine/index.d.ts +91 -0
- package/dist/core/engine/index.js +78 -6
- package/dist/core/engine/inline-launch-queue.js +1 -1
- package/dist/core/engine/internals.d.ts +54 -15
- package/dist/core/engine/internals.js +6 -0
- package/dist/core/engine/lifecycle/checkpoint-launch.d.ts +29 -0
- package/dist/core/engine/lifecycle/checkpoint-launch.js +75 -0
- package/dist/core/engine/lifecycle/delayed-start-registration.d.ts +30 -0
- package/dist/core/engine/lifecycle/delayed-start-registration.js +11 -0
- package/dist/core/engine/lifecycle/fork-helpers.d.ts +33 -1
- package/dist/core/engine/lifecycle/fork-helpers.js +3 -1
- package/dist/core/engine/lifecycle/recovery-revision-groups.d.ts +75 -0
- package/dist/core/engine/lifecycle/recovery-revision-groups.js +64 -0
- package/dist/core/engine/lifecycle/resume-generation-guard.d.ts +58 -0
- package/dist/core/engine/lifecycle/resume-generation-guard.js +11 -0
- package/dist/core/engine/lifecycle/resume.js +18 -9
- package/dist/core/engine/lifecycle/shared.d.ts +43 -0
- package/dist/core/engine/lifecycle/standalone-claim-acquire.d.ts +12 -0
- package/dist/core/engine/lifecycle/standalone-claim-acquire.js +6 -0
- package/dist/core/engine/lifecycle/start-commit-errors.d.ts +12 -0
- package/dist/core/engine/lifecycle/start-commit-errors.js +6 -0
- package/dist/core/engine/lifecycle/start-commit.d.ts +22 -7
- package/dist/core/engine/lifecycle/start-commit.js +49 -15
- package/dist/core/engine/lifecycle/start-exec.d.ts +18 -2
- package/dist/core/engine/lifecycle/start-exec.js +7 -5
- package/dist/core/engine/lifecycle/start-or-signal-create.js +1 -3
- package/dist/core/engine/lifecycle/start-or-signal.js +1 -1
- package/dist/core/engine/lifecycle/start-precondition-attribution.d.ts +49 -0
- package/dist/core/engine/lifecycle/start-precondition-attribution.js +13 -0
- package/dist/core/engine/lifecycle/start-revision-resolution.d.ts +34 -0
- package/dist/core/engine/lifecycle/start-revision-resolution.js +11 -0
- package/dist/core/engine/lifecycle/start-state.d.ts +16 -0
- package/dist/core/engine/lifecycle/start-state.js +60 -0
- package/dist/core/engine/lifecycle/start-terminal-conflict-purge.d.ts +66 -3
- package/dist/core/engine/lifecycle/start-terminal-conflict-purge.js +13 -3
- package/dist/core/engine/lifecycle/start.d.ts +16 -6
- package/dist/core/engine/lifecycle/start.js +39 -66
- package/dist/core/engine/lifecycle/transition.d.ts +3 -4
- package/dist/core/engine/lifecycle/transition.js +30 -80
- package/dist/core/engine/lifecycle.d.ts +4 -2
- package/dist/core/engine/lifecycle.js +6 -6
- package/dist/core/engine/listing.js +15 -1
- package/dist/core/engine/memo-durable-activity.js +4 -1
- package/dist/core/engine/nonterminal-revision-count.d.ts +25 -0
- package/dist/core/engine/nonterminal-revision-count.js +16 -0
- package/dist/core/engine/operations-time.d.ts +5 -23
- package/dist/core/engine/operations-time.js +13 -11
- package/dist/core/engine/ownership-bootstrap.d.ts +1 -1
- package/dist/core/engine/pinned-schedule-revision-count.d.ts +26 -0
- package/dist/core/engine/pinned-schedule-revision-count.js +19 -0
- package/dist/core/engine/pinned-schedule-revision.d.ts +76 -0
- package/dist/core/engine/pinned-schedule-revision.js +53 -0
- package/dist/core/engine/registration.d.ts +106 -0
- package/dist/core/engine/registration.js +28 -7
- package/dist/core/engine/retention.js +9 -2
- package/dist/core/engine/revision-errors.d.ts +71 -0
- package/dist/core/engine/revision-errors.js +13 -0
- package/dist/core/engine/schedule-revision-fire.d.ts +17 -0
- package/dist/core/engine/schedule-revision-fire.js +3 -0
- package/dist/core/engine/schedule-run.js +2 -1
- package/dist/core/engine/schedules.d.ts +2 -1
- package/dist/core/engine/schedules.js +28 -9
- package/dist/core/engine/source-diagnostics.d.ts +76 -0
- package/dist/core/engine/source-diagnostics.js +105 -0
- package/dist/core/engine/source-registration.d.ts +42 -0
- package/dist/core/engine/source-registration.js +38 -0
- package/dist/core/engine/source-resolution.d.ts +101 -0
- package/dist/core/engine/source-resolution.js +154 -0
- package/dist/core/engine/source-runtime-state.d.ts +92 -0
- package/dist/core/engine/source-runtime-state.js +36 -0
- package/dist/core/engine/storage-io.d.ts +19 -2
- package/dist/core/engine/storage-io.js +21 -2
- package/dist/core/engine/termination/finalizer-registration.d.ts +18 -0
- package/dist/core/engine/termination/finalizer-registration.js +21 -0
- package/dist/core/engine/termination/finalizer.d.ts +16 -19
- package/dist/core/engine/termination/finalizer.js +3 -3
- package/dist/core/engine/time-operation-callbacks.d.ts +32 -0
- package/dist/core/engine/time-operation-callbacks.js +0 -0
- package/dist/core/engine/validation/schedule-cadence.d.ts +16 -0
- package/dist/core/engine/validation/schedule-cadence.js +20 -0
- package/dist/core/engine/validation/schedule-options.d.ts +4 -1
- package/dist/core/engine/validation/schedule-options.js +14 -0
- package/dist/core/engine/validation/schedule-revision.d.ts +24 -0
- package/dist/core/engine/validation/schedule-revision.js +21 -0
- package/dist/core/engine/validation/schedule-warnings.d.ts +11 -0
- package/dist/core/engine/validation/schedule-warnings.js +5 -0
- package/dist/core/engine/validation/schedule.d.ts +4 -3
- package/dist/core/engine/validation/schedule.js +15 -26
- package/dist/core/engine/validation.js +5 -2
- package/dist/core/engine/workflow-claim-reclaim-target.d.ts +1 -1
- package/dist/core/engine/workflow-claim-reclaim-target.js +16 -2
- package/dist/core/engine/workflow-retention-deadline.d.ts +16 -0
- package/dist/core/engine/workflow-retention-deadline.js +33 -0
- package/dist/core/events/catalog-events.d.ts +117 -0
- package/dist/core/events/catalog-events.js +62 -0
- package/dist/core/events/event-map.d.ts +11 -0
- package/dist/core/events/index.d.ts +2 -0
- package/dist/core/events/index.js +2 -0
- package/dist/core/events/workflow-source-events.d.ts +102 -0
- package/dist/core/events/workflow-source-events.js +57 -0
- package/dist/core/execution-strategy.d.ts +7 -0
- package/dist/core/inline-execution-strategy.context-options.d.ts +1 -1
- package/dist/core/inline-execution-strategy.js +1 -1
- package/dist/core/mailbox-admission.d.ts +26 -0
- package/dist/core/mailbox-admission.js +130 -0
- package/dist/core/mailbox-claims.d.ts +251 -0
- package/dist/core/mailbox-claims.js +0 -0
- package/dist/core/mailbox-codec.d.ts +32 -0
- package/dist/core/mailbox-codec.js +221 -0
- package/dist/core/mailbox-contract.d.ts +290 -0
- package/dist/core/mailbox-contract.js +0 -0
- package/dist/core/mailbox-delivery.d.ts +37 -0
- package/dist/core/mailbox-delivery.js +193 -0
- package/dist/core/mailbox-guards.d.ts +78 -0
- package/dist/core/mailbox-guards.js +58 -0
- package/dist/core/mailbox-index-codec.d.ts +41 -0
- package/dist/core/mailbox-index-codec.js +71 -0
- package/dist/core/mailbox-internals.d.ts +156 -0
- package/dist/core/mailbox-internals.js +154 -0
- package/dist/core/mailbox-maintenance.d.ts +29 -0
- package/dist/core/mailbox-maintenance.js +196 -0
- package/dist/core/mailbox-settlement.d.ts +69 -0
- package/dist/core/mailbox-settlement.js +206 -0
- package/dist/core/mailbox-storage.d.ts +117 -0
- package/dist/core/mailbox-storage.js +115 -0
- package/dist/core/mailbox-transition-helpers.d.ts +70 -0
- package/dist/core/mailbox-transition-helpers.js +43 -0
- package/dist/core/mailbox-transitions-recovery.d.ts +28 -0
- package/dist/core/mailbox-transitions-recovery.js +64 -0
- package/dist/core/mailbox-transitions.d.ts +138 -0
- package/dist/core/mailbox-transitions.js +180 -0
- package/dist/core/mailbox-types.d.ts +406 -0
- package/dist/core/mailbox-types.js +16 -0
- package/dist/core/mailbox-validation.d.ts +65 -0
- package/dist/core/mailbox-validation.js +73 -0
- package/dist/core/mailbox-waits.d.ts +50 -0
- package/dist/core/mailbox-waits.js +97 -0
- package/dist/core/mailbox.d.ts +163 -0
- package/dist/core/mailbox.js +211 -0
- package/dist/core/outbox-claims.d.ts +307 -0
- package/dist/core/outbox-claims.js +0 -0
- package/dist/core/outbox-codec.d.ts +24 -0
- package/dist/core/outbox-codec.js +257 -0
- package/dist/core/outbox-contract.d.ts +346 -0
- package/dist/core/outbox-contract.js +0 -0
- package/dist/core/outbox-delivery.d.ts +34 -0
- package/dist/core/outbox-delivery.js +149 -0
- package/dist/core/outbox-drain.d.ts +29 -0
- package/dist/core/outbox-drain.js +158 -0
- package/dist/core/outbox-enqueue.d.ts +24 -0
- package/dist/core/outbox-enqueue.js +115 -0
- package/dist/core/outbox-guards.d.ts +76 -0
- package/dist/core/outbox-guards.js +60 -0
- package/dist/core/outbox-index-codec.d.ts +33 -0
- package/dist/core/outbox-index-codec.js +71 -0
- package/dist/core/outbox-internals.d.ts +99 -0
- package/dist/core/outbox-internals.js +159 -0
- package/dist/core/outbox-listing.d.ts +12 -0
- package/dist/core/outbox-listing.js +38 -0
- package/dist/core/outbox-maintenance.d.ts +28 -0
- package/dist/core/outbox-maintenance.js +191 -0
- package/dist/core/outbox-operations.d.ts +18 -0
- package/dist/core/outbox-operations.js +46 -0
- package/dist/core/outbox-runner.d.ts +30 -0
- package/dist/core/outbox-runner.js +217 -0
- package/dist/core/outbox-settlement.d.ts +57 -0
- package/dist/core/outbox-settlement.js +183 -0
- package/dist/core/outbox-storage.d.ts +107 -0
- package/dist/core/outbox-storage.js +127 -0
- package/dist/core/outbox-transition-helpers.d.ts +83 -0
- package/dist/core/outbox-transition-helpers.js +63 -0
- package/dist/core/outbox-transitions-recovery.d.ts +30 -0
- package/dist/core/outbox-transitions-recovery.js +42 -0
- package/dist/core/outbox-transitions.d.ts +145 -0
- package/dist/core/outbox-transitions.js +236 -0
- package/dist/core/outbox-types.d.ts +400 -0
- package/dist/core/outbox-types.js +20 -0
- package/dist/core/outbox-validation.d.ts +101 -0
- package/dist/core/outbox-validation.js +127 -0
- package/dist/core/outbox-waits.d.ts +39 -0
- package/dist/core/outbox-waits.js +88 -0
- package/dist/core/outbox.d.ts +156 -0
- package/dist/core/outbox.js +234 -0
- package/dist/core/registry-limits.d.ts +49 -0
- package/dist/core/registry-limits.js +10 -0
- package/dist/core/registry-schema-conversion.d.ts +20 -0
- package/dist/core/registry-schema-conversion.js +22 -0
- package/dist/core/registry-snapshot.d.ts +91 -42
- package/dist/core/registry-snapshot.js +39 -77
- package/dist/core/registry-workflow-contract-draft.d.ts +32 -0
- package/dist/core/registry-workflow-contract-draft.js +28 -0
- package/dist/core/registry-workflow-manifest.d.ts +122 -0
- package/dist/core/registry-workflow-manifest.js +92 -0
- package/dist/core/source/errors.d.ts +55 -0
- package/dist/core/source/errors.js +13 -0
- package/dist/core/source/index.d.ts +19 -0
- package/dist/core/source/index.js +4 -0
- package/dist/core/source/resolvers.d.ts +45 -0
- package/dist/core/source/resolvers.js +9 -0
- package/dist/core/source/types.d.ts +211 -0
- package/dist/core/source/types.js +0 -0
- package/dist/core/source/validate.d.ts +91 -0
- package/dist/core/source/validate.js +62 -0
- package/dist/core/source/workflow-source.d.ts +43 -0
- package/dist/core/source/workflow-source.js +16 -0
- package/dist/core/types/checkpoint.d.ts +14 -0
- package/dist/core/types/schedules.d.ts +52 -1
- package/dist/core/types/state.d.ts +16 -0
- package/dist/core/types/workflow-registries.d.ts +7 -0
- package/dist/core/types/workflow-registry.d.ts +12 -0
- package/dist/core/versioning.js +2 -0
- package/dist/core/weft-error.d.ts +1 -1
- package/dist/core/weft-error.js +12 -1
- package/dist/core/worker-execution-strategy.d.ts +1 -0
- package/dist/core/worker-execution-strategy.js +13 -1
- package/dist/core/worker-fault-handling.d.ts +10 -0
- package/dist/core/worker-fault-handling.js +1 -0
- package/dist/core/worker-inbound-message.d.ts +1 -0
- package/dist/core/worker-inbound-message.js +1 -0
- package/dist/core/worker-protocol-guard.js +4 -0
- package/dist/core/worker-protocol.d.ts +7 -0
- package/dist/core/worker-protocol.js +2 -1
- package/dist/core/worker-turn-watchdog.d.ts +8 -1
- package/dist/core/worker-turn-watchdog.js +3 -2
- package/dist/diagnostics/format.js +5 -0
- package/dist/diagnostics/types.d.ts +24 -0
- package/dist/diagnostics/version-check.js +8 -2
- package/dist/http.js +2 -2
- package/dist/index.d.ts +25 -4
- package/dist/index.js +57 -0
- package/dist/indexeddb.js +1 -1
- package/dist/json-schema.js +3 -3
- package/dist/mcp/resources.js +2 -0
- package/dist/runtime/portable.d.ts +9 -1
- package/dist/server/fault-to-json-rpc.js +4 -1
- package/dist/server/handler/auth-context-principal.js +4 -0
- package/dist/server/index.d.ts +11 -0
- package/dist/server/json-rpc-http.js +2 -0
- package/dist/server/json-rpc-websocket.js +6 -4
- package/dist/server/operation-catalog/index.d.ts +1 -1
- package/dist/server/operation-catalog/pipeline-helpers.js +2 -0
- package/dist/server/operation-catalog/types.d.ts +17 -0
- package/dist/server/operation-fault.d.ts +5 -0
- package/dist/server/operation-fault.js +4 -1
- package/dist/server/operations/activate-workflow-revision.d.ts +30 -0
- package/dist/server/operations/activate-workflow-revision.js +69 -0
- package/dist/server/operations/create-schedule.d.ts +2 -0
- package/dist/server/operations/create-schedule.js +10 -6
- package/dist/server/operations/fleet-events-subscription.js +1 -1
- package/dist/server/operations/fork-workflow.js +1 -1
- package/dist/server/operations/get-active-workflow-revision.d.ts +32 -0
- package/dist/server/operations/get-active-workflow-revision.js +46 -0
- package/dist/server/operations/get-catalog-diagnostics.d.ts +113 -0
- package/dist/server/operations/get-catalog-diagnostics.js +65 -0
- package/dist/server/operations/get-registry.js +17 -4
- package/dist/server/operations/get-task-detail-schema.d.ts +8 -0
- package/dist/server/operations/get-task-detail-schema.js +1 -0
- package/dist/server/operations/get-task-detail.d.ts +8 -0
- package/dist/server/operations/get-task-detail.js +1 -0
- package/dist/server/operations/get-task-diagnostics.d.ts +4 -4
- package/dist/server/operations/get-workflow-revision.d.ts +25 -0
- package/dist/server/operations/get-workflow-revision.js +50 -0
- package/dist/server/operations/install-workflow-revision.d.ts +27 -0
- package/dist/server/operations/install-workflow-revision.js +46 -0
- package/dist/server/operations/list-workflow-revisions.d.ts +20 -0
- package/dist/server/operations/list-workflow-revisions.js +40 -0
- package/dist/server/operations/preload-workflow-revision.d.ts +28 -0
- package/dist/server/operations/preload-workflow-revision.js +60 -0
- package/dist/server/operations/schedule-faults.d.ts +1 -0
- package/dist/server/operations/schedule-faults.js +32 -4
- package/dist/server/operations/schedule-rest-body.d.ts +1 -0
- package/dist/server/operations/schedule-rest-body.js +2 -1
- package/dist/server/operations/start-or-signal-workflow.js +1 -1
- package/dist/server/operations/start-workflow.js +1 -1
- package/dist/server/operations/static-registrations.js +42 -0
- package/dist/server/operations/storage.js +2 -2
- package/dist/server/operations/submit-review-decision.js +1 -1
- package/dist/server/operations/update-schedule.d.ts +2 -0
- package/dist/server/operations/update-schedule.js +4 -2
- package/dist/server/operations/workflow-catalog-operation-helpers.d.ts +59 -0
- package/dist/server/operations/workflow-catalog-operation-helpers.js +162 -0
- package/dist/server/runtime/task-dispatch-envelope.d.ts +14 -0
- package/dist/server/runtime/task-dispatch-envelope.js +32 -0
- package/dist/server/runtime/task-dispatch-revision.d.ts +29 -0
- package/dist/server/runtime/task-dispatch-revision.js +13 -0
- package/dist/server/runtime/task-dispatch.js +12 -37
- package/dist/server/runtime/task-ledger-recovery.js +1 -1
- package/dist/server/runtime/task-ledger-runtime.d.ts +14 -2
- package/dist/server/runtime/task-ledger-runtime.js +5 -3
- package/dist/server/runtime/task-polling.js +9 -3
- package/dist/server/runtime/task-reconciliation.js +2 -1
- package/dist/server/runtime/websocket-upgrade.js +2 -0
- package/dist/server/runtime/websocket-worker.js +9 -0
- package/dist/server/task-ledger-codec.d.ts +9 -0
- package/dist/server/task-ledger-codec.js +4 -1
- package/dist/server/task-ledger-transition-helpers.js +1 -0
- package/dist/server/task-ledger-types.d.ts +9 -0
- package/dist/server/task-ledger.d.ts +1 -1
- package/dist/server/task-ledger.js +2 -1
- package/dist/server/task-queue-types.d.ts +2 -0
- package/dist/storage/bun-sql.js +51 -6
- package/dist/storage/catalog-keys.d.ts +64 -0
- package/dist/storage/catalog-keys.js +8 -0
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/derived-operations.js +1 -1
- package/dist/storage/index.d.ts +28 -1
- package/dist/storage/interface.d.ts +28 -1
- package/dist/storage/interface.js +1 -1
- package/dist/storage/key-encoding.d.ts +15 -0
- package/dist/storage/key-encoding.js +3 -0
- package/dist/storage/key-prefixes.d.ts +1 -1
- package/dist/storage/key-prefixes.js +16 -0
- package/dist/storage/lmdb.d.ts +54 -1
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/mailbox-keys.d.ts +80 -0
- package/dist/storage/mailbox-keys.js +14 -0
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon.js +2 -2
- package/dist/storage/node-sqlite-loader.d.ts +1 -1
- package/dist/storage/node-sqlite.js +51 -6
- package/dist/storage/outbox-keys.d.ts +77 -0
- package/dist/storage/outbox-keys.js +14 -0
- package/dist/storage/postgres.js +2 -2
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/storage-configuration.d.ts +6 -0
- package/dist/storage/testing.js +1 -1
- package/dist/storage/turso.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/web-extension.js +1 -1
- package/dist/worker/manifest/registry-contract-builder.d.ts +21 -3
- package/dist/worker/manifest/registry-contract-builder.js +40 -31
- package/dist/worker/protocol-messages.d.ts +17 -0
- package/dist/worker/protocol-schemas.d.ts +32 -0
- package/dist/worker/protocol-schemas.js +7 -3
- package/dist/worker/protocol-task-result.js +35 -3
- package/dist/worker/protocol.js +1 -1
- package/dist/worker/registry/types.d.ts +2 -0
- package/dist/worker/registry.d.ts +1 -1
- package/dist/worker/registry.js +3 -1
- package/dist/workers/workflow-runner.d.ts +9 -0
- package/dist/workers/workflow-runner.js +9 -2
- package/dist/workers/workflow-worker-entry.js +9 -4
- package/package.json +2 -2
|
@@ -38,6 +38,7 @@ function baseEnvelopeFields(record) {
|
|
|
38
38
|
operationId: record.operationId,
|
|
39
39
|
...record.workflowId !== void 0 ? { workflowId: record.workflowId } : {},
|
|
40
40
|
...record.workflowExecutionToken !== void 0 ? { workflowExecutionToken: record.workflowExecutionToken } : {},
|
|
41
|
+
...record.workflowRevision !== void 0 ? { workflowRevision: record.workflowRevision } : {},
|
|
41
42
|
workflowType: record.workflowType,
|
|
42
43
|
activityName: record.activityName,
|
|
43
44
|
queue: record.queue,
|
|
@@ -60,8 +60,8 @@ declare const taskDiagnosticItemSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
60
60
|
}>;
|
|
61
61
|
state: z.ZodEnum<{
|
|
62
62
|
"dead-lettered": "dead-lettered";
|
|
63
|
-
queued: "queued";
|
|
64
63
|
resolved: "resolved";
|
|
64
|
+
queued: "queued";
|
|
65
65
|
inflight: "inflight";
|
|
66
66
|
capacity: "capacity";
|
|
67
67
|
}>;
|
|
@@ -122,8 +122,8 @@ declare const getTaskDiagnosticsOutput: z.ZodObject<{
|
|
|
122
122
|
}>;
|
|
123
123
|
state: z.ZodEnum<{
|
|
124
124
|
"dead-lettered": "dead-lettered";
|
|
125
|
-
queued: "queued";
|
|
126
125
|
resolved: "resolved";
|
|
126
|
+
queued: "queued";
|
|
127
127
|
inflight: "inflight";
|
|
128
128
|
capacity: "capacity";
|
|
129
129
|
}>;
|
|
@@ -217,7 +217,7 @@ export declare function createGetTaskDiagnosticsOperation(options?: GetTaskDiagn
|
|
|
217
217
|
}, {
|
|
218
218
|
items: ({
|
|
219
219
|
kind: "dead-lettered" | "stuck-queued" | "stale-inflight" | "retry-storm" | "all-workers-at-capacity";
|
|
220
|
-
state: "dead-lettered" | "
|
|
220
|
+
state: "dead-lettered" | "resolved" | "queued" | "inflight" | "capacity";
|
|
221
221
|
retryCount: number;
|
|
222
222
|
requeueCount: number;
|
|
223
223
|
evidence: string[];
|
|
@@ -279,7 +279,7 @@ export declare const getTaskDiagnosticsOperation: import("../operation-catalog.t
|
|
|
279
279
|
}, {
|
|
280
280
|
items: ({
|
|
281
281
|
kind: "dead-lettered" | "stuck-queued" | "stale-inflight" | "retry-storm" | "all-workers-at-capacity";
|
|
282
|
-
state: "dead-lettered" | "
|
|
282
|
+
state: "dead-lettered" | "resolved" | "queued" | "inflight" | "capacity";
|
|
283
283
|
retryCount: number;
|
|
284
284
|
requeueCount: number;
|
|
285
285
|
evidence: string[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `weft.workflows.revisions.get` operation + REST binding.
|
|
3
|
+
*
|
|
4
|
+
* Returns one installed `(name, revision)` workflow catalog record.
|
|
5
|
+
*
|
|
6
|
+
* @module server/operations/get-workflow-revision
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import type { WorkflowRevisionRecord } from '../../core/catalog/index.ts';
|
|
10
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
11
|
+
declare const getWorkflowRevisionInput: z.ZodObject<{
|
|
12
|
+
name: z.ZodUnknown;
|
|
13
|
+
revision: z.ZodUnknown;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type GetWorkflowRevisionInput = z.infer<typeof getWorkflowRevisionInput>;
|
|
16
|
+
export type GetWorkflowRevisionOutput = WorkflowRevisionRecord;
|
|
17
|
+
export declare const getWorkflowRevisionOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
18
|
+
name: unknown;
|
|
19
|
+
revision: unknown;
|
|
20
|
+
}, Readonly<{
|
|
21
|
+
manifest: import("../../index.ts").WorkflowRevisionManifest;
|
|
22
|
+
installedAt: number;
|
|
23
|
+
}>, unknown>;
|
|
24
|
+
export declare const getWorkflowRevisionRestBinding: UnknownRestBinding;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-registry.js";
|
|
3
|
+
import {
|
|
4
|
+
validateWorkflowNameField,
|
|
5
|
+
validateWorkflowRevisionField,
|
|
6
|
+
workflowsReadAccess
|
|
7
|
+
} from "./workflow-catalog-operation-helpers.js";
|
|
8
|
+
const getWorkflowRevisionInput = z.object({
|
|
9
|
+
name: z.unknown().describe("Workflow name. Runtime validation requires a wire-safe identifier."),
|
|
10
|
+
revision: z.unknown().describe("Installed revision. Runtime validation requires a non-empty string.")
|
|
11
|
+
}), getWorkflowRevisionOutput = z.unknown();
|
|
12
|
+
export const getWorkflowRevisionOperation = defineOperation({
|
|
13
|
+
name: "weft.workflows.revisions.get",
|
|
14
|
+
mcpExposable: !1,
|
|
15
|
+
summary: "Get one installed workflow revision",
|
|
16
|
+
description: "Read one durably installed `(name, revision)` workflow catalog record. Read-only. Faults with NotFound when no such revision was installed.",
|
|
17
|
+
destructive: !1,
|
|
18
|
+
tags: ["Workflow Catalog"],
|
|
19
|
+
inputSchema: getWorkflowRevisionInput,
|
|
20
|
+
outputSchema: getWorkflowRevisionOutput,
|
|
21
|
+
access: workflowsReadAccess,
|
|
22
|
+
producibleFaults: ["NotFound", "InvalidParams"],
|
|
23
|
+
discoverable: !0,
|
|
24
|
+
transports: { http: !0, jsonRpcHttp: !0, jsonRpcWebSocket: !0, jsonRpcStdio: !0 },
|
|
25
|
+
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
26
|
+
invoke: async ({ input, engine }) => {
|
|
27
|
+
const e = engine, name = validateWorkflowNameField(input.name), revision = validateWorkflowRevisionField(input.revision), record = await e.workflows.getRevision(name, revision);
|
|
28
|
+
if (record === null)
|
|
29
|
+
throw {
|
|
30
|
+
code: "NotFound",
|
|
31
|
+
message: `Workflow "${name}" has no installed revision "${revision}"`,
|
|
32
|
+
data: { resource: "workflow-revision", identifier: `${name}:${revision}` }
|
|
33
|
+
};
|
|
34
|
+
return record;
|
|
35
|
+
}
|
|
36
|
+
}), getWorkflowRevisionRestBinding = {
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: "/v1/registry/workflows/:name/revisions/:revision",
|
|
39
|
+
pathParamNames: ["name", "revision"],
|
|
40
|
+
operationName: "weft.workflows.revisions.get",
|
|
41
|
+
inputSources: {
|
|
42
|
+
name: { kind: "path", pathParam: "name" },
|
|
43
|
+
revision: { kind: "path", pathParam: "revision" }
|
|
44
|
+
},
|
|
45
|
+
extractInput: async (_request, pathParams) => ({
|
|
46
|
+
name: pathParams.name ?? "",
|
|
47
|
+
revision: pathParams.revision ?? ""
|
|
48
|
+
}),
|
|
49
|
+
success: { kind: "json", status: 200 }
|
|
50
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `weft.workflows.revisions.install` operation + REST binding.
|
|
3
|
+
*
|
|
4
|
+
* Durably installs a validated {@link WorkflowRevisionManifest} for a
|
|
5
|
+
* workflow the engine already has an in-process definition for. Catalog
|
|
6
|
+
* bookkeeping only — see `core/engine/engine-workflows-namespace.ts`'s
|
|
7
|
+
* module doc: installing (and later activating) a revision never changes
|
|
8
|
+
* which in-process handler `engine.start()` dispatches to.
|
|
9
|
+
*
|
|
10
|
+
* @module server/operations/install-workflow-revision
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import type { WorkflowRevisionRecord } from '../../core/catalog/index.ts';
|
|
14
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
15
|
+
declare const installWorkflowRevisionInput: z.ZodObject<{
|
|
16
|
+
manifest: z.ZodUnknown;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type InstallWorkflowRevisionInput = z.infer<typeof installWorkflowRevisionInput>;
|
|
19
|
+
export type InstallWorkflowRevisionOutput = WorkflowRevisionRecord;
|
|
20
|
+
export declare const installWorkflowRevisionOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
21
|
+
manifest: unknown;
|
|
22
|
+
}, Readonly<{
|
|
23
|
+
manifest: import("../../index.ts").WorkflowRevisionManifest;
|
|
24
|
+
installedAt: number;
|
|
25
|
+
}>, unknown>;
|
|
26
|
+
export declare const installWorkflowRevisionRestBinding: UnknownRestBinding;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-registry.js";
|
|
3
|
+
import {
|
|
4
|
+
readWorkflowCatalogRestBody,
|
|
5
|
+
throwWorkflowCatalogOperationFault,
|
|
6
|
+
validateManifestField,
|
|
7
|
+
workflowsAdminAccess
|
|
8
|
+
} from "./workflow-catalog-operation-helpers.js";
|
|
9
|
+
const installWorkflowRevisionInput = z.object({
|
|
10
|
+
manifest: z.unknown().describe("An untrusted WorkflowRevisionManifest, validated at invoke time.")
|
|
11
|
+
}), installWorkflowRevisionOutput = z.unknown();
|
|
12
|
+
export const installWorkflowRevisionOperation = defineOperation({
|
|
13
|
+
name: "weft.workflows.revisions.install",
|
|
14
|
+
mcpExposable: !1,
|
|
15
|
+
summary: "Durably install a workflow revision manifest",
|
|
16
|
+
description: "Validate and durably install a `WorkflowRevisionManifest` for a workflow the engine already has an in-process definition for. Idempotent on a byte-identical reinstall of the same (name, revision). Faults with InvalidParams when the manifest fails validation or names a workflow with no in-process definition, and Conflict when (name, revision) is already installed with different contract content. Does not check `manifest.workflowVersion` " + "against the in-process definition's own version \u2014 that mismatch is a normal " + "activation-time `incompatible` refusal, not an install-time error. Never changes which in-process handler `engine.start()` dispatches to.",
|
|
17
|
+
destructive: !1,
|
|
18
|
+
tags: ["Workflow Catalog"],
|
|
19
|
+
inputSchema: installWorkflowRevisionInput,
|
|
20
|
+
outputSchema: installWorkflowRevisionOutput,
|
|
21
|
+
access: workflowsAdminAccess,
|
|
22
|
+
producibleFaults: ["InvalidParams", "Conflict"],
|
|
23
|
+
discoverable: !0,
|
|
24
|
+
transports: { http: !0, jsonRpcHttp: !0, jsonRpcWebSocket: !0, jsonRpcStdio: !0 },
|
|
25
|
+
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
26
|
+
invoke: async ({ input, engine }) => {
|
|
27
|
+
const e = engine, manifest = await validateManifestField(input.manifest);
|
|
28
|
+
try {
|
|
29
|
+
return await e.workflows.install(manifest);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return throwWorkflowCatalogOperationFault(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}), installWorkflowRevisionRestBinding = {
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: "/v1/registry/revisions",
|
|
37
|
+
pathParamNames: [],
|
|
38
|
+
operationName: "weft.workflows.revisions.install",
|
|
39
|
+
inputSources: {
|
|
40
|
+
manifest: { kind: "body-field", bodyField: "manifest" }
|
|
41
|
+
},
|
|
42
|
+
extractInput: async (request, _pathParams, context) => {
|
|
43
|
+
return { manifest: (await readWorkflowCatalogRestBody(request, context)).manifest };
|
|
44
|
+
},
|
|
45
|
+
success: { kind: "json", status: 201 }
|
|
46
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `weft.workflows.revisions.list` operation + REST binding.
|
|
3
|
+
*
|
|
4
|
+
* Lists every durably installed revision of one workflow name.
|
|
5
|
+
*
|
|
6
|
+
* @module server/operations/list-workflow-revisions
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import type { WorkflowRevisionRecord } from '../../core/catalog/index.ts';
|
|
10
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
11
|
+
declare const listWorkflowRevisionsInput: z.ZodObject<{
|
|
12
|
+
name: z.ZodUnknown;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type ListWorkflowRevisionsInput = z.infer<typeof listWorkflowRevisionsInput>;
|
|
15
|
+
export type ListWorkflowRevisionsOutput = readonly WorkflowRevisionRecord[];
|
|
16
|
+
export declare const listWorkflowRevisionsOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
17
|
+
name: unknown;
|
|
18
|
+
}, ListWorkflowRevisionsOutput, unknown>;
|
|
19
|
+
export declare const listWorkflowRevisionsRestBinding: UnknownRestBinding;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-registry.js";
|
|
3
|
+
import {
|
|
4
|
+
validateWorkflowNameField,
|
|
5
|
+
workflowsReadAccess
|
|
6
|
+
} from "./workflow-catalog-operation-helpers.js";
|
|
7
|
+
const listWorkflowRevisionsInput = z.object({
|
|
8
|
+
name: z.unknown().describe("Workflow name. Runtime validation requires a wire-safe identifier.")
|
|
9
|
+
}), listWorkflowRevisionsOutput = z.unknown();
|
|
10
|
+
export const listWorkflowRevisionsOperation = defineOperation({
|
|
11
|
+
name: "weft.workflows.revisions.list",
|
|
12
|
+
mcpExposable: !1,
|
|
13
|
+
summary: "List every installed revision of a workflow",
|
|
14
|
+
description: "Read every durably installed revision of `name`, sorted deterministically by revision. Read-only. Returns an empty array for a name with no installed revisions, rather than a " + "NotFound fault \u2014 an empty catalog is not an error.",
|
|
15
|
+
destructive: !1,
|
|
16
|
+
tags: ["Workflow Catalog"],
|
|
17
|
+
inputSchema: listWorkflowRevisionsInput,
|
|
18
|
+
outputSchema: listWorkflowRevisionsOutput,
|
|
19
|
+
access: workflowsReadAccess,
|
|
20
|
+
producibleFaults: ["InvalidParams"],
|
|
21
|
+
discoverable: !0,
|
|
22
|
+
transports: { http: !0, jsonRpcHttp: !0, jsonRpcWebSocket: !0, jsonRpcStdio: !0 },
|
|
23
|
+
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
24
|
+
invoke: async ({ input, engine }) => {
|
|
25
|
+
const e = engine, name = validateWorkflowNameField(input.name);
|
|
26
|
+
return e.workflows.listRevisions(name);
|
|
27
|
+
}
|
|
28
|
+
}), listWorkflowRevisionsRestBinding = {
|
|
29
|
+
method: "GET",
|
|
30
|
+
path: "/v1/registry/workflows/:name/revisions",
|
|
31
|
+
pathParamNames: ["name"],
|
|
32
|
+
operationName: "weft.workflows.revisions.list",
|
|
33
|
+
inputSources: {
|
|
34
|
+
name: { kind: "path", pathParam: "name" }
|
|
35
|
+
},
|
|
36
|
+
extractInput: async (_request, pathParams) => ({
|
|
37
|
+
name: pathParams.name ?? ""
|
|
38
|
+
}),
|
|
39
|
+
success: { kind: "json", status: 200 }
|
|
40
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `weft.workflows.revisions.preload` operation + REST binding.
|
|
3
|
+
*
|
|
4
|
+
* Loads, validates, and installs one dynamic workflow source revision
|
|
5
|
+
* previously recorded via `engine.registerSource()` — a thin, documented
|
|
6
|
+
* exposure of `engine.workflows.preload()` (WFT-15/16). Modeled on
|
|
7
|
+
* `install-workflow-revision.ts` / `activate-workflow-revision.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module server/operations/preload-workflow-revision
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import type { WorkflowRevisionRecord } from '../../core/catalog/index.ts';
|
|
13
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
14
|
+
declare const preloadWorkflowRevisionInput: z.ZodObject<{
|
|
15
|
+
name: z.ZodUnknown;
|
|
16
|
+
revision: z.ZodUnknown;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type PreloadWorkflowRevisionInput = z.infer<typeof preloadWorkflowRevisionInput>;
|
|
19
|
+
export type PreloadWorkflowRevisionOutput = WorkflowRevisionRecord;
|
|
20
|
+
export declare const preloadWorkflowRevisionOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
21
|
+
name: unknown;
|
|
22
|
+
revision: unknown;
|
|
23
|
+
}, Readonly<{
|
|
24
|
+
manifest: import("../../index.ts").WorkflowRevisionManifest;
|
|
25
|
+
installedAt: number;
|
|
26
|
+
}>, unknown>;
|
|
27
|
+
export declare const preloadWorkflowRevisionRestBinding: UnknownRestBinding;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isWeftError } from "../../core/weft-error.js";
|
|
3
|
+
import { defineOperation } from "../operation-registry.js";
|
|
4
|
+
import {
|
|
5
|
+
readWorkflowCatalogRestBody,
|
|
6
|
+
throwWorkflowCatalogOperationFault,
|
|
7
|
+
validateWorkflowNameField,
|
|
8
|
+
validateWorkflowRevisionField,
|
|
9
|
+
workflowsAdminAccess
|
|
10
|
+
} from "./workflow-catalog-operation-helpers.js";
|
|
11
|
+
const preloadWorkflowRevisionInput = z.object({
|
|
12
|
+
name: z.unknown().describe("Workflow name. Runtime validation requires a wire-safe identifier."),
|
|
13
|
+
revision: z.unknown().describe("The registerSource()-registered revision to load, validate, and install. Runtime validation requires a non-empty string.")
|
|
14
|
+
}), preloadWorkflowRevisionOutput = z.unknown();
|
|
15
|
+
export const preloadWorkflowRevisionOperation = defineOperation({
|
|
16
|
+
name: "weft.workflows.revisions.preload",
|
|
17
|
+
mcpExposable: !1,
|
|
18
|
+
summary: "Load, validate, and install a registered dynamic workflow source revision",
|
|
19
|
+
description: "Load, validate, and install `(name, revision)` \u2014 previously recorded via " + "engine.registerSource() \u2014 durably into the workflow catalog. Faults NotFound when no " + "source was ever registered for this exact key, and Conflict when the load fails or the loaded module fails validation.",
|
|
20
|
+
destructive: !1,
|
|
21
|
+
tags: ["Workflow Catalog"],
|
|
22
|
+
inputSchema: preloadWorkflowRevisionInput,
|
|
23
|
+
outputSchema: preloadWorkflowRevisionOutput,
|
|
24
|
+
access: workflowsAdminAccess,
|
|
25
|
+
producibleFaults: ["InvalidParams", "NotFound", "Conflict"],
|
|
26
|
+
discoverable: !0,
|
|
27
|
+
transports: { http: !0, jsonRpcHttp: !0, jsonRpcWebSocket: !0, jsonRpcStdio: !0 },
|
|
28
|
+
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
29
|
+
invoke: async ({ input, engine }) => {
|
|
30
|
+
const e = engine, name = validateWorkflowNameField(input.name), revision = validateWorkflowRevisionField(input.revision);
|
|
31
|
+
try {
|
|
32
|
+
return await e.workflows.preload(name, revision);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (!isWeftError(error))
|
|
35
|
+
throw {
|
|
36
|
+
code: "Conflict",
|
|
37
|
+
message: `Dynamic workflow source "${name}" revision "${revision}" failed to load.`,
|
|
38
|
+
data: { reason: "load-failed" }
|
|
39
|
+
};
|
|
40
|
+
return throwWorkflowCatalogOperationFault(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}), preloadWorkflowRevisionRestBinding = {
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/v1/registry/workflows/:name/preload",
|
|
46
|
+
pathParamNames: ["name"],
|
|
47
|
+
operationName: "weft.workflows.revisions.preload",
|
|
48
|
+
inputSources: {
|
|
49
|
+
name: { kind: "path", pathParam: "name" },
|
|
50
|
+
revision: { kind: "body-field", bodyField: "revision" }
|
|
51
|
+
},
|
|
52
|
+
extractInput: async (request, pathParams, context) => {
|
|
53
|
+
const body = await readWorkflowCatalogRestBody(request, context);
|
|
54
|
+
return {
|
|
55
|
+
name: pathParams.name ?? "",
|
|
56
|
+
revision: body.revision
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
success: { kind: "json", status: 200 }
|
|
60
|
+
};
|
|
@@ -6,6 +6,7 @@ export type ScheduleMutableOptionsInput = {
|
|
|
6
6
|
overlap?: unknown;
|
|
7
7
|
backfill?: unknown;
|
|
8
8
|
jitter?: unknown;
|
|
9
|
+
revisionPolicy?: unknown;
|
|
9
10
|
};
|
|
10
11
|
/** Validate the mutable schedule options shared by create and update. */
|
|
11
12
|
export declare function validateScheduleMutableOptions(input: ScheduleMutableOptionsInput): ScheduleUpdateOptions;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { WorkflowRevisionUnavailableError } from "../../core/engine/revision-errors.js";
|
|
1
2
|
import {
|
|
2
3
|
isValidScheduleOverlapPolicy,
|
|
4
|
+
isValidScheduleRevisionPolicy,
|
|
3
5
|
normalizeScheduleUpdateOptions
|
|
4
6
|
} from "../../core/engine/validation/schedule.js";
|
|
5
7
|
import { invalidParamsFault } from "./operation-helpers.js";
|
|
6
8
|
export { isOperationFault } from "./operation-helpers.js";
|
|
7
9
|
export function validateScheduleMutableOptions(input) {
|
|
8
|
-
const description = validateScheduleDescription(input.description), overlap = validateScheduleOverlap(input.overlap), backfill = validateScheduleBackfill(input.backfill), jitter = validateScheduleJitter(input.jitter);
|
|
10
|
+
const description = validateScheduleDescription(input.description), overlap = validateScheduleOverlap(input.overlap), backfill = validateScheduleBackfill(input.backfill), jitter = validateScheduleJitter(input.jitter), revisionPolicy = validateScheduleRevisionPolicy(input.revisionPolicy);
|
|
9
11
|
return {
|
|
10
12
|
...description !== void 0 ? { description } : {},
|
|
11
13
|
...overlap !== void 0 ? { overlap } : {},
|
|
12
14
|
...backfill !== void 0 ? { backfill } : {},
|
|
13
|
-
...jitter !== void 0 ? { jitter } : {}
|
|
15
|
+
...jitter !== void 0 ? { jitter } : {},
|
|
16
|
+
...revisionPolicy !== void 0 ? { revisionPolicy } : {}
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
function validateScheduleDescription(value) {
|
|
@@ -27,6 +30,13 @@ function validateScheduleOverlap(value) {
|
|
|
27
30
|
throw invalidParamsFault('Field "overlap" must be one of skip, queue, cancel-running, allow');
|
|
28
31
|
return value;
|
|
29
32
|
}
|
|
33
|
+
function validateScheduleRevisionPolicy(value) {
|
|
34
|
+
if (value === void 0)
|
|
35
|
+
return;
|
|
36
|
+
if (!isValidScheduleRevisionPolicy(value))
|
|
37
|
+
throw invalidParamsFault('Field "revisionPolicy" must be one of active-at-fire, pinned');
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
30
40
|
function validateScheduleBackfill(value) {
|
|
31
41
|
if (value === void 0)
|
|
32
42
|
return;
|
|
@@ -51,7 +61,25 @@ function formatJitterValidationMessage(message) {
|
|
|
51
61
|
const enginePrefix = "Invalid options.jitter: ", hasEnginePrefix = message.startsWith(enginePrefix), wireDetail = (hasEnginePrefix ? message.slice(enginePrefix.length) : message).replaceAll("options.jitter", 'Field "jitter"');
|
|
52
62
|
return hasEnginePrefix ? `Field "jitter" is invalid: ${wireDetail}` : wireDetail;
|
|
53
63
|
}
|
|
64
|
+
function mapRevisionUnavailableToFault(error) {
|
|
65
|
+
if (!(error instanceof WorkflowRevisionUnavailableError))
|
|
66
|
+
return;
|
|
67
|
+
return {
|
|
68
|
+
code: "Conflict",
|
|
69
|
+
message: error.message,
|
|
70
|
+
data: { reason: error.reason }
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function isScheduleConflictMessage(normalizedMessage) {
|
|
74
|
+
return normalizedMessage.includes("already exists") || normalizedMessage.includes("cannot be resumed");
|
|
75
|
+
}
|
|
76
|
+
function isScheduleInvalidParamsMessage(message, normalizedMessage) {
|
|
77
|
+
return message.includes("Missing required field") || normalizedMessage.includes("must be") || normalizedMessage.includes("no workflow registered") || normalizedMessage.includes("cron") || normalizedMessage.includes("interval");
|
|
78
|
+
}
|
|
54
79
|
export function mapScheduleErrorToFault(scheduleId, error) {
|
|
80
|
+
const revisionFault = mapRevisionUnavailableToFault(error);
|
|
81
|
+
if (revisionFault !== void 0)
|
|
82
|
+
return revisionFault;
|
|
55
83
|
const message = error instanceof Error ? error.message : String(error), normalizedMessage = message.toLowerCase();
|
|
56
84
|
if (normalizedMessage.includes("not found"))
|
|
57
85
|
return {
|
|
@@ -59,13 +87,13 @@ export function mapScheduleErrorToFault(scheduleId, error) {
|
|
|
59
87
|
message,
|
|
60
88
|
data: { resource: "schedule", identifier: scheduleId }
|
|
61
89
|
};
|
|
62
|
-
if (
|
|
90
|
+
if (isScheduleConflictMessage(normalizedMessage))
|
|
63
91
|
return {
|
|
64
92
|
code: "Conflict",
|
|
65
93
|
message,
|
|
66
94
|
data: { reason: message }
|
|
67
95
|
};
|
|
68
|
-
if (message
|
|
96
|
+
if (isScheduleInvalidParamsMessage(message, normalizedMessage))
|
|
69
97
|
return {
|
|
70
98
|
code: "InvalidParams",
|
|
71
99
|
message,
|
|
@@ -6,6 +6,7 @@ export type SharedScheduleRestFields = {
|
|
|
6
6
|
readonly overlap: unknown;
|
|
7
7
|
readonly backfill: unknown;
|
|
8
8
|
readonly jitter: unknown;
|
|
9
|
+
readonly revisionPolicy: unknown;
|
|
9
10
|
};
|
|
10
11
|
export declare function parseScheduleRestBodyRequestRecord(request: Request, context?: RestInputContext): Promise<Record<string, unknown>>;
|
|
11
12
|
export declare function extractSharedScheduleRestFields(record: Record<string, unknown>): SharedScheduleRestFields;
|
|
@@ -103,7 +103,7 @@ export const startOrSignalWorkflowOperation = defineOperation({
|
|
|
103
103
|
const { handle, outcome } = await typedEngine.startOrSignal(type, input.input, signal, options);
|
|
104
104
|
return { id: handle.id, outcome };
|
|
105
105
|
} catch (error) {
|
|
106
|
-
resolveStartOrSignalWorkflowFault(error);
|
|
106
|
+
return resolveStartOrSignalWorkflowFault(error);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}), startOrSignalWorkflowRestBinding = {
|
|
@@ -77,7 +77,7 @@ export const startWorkflowOperation = defineOperation({
|
|
|
77
77
|
try {
|
|
78
78
|
return { id: (await typedEngine.start(type, input.input, options)).id };
|
|
79
79
|
} catch (error) {
|
|
80
|
-
resolveStartWorkflowAccess(error);
|
|
80
|
+
return resolveStartWorkflowAccess(error);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}), startWorkflowRestBinding = {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
activateWorkflowRevisionOperation,
|
|
3
|
+
activateWorkflowRevisionRestBinding
|
|
4
|
+
} from "./activate-workflow-revision.js";
|
|
1
5
|
import { addWorkflowTagsOperation, addWorkflowTagsRestBinding } from "./add-workflow-tags.js";
|
|
2
6
|
import {
|
|
3
7
|
aggregateWorkflowsOperation,
|
|
@@ -30,6 +34,14 @@ import { createScheduleOperation, createScheduleRestBinding } from "./create-sch
|
|
|
30
34
|
import { fleetEventsSseOperation, fleetEventsSseRestBinding } from "./fleet-events-sse.js";
|
|
31
35
|
import { fleetEventsSubscriptionOperation } from "./fleet-events-subscription.js";
|
|
32
36
|
import { forkWorkflowOperation, forkWorkflowRestBinding } from "./fork-workflow.js";
|
|
37
|
+
import {
|
|
38
|
+
getActiveWorkflowRevisionOperation,
|
|
39
|
+
getActiveWorkflowRevisionRestBinding
|
|
40
|
+
} from "./get-active-workflow-revision.js";
|
|
41
|
+
import {
|
|
42
|
+
getCatalogDiagnosticsOperation,
|
|
43
|
+
getCatalogDiagnosticsRestBinding
|
|
44
|
+
} from "./get-catalog-diagnostics.js";
|
|
33
45
|
import { getCheckpointAtOperation, getCheckpointAtRestBinding } from "./get-checkpoint-at.js";
|
|
34
46
|
import { getPrincipalOperation, getPrincipalRestBinding } from "./get-principal.js";
|
|
35
47
|
import { getRegistryOperation, getRegistryRestBinding } from "./get-registry.js";
|
|
@@ -55,17 +67,33 @@ import {
|
|
|
55
67
|
import { getWorkflowEventsOperation, getWorkflowEventsRestBinding } from "./get-workflow-events.js";
|
|
56
68
|
import * as workflowObservability from "./get-workflow-observability.js";
|
|
57
69
|
import { getWorkflowResultOperation, getWorkflowResultRestBinding } from "./get-workflow-result.js";
|
|
70
|
+
import {
|
|
71
|
+
getWorkflowRevisionOperation,
|
|
72
|
+
getWorkflowRevisionRestBinding
|
|
73
|
+
} from "./get-workflow-revision.js";
|
|
58
74
|
import {
|
|
59
75
|
getWorkflowTimelineOperation,
|
|
60
76
|
getWorkflowTimelineRestBinding
|
|
61
77
|
} from "./get-workflow-timeline.js";
|
|
62
78
|
import { getWorkflowOperation, getWorkflowRestBinding } from "./get-workflow.js";
|
|
79
|
+
import {
|
|
80
|
+
installWorkflowRevisionOperation,
|
|
81
|
+
installWorkflowRevisionRestBinding
|
|
82
|
+
} from "./install-workflow-revision.js";
|
|
63
83
|
import { listAlertsOperation, listAlertsRestBinding } from "./list-alerts.js";
|
|
64
84
|
import { listCheckpointsOperation, listCheckpointsRestBinding } from "./list-checkpoints.js";
|
|
65
85
|
import { listReviewsOperation, listReviewsRestBinding } from "./list-reviews.js";
|
|
66
86
|
import { listSchedulesOperation, listSchedulesRestBinding } from "./list-schedules.js";
|
|
87
|
+
import {
|
|
88
|
+
listWorkflowRevisionsOperation,
|
|
89
|
+
listWorkflowRevisionsRestBinding
|
|
90
|
+
} from "./list-workflow-revisions.js";
|
|
67
91
|
import { listWorkflowsOperation, listWorkflowsRestBinding } from "./list-workflows.js";
|
|
68
92
|
import { pauseScheduleOperation, pauseScheduleRestBinding } from "./pause-schedule.js";
|
|
93
|
+
import {
|
|
94
|
+
preloadWorkflowRevisionOperation,
|
|
95
|
+
preloadWorkflowRevisionRestBinding
|
|
96
|
+
} from "./preload-workflow-revision.js";
|
|
69
97
|
import { purgeWorkflowsOperation, purgeWorkflowsRestBinding } from "./purge-workflows.js";
|
|
70
98
|
import {
|
|
71
99
|
queryWorkflowOperation,
|
|
@@ -130,6 +158,7 @@ export const STATIC_REST_BINDINGS = [
|
|
|
130
158
|
bulkRetryFailedWorkflowsRestBinding,
|
|
131
159
|
bulkDeleteWorkflowsRestBinding,
|
|
132
160
|
bulkMutateWorkflowTagsRestBinding,
|
|
161
|
+
getCatalogDiagnosticsRestBinding,
|
|
133
162
|
getWorkflowRestBinding,
|
|
134
163
|
cancelWorkflowRestBinding,
|
|
135
164
|
getWorkflowResultRestBinding,
|
|
@@ -151,6 +180,12 @@ export const STATIC_REST_BINDINGS = [
|
|
|
151
180
|
createScheduleRestBinding,
|
|
152
181
|
updateScheduleRestBinding,
|
|
153
182
|
getRegistryRestBinding,
|
|
183
|
+
installWorkflowRevisionRestBinding,
|
|
184
|
+
activateWorkflowRevisionRestBinding,
|
|
185
|
+
preloadWorkflowRevisionRestBinding,
|
|
186
|
+
getWorkflowRevisionRestBinding,
|
|
187
|
+
listWorkflowRevisionsRestBinding,
|
|
188
|
+
getActiveWorkflowRevisionRestBinding,
|
|
154
189
|
getSystemLeaseRestBinding,
|
|
155
190
|
getRetentionOverviewRestBinding,
|
|
156
191
|
getUpdateResultRestBinding,
|
|
@@ -194,6 +229,7 @@ export const STATIC_REST_BINDINGS = [
|
|
|
194
229
|
bulkRetryFailedWorkflowsOperation,
|
|
195
230
|
bulkDeleteWorkflowsOperation,
|
|
196
231
|
bulkMutateWorkflowTagsOperation,
|
|
232
|
+
getCatalogDiagnosticsOperation,
|
|
197
233
|
getWorkflowOperation,
|
|
198
234
|
cancelWorkflowOperation,
|
|
199
235
|
getWorkflowResultOperation,
|
|
@@ -214,6 +250,12 @@ export const STATIC_REST_BINDINGS = [
|
|
|
214
250
|
createScheduleOperation,
|
|
215
251
|
updateScheduleOperation,
|
|
216
252
|
getRegistryOperation,
|
|
253
|
+
installWorkflowRevisionOperation,
|
|
254
|
+
activateWorkflowRevisionOperation,
|
|
255
|
+
preloadWorkflowRevisionOperation,
|
|
256
|
+
getWorkflowRevisionOperation,
|
|
257
|
+
listWorkflowRevisionsOperation,
|
|
258
|
+
getActiveWorkflowRevisionOperation,
|
|
217
259
|
getSystemLeaseOperation,
|
|
218
260
|
getRetentionOverviewOperation,
|
|
219
261
|
getUpdateResultOperation,
|
|
@@ -42,14 +42,14 @@ const rawStorageAccess = {
|
|
|
42
42
|
}), emptyOutput = z.null(), storageGetOutput = binaryValueSchema.nullable(), storageScanOutput = z.custom((value) => typeof value === "object" && value !== null && (Symbol.asyncIterator in value) && typeof value[Symbol.asyncIterator] === "function", "Storage scan output must be an async iterable."), storageConditionalBatchOutput = z.object({ applied: z.boolean() });
|
|
43
43
|
function resolveAuthorizedStorage(engine, principal, operation) {
|
|
44
44
|
if (!isAuthenticated(principal))
|
|
45
|
-
raiseFault(operation, {
|
|
45
|
+
return raiseFault(operation, {
|
|
46
46
|
code: "Unauthorized",
|
|
47
47
|
message: "authentication required",
|
|
48
48
|
data: { reason: "authentication required" }
|
|
49
49
|
});
|
|
50
50
|
if (principal.hasScope("storage:admin"))
|
|
51
51
|
return engine.storage;
|
|
52
|
-
raiseFault(operation, {
|
|
52
|
+
return raiseFault(operation, {
|
|
53
53
|
code: "Forbidden",
|
|
54
54
|
message: "Raw storage access requires storage:admin.",
|
|
55
55
|
data: { reason: "Raw storage access requires storage:admin." }
|
|
@@ -89,7 +89,7 @@ export const submitReviewDecisionOperation = defineOperation({
|
|
|
89
89
|
await e.submitReview(input.reviewId, reviewOptions);
|
|
90
90
|
return { ok: !0 };
|
|
91
91
|
} catch (error) {
|
|
92
|
-
mapReviewDecisionError(error, input.reviewId);
|
|
92
|
+
return mapReviewDecisionError(error, input.reviewId);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}), submitReviewDecisionRestBinding = {
|
|
@@ -8,6 +8,7 @@ declare const updateScheduleInput: z.ZodObject<{
|
|
|
8
8
|
overlap: z.ZodOptional<z.ZodUnknown>;
|
|
9
9
|
backfill: z.ZodOptional<z.ZodUnknown>;
|
|
10
10
|
jitter: z.ZodOptional<z.ZodUnknown>;
|
|
11
|
+
revisionPolicy: z.ZodOptional<z.ZodUnknown>;
|
|
11
12
|
}, z.core.$strip>;
|
|
12
13
|
export type UpdateScheduleInput = z.infer<typeof updateScheduleInput>;
|
|
13
14
|
export declare const updateScheduleOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
@@ -18,6 +19,7 @@ export declare const updateScheduleOperation: import("../operation-catalog.ts").
|
|
|
18
19
|
overlap?: unknown;
|
|
19
20
|
backfill?: unknown;
|
|
20
21
|
jitter?: unknown;
|
|
22
|
+
revisionPolicy?: unknown;
|
|
21
23
|
}, null, unknown>;
|
|
22
24
|
export declare const updateScheduleRestBinding: UnknownRestBinding;
|
|
23
25
|
export {};
|
|
@@ -16,7 +16,8 @@ const updateScheduleInput = z.object({
|
|
|
16
16
|
description: z.unknown().optional().describe("Operator-facing schedule description. Runtime validation requires a string."),
|
|
17
17
|
overlap: z.unknown().optional(),
|
|
18
18
|
backfill: z.unknown().optional(),
|
|
19
|
-
jitter: z.unknown().optional()
|
|
19
|
+
jitter: z.unknown().optional(),
|
|
20
|
+
revisionPolicy: z.unknown().optional().describe('Revision policy (WFT-20). Runtime validation requires "active-at-fire" or "pinned". Omitted preserves the current policy (and pin); "pinned" always re-resolves and re-captures the pin against the revision active right now.')
|
|
20
21
|
});
|
|
21
22
|
export const updateScheduleOperation = defineOperation({
|
|
22
23
|
name: "weft.schedules.update",
|
|
@@ -52,7 +53,8 @@ export const updateScheduleOperation = defineOperation({
|
|
|
52
53
|
description: { kind: "body-field", bodyField: "description" },
|
|
53
54
|
overlap: { kind: "body-field", bodyField: "overlap" },
|
|
54
55
|
backfill: { kind: "body-field", bodyField: "backfill" },
|
|
55
|
-
jitter: { kind: "body-field", bodyField: "jitter" }
|
|
56
|
+
jitter: { kind: "body-field", bodyField: "jitter" },
|
|
57
|
+
revisionPolicy: { kind: "body-field", bodyField: "revisionPolicy" }
|
|
56
58
|
},
|
|
57
59
|
extractInput: async (request, pathParams, context) => {
|
|
58
60
|
const record = await parseScheduleRestBodyRequestRecord(request, context);
|