@shipfox/api-workflows 2.0.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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +311 -0
- package/LICENSE +21 -0
- package/dist/core/agent-tool-capability-warning.d.ts +7 -0
- package/dist/core/agent-tool-capability-warning.d.ts.map +1 -0
- package/dist/core/agent-tool-capability-warning.js +149 -0
- package/dist/core/agent-tool-capability-warning.js.map +1 -0
- package/dist/core/agent-tools.d.ts +51 -0
- package/dist/core/agent-tools.d.ts.map +1 -0
- package/dist/core/agent-tools.js +296 -0
- package/dist/core/agent-tools.js.map +1 -0
- package/dist/core/checkout.d.ts +29 -0
- package/dist/core/checkout.d.ts.map +1 -0
- package/dist/core/checkout.js +42 -0
- package/dist/core/checkout.js.map +1 -0
- package/dist/core/condition-trace.d.ts +13 -0
- package/dist/core/condition-trace.d.ts.map +1 -0
- package/dist/core/condition-trace.js +51 -0
- package/dist/core/condition-trace.js.map +1 -0
- package/dist/core/entities/index.d.ts +5 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +3 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/entities/job-execution.d.ts +30 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -0
- package/dist/core/entities/job-execution.js +3 -0
- package/dist/core/entities/job-execution.js.map +1 -0
- package/dist/core/entities/job-listener-event.d.ts +15 -0
- package/dist/core/entities/job-listener-event.d.ts.map +1 -0
- package/dist/core/entities/job-listener-event.js +3 -0
- package/dist/core/entities/job-listener-event.js.map +1 -0
- package/dist/core/entities/job.d.ts +54 -0
- package/dist/core/entities/job.d.ts.map +1 -0
- package/dist/core/entities/job.js +29 -0
- package/dist/core/entities/job.js.map +1 -0
- package/dist/core/entities/step.d.ts +86 -0
- package/dist/core/entities/step.d.ts.map +1 -0
- package/dist/core/entities/step.js +12 -0
- package/dist/core/entities/step.js.map +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts +20 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
- package/dist/core/entities/workflow-run-attempt.js +3 -0
- package/dist/core/entities/workflow-run-attempt.js.map +1 -0
- package/dist/core/entities/workflow-run.d.ts +66 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -0
- package/dist/core/entities/workflow-run.js +10 -0
- package/dist/core/entities/workflow-run.js.map +1 -0
- package/dist/core/errors.d.ts +85 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +134 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/job-execution-outcome.d.ts +29 -0
- package/dist/core/job-execution-outcome.d.ts.map +1 -0
- package/dist/core/job-execution-outcome.js +31 -0
- package/dist/core/job-execution-outcome.js.map +1 -0
- package/dist/core/job-execution.d.ts +37 -0
- package/dist/core/job-execution.d.ts.map +1 -0
- package/dist/core/job-execution.js +425 -0
- package/dist/core/job-execution.js.map +1 -0
- package/dist/core/job-transition/decide-job-activation.d.ts +29 -0
- package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -0
- package/dist/core/job-transition/decide-job-activation.js +51 -0
- package/dist/core/job-transition/decide-job-activation.js.map +1 -0
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts +18 -0
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts.map +1 -0
- package/dist/core/job-transition/derive-job-execution-outputs.js +23 -0
- package/dist/core/job-transition/derive-job-execution-outputs.js.map +1 -0
- package/dist/core/job-transition/derive-job-success.d.ts +16 -0
- package/dist/core/job-transition/derive-job-success.d.ts.map +1 -0
- package/dist/core/job-transition/derive-job-success.js +47 -0
- package/dist/core/job-transition/derive-job-success.js.map +1 -0
- package/dist/core/job-transition/index.d.ts +5 -0
- package/dist/core/job-transition/index.d.ts.map +1 -0
- package/dist/core/job-transition/index.js +6 -0
- package/dist/core/job-transition/index.js.map +1 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.d.ts +4 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.d.ts.map +1 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.js +8 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.js.map +1 -0
- package/dist/core/listener-execution-materialization.d.ts +30 -0
- package/dist/core/listener-execution-materialization.d.ts.map +1 -0
- package/dist/core/listener-execution-materialization.js +87 -0
- package/dist/core/listener-execution-materialization.js.map +1 -0
- package/dist/core/run-workflow.d.ts +11 -0
- package/dist/core/run-workflow.d.ts.map +1 -0
- package/dist/core/run-workflow.js +28 -0
- package/dist/core/run-workflow.js.map +1 -0
- package/dist/core/source-control.d.ts +5 -0
- package/dist/core/source-control.d.ts.map +1 -0
- package/dist/core/source-control.js +19 -0
- package/dist/core/source-control.js.map +1 -0
- package/dist/core/step-config/agent.d.ts +49 -0
- package/dist/core/step-config/agent.d.ts.map +1 -0
- package/dist/core/step-config/agent.js +337 -0
- package/dist/core/step-config/agent.js.map +1 -0
- package/dist/core/step-config/assemble-run-context.d.ts +94 -0
- package/dist/core/step-config/assemble-run-context.d.ts.map +1 -0
- package/dist/core/step-config/assemble-run-context.js +393 -0
- package/dist/core/step-config/assemble-run-context.js.map +1 -0
- package/dist/core/step-config/complete-step-dispatch-config.d.ts +13 -0
- package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -0
- package/dist/core/step-config/complete-step-dispatch-config.js +38 -0
- package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -0
- package/dist/core/step-config/fields.d.ts +38 -0
- package/dist/core/step-config/fields.d.ts.map +1 -0
- package/dist/core/step-config/fields.js +72 -0
- package/dist/core/step-config/fields.js.map +1 -0
- package/dist/core/step-config/index.d.ts +8 -0
- package/dist/core/step-config/index.d.ts.map +1 -0
- package/dist/core/step-config/index.js +7 -0
- package/dist/core/step-config/index.js.map +1 -0
- package/dist/core/step-config/materialize-job-execution-steps.d.ts +35 -0
- package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -0
- package/dist/core/step-config/materialize-job-execution-steps.js +92 -0
- package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -0
- package/dist/core/step-config/materialize-workflow-model.d.ts +42 -0
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -0
- package/dist/core/step-config/materialize-workflow-model.js +96 -0
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -0
- package/dist/core/step-config/resolve-job-execution-name.d.ts +18 -0
- package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -0
- package/dist/core/step-config/resolve-job-execution-name.js +36 -0
- package/dist/core/step-config/resolve-job-execution-name.js.map +1 -0
- package/dist/core/step-config/resolve-step-config.d.ts +33 -0
- package/dist/core/step-config/resolve-step-config.d.ts.map +1 -0
- package/dist/core/step-config/resolve-step-config.js +164 -0
- package/dist/core/step-config/resolve-step-config.js.map +1 -0
- package/dist/core/step-config/run.d.ts +39 -0
- package/dist/core/step-config/run.d.ts.map +1 -0
- package/dist/core/step-config/run.js +360 -0
- package/dist/core/step-config/run.js.map +1 -0
- package/dist/core/step-config/workflow-evaluation-context.d.ts +6 -0
- package/dist/core/step-config/workflow-evaluation-context.d.ts.map +1 -0
- package/dist/core/step-config/workflow-evaluation-context.js +3 -0
- package/dist/core/step-config/workflow-evaluation-context.js.map +1 -0
- package/dist/core/step-transition/apply-step-transition.d.ts +26 -0
- package/dist/core/step-transition/apply-step-transition.d.ts.map +1 -0
- package/dist/core/step-transition/apply-step-transition.js +141 -0
- package/dist/core/step-transition/apply-step-transition.js.map +1 -0
- package/dist/core/step-transition/decide-step-transition.d.ts +71 -0
- package/dist/core/step-transition/decide-step-transition.d.ts.map +1 -0
- package/dist/core/step-transition/decide-step-transition.js +110 -0
- package/dist/core/step-transition/decide-step-transition.js.map +1 -0
- package/dist/core/step-transition/evaluate-gate.d.ts +28 -0
- package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -0
- package/dist/core/step-transition/evaluate-gate.js +159 -0
- package/dist/core/step-transition/evaluate-gate.js.map +1 -0
- package/dist/core/step-transition/read-step-outputs.d.ts +3 -0
- package/dist/core/step-transition/read-step-outputs.d.ts.map +1 -0
- package/dist/core/step-transition/read-step-outputs.js +24 -0
- package/dist/core/step-transition/read-step-outputs.js.map +1 -0
- package/dist/core/workflow-run-creation.d.ts +43 -0
- package/dist/core/workflow-run-creation.d.ts.map +1 -0
- package/dist/core/workflow-run-creation.js +80 -0
- package/dist/core/workflow-run-creation.js.map +1 -0
- package/dist/core/workflow-scheduling/index.d.ts +5 -0
- package/dist/core/workflow-scheduling/index.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/index.js +4 -0
- package/dist/core/workflow-scheduling/index.js.map +1 -0
- package/dist/core/workflow-scheduling/run-progress.d.ts +20 -0
- package/dist/core/workflow-scheduling/run-progress.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/run-progress.js +40 -0
- package/dist/core/workflow-scheduling/run-progress.js.map +1 -0
- package/dist/core/workflow-scheduling/runtime-dag.d.ts +10 -0
- package/dist/core/workflow-scheduling/runtime-dag.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/runtime-dag.js +3 -0
- package/dist/core/workflow-scheduling/runtime-dag.js.map +1 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts +16 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.js +3 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.js.map +1 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts +9 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.js +72 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.js.map +1 -0
- package/dist/db/db.d.ts +4959 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +37 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/index.d.ts +9 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/job-listener-events.d.ts +18 -0
- package/dist/db/job-listener-events.d.ts.map +1 -0
- package/dist/db/job-listener-events.js +59 -0
- package/dist/db/job-listener-events.js.map +1 -0
- package/dist/db/job-listeners.d.ts +55 -0
- package/dist/db/job-listeners.d.ts.map +1 -0
- package/dist/db/job-listeners.js +358 -0
- package/dist/db/job-listeners.js.map +1 -0
- package/dist/db/outbox-writes.d.ts +12 -0
- package/dist/db/outbox-writes.d.ts.map +1 -0
- package/dist/db/outbox-writes.js +20 -0
- package/dist/db/outbox-writes.js.map +1 -0
- package/dist/db/runner-lease-table.d.ts +469 -0
- package/dist/db/runner-lease-table.d.ts.map +1 -0
- package/dist/db/runner-lease-table.js +42 -0
- package/dist/db/runner-lease-table.js.map +1 -0
- package/dist/db/schema/common.d.ts +2 -0
- package/dist/db/schema/common.d.ts.map +1 -0
- package/dist/db/schema/common.js +4 -0
- package/dist/db/schema/common.js.map +1 -0
- package/dist/db/schema/job-executions.d.ts +311 -0
- package/dist/db/schema/job-executions.d.ts.map +1 -0
- package/dist/db/schema/job-executions.js +76 -0
- package/dist/db/schema/job-executions.js.map +1 -0
- package/dist/db/schema/job-listener-events.d.ts +200 -0
- package/dist/db/schema/job-listener-events.d.ts.map +1 -0
- package/dist/db/schema/job-listener-events.js +50 -0
- package/dist/db/schema/job-listener-events.js.map +1 -0
- package/dist/db/schema/jobs.d.ts +542 -0
- package/dist/db/schema/jobs.d.ts.map +1 -0
- package/dist/db/schema/jobs.js +121 -0
- package/dist/db/schema/jobs.js.map +1 -0
- package/dist/db/schema/outbox.d.ts +195 -0
- package/dist/db/schema/outbox.d.ts.map +1 -0
- package/dist/db/schema/outbox.js +5 -0
- package/dist/db/schema/outbox.js.map +1 -0
- package/dist/db/schema/step-attempts.d.ts +330 -0
- package/dist/db/schema/step-attempts.d.ts.map +1 -0
- package/dist/db/schema/step-attempts.js +80 -0
- package/dist/db/schema/step-attempts.js.map +1 -0
- package/dist/db/schema/steps.d.ts +352 -0
- package/dist/db/schema/steps.d.ts.map +1 -0
- package/dist/db/schema/steps.js +80 -0
- package/dist/db/schema/steps.js.map +1 -0
- package/dist/db/schema/workflow-run-attempts.d.ts +239 -0
- package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -0
- package/dist/db/schema/workflow-run-attempts.js +53 -0
- package/dist/db/schema/workflow-run-attempts.js.map +1 -0
- package/dist/db/schema/workflow-runs.d.ts +360 -0
- package/dist/db/schema/workflow-runs.d.ts.map +1 -0
- package/dist/db/schema/workflow-runs.js +85 -0
- package/dist/db/schema/workflow-runs.js.map +1 -0
- package/dist/db/workflow-runs/job-executions.d.ts +49 -0
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -0
- package/dist/db/workflow-runs/job-executions.js +271 -0
- package/dist/db/workflow-runs/job-executions.js.map +1 -0
- package/dist/db/workflow-runs/jobs.d.ts +60 -0
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -0
- package/dist/db/workflow-runs/jobs.js +288 -0
- package/dist/db/workflow-runs/jobs.js.map +1 -0
- package/dist/db/workflow-runs/outbox.d.ts +20 -0
- package/dist/db/workflow-runs/outbox.d.ts.map +1 -0
- package/dist/db/workflow-runs/outbox.js +68 -0
- package/dist/db/workflow-runs/outbox.js.map +1 -0
- package/dist/db/workflow-runs/queries.d.ts +71 -0
- package/dist/db/workflow-runs/queries.d.ts.map +1 -0
- package/dist/db/workflow-runs/queries.js +253 -0
- package/dist/db/workflow-runs/queries.js.map +1 -0
- package/dist/db/workflow-runs/run-create.d.ts +32 -0
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-create.js +288 -0
- package/dist/db/workflow-runs/run-create.js.map +1 -0
- package/dist/db/workflow-runs/run-graph.d.ts +27 -0
- package/dist/db/workflow-runs/run-graph.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-graph.js +63 -0
- package/dist/db/workflow-runs/run-graph.js.map +1 -0
- package/dist/db/workflow-runs/run-rerun.d.ts +8 -0
- package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-rerun.js +207 -0
- package/dist/db/workflow-runs/run-rerun.js.map +1 -0
- package/dist/db/workflow-runs/run-status.d.ts +24 -0
- package/dist/db/workflow-runs/run-status.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-status.js +249 -0
- package/dist/db/workflow-runs/run-status.js.map +1 -0
- package/dist/db/workflow-runs/runs.d.ts +7 -0
- package/dist/db/workflow-runs/runs.d.ts.map +1 -0
- package/dist/db/workflow-runs/runs.js +5 -0
- package/dist/db/workflow-runs/runs.js.map +1 -0
- package/dist/db/workflow-runs/shared.d.ts +24 -0
- package/dist/db/workflow-runs/shared.d.ts.map +1 -0
- package/dist/db/workflow-runs/shared.js +50 -0
- package/dist/db/workflow-runs/shared.js.map +1 -0
- package/dist/db/workflow-runs/steps.d.ts +83 -0
- package/dist/db/workflow-runs/steps.d.ts.map +1 -0
- package/dist/db/workflow-runs/steps.js +246 -0
- package/dist/db/workflow-runs/steps.js.map +1 -0
- package/dist/db/workflow-runs.d.ts +12 -0
- package/dist/db/workflow-runs.d.ts.map +1 -0
- package/dist/db/workflow-runs.js +8 -0
- package/dist/db/workflow-runs.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +3 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/instance.d.ts +20 -0
- package/dist/metrics/instance.d.ts.map +1 -0
- package/dist/metrics/instance.js +127 -0
- package/dist/metrics/instance.js.map +1 -0
- package/dist/metrics/service.d.ts +2 -0
- package/dist/metrics/service.d.ts.map +1 -0
- package/dist/metrics/service.js +30 -0
- package/dist/metrics/service.js.map +1 -0
- package/dist/presentation/dto/checkout-token.d.ts +6 -0
- package/dist/presentation/dto/checkout-token.d.ts.map +1 -0
- package/dist/presentation/dto/checkout-token.js +74 -0
- package/dist/presentation/dto/checkout-token.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +4 -0
- package/dist/presentation/dto/index.d.ts.map +1 -0
- package/dist/presentation/dto/index.js +5 -0
- package/dist/presentation/dto/index.js.map +1 -0
- package/dist/presentation/dto/job.d.ts +6 -0
- package/dist/presentation/dto/job.d.ts.map +1 -0
- package/dist/presentation/dto/job.js +59 -0
- package/dist/presentation/dto/job.js.map +1 -0
- package/dist/presentation/dto/step.d.ts +6 -0
- package/dist/presentation/dto/step.d.ts.map +1 -0
- package/dist/presentation/dto/step.js +162 -0
- package/dist/presentation/dto/step.js.map +1 -0
- package/dist/presentation/dto/workflow-run.d.ts +6 -0
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -0
- package/dist/presentation/dto/workflow-run.js +35 -0
- package/dist/presentation/dto/workflow-run.js.map +1 -0
- package/dist/presentation/index.d.ts +3 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +4 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/routes/agent-runtime-config.d.ts +2 -0
- package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -0
- package/dist/presentation/routes/agent-runtime-config.js +71 -0
- package/dist/presentation/routes/agent-runtime-config.js.map +1 -0
- package/dist/presentation/routes/cancel-run.d.ts +2 -0
- package/dist/presentation/routes/cancel-run.d.ts.map +1 -0
- package/dist/presentation/routes/cancel-run.js +46 -0
- package/dist/presentation/routes/cancel-run.js.map +1 -0
- package/dist/presentation/routes/checkout-token.d.ts +2 -0
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -0
- package/dist/presentation/routes/checkout-token.js +64 -0
- package/dist/presentation/routes/checkout-token.js.map +1 -0
- package/dist/presentation/routes/get-run-aggregates.d.ts +2 -0
- package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -0
- package/dist/presentation/routes/get-run-aggregates.js +60 -0
- package/dist/presentation/routes/get-run-aggregates.js.map +1 -0
- package/dist/presentation/routes/get-run.d.ts +2 -0
- package/dist/presentation/routes/get-run.d.ts.map +1 -0
- package/dist/presentation/routes/get-run.js +60 -0
- package/dist/presentation/routes/get-run.js.map +1 -0
- package/dist/presentation/routes/get-step-secrets.d.ts +2 -0
- package/dist/presentation/routes/get-step-secrets.d.ts.map +1 -0
- package/dist/presentation/routes/get-step-secrets.js +115 -0
- package/dist/presentation/routes/get-step-secrets.js.map +1 -0
- package/dist/presentation/routes/index.d.ts +4 -0
- package/dist/presentation/routes/index.d.ts.map +1 -0
- package/dist/presentation/routes/index.js +41 -0
- package/dist/presentation/routes/index.js.map +1 -0
- package/dist/presentation/routes/leased-step.d.ts +14 -0
- package/dist/presentation/routes/leased-step.d.ts.map +1 -0
- package/dist/presentation/routes/leased-step.js +50 -0
- package/dist/presentation/routes/leased-step.js.map +1 -0
- package/dist/presentation/routes/list-run-attempts.d.ts +2 -0
- package/dist/presentation/routes/list-run-attempts.d.ts.map +1 -0
- package/dist/presentation/routes/list-run-attempts.js +35 -0
- package/dist/presentation/routes/list-run-attempts.js.map +1 -0
- package/dist/presentation/routes/list-runs.d.ts +2 -0
- package/dist/presentation/routes/list-runs.d.ts.map +1 -0
- package/dist/presentation/routes/list-runs.js +70 -0
- package/dist/presentation/routes/list-runs.js.map +1 -0
- package/dist/presentation/routes/next-step.d.ts +2 -0
- package/dist/presentation/routes/next-step.d.ts.map +1 -0
- package/dist/presentation/routes/next-step.js +65 -0
- package/dist/presentation/routes/next-step.js.map +1 -0
- package/dist/presentation/routes/report-step.d.ts +2 -0
- package/dist/presentation/routes/report-step.d.ts.map +1 -0
- package/dist/presentation/routes/report-step.js +73 -0
- package/dist/presentation/routes/report-step.js.map +1 -0
- package/dist/presentation/routes/require-accessible-run.d.ts +7 -0
- package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -0
- package/dist/presentation/routes/require-accessible-run.js +25 -0
- package/dist/presentation/routes/require-accessible-run.js.map +1 -0
- package/dist/presentation/routes/rerun-run.d.ts +2 -0
- package/dist/presentation/routes/rerun-run.d.ts.map +1 -0
- package/dist/presentation/routes/rerun-run.js +56 -0
- package/dist/presentation/routes/rerun-run.js.map +1 -0
- package/dist/presentation/subscribers/index.d.ts +8 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -0
- package/dist/presentation/subscribers/index.js +9 -0
- package/dist/presentation/subscribers/index.js.map +1 -0
- package/dist/presentation/subscribers/on-job-event-delivered.d.ts +3 -0
- package/dist/presentation/subscribers/on-job-event-delivered.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-job-event-delivered.js +24 -0
- package/dist/presentation/subscribers/on-job-event-delivered.js.map +1 -0
- package/dist/presentation/subscribers/on-job-steps-settled.d.ts +3 -0
- package/dist/presentation/subscribers/on-job-steps-settled.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-job-steps-settled.js +36 -0
- package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js +20 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.js +35 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-queued.js +20 -0
- package/dist/presentation/subscribers/on-runner-job-queued.js.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts +3 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.js +35 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.js.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts +3 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.js +25 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.js.map +1 -0
- package/dist/temporal/activities/index.d.ts +23 -0
- package/dist/temporal/activities/index.d.ts.map +1 -0
- package/dist/temporal/activities/index.js +26 -0
- package/dist/temporal/activities/index.js.map +1 -0
- package/dist/temporal/activities/orchestration-activities.d.ts +130 -0
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -0
- package/dist/temporal/activities/orchestration-activities.js +188 -0
- package/dist/temporal/activities/orchestration-activities.js.map +1 -0
- package/dist/temporal/constants.d.ts +7 -0
- package/dist/temporal/constants.d.ts.map +1 -0
- package/dist/temporal/constants.js +8 -0
- package/dist/temporal/constants.js.map +1 -0
- package/dist/temporal/index.d.ts +3 -0
- package/dist/temporal/index.d.ts.map +1 -0
- package/dist/temporal/index.js +4 -0
- package/dist/temporal/index.js.map +1 -0
- package/dist/temporal/workflow-not-found.d.ts +2 -0
- package/dist/temporal/workflow-not-found.d.ts.map +1 -0
- package/dist/temporal/workflow-not-found.js +10 -0
- package/dist/temporal/workflow-not-found.js.map +1 -0
- package/dist/temporal/workflows/deadline.d.ts +3 -0
- package/dist/temporal/workflows/deadline.d.ts.map +1 -0
- package/dist/temporal/workflows/deadline.js +8 -0
- package/dist/temporal/workflows/deadline.js.map +1 -0
- package/dist/temporal/workflows/index.d.ts +4 -0
- package/dist/temporal/workflows/index.d.ts.map +1 -0
- package/dist/temporal/workflows/index.js +5 -0
- package/dist/temporal/workflows/index.js.map +1 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts +27 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/job-execution-orchestration.js +265 -0
- package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -0
- package/dist/temporal/workflows/job-listener-orchestration.d.ts +40 -0
- package/dist/temporal/workflows/job-listener-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/job-listener-orchestration.js +332 -0
- package/dist/temporal/workflows/job-listener-orchestration.js.map +1 -0
- package/dist/temporal/workflows/run-orchestration.d.ts +8 -0
- package/dist/temporal/workflows/run-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/run-orchestration.js +243 -0
- package/dist/temporal/workflows/run-orchestration.js.map +1 -0
- package/dist/temporal/workflows/test-env.d.ts +114 -0
- package/dist/temporal/workflows/test-env.d.ts.map +1 -0
- package/dist/temporal/workflows/test-env.js +323 -0
- package/dist/temporal/workflows/test-env.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/drizzle/0000_initial.sql +211 -0
- package/drizzle/0001_agent_tool_materialization.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +1613 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +7 -0
- package/package.json +91 -0
- package/src/core/README.md +79 -0
- package/src/core/agent-tool-capability-warning.test.ts +280 -0
- package/src/core/agent-tool-capability-warning.ts +200 -0
- package/src/core/agent-tools.ts +422 -0
- package/src/core/checkout.test.ts +112 -0
- package/src/core/checkout.ts +63 -0
- package/src/core/condition-trace.ts +64 -0
- package/src/core/entities/index.ts +9 -0
- package/src/core/entities/job-execution.ts +32 -0
- package/src/core/entities/job-listener-event.ts +15 -0
- package/src/core/entities/job.ts +91 -0
- package/src/core/entities/step.ts +126 -0
- package/src/core/entities/workflow-run-attempt.ts +21 -0
- package/src/core/entities/workflow-run.ts +94 -0
- package/src/core/errors.test.ts +45 -0
- package/src/core/errors.ts +209 -0
- package/src/core/index.ts +54 -0
- package/src/core/job-execution-outcome.ts +64 -0
- package/src/core/job-execution.test.ts +1560 -0
- package/src/core/job-execution.ts +581 -0
- package/src/core/job-transition/decide-job-activation.test.ts +196 -0
- package/src/core/job-transition/decide-job-activation.ts +79 -0
- package/src/core/job-transition/derive-job-execution-outputs.ts +41 -0
- package/src/core/job-transition/derive-job-success.test.ts +133 -0
- package/src/core/job-transition/derive-job-success.ts +67 -0
- package/src/core/job-transition/index.ts +11 -0
- package/src/core/job-transition/runtime-completion-status-for-job.ts +14 -0
- package/src/core/listener-execution-materialization.test.ts +49 -0
- package/src/core/listener-execution-materialization.ts +162 -0
- package/src/core/run-workflow.test.ts +229 -0
- package/src/core/run-workflow.ts +41 -0
- package/src/core/source-control.test.ts +17 -0
- package/src/core/source-control.ts +22 -0
- package/src/core/step-config/agent.ts +459 -0
- package/src/core/step-config/assemble-run-context.test.ts +1021 -0
- package/src/core/step-config/assemble-run-context.ts +535 -0
- package/src/core/step-config/complete-step-dispatch-config.test.ts +354 -0
- package/src/core/step-config/complete-step-dispatch-config.ts +40 -0
- package/src/core/step-config/fields.ts +111 -0
- package/src/core/step-config/index.ts +41 -0
- package/src/core/step-config/materialize-job-execution-steps.test.ts +494 -0
- package/src/core/step-config/materialize-job-execution-steps.ts +136 -0
- package/src/core/step-config/materialize-workflow-model.test.ts +1214 -0
- package/src/core/step-config/materialize-workflow-model.ts +140 -0
- package/src/core/step-config/resolve-job-execution-name.test.ts +94 -0
- package/src/core/step-config/resolve-job-execution-name.ts +51 -0
- package/src/core/step-config/resolve-step-config.ts +199 -0
- package/src/core/step-config/run.ts +467 -0
- package/src/core/step-config/workflow-evaluation-context.ts +6 -0
- package/src/core/step-transition/apply-step-transition.ts +163 -0
- package/src/core/step-transition/decide-step-transition.test.ts +307 -0
- package/src/core/step-transition/decide-step-transition.ts +200 -0
- package/src/core/step-transition/evaluate-gate.test.ts +317 -0
- package/src/core/step-transition/evaluate-gate.ts +168 -0
- package/src/core/step-transition/read-step-outputs.ts +27 -0
- package/src/core/workflow-run-creation.test.ts +155 -0
- package/src/core/workflow-run-creation.ts +131 -0
- package/src/core/workflow-scheduling/index.ts +15 -0
- package/src/core/workflow-scheduling/run-progress.test.ts +46 -0
- package/src/core/workflow-scheduling/run-progress.ts +68 -0
- package/src/core/workflow-scheduling/runtime-dag.ts +10 -0
- package/src/core/workflow-scheduling/runtime-scheduling-command.ts +20 -0
- package/src/core/workflow-scheduling/schedule-runtime-dag.test.ts +197 -0
- package/src/core/workflow-scheduling/schedule-runtime-dag.ts +115 -0
- package/src/db/db.ts +40 -0
- package/src/db/index.ts +86 -0
- package/src/db/job-listener-events.test.ts +113 -0
- package/src/db/job-listener-events.ts +73 -0
- package/src/db/job-listeners.test.ts +865 -0
- package/src/db/job-listeners.ts +564 -0
- package/src/db/outbox-writes.ts +40 -0
- package/src/db/rerun-listener.test.ts +64 -0
- package/src/db/run-timeout.test.ts +102 -0
- package/src/db/runner-lease-table.ts +39 -0
- package/src/db/schema/common.ts +3 -0
- package/src/db/schema/job-executions.ts +85 -0
- package/src/db/schema/job-listener-events.ts +58 -0
- package/src/db/schema/jobs.ts +136 -0
- package/src/db/schema/outbox.ts +4 -0
- package/src/db/schema/step-attempts.ts +99 -0
- package/src/db/schema/steps.ts +99 -0
- package/src/db/schema/workflow-run-attempts.ts +59 -0
- package/src/db/schema/workflow-runs.ts +112 -0
- package/src/db/workflow-runs/job-executions.test.ts +99 -0
- package/src/db/workflow-runs/job-executions.ts +421 -0
- package/src/db/workflow-runs/job-status.test.ts +532 -0
- package/src/db/workflow-runs/jobs.test.ts +194 -0
- package/src/db/workflow-runs/jobs.ts +418 -0
- package/src/db/workflow-runs/outbox.ts +109 -0
- package/src/db/workflow-runs/queries.test.ts +256 -0
- package/src/db/workflow-runs/queries.ts +437 -0
- package/src/db/workflow-runs/run-create.test.ts +1281 -0
- package/src/db/workflow-runs/run-create.ts +373 -0
- package/src/db/workflow-runs/run-graph.ts +95 -0
- package/src/db/workflow-runs/run-rerun.test.ts +625 -0
- package/src/db/workflow-runs/run-rerun.ts +266 -0
- package/src/db/workflow-runs/run-status.test.ts +425 -0
- package/src/db/workflow-runs/run-status.ts +391 -0
- package/src/db/workflow-runs/runs.ts +17 -0
- package/src/db/workflow-runs/shared.ts +84 -0
- package/src/db/workflow-runs/steps.test.ts +191 -0
- package/src/db/workflow-runs/steps.ts +476 -0
- package/src/db/workflow-runs.ts +111 -0
- package/src/index.ts +99 -0
- package/src/metrics/index.ts +1 -0
- package/src/metrics/instance.ts +160 -0
- package/src/metrics/service.ts +30 -0
- package/src/presentation/dto/checkout-token.test.ts +107 -0
- package/src/presentation/dto/checkout-token.ts +85 -0
- package/src/presentation/dto/index.ts +3 -0
- package/src/presentation/dto/job.test.ts +108 -0
- package/src/presentation/dto/job.ts +64 -0
- package/src/presentation/dto/step.test.ts +307 -0
- package/src/presentation/dto/step.ts +145 -0
- package/src/presentation/dto/workflow-run.ts +38 -0
- package/src/presentation/index.ts +10 -0
- package/src/presentation/routes/agent-runtime-config.test.ts +478 -0
- package/src/presentation/routes/agent-runtime-config.ts +81 -0
- package/src/presentation/routes/cancel-run.test.ts +156 -0
- package/src/presentation/routes/cancel-run.ts +37 -0
- package/src/presentation/routes/checkout-token.test.ts +366 -0
- package/src/presentation/routes/checkout-token.ts +61 -0
- package/src/presentation/routes/get-run-aggregates.test.ts +114 -0
- package/src/presentation/routes/get-run-aggregates.ts +69 -0
- package/src/presentation/routes/get-run.test.ts +604 -0
- package/src/presentation/routes/get-run.ts +66 -0
- package/src/presentation/routes/get-step-secrets.test.ts +260 -0
- package/src/presentation/routes/get-step-secrets.ts +117 -0
- package/src/presentation/routes/index.test.ts +71 -0
- package/src/presentation/routes/index.ts +42 -0
- package/src/presentation/routes/leased-step.ts +54 -0
- package/src/presentation/routes/list-run-attempts.test.ts +163 -0
- package/src/presentation/routes/list-run-attempts.ts +27 -0
- package/src/presentation/routes/list-runs.test.ts +244 -0
- package/src/presentation/routes/list-runs.ts +83 -0
- package/src/presentation/routes/next-step.test.ts +366 -0
- package/src/presentation/routes/next-step.ts +62 -0
- package/src/presentation/routes/report-step.test.ts +374 -0
- package/src/presentation/routes/report-step.ts +61 -0
- package/src/presentation/routes/require-accessible-run.ts +27 -0
- package/src/presentation/routes/rerun-run.test.ts +202 -0
- package/src/presentation/routes/rerun-run.ts +48 -0
- package/src/presentation/subscribers/index.ts +7 -0
- package/src/presentation/subscribers/on-job-event-delivered.test.ts +71 -0
- package/src/presentation/subscribers/on-job-event-delivered.ts +30 -0
- package/src/presentation/subscribers/on-job-steps-settled.test.ts +75 -0
- package/src/presentation/subscribers/on-job-steps-settled.ts +42 -0
- package/src/presentation/subscribers/on-runner-job-claimed.test.ts +57 -0
- package/src/presentation/subscribers/on-runner-job-claimed.ts +23 -0
- package/src/presentation/subscribers/on-runner-job-lease-expired.test.ts +73 -0
- package/src/presentation/subscribers/on-runner-job-lease-expired.ts +36 -0
- package/src/presentation/subscribers/on-runner-job-queued.test.ts +57 -0
- package/src/presentation/subscribers/on-runner-job-queued.ts +23 -0
- package/src/presentation/subscribers/on-workflow-run-attempt-created.test.ts +69 -0
- package/src/presentation/subscribers/on-workflow-run-attempt-created.ts +40 -0
- package/src/presentation/subscribers/on-workflow-run-cancelled.test.ts +59 -0
- package/src/presentation/subscribers/on-workflow-run-cancelled.ts +29 -0
- package/src/temporal/activities/index.ts +45 -0
- package/src/temporal/activities/orchestration-activities.test.ts +115 -0
- package/src/temporal/activities/orchestration-activities.ts +305 -0
- package/src/temporal/constants.ts +6 -0
- package/src/temporal/index.ts +6 -0
- package/src/temporal/workflow-not-found.ts +9 -0
- package/src/temporal/workflows/deadline.ts +7 -0
- package/src/temporal/workflows/index.ts +11 -0
- package/src/temporal/workflows/job-execution-orchestration-timeout.test.ts +165 -0
- package/src/temporal/workflows/job-execution-orchestration.test.ts +311 -0
- package/src/temporal/workflows/job-execution-orchestration.ts +314 -0
- package/src/temporal/workflows/job-listener-orchestration-continuation.test.ts +93 -0
- package/src/temporal/workflows/job-listener-orchestration.test.ts +406 -0
- package/src/temporal/workflows/job-listener-orchestration.ts +490 -0
- package/src/temporal/workflows/run-orchestration.test.ts +409 -0
- package/src/temporal/workflows/run-orchestration.ts +283 -0
- package/src/temporal/workflows/test-env.ts +409 -0
- package/test/env.ts +11 -0
- package/test/factories/job.ts +83 -0
- package/test/factories/project.ts +16 -0
- package/test/factories/workflow-model.test.ts +26 -0
- package/test/factories/workflow-model.ts +268 -0
- package/test/factories/workflow-run.ts +58 -0
- package/test/fixtures/active-lease-token.ts +85 -0
- package/test/fixtures/job-with-steps.ts +42 -0
- package/test/fixtures/lease-token.ts +44 -0
- package/test/fixtures/strip-setup-step.ts +23 -0
- package/test/globalSetup.ts +54 -0
- package/test/helpers/workflow-runs.ts +210 -0
- package/test/index.ts +3 -0
- package/test/setup.ts +17 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContextRootKeyAccess,
|
|
3
|
+
extractExactContextRoots,
|
|
4
|
+
type WorkflowExpressionEvaluationContext,
|
|
5
|
+
} from '@shipfox/expression';
|
|
6
|
+
import type {Job, JobListeningTrigger} from '#core/entities/job.js';
|
|
7
|
+
import type {JobExecution} from '#core/entities/job-execution.js';
|
|
8
|
+
import type {Step, StepAttempt, StepStatus} from '#core/entities/step.js';
|
|
9
|
+
import type {TriggerPayload, WorkflowRun} from '#core/entities/workflow-run.js';
|
|
10
|
+
import type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';
|
|
11
|
+
|
|
12
|
+
export interface JobContextInput {
|
|
13
|
+
readonly job: Pick<Job, 'key' | 'status' | 'outputs'>;
|
|
14
|
+
readonly executions: readonly JobExecution[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AssembleWorkflowRunContextParams {
|
|
18
|
+
readonly run: Pick<
|
|
19
|
+
WorkflowRun,
|
|
20
|
+
'id' | 'name' | 'definitionId' | 'projectId' | 'workspaceId' | 'createdAt'
|
|
21
|
+
>;
|
|
22
|
+
readonly triggerPayload: TriggerPayload;
|
|
23
|
+
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
24
|
+
readonly vars?: Record<string, string> | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function assembleWorkflowRunContext(
|
|
28
|
+
params: AssembleWorkflowRunContextParams,
|
|
29
|
+
): WorkflowExpressionEvaluationContext {
|
|
30
|
+
return {
|
|
31
|
+
run: {
|
|
32
|
+
id: params.run.id,
|
|
33
|
+
name: params.run.name,
|
|
34
|
+
definition_id: params.run.definitionId,
|
|
35
|
+
project_id: params.run.projectId,
|
|
36
|
+
workspace_id: params.run.workspaceId,
|
|
37
|
+
created_at: params.run.createdAt,
|
|
38
|
+
},
|
|
39
|
+
trigger: {
|
|
40
|
+
source: params.triggerPayload.source,
|
|
41
|
+
event: params.triggerPayload.event,
|
|
42
|
+
},
|
|
43
|
+
event: 'data' in params.triggerPayload ? params.triggerPayload.data : null,
|
|
44
|
+
inputs: params.inputs ?? null,
|
|
45
|
+
...(params.vars === undefined ? {} : {vars: params.vars}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function assembleCreationContext(
|
|
50
|
+
params: AssembleWorkflowRunContextParams,
|
|
51
|
+
): WorkflowEvaluationContext {
|
|
52
|
+
return {
|
|
53
|
+
site: 'run-creation',
|
|
54
|
+
values: assembleWorkflowRunContext(params),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AssembleExecutionCreationContextParams extends AssembleWorkflowRunContextParams {
|
|
59
|
+
readonly jobId: string;
|
|
60
|
+
readonly sequence: number;
|
|
61
|
+
readonly executionName: string;
|
|
62
|
+
readonly status: JobExecution['status'];
|
|
63
|
+
readonly triggerEvents: readonly JobExecution['triggerEvents'][number][];
|
|
64
|
+
readonly priorExecutions: readonly JobExecution[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function assembleExecutionCreationContext(
|
|
68
|
+
params: AssembleExecutionCreationContextParams,
|
|
69
|
+
): WorkflowEvaluationContext {
|
|
70
|
+
const execution: JobExecution = {
|
|
71
|
+
id: `${params.jobId}:${params.sequence}`,
|
|
72
|
+
jobId: params.jobId,
|
|
73
|
+
sequence: params.sequence,
|
|
74
|
+
name: params.executionName,
|
|
75
|
+
runner: null,
|
|
76
|
+
status: params.status,
|
|
77
|
+
statusReason: null,
|
|
78
|
+
triggerEvents: [...params.triggerEvents],
|
|
79
|
+
outputs: null,
|
|
80
|
+
version: 1,
|
|
81
|
+
createdAt: new Date(),
|
|
82
|
+
updatedAt: new Date(),
|
|
83
|
+
queuedAt: null,
|
|
84
|
+
startedAt: null,
|
|
85
|
+
finishedAt: null,
|
|
86
|
+
timedOutAt: null,
|
|
87
|
+
};
|
|
88
|
+
const executions = assembleExecutionsContext([...params.priorExecutions, execution]);
|
|
89
|
+
const executionValues = executions.executions as unknown[];
|
|
90
|
+
return {
|
|
91
|
+
site: 'execution-creation',
|
|
92
|
+
values: {
|
|
93
|
+
...assembleWorkflowRunContext(params),
|
|
94
|
+
...executions,
|
|
95
|
+
execution: executionValues.at(-1),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Keeps job-success predicate values aligned with the registry's `executions`
|
|
102
|
+
* type environment.
|
|
103
|
+
*/
|
|
104
|
+
export function assembleExecutionsContext(
|
|
105
|
+
executions: readonly JobExecution[],
|
|
106
|
+
): WorkflowExpressionEvaluationContext {
|
|
107
|
+
return {
|
|
108
|
+
executions: executions.map((execution, index) => assembleExecutionContext(execution, index)),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function assembleExecutionContext(execution: JobExecution, index: number): Record<string, unknown> {
|
|
113
|
+
return {
|
|
114
|
+
index,
|
|
115
|
+
name: execution.name,
|
|
116
|
+
status: execution.status,
|
|
117
|
+
started_at: execution.startedAt,
|
|
118
|
+
finished_at: execution.finishedAt,
|
|
119
|
+
events: execution.triggerEvents,
|
|
120
|
+
outputs: execution.outputs ?? {},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function assembleJobsContext(
|
|
125
|
+
jobs: readonly JobContextInput[],
|
|
126
|
+
): WorkflowExpressionEvaluationContext & {readonly jobs: Record<string, unknown>} {
|
|
127
|
+
return {
|
|
128
|
+
jobs: Object.fromEntries(jobs.map((input) => [input.job.key, assembleJobContext(input)])),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface AssembleJobActivationContextParams extends AssembleWorkflowRunContextParams {
|
|
133
|
+
readonly jobs: readonly JobContextInput[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function assembleJobActivationContext(
|
|
137
|
+
params: AssembleJobActivationContextParams,
|
|
138
|
+
): WorkflowEvaluationContext {
|
|
139
|
+
return {
|
|
140
|
+
site: 'job-activation',
|
|
141
|
+
values: {
|
|
142
|
+
...assembleWorkflowRunContext(params),
|
|
143
|
+
...assembleJobsContext(params.jobs),
|
|
144
|
+
needs: params.jobs.map(assembleJobContext),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type ListenerSnapshotRoot = 'run' | 'trigger' | 'inputs' | 'job' | 'jobs';
|
|
150
|
+
|
|
151
|
+
export interface MatcherSnapshotPlan {
|
|
152
|
+
readonly matcher: JobListeningTrigger;
|
|
153
|
+
readonly roots: ReadonlySet<ListenerSnapshotRoot>;
|
|
154
|
+
readonly jobKeys: ReadonlySet<string>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface ListenerSnapshotPlan {
|
|
158
|
+
readonly on: readonly MatcherSnapshotPlan[];
|
|
159
|
+
readonly until: readonly MatcherSnapshotPlan[];
|
|
160
|
+
readonly roots: ReadonlySet<ListenerSnapshotRoot>;
|
|
161
|
+
readonly jobKeys: ReadonlySet<string>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function planListenerFilterSnapshots(params: {
|
|
165
|
+
readonly on: readonly JobListeningTrigger[];
|
|
166
|
+
readonly until: readonly JobListeningTrigger[] | null;
|
|
167
|
+
}): ListenerSnapshotPlan {
|
|
168
|
+
const roots = new Set<ListenerSnapshotRoot>();
|
|
169
|
+
const jobKeys = new Set<string>();
|
|
170
|
+
const on = params.on.map((matcher) => planMatcherFilterSnapshot(matcher, roots, jobKeys));
|
|
171
|
+
const until = (params.until ?? []).map((matcher) =>
|
|
172
|
+
planMatcherFilterSnapshot(matcher, roots, jobKeys),
|
|
173
|
+
);
|
|
174
|
+
return {on, until, roots, jobKeys};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function planMatcherFilterSnapshot(
|
|
178
|
+
matcher: JobListeningTrigger,
|
|
179
|
+
allRoots: Set<ListenerSnapshotRoot>,
|
|
180
|
+
allJobKeys: Set<string>,
|
|
181
|
+
): MatcherSnapshotPlan {
|
|
182
|
+
if (matcher.filter === undefined) return {matcher, roots: new Set(), jobKeys: new Set()};
|
|
183
|
+
|
|
184
|
+
let roots: ListenerSnapshotRoot[];
|
|
185
|
+
try {
|
|
186
|
+
roots = extractExactContextRoots(matcher.filter)
|
|
187
|
+
.filter((root) => root !== 'event')
|
|
188
|
+
.filter(isListenerSnapshotRoot);
|
|
189
|
+
} catch {
|
|
190
|
+
return {matcher, roots: new Set(), jobKeys: new Set()};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (roots.length === 0) return {matcher, roots: new Set(), jobKeys: new Set()};
|
|
194
|
+
|
|
195
|
+
const jobKeys =
|
|
196
|
+
roots.includes('jobs') && matcher.filter !== undefined
|
|
197
|
+
? new Set(
|
|
198
|
+
analyzeContextRootKeyAccess(matcher.filter, ['jobs']).references.map(
|
|
199
|
+
(reference) => reference.key,
|
|
200
|
+
),
|
|
201
|
+
)
|
|
202
|
+
: new Set<string>();
|
|
203
|
+
for (const root of roots) allRoots.add(root);
|
|
204
|
+
for (const key of jobKeys) allJobKeys.add(key);
|
|
205
|
+
return {matcher, roots: new Set(roots), jobKeys};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function isListenerSnapshotRoot(root: string): root is ListenerSnapshotRoot {
|
|
209
|
+
return (
|
|
210
|
+
root === 'run' || root === 'trigger' || root === 'inputs' || root === 'job' || root === 'jobs'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function assembleListenerSnapshotContext(params: {
|
|
215
|
+
readonly job: Pick<Job, 'key'>;
|
|
216
|
+
readonly run: AssembleWorkflowRunContextParams['run'];
|
|
217
|
+
readonly triggerPayload: TriggerPayload;
|
|
218
|
+
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
219
|
+
readonly plan: ListenerSnapshotPlan;
|
|
220
|
+
readonly dependencyJobs: readonly JobContextInput[];
|
|
221
|
+
}): WorkflowExpressionEvaluationContext {
|
|
222
|
+
const context: Record<string, unknown> = {};
|
|
223
|
+
if (params.plan.roots.has('run') || params.plan.roots.has('trigger')) {
|
|
224
|
+
const runContext = assembleWorkflowRunContext({
|
|
225
|
+
run: params.run,
|
|
226
|
+
triggerPayload: params.triggerPayload,
|
|
227
|
+
inputs: params.inputs,
|
|
228
|
+
});
|
|
229
|
+
if (params.plan.roots.has('run')) context.run = runContext.run;
|
|
230
|
+
if (params.plan.roots.has('trigger')) context.trigger = runContext.trigger;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (params.plan.roots.has('inputs')) {
|
|
234
|
+
context.inputs = params.inputs ?? null;
|
|
235
|
+
}
|
|
236
|
+
if (params.plan.roots.has('job')) {
|
|
237
|
+
context.job = {key: params.job.key};
|
|
238
|
+
}
|
|
239
|
+
if (params.plan.roots.has('jobs')) {
|
|
240
|
+
context.jobs = requestedJobsContext(params.dependencyJobs, params.plan.jobKeys);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return context;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function requestedJobsContext(
|
|
247
|
+
dependencyJobs: readonly JobContextInput[],
|
|
248
|
+
jobKeys: ReadonlySet<string>,
|
|
249
|
+
): Record<string, unknown> {
|
|
250
|
+
if (jobKeys.size === 0) return assembleJobsContext(dependencyJobs).jobs;
|
|
251
|
+
|
|
252
|
+
const filtered = dependencyJobs.filter(({job}) => jobKeys.has(job.key));
|
|
253
|
+
|
|
254
|
+
return assembleJobsContext(filtered).jobs;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type ListenerTriggerWithSnapshot = JobListeningTrigger & {
|
|
258
|
+
readonly filter_snapshot?: Record<string, unknown>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export function applyListenerFilterSnapshots(
|
|
262
|
+
plans: readonly MatcherSnapshotPlan[],
|
|
263
|
+
context: WorkflowExpressionEvaluationContext,
|
|
264
|
+
): ListenerTriggerWithSnapshot[] {
|
|
265
|
+
return plans.map((plan) => {
|
|
266
|
+
const filterSnapshot = filterSnapshotForPlan(plan, context);
|
|
267
|
+
if (filterSnapshot === undefined) return plan.matcher;
|
|
268
|
+
|
|
269
|
+
return {...plan.matcher, filter_snapshot: filterSnapshot};
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function filterSnapshotForPlan(
|
|
274
|
+
plan: MatcherSnapshotPlan,
|
|
275
|
+
context: WorkflowExpressionEvaluationContext,
|
|
276
|
+
): Record<string, unknown> | undefined {
|
|
277
|
+
const snapshot: Record<string, unknown> = {};
|
|
278
|
+
for (const root of plan.roots) {
|
|
279
|
+
if (root === 'jobs') {
|
|
280
|
+
const jobsSnapshot = jobsSnapshotForPlan(plan, context);
|
|
281
|
+
if (jobsSnapshot !== undefined) snapshot.jobs = jobsSnapshot;
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (root in context) snapshot[root] = context[root];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return Object.keys(snapshot).length === 0 ? undefined : snapshot;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function jobsSnapshotForPlan(
|
|
292
|
+
plan: MatcherSnapshotPlan,
|
|
293
|
+
context: WorkflowExpressionEvaluationContext,
|
|
294
|
+
): Record<string, unknown> | undefined {
|
|
295
|
+
if (typeof context.jobs !== 'object' || context.jobs === null) {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const jobsContext = context.jobs as Record<string, unknown>;
|
|
300
|
+
if (plan.jobKeys.size === 0) return {...jobsContext};
|
|
301
|
+
|
|
302
|
+
const snapshot = Object.fromEntries(
|
|
303
|
+
[...plan.jobKeys].flatMap((key) =>
|
|
304
|
+
Object.hasOwn(jobsContext, key) ? [[key, jobsContext[key]]] : [],
|
|
305
|
+
),
|
|
306
|
+
);
|
|
307
|
+
return snapshot;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function assembleJobContext({job, executions}: JobContextInput): Record<string, unknown> {
|
|
311
|
+
return {
|
|
312
|
+
key: job.key,
|
|
313
|
+
status: job.status,
|
|
314
|
+
outputs: job.outputs ?? {},
|
|
315
|
+
executions: assembleExecutionsContext(executions).executions,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function assembleStepsContext(params: {
|
|
320
|
+
readonly steps: readonly Step[];
|
|
321
|
+
readonly attempts: readonly StepAttempt[];
|
|
322
|
+
}): Record<string, Record<string, unknown>> {
|
|
323
|
+
return buildStepAttemptContext(params).stepsContext;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function buildStepAttemptContext(params: {
|
|
327
|
+
readonly steps: readonly Step[];
|
|
328
|
+
readonly attempts: readonly StepAttempt[];
|
|
329
|
+
}): {
|
|
330
|
+
readonly stepsContext: Record<string, Record<string, unknown>>;
|
|
331
|
+
readonly stepsFailed: boolean;
|
|
332
|
+
readonly orderedAttempts: readonly StepAttempt[];
|
|
333
|
+
readonly stepsByKey: ReadonlyMap<string, Step>;
|
|
334
|
+
readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;
|
|
335
|
+
} {
|
|
336
|
+
const stepsByKey = new Map(
|
|
337
|
+
params.steps.flatMap((step) => (step.key === null ? [] : [[step.key, step] as const])),
|
|
338
|
+
);
|
|
339
|
+
const terminalAttemptsByStepId = new Map<string, StepAttempt[]>();
|
|
340
|
+
const orderedAttempts = [...params.attempts].sort(
|
|
341
|
+
(left, right) => left.executionOrder - right.executionOrder,
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
for (const attempt of orderedAttempts) {
|
|
345
|
+
if (attempt.status === 'running') continue;
|
|
346
|
+
const attemptsForStep = terminalAttemptsByStepId.get(attempt.stepId) ?? [];
|
|
347
|
+
attemptsForStep.push(attempt);
|
|
348
|
+
terminalAttemptsByStepId.set(attempt.stepId, attemptsForStep);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const stepsContext: Record<string, Record<string, unknown>> = {};
|
|
352
|
+
|
|
353
|
+
for (const step of params.steps) {
|
|
354
|
+
if (step.key === null) continue;
|
|
355
|
+
const attempts = terminalAttemptsByStepId.get(step.id) ?? [];
|
|
356
|
+
const latestAttempt = attempts.at(-1);
|
|
357
|
+
stepsContext[step.key] = {
|
|
358
|
+
status: step.status,
|
|
359
|
+
...(latestAttempt === undefined ? {} : latestAttemptFields(latestAttempt)),
|
|
360
|
+
attempts: attempts.map(attemptFields),
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return {
|
|
365
|
+
stepsContext,
|
|
366
|
+
stepsFailed: params.steps.some((step) => step.status === 'failed'),
|
|
367
|
+
orderedAttempts,
|
|
368
|
+
stepsByKey,
|
|
369
|
+
terminalAttemptsByStepId,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export function assembleStepDispatchContext(params: {
|
|
374
|
+
readonly steps: readonly Step[];
|
|
375
|
+
readonly attempts: readonly StepAttempt[];
|
|
376
|
+
readonly targetStepId: string;
|
|
377
|
+
readonly jobExecution?: JobExecution;
|
|
378
|
+
readonly jobs?: readonly JobContextInput[];
|
|
379
|
+
}): WorkflowEvaluationContext {
|
|
380
|
+
const targetStep = params.steps.find((step) => step.id === params.targetStepId);
|
|
381
|
+
const stepAttemptContext = buildStepAttemptContext(params);
|
|
382
|
+
const restart =
|
|
383
|
+
targetStep === undefined || targetStep.currentAttempt <= 1
|
|
384
|
+
? undefined
|
|
385
|
+
: restartProvenance({
|
|
386
|
+
targetStep,
|
|
387
|
+
orderedAttempts: stepAttemptContext.orderedAttempts,
|
|
388
|
+
stepsByKey: stepAttemptContext.stepsByKey,
|
|
389
|
+
terminalAttemptsByStepId: stepAttemptContext.terminalAttemptsByStepId,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
site: 'step-dispatch',
|
|
394
|
+
values: {
|
|
395
|
+
...(params.jobs === undefined ? {} : assembleJobsContext(params.jobs)),
|
|
396
|
+
...(params.jobExecution === undefined
|
|
397
|
+
? {}
|
|
398
|
+
: {
|
|
399
|
+
execution: {
|
|
400
|
+
index: params.jobExecution.sequence,
|
|
401
|
+
name: params.jobExecution.name,
|
|
402
|
+
status: params.jobExecution.status,
|
|
403
|
+
failed: stepAttemptContext.stepsFailed,
|
|
404
|
+
started_at: params.jobExecution.startedAt,
|
|
405
|
+
finished_at: params.jobExecution.finishedAt,
|
|
406
|
+
events: params.jobExecution.triggerEvents,
|
|
407
|
+
outputs: params.jobExecution.outputs ?? {},
|
|
408
|
+
},
|
|
409
|
+
}),
|
|
410
|
+
...(targetStep === undefined
|
|
411
|
+
? {}
|
|
412
|
+
: {
|
|
413
|
+
step: {
|
|
414
|
+
attempt: BigInt(targetStep.currentAttempt),
|
|
415
|
+
is_retry: targetStep.currentAttempt > 1,
|
|
416
|
+
...(restart === undefined ? {} : {restart}),
|
|
417
|
+
},
|
|
418
|
+
}),
|
|
419
|
+
steps: stepAttemptContext.stepsContext,
|
|
420
|
+
},
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function restartProvenance(params: {
|
|
425
|
+
readonly targetStep: Step;
|
|
426
|
+
readonly orderedAttempts: readonly StepAttempt[];
|
|
427
|
+
readonly stepsByKey: ReadonlyMap<string, Step>;
|
|
428
|
+
readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;
|
|
429
|
+
}): Record<string, unknown> | undefined {
|
|
430
|
+
for (const attempt of [...params.orderedAttempts].reverse()) {
|
|
431
|
+
if (attempt.status !== 'failed' || attempt.restartFeedback === null) continue;
|
|
432
|
+
const restartFromKey = restartFromStepKey(attempt);
|
|
433
|
+
if (restartFromKey === undefined) continue;
|
|
434
|
+
|
|
435
|
+
const restartFromStep = params.stepsByKey.get(restartFromKey);
|
|
436
|
+
if (restartFromStep === undefined || restartFromStep.position > params.targetStep.position) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const gatingAttempts = params.terminalAttemptsByStepId.get(attempt.stepId) ?? [];
|
|
441
|
+
return {
|
|
442
|
+
from: {
|
|
443
|
+
...attemptFields(attempt),
|
|
444
|
+
attempts: gatingAttempts.map(attemptFields),
|
|
445
|
+
},
|
|
446
|
+
feedback: attempt.restartFeedback,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function restartFromStepKey(attempt: StepAttempt): string | undefined {
|
|
454
|
+
const gate = attempt.config?.gate;
|
|
455
|
+
if (gate === null || typeof gate !== 'object') return undefined;
|
|
456
|
+
const onFailure = (gate as Record<string, unknown>).on_failure;
|
|
457
|
+
if (onFailure === null || typeof onFailure !== 'object') return undefined;
|
|
458
|
+
const restartFrom = (onFailure as Record<string, unknown>).restart_from;
|
|
459
|
+
return typeof restartFrom === 'string' ? restartFrom : undefined;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function attemptFields(attempt: StepAttempt): Record<string, unknown> {
|
|
463
|
+
return {
|
|
464
|
+
status: attempt.status,
|
|
465
|
+
outputs: attempt.output ?? {},
|
|
466
|
+
...(attempt.response === null ? {} : {response: attempt.response}),
|
|
467
|
+
...(attempt.exitCode === null ? {} : {exit_code: BigInt(attempt.exitCode)}),
|
|
468
|
+
...(attempt.gateResult === null ? {} : {gate: attempt.gateResult}),
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function latestAttemptFields(attempt: StepAttempt): Record<string, unknown> {
|
|
473
|
+
const fields = attemptFields(attempt);
|
|
474
|
+
delete fields.status;
|
|
475
|
+
return fields;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export function assembleGateContext(params: {
|
|
479
|
+
readonly status: StepStatus;
|
|
480
|
+
readonly exitCode: number | null;
|
|
481
|
+
readonly output?: Record<string, unknown> | null | undefined;
|
|
482
|
+
}): WorkflowEvaluationContext {
|
|
483
|
+
return {
|
|
484
|
+
site: 'step-report',
|
|
485
|
+
values: {
|
|
486
|
+
step: {
|
|
487
|
+
...(params.exitCode === null ? {} : {exit_code: BigInt(params.exitCode)}),
|
|
488
|
+
status: params.status,
|
|
489
|
+
outputs: params.output ?? {},
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export function assembleJobResolutionContext(
|
|
496
|
+
executions: readonly JobExecution[],
|
|
497
|
+
): WorkflowEvaluationContext {
|
|
498
|
+
return {
|
|
499
|
+
site: 'job-resolution',
|
|
500
|
+
values: assembleExecutionsContext(executions),
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export function assembleExecutionResolutionContext(params: {
|
|
505
|
+
readonly run: AssembleWorkflowRunContextParams['run'];
|
|
506
|
+
readonly triggerPayload: TriggerPayload;
|
|
507
|
+
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
508
|
+
readonly vars?: Record<string, string> | undefined;
|
|
509
|
+
readonly job: Pick<Job, 'key'>;
|
|
510
|
+
readonly jobExecution: JobExecution;
|
|
511
|
+
readonly executions: readonly JobExecution[];
|
|
512
|
+
readonly steps: readonly Step[];
|
|
513
|
+
readonly attempts: readonly StepAttempt[];
|
|
514
|
+
readonly jobs?: readonly JobContextInput[];
|
|
515
|
+
}): WorkflowEvaluationContext {
|
|
516
|
+
const executions = assembleExecutionsContext(params.executions);
|
|
517
|
+
const executionIndex = params.executions.findIndex(
|
|
518
|
+
(execution) => execution.id === params.jobExecution.id,
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
return {
|
|
522
|
+
site: 'execution-resolution',
|
|
523
|
+
values: {
|
|
524
|
+
...assembleWorkflowRunContext(params),
|
|
525
|
+
...executions,
|
|
526
|
+
...(params.jobs === undefined ? {} : assembleJobsContext(params.jobs)),
|
|
527
|
+
execution: assembleExecutionContext(
|
|
528
|
+
params.jobExecution,
|
|
529
|
+
executionIndex < 0 ? params.jobExecution.sequence - 1 : executionIndex,
|
|
530
|
+
),
|
|
531
|
+
job: {key: params.job.key},
|
|
532
|
+
steps: assembleStepsContext({steps: params.steps, attempts: params.attempts}),
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
}
|