@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,8 @@
|
|
|
1
|
+
export { type AssembleExecutionCreationContextParams, type AssembleJobActivationContextParams, type AssembleWorkflowRunContextParams, applyListenerFilterSnapshots, assembleCreationContext, assembleExecutionCreationContext, assembleExecutionResolutionContext, assembleExecutionsContext, assembleGateContext, assembleJobActivationContext, assembleJobResolutionContext, assembleListenerSnapshotContext, assembleStepDispatchContext, assembleWorkflowRunContext, type JobContextInput, type ListenerSnapshotPlan, type ListenerTriggerWithSnapshot, type MatcherSnapshotPlan, planListenerFilterSnapshots, } from './assemble-run-context.js';
|
|
2
|
+
export { completeStepDispatchConfig } from './complete-step-dispatch-config.js';
|
|
3
|
+
export { type MaterializedWorkflowStep, type MaterializeJobExecutionStepsParams, materializeJobExecutionSteps, } from './materialize-job-execution-steps.js';
|
|
4
|
+
export { type MaterializedWorkflowJob, type MaterializeWorkflowModelParams, materializeJobOutputs, materializeJobRunner, materializeWorkflowModel, modelHasAgentStep, } from './materialize-workflow-model.js';
|
|
5
|
+
export { type ResolveJobExecutionNameParams, resolveJobExecutionName, } from './resolve-job-execution-name.js';
|
|
6
|
+
export type { WorkflowStepTemplateDiagnostic } from './resolve-step-config.js';
|
|
7
|
+
export type { WorkflowEvaluationContext } from './workflow-evaluation-context.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sCAAsC,EAC3C,KAAK,kCAAkC,EACvC,KAAK,gCAAgC,EACrC,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,0BAA0B,EAAC,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,kCAAkC,EACvC,4BAA4B,GAC7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,6BAA6B,EAClC,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAC,8BAA8B,EAAC,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { applyListenerFilterSnapshots, assembleCreationContext, assembleExecutionCreationContext, assembleExecutionResolutionContext, assembleExecutionsContext, assembleGateContext, assembleJobActivationContext, assembleJobResolutionContext, assembleListenerSnapshotContext, assembleStepDispatchContext, assembleWorkflowRunContext, planListenerFilterSnapshots } from './assemble-run-context.js';
|
|
2
|
+
export { completeStepDispatchConfig } from './complete-step-dispatch-config.js';
|
|
3
|
+
export { materializeJobExecutionSteps } from './materialize-job-execution-steps.js';
|
|
4
|
+
export { materializeJobOutputs, materializeJobRunner, materializeWorkflowModel, modelHasAgentStep } from './materialize-workflow-model.js';
|
|
5
|
+
export { resolveJobExecutionName } from './resolve-job-execution-name.js';
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/index.ts"],"sourcesContent":["export {\n type AssembleExecutionCreationContextParams,\n type AssembleJobActivationContextParams,\n type AssembleWorkflowRunContextParams,\n applyListenerFilterSnapshots,\n assembleCreationContext,\n assembleExecutionCreationContext,\n assembleExecutionResolutionContext,\n assembleExecutionsContext,\n assembleGateContext,\n assembleJobActivationContext,\n assembleJobResolutionContext,\n assembleListenerSnapshotContext,\n assembleStepDispatchContext,\n assembleWorkflowRunContext,\n type JobContextInput,\n type ListenerSnapshotPlan,\n type ListenerTriggerWithSnapshot,\n type MatcherSnapshotPlan,\n planListenerFilterSnapshots,\n} from './assemble-run-context.js';\nexport {completeStepDispatchConfig} from './complete-step-dispatch-config.js';\nexport {\n type MaterializedWorkflowStep,\n type MaterializeJobExecutionStepsParams,\n materializeJobExecutionSteps,\n} from './materialize-job-execution-steps.js';\nexport {\n type MaterializedWorkflowJob,\n type MaterializeWorkflowModelParams,\n materializeJobOutputs,\n materializeJobRunner,\n materializeWorkflowModel,\n modelHasAgentStep,\n} from './materialize-workflow-model.js';\nexport {\n type ResolveJobExecutionNameParams,\n resolveJobExecutionName,\n} from './resolve-job-execution-name.js';\nexport type {WorkflowStepTemplateDiagnostic} from './resolve-step-config.js';\nexport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n"],"names":["applyListenerFilterSnapshots","assembleCreationContext","assembleExecutionCreationContext","assembleExecutionResolutionContext","assembleExecutionsContext","assembleGateContext","assembleJobActivationContext","assembleJobResolutionContext","assembleListenerSnapshotContext","assembleStepDispatchContext","assembleWorkflowRunContext","planListenerFilterSnapshots","completeStepDispatchConfig","materializeJobExecutionSteps","materializeJobOutputs","materializeJobRunner","materializeWorkflowModel","modelHasAgentStep","resolveJobExecutionName"],"mappings":"AAAA,SAIEA,4BAA4B,EAC5BC,uBAAuB,EACvBC,gCAAgC,EAChCC,kCAAkC,EAClCC,yBAAyB,EACzBC,mBAAmB,EACnBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,0BAA0B,EAK1BC,2BAA2B,QACtB,4BAA4B;AACnC,SAAQC,0BAA0B,QAAO,qCAAqC;AAC9E,SAGEC,4BAA4B,QACvB,uCAAuC;AAC9C,SAGEC,qBAAqB,EACrBC,oBAAoB,EACpBC,wBAAwB,EACxBC,iBAAiB,QACZ,kCAAkC;AACzC,SAEEC,uBAAuB,QAClB,kCAAkC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type AgentDefaultsResolver } from '@shipfox/api-agent/core/resolve-agent-config';
|
|
2
|
+
import type { WorkflowModel } from '@shipfox/api-definitions';
|
|
3
|
+
import type { WorkflowExpression } from '@shipfox/expression';
|
|
4
|
+
import type { AgentToolMaterializationContext, AgentToolMaterializationSnapshot } from '#core/agent-tools.js';
|
|
5
|
+
import type { StepConfigDispatchPlan } from '#core/entities/step.js';
|
|
6
|
+
import { type WorkflowStepTemplateDiagnostic } from './resolve-step-config.js';
|
|
7
|
+
import type { WorkflowEvaluationContext } from './workflow-evaluation-context.js';
|
|
8
|
+
type WorkflowModelJob = WorkflowModel['jobs'][number];
|
|
9
|
+
type WorkflowModelStep = WorkflowModelJob['steps'][number];
|
|
10
|
+
type WorkflowSourceLocation = NonNullable<WorkflowModelStep['sourceLocation']>;
|
|
11
|
+
export interface MaterializedWorkflowStep {
|
|
12
|
+
readonly key: string | null;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly sourceLocation: WorkflowSourceLocation | null;
|
|
15
|
+
readonly status: 'pending';
|
|
16
|
+
readonly type: WorkflowModelStep['kind'] | 'setup';
|
|
17
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
18
|
+
readonly condition?: WorkflowExpression;
|
|
19
|
+
readonly configPlan?: StepConfigDispatchPlan;
|
|
20
|
+
readonly authoredConfig: Readonly<Record<string, unknown>> | null;
|
|
21
|
+
readonly diagnostics?: readonly WorkflowStepTemplateDiagnostic[];
|
|
22
|
+
readonly position: number;
|
|
23
|
+
}
|
|
24
|
+
export interface MaterializeJobExecutionStepsParams {
|
|
25
|
+
readonly model: WorkflowModel;
|
|
26
|
+
readonly job: WorkflowModelJob;
|
|
27
|
+
readonly context: WorkflowEvaluationContext;
|
|
28
|
+
readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;
|
|
29
|
+
readonly definitionId?: string | undefined;
|
|
30
|
+
readonly agentToolContext?: AgentToolMaterializationContext | undefined;
|
|
31
|
+
readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare function materializeJobExecutionSteps(params: MaterializeJobExecutionStepsParams): readonly MaterializedWorkflowStep[];
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=materialize-job-execution-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize-job-execution-steps.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/materialize-job-execution-steps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAC,kBAAkB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AC3B;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,+BAA+B,GAAG,SAAS,CAAC;IACxE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gCAAgC,GAAG,IAAI,GAAG,SAAS,CAAC;CAClF;AAiBD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,kCAAkC,GACzC,SAAS,wBAAwB,EAAE,CA6CrC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { catalogDefaultAgentResolver } from '@shipfox/api-agent/core/resolve-agent-config';
|
|
2
|
+
import { resolveStepConfig } from './resolve-step-config.js';
|
|
3
|
+
const FIRST_LINE_PATTERN = /\r?\n/;
|
|
4
|
+
// Synthetic "Set up job" step prepended when a job execution's steps are materialized.
|
|
5
|
+
// The runner prepares the workspace here; failures report through the normal step
|
|
6
|
+
// protocol instead of hanging the job until the lease/timeout fires. Its config is
|
|
7
|
+
// credential-free.
|
|
8
|
+
const SETUP_STEP = {
|
|
9
|
+
key: null,
|
|
10
|
+
name: 'Set up job',
|
|
11
|
+
sourceLocation: null,
|
|
12
|
+
status: 'pending',
|
|
13
|
+
type: 'setup',
|
|
14
|
+
config: {},
|
|
15
|
+
authoredConfig: null,
|
|
16
|
+
position: 0
|
|
17
|
+
};
|
|
18
|
+
export function materializeJobExecutionSteps(params) {
|
|
19
|
+
const { model, job, context, resolveAgentDefaults = catalogDefaultAgentResolver, definitionId = model.name, agentToolContext, agentToolSnapshot } = params;
|
|
20
|
+
return [
|
|
21
|
+
SETUP_STEP,
|
|
22
|
+
...job.steps.map((step, stepPosition)=>{
|
|
23
|
+
// The trusted context exposes the stable job key; the authored display field remains `job.name`.
|
|
24
|
+
const stepContext = {
|
|
25
|
+
...context.values,
|
|
26
|
+
job: {
|
|
27
|
+
key: job.key
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const resolved = resolveStepConfig({
|
|
31
|
+
jobKey: job.key,
|
|
32
|
+
step,
|
|
33
|
+
workflowEnv: model.env,
|
|
34
|
+
workflowEnvTemplates: model.templates?.env,
|
|
35
|
+
jobEnv: job.env,
|
|
36
|
+
jobEnvTemplates: job.templates?.env,
|
|
37
|
+
context: stepContext,
|
|
38
|
+
site: context.site,
|
|
39
|
+
resolveAgentDefaults,
|
|
40
|
+
definitionId,
|
|
41
|
+
agentToolContext,
|
|
42
|
+
agentToolSnapshot
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
key: step.key ?? null,
|
|
46
|
+
name: resolved.name ?? stepDisplayName(step),
|
|
47
|
+
sourceLocation: step.sourceLocation ?? null,
|
|
48
|
+
status: 'pending',
|
|
49
|
+
type: step.kind,
|
|
50
|
+
config: resolved.config,
|
|
51
|
+
...step.if === undefined ? {} : {
|
|
52
|
+
condition: step.if
|
|
53
|
+
},
|
|
54
|
+
authoredConfig: resolved.authoredConfig,
|
|
55
|
+
...materializedConfigPlan(resolved.configPlan, resolved.trace),
|
|
56
|
+
...resolved.diagnostics.length === 0 ? {} : {
|
|
57
|
+
diagnostics: resolved.diagnostics
|
|
58
|
+
},
|
|
59
|
+
position: stepPosition + 1
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
function materializedConfigPlan(configPlan, trace) {
|
|
65
|
+
if (configPlan === null && trace.length === 0) return {};
|
|
66
|
+
return {
|
|
67
|
+
configPlan: {
|
|
68
|
+
...configPlan ?? {},
|
|
69
|
+
...trace.length === 0 ? {} : {
|
|
70
|
+
trace
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function stepDisplayName(step) {
|
|
76
|
+
switch(step.kind){
|
|
77
|
+
case 'run':
|
|
78
|
+
return firstLine(step.command.value);
|
|
79
|
+
case 'agent':
|
|
80
|
+
return step.model === undefined ? firstLine(step.prompt) : `${step.model} · ${firstLine(step.prompt)}`;
|
|
81
|
+
default:
|
|
82
|
+
return assertNever(step);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function firstLine(value) {
|
|
86
|
+
return value.split(FIRST_LINE_PATTERN, 1)[0]?.trim() || value.trim();
|
|
87
|
+
}
|
|
88
|
+
function assertNever(value) {
|
|
89
|
+
throw new Error(`Unhandled workflow step kind: ${JSON.stringify(value)}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=materialize-job-execution-steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/materialize-job-execution-steps.ts"],"sourcesContent":["import {\n type AgentDefaultsResolver,\n catalogDefaultAgentResolver,\n} from '@shipfox/api-agent/core/resolve-agent-config';\nimport type {WorkflowModel} from '@shipfox/api-definitions';\nimport type {WorkflowExpression} from '@shipfox/expression';\nimport type {\n AgentToolMaterializationContext,\n AgentToolMaterializationSnapshot,\n} from '#core/agent-tools.js';\nimport type {StepConfigDispatchPlan} from '#core/entities/step.js';\nimport {resolveStepConfig, type WorkflowStepTemplateDiagnostic} from './resolve-step-config.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\ntype WorkflowModelJob = WorkflowModel['jobs'][number];\ntype WorkflowModelStep = WorkflowModelJob['steps'][number];\ntype WorkflowSourceLocation = NonNullable<WorkflowModelStep['sourceLocation']>;\n\nconst FIRST_LINE_PATTERN = /\\r?\\n/;\n\nexport interface MaterializedWorkflowStep {\n readonly key: string | null;\n readonly name: string;\n readonly sourceLocation: WorkflowSourceLocation | null;\n readonly status: 'pending';\n readonly type: WorkflowModelStep['kind'] | 'setup';\n readonly config: Readonly<Record<string, unknown>>;\n readonly condition?: WorkflowExpression;\n readonly configPlan?: StepConfigDispatchPlan;\n readonly authoredConfig: Readonly<Record<string, unknown>> | null;\n readonly diagnostics?: readonly WorkflowStepTemplateDiagnostic[];\n readonly position: number;\n}\n\nexport interface MaterializeJobExecutionStepsParams {\n readonly model: WorkflowModel;\n readonly job: WorkflowModelJob;\n readonly context: WorkflowEvaluationContext;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId?: string | undefined;\n readonly agentToolContext?: AgentToolMaterializationContext | undefined;\n readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;\n}\n\n// Synthetic \"Set up job\" step prepended when a job execution's steps are materialized.\n// The runner prepares the workspace here; failures report through the normal step\n// protocol instead of hanging the job until the lease/timeout fires. Its config is\n// credential-free.\nconst SETUP_STEP: MaterializedWorkflowStep = {\n key: null,\n name: 'Set up job',\n sourceLocation: null,\n status: 'pending',\n type: 'setup',\n config: {},\n authoredConfig: null,\n position: 0,\n};\n\nexport function materializeJobExecutionSteps(\n params: MaterializeJobExecutionStepsParams,\n): readonly MaterializedWorkflowStep[] {\n const {\n model,\n job,\n context,\n resolveAgentDefaults = catalogDefaultAgentResolver,\n definitionId = model.name,\n agentToolContext,\n agentToolSnapshot,\n } = params;\n\n return [\n SETUP_STEP,\n ...job.steps.map((step, stepPosition) => {\n // The trusted context exposes the stable job key; the authored display field remains `job.name`.\n const stepContext = {...context.values, job: {key: job.key}};\n const resolved = resolveStepConfig({\n jobKey: job.key,\n step,\n workflowEnv: model.env,\n workflowEnvTemplates: model.templates?.env,\n jobEnv: job.env,\n jobEnvTemplates: job.templates?.env,\n context: stepContext,\n site: context.site,\n resolveAgentDefaults,\n definitionId,\n agentToolContext,\n agentToolSnapshot,\n });\n return {\n key: step.key ?? null,\n name: resolved.name ?? stepDisplayName(step),\n sourceLocation: step.sourceLocation ?? null,\n status: 'pending' as const,\n type: step.kind,\n config: resolved.config,\n ...(step.if === undefined ? {} : {condition: step.if}),\n authoredConfig: resolved.authoredConfig,\n ...materializedConfigPlan(resolved.configPlan, resolved.trace),\n ...(resolved.diagnostics.length === 0 ? {} : {diagnostics: resolved.diagnostics}),\n position: stepPosition + 1,\n };\n }),\n ];\n}\n\nfunction materializedConfigPlan(\n configPlan: StepConfigDispatchPlan | null,\n trace: NonNullable<StepConfigDispatchPlan['trace']>,\n): {readonly configPlan?: StepConfigDispatchPlan} {\n if (configPlan === null && trace.length === 0) return {};\n return {configPlan: {...(configPlan ?? {}), ...(trace.length === 0 ? {} : {trace})}};\n}\n\nfunction stepDisplayName(step: WorkflowModelStep): string {\n switch (step.kind) {\n case 'run':\n return firstLine(step.command.value);\n case 'agent':\n return step.model === undefined\n ? firstLine(step.prompt)\n : `${step.model} · ${firstLine(step.prompt)}`;\n default:\n return assertNever(step);\n }\n}\n\nfunction firstLine(value: string): string {\n return value.split(FIRST_LINE_PATTERN, 1)[0]?.trim() || value.trim();\n}\n\nfunction assertNever(value: never): never {\n throw new Error(`Unhandled workflow step kind: ${JSON.stringify(value)}`);\n}\n"],"names":["catalogDefaultAgentResolver","resolveStepConfig","FIRST_LINE_PATTERN","SETUP_STEP","key","name","sourceLocation","status","type","config","authoredConfig","position","materializeJobExecutionSteps","params","model","job","context","resolveAgentDefaults","definitionId","agentToolContext","agentToolSnapshot","steps","map","step","stepPosition","stepContext","values","resolved","jobKey","workflowEnv","env","workflowEnvTemplates","templates","jobEnv","jobEnvTemplates","site","stepDisplayName","kind","if","undefined","condition","materializedConfigPlan","configPlan","trace","diagnostics","length","firstLine","command","value","prompt","assertNever","split","trim","Error","JSON","stringify"],"mappings":"AAAA,SAEEA,2BAA2B,QACtB,+CAA+C;AAQtD,SAAQC,iBAAiB,QAA4C,2BAA2B;AAOhG,MAAMC,qBAAqB;AA0B3B,uFAAuF;AACvF,kFAAkF;AAClF,mFAAmF;AACnF,mBAAmB;AACnB,MAAMC,aAAuC;IAC3CC,K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,IAAI;oBAACD,aAAajB,SAASiB,WAAW;gBAAA,CAAC;gBAChFjC,UAAUa,eAAe;YAC3B;QACF;KACD;AACH;AAEA,SAASiB,uBACPC,UAAyC,EACzCC,KAAmD;IAEnD,IAAID,eAAe,QAAQC,MAAME,MAAM,KAAK,GAAG,OAAO,CAAC;IACvD,OAAO;QAACH,YAAY;YAAC,GAAIA,cAAc,CAAC,CAAC;YAAG,GAAIC,MAAME,MAAM,KAAK,IAAI,CAAC,IAAI;gBAACF;YAAK,CAAC;QAAC;IAAC;AACrF;AAEA,SAASP,gBAAgBb,IAAuB;IAC9C,OAAQA,KAAKc,IAAI;QACf,KAAK;YACH,OAAOS,UAAUvB,KAAKwB,OAAO,CAACC,KAAK;QACrC,KAAK;YACH,OAAOzB,KAAKT,KAAK,KAAKyB,YAClBO,UAAUvB,KAAK0B,MAAM,IACrB,GAAG1B,KAAKT,KAAK,CAAC,GAAG,EAAEgC,UAAUvB,KAAK0B,MAAM,GAAG;QACjD;YACE,OAAOC,YAAY3B;IACvB;AACF;AAEA,SAASuB,UAAUE,KAAa;IAC9B,OAAOA,MAAMG,KAAK,CAACjD,oBAAoB,EAAE,CAAC,EAAE,EAAEkD,UAAUJ,MAAMI,IAAI;AACpE;AAEA,SAASF,YAAYF,KAAY;IAC/B,MAAM,IAAIK,MAAM,CAAC,8BAA8B,EAAEC,KAAKC,SAAS,CAACP,QAAQ;AAC1E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentDefaultsResolver } from '@shipfox/api-agent/core/resolve-agent-config';
|
|
2
|
+
import type { WorkflowModel } from '@shipfox/api-definitions';
|
|
3
|
+
import type { AgentToolMaterializationContext, AgentToolMaterializationSnapshot } from '#core/agent-tools.js';
|
|
4
|
+
import { type MaterializedWorkflowStep } from './materialize-job-execution-steps.js';
|
|
5
|
+
import type { WorkflowEvaluationContext } from './workflow-evaluation-context.js';
|
|
6
|
+
type WorkflowModelJob = WorkflowModel['jobs'][number];
|
|
7
|
+
export interface MaterializedWorkflowJob {
|
|
8
|
+
readonly key: string;
|
|
9
|
+
readonly mode: WorkflowModelJob['mode'];
|
|
10
|
+
readonly success?: string;
|
|
11
|
+
readonly executionTimeoutMs?: number;
|
|
12
|
+
readonly checkout: WorkflowModelJob['checkout'];
|
|
13
|
+
readonly listening?: WorkflowModelJob['listening'];
|
|
14
|
+
readonly name?: WorkflowModelJob['name'];
|
|
15
|
+
readonly outputs?: WorkflowModelJob['outputs'];
|
|
16
|
+
readonly dependencies: readonly string[];
|
|
17
|
+
readonly runner: readonly string[];
|
|
18
|
+
readonly position: number;
|
|
19
|
+
readonly steps: readonly MaterializedWorkflowStep[];
|
|
20
|
+
}
|
|
21
|
+
export interface MaterializeWorkflowModelParams {
|
|
22
|
+
readonly model: WorkflowModel;
|
|
23
|
+
readonly context?: WorkflowEvaluationContext | undefined;
|
|
24
|
+
readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;
|
|
25
|
+
readonly definitionId?: string | undefined;
|
|
26
|
+
readonly agentToolContext?: AgentToolMaterializationContext | undefined;
|
|
27
|
+
readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare function materializeWorkflowModel(params: MaterializeWorkflowModelParams): readonly MaterializedWorkflowJob[];
|
|
30
|
+
export declare function materializeJobRunner(params: {
|
|
31
|
+
readonly job: WorkflowModelJob;
|
|
32
|
+
readonly context: WorkflowEvaluationContext;
|
|
33
|
+
readonly definitionId: string;
|
|
34
|
+
}): readonly string[];
|
|
35
|
+
export declare function materializeJobOutputs(params: {
|
|
36
|
+
readonly job: WorkflowModelJob;
|
|
37
|
+
readonly context: WorkflowEvaluationContext;
|
|
38
|
+
readonly definitionId: string;
|
|
39
|
+
}): Record<string, string> | null;
|
|
40
|
+
export declare function modelHasAgentStep(model: WorkflowModel): boolean;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=materialize-workflow-model.d.ts.map
|
|
@@ -0,0 +1 @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M,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,+BAA+B,GAAG,SAAS,CAAC;IACxE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gCAAgC,GAAG,IAAI,GAAG,SAAS,CAAC;CAClF;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,8BAA8B,GACrC,SAAS,uBAAuB,EAAE,CAoCpC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,SAAS,MAAM,EAAE,CAgBpB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAgBhC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { canonicalizeLabels, findInvalidLabels, MAX_RUNNER_LABELS } from '@shipfox/runner-labels';
|
|
2
|
+
import { InvalidJobRunnerLabelsError } from '#core/errors.js';
|
|
3
|
+
import { completeStepField } from './fields.js';
|
|
4
|
+
import { materializeJobExecutionSteps } from './materialize-job-execution-steps.js';
|
|
5
|
+
export function materializeWorkflowModel(params) {
|
|
6
|
+
const { model, context = {
|
|
7
|
+
site: 'run-creation',
|
|
8
|
+
values: {}
|
|
9
|
+
}, resolveAgentDefaults, definitionId = model.name, agentToolContext, agentToolSnapshot } = params;
|
|
10
|
+
const jobsById = new Map(model.jobs.map((job)=>[
|
|
11
|
+
job.id,
|
|
12
|
+
job
|
|
13
|
+
]));
|
|
14
|
+
return model.jobs.map((job, position)=>({
|
|
15
|
+
key: job.key,
|
|
16
|
+
mode: job.mode,
|
|
17
|
+
...job.success === undefined ? {} : {
|
|
18
|
+
success: job.success
|
|
19
|
+
},
|
|
20
|
+
...job.executionTimeoutMs === undefined ? {} : {
|
|
21
|
+
executionTimeoutMs: job.executionTimeoutMs
|
|
22
|
+
},
|
|
23
|
+
checkout: job.checkout,
|
|
24
|
+
...job.listening === undefined ? {} : {
|
|
25
|
+
listening: job.listening
|
|
26
|
+
},
|
|
27
|
+
...job.name === undefined ? {} : {
|
|
28
|
+
name: job.name
|
|
29
|
+
},
|
|
30
|
+
...job.outputs === undefined ? {} : {
|
|
31
|
+
outputs: job.outputs
|
|
32
|
+
},
|
|
33
|
+
dependencies: dependencySourceNames(job, jobsById),
|
|
34
|
+
runner: job.runner,
|
|
35
|
+
position,
|
|
36
|
+
steps: job.mode === 'listening' ? [] : materializeJobExecutionSteps({
|
|
37
|
+
model,
|
|
38
|
+
job,
|
|
39
|
+
context,
|
|
40
|
+
resolveAgentDefaults,
|
|
41
|
+
definitionId,
|
|
42
|
+
agentToolContext,
|
|
43
|
+
agentToolSnapshot
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
export function materializeJobRunner(params) {
|
|
48
|
+
const resolvedLabels = (params.job.runnerTemplates ?? []).map((template)=>completeStepField({
|
|
49
|
+
field: 'job.runner',
|
|
50
|
+
errorField: 'job.runner',
|
|
51
|
+
template: {
|
|
52
|
+
segments: template
|
|
53
|
+
},
|
|
54
|
+
context: params.context,
|
|
55
|
+
definitionId: params.definitionId
|
|
56
|
+
}));
|
|
57
|
+
const labels = canonicalizeLabels([
|
|
58
|
+
...params.job.runner,
|
|
59
|
+
...resolvedLabels
|
|
60
|
+
]);
|
|
61
|
+
const invalidLabels = findInvalidLabels(labels);
|
|
62
|
+
if (labels.length === 0 || labels.length > MAX_RUNNER_LABELS || invalidLabels.length > 0) {
|
|
63
|
+
throw new InvalidJobRunnerLabelsError(labels);
|
|
64
|
+
}
|
|
65
|
+
return labels;
|
|
66
|
+
}
|
|
67
|
+
export function materializeJobOutputs(params) {
|
|
68
|
+
const outputs = params.job.outputs;
|
|
69
|
+
if (outputs === undefined) return null;
|
|
70
|
+
return Object.fromEntries(Object.entries(outputs).map(([key, template])=>[
|
|
71
|
+
key,
|
|
72
|
+
completeStepField({
|
|
73
|
+
field: 'job.outputs',
|
|
74
|
+
errorField: 'job.outputs',
|
|
75
|
+
template: {
|
|
76
|
+
segments: template
|
|
77
|
+
},
|
|
78
|
+
context: params.context,
|
|
79
|
+
definitionId: params.definitionId
|
|
80
|
+
})
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
export function modelHasAgentStep(model) {
|
|
84
|
+
return model.jobs.some((job)=>job.steps.some((step)=>step.kind === 'agent'));
|
|
85
|
+
}
|
|
86
|
+
function dependencySourceNames(job, jobsById) {
|
|
87
|
+
return job.dependencies.map((dependencyId)=>{
|
|
88
|
+
const dependency = jobsById.get(dependencyId);
|
|
89
|
+
if (!dependency) {
|
|
90
|
+
throw new Error(`Unresolved workflow model dependency "${dependencyId}" for job "${job.id}"`);
|
|
91
|
+
}
|
|
92
|
+
return dependency.key;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=materialize-workflow-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/materialize-workflow-model.ts"],"sourcesContent":["import type {AgentDefaultsResolver} from '@shipfox/api-agent/core/resolve-agent-config';\nimport type {WorkflowModel} from '@shipfox/api-definitions';\nimport {canonicalizeLabels, findInvalidLabels, MAX_RUNNER_LABELS} from '@shipfox/runner-labels';\nimport type {\n AgentToolMaterializationContext,\n AgentToolMaterializationSnapshot,\n} from '#core/agent-tools.js';\nimport {InvalidJobRunnerLabelsError} from '#core/errors.js';\nimport {completeStepField} from './fields.js';\nimport {\n type MaterializedWorkflowStep,\n materializeJobExecutionSteps,\n} from './materialize-job-execution-steps.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\ntype WorkflowModelJob = WorkflowModel['jobs'][number];\nexport interface MaterializedWorkflowJob {\n readonly key: string;\n readonly mode: WorkflowModelJob['mode'];\n readonly success?: string;\n readonly executionTimeoutMs?: number;\n readonly checkout: WorkflowModelJob['checkout'];\n readonly listening?: WorkflowModelJob['listening'];\n readonly name?: WorkflowModelJob['name'];\n readonly outputs?: WorkflowModelJob['outputs'];\n readonly dependencies: readonly string[];\n readonly runner: readonly string[];\n readonly position: number;\n readonly steps: readonly MaterializedWorkflowStep[];\n}\n\nexport interface MaterializeWorkflowModelParams {\n readonly model: WorkflowModel;\n readonly context?: WorkflowEvaluationContext | undefined;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId?: string | undefined;\n readonly agentToolContext?: AgentToolMaterializationContext | undefined;\n readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;\n}\n\nexport function materializeWorkflowModel(\n params: MaterializeWorkflowModelParams,\n): readonly MaterializedWorkflowJob[] {\n const {\n model,\n context = {site: 'run-creation', values: {}},\n resolveAgentDefaults,\n definitionId = model.name,\n agentToolContext,\n agentToolSnapshot,\n } = params;\n const jobsById = new Map(model.jobs.map((job) => [job.id, job]));\n\n return model.jobs.map((job, position) => ({\n key: job.key,\n mode: job.mode,\n ...(job.success === undefined ? {} : {success: job.success}),\n ...(job.executionTimeoutMs === undefined ? {} : {executionTimeoutMs: job.executionTimeoutMs}),\n checkout: job.checkout,\n ...(job.listening === undefined ? {} : {listening: job.listening}),\n ...(job.name === undefined ? {} : {name: job.name}),\n ...(job.outputs === undefined ? {} : {outputs: job.outputs}),\n dependencies: dependencySourceNames(job, jobsById),\n runner: job.runner,\n position,\n steps:\n job.mode === 'listening'\n ? []\n : materializeJobExecutionSteps({\n model,\n job,\n context,\n resolveAgentDefaults,\n definitionId,\n agentToolContext,\n agentToolSnapshot,\n }),\n }));\n}\n\nexport function materializeJobRunner(params: {\n readonly job: WorkflowModelJob;\n readonly context: WorkflowEvaluationContext;\n readonly definitionId: string;\n}): readonly string[] {\n const resolvedLabels = (params.job.runnerTemplates ?? []).map((template) =>\n completeStepField({\n field: 'job.runner',\n errorField: 'job.runner',\n template: {segments: template},\n context: params.context,\n definitionId: params.definitionId,\n }),\n );\n const labels = canonicalizeLabels([...params.job.runner, ...resolvedLabels]);\n const invalidLabels = findInvalidLabels(labels);\n if (labels.length === 0 || labels.length > MAX_RUNNER_LABELS || invalidLabels.length > 0) {\n throw new InvalidJobRunnerLabelsError(labels);\n }\n return labels;\n}\n\nexport function materializeJobOutputs(params: {\n readonly job: WorkflowModelJob;\n readonly context: WorkflowEvaluationContext;\n readonly definitionId: string;\n}): Record<string, string> | null {\n const outputs = params.job.outputs;\n if (outputs === undefined) return null;\n\n return Object.fromEntries(\n Object.entries(outputs).map(([key, template]) => [\n key,\n completeStepField({\n field: 'job.outputs',\n errorField: 'job.outputs',\n template: {segments: template},\n context: params.context,\n definitionId: params.definitionId,\n }),\n ]),\n );\n}\n\nexport function modelHasAgentStep(model: WorkflowModel): boolean {\n return model.jobs.some((job) => job.steps.some((step) => step.kind === 'agent'));\n}\n\nfunction dependencySourceNames(\n job: WorkflowModelJob,\n jobsById: ReadonlyMap<string, WorkflowModelJob>,\n): readonly string[] {\n return job.dependencies.map((dependencyId) => {\n const dependency = jobsById.get(dependencyId);\n if (!dependency) {\n throw new Error(`Unresolved workflow model dependency \"${dependencyId}\" for job \"${job.id}\"`);\n }\n return dependency.key;\n });\n}\n"],"names":["canonicalizeLabels","findInvalidLabels","MAX_RUNNER_LABELS","InvalidJobRunnerLabelsError","completeStepField","materializeJobExecutionSteps","materializeWorkflowModel","params","model","context","site","values","resolveAgentDefaults","definitionId","name","agentToolContext","agentToolSnapshot","jobsById","Map","jobs","map","job","id","position","key","mode","success","undefined","executionTimeoutMs","checkout","listening","outputs","dependencies","dependencySourceNames","runner","steps","materializeJobRunner","resolvedLabels","runnerTemplates","template","field","errorField","segments","labels","invalidLabels","length","materializeJobOutputs","Object","fromEntries","entries","modelHasAgentStep","some","step","kind","dependencyId","dependency","get","Error"],"mappings":"AAEA,SAAQA,kBAAkB,EAAEC,iBAAiB,EAAEC,iBAAiB,QAAO,yBAAyB;AAKhG,SAAQC,2BAA2B,QAAO,kBAAkB;AAC5D,SAAQC,iBAAiB,QAAO,cAAc;AAC9C,SAEEC,4BAA4B,QACvB,uCAAuC;AA4B9C,OAAO,SAASC,yBACdC,MAAsC;IAEtC,MAAM,EACJC,KAAK,EACLC,UAAU;QAACC,MAAM;QAAgBC,QAAQ,CAAC;IAAC,CAAC,EAC5CC,oBAAoB,EACpBC,eAAeL,MAAMM,IAAI,EACzBC,gBAAgB,EAChBC,iBAAiB,EAClB,GAAGT;IACJ,MAAMU,WAAW,IAAIC,IAAIV,MAAMW,IAAI,CAACC,GAAG,CAAC,CAACC,MAAQ;YAACA,IAAIC,EAAE;YAAED;SAAI;IAE9D,OAAOb,MAAMW,IAAI,CAACC,GAAG,CAAC,CAACC,KAAKE,WAAc,CAAA;YACxCC,KAAKH,IAAIG,GAAG;YACZC,MAAMJ,IAAII,IAAI;YACd,GAAIJ,IAAIK,OAAO,KAAKC,YAAY,CAAC,IAAI;gBAACD,SAASL,IAAIK,OAAO;YAAA,CAAC;YAC3D,GAAIL,IAAIO,kBAAkB,KAAKD,YAAY,CAAC,IAAI;gBAACC,oBAAoBP,IAAIO,kBAAkB;YAAA,CAAC;YAC5FC,UAAUR,IAAIQ,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CAACI,KAAKe,SAAS,GAAK;YAC/Cf;YACApB,kBAAkB;gBAChBoC,OAAO;gBACPC,YAAY;gBACZF,UAAU;oBAACG,UAAUH;gBAAQ;gBAC7B9B,SAASF,OAAOE,OAAO;gBACvBI,cAAcN,OAAOM,YAAY;YACnC;SACD;AAEL;AAEA,OAAO,SAASqC,kBAAkB1C,KAAoB;IACpD,OAAOA,MAAMW,IAAI,CAACgC,IAAI,CAAC,CAAC9B,MAAQA,IAAIc,KAAK,CAACgB,IAAI,CAAC,CAACC,OAASA,KAAKC,IAAI,KAAK;AACzE;AAEA,SAASpB,sBACPZ,GAAqB,EACrBJ,QAA+C;IAE/C,OAAOI,IAAIW,YAAY,CAACZ,GAAG,CAAC,CAACkC;QAC3B,MAAMC,aAAatC,SAASuC,GAAG,CAACF;QAChC,IAAI,CAACC,YAAY;YACf,MAAM,IAAIE,MAAM,CAAC,sCAAsC,EAAEH,aAAa,WAAW,EAAEjC,IAAIC,EAAE,CAAC,CAAC,CAAC;QAC9F;QACA,OAAOiC,WAAW/B,GAAG;IACvB;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkflowModel } from '@shipfox/api-definitions';
|
|
2
|
+
import { type WorkflowExpressionEvaluationContext } from '@shipfox/expression';
|
|
3
|
+
import type { PersistedEvaluationTraceEntry } from '#core/entities/step.js';
|
|
4
|
+
interface WorkflowModelJobName {
|
|
5
|
+
readonly name?: WorkflowModel['jobs'][number]['name'] | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface ResolveJobExecutionNameParams {
|
|
8
|
+
readonly definitionId: string;
|
|
9
|
+
readonly job: WorkflowModelJobName;
|
|
10
|
+
readonly fallbackName: string;
|
|
11
|
+
readonly context: WorkflowExpressionEvaluationContext;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveJobExecutionName(params: ResolveJobExecutionNameParams): {
|
|
14
|
+
readonly value: string;
|
|
15
|
+
readonly trace: readonly PersistedEvaluationTraceEntry[];
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=resolve-job-execution-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-job-execution-name.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/resolve-job-execution-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAIL,KAAK,mCAAmC,EAEzC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAG1E,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CACnE;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,mCAAmC,CAAC;CACvD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,6BAA6B,GAAG;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,6BAA6B,EAAE,CAAC;CAC1D,CAyBA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { capTraceEntries, getWorkflowInterpolationFieldFailurePolicy, resolveFieldAtSite, WorkflowTemplateResolutionError } from '@shipfox/expression';
|
|
2
|
+
import { InterpolationUnresolvableError } from '#core/errors.js';
|
|
3
|
+
export function resolveJobExecutionName(params) {
|
|
4
|
+
if (params.job.name === undefined) return {
|
|
5
|
+
value: params.fallbackName,
|
|
6
|
+
trace: []
|
|
7
|
+
};
|
|
8
|
+
try {
|
|
9
|
+
const resolved = resolveFieldAtSite({
|
|
10
|
+
field: {
|
|
11
|
+
segments: params.job.name
|
|
12
|
+
},
|
|
13
|
+
site: 'execution-creation',
|
|
14
|
+
context: params.context,
|
|
15
|
+
failurePolicy: getWorkflowInterpolationFieldFailurePolicy('job.name')
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
value: resolved.kind === 'frozen' && resolved.value !== '' ? resolved.value : params.fallbackName,
|
|
19
|
+
trace: capTraceEntries(resolved.trace.map((entry)=>({
|
|
20
|
+
...entry,
|
|
21
|
+
field: 'job.name'
|
|
22
|
+
})))
|
|
23
|
+
};
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (error instanceof WorkflowTemplateResolutionError) {
|
|
26
|
+
throw new InterpolationUnresolvableError(params.definitionId, {
|
|
27
|
+
field: 'job.name',
|
|
28
|
+
source: error.source,
|
|
29
|
+
cause: error
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=resolve-job-execution-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/resolve-job-execution-name.ts"],"sourcesContent":["import type {WorkflowModel} from '@shipfox/api-definitions';\nimport {\n capTraceEntries,\n getWorkflowInterpolationFieldFailurePolicy,\n resolveFieldAtSite,\n type WorkflowExpressionEvaluationContext,\n WorkflowTemplateResolutionError,\n} from '@shipfox/expression';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport {InterpolationUnresolvableError} from '#core/errors.js';\n\ninterface WorkflowModelJobName {\n readonly name?: WorkflowModel['jobs'][number]['name'] | undefined;\n}\n\nexport interface ResolveJobExecutionNameParams {\n readonly definitionId: string;\n readonly job: WorkflowModelJobName;\n readonly fallbackName: string;\n readonly context: WorkflowExpressionEvaluationContext;\n}\n\nexport function resolveJobExecutionName(params: ResolveJobExecutionNameParams): {\n readonly value: string;\n readonly trace: readonly PersistedEvaluationTraceEntry[];\n} {\n if (params.job.name === undefined) return {value: params.fallbackName, trace: []};\n\n try {\n const resolved = resolveFieldAtSite({\n field: {segments: params.job.name},\n site: 'execution-creation',\n context: params.context,\n failurePolicy: getWorkflowInterpolationFieldFailurePolicy('job.name'),\n });\n return {\n value:\n resolved.kind === 'frozen' && resolved.value !== '' ? resolved.value : params.fallbackName,\n trace: capTraceEntries(resolved.trace.map((entry) => ({...entry, field: 'job.name'}))),\n };\n } catch (error) {\n if (error instanceof WorkflowTemplateResolutionError) {\n throw new InterpolationUnresolvableError(params.definitionId, {\n field: 'job.name',\n source: error.source,\n cause: error,\n });\n }\n throw error;\n }\n}\n"],"names":["capTraceEntries","getWorkflowInterpolationFieldFailurePolicy","resolveFieldAtSite","WorkflowTemplateResolutionError","InterpolationUnresolvableError","resolveJobExecutionName","params","job","name","undefined","value","fallbackName","trace","resolved","field","segments","site","context","failurePolicy","kind","map","entry","error","definitionId","source","cause"],"mappings":"AACA,SACEA,eAAe,EACfC,0CAA0C,EAC1CC,kBAAkB,EAElBC,+BAA+B,QAC1B,sBAAsB;AAE7B,SAAQC,8BAA8B,QAAO,kBAAkB;AAa/D,OAAO,SAASC,wBAAwBC,MAAqC;IAI3E,IAAIA,OAAOC,GAAG,CAACC,IAAI,KAAKC,WAAW,OAAO;QAACC,OAAOJ,OAAOK,YAAY;QAAEC,OAAO,EAAE;IAAA;IAEhF,IAAI;QACF,MAAMC,WAAWX,mBAAmB;YAClCY,OAAO;gBAACC,UAAUT,OAAOC,GAAG,CAACC,IAAI;YAAA;YACjCQ,MAAM;YACNC,SAASX,OAAOW,OAAO;YACvBC,eAAejB,2CAA2C;QAC5D;QACA,OAAO;YACLS,OACEG,SAASM,IAAI,KAAK,YAAYN,SAASH,KAAK,KAAK,KAAKG,SAASH,KAAK,GAAGJ,OAAOK,YAAY;YAC5FC,OAAOZ,gBAAgBa,SAASD,KAAK,CAACQ,GAAG,CAAC,CAACC,QAAW,CAAA;oBAAC,GAAGA,KAAK;oBAAEP,OAAO;gBAAU,CAAA;QACpF;IACF,EAAE,OAAOQ,OAAO;QACd,IAAIA,iBAAiBnB,iCAAiC;YACpD,MAAM,IAAIC,+BAA+BE,OAAOiB,YAAY,EAAE;gBAC5DT,OAAO;gBACPU,QAAQF,MAAME,MAAM;gBACpBC,OAAOH;YACT;QACF;QACA,MAAMA;IACR;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentDefaultsResolver } from '@shipfox/api-agent/core/resolve-agent-config';
|
|
2
|
+
import type { WorkflowEnvTemplates, WorkflowModel } from '@shipfox/api-definitions';
|
|
3
|
+
import { type AvailabilitySite, type EvaluationTraceLimitEntry, type WorkflowExpressionEvaluationContext } from '@shipfox/expression';
|
|
4
|
+
import type { AgentToolMaterializationContext, AgentToolMaterializationSnapshot } from '#core/agent-tools.js';
|
|
5
|
+
import type { StepConfigDispatchPlan } from '#core/entities/step.js';
|
|
6
|
+
import { type StepConfigField, type WorkflowStepEvaluationTraceEntry, type WorkflowStepTemplateDiagnostic } from './fields.js';
|
|
7
|
+
type WorkflowModelJob = WorkflowModel['jobs'][number];
|
|
8
|
+
type WorkflowModelStep = WorkflowModelJob['steps'][number];
|
|
9
|
+
export type { StepConfigField, WorkflowStepTemplateDiagnostic };
|
|
10
|
+
export interface ResolvedStepConfig {
|
|
11
|
+
readonly config: Record<string, unknown>;
|
|
12
|
+
readonly configPlan: StepConfigDispatchPlan | null;
|
|
13
|
+
readonly authoredConfig: Record<string, unknown> | null;
|
|
14
|
+
readonly name?: string;
|
|
15
|
+
readonly diagnostics: readonly WorkflowStepTemplateDiagnostic[];
|
|
16
|
+
readonly trace: readonly (WorkflowStepEvaluationTraceEntry | EvaluationTraceLimitEntry)[];
|
|
17
|
+
}
|
|
18
|
+
export interface ResolveStepConfigParams {
|
|
19
|
+
readonly jobKey: string;
|
|
20
|
+
readonly step: WorkflowModelStep;
|
|
21
|
+
readonly workflowEnv: WorkflowModel['env'];
|
|
22
|
+
readonly workflowEnvTemplates: WorkflowEnvTemplates | undefined;
|
|
23
|
+
readonly jobEnv: WorkflowModelJob['env'];
|
|
24
|
+
readonly jobEnvTemplates: WorkflowEnvTemplates | undefined;
|
|
25
|
+
readonly context: WorkflowExpressionEvaluationContext;
|
|
26
|
+
readonly site: AvailabilitySite;
|
|
27
|
+
readonly resolveAgentDefaults: AgentDefaultsResolver;
|
|
28
|
+
readonly definitionId: string;
|
|
29
|
+
readonly agentToolContext?: AgentToolMaterializationContext | undefined;
|
|
30
|
+
readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare function resolveStepConfig(params: ResolveStepConfigParams): ResolvedStepConfig;
|
|
33
|
+
//# sourceMappingURL=resolve-step-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-step-config.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/resolve-step-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAClF,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACzC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,MAAM,aAAa,CAAC;AAIrB,KAAK,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,KAAK,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAI3D,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AAG,kBAAkB,CAgBrF"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { capTraceEntries } from '@shipfox/expression';
|
|
2
|
+
import { resolveAgentStepConfig } from './agent.js';
|
|
3
|
+
import { freezeStepField } from './fields.js';
|
|
4
|
+
import { resolveRunStepConfig } from './run.js';
|
|
5
|
+
export function resolveStepConfig(params) {
|
|
6
|
+
const context = evaluationContext(params);
|
|
7
|
+
const effective = buildStepConfig({
|
|
8
|
+
...params,
|
|
9
|
+
context,
|
|
10
|
+
mode: 'effective'
|
|
11
|
+
});
|
|
12
|
+
const authoredConfig = effective.hasTemplates ? buildStepConfig({
|
|
13
|
+
...params,
|
|
14
|
+
context,
|
|
15
|
+
mode: 'authored'
|
|
16
|
+
}).config : null;
|
|
17
|
+
const name = resolveStepName(params.step, context, params.definitionId);
|
|
18
|
+
return {
|
|
19
|
+
config: effective.config,
|
|
20
|
+
configPlan: effective.configPlan,
|
|
21
|
+
authoredConfig,
|
|
22
|
+
...name.value === undefined || name.value === '' ? {} : {
|
|
23
|
+
name: name.value
|
|
24
|
+
},
|
|
25
|
+
diagnostics: [
|
|
26
|
+
...effective.diagnostics,
|
|
27
|
+
...name.diagnostics
|
|
28
|
+
],
|
|
29
|
+
trace: capTraceEntries([
|
|
30
|
+
...effective.trace,
|
|
31
|
+
...name.trace
|
|
32
|
+
])
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function buildStepConfig(params) {
|
|
36
|
+
const gate = gateConfigForStep(params.step);
|
|
37
|
+
const outputs = outputsConfigForStep(params.step);
|
|
38
|
+
const runStep = runStepOrNull(params.step);
|
|
39
|
+
const isRunStep = runStep !== null;
|
|
40
|
+
if (isRunStep) {
|
|
41
|
+
const run = resolveRunStepConfig({
|
|
42
|
+
...params,
|
|
43
|
+
step: runStep
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
config: {
|
|
47
|
+
...run.config,
|
|
48
|
+
...gate,
|
|
49
|
+
...outputs
|
|
50
|
+
},
|
|
51
|
+
configPlan: run.configPlan,
|
|
52
|
+
diagnostics: run.diagnostics,
|
|
53
|
+
trace: run.trace,
|
|
54
|
+
hasTemplates: run.hasTemplates
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const agentStep = agentStepOrNull(params.step);
|
|
58
|
+
if (agentStep === null) throw new Error(`Unsupported workflow step kind: ${params.step.kind}`);
|
|
59
|
+
const agent = resolveAgentStepConfig({
|
|
60
|
+
...params,
|
|
61
|
+
step: agentStep
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
config: {
|
|
65
|
+
...agent.config,
|
|
66
|
+
...gate,
|
|
67
|
+
...outputs
|
|
68
|
+
},
|
|
69
|
+
configPlan: agent.configPlan,
|
|
70
|
+
diagnostics: agent.diagnostics,
|
|
71
|
+
trace: agent.trace,
|
|
72
|
+
hasTemplates: agent.hasTemplates
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function evaluationContext(params) {
|
|
76
|
+
return {
|
|
77
|
+
site: params.site,
|
|
78
|
+
values: params.context
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function runStepOrNull(step) {
|
|
82
|
+
const isRunStep = step.kind === 'run';
|
|
83
|
+
return isRunStep ? step : null;
|
|
84
|
+
}
|
|
85
|
+
function agentStepOrNull(step) {
|
|
86
|
+
const isAgentStep = step.kind === 'agent';
|
|
87
|
+
return isAgentStep ? step : null;
|
|
88
|
+
}
|
|
89
|
+
function gateConfigForStep(step) {
|
|
90
|
+
const hasGate = step.gate !== undefined;
|
|
91
|
+
return hasGate ? {
|
|
92
|
+
gate: stepGateConfig(step.gate)
|
|
93
|
+
} : {};
|
|
94
|
+
}
|
|
95
|
+
function outputsConfigForStep(step) {
|
|
96
|
+
const hasOutputs = step.outputs !== undefined;
|
|
97
|
+
return hasOutputs ? {
|
|
98
|
+
outputs: step.outputs
|
|
99
|
+
} : {};
|
|
100
|
+
}
|
|
101
|
+
function resolveStepName(step, context, definitionId) {
|
|
102
|
+
const hasName = step.name !== undefined;
|
|
103
|
+
if (!hasName) return {
|
|
104
|
+
value: undefined,
|
|
105
|
+
diagnostics: [],
|
|
106
|
+
trace: []
|
|
107
|
+
};
|
|
108
|
+
const hasNameTemplate = step.templates?.name !== undefined;
|
|
109
|
+
if (!hasNameTemplate) return {
|
|
110
|
+
value: step.name,
|
|
111
|
+
diagnostics: [],
|
|
112
|
+
trace: []
|
|
113
|
+
};
|
|
114
|
+
const resolved = freezeStepField({
|
|
115
|
+
field: 'step.name',
|
|
116
|
+
template: {
|
|
117
|
+
segments: step.templates.name
|
|
118
|
+
},
|
|
119
|
+
context,
|
|
120
|
+
definitionId,
|
|
121
|
+
errorField: 'step.name'
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
value: resolved.value,
|
|
125
|
+
diagnostics: resolved.diagnostics.map((diagnostic)=>({
|
|
126
|
+
...diagnostic,
|
|
127
|
+
field: 'step.name'
|
|
128
|
+
})),
|
|
129
|
+
trace: resolved.trace.map((entry)=>({
|
|
130
|
+
...entry,
|
|
131
|
+
field: 'step.name'
|
|
132
|
+
}))
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function stepGateConfig(gate) {
|
|
136
|
+
const hasSuccess = gate.success !== undefined;
|
|
137
|
+
const hasOnFailure = gate.onFailure !== undefined;
|
|
138
|
+
const hasOnFailureFeedback = gate.onFailure?.feedback !== undefined;
|
|
139
|
+
const hasOnFailureFeedbackTemplate = gate.onFailure?.feedbackTemplate !== undefined;
|
|
140
|
+
return {
|
|
141
|
+
...hasSuccess ? {
|
|
142
|
+
success: {
|
|
143
|
+
language: gate.success.language,
|
|
144
|
+
check: gate.success.check,
|
|
145
|
+
source: gate.success.source
|
|
146
|
+
}
|
|
147
|
+
} : {},
|
|
148
|
+
...hasOnFailure ? {
|
|
149
|
+
on_failure: {
|
|
150
|
+
restart_from: gate.onFailure.restartFrom,
|
|
151
|
+
...hasOnFailureFeedback ? {
|
|
152
|
+
feedback: gate.onFailure.feedback
|
|
153
|
+
} : {},
|
|
154
|
+
...hasOnFailureFeedbackTemplate ? {
|
|
155
|
+
feedback_template: {
|
|
156
|
+
segments: gate.onFailure.feedbackTemplate
|
|
157
|
+
}
|
|
158
|
+
} : {}
|
|
159
|
+
}
|
|
160
|
+
} : {}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=resolve-step-config.js.map
|