@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,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1783159827882,
|
|
9
|
+
"tag": "0000_initial",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1783439600000,
|
|
16
|
+
"tag": "0001_agent_tool_materialization",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shipfox/api-workflows",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
8
|
+
"directory": "libs/api/workflows"
|
|
9
|
+
},
|
|
10
|
+
"private": false,
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"imports": {
|
|
15
|
+
"#test/*": "./test/*",
|
|
16
|
+
"#*": {
|
|
17
|
+
"workspace-source": "./src/*",
|
|
18
|
+
"development": "./src/*",
|
|
19
|
+
"default": "./dist/*"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"development": {
|
|
25
|
+
"types": "./src/index.ts",
|
|
26
|
+
"default": "./src/index.ts"
|
|
27
|
+
},
|
|
28
|
+
"default": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@temporalio/common": "^1.16.1",
|
|
36
|
+
"@temporalio/workflow": "^1.16.1",
|
|
37
|
+
"drizzle-orm": "^0.45.2",
|
|
38
|
+
"zod": "^4.4.3",
|
|
39
|
+
"@shipfox/api-auth": "2.0.0",
|
|
40
|
+
"@shipfox/api-auth-context": "2.0.0",
|
|
41
|
+
"@shipfox/annotations": "2.0.0",
|
|
42
|
+
"@shipfox/api-integration-core": "2.0.0",
|
|
43
|
+
"@shipfox/api-projects": "2.0.0",
|
|
44
|
+
"@shipfox/api-agent-dto": "2.0.0",
|
|
45
|
+
"@shipfox/api-runners-dto": "2.0.0",
|
|
46
|
+
"@shipfox/api-runners": "2.0.0",
|
|
47
|
+
"@shipfox/api-secrets": "2.0.0",
|
|
48
|
+
"@shipfox/api-secrets-dto": "2.0.0",
|
|
49
|
+
"@shipfox/expression": "1.1.1",
|
|
50
|
+
"@shipfox/node-error-monitoring": "0.1.2",
|
|
51
|
+
"@shipfox/api-workflows-dto": "2.0.0",
|
|
52
|
+
"@shipfox/node-drizzle": "0.2.1",
|
|
53
|
+
"@shipfox/node-opentelemetry": "0.5.0",
|
|
54
|
+
"@shipfox/node-module": "0.2.0",
|
|
55
|
+
"@shipfox/node-outbox": "0.2.1",
|
|
56
|
+
"@shipfox/node-fastify": "0.2.1",
|
|
57
|
+
"@shipfox/node-postgres": "0.4.1",
|
|
58
|
+
"@shipfox/node-temporal": "0.2.0",
|
|
59
|
+
"@shipfox/runner-labels": "0.1.0",
|
|
60
|
+
"@shipfox/api-agent": "2.0.0",
|
|
61
|
+
"@shipfox/api-definitions": "2.0.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@temporalio/activity": "^1.16.1",
|
|
65
|
+
"@temporalio/client": "^1.16.1",
|
|
66
|
+
"@temporalio/testing": "^1.16.1",
|
|
67
|
+
"@temporalio/worker": "^1.16.1",
|
|
68
|
+
"@types/pg": "^8.15.5",
|
|
69
|
+
"drizzle-kit": "^0.31.10",
|
|
70
|
+
"fastify": "^5.3.3",
|
|
71
|
+
"fastify-type-provider-zod": "^6.0.0",
|
|
72
|
+
"fishery": "^2.2.2",
|
|
73
|
+
"@shipfox/api-auth-dto": "2.0.0",
|
|
74
|
+
"@shipfox/biome": "1.8.1",
|
|
75
|
+
"@shipfox/node-jwt": "0.2.0",
|
|
76
|
+
"@shipfox/swc": "1.2.5",
|
|
77
|
+
"@shipfox/vitest": "1.2.2",
|
|
78
|
+
"@shipfox/ts-config": "1.3.8",
|
|
79
|
+
"@shipfox/typescript": "1.1.6",
|
|
80
|
+
"@shipfox/node-log": "0.3.3"
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "shipfox-swc",
|
|
84
|
+
"check": "shipfox-biome-check",
|
|
85
|
+
"check:fix": "shipfox-biome-check --write",
|
|
86
|
+
"test": "shipfox-vitest-run",
|
|
87
|
+
"test:watch": "shipfox-vitest-watch",
|
|
88
|
+
"type": "shipfox-tsc-check",
|
|
89
|
+
"type:emit": "shipfox-tsc-emit"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Workflow Runtime Core
|
|
2
|
+
|
|
3
|
+
Workflow runtime code is split into two independent subsystems: scheduling and step config.
|
|
4
|
+
|
|
5
|
+
## Workflow Scheduling
|
|
6
|
+
|
|
7
|
+
`core/workflow-scheduling` contains the pure DAG scheduler and run-progress helpers.
|
|
8
|
+
|
|
9
|
+
- **`scheduleRuntimeDag`** reads a runtime DAG, completed job statuses, and currently running jobs, then returns scheduling commands.
|
|
10
|
+
- **Runtime commands** describe host actions such as starting a job, skipping a job, cancelling a job, or completing a run.
|
|
11
|
+
- **Runtime DAG entities** define the small job shape the scheduler needs.
|
|
12
|
+
- **Run progress** tracks completed and skipped jobs while Temporal orchestration loops over scheduler decisions.
|
|
13
|
+
|
|
14
|
+
The scheduler does not call Temporal, runners, the database, or external systems. The host loads durable state, calls the scheduler, applies commands, persists rows, and waits for job results.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {scheduleRuntimeDag} from '#core/workflow-scheduling/schedule-runtime-dag.js';
|
|
18
|
+
|
|
19
|
+
const commands = scheduleRuntimeDag({
|
|
20
|
+
jobs: [
|
|
21
|
+
{id: 'job-1', key: 'build', mode: 'one_shot', dependencies: [], version: 1},
|
|
22
|
+
{id: 'job-2', key: 'test', mode: 'one_shot', dependencies: ['build'], version: 1},
|
|
23
|
+
],
|
|
24
|
+
completed: new Map(),
|
|
25
|
+
running: new Set(),
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Step Config
|
|
30
|
+
|
|
31
|
+
`core/step-config` owns workflow step config materialization and fill-site completion.
|
|
32
|
+
|
|
33
|
+
- **Run and execution assembly** builds `WorkflowEvaluationContext` values for run creation, execution creation, and step dispatch.
|
|
34
|
+
- **Materialization** converts a normalized workflow model into persisted job and step rows for a run or a single job execution.
|
|
35
|
+
- **Step config resolution** evaluates and freezes planned step config fields at the earliest server site that has the required roots.
|
|
36
|
+
- **Dispatch completion** fills any `step-dispatch` `config_plan` segments before a step is handed to a runner.
|
|
37
|
+
|
|
38
|
+
Step config starts from the authored workflow model. Authoring validation records each expression's roots and produces a `config_plan` for fields that may need more than one fill site. At run creation or execution creation, the materializer assembles a phase-tagged context and resolves fields whose roots are available at that site.
|
|
39
|
+
|
|
40
|
+
Fully resolved fields are frozen into `steps.config`. Deferred segments stay in the plan until their fill site. `completeStepDispatchConfig` handles the dispatch site, using the latest step context to finish server-side segments before the runner receives the step. Runner-only segments, such as secrets, remain references for runner fill and are never persisted as plaintext values.
|
|
41
|
+
|
|
42
|
+
The context wrapper is:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
type WorkflowEvaluationContext = {
|
|
46
|
+
site: AvailabilitySite;
|
|
47
|
+
values: WorkflowExpressionEvaluationContext;
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `site` records where the fill is happening. The `values` object carries only the roots available there, such as `run`, `trigger`, `event`, `inputs`, `job`, `execution`, `executions`, and step data for dispatch.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import {assembleCreationContext} from '#core/step-config/assemble-run-context.js';
|
|
55
|
+
import {materializeWorkflowModel} from '#core/step-config/materialize-workflow-model.js';
|
|
56
|
+
|
|
57
|
+
const context = assembleCreationContext({
|
|
58
|
+
run,
|
|
59
|
+
triggerPayload,
|
|
60
|
+
inputs,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const materialized = await materializeWorkflowModel({
|
|
64
|
+
model,
|
|
65
|
+
context,
|
|
66
|
+
definitionId,
|
|
67
|
+
resolveAgentDefaults,
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
turbo check --filter=@shipfox/api-workflows
|
|
75
|
+
turbo type --filter=@shipfox/api-workflows
|
|
76
|
+
turbo test --filter=@shipfox/api-workflows
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
DB-backed workflow tests need local Postgres from `docker compose up -d`.
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type {JobLeaseTokenClaims} from '@shipfox/api-auth';
|
|
2
|
+
import {sql} from 'drizzle-orm';
|
|
3
|
+
import {db} from '#db/db.js';
|
|
4
|
+
import {warnAgentToolCapabilityMismatchOnDispatch} from './agent-tool-capability-warning.js';
|
|
5
|
+
import type {Step} from './entities/step.js';
|
|
6
|
+
|
|
7
|
+
function lease(params: Partial<JobLeaseTokenClaims> = {}): JobLeaseTokenClaims {
|
|
8
|
+
const now = Math.floor(Date.now() / 1000);
|
|
9
|
+
return {
|
|
10
|
+
aud: 'runner-job-lease',
|
|
11
|
+
iat: now,
|
|
12
|
+
exp: now + 60,
|
|
13
|
+
workspaceId: crypto.randomUUID(),
|
|
14
|
+
projectId: crypto.randomUUID(),
|
|
15
|
+
workflowRunId: crypto.randomUUID(),
|
|
16
|
+
workflowRunAttempt: 1,
|
|
17
|
+
workflowRunAttemptId: crypto.randomUUID(),
|
|
18
|
+
jobId: crypto.randomUUID(),
|
|
19
|
+
jobExecutionId: crypto.randomUUID(),
|
|
20
|
+
runnerSessionId: crypto.randomUUID(),
|
|
21
|
+
currentStepId: crypto.randomUUID(),
|
|
22
|
+
currentStepAttempt: 1,
|
|
23
|
+
...params,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function agentStep(params: Partial<Step> = {}): Step {
|
|
28
|
+
return {
|
|
29
|
+
id: crypto.randomUUID(),
|
|
30
|
+
jobExecutionId: crypto.randomUUID(),
|
|
31
|
+
key: 'fix',
|
|
32
|
+
name: 'Fix',
|
|
33
|
+
sourceLocation: null,
|
|
34
|
+
status: 'running',
|
|
35
|
+
statusReason: null,
|
|
36
|
+
evaluationTrace: null,
|
|
37
|
+
type: 'agent',
|
|
38
|
+
config: {
|
|
39
|
+
harness: 'pi',
|
|
40
|
+
provider: 'anthropic',
|
|
41
|
+
model: 'claude-opus-4-8',
|
|
42
|
+
thinking: 'high',
|
|
43
|
+
tools: ['read', 'web_search'],
|
|
44
|
+
prompt: 'Fix it.',
|
|
45
|
+
},
|
|
46
|
+
condition: null,
|
|
47
|
+
configPlan: null,
|
|
48
|
+
authoredConfig: null,
|
|
49
|
+
error: null,
|
|
50
|
+
position: 0,
|
|
51
|
+
version: 1,
|
|
52
|
+
currentAttempt: 1,
|
|
53
|
+
createdAt: new Date(),
|
|
54
|
+
updatedAt: new Date(),
|
|
55
|
+
...params,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function insertRunnerSession(params: {
|
|
60
|
+
runnerSessionId: string;
|
|
61
|
+
workspaceId: string;
|
|
62
|
+
toolCapabilities: Record<string, unknown> | null;
|
|
63
|
+
reportedAt?: 'fresh' | 'stale' | 'missing';
|
|
64
|
+
}): Promise<void> {
|
|
65
|
+
const reportedAt =
|
|
66
|
+
params.reportedAt === 'missing'
|
|
67
|
+
? sql`NULL`
|
|
68
|
+
: params.reportedAt === 'stale'
|
|
69
|
+
? sql`now() - interval '1 hour'`
|
|
70
|
+
: sql`now()`;
|
|
71
|
+
const toolCapabilities =
|
|
72
|
+
params.toolCapabilities === null
|
|
73
|
+
? sql`NULL`
|
|
74
|
+
: sql`${JSON.stringify(params.toolCapabilities)}::jsonb`;
|
|
75
|
+
|
|
76
|
+
await db().execute(sql`
|
|
77
|
+
INSERT INTO runners_runner_sessions (
|
|
78
|
+
id,
|
|
79
|
+
workspace_id,
|
|
80
|
+
scope,
|
|
81
|
+
registration_token_id,
|
|
82
|
+
registration_token_kind,
|
|
83
|
+
labels,
|
|
84
|
+
tool_capabilities,
|
|
85
|
+
tool_capabilities_reported_at
|
|
86
|
+
)
|
|
87
|
+
VALUES (
|
|
88
|
+
${params.runnerSessionId},
|
|
89
|
+
${params.workspaceId},
|
|
90
|
+
'workspace',
|
|
91
|
+
${crypto.randomUUID()},
|
|
92
|
+
'manual',
|
|
93
|
+
ARRAY['linux'],
|
|
94
|
+
${toolCapabilities},
|
|
95
|
+
${reportedAt}
|
|
96
|
+
)
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function annotationsFor(
|
|
101
|
+
jobExecutionId: string,
|
|
102
|
+
): Promise<Array<{context: string; body: string}>> {
|
|
103
|
+
const result = await db().execute<{context: string; body: string}>(sql`
|
|
104
|
+
SELECT context, body
|
|
105
|
+
FROM annotations_annotations
|
|
106
|
+
WHERE job_execution_id = ${jobExecutionId}
|
|
107
|
+
ORDER BY sequence
|
|
108
|
+
`);
|
|
109
|
+
return [...result.rows];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
describe('warnAgentToolCapabilityMismatchOnDispatch', () => {
|
|
113
|
+
it('writes a warning when the matched runner advertised a set without requested tools', async () => {
|
|
114
|
+
const identity = lease();
|
|
115
|
+
const step = agentStep({jobExecutionId: identity.jobExecutionId});
|
|
116
|
+
await insertRunnerSession({
|
|
117
|
+
runnerSessionId: identity.runnerSessionId,
|
|
118
|
+
workspaceId: identity.workspaceId,
|
|
119
|
+
toolCapabilities: {harnesses: {pi: {tools: ['read']}}},
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
123
|
+
|
|
124
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
125
|
+
expect(rows).toHaveLength(1);
|
|
126
|
+
expect(rows[0]?.context).toBe(`agent-tool-capability:${step.id}`);
|
|
127
|
+
expect(rows[0]?.body).toContain('advertised a `pi` tool set without: `web_search`');
|
|
128
|
+
expect(rows[0]?.body).toContain('Execution is continuing');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('writes unknown wording when capabilities are missing', async () => {
|
|
132
|
+
const identity = lease();
|
|
133
|
+
const step = agentStep({jobExecutionId: identity.jobExecutionId});
|
|
134
|
+
await insertRunnerSession({
|
|
135
|
+
runnerSessionId: identity.runnerSessionId,
|
|
136
|
+
workspaceId: identity.workspaceId,
|
|
137
|
+
toolCapabilities: null,
|
|
138
|
+
reportedAt: 'missing',
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
142
|
+
|
|
143
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
144
|
+
expect(rows[0]?.body).toContain('reported no or stale tool capabilities');
|
|
145
|
+
expect(rows[0]?.body).toContain('`read`, `web_search`');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('writes missing-harness wording when fresh capabilities omit the harness', async () => {
|
|
149
|
+
const identity = lease();
|
|
150
|
+
const step = agentStep({jobExecutionId: identity.jobExecutionId});
|
|
151
|
+
await insertRunnerSession({
|
|
152
|
+
runnerSessionId: identity.runnerSessionId,
|
|
153
|
+
workspaceId: identity.workspaceId,
|
|
154
|
+
toolCapabilities: {harnesses: {claude: {tools: ['read', 'web_search']}}},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
158
|
+
|
|
159
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
160
|
+
expect(rows[0]?.body).toContain('did not advertise a `pi` tool set');
|
|
161
|
+
expect(rows[0]?.body).not.toContain('reported no or stale tool capabilities');
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('uses Markdown-safe code spans for requested tool names', async () => {
|
|
165
|
+
const identity = lease();
|
|
166
|
+
const step = agentStep({
|
|
167
|
+
jobExecutionId: identity.jobExecutionId,
|
|
168
|
+
config: {
|
|
169
|
+
harness: 'pi',
|
|
170
|
+
provider: 'anthropic',
|
|
171
|
+
model: 'claude-opus-4-8',
|
|
172
|
+
thinking: 'high',
|
|
173
|
+
tools: ['read', 'we`ird'],
|
|
174
|
+
prompt: 'Fix it.',
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
await insertRunnerSession({
|
|
178
|
+
runnerSessionId: identity.runnerSessionId,
|
|
179
|
+
workspaceId: identity.workspaceId,
|
|
180
|
+
toolCapabilities: {harnesses: {pi: {tools: ['read']}}},
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
184
|
+
|
|
185
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
186
|
+
expect(rows[0]?.body).toContain('``we`ird``');
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('removes an existing warning when a later dispatch has all requested tools', async () => {
|
|
190
|
+
const identity = lease();
|
|
191
|
+
const step = agentStep({jobExecutionId: identity.jobExecutionId});
|
|
192
|
+
await insertRunnerSession({
|
|
193
|
+
runnerSessionId: identity.runnerSessionId,
|
|
194
|
+
workspaceId: identity.workspaceId,
|
|
195
|
+
toolCapabilities: {harnesses: {pi: {tools: ['read']}}},
|
|
196
|
+
});
|
|
197
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
198
|
+
await db().execute(sql`
|
|
199
|
+
UPDATE runners_runner_sessions
|
|
200
|
+
SET tool_capabilities = ${JSON.stringify({
|
|
201
|
+
harnesses: {pi: {tools: ['read', 'web_search']}},
|
|
202
|
+
})}::jsonb,
|
|
203
|
+
tool_capabilities_reported_at = now()
|
|
204
|
+
WHERE id = ${identity.runnerSessionId}
|
|
205
|
+
`);
|
|
206
|
+
|
|
207
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
208
|
+
|
|
209
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
210
|
+
expect(rows).toEqual([]);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('does nothing for agent steps without requested tools', async () => {
|
|
214
|
+
const identity = lease();
|
|
215
|
+
const step = agentStep({
|
|
216
|
+
jobExecutionId: identity.jobExecutionId,
|
|
217
|
+
config: {
|
|
218
|
+
harness: 'pi',
|
|
219
|
+
provider: 'anthropic',
|
|
220
|
+
model: 'claude-opus-4-8',
|
|
221
|
+
thinking: 'high',
|
|
222
|
+
prompt: 'Fix it.',
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
await insertRunnerSession({
|
|
226
|
+
runnerSessionId: identity.runnerSessionId,
|
|
227
|
+
workspaceId: identity.workspaceId,
|
|
228
|
+
toolCapabilities: null,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
232
|
+
|
|
233
|
+
expect(await annotationsFor(identity.jobExecutionId)).toEqual([]);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('does nothing for non-agent steps', async () => {
|
|
237
|
+
const identity = lease();
|
|
238
|
+
const step = agentStep({
|
|
239
|
+
jobExecutionId: identity.jobExecutionId,
|
|
240
|
+
type: 'run',
|
|
241
|
+
config: {run: 'echo ok'},
|
|
242
|
+
});
|
|
243
|
+
await insertRunnerSession({
|
|
244
|
+
runnerSessionId: identity.runnerSessionId,
|
|
245
|
+
workspaceId: identity.workspaceId,
|
|
246
|
+
toolCapabilities: null,
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
250
|
+
|
|
251
|
+
expect(await annotationsFor(identity.jobExecutionId)).toEqual([]);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('caps long tool lists in the warning body', async () => {
|
|
255
|
+
const identity = lease();
|
|
256
|
+
const tools = Array.from({length: 12}, (_, index) => `tool_${index}`);
|
|
257
|
+
const step = agentStep({
|
|
258
|
+
jobExecutionId: identity.jobExecutionId,
|
|
259
|
+
config: {
|
|
260
|
+
harness: 'pi',
|
|
261
|
+
provider: 'anthropic',
|
|
262
|
+
model: 'claude-opus-4-8',
|
|
263
|
+
thinking: 'high',
|
|
264
|
+
tools,
|
|
265
|
+
prompt: 'Fix it.',
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
await insertRunnerSession({
|
|
269
|
+
runnerSessionId: identity.runnerSessionId,
|
|
270
|
+
workspaceId: identity.workspaceId,
|
|
271
|
+
toolCapabilities: {harnesses: {pi: {tools: []}}},
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
await warnAgentToolCapabilityMismatchOnDispatch({leaseIdentity: identity, step});
|
|
275
|
+
|
|
276
|
+
const rows = await annotationsFor(identity.jobExecutionId);
|
|
277
|
+
expect(rows[0]?.body).toContain('...and 2 more');
|
|
278
|
+
expect(rows[0]?.body).not.toContain('tool_10');
|
|
279
|
+
});
|
|
280
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnnotationBodyTooLargeError,
|
|
3
|
+
AnnotationCountLimitExceededError,
|
|
4
|
+
AnnotationTotalBytesLimitExceededError,
|
|
5
|
+
type WriteAnnotationsParams,
|
|
6
|
+
writeAnnotations,
|
|
7
|
+
} from '@shipfox/annotations';
|
|
8
|
+
import {
|
|
9
|
+
harnessSchema,
|
|
10
|
+
type MaterializedAgentStepConfigDto,
|
|
11
|
+
materializedAgentStepConfigSchema,
|
|
12
|
+
} from '@shipfox/api-agent-dto';
|
|
13
|
+
import type {LeasedJobContext} from '@shipfox/api-auth-context';
|
|
14
|
+
import {getEffectiveRunnerToolCapabilities, unadvertisedRunnerTools} from '@shipfox/api-runners';
|
|
15
|
+
import {logger} from '@shipfox/node-opentelemetry';
|
|
16
|
+
import {recordWorkflowAgentToolWarningFailed} from '#metrics/instance.js';
|
|
17
|
+
import type {Step} from './entities/step.js';
|
|
18
|
+
|
|
19
|
+
const TOOL_LIST_LIMIT = 10;
|
|
20
|
+
|
|
21
|
+
type WarningFailureReason = 'budget' | 'lookup' | 'write';
|
|
22
|
+
type WarningReason = 'known-absence' | 'harness-not-advertised' | 'unknown-or-stale';
|
|
23
|
+
|
|
24
|
+
export async function warnAgentToolCapabilityMismatchOnDispatch(params: {
|
|
25
|
+
leaseIdentity: LeasedJobContext;
|
|
26
|
+
step: Step;
|
|
27
|
+
}): Promise<void> {
|
|
28
|
+
const config = parseAgentConfig(params.step);
|
|
29
|
+
if (!config) return;
|
|
30
|
+
|
|
31
|
+
const requestedTools = config.tools ?? [];
|
|
32
|
+
if (requestedTools.length === 0) return;
|
|
33
|
+
|
|
34
|
+
const harness = harnessSchema.safeParse(config.harness);
|
|
35
|
+
if (!harness.success) return;
|
|
36
|
+
|
|
37
|
+
let effective: Awaited<ReturnType<typeof getEffectiveRunnerToolCapabilities>>;
|
|
38
|
+
try {
|
|
39
|
+
effective = await getEffectiveRunnerToolCapabilities({
|
|
40
|
+
runnerSessionId: params.leaseIdentity.runnerSessionId,
|
|
41
|
+
});
|
|
42
|
+
} catch (error) {
|
|
43
|
+
recordWarningWriteFailure('lookup');
|
|
44
|
+
logger().warn(
|
|
45
|
+
{error, jobExecutionId: params.leaseIdentity.jobExecutionId, stepId: params.step.id},
|
|
46
|
+
'Failed to read runner tool capabilities for agent tool warning',
|
|
47
|
+
);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const missing = unadvertisedRunnerTools({
|
|
52
|
+
harness: harness.data,
|
|
53
|
+
requestedTools,
|
|
54
|
+
capabilities: effective.capabilities,
|
|
55
|
+
});
|
|
56
|
+
const context = `agent-tool-capability:${params.step.id}`;
|
|
57
|
+
|
|
58
|
+
const operation =
|
|
59
|
+
missing.length === 0
|
|
60
|
+
? {context, style: 'warning' as const, op: 'remove' as const}
|
|
61
|
+
: {
|
|
62
|
+
context,
|
|
63
|
+
style: 'warning' as const,
|
|
64
|
+
op: 'replace' as const,
|
|
65
|
+
body: warningBody({
|
|
66
|
+
harness: harness.data,
|
|
67
|
+
missing,
|
|
68
|
+
reason: warningReason({
|
|
69
|
+
reportFresh: effective.reportFresh,
|
|
70
|
+
harnessKnown: effective.harnessKnown(harness.data),
|
|
71
|
+
}),
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
await writeAnnotations({
|
|
77
|
+
...writeParamsFromLease(params.leaseIdentity),
|
|
78
|
+
originStepId: params.step.id,
|
|
79
|
+
originStepAttempt: params.step.currentAttempt,
|
|
80
|
+
operations: [operation],
|
|
81
|
+
});
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const reason = isAnnotationBudgetError(error) ? 'budget' : 'write';
|
|
84
|
+
recordWarningWriteFailure(reason);
|
|
85
|
+
logger().warn(
|
|
86
|
+
{
|
|
87
|
+
error,
|
|
88
|
+
reason,
|
|
89
|
+
jobExecutionId: params.leaseIdentity.jobExecutionId,
|
|
90
|
+
stepId: params.step.id,
|
|
91
|
+
},
|
|
92
|
+
'Failed to write agent tool capability warning annotation',
|
|
93
|
+
);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (missing.length > 0) {
|
|
98
|
+
logger().warn(
|
|
99
|
+
{
|
|
100
|
+
jobExecutionId: params.leaseIdentity.jobExecutionId,
|
|
101
|
+
stepId: params.step.id,
|
|
102
|
+
harness: harness.data,
|
|
103
|
+
missing,
|
|
104
|
+
reason: warningReason({
|
|
105
|
+
reportFresh: effective.reportFresh,
|
|
106
|
+
harnessKnown: effective.harnessKnown(harness.data),
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
'Runner missing requested agent tools; dispatch is continuing',
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function parseAgentConfig(step: Step): MaterializedAgentStepConfigDto | null {
|
|
115
|
+
if (step.type !== 'agent') return null;
|
|
116
|
+
|
|
117
|
+
const parsed = materializedAgentStepConfigSchema.safeParse(step.config);
|
|
118
|
+
return parsed.success ? parsed.data : null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function warningBody(params: {
|
|
122
|
+
harness: string;
|
|
123
|
+
missing: readonly string[];
|
|
124
|
+
reason: WarningReason;
|
|
125
|
+
}): string {
|
|
126
|
+
const tools = formatToolList(params.missing);
|
|
127
|
+
const harness = markdownInlineCode(params.harness);
|
|
128
|
+
if (params.reason === 'known-absence') {
|
|
129
|
+
return [
|
|
130
|
+
'**Runner missing requested agent tools**',
|
|
131
|
+
'',
|
|
132
|
+
`The matched runner advertised a ${harness} tool set without: ${tools}.`,
|
|
133
|
+
'Execution is continuing on this runner because labels matched; the step may fail if the harness cannot provide these tools.',
|
|
134
|
+
].join('\n');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (params.reason === 'harness-not-advertised') {
|
|
138
|
+
return [
|
|
139
|
+
'**Runner missing requested agent harness tools**',
|
|
140
|
+
'',
|
|
141
|
+
`The matched runner advertised fresh tool capabilities, but did not advertise a ${harness} tool set. Support for ${tools} could not be confirmed.`,
|
|
142
|
+
'Execution is continuing on this runner because labels matched; the step may fail if the harness cannot provide these tools.',
|
|
143
|
+
].join('\n');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return [
|
|
147
|
+
'**Could not confirm runner agent tools**',
|
|
148
|
+
'',
|
|
149
|
+
`The matched runner reported no or stale tool capabilities, so support for ${tools} could not be confirmed.`,
|
|
150
|
+
'Execution is continuing on this runner because labels matched.',
|
|
151
|
+
].join('\n');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function formatToolList(tools: readonly string[]): string {
|
|
155
|
+
const visible = tools.slice(0, TOOL_LIST_LIMIT).map(markdownInlineCode);
|
|
156
|
+
const remaining = tools.length - visible.length;
|
|
157
|
+
return remaining > 0 ? `${visible.join(', ')} ...and ${remaining} more` : visible.join(', ');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function markdownInlineCode(value: string): string {
|
|
161
|
+
const maxBacktickRun = Math.max(
|
|
162
|
+
0,
|
|
163
|
+
...Array.from(value.matchAll(/`+/g), (match) => match[0].length),
|
|
164
|
+
);
|
|
165
|
+
const delimiter = '`'.repeat(maxBacktickRun + 1);
|
|
166
|
+
const needsPadding = value.startsWith('`') || value.endsWith('`');
|
|
167
|
+
const content = needsPadding ? ` ${value} ` : value;
|
|
168
|
+
return `${delimiter}${content}${delimiter}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function warningReason(params: {reportFresh: boolean; harnessKnown: boolean}): WarningReason {
|
|
172
|
+
if (params.harnessKnown) return 'known-absence';
|
|
173
|
+
return params.reportFresh ? 'harness-not-advertised' : 'unknown-or-stale';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function writeParamsFromLease(
|
|
177
|
+
lease: LeasedJobContext,
|
|
178
|
+
): Omit<WriteAnnotationsParams, 'originStepId' | 'originStepAttempt' | 'operations'> {
|
|
179
|
+
return {
|
|
180
|
+
workspaceId: lease.workspaceId,
|
|
181
|
+
projectId: lease.projectId,
|
|
182
|
+
workflowRunId: lease.workflowRunId,
|
|
183
|
+
workflowRunAttempt: lease.workflowRunAttempt ?? 1,
|
|
184
|
+
workflowRunAttemptId: lease.workflowRunAttemptId,
|
|
185
|
+
jobId: lease.jobId,
|
|
186
|
+
jobExecutionId: lease.jobExecutionId,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isAnnotationBudgetError(error: unknown): boolean {
|
|
191
|
+
return (
|
|
192
|
+
error instanceof AnnotationBodyTooLargeError ||
|
|
193
|
+
error instanceof AnnotationCountLimitExceededError ||
|
|
194
|
+
error instanceof AnnotationTotalBytesLimitExceededError
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function recordWarningWriteFailure(reason: WarningFailureReason): void {
|
|
199
|
+
recordWorkflowAgentToolWarningFailed(reason);
|
|
200
|
+
}
|