@shipfox/api-workflows 10.2.0 → 12.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 +8 -8
- package/CHANGELOG.md +117 -0
- package/README.md +75 -0
- package/dist/core/agent-defaults.d.ts +2 -1
- package/dist/core/agent-defaults.d.ts.map +1 -1
- package/dist/core/agent-defaults.js.map +1 -1
- package/dist/core/checkout.d.ts +7 -21
- package/dist/core/checkout.d.ts.map +1 -1
- package/dist/core/checkout.js +122 -41
- package/dist/core/checkout.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +8 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js +13 -1
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job-listener-event.d.ts +2 -0
- package/dist/core/entities/job-listener-event.d.ts.map +1 -1
- package/dist/core/entities/job-listener-event.js.map +1 -1
- package/dist/core/entities/step.d.ts +13 -3
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/entities/step.js +6 -0
- package/dist/core/entities/step.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
- package/dist/core/entities/workflow-run-attempt.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +17 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/errors.d.ts +9 -2
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +10 -5
- package/dist/core/errors.js.map +1 -1
- package/dist/core/job-execution.d.ts.map +1 -1
- package/dist/core/job-execution.js +14 -8
- package/dist/core/job-execution.js.map +1 -1
- package/dist/core/job-transition/decide-job-activation.d.ts +1 -0
- package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -1
- package/dist/core/job-transition/decide-job-activation.js +1 -0
- package/dist/core/job-transition/decide-job-activation.js.map +1 -1
- package/dist/core/job-transition/derive-job-success.d.ts +1 -0
- package/dist/core/job-transition/derive-job-success.d.ts.map +1 -1
- package/dist/core/job-transition/derive-job-success.js +5 -8
- package/dist/core/job-transition/derive-job-success.js.map +1 -1
- package/dist/core/listener-execution-materialization.d.ts +6 -3
- package/dist/core/listener-execution-materialization.d.ts.map +1 -1
- package/dist/core/listener-execution-materialization.js +44 -6
- package/dist/core/listener-execution-materialization.js.map +1 -1
- package/dist/core/resolve-trigger-reference.d.ts +11 -0
- package/dist/core/resolve-trigger-reference.d.ts.map +1 -0
- package/dist/core/resolve-trigger-reference.js +39 -0
- package/dist/core/resolve-trigger-reference.js.map +1 -0
- package/dist/core/run-workflow.d.ts +1 -0
- package/dist/core/run-workflow.d.ts.map +1 -1
- package/dist/core/run-workflow.js +1 -0
- package/dist/core/run-workflow.js.map +1 -1
- package/dist/core/step-config/agent.d.ts +1 -2
- package/dist/core/step-config/agent.d.ts.map +1 -1
- package/dist/core/step-config/agent.js +22 -7
- package/dist/core/step-config/agent.js.map +1 -1
- package/dist/core/step-config/assemble-run-context.d.ts +19 -8
- package/dist/core/step-config/assemble-run-context.d.ts.map +1 -1
- package/dist/core/step-config/assemble-run-context.js +51 -19
- package/dist/core/step-config/assemble-run-context.js.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.js +72 -4
- package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -1
- package/dist/core/step-config/index.d.ts +1 -0
- package/dist/core/step-config/index.d.ts.map +1 -1
- package/dist/core/step-config/index.js +1 -0
- package/dist/core/step-config/index.js.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.d.ts +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.js +49 -8
- package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.d.ts +3 -3
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +9 -5
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.d.ts +3 -3
- package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.js +24 -13
- package/dist/core/step-config/resolve-job-execution-name.js.map +1 -1
- package/dist/core/step-config/resolve-step-config.d.ts.map +1 -1
- package/dist/core/step-config/resolve-step-config.js +174 -9
- package/dist/core/step-config/resolve-step-config.js.map +1 -1
- package/dist/core/step-config/resolve-workflow-run-name.d.ts +19 -0
- package/dist/core/step-config/resolve-workflow-run-name.d.ts.map +1 -0
- package/dist/core/step-config/resolve-workflow-run-name.js +73 -0
- package/dist/core/step-config/resolve-workflow-run-name.js.map +1 -0
- package/dist/core/step-transition/decide-step-transition.js.map +1 -1
- package/dist/core/step-transition/evaluate-gate.d.ts +2 -1
- package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -1
- package/dist/core/step-transition/evaluate-gate.js +5 -3
- package/dist/core/step-transition/evaluate-gate.js.map +1 -1
- package/dist/core/workflow-run-creation.d.ts +3 -0
- package/dist/core/workflow-run-creation.d.ts.map +1 -1
- package/dist/core/workflow-run-creation.js +22 -7
- package/dist/core/workflow-run-creation.js.map +1 -1
- package/dist/db/db.d.ts +278 -10
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +2 -0
- package/dist/db/db.js.map +1 -1
- package/dist/db/index.d.ts +3 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +2 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/job-listener-events.d.ts +2 -0
- package/dist/db/job-listener-events.d.ts.map +1 -1
- package/dist/db/job-listener-events.js +1 -0
- package/dist/db/job-listener-events.js.map +1 -1
- package/dist/db/job-listeners.d.ts +2 -0
- package/dist/db/job-listeners.d.ts.map +1 -1
- package/dist/db/job-listeners.js +81 -21
- package/dist/db/job-listeners.js.map +1 -1
- package/dist/db/schema/job-executions.d.ts +3 -3
- package/dist/db/schema/job-executions.d.ts.map +1 -1
- package/dist/db/schema/job-executions.js +8 -4
- package/dist/db/schema/job-executions.js.map +1 -1
- package/dist/db/schema/job-listener-events.d.ts +20 -0
- package/dist/db/schema/job-listener-events.d.ts.map +1 -1
- package/dist/db/schema/job-listener-events.js +2 -0
- package/dist/db/schema/job-listener-events.js.map +1 -1
- package/dist/db/schema/step-attempts.js +2 -2
- package/dist/db/schema/step-attempts.js.map +1 -1
- package/dist/db/schema/steps.d.ts +4 -2
- package/dist/db/schema/steps.d.ts.map +1 -1
- package/dist/db/schema/steps.js +1 -1
- package/dist/db/schema/steps.js.map +1 -1
- package/dist/db/schema/workflow-run-attempts.d.ts +21 -2
- package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -1
- package/dist/db/schema/workflow-run-attempts.js +2 -0
- package/dist/db/schema/workflow-run-attempts.js.map +1 -1
- package/dist/db/schema/workflow-run-counters.d.ts +43 -0
- package/dist/db/schema/workflow-run-counters.d.ts.map +1 -0
- package/dist/db/schema/workflow-run-counters.js +10 -0
- package/dist/db/schema/workflow-run-counters.js.map +1 -0
- package/dist/db/schema/workflow-runs.d.ts +54 -1
- package/dist/db/schema/workflow-runs.d.ts.map +1 -1
- package/dist/db/schema/workflow-runs.js +10 -2
- package/dist/db/schema/workflow-runs.js.map +1 -1
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +35 -14
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts +2 -0
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +9 -5
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/queries.d.ts +51 -0
- package/dist/db/workflow-runs/queries.d.ts.map +1 -1
- package/dist/db/workflow-runs/queries.js +82 -2
- package/dist/db/workflow-runs/queries.js.map +1 -1
- package/dist/db/workflow-runs/run-create.d.ts +1 -0
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-create.js +159 -32
- package/dist/db/workflow-runs/run-create.js.map +1 -1
- package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-rerun.js +13 -5
- package/dist/db/workflow-runs/run-rerun.js.map +1 -1
- package/dist/db/workflow-runs/shared.d.ts +1 -0
- package/dist/db/workflow-runs/shared.d.ts.map +1 -1
- package/dist/db/workflow-runs/shared.js +2 -1
- package/dist/db/workflow-runs/shared.js.map +1 -1
- package/dist/db/workflow-runs/steps.js +3 -3
- package/dist/db/workflow-runs/steps.js.map +1 -1
- package/dist/db/workflow-runs.d.ts +4 -3
- package/dist/db/workflow-runs.d.ts.map +1 -1
- package/dist/db/workflow-runs.js +3 -2
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/metrics/instance.d.ts +1 -0
- package/dist/metrics/instance.d.ts.map +1 -1
- package/dist/metrics/instance.js +9 -0
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/checkout-token.d.ts +1 -0
- package/dist/presentation/dto/checkout-token.d.ts.map +1 -1
- package/dist/presentation/dto/checkout-token.js +1 -0
- package/dist/presentation/dto/checkout-token.js.map +1 -1
- package/dist/presentation/dto/index.d.ts +1 -1
- package/dist/presentation/dto/index.d.ts.map +1 -1
- package/dist/presentation/dto/index.js +1 -1
- package/dist/presentation/dto/index.js.map +1 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +2 -2
- package/dist/presentation/dto/step.js.map +1 -1
- package/dist/presentation/dto/workflow-run.d.ts +3 -1
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
- package/dist/presentation/dto/workflow-run.js +34 -0
- package/dist/presentation/dto/workflow-run.js.map +1 -1
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +31 -3
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/presentation/routes/checkout-token.d.ts +1 -1
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
- package/dist/presentation/routes/checkout-token.js +32 -20
- package/dist/presentation/routes/checkout-token.js.map +1 -1
- package/dist/presentation/routes/leased-step.d.ts +2 -0
- package/dist/presentation/routes/leased-step.d.ts.map +1 -1
- package/dist/presentation/routes/leased-step.js +2 -1
- package/dist/presentation/routes/leased-step.js.map +1 -1
- package/dist/presentation/routes/list-runs.d.ts.map +1 -1
- package/dist/presentation/routes/list-runs.js +9 -3
- package/dist/presentation/routes/list-runs.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +1 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -1
- package/dist/presentation/routes/report-step.d.ts.map +1 -1
- package/dist/presentation/routes/report-step.js +9 -2
- package/dist/presentation/routes/report-step.js.map +1 -1
- package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -1
- package/dist/presentation/routes/require-accessible-run.js +1 -1
- package/dist/presentation/routes/require-accessible-run.js.map +1 -1
- package/dist/presentation/subscribers/on-job-steps-settled.js +1 -1
- package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -1
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -1
- package/dist/presentation/subscribers/on-runner-job-claimed.js +21 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -1
- package/dist/temporal/activities/index.d.ts.map +1 -1
- package/dist/temporal/activities/index.js +2 -1
- package/dist/temporal/activities/index.js.map +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts +1 -0
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
- package/dist/temporal/activities/orchestration-activities.js.map +1 -1
- package/dist/temporal/constants.d.ts +1 -0
- package/dist/temporal/constants.d.ts.map +1 -1
- package/dist/temporal/constants.js +1 -0
- package/dist/temporal/constants.js.map +1 -1
- package/dist/temporal/index.d.ts +1 -1
- package/dist/temporal/index.d.ts.map +1 -1
- package/dist/temporal/index.js +1 -1
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal/workflows/index.bundle.js +82 -43
- package/dist/temporal/workflows/index.d.ts +1 -1
- package/dist/temporal/workflows/index.d.ts.map +1 -1
- package/dist/temporal/workflows/index.js +1 -1
- package/dist/temporal/workflows/index.js.map +1 -1
- package/dist/temporal/workflows/job-execution-orchestration.d.ts +5 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -1
- package/dist/temporal/workflows/job-execution-orchestration.js +77 -43
- package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -1
- package/dist/temporal/workflows/test-env.d.ts +5 -1
- package/dist/temporal/workflows/test-env.d.ts.map +1 -1
- package/dist/temporal/workflows/test-env.js +32 -11
- package/dist/temporal/workflows/test-env.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0000_initial.sql +14 -2
- package/drizzle/0001_windy_sunfire.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +93 -1
- package/drizzle/meta/0001_snapshot.json +1711 -0
- package/drizzle/meta/_journal.json +2 -2
- package/package.json +21 -21
- package/src/core/agent-defaults.ts +2 -1
- package/src/core/checkout.test.ts +378 -67
- package/src/core/checkout.ts +142 -59
- package/src/core/entities/job-execution.test.ts +21 -0
- package/src/core/entities/job-execution.ts +24 -0
- package/src/core/entities/job-listener-event.ts +3 -0
- package/src/core/entities/step.ts +15 -3
- package/src/core/entities/workflow-run-attempt.ts +1 -0
- package/src/core/entities/workflow-run.ts +16 -0
- package/src/core/errors.ts +21 -7
- package/src/core/job-execution.ts +27 -4
- package/src/core/job-transition/decide-job-activation.test.ts +4 -0
- package/src/core/job-transition/decide-job-activation.ts +2 -0
- package/src/core/job-transition/derive-job-success.test.ts +12 -0
- package/src/core/job-transition/derive-job-success.ts +6 -9
- package/src/core/listener-execution-materialization.test.ts +2 -0
- package/src/core/listener-execution-materialization.ts +57 -11
- package/src/core/resolve-trigger-reference.test.ts +160 -0
- package/src/core/resolve-trigger-reference.ts +53 -0
- package/src/core/run-workflow.ts +2 -0
- package/src/core/step-config/agent.ts +29 -12
- package/src/core/step-config/assemble-run-context.test.ts +149 -6
- package/src/core/step-config/assemble-run-context.ts +87 -25
- package/src/core/step-config/complete-step-dispatch-config.test.ts +125 -2
- package/src/core/step-config/complete-step-dispatch-config.ts +83 -1
- package/src/core/step-config/index.ts +7 -0
- package/src/core/step-config/materialize-job-execution-steps.test.ts +250 -1
- package/src/core/step-config/materialize-job-execution-steps.ts +57 -10
- package/src/core/step-config/materialize-workflow-model.test.ts +212 -4
- package/src/core/step-config/materialize-workflow-model.ts +33 -28
- package/src/core/step-config/resolve-job-execution-name.test.ts +37 -15
- package/src/core/step-config/resolve-job-execution-name.ts +30 -15
- package/src/core/step-config/resolve-step-config.ts +175 -10
- package/src/core/step-config/resolve-workflow-run-name.test.ts +115 -0
- package/src/core/step-config/resolve-workflow-run-name.ts +108 -0
- package/src/core/step-transition/decide-step-transition.ts +2 -2
- package/src/core/step-transition/evaluate-gate.test.ts +8 -0
- package/src/core/step-transition/evaluate-gate.ts +8 -1
- package/src/core/workflow-run-creation.test.ts +7 -4
- package/src/core/workflow-run-creation.ts +13 -7
- package/src/db/db.ts +2 -0
- package/src/db/index.ts +6 -0
- package/src/db/job-listener-events.test.ts +19 -0
- package/src/db/job-listener-events.ts +3 -0
- package/src/db/job-listeners.test.ts +187 -5
- package/src/db/job-listeners.ts +122 -30
- package/src/db/schema/job-executions.ts +12 -5
- package/src/db/schema/job-listener-events.ts +3 -0
- package/src/db/schema/step-attempts.ts +2 -2
- package/src/db/schema/steps.ts +2 -1
- package/src/db/schema/workflow-run-attempts.ts +2 -0
- package/src/db/schema/workflow-run-counters.ts +13 -0
- package/src/db/schema/workflow-runs.ts +11 -2
- package/src/db/workflow-runs/job-executions.ts +37 -15
- package/src/db/workflow-runs/jobs.ts +17 -4
- package/src/db/workflow-runs/queries.test.ts +206 -0
- package/src/db/workflow-runs/queries.ts +146 -2
- package/src/db/workflow-runs/run-create.test.ts +606 -8
- package/src/db/workflow-runs/run-create.ts +185 -40
- package/src/db/workflow-runs/run-rerun.test.ts +61 -2
- package/src/db/workflow-runs/run-rerun.ts +15 -5
- package/src/db/workflow-runs/shared.ts +2 -0
- package/src/db/workflow-runs/steps.ts +3 -3
- package/src/db/workflow-runs.ts +7 -0
- package/src/metrics/instance.ts +14 -0
- package/src/presentation/dto/checkout-token.test.ts +19 -9
- package/src/presentation/dto/checkout-token.ts +2 -1
- package/src/presentation/dto/index.ts +1 -1
- package/src/presentation/dto/job.test.ts +9 -0
- package/src/presentation/dto/step.test.ts +12 -0
- package/src/presentation/dto/step.ts +5 -2
- package/src/presentation/dto/workflow-run.ts +44 -2
- package/src/presentation/inter-module.test.ts +165 -0
- package/src/presentation/inter-module.ts +38 -4
- package/src/presentation/routes/cancel-run.test.ts +1 -1
- package/src/presentation/routes/checkout-token.test.ts +357 -142
- package/src/presentation/routes/checkout-token.ts +56 -26
- package/src/presentation/routes/get-run-aggregates.test.ts +1 -1
- package/src/presentation/routes/get-run.test.ts +29 -1
- package/src/presentation/routes/get-step-secrets.test.ts +7 -2
- package/src/presentation/routes/leased-step.ts +9 -1
- package/src/presentation/routes/list-run-attempts.test.ts +1 -1
- package/src/presentation/routes/list-runs.test.ts +58 -1
- package/src/presentation/routes/list-runs.ts +8 -3
- package/src/presentation/routes/report-step.test.ts +25 -0
- package/src/presentation/routes/report-step.ts +10 -2
- package/src/presentation/routes/require-accessible-run.ts +4 -1
- package/src/presentation/routes/rerun-run.test.ts +1 -1
- package/src/presentation/subscribers/on-job-steps-settled.ts +1 -1
- package/src/presentation/subscribers/on-runner-job-claimed.test.ts +49 -0
- package/src/presentation/subscribers/on-runner-job-claimed.ts +22 -0
- package/src/temporal/activities/index.ts +1 -0
- package/src/temporal/activities/orchestration-activities.ts +1 -0
- package/src/temporal/constants.ts +1 -0
- package/src/temporal/index.ts +1 -0
- package/src/temporal/workflows/index.ts +1 -0
- package/src/temporal/workflows/job-execution-orchestration.test.ts +142 -6
- package/src/temporal/workflows/job-execution-orchestration.ts +99 -50
- package/src/temporal/workflows/run-orchestration.test.ts +1 -1
- package/src/temporal/workflows/test-env.ts +50 -13
- package/test/factories/project.ts +2 -0
- package/test/factories/workflow-model.ts +80 -26
- package/test/factories/workflow-run.ts +4 -1
- package/test/fixtures/agent-inter-module.ts +2 -1
- package/test/fixtures/job-with-steps.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/drizzle/0001_agent_tool_materialization.sql +0 -1
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
type ModelStep = WorkflowModel['jobs'][number]['steps'][number];
|
|
11
11
|
type AgentThinking = Extract<ModelStep, {kind: 'agent'}>['thinking'];
|
|
12
12
|
type Harness = Extract<ModelStep, {kind: 'agent'}>['harness'];
|
|
13
|
+
type Checkout = Extract<ModelStep, {kind: 'checkout'}>['checkout'];
|
|
13
14
|
type WorkflowEnvTemplates = NonNullable<NonNullable<WorkflowModel['templates']>['env']>;
|
|
14
15
|
|
|
15
16
|
interface TestWorkflowStepBase {
|
|
16
17
|
readonly key?: string | undefined;
|
|
17
18
|
readonly name?: string | undefined;
|
|
19
|
+
readonly workingDirectory?: string | undefined;
|
|
18
20
|
readonly sourceLocation?: WorkflowModel['jobs'][number]['steps'][number]['sourceLocation'];
|
|
19
21
|
readonly if?: ModelStep['if'] | undefined;
|
|
20
22
|
readonly gate?: WorkflowModel['jobs'][number]['steps'][number]['gate'] | undefined;
|
|
@@ -35,13 +37,18 @@ interface TestAgentStep extends TestWorkflowStepBase {
|
|
|
35
37
|
readonly integrations?: Extract<ModelStep, {kind: 'agent'}>['integrations'] | undefined;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
interface TestCheckoutStep extends TestWorkflowStepBase {
|
|
41
|
+
readonly checkout: Checkout;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type TestWorkflowStep = TestRunStep | TestAgentStep | TestCheckoutStep;
|
|
39
45
|
|
|
40
46
|
const DEFAULT_RUNNER_LABELS = ['ubuntu-latest'] as const;
|
|
41
47
|
|
|
42
48
|
interface TestWorkflowJob {
|
|
43
49
|
readonly needs?: string | readonly string[] | undefined;
|
|
44
50
|
readonly name?: string | undefined;
|
|
51
|
+
readonly executionName?: string | undefined;
|
|
45
52
|
readonly runner?: string | readonly string[] | undefined;
|
|
46
53
|
readonly runnerTemplates?: readonly string[] | undefined;
|
|
47
54
|
readonly checkout?: WorkflowModel['jobs'][number]['checkout'] | undefined;
|
|
@@ -55,6 +62,7 @@ interface TestWorkflowJob {
|
|
|
55
62
|
|
|
56
63
|
interface TestWorkflowModelInput {
|
|
57
64
|
readonly name?: string | undefined;
|
|
65
|
+
readonly runName?: string | undefined;
|
|
58
66
|
readonly runner?: string | readonly string[] | undefined;
|
|
59
67
|
readonly env?: WorkflowModel['env'] | undefined;
|
|
60
68
|
readonly jobs?: Readonly<Record<string, TestWorkflowJob>> | undefined;
|
|
@@ -84,11 +92,12 @@ export function workflowModel(input: TestWorkflowModelInput = {}): WorkflowModel
|
|
|
84
92
|
...(job.if === undefined ? {} : {if: workflowExpression(job.if)}),
|
|
85
93
|
...(job.success === undefined ? {} : {success: job.success}),
|
|
86
94
|
...(job.outputs === undefined ? {} : {outputs: outputTemplates(job.outputs)}),
|
|
87
|
-
...(job.name === undefined
|
|
95
|
+
...(job.name === undefined ? {} : {name: job.name}),
|
|
96
|
+
...(job.executionName === undefined
|
|
88
97
|
? {}
|
|
89
98
|
: {
|
|
90
|
-
|
|
91
|
-
{kind: 'literal' as const, value: job.
|
|
99
|
+
executionName: fieldTemplate('job.execution_name', job.executionName) ?? [
|
|
100
|
+
{kind: 'literal' as const, value: job.executionName},
|
|
92
101
|
],
|
|
93
102
|
}),
|
|
94
103
|
...(job.listening === undefined ? {} : {listening: job.listening}),
|
|
@@ -101,6 +110,13 @@ export function workflowModel(input: TestWorkflowModelInput = {}): WorkflowModel
|
|
|
101
110
|
return {
|
|
102
111
|
kind: 'workflow',
|
|
103
112
|
name: input.name ?? 'Test Workflow',
|
|
113
|
+
...(input.runName === undefined
|
|
114
|
+
? {}
|
|
115
|
+
: {
|
|
116
|
+
runName: fieldTemplate('workflow.run_name', input.runName) ?? [
|
|
117
|
+
{kind: 'literal' as const, value: input.runName},
|
|
118
|
+
],
|
|
119
|
+
}),
|
|
104
120
|
...optionalScopedEnv(input.env),
|
|
105
121
|
triggers: [],
|
|
106
122
|
jobs: modelJobs,
|
|
@@ -128,26 +144,36 @@ function outputTemplates(outputs: Readonly<Record<string, string>>) {
|
|
|
128
144
|
|
|
129
145
|
function normalizeStep(step: TestWorkflowStep, jobId: string, stepIndex: number): ModelStep {
|
|
130
146
|
const base = stepBase(step, jobId, stepIndex);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
147
|
+
if ('run' in step) {
|
|
148
|
+
return {
|
|
149
|
+
...base,
|
|
150
|
+
kind: 'run',
|
|
151
|
+
command: {kind: 'shell', value: step.run},
|
|
152
|
+
...optionalRunTemplates(step),
|
|
153
|
+
...optionalStepEnv(step.env),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ('prompt' in step) {
|
|
158
|
+
return {
|
|
159
|
+
...base,
|
|
160
|
+
kind: 'agent',
|
|
161
|
+
...(step.harness === undefined ? {} : {harness: step.harness}),
|
|
162
|
+
...(step.model === undefined ? {} : {model: step.model}),
|
|
163
|
+
...(step.provider === undefined ? {} : {provider: step.provider}),
|
|
164
|
+
...(step.thinking === undefined ? {} : {thinking: step.thinking}),
|
|
165
|
+
...(step.tools === undefined ? {} : {tools: step.tools}),
|
|
166
|
+
...(step.integrations === undefined ? {} : {integrations: step.integrations}),
|
|
167
|
+
prompt: step.prompt,
|
|
168
|
+
...optionalAgentTemplates(step),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
...base,
|
|
174
|
+
kind: 'checkout',
|
|
175
|
+
checkout: step.checkout,
|
|
176
|
+
};
|
|
151
177
|
}
|
|
152
178
|
|
|
153
179
|
function stepBase(step: TestWorkflowStep, jobId: string, stepIndex: number) {
|
|
@@ -156,6 +182,7 @@ function stepBase(step: TestWorkflowStep, jobId: string, stepIndex: number) {
|
|
|
156
182
|
step.key === undefined ? `${jobId}-step-${stepIndex + 1}` : `${jobId}-${stableId(step.key)}`,
|
|
157
183
|
...(step.key === undefined ? {} : {key: step.key}),
|
|
158
184
|
...(step.name === undefined ? {} : {name: step.name}),
|
|
185
|
+
...(step.workingDirectory === undefined ? {} : {workingDirectory: step.workingDirectory}),
|
|
159
186
|
...(step.sourceLocation === undefined ? {} : {sourceLocation: step.sourceLocation}),
|
|
160
187
|
...(step.if === undefined ? {} : {if: step.if}),
|
|
161
188
|
...(step.gate === undefined ? {} : {gate: step.gate}),
|
|
@@ -188,12 +215,24 @@ function optionalStepEnv(
|
|
|
188
215
|
function optionalRunTemplates(step: TestRunStep) {
|
|
189
216
|
const command = fieldTemplate('run', step.run);
|
|
190
217
|
const name = step.name === undefined ? undefined : fieldTemplate('step.name', step.name);
|
|
218
|
+
const workingDirectory =
|
|
219
|
+
step.workingDirectory === undefined
|
|
220
|
+
? undefined
|
|
221
|
+
: fieldTemplate('step.working_directory', step.workingDirectory);
|
|
191
222
|
const env = envTemplates(step.env);
|
|
192
|
-
if (
|
|
223
|
+
if (
|
|
224
|
+
command === undefined &&
|
|
225
|
+
name === undefined &&
|
|
226
|
+
workingDirectory === undefined &&
|
|
227
|
+
env === undefined
|
|
228
|
+
) {
|
|
229
|
+
return {};
|
|
230
|
+
}
|
|
193
231
|
return {
|
|
194
232
|
templates: {
|
|
195
233
|
...(command === undefined ? {} : {command}),
|
|
196
234
|
...(name === undefined ? {} : {name}),
|
|
235
|
+
...(workingDirectory === undefined ? {} : {workingDirectory}),
|
|
197
236
|
...(env === undefined ? {} : {env}),
|
|
198
237
|
},
|
|
199
238
|
};
|
|
@@ -204,8 +243,21 @@ function optionalAgentTemplates(step: TestAgentStep) {
|
|
|
204
243
|
const model = step.model === undefined ? undefined : fieldTemplate('agent.model', step.model);
|
|
205
244
|
const provider =
|
|
206
245
|
step.provider === undefined ? undefined : fieldTemplate('agent.provider', step.provider);
|
|
246
|
+
const thinking =
|
|
247
|
+
step.thinking === undefined ? undefined : fieldTemplate('agent.thinking', step.thinking);
|
|
207
248
|
const name = step.name === undefined ? undefined : fieldTemplate('step.name', step.name);
|
|
208
|
-
|
|
249
|
+
const workingDirectory =
|
|
250
|
+
step.workingDirectory === undefined
|
|
251
|
+
? undefined
|
|
252
|
+
: fieldTemplate('step.working_directory', step.workingDirectory);
|
|
253
|
+
if (
|
|
254
|
+
prompt === undefined &&
|
|
255
|
+
model === undefined &&
|
|
256
|
+
provider === undefined &&
|
|
257
|
+
thinking === undefined &&
|
|
258
|
+
name === undefined &&
|
|
259
|
+
workingDirectory === undefined
|
|
260
|
+
) {
|
|
209
261
|
return {};
|
|
210
262
|
}
|
|
211
263
|
return {
|
|
@@ -213,7 +265,9 @@ function optionalAgentTemplates(step: TestAgentStep) {
|
|
|
213
265
|
...(prompt === undefined ? {} : {prompt}),
|
|
214
266
|
...(model === undefined ? {} : {model}),
|
|
215
267
|
...(provider === undefined ? {} : {provider}),
|
|
268
|
+
...(thinking === undefined ? {} : {thinking}),
|
|
216
269
|
...(name === undefined ? {} : {name}),
|
|
270
|
+
...(workingDirectory === undefined ? {} : {workingDirectory}),
|
|
217
271
|
},
|
|
218
272
|
};
|
|
219
273
|
}
|
|
@@ -19,7 +19,7 @@ export const workflowRunFactory = Factory.define<WorkflowRun, WorkflowRunTransie
|
|
|
19
19
|
workspaceId: run.workspaceId,
|
|
20
20
|
projectId: run.projectId,
|
|
21
21
|
definitionId: run.definitionId,
|
|
22
|
-
name: run.
|
|
22
|
+
name: run.workflowName,
|
|
23
23
|
model: transientParams.model ?? workflowModel({name: run.name}),
|
|
24
24
|
triggerPayload: run.triggerPayload,
|
|
25
25
|
inputs: run.inputs ?? undefined,
|
|
@@ -32,7 +32,10 @@ export const workflowRunFactory = Factory.define<WorkflowRun, WorkflowRunTransie
|
|
|
32
32
|
workspaceId,
|
|
33
33
|
projectId,
|
|
34
34
|
definitionId,
|
|
35
|
+
number: 1,
|
|
35
36
|
name: 'Test Workflow',
|
|
37
|
+
workflowName: 'Test Workflow',
|
|
38
|
+
nameOverride: null,
|
|
36
39
|
status: 'pending',
|
|
37
40
|
currentAttempt: 1,
|
|
38
41
|
triggerProvider: null,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
AgentInterModuleClient,
|
|
10
10
|
AgentValidationCatalog,
|
|
11
11
|
} from '@shipfox/api-agent-dto/inter-module';
|
|
12
|
+
import {agentThinkingSchema} from '@shipfox/workflow-document';
|
|
12
13
|
import type {AgentDefaultsResolver} from '#core/agent-defaults.js';
|
|
13
14
|
|
|
14
15
|
export const agentValidationCatalog: AgentValidationCatalog = {
|
|
@@ -53,6 +54,6 @@ export const resolveTestAgentDefaults: AgentDefaultsResolver = (config) => {
|
|
|
53
54
|
harness: config.harness ?? 'pi',
|
|
54
55
|
provider,
|
|
55
56
|
model: config.model ?? (provider === 'openai' ? 'gpt-5.5-pro' : 'claude-opus-4-8'),
|
|
56
|
-
thinking: config.thinking ?? 'xhigh',
|
|
57
|
+
thinking: agentThinkingSchema.safeParse(config.thinking).data ?? 'xhigh',
|
|
57
58
|
};
|
|
58
59
|
};
|
|
@@ -3,7 +3,7 @@ import {createWorkflowRun, getJobsByWorkflowRunId, getStepsByJobId} from '#db/wo
|
|
|
3
3
|
import {stripSetupStep} from '#test/fixtures/strip-setup-step.js';
|
|
4
4
|
import {workflowModel} from '#test/index.js';
|
|
5
5
|
|
|
6
|
-
// Jobs and steps have no standalone factory
|
|
6
|
+
// Jobs and steps have no standalone factory: they only exist as children
|
|
7
7
|
// materialized from a WorkflowModel by createWorkflowRun, which also prepends a
|
|
8
8
|
// synthetic "Set up job" step to every job. This fixture exercises step-execution
|
|
9
9
|
// mechanics in isolation, so it strips that step (see stripSetupStep) to keep the
|