@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,494 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InvalidAgentModelError,
|
|
3
|
+
UnsupportedModelProviderError,
|
|
4
|
+
} from '@shipfox/api-agent/core/errors';
|
|
5
|
+
import type {AgentDefaultsResolver} from '@shipfox/api-agent/core/resolve-agent-config';
|
|
6
|
+
import {
|
|
7
|
+
AGENT_INTEGRATION_MCP_AUTH,
|
|
8
|
+
AGENT_INTEGRATION_MCP_ENDPOINT,
|
|
9
|
+
AGENT_INTEGRATION_MCP_SERVER_NAME,
|
|
10
|
+
AGENT_INTEGRATION_MCP_TRANSPORT,
|
|
11
|
+
} from '@shipfox/api-agent-dto';
|
|
12
|
+
import type {AgentToolCatalogEntry} from '@shipfox/api-integration-core';
|
|
13
|
+
import type {AgentToolMaterializationContext} from '#core/agent-tools.js';
|
|
14
|
+
import {AgentConfigUnresolvableError, InterpolationUnresolvableError} from '#core/errors.js';
|
|
15
|
+
import {workflowModel} from '#test/index.js';
|
|
16
|
+
import {materializeJobExecutionSteps} from './materialize-job-execution-steps.js';
|
|
17
|
+
import type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';
|
|
18
|
+
|
|
19
|
+
function template(source: string): string {
|
|
20
|
+
return `\${{ ${source} }}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function shellRef(name: string): string {
|
|
24
|
+
return `\${${name}}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function jobExecutionContext(): WorkflowEvaluationContext {
|
|
28
|
+
return {
|
|
29
|
+
site: 'execution-creation',
|
|
30
|
+
values: {
|
|
31
|
+
run: {
|
|
32
|
+
id: 'run-1',
|
|
33
|
+
name: 'Reviews',
|
|
34
|
+
definition_id: 'def-1',
|
|
35
|
+
project_id: 'proj-1',
|
|
36
|
+
workspace_id: 'workspace-1',
|
|
37
|
+
created_at: new Date('2026-06-30T12:00:00.000Z'),
|
|
38
|
+
},
|
|
39
|
+
trigger: {source: 'manual', event: 'fire'},
|
|
40
|
+
event: null,
|
|
41
|
+
inputs: null,
|
|
42
|
+
execution: {
|
|
43
|
+
index: 1,
|
|
44
|
+
name: 'Review batch 2',
|
|
45
|
+
status: 'pending',
|
|
46
|
+
started_at: '2026-06-30T12:01:00.000Z',
|
|
47
|
+
finished_at: null,
|
|
48
|
+
events: [
|
|
49
|
+
{
|
|
50
|
+
source: 'github',
|
|
51
|
+
event: 'pull_request_review',
|
|
52
|
+
delivery_id: 'delivery-2',
|
|
53
|
+
received_at: '2026-06-30T12:01:00.000Z',
|
|
54
|
+
data: {body: 'LGTM'},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
executions: [
|
|
59
|
+
{
|
|
60
|
+
index: 0,
|
|
61
|
+
name: 'Review batch 1',
|
|
62
|
+
status: 'succeeded',
|
|
63
|
+
started_at: '2026-06-30T12:00:00.000Z',
|
|
64
|
+
finished_at: '2026-06-30T12:00:30.000Z',
|
|
65
|
+
events: [],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function githubAgentToolContext(
|
|
73
|
+
catalog: readonly AgentToolCatalogEntry[] = githubAgentToolCatalog(),
|
|
74
|
+
): AgentToolMaterializationContext {
|
|
75
|
+
return {
|
|
76
|
+
catalogs: new Map([['github', catalog]]),
|
|
77
|
+
workspaceConnectionSnapshot: new Map([
|
|
78
|
+
[
|
|
79
|
+
'github-main',
|
|
80
|
+
{
|
|
81
|
+
id: 'connection-1',
|
|
82
|
+
provider: 'github',
|
|
83
|
+
capabilities: ['agent_tools'],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
]),
|
|
87
|
+
defaultConnection: {
|
|
88
|
+
id: 'connection-1',
|
|
89
|
+
slug: 'github-main',
|
|
90
|
+
provider: 'github',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function githubAgentToolCatalog(): readonly AgentToolCatalogEntry[] {
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
id: 'issue_read',
|
|
99
|
+
description: 'Read issues.',
|
|
100
|
+
sensitivity: 'read',
|
|
101
|
+
sensitive: false,
|
|
102
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
103
|
+
inputSchema: {type: 'object'},
|
|
104
|
+
methods: [
|
|
105
|
+
{
|
|
106
|
+
id: 'get',
|
|
107
|
+
description: 'Get issue.',
|
|
108
|
+
sensitivity: 'read',
|
|
109
|
+
sensitive: false,
|
|
110
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'get_comments',
|
|
114
|
+
description: 'Get issue comments.',
|
|
115
|
+
sensitivity: 'read',
|
|
116
|
+
sensitive: false,
|
|
117
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'issue_write',
|
|
123
|
+
description: 'Write issues.',
|
|
124
|
+
sensitivity: 'write',
|
|
125
|
+
sensitive: false,
|
|
126
|
+
requiredScope: [{permission: 'issues', access: 'write'}],
|
|
127
|
+
inputSchema: {type: 'object'},
|
|
128
|
+
methods: [
|
|
129
|
+
{
|
|
130
|
+
id: 'create',
|
|
131
|
+
description: 'Create issue.',
|
|
132
|
+
sensitivity: 'write',
|
|
133
|
+
sensitive: false,
|
|
134
|
+
requiredScope: [{permission: 'issues', access: 'write'}],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'merge_pull_request',
|
|
140
|
+
description: 'Merge a pull request.',
|
|
141
|
+
sensitivity: 'write',
|
|
142
|
+
sensitive: true,
|
|
143
|
+
requiredScope: [
|
|
144
|
+
{permission: 'pull_requests', access: 'write'},
|
|
145
|
+
{permission: 'contents', access: 'write'},
|
|
146
|
+
],
|
|
147
|
+
inputSchema: {type: 'object'},
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
describe('materializeJobExecutionSteps', () => {
|
|
153
|
+
it('prepends setup and resolves job-execution context fields', () => {
|
|
154
|
+
const model = workflowModel({
|
|
155
|
+
jobs: {
|
|
156
|
+
review: {
|
|
157
|
+
steps: [
|
|
158
|
+
{
|
|
159
|
+
name: `Review ${template('execution.events[0].data.body')}`,
|
|
160
|
+
run: `echo "${template('executions[0].name')}"`,
|
|
161
|
+
env: {BODY: template('execution.events[0].data.body')},
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const job = model.jobs[0];
|
|
168
|
+
if (!job) throw new Error('Expected workflow job');
|
|
169
|
+
|
|
170
|
+
const steps = materializeJobExecutionSteps({model, job, context: jobExecutionContext()});
|
|
171
|
+
|
|
172
|
+
expect(steps).toEqual([
|
|
173
|
+
{
|
|
174
|
+
key: null,
|
|
175
|
+
name: 'Set up job',
|
|
176
|
+
sourceLocation: null,
|
|
177
|
+
status: 'pending',
|
|
178
|
+
type: 'setup',
|
|
179
|
+
config: {},
|
|
180
|
+
authoredConfig: null,
|
|
181
|
+
position: 0,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: null,
|
|
185
|
+
name: 'Review LGTM',
|
|
186
|
+
sourceLocation: null,
|
|
187
|
+
status: 'pending',
|
|
188
|
+
type: 'run',
|
|
189
|
+
config: {
|
|
190
|
+
run: `echo "${shellRef('__sf_0')}"`,
|
|
191
|
+
env: {
|
|
192
|
+
BODY: 'LGTM',
|
|
193
|
+
__sf_0: 'Review batch 1',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
authoredConfig: {
|
|
197
|
+
run: `echo "${template('executions[0].name')}"`,
|
|
198
|
+
env: {BODY: template('execution.events[0].data.body')},
|
|
199
|
+
},
|
|
200
|
+
configPlan: {
|
|
201
|
+
trace: [
|
|
202
|
+
{
|
|
203
|
+
expression: 'execution.events[0].data.body',
|
|
204
|
+
roots: ['execution'],
|
|
205
|
+
fillTarget: 'execution-creation',
|
|
206
|
+
evaluatedAt: 'execution-creation',
|
|
207
|
+
value: 'LGTM',
|
|
208
|
+
field: 'env',
|
|
209
|
+
envKey: 'BODY',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
expression: 'executions[0].name',
|
|
213
|
+
roots: ['executions'],
|
|
214
|
+
fillTarget: 'execution-creation',
|
|
215
|
+
evaluatedAt: 'execution-creation',
|
|
216
|
+
value: 'Review batch 1',
|
|
217
|
+
field: 'run',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
expression: 'execution.events[0].data.body',
|
|
221
|
+
roots: ['execution'],
|
|
222
|
+
fillTarget: 'execution-creation',
|
|
223
|
+
evaluatedAt: 'execution-creation',
|
|
224
|
+
value: 'LGTM',
|
|
225
|
+
field: 'step.name',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
position: 1,
|
|
230
|
+
},
|
|
231
|
+
]);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('freezes resolved agent integration tools with default connection, repo, and token scope', () => {
|
|
235
|
+
const model = workflowModel({
|
|
236
|
+
jobs: {
|
|
237
|
+
fix: {
|
|
238
|
+
steps: [
|
|
239
|
+
{
|
|
240
|
+
harness: 'pi',
|
|
241
|
+
provider: 'anthropic',
|
|
242
|
+
model: 'claude-opus-4-8',
|
|
243
|
+
thinking: 'high',
|
|
244
|
+
prompt: 'Fix it.',
|
|
245
|
+
integrations: [
|
|
246
|
+
{
|
|
247
|
+
include: ['issue_read.get', 'issue_write.create', 'merge_pull_request'],
|
|
248
|
+
allowWrite: true,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
const job = model.jobs[0];
|
|
257
|
+
if (!job) throw new Error('Expected workflow job');
|
|
258
|
+
|
|
259
|
+
const steps = materializeJobExecutionSteps({
|
|
260
|
+
model,
|
|
261
|
+
job,
|
|
262
|
+
context: jobExecutionContext(),
|
|
263
|
+
agentToolContext: githubAgentToolContext(),
|
|
264
|
+
});
|
|
265
|
+
const integrations = steps[1]?.config.integrations;
|
|
266
|
+
|
|
267
|
+
expect(integrations).toEqual([
|
|
268
|
+
{
|
|
269
|
+
connectionId: 'connection-1',
|
|
270
|
+
connectionSlug: 'github-main',
|
|
271
|
+
provider: 'github',
|
|
272
|
+
requiredScope: [
|
|
273
|
+
{permission: 'issues', access: 'write'},
|
|
274
|
+
{permission: 'pull_requests', access: 'write'},
|
|
275
|
+
{permission: 'contents', access: 'write'},
|
|
276
|
+
],
|
|
277
|
+
tools: [
|
|
278
|
+
{
|
|
279
|
+
id: 'issue_read',
|
|
280
|
+
sensitivity: 'read',
|
|
281
|
+
sensitive: false,
|
|
282
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
283
|
+
inputSchema: {type: 'object'},
|
|
284
|
+
methods: [
|
|
285
|
+
{
|
|
286
|
+
id: 'get',
|
|
287
|
+
token: 'issue_read.get',
|
|
288
|
+
description: 'Get issue.',
|
|
289
|
+
sensitivity: 'read',
|
|
290
|
+
sensitive: false,
|
|
291
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: 'issue_write',
|
|
297
|
+
sensitivity: 'write',
|
|
298
|
+
sensitive: false,
|
|
299
|
+
requiredScope: [{permission: 'issues', access: 'write'}],
|
|
300
|
+
inputSchema: {type: 'object'},
|
|
301
|
+
methods: [
|
|
302
|
+
{
|
|
303
|
+
id: 'create',
|
|
304
|
+
token: 'issue_write.create',
|
|
305
|
+
description: 'Create issue.',
|
|
306
|
+
sensitivity: 'write',
|
|
307
|
+
sensitive: false,
|
|
308
|
+
requiredScope: [{permission: 'issues', access: 'write'}],
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: 'merge_pull_request',
|
|
314
|
+
sensitivity: 'write',
|
|
315
|
+
sensitive: true,
|
|
316
|
+
requiredScope: [
|
|
317
|
+
{permission: 'pull_requests', access: 'write'},
|
|
318
|
+
{permission: 'contents', access: 'write'},
|
|
319
|
+
],
|
|
320
|
+
inputSchema: {type: 'object'},
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
]);
|
|
325
|
+
expect(steps[1]?.config.mcpServers).toEqual([
|
|
326
|
+
{
|
|
327
|
+
name: AGENT_INTEGRATION_MCP_SERVER_NAME,
|
|
328
|
+
transport: AGENT_INTEGRATION_MCP_TRANSPORT,
|
|
329
|
+
endpoint: AGENT_INTEGRATION_MCP_ENDPOINT,
|
|
330
|
+
auth: AGENT_INTEGRATION_MCP_AUTH,
|
|
331
|
+
integrations,
|
|
332
|
+
},
|
|
333
|
+
]);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('carries frozen integrations through the agent dispatch plan when prompt is deferred', () => {
|
|
337
|
+
const model = workflowModel({
|
|
338
|
+
jobs: {
|
|
339
|
+
fix: {
|
|
340
|
+
steps: [
|
|
341
|
+
{
|
|
342
|
+
harness: 'pi',
|
|
343
|
+
provider: 'anthropic',
|
|
344
|
+
model: 'claude-opus-4-8',
|
|
345
|
+
thinking: 'high',
|
|
346
|
+
prompt: `Fix ${template('steps.build.outputs.summary')}`,
|
|
347
|
+
integrations: [
|
|
348
|
+
{
|
|
349
|
+
connection: 'github-main',
|
|
350
|
+
include: ['issue_read'],
|
|
351
|
+
exclude: ['issue_read.get_comments'],
|
|
352
|
+
allowWrite: false,
|
|
353
|
+
},
|
|
354
|
+
],
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
const job = model.jobs[0];
|
|
361
|
+
if (!job) throw new Error('Expected workflow job');
|
|
362
|
+
|
|
363
|
+
const steps = materializeJobExecutionSteps({
|
|
364
|
+
model,
|
|
365
|
+
job,
|
|
366
|
+
context: jobExecutionContext(),
|
|
367
|
+
agentToolContext: githubAgentToolContext(),
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
expect(steps[1]?.config).toEqual({
|
|
371
|
+
harness: 'pi',
|
|
372
|
+
provider: 'anthropic',
|
|
373
|
+
model: 'claude-opus-4-8',
|
|
374
|
+
thinking: 'high',
|
|
375
|
+
});
|
|
376
|
+
const integrations = steps[1]?.configPlan?.agent?.integrations;
|
|
377
|
+
expect(integrations).toEqual([
|
|
378
|
+
{
|
|
379
|
+
connectionId: 'connection-1',
|
|
380
|
+
connectionSlug: 'github-main',
|
|
381
|
+
provider: 'github',
|
|
382
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
383
|
+
tools: [
|
|
384
|
+
{
|
|
385
|
+
id: 'issue_read',
|
|
386
|
+
sensitivity: 'read',
|
|
387
|
+
sensitive: false,
|
|
388
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
389
|
+
inputSchema: {type: 'object'},
|
|
390
|
+
methods: [
|
|
391
|
+
{
|
|
392
|
+
id: 'get',
|
|
393
|
+
token: 'issue_read.get',
|
|
394
|
+
description: 'Get issue.',
|
|
395
|
+
sensitivity: 'read',
|
|
396
|
+
sensitive: false,
|
|
397
|
+
requiredScope: [{permission: 'issues', access: 'read'}],
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
],
|
|
402
|
+
},
|
|
403
|
+
]);
|
|
404
|
+
expect(steps[1]?.configPlan?.agent?.mcpServers).toEqual([
|
|
405
|
+
{
|
|
406
|
+
name: AGENT_INTEGRATION_MCP_SERVER_NAME,
|
|
407
|
+
transport: AGENT_INTEGRATION_MCP_TRANSPORT,
|
|
408
|
+
endpoint: AGENT_INTEGRATION_MCP_ENDPOINT,
|
|
409
|
+
auth: AGENT_INTEGRATION_MCP_AUTH,
|
|
410
|
+
integrations,
|
|
411
|
+
},
|
|
412
|
+
]);
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
it('throws a permanent interpolation error for available missing value paths', () => {
|
|
416
|
+
const model = workflowModel({
|
|
417
|
+
jobs: {
|
|
418
|
+
review: {
|
|
419
|
+
steps: [{run: 'echo ok', env: {TICKET: template('inputs.ticket')}}],
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
});
|
|
423
|
+
const job = model.jobs[0];
|
|
424
|
+
if (!job) throw new Error('Expected workflow job');
|
|
425
|
+
const baseContext = jobExecutionContext();
|
|
426
|
+
|
|
427
|
+
let error: unknown;
|
|
428
|
+
try {
|
|
429
|
+
materializeJobExecutionSteps({
|
|
430
|
+
model,
|
|
431
|
+
job,
|
|
432
|
+
context: {...baseContext, values: {...baseContext.values, inputs: {}}},
|
|
433
|
+
definitionId: 'def-1',
|
|
434
|
+
});
|
|
435
|
+
} catch (caught) {
|
|
436
|
+
error = caught;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
expect(error).toBeInstanceOf(InterpolationUnresolvableError);
|
|
440
|
+
expect(error).toMatchObject({
|
|
441
|
+
field: 'env',
|
|
442
|
+
source: 'inputs.ticket',
|
|
443
|
+
envKey: 'TICKET',
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it.each([
|
|
448
|
+
new UnsupportedModelProviderError('unknown-provider'),
|
|
449
|
+
new InvalidAgentModelError('pi', 'anthropic', 'missing-model'),
|
|
450
|
+
])('wraps known resolver errors as permanent agent config errors', (cause) => {
|
|
451
|
+
const model = workflowModel({
|
|
452
|
+
jobs: {
|
|
453
|
+
review: {steps: [{prompt: 'Summarize the review.'}]},
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
const job = model.jobs[0];
|
|
457
|
+
if (!job) throw new Error('Expected workflow job');
|
|
458
|
+
const resolveAgentDefaults = vi.fn<AgentDefaultsResolver>().mockImplementation(() => {
|
|
459
|
+
throw cause;
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
const materialize = () =>
|
|
463
|
+
materializeJobExecutionSteps({
|
|
464
|
+
model,
|
|
465
|
+
job,
|
|
466
|
+
context: jobExecutionContext(),
|
|
467
|
+
resolveAgentDefaults,
|
|
468
|
+
definitionId: 'def-1',
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
expect(materialize).toThrow(AgentConfigUnresolvableError);
|
|
472
|
+
expect(materialize).toThrow('Agent configuration cannot be resolved for definition def-1');
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
it('throws a permanent interpolation error for unsafe run interpolation', () => {
|
|
476
|
+
const model = workflowModel({
|
|
477
|
+
jobs: {
|
|
478
|
+
review: {steps: [{run: `echo \`${template('execution.index')}\``}]},
|
|
479
|
+
},
|
|
480
|
+
});
|
|
481
|
+
const job = model.jobs[0];
|
|
482
|
+
if (!job) throw new Error('Expected workflow job');
|
|
483
|
+
|
|
484
|
+
const materialize = () =>
|
|
485
|
+
materializeJobExecutionSteps({
|
|
486
|
+
model,
|
|
487
|
+
job,
|
|
488
|
+
context: jobExecutionContext(),
|
|
489
|
+
definitionId: 'def-1',
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
expect(materialize).toThrow(InterpolationUnresolvableError);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AgentDefaultsResolver,
|
|
3
|
+
catalogDefaultAgentResolver,
|
|
4
|
+
} from '@shipfox/api-agent/core/resolve-agent-config';
|
|
5
|
+
import type {WorkflowModel} from '@shipfox/api-definitions';
|
|
6
|
+
import type {WorkflowExpression} from '@shipfox/expression';
|
|
7
|
+
import type {
|
|
8
|
+
AgentToolMaterializationContext,
|
|
9
|
+
AgentToolMaterializationSnapshot,
|
|
10
|
+
} from '#core/agent-tools.js';
|
|
11
|
+
import type {StepConfigDispatchPlan} from '#core/entities/step.js';
|
|
12
|
+
import {resolveStepConfig, type WorkflowStepTemplateDiagnostic} from './resolve-step-config.js';
|
|
13
|
+
import type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';
|
|
14
|
+
|
|
15
|
+
type WorkflowModelJob = WorkflowModel['jobs'][number];
|
|
16
|
+
type WorkflowModelStep = WorkflowModelJob['steps'][number];
|
|
17
|
+
type WorkflowSourceLocation = NonNullable<WorkflowModelStep['sourceLocation']>;
|
|
18
|
+
|
|
19
|
+
const FIRST_LINE_PATTERN = /\r?\n/;
|
|
20
|
+
|
|
21
|
+
export interface MaterializedWorkflowStep {
|
|
22
|
+
readonly key: string | null;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly sourceLocation: WorkflowSourceLocation | null;
|
|
25
|
+
readonly status: 'pending';
|
|
26
|
+
readonly type: WorkflowModelStep['kind'] | 'setup';
|
|
27
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
28
|
+
readonly condition?: WorkflowExpression;
|
|
29
|
+
readonly configPlan?: StepConfigDispatchPlan;
|
|
30
|
+
readonly authoredConfig: Readonly<Record<string, unknown>> | null;
|
|
31
|
+
readonly diagnostics?: readonly WorkflowStepTemplateDiagnostic[];
|
|
32
|
+
readonly position: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface MaterializeJobExecutionStepsParams {
|
|
36
|
+
readonly model: WorkflowModel;
|
|
37
|
+
readonly job: WorkflowModelJob;
|
|
38
|
+
readonly context: WorkflowEvaluationContext;
|
|
39
|
+
readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;
|
|
40
|
+
readonly definitionId?: string | undefined;
|
|
41
|
+
readonly agentToolContext?: AgentToolMaterializationContext | undefined;
|
|
42
|
+
readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Synthetic "Set up job" step prepended when a job execution's steps are materialized.
|
|
46
|
+
// The runner prepares the workspace here; failures report through the normal step
|
|
47
|
+
// protocol instead of hanging the job until the lease/timeout fires. Its config is
|
|
48
|
+
// credential-free.
|
|
49
|
+
const SETUP_STEP: MaterializedWorkflowStep = {
|
|
50
|
+
key: null,
|
|
51
|
+
name: 'Set up job',
|
|
52
|
+
sourceLocation: null,
|
|
53
|
+
status: 'pending',
|
|
54
|
+
type: 'setup',
|
|
55
|
+
config: {},
|
|
56
|
+
authoredConfig: null,
|
|
57
|
+
position: 0,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export function materializeJobExecutionSteps(
|
|
61
|
+
params: MaterializeJobExecutionStepsParams,
|
|
62
|
+
): readonly MaterializedWorkflowStep[] {
|
|
63
|
+
const {
|
|
64
|
+
model,
|
|
65
|
+
job,
|
|
66
|
+
context,
|
|
67
|
+
resolveAgentDefaults = catalogDefaultAgentResolver,
|
|
68
|
+
definitionId = model.name,
|
|
69
|
+
agentToolContext,
|
|
70
|
+
agentToolSnapshot,
|
|
71
|
+
} = params;
|
|
72
|
+
|
|
73
|
+
return [
|
|
74
|
+
SETUP_STEP,
|
|
75
|
+
...job.steps.map((step, stepPosition) => {
|
|
76
|
+
// The trusted context exposes the stable job key; the authored display field remains `job.name`.
|
|
77
|
+
const stepContext = {...context.values, job: {key: job.key}};
|
|
78
|
+
const resolved = resolveStepConfig({
|
|
79
|
+
jobKey: job.key,
|
|
80
|
+
step,
|
|
81
|
+
workflowEnv: model.env,
|
|
82
|
+
workflowEnvTemplates: model.templates?.env,
|
|
83
|
+
jobEnv: job.env,
|
|
84
|
+
jobEnvTemplates: job.templates?.env,
|
|
85
|
+
context: stepContext,
|
|
86
|
+
site: context.site,
|
|
87
|
+
resolveAgentDefaults,
|
|
88
|
+
definitionId,
|
|
89
|
+
agentToolContext,
|
|
90
|
+
agentToolSnapshot,
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
key: step.key ?? null,
|
|
94
|
+
name: resolved.name ?? stepDisplayName(step),
|
|
95
|
+
sourceLocation: step.sourceLocation ?? null,
|
|
96
|
+
status: 'pending' as const,
|
|
97
|
+
type: step.kind,
|
|
98
|
+
config: resolved.config,
|
|
99
|
+
...(step.if === undefined ? {} : {condition: step.if}),
|
|
100
|
+
authoredConfig: resolved.authoredConfig,
|
|
101
|
+
...materializedConfigPlan(resolved.configPlan, resolved.trace),
|
|
102
|
+
...(resolved.diagnostics.length === 0 ? {} : {diagnostics: resolved.diagnostics}),
|
|
103
|
+
position: stepPosition + 1,
|
|
104
|
+
};
|
|
105
|
+
}),
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function materializedConfigPlan(
|
|
110
|
+
configPlan: StepConfigDispatchPlan | null,
|
|
111
|
+
trace: NonNullable<StepConfigDispatchPlan['trace']>,
|
|
112
|
+
): {readonly configPlan?: StepConfigDispatchPlan} {
|
|
113
|
+
if (configPlan === null && trace.length === 0) return {};
|
|
114
|
+
return {configPlan: {...(configPlan ?? {}), ...(trace.length === 0 ? {} : {trace})}};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function stepDisplayName(step: WorkflowModelStep): string {
|
|
118
|
+
switch (step.kind) {
|
|
119
|
+
case 'run':
|
|
120
|
+
return firstLine(step.command.value);
|
|
121
|
+
case 'agent':
|
|
122
|
+
return step.model === undefined
|
|
123
|
+
? firstLine(step.prompt)
|
|
124
|
+
: `${step.model} · ${firstLine(step.prompt)}`;
|
|
125
|
+
default:
|
|
126
|
+
return assertNever(step);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function firstLine(value: string): string {
|
|
131
|
+
return value.split(FIRST_LINE_PATTERN, 1)[0]?.trim() || value.trim();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function assertNever(value: never): never {
|
|
135
|
+
throw new Error(`Unhandled workflow step kind: ${JSON.stringify(value)}`);
|
|
136
|
+
}
|