@shipfox/api-workflows 11.0.0 → 12.1.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 +107 -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/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 +19 -19
- 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/checkout-token.test.ts +357 -142
- package/src/presentation/routes/checkout-token.ts +56 -26
- package/src/presentation/routes/get-run.test.ts +2 -0
- 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-runs.test.ts +57 -0
- 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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/step-config/agent.ts"],"sourcesContent":["import {\n AGENT_INTEGRATION_MCP_AUTH,\n AGENT_INTEGRATION_MCP_ENDPOINT,\n AGENT_INTEGRATION_MCP_SERVER_NAME,\n AGENT_INTEGRATION_MCP_TRANSPORT,\n type AgentIntegrationMcpServerConfigDto,\n type MaterializedAgentIntegrationConfigDto,\n} from '@shipfox/api-agent-dto';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport type {WorkflowModel} from '@shipfox/api-definitions-dto';\nimport type {ResolvedField, SiteResolvedField} from '@shipfox/expression';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport type {AgentThinking} from '@shipfox/workflow-document';\nimport type {AgentDefaultsResolver, ResolvedAgentDefaults} from '#core/agent-defaults.js';\nimport {\n type AgentToolMaterializationContext,\n type AgentToolMaterializationSnapshot,\n materializeAgentIntegrations,\n} from '#core/agent-tools.js';\nimport type {PersistedEvaluationTraceEntry, StepConfigDispatchPlan} from '#core/entities/step.js';\nimport {AgentConfigUnresolvableError} from '#core/errors.js';\nimport {\n completeStepFieldWithTrace,\n literalField,\n resolveStepField,\n type WorkflowStepEvaluationTraceEntry,\n type WorkflowStepTemplateDiagnostic,\n} from './fields.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\ntype WorkflowModelJob = WorkflowModel['jobs'][number];\ntype WorkflowModelStep = WorkflowModelJob['steps'][number];\ntype WorkflowModelAgentStep = Extract<WorkflowModelStep, {kind: 'agent'}>;\ntype StepConfigMode = 'effective' | 'authored';\ntype FieldResolution =\n | {readonly kind: 'frozen'; readonly value: string}\n | {readonly kind: 'residual'; readonly field: ResolvedField};\n\ninterface AgentFieldResolutions {\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly prompt: FieldResolution;\n readonly model: FieldResolution | undefined;\n readonly provider: FieldResolution | undefined;\n readonly hasTemplates: boolean;\n}\n\nexport interface ResolveAgentStepConfigParams {\n readonly jobKey: string;\n readonly step: WorkflowModelAgentStep;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly definitionId: string;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly agentToolContext?: AgentToolMaterializationContext | undefined;\n readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;\n}\n\nexport interface AgentStepConfig {\n readonly config: Record<string, unknown>;\n readonly configPlan: StepConfigDispatchPlan | null;\n readonly diagnostics: readonly WorkflowStepTemplateDiagnostic[];\n readonly trace: readonly WorkflowStepEvaluationTraceEntry[];\n readonly hasTemplates: boolean;\n}\n\nexport async function resolveAgentStepConfig(\n params: ResolveAgentStepConfigParams,\n): Promise<AgentStepConfig> {\n const fields = resolveAgentFields(params);\n const usesAuthoredMode = params.mode === 'authored';\n\n if (usesAuthoredMode) return authoredAgentStepConfig(params.step, fields);\n\n const hasDeferredModelOrProvider =\n fields.model?.kind === 'residual' || fields.provider?.kind === 'residual';\n if (hasDeferredModelOrProvider) return deferredAgentStepConfig(params, fields);\n\n return await agentStepConfigWithDefaults(params.step, params, fields);\n}\n\nexport async function completeAgentConfig(params: {\n readonly config: Record<string, unknown>;\n readonly plan: StepConfigDispatchPlan;\n readonly context: WorkflowEvaluationContext;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId: string;\n readonly trace: PersistedEvaluationTraceEntry[];\n}): Promise<void> {\n const agent = params.plan.agent;\n if (agent === undefined) return;\n\n const prompt =\n agent.prompt === undefined\n ? readConfigString(params.config, 'prompt')\n : completeAgentField({\n field: 'agent.prompt',\n template: agent.prompt,\n params,\n });\n const model =\n agent.model === undefined\n ? readConfigString(params.config, 'model')\n : completeAgentField({\n field: 'agent.model',\n template: agent.model,\n params,\n });\n const provider =\n agent.provider === undefined\n ? readConfigString(params.config, 'provider')\n : completeAgentField({\n field: 'agent.provider',\n template: agent.provider,\n params,\n });\n\n const defaults = await completeAgentDefaults({\n harness: agent.harness ?? readConfigHarness(params.config),\n provider,\n model,\n thinking: agent.thinking ?? readConfigThinking(params.config),\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n });\n params.config.harness = defaults.harness;\n params.config.provider = defaults.provider;\n params.config.model = defaults.model;\n params.config.thinking = defaults.thinking;\n params.config.prompt = prompt;\n if (agent.tools !== undefined) params.config.tools = [...agent.tools];\n const integrations = agent.integrations === undefined ? undefined : [...agent.integrations];\n if (integrations !== undefined) params.config.integrations = integrations;\n const mcpServers =\n agent.mcpServers ??\n (integrations === undefined ? undefined : agentIntegrationMcpServers(integrations));\n if (mcpServers !== undefined) params.config.mcpServers = [...mcpServers];\n}\n\nfunction completeAgentField(args: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider';\n readonly template: ResolvedField;\n readonly params: {\n readonly context: WorkflowEvaluationContext;\n readonly definitionId: string;\n readonly trace: PersistedEvaluationTraceEntry[];\n };\n}): string {\n const resolved = completeStepFieldWithTrace({\n field: args.field,\n errorField: args.field,\n template: args.template,\n context: args.params.context,\n definitionId: args.params.definitionId,\n });\n args.params.trace.push(...resolved.trace.map((entry) => ({...entry, field: args.field})));\n return resolved.value;\n}\n\nexport async function completeAgentDefaults(params: {\n readonly harness: WorkflowModelAgentStep['harness'] | undefined;\n readonly provider: string | undefined;\n readonly model: string | undefined;\n readonly thinking: AgentThinking | undefined;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId: string;\n}): Promise<ResolvedAgentDefaults> {\n if (!params.resolveAgentDefaults) throw new Error('Agent defaults resolver is required');\n\n try {\n return await params.resolveAgentDefaults({\n harness: params.harness,\n provider: params.provider,\n model: params.model,\n thinking: params.thinking,\n });\n } catch (error) {\n if (\n isInterModuleKnownError(agentInterModuleContract.methods.resolveAgentConfig, error) &&\n error.code === 'agent-config-invalid'\n ) {\n throw new AgentConfigUnresolvableError(params.definitionId, {cause: error});\n }\n throw error;\n }\n}\n\nfunction resolveAgentFields(params: ResolveAgentStepConfigParams): AgentFieldResolutions {\n const diagnostics: WorkflowStepTemplateDiagnostic[] = [];\n const trace: WorkflowStepEvaluationTraceEntry[] = [];\n const prompt = resolveAgentField({\n field: 'agent.prompt',\n value: params.step.prompt,\n template: params.step.templates?.prompt,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const model = resolveOptionalAgentField({\n field: 'agent.model',\n value: params.step.model,\n template: params.step.templates?.model,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const provider = resolveOptionalAgentField({\n field: 'agent.provider',\n value: params.step.provider,\n template: params.step.templates?.provider,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const hasTemplates =\n params.step.templates?.prompt !== undefined ||\n params.step.templates?.model !== undefined ||\n params.step.templates?.provider !== undefined;\n\n return {diagnostics, trace, prompt, model, provider, hasTemplates};\n}\n\nfunction authoredAgentStepConfig(\n step: WorkflowModelAgentStep,\n fields: AgentFieldResolutions,\n): AgentStepConfig {\n return {\n config: {\n ...(step.provider === undefined ? {} : {provider: step.provider}),\n ...(step.model === undefined ? {} : {model: step.model}),\n ...(step.harness === undefined ? {} : {harness: step.harness}),\n ...(step.thinking === undefined ? {} : {thinking: step.thinking}),\n ...agentToolsConfig(step),\n ...authoredAgentIntegrationsConfig(step),\n prompt: step.prompt,\n },\n configPlan: null,\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nfunction deferredAgentStepConfig(\n params: ResolveAgentStepConfigParams,\n fields: AgentFieldResolutions,\n): AgentStepConfig {\n const {step} = params;\n return {\n config: {},\n configPlan: {\n agent: {\n prompt: dispatchPlanField(fields.prompt),\n ...(fields.model === undefined ? {} : {model: dispatchPlanField(fields.model)}),\n ...(fields.provider === undefined ? {} : {provider: dispatchPlanField(fields.provider)}),\n ...(step.harness === undefined ? {} : {harness: step.harness}),\n ...(step.thinking === undefined ? {} : {thinking: step.thinking}),\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n },\n },\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nasync function agentStepConfigWithDefaults(\n step: WorkflowModelAgentStep,\n params: ResolveAgentStepConfigParams,\n fields: AgentFieldResolutions,\n): Promise<AgentStepConfig> {\n const providerValue = frozenFieldValue(fields.provider);\n const modelValue = frozenFieldValue(fields.model);\n const promptIsDeferred = fields.prompt.kind === 'residual';\n\n const resolved = await completeAgentDefaults({\n harness: step.harness,\n provider: providerValue,\n model: modelValue,\n thinking: step.thinking,\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n });\n if (promptIsDeferred) {\n return {\n config: {\n provider: resolved.provider,\n model: resolved.model,\n harness: resolved.harness,\n thinking: resolved.thinking,\n },\n configPlan: {\n agent: {\n prompt: dispatchPlanField(fields.prompt),\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n },\n },\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n }\n\n const promptValue = frozenFieldValue(fields.prompt) ?? step.prompt;\n return {\n config: {\n provider: resolved.provider,\n model: resolved.model,\n harness: resolved.harness,\n thinking: resolved.thinking,\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n prompt: promptValue,\n },\n configPlan: null,\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nfunction agentToolsConfig(\n step: WorkflowModelAgentStep,\n): {readonly tools: readonly string[]} | Record<string, never> {\n return step.tools === undefined ? {} : {tools: [...step.tools]};\n}\n\nfunction authoredAgentIntegrationsConfig(\n step: WorkflowModelAgentStep,\n):\n | {readonly integrations: NonNullable<WorkflowModelAgentStep['integrations']>}\n | Record<string, never> {\n return step.integrations === undefined ? {} : {integrations: step.integrations};\n}\n\nfunction materializedAgentIntegrationsConfig(params: ResolveAgentStepConfigParams):\n | {\n readonly integrations: readonly MaterializedAgentIntegrationConfigDto[];\n readonly mcpServers: readonly AgentIntegrationMcpServerConfigDto[];\n }\n | Record<string, never> {\n const integrations = materializeAgentIntegrations({\n jobKey: params.jobKey,\n stepId: params.step.id,\n integrations: params.step.integrations,\n context: params.agentToolContext,\n snapshot: params.agentToolSnapshot,\n });\n return integrations === undefined\n ? {}\n : {integrations, mcpServers: agentIntegrationMcpServers(integrations)};\n}\n\nfunction agentIntegrationMcpServers(\n integrations: readonly MaterializedAgentIntegrationConfigDto[],\n): readonly AgentIntegrationMcpServerConfigDto[] {\n return [\n {\n name: AGENT_INTEGRATION_MCP_SERVER_NAME,\n transport: AGENT_INTEGRATION_MCP_TRANSPORT,\n endpoint: AGENT_INTEGRATION_MCP_ENDPOINT,\n auth: AGENT_INTEGRATION_MCP_AUTH,\n integrations: [...integrations],\n },\n ];\n}\n\nfunction dispatchPlanField(field: FieldResolution): ResolvedField {\n const isResidual = field.kind === 'residual';\n return isResidual ? field.field : literalField(field.value);\n}\n\nfunction frozenFieldValue(field: FieldResolution | undefined): string | undefined {\n const isFrozen = field?.kind === 'frozen';\n return isFrozen ? field.value : undefined;\n}\n\nfunction resolveAgentField(params: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider';\n readonly value: string;\n readonly template: ResolvedField['segments'] | undefined;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly definitionId: string;\n}): FieldResolution {\n const hasTemplate = params.template !== undefined;\n const usesAuthoredMode = params.mode === 'authored';\n if (!hasTemplate || usesAuthoredMode) {\n return {kind: 'frozen', value: params.value};\n }\n\n const resolved = resolveStepField({\n field: params.field,\n template: {segments: params.template},\n context: params.context,\n definitionId: params.definitionId,\n errorField: params.field,\n });\n params.diagnostics.push(\n ...resolved.diagnostics.map((diagnostic) => ({...diagnostic, field: params.field})),\n );\n params.trace.push(...resolved.trace.map((entry) => ({...entry, field: params.field})));\n return fieldResolution(resolved);\n}\n\nfunction resolveOptionalAgentField(params: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider';\n readonly value: string | undefined;\n readonly template: ResolvedField['segments'] | undefined;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly definitionId: string;\n}): FieldResolution | undefined {\n const hasValue = params.value !== undefined;\n if (!hasValue) return undefined;\n return resolveAgentField({...params, value: params.value});\n}\n\nfunction fieldResolution(resolved: SiteResolvedField): FieldResolution {\n if (resolved.kind === 'residual') return {kind: 'residual', field: resolved.field};\n return {kind: 'frozen', value: resolved.value};\n}\n\nfunction readConfigString(config: Record<string, unknown>, key: string): string | undefined {\n const value = config[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction readConfigThinking(config: Record<string, unknown>): AgentThinking | undefined {\n const value = config.thinking;\n return value === 'off' ||\n value === 'minimal' ||\n value === 'low' ||\n value === 'medium' ||\n value === 'high' ||\n value === 'xhigh'\n ? value\n : undefined;\n}\n\nfunction readConfigHarness(\n config: Record<string, unknown>,\n): WorkflowModelAgentStep['harness'] | undefined {\n return config.harness === 'pi' || config.harness === 'claude' ? config.harness : undefined;\n}\n"],"names":["AGENT_INTEGRATION_MCP_AUTH","AGENT_INTEGRATION_MCP_ENDPOINT","AGENT_INTEGRATION_MCP_SERVER_NAME","AGENT_INTEGRATION_MCP_TRANSPORT","agentInterModuleContract","isInterModuleKnownError","materializeAgentIntegrations","AgentConfigUnresolvableError","completeStepFieldWithTrace","literalField","resolveStepField","resolveAgentStepConfig","params","fields","resolveAgentFields","usesAuthoredMode","mode","authoredAgentStepConfig","step","hasDeferredModelOrProvider","model","kind","provider","deferredAgentStepConfig","agentStepConfigWithDefaults","completeAgentConfig","agent","plan","undefined","prompt","readConfigString","config","completeAgentField","field","template","defaults","completeAgentDefaults","harness","readConfigHarness","thinking","readConfigThinking","resolveAgentDefaults","definitionId","tools","integrations","mcpServers","agentIntegrationMcpServers","args","resolved","errorField","context","trace","push","map","entry","value","Error","error","methods","resolveAgentConfig","code","cause","diagnostics","resolveAgentField","templates","resolveOptionalAgentField","hasTemplates","agentToolsConfig","authoredAgentIntegrationsConfig","configPlan","dispatchPlanField","materializedAgentIntegrationsConfig","providerValue","frozenFieldValue","modelValue","promptIsDeferred","promptValue","jobKey","stepId","id","agentToolContext","snapshot","agentToolSnapshot","name","transport","endpoint","auth","isResidual","isFrozen","hasTemplate","segments","diagnostic","fieldResolution","hasValue","key"],"mappings":"AAAA,SACEA,0BAA0B,EAC1BC,8BAA8B,EAC9BC,iCAAiC,EACjCC,+BAA+B,QAG1B,yBAAyB;AAChC,SAAQC,wBAAwB,QAAO,sCAAsC;AAG7E,SAAQC,uBAAuB,QAAO,wBAAwB;AAG9D,SAGEC,4BAA4B,QACvB,uBAAuB;AAE9B,SAAQC,4BAA4B,QAAO,kBAAkB;AAC7D,SACEC,0BAA0B,EAC1BC,YAAY,EACZC,gBAAgB,QAGX,cAAc;AAuCrB,OAAO,eAAeC,uBACpBC,MAAoC;IAEpC,MAAMC,SAASC,mBAAmBF;IAClC,MAAMG,mBAAmBH,OAAOI,IAAI,KAAK;IAEzC,IAAID,kBAAkB,OAAOE,wBAAwBL,OAAOM,IAAI,EAAEL;IAElE,MAAMM,6BACJN,OAAOO,KAAK,EAAEC,SAAS,cAAcR,OAAOS,QAAQ,EAAED,SAAS;IACjE,IAAIF,4BAA4B,OAAOI,wBAAwBX,QAAQC;IAEvE,OAAO,MAAMW,4BAA4BZ,OAAOM,IAAI,EAAEN,QAAQC;AAChE;AAEA,OAAO,eAAeY,oBAAoBb,MAOzC;IACC,MAAMc,QAAQd,OAAO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AAO,KAAK,QAAQN,OAAOM,OAAO,KAAK,WAAWN,OAAOM,OAAO,GAAGT;AACnF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/agent.ts"],"sourcesContent":["import {\n AGENT_INTEGRATION_MCP_AUTH,\n AGENT_INTEGRATION_MCP_ENDPOINT,\n AGENT_INTEGRATION_MCP_SERVER_NAME,\n AGENT_INTEGRATION_MCP_TRANSPORT,\n type AgentIntegrationMcpServerConfigDto,\n type MaterializedAgentIntegrationConfigDto,\n} from '@shipfox/api-agent-dto';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport type {WorkflowModel} from '@shipfox/api-definitions-dto';\nimport type {ResolvedField, SiteResolvedField} from '@shipfox/expression';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport type {AgentThinking} from '@shipfox/workflow-document';\nimport type {AgentDefaultsResolver, ResolvedAgentDefaults} from '#core/agent-defaults.js';\nimport {\n type AgentToolMaterializationContext,\n type AgentToolMaterializationSnapshot,\n materializeAgentIntegrations,\n} from '#core/agent-tools.js';\nimport type {PersistedEvaluationTraceEntry, StepConfigDispatchPlan} from '#core/entities/step.js';\nimport {AgentConfigUnresolvableError} from '#core/errors.js';\nimport {\n completeStepFieldWithTrace,\n literalField,\n resolveStepField,\n type WorkflowStepEvaluationTraceEntry,\n type WorkflowStepTemplateDiagnostic,\n} from './fields.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\ntype WorkflowModelJob = WorkflowModel['jobs'][number];\ntype WorkflowModelStep = WorkflowModelJob['steps'][number];\ntype WorkflowModelAgentStep = Extract<WorkflowModelStep, {kind: 'agent'}>;\ntype StepConfigMode = 'effective' | 'authored';\ntype FieldResolution =\n | {readonly kind: 'frozen'; readonly value: string}\n | {readonly kind: 'residual'; readonly field: ResolvedField};\n\ninterface AgentFieldResolutions {\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly prompt: FieldResolution;\n readonly model: FieldResolution | undefined;\n readonly provider: FieldResolution | undefined;\n readonly thinking: FieldResolution | undefined;\n readonly hasTemplates: boolean;\n}\n\nexport interface ResolveAgentStepConfigParams {\n readonly jobKey: string;\n readonly step: WorkflowModelAgentStep;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly definitionId: string;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly agentToolContext?: AgentToolMaterializationContext | undefined;\n readonly agentToolSnapshot?: AgentToolMaterializationSnapshot | null | undefined;\n}\n\nexport interface AgentStepConfig {\n readonly config: Record<string, unknown>;\n readonly configPlan: StepConfigDispatchPlan | null;\n readonly diagnostics: readonly WorkflowStepTemplateDiagnostic[];\n readonly trace: readonly WorkflowStepEvaluationTraceEntry[];\n readonly hasTemplates: boolean;\n}\n\nexport async function resolveAgentStepConfig(\n params: ResolveAgentStepConfigParams,\n): Promise<AgentStepConfig> {\n const fields = resolveAgentFields(params);\n const usesAuthoredMode = params.mode === 'authored';\n\n if (usesAuthoredMode) return authoredAgentStepConfig(params.step, fields);\n\n const hasDeferredAgentField =\n fields.model?.kind === 'residual' ||\n fields.provider?.kind === 'residual' ||\n fields.thinking?.kind === 'residual';\n if (hasDeferredAgentField) return deferredAgentStepConfig(params, fields);\n\n return await agentStepConfigWithDefaults(params.step, params, fields);\n}\n\nexport async function completeAgentConfig(params: {\n readonly config: Record<string, unknown>;\n readonly plan: StepConfigDispatchPlan;\n readonly context: WorkflowEvaluationContext;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId: string;\n readonly trace: PersistedEvaluationTraceEntry[];\n}): Promise<void> {\n const agent = params.plan.agent;\n if (agent === undefined) return;\n\n const prompt =\n agent.prompt === undefined\n ? readConfigString(params.config, 'prompt')\n : completeAgentField({\n field: 'agent.prompt',\n template: agent.prompt,\n params,\n });\n const model =\n agent.model === undefined\n ? readConfigString(params.config, 'model')\n : completeAgentField({\n field: 'agent.model',\n template: agent.model,\n params,\n });\n const provider =\n agent.provider === undefined\n ? readConfigString(params.config, 'provider')\n : completeAgentField({\n field: 'agent.provider',\n template: agent.provider,\n params,\n });\n\n const defaults = await completeAgentDefaults({\n harness: agent.harness ?? readConfigHarness(params.config),\n provider,\n model,\n thinking:\n agent.thinking === undefined\n ? readConfigThinking(params.config)\n : completeAgentField({field: 'agent.thinking', template: agent.thinking, params}),\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n });\n params.config.harness = defaults.harness;\n params.config.provider = defaults.provider;\n params.config.model = defaults.model;\n params.config.thinking = defaults.thinking;\n params.config.prompt = prompt;\n if (agent.tools !== undefined) params.config.tools = [...agent.tools];\n const integrations = agent.integrations === undefined ? undefined : [...agent.integrations];\n if (integrations !== undefined) params.config.integrations = integrations;\n const mcpServers =\n agent.mcpServers ??\n (integrations === undefined ? undefined : agentIntegrationMcpServers(integrations));\n if (mcpServers !== undefined) params.config.mcpServers = [...mcpServers];\n}\n\nfunction completeAgentField(args: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider' | 'agent.thinking';\n readonly template: ResolvedField;\n readonly params: {\n readonly context: WorkflowEvaluationContext;\n readonly definitionId: string;\n readonly trace: PersistedEvaluationTraceEntry[];\n };\n}): string {\n const resolved = completeStepFieldWithTrace({\n field: args.field,\n errorField: args.field,\n template: args.template,\n context: args.params.context,\n definitionId: args.params.definitionId,\n });\n args.params.trace.push(...resolved.trace.map((entry) => ({...entry, field: args.field})));\n return resolved.value;\n}\n\nexport async function completeAgentDefaults(params: {\n readonly harness: WorkflowModelAgentStep['harness'] | undefined;\n readonly provider: string | undefined;\n readonly model: string | undefined;\n readonly thinking: string | undefined;\n readonly resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n readonly definitionId: string;\n}): Promise<ResolvedAgentDefaults> {\n if (!params.resolveAgentDefaults) throw new Error('Agent defaults resolver is required');\n\n try {\n return await params.resolveAgentDefaults({\n harness: params.harness,\n provider: params.provider,\n model: params.model,\n thinking: params.thinking,\n });\n } catch (error) {\n if (\n isInterModuleKnownError(agentInterModuleContract.methods.resolveAgentConfig, error) &&\n error.code === 'agent-config-invalid'\n ) {\n throw new AgentConfigUnresolvableError(params.definitionId, {cause: error});\n }\n throw error;\n }\n}\n\nfunction resolveAgentFields(params: ResolveAgentStepConfigParams): AgentFieldResolutions {\n const diagnostics: WorkflowStepTemplateDiagnostic[] = [];\n const trace: WorkflowStepEvaluationTraceEntry[] = [];\n const prompt = resolveAgentField({\n field: 'agent.prompt',\n value: params.step.prompt,\n template: params.step.templates?.prompt,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const model = resolveOptionalAgentField({\n field: 'agent.model',\n value: params.step.model,\n template: params.step.templates?.model,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const provider = resolveOptionalAgentField({\n field: 'agent.provider',\n value: params.step.provider,\n template: params.step.templates?.provider,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const thinking = resolveOptionalAgentField({\n field: 'agent.thinking',\n value: params.step.thinking,\n template: params.step.templates?.thinking,\n context: params.context,\n mode: params.mode,\n diagnostics,\n trace,\n definitionId: params.definitionId,\n });\n const hasTemplates =\n params.step.templates?.prompt !== undefined ||\n params.step.templates?.model !== undefined ||\n params.step.templates?.provider !== undefined ||\n params.step.templates?.thinking !== undefined;\n\n return {diagnostics, trace, prompt, model, provider, thinking, hasTemplates};\n}\n\nfunction authoredAgentStepConfig(\n step: WorkflowModelAgentStep,\n fields: AgentFieldResolutions,\n): AgentStepConfig {\n return {\n config: {\n ...(step.provider === undefined ? {} : {provider: step.provider}),\n ...(step.model === undefined ? {} : {model: step.model}),\n ...(step.harness === undefined ? {} : {harness: step.harness}),\n ...(step.thinking === undefined ? {} : {thinking: step.thinking}),\n ...agentToolsConfig(step),\n ...authoredAgentIntegrationsConfig(step),\n prompt: step.prompt,\n },\n configPlan: null,\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nfunction deferredAgentStepConfig(\n params: ResolveAgentStepConfigParams,\n fields: AgentFieldResolutions,\n): AgentStepConfig {\n const {step} = params;\n return {\n config: {},\n configPlan: {\n agent: {\n prompt: dispatchPlanField(fields.prompt),\n ...(fields.model === undefined ? {} : {model: dispatchPlanField(fields.model)}),\n ...(fields.provider === undefined ? {} : {provider: dispatchPlanField(fields.provider)}),\n ...(step.harness === undefined ? {} : {harness: step.harness}),\n ...(fields.thinking === undefined ? {} : {thinking: dispatchPlanField(fields.thinking)}),\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n },\n },\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nasync function agentStepConfigWithDefaults(\n step: WorkflowModelAgentStep,\n params: ResolveAgentStepConfigParams,\n fields: AgentFieldResolutions,\n): Promise<AgentStepConfig> {\n const providerValue = frozenFieldValue(fields.provider);\n const modelValue = frozenFieldValue(fields.model);\n const promptIsDeferred = fields.prompt.kind === 'residual';\n\n const resolved = await completeAgentDefaults({\n harness: step.harness,\n provider: providerValue,\n model: modelValue,\n thinking: frozenFieldValue(fields.thinking),\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n });\n if (promptIsDeferred) {\n return {\n config: {\n provider: resolved.provider,\n model: resolved.model,\n harness: resolved.harness,\n thinking: resolved.thinking,\n },\n configPlan: {\n agent: {\n prompt: dispatchPlanField(fields.prompt),\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n },\n },\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n }\n\n const promptValue = frozenFieldValue(fields.prompt) ?? step.prompt;\n return {\n config: {\n provider: resolved.provider,\n model: resolved.model,\n harness: resolved.harness,\n thinking: resolved.thinking,\n ...agentToolsConfig(step),\n ...materializedAgentIntegrationsConfig(params),\n prompt: promptValue,\n },\n configPlan: null,\n diagnostics: fields.diagnostics,\n trace: fields.trace,\n hasTemplates: fields.hasTemplates,\n };\n}\n\nfunction agentToolsConfig(\n step: WorkflowModelAgentStep,\n): {readonly tools: readonly string[]} | Record<string, never> {\n return step.tools === undefined ? {} : {tools: [...step.tools]};\n}\n\nfunction authoredAgentIntegrationsConfig(\n step: WorkflowModelAgentStep,\n):\n | {readonly integrations: NonNullable<WorkflowModelAgentStep['integrations']>}\n | Record<string, never> {\n return step.integrations === undefined ? {} : {integrations: step.integrations};\n}\n\nfunction materializedAgentIntegrationsConfig(params: ResolveAgentStepConfigParams):\n | {\n readonly integrations: readonly MaterializedAgentIntegrationConfigDto[];\n readonly mcpServers: readonly AgentIntegrationMcpServerConfigDto[];\n }\n | Record<string, never> {\n const integrations = materializeAgentIntegrations({\n jobKey: params.jobKey,\n stepId: params.step.id,\n integrations: params.step.integrations,\n context: params.agentToolContext,\n snapshot: params.agentToolSnapshot,\n });\n return integrations === undefined\n ? {}\n : {integrations, mcpServers: agentIntegrationMcpServers(integrations)};\n}\n\nfunction agentIntegrationMcpServers(\n integrations: readonly MaterializedAgentIntegrationConfigDto[],\n): readonly AgentIntegrationMcpServerConfigDto[] {\n return [\n {\n name: AGENT_INTEGRATION_MCP_SERVER_NAME,\n transport: AGENT_INTEGRATION_MCP_TRANSPORT,\n endpoint: AGENT_INTEGRATION_MCP_ENDPOINT,\n auth: AGENT_INTEGRATION_MCP_AUTH,\n integrations: [...integrations],\n },\n ];\n}\n\nfunction dispatchPlanField(field: FieldResolution): ResolvedField {\n const isResidual = field.kind === 'residual';\n return isResidual ? field.field : literalField(field.value);\n}\n\nfunction frozenFieldValue(field: FieldResolution | undefined): string | undefined {\n const isFrozen = field?.kind === 'frozen';\n return isFrozen ? field.value : undefined;\n}\n\nfunction resolveAgentField(params: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider' | 'agent.thinking';\n readonly value: string;\n readonly template: ResolvedField['segments'] | undefined;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly definitionId: string;\n}): FieldResolution {\n const hasTemplate = params.template !== undefined;\n const usesAuthoredMode = params.mode === 'authored';\n if (!hasTemplate || usesAuthoredMode) {\n return {kind: 'frozen', value: params.value};\n }\n\n const resolved = resolveStepField({\n field: params.field,\n template: {segments: params.template},\n context: params.context,\n definitionId: params.definitionId,\n errorField: params.field,\n });\n params.diagnostics.push(\n ...resolved.diagnostics.map((diagnostic) => ({...diagnostic, field: params.field})),\n );\n params.trace.push(...resolved.trace.map((entry) => ({...entry, field: params.field})));\n return fieldResolution(resolved);\n}\n\nfunction resolveOptionalAgentField(params: {\n readonly field: 'agent.prompt' | 'agent.model' | 'agent.provider' | 'agent.thinking';\n readonly value: string | undefined;\n readonly template: ResolvedField['segments'] | undefined;\n readonly context: WorkflowEvaluationContext;\n readonly mode: StepConfigMode;\n readonly diagnostics: WorkflowStepTemplateDiagnostic[];\n readonly trace: WorkflowStepEvaluationTraceEntry[];\n readonly definitionId: string;\n}): FieldResolution | undefined {\n const hasValue = params.value !== undefined;\n if (!hasValue) return undefined;\n return resolveAgentField({...params, value: params.value});\n}\n\nfunction fieldResolution(resolved: SiteResolvedField): FieldResolution {\n if (resolved.kind === 'residual') return {kind: 'residual', field: resolved.field};\n return {kind: 'frozen', value: resolved.value};\n}\n\nfunction readConfigString(config: Record<string, unknown>, key: string): string | undefined {\n const value = config[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction readConfigThinking(config: Record<string, unknown>): AgentThinking | undefined {\n const value = config.thinking;\n return value === 'off' ||\n value === 'minimal' ||\n value === 'low' ||\n value === 'medium' ||\n value === 'high' ||\n value === 'xhigh'\n ? value\n : undefined;\n}\n\nfunction readConfigHarness(\n config: Record<string, unknown>,\n): WorkflowModelAgentStep['harness'] | undefined {\n return config.harness === 'pi' || config.harness === 'claude' ? config.harness : undefined;\n}\n"],"names":["AGENT_INTEGRATION_MCP_AUTH","AGENT_INTEGRATION_MCP_ENDPOINT","AGENT_INTEGRATION_MCP_SERVER_NAME","AGENT_INTEGRATION_MCP_TRANSPORT","agentInterModuleContract","isInterModuleKnownError","materializeAgentIntegrations","AgentConfigUnresolvableError","completeStepFieldWithTrace","literalField","resolveStepField","resolveAgentStepConfig","params","fields","resolveAgentFields","usesAuthoredMode","mode","authoredAgentStepConfig","step","hasDeferredAgentField","model","kind","provider","thinking","deferredAgentStepConfig","agentStepConfigWithDefaults","completeAgentConfig","agent","plan","undefined","prompt","readConfigString","config","completeAgentField","field","template","defaults","completeAgentDefaults","harness","readConfigHarness","readConfigThinking","resolveAgentDefaults","definitionId","tools","integrations","mcpServers","agentIntegrationMcpServers","args","resolved","errorField","context","trace","push","map","entry","value","Error","error","methods","resolveAgentConfig","code","cause","diagnostics","resolveAgentField","templates","resolveOptionalAgentField","hasTemplates","agentToolsConfig","authoredAgentIntegrationsConfig","configPlan","dispatchPlanField","materializedAgentIntegrationsConfig","providerValue","frozenFieldValue","modelValue","promptIsDeferred","promptValue","jobKey","stepId","id","agentToolContext","snapshot","agentToolSnapshot","name","transport","endpoint","auth","isResidual","isFrozen","hasTemplate","segments","diagnostic","fieldResolution","hasValue","key"],"mappings":"AAAA,SACEA,0BAA0B,EAC1BC,8BAA8B,EAC9BC,iCAAiC,EACjCC,+BAA+B,QAG1B,yBAAyB;AAChC,SAAQC,wBAAwB,QAAO,sCAAsC;AAG7E,SAAQC,uBAAuB,QAAO,wBAAwB;AAG9D,SAGEC,4BAA4B,QACvB,uBAAuB;AAE9B,SAAQC,4BAA4B,QAAO,kBAAkB;AAC7D,SACEC,0BAA0B,EAC1BC,YAAY,EACZC,gBAAgB,QAGX,cAAc;AAwCrB,OAAO,eAAeC,uBACpBC,MAAoC;IAEpC,MAAMC,SAASC,mBAAmBF;IAClC,MAAMG,mBAAmBH,OAAOI,IAAI,KAAK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ACzB;AAEA,SAASiB,0BAA0BrD,MASlC;IACC,MAAMiF,WAAWjF,OAAO2C,KAAK,KAAK1B;IAClC,IAAI,CAACgE,UAAU,OAAOhE;IACtB,OAAOkC,kBAAkB;QAAC,GAAGnD,MAAM;QAAE2C,OAAO3C,OAAO2C,KAAK;IAAA;AAC1D;AAEA,SAASqC,gBAAgB5C,QAA2B;IAClD,IAAIA,SAAS3B,IAAI,KAAK,YAAY,OAAO;QAACA,MAAM;QAAYa,OAAOc,SAASd,KAAK;IAAA;IACjF,OAAO;QAACb,MAAM;QAAUkC,OAAOP,SAASO,KAAK;IAAA;AAC/C;AAEA,SAASxB,iBAAiBC,MAA+B,EAAE8D,GAAW;IACpE,MAAMvC,QAAQvB,MAAM,CAAC8D,IAAI;IACzB,OAAO,OAAOvC,UAAU,WAAWA,QAAQ1B;AAC7C;AAEA,SAASW,mBAAmBR,MAA+B;IACzD,MAAMuB,QAAQvB,OAAOT,QAAQ;IAC7B,OAAOgC,UAAU,SACfA,UAAU,aACVA,UAAU,SACVA,UAAU,YACVA,UAAU,UACVA,UAAU,UACRA,QACA1B;AACN;AAEA,SAASU,kBACPP,MAA+B;IAE/B,OAAOA,OAAOM,OAAO,KAAK,QAAQN,OAAOM,OAAO,KAAK,WAAWN,OAAOM,OAAO,GAAGT;AACnF"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { type WorkflowExpressionEvaluationContext } from '@shipfox/expression';
|
|
1
|
+
import { type WorkflowExpressionEvaluationContext, type WorkflowPredicateContextRoot } from '@shipfox/expression';
|
|
2
2
|
import type { Job, JobListeningTrigger } from '#core/entities/job.js';
|
|
3
3
|
import type { JobExecution } from '#core/entities/job-execution.js';
|
|
4
4
|
import type { Step, StepAttempt, StepStatus } from '#core/entities/step.js';
|
|
5
|
-
import type { TriggerPayload, WorkflowRun } from '#core/entities/workflow-run.js';
|
|
5
|
+
import type { TriggerPayload, WorkflowRun, WorkflowRunTriggerReference } from '#core/entities/workflow-run.js';
|
|
6
6
|
import type { WorkflowEvaluationContext } from './workflow-evaluation-context.js';
|
|
7
7
|
export interface JobContextInput {
|
|
8
8
|
readonly job: Pick<Job, 'key' | 'status' | 'outputs'>;
|
|
9
9
|
readonly executions: readonly JobExecution[];
|
|
10
10
|
}
|
|
11
11
|
export interface AssembleWorkflowRunContextParams {
|
|
12
|
-
readonly run: Pick<WorkflowRun, 'id' | 'name' | 'definitionId' | 'projectId' | 'workspaceId' | 'createdAt'
|
|
12
|
+
readonly run: Pick<WorkflowRun, 'id' | 'number' | 'name' | 'workflowName' | 'definitionId' | 'projectId' | 'workspaceId' | 'createdAt'> & {
|
|
13
|
+
readonly triggerReference?: WorkflowRunTriggerReference | null | undefined;
|
|
14
|
+
};
|
|
13
15
|
readonly triggerPayload: TriggerPayload;
|
|
14
16
|
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
15
17
|
readonly vars?: Record<string, string> | undefined;
|
|
@@ -17,8 +19,9 @@ export interface AssembleWorkflowRunContextParams {
|
|
|
17
19
|
export declare function assembleWorkflowRunContext(params: AssembleWorkflowRunContextParams): WorkflowExpressionEvaluationContext;
|
|
18
20
|
export declare function assembleCreationContext(params: AssembleWorkflowRunContextParams): WorkflowEvaluationContext;
|
|
19
21
|
export interface AssembleExecutionCreationContextParams extends AssembleWorkflowRunContextParams {
|
|
20
|
-
readonly
|
|
22
|
+
readonly job: Pick<Job, 'id' | 'key' | 'name'>;
|
|
21
23
|
readonly sequence: number;
|
|
24
|
+
readonly nameOverride: string | null;
|
|
22
25
|
readonly executionName: string;
|
|
23
26
|
readonly status: JobExecution['status'];
|
|
24
27
|
readonly triggerEvents: readonly JobExecution['triggerEvents'][number][];
|
|
@@ -37,7 +40,8 @@ export interface AssembleJobActivationContextParams extends AssembleWorkflowRunC
|
|
|
37
40
|
readonly jobs: readonly JobContextInput[];
|
|
38
41
|
}
|
|
39
42
|
export declare function assembleJobActivationContext(params: AssembleJobActivationContextParams): WorkflowEvaluationContext;
|
|
40
|
-
type
|
|
43
|
+
type ListenerPredicateField = 'listener.on' | 'listener.until';
|
|
44
|
+
type ListenerSnapshotRoot = Exclude<WorkflowPredicateContextRoot<ListenerPredicateField>, 'event'>;
|
|
41
45
|
export interface MatcherSnapshotPlan {
|
|
42
46
|
readonly matcher: JobListeningTrigger;
|
|
43
47
|
readonly roots: ReadonlySet<ListenerSnapshotRoot>;
|
|
@@ -54,10 +58,11 @@ export declare function planListenerFilterSnapshots(params: {
|
|
|
54
58
|
readonly until: readonly JobListeningTrigger[] | null;
|
|
55
59
|
}): ListenerSnapshotPlan;
|
|
56
60
|
export declare function assembleListenerSnapshotContext(params: {
|
|
57
|
-
readonly job: Pick<Job, 'key'
|
|
61
|
+
readonly job: Pick<Job, 'key'> & Partial<Pick<Job, 'name'>>;
|
|
58
62
|
readonly run: AssembleWorkflowRunContextParams['run'];
|
|
59
63
|
readonly triggerPayload: TriggerPayload;
|
|
60
64
|
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
65
|
+
readonly vars?: Record<string, string> | undefined;
|
|
61
66
|
readonly plan: ListenerSnapshotPlan;
|
|
62
67
|
readonly dependencyJobs: readonly JobContextInput[];
|
|
63
68
|
}): WorkflowExpressionEvaluationContext;
|
|
@@ -71,19 +76,25 @@ export declare function assembleStepDispatchContext(params: {
|
|
|
71
76
|
readonly targetStepId: string;
|
|
72
77
|
readonly jobExecution?: JobExecution;
|
|
73
78
|
readonly jobs?: readonly JobContextInput[];
|
|
79
|
+
readonly vars?: Record<string, string> | undefined;
|
|
74
80
|
}): WorkflowEvaluationContext;
|
|
75
81
|
export declare function assembleGateContext(params: {
|
|
76
82
|
readonly status: StepStatus;
|
|
77
83
|
readonly exitCode: number | null;
|
|
78
84
|
readonly output?: Record<string, unknown> | null | undefined;
|
|
85
|
+
readonly vars?: Record<string, string> | undefined;
|
|
86
|
+
}): WorkflowEvaluationContext;
|
|
87
|
+
export declare function assembleJobResolutionContext(params: {
|
|
88
|
+
readonly executions: readonly JobExecution[];
|
|
89
|
+
readonly jobs: readonly JobContextInput[];
|
|
90
|
+
readonly vars?: Record<string, string> | undefined;
|
|
79
91
|
}): WorkflowEvaluationContext;
|
|
80
|
-
export declare function assembleJobResolutionContext(executions: readonly JobExecution[]): WorkflowEvaluationContext;
|
|
81
92
|
export declare function assembleExecutionResolutionContext(params: {
|
|
82
93
|
readonly run: AssembleWorkflowRunContextParams['run'];
|
|
83
94
|
readonly triggerPayload: TriggerPayload;
|
|
84
95
|
readonly inputs?: Record<string, unknown> | null | undefined;
|
|
85
96
|
readonly vars?: Record<string, string> | undefined;
|
|
86
|
-
readonly job: Pick<Job, 'key'
|
|
97
|
+
readonly job: Pick<Job, 'key'> & Partial<Pick<Job, 'name'>>;
|
|
87
98
|
readonly jobExecution: JobExecution;
|
|
88
99
|
readonly executions: readonly JobExecution[];
|
|
89
100
|
readonly steps: readonly Step[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-run-context.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/assemble-run-context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"assemble-run-context.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/assemble-run-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,GAAG,EAAE,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAEhF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAA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GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,YAAY,EAAE,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C,GAAG,yBAAyB,CAuB5B"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { analyzeContextRootKeyAccess, extractExactContextRoots } from '@shipfox/expression';
|
|
1
|
+
import { analyzeContextRootKeyAccess, extractExactContextRoots, getWorkflowPredicateContextRoots } from '@shipfox/expression';
|
|
2
2
|
export function assembleWorkflowRunContext(params) {
|
|
3
|
+
const triggerReference = params.run.triggerReference;
|
|
3
4
|
return {
|
|
5
|
+
workflow: {
|
|
6
|
+
id: params.run.definitionId,
|
|
7
|
+
name: params.run.workflowName
|
|
8
|
+
},
|
|
4
9
|
run: {
|
|
5
10
|
id: params.run.id,
|
|
11
|
+
number: params.run.number,
|
|
6
12
|
name: params.run.name,
|
|
7
|
-
definition_id: params.run.definitionId,
|
|
8
13
|
project_id: params.run.projectId,
|
|
9
14
|
workspace_id: params.run.workspaceId,
|
|
10
15
|
created_at: params.run.createdAt
|
|
11
16
|
},
|
|
12
17
|
trigger: {
|
|
13
18
|
source: params.triggerPayload.source,
|
|
14
|
-
event: params.triggerPayload.event
|
|
19
|
+
event: params.triggerPayload.event,
|
|
20
|
+
project: triggerReference?.project ?? null,
|
|
21
|
+
repository: triggerReference?.repository ?? null,
|
|
22
|
+
ref: triggerReference?.ref ?? null,
|
|
23
|
+
commit: triggerReference?.commit ?? null
|
|
15
24
|
},
|
|
16
25
|
event: 'data' in params.triggerPayload ? params.triggerPayload.data : null,
|
|
17
26
|
inputs: params.inputs ?? null,
|
|
@@ -28,9 +37,10 @@ export function assembleCreationContext(params) {
|
|
|
28
37
|
}
|
|
29
38
|
export function assembleExecutionCreationContext(params) {
|
|
30
39
|
const execution = {
|
|
31
|
-
id: `${params.
|
|
32
|
-
jobId: params.
|
|
40
|
+
id: `${params.job.id}:${params.sequence}`,
|
|
41
|
+
jobId: params.job.id,
|
|
33
42
|
sequence: params.sequence,
|
|
43
|
+
nameOverride: params.nameOverride,
|
|
34
44
|
name: params.executionName,
|
|
35
45
|
runner: null,
|
|
36
46
|
status: params.status,
|
|
@@ -57,6 +67,10 @@ export function assembleExecutionCreationContext(params) {
|
|
|
57
67
|
values: {
|
|
58
68
|
...assembleWorkflowRunContext(params),
|
|
59
69
|
...executions,
|
|
70
|
+
job: {
|
|
71
|
+
key: params.job.key,
|
|
72
|
+
name: params.job.name ?? params.job.key
|
|
73
|
+
},
|
|
60
74
|
execution: executionValues.at(-1)
|
|
61
75
|
}
|
|
62
76
|
};
|
|
@@ -94,15 +108,16 @@ export function assembleJobActivationContext(params) {
|
|
|
94
108
|
values: {
|
|
95
109
|
...assembleWorkflowRunContext(params),
|
|
96
110
|
...assembleJobsContext(params.jobs),
|
|
97
|
-
needs: params.jobs.map(assembleJobContext)
|
|
111
|
+
needs: params.jobs.map(assembleJobContext),
|
|
112
|
+
vars: params.vars ?? {}
|
|
98
113
|
}
|
|
99
114
|
};
|
|
100
115
|
}
|
|
101
116
|
export function planListenerFilterSnapshots(params) {
|
|
102
117
|
const roots = new Set();
|
|
103
118
|
const jobKeys = new Set();
|
|
104
|
-
const on = params.on.map((matcher)=>planMatcherFilterSnapshot(matcher, roots, jobKeys));
|
|
105
|
-
const until = (params.until ?? []).map((matcher)=>planMatcherFilterSnapshot(matcher, roots, jobKeys));
|
|
119
|
+
const on = params.on.map((matcher)=>planMatcherFilterSnapshot('listener.on', matcher, roots, jobKeys));
|
|
120
|
+
const until = (params.until ?? []).map((matcher)=>planMatcherFilterSnapshot('listener.until', matcher, roots, jobKeys));
|
|
106
121
|
return {
|
|
107
122
|
on,
|
|
108
123
|
until,
|
|
@@ -110,7 +125,7 @@ export function planListenerFilterSnapshots(params) {
|
|
|
110
125
|
jobKeys
|
|
111
126
|
};
|
|
112
127
|
}
|
|
113
|
-
function planMatcherFilterSnapshot(matcher, allRoots, allJobKeys) {
|
|
128
|
+
function planMatcherFilterSnapshot(field, matcher, allRoots, allJobKeys) {
|
|
114
129
|
if (matcher.filter === undefined) return {
|
|
115
130
|
matcher,
|
|
116
131
|
roots: new Set(),
|
|
@@ -118,7 +133,7 @@ function planMatcherFilterSnapshot(matcher, allRoots, allJobKeys) {
|
|
|
118
133
|
};
|
|
119
134
|
let roots;
|
|
120
135
|
try {
|
|
121
|
-
roots = extractExactContextRoots(matcher.filter).filter((root)=>root
|
|
136
|
+
roots = extractExactContextRoots(matcher.filter).filter((root)=>isListenerSnapshotRoot(field, root));
|
|
122
137
|
} catch {
|
|
123
138
|
return {
|
|
124
139
|
matcher,
|
|
@@ -142,26 +157,34 @@ function planMatcherFilterSnapshot(matcher, allRoots, allJobKeys) {
|
|
|
142
157
|
jobKeys
|
|
143
158
|
};
|
|
144
159
|
}
|
|
145
|
-
function isListenerSnapshotRoot(root) {
|
|
146
|
-
return root
|
|
160
|
+
function isListenerSnapshotRoot(field, root) {
|
|
161
|
+
return root !== 'event' && getWorkflowPredicateContextRoots(field).includes(root);
|
|
147
162
|
}
|
|
148
163
|
export function assembleListenerSnapshotContext(params) {
|
|
149
164
|
const context = {};
|
|
150
|
-
if (params.plan.roots.has('run') || params.plan.roots.has('trigger')) {
|
|
165
|
+
if (params.plan.roots.has('workflow') || params.plan.roots.has('run') || params.plan.roots.has('trigger')) {
|
|
151
166
|
const runContext = assembleWorkflowRunContext({
|
|
152
167
|
run: params.run,
|
|
153
168
|
triggerPayload: params.triggerPayload,
|
|
154
|
-
inputs: params.inputs
|
|
169
|
+
inputs: params.inputs,
|
|
170
|
+
vars: params.vars
|
|
155
171
|
});
|
|
172
|
+
if (params.plan.roots.has('workflow')) context.workflow = runContext.workflow;
|
|
156
173
|
if (params.plan.roots.has('run')) context.run = runContext.run;
|
|
157
174
|
if (params.plan.roots.has('trigger')) context.trigger = runContext.trigger;
|
|
158
175
|
}
|
|
159
176
|
if (params.plan.roots.has('inputs')) {
|
|
160
177
|
context.inputs = params.inputs ?? null;
|
|
161
178
|
}
|
|
179
|
+
if (params.plan.roots.has('vars')) {
|
|
180
|
+
context.vars = params.vars ?? {};
|
|
181
|
+
}
|
|
162
182
|
if (params.plan.roots.has('job')) {
|
|
163
183
|
context.job = {
|
|
164
|
-
key: params.job.key
|
|
184
|
+
key: params.job.key,
|
|
185
|
+
...params.job.name === undefined ? {} : {
|
|
186
|
+
name: params.job.name ?? params.job.key
|
|
187
|
+
}
|
|
165
188
|
};
|
|
166
189
|
}
|
|
167
190
|
if (params.plan.roots.has('jobs')) {
|
|
@@ -273,7 +296,8 @@ export function assembleStepDispatchContext(params) {
|
|
|
273
296
|
return {
|
|
274
297
|
site: 'step-dispatch',
|
|
275
298
|
values: {
|
|
276
|
-
|
|
299
|
+
vars: params.vars ?? {},
|
|
300
|
+
...assembleJobsContext(params.jobs ?? []),
|
|
277
301
|
...params.jobExecution === undefined ? {} : {
|
|
278
302
|
execution: {
|
|
279
303
|
index: params.jobExecution.sequence,
|
|
@@ -353,6 +377,7 @@ export function assembleGateContext(params) {
|
|
|
353
377
|
return {
|
|
354
378
|
site: 'step-report',
|
|
355
379
|
values: {
|
|
380
|
+
vars: params.vars ?? {},
|
|
356
381
|
step: {
|
|
357
382
|
...params.exitCode === null ? {} : {
|
|
358
383
|
exit_code: BigInt(params.exitCode)
|
|
@@ -363,10 +388,14 @@ export function assembleGateContext(params) {
|
|
|
363
388
|
}
|
|
364
389
|
};
|
|
365
390
|
}
|
|
366
|
-
export function assembleJobResolutionContext(
|
|
391
|
+
export function assembleJobResolutionContext(params) {
|
|
367
392
|
return {
|
|
368
393
|
site: 'job-resolution',
|
|
369
|
-
values:
|
|
394
|
+
values: {
|
|
395
|
+
...assembleExecutionsContext(params.executions),
|
|
396
|
+
...assembleJobsContext(params.jobs),
|
|
397
|
+
vars: params.vars ?? {}
|
|
398
|
+
}
|
|
370
399
|
};
|
|
371
400
|
}
|
|
372
401
|
export function assembleExecutionResolutionContext(params) {
|
|
@@ -380,7 +409,10 @@ export function assembleExecutionResolutionContext(params) {
|
|
|
380
409
|
...params.jobs === undefined ? {} : assembleJobsContext(params.jobs),
|
|
381
410
|
execution: assembleExecutionContext(params.jobExecution, executionIndex < 0 ? params.jobExecution.sequence - 1 : executionIndex),
|
|
382
411
|
job: {
|
|
383
|
-
key: params.job.key
|
|
412
|
+
key: params.job.key,
|
|
413
|
+
...params.job.name === undefined ? {} : {
|
|
414
|
+
name: params.job.name ?? params.job.key
|
|
415
|
+
}
|
|
384
416
|
},
|
|
385
417
|
steps: assembleStepsContext({
|
|
386
418
|
steps: params.steps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/step-config/assemble-run-context.ts"],"sourcesContent":["import {\n analyzeContextRootKeyAccess,\n extractExactContextRoots,\n type WorkflowExpressionEvaluationContext,\n} from '@shipfox/expression';\nimport type {Job, JobListeningTrigger} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport type {Step, StepAttempt, StepStatus} from '#core/entities/step.js';\nimport type {TriggerPayload, WorkflowRun} from '#core/entities/workflow-run.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\nexport interface JobContextInput {\n readonly job: Pick<Job, 'key' | 'status' | 'outputs'>;\n readonly executions: readonly JobExecution[];\n}\n\nexport interface AssembleWorkflowRunContextParams {\n readonly run: Pick<\n WorkflowRun,\n 'id' | 'name' | 'definitionId' | 'projectId' | 'workspaceId' | 'createdAt'\n >;\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n}\n\nexport function assembleWorkflowRunContext(\n params: AssembleWorkflowRunContextParams,\n): WorkflowExpressionEvaluationContext {\n return {\n run: {\n id: params.run.id,\n name: params.run.name,\n definition_id: params.run.definitionId,\n project_id: params.run.projectId,\n workspace_id: params.run.workspaceId,\n created_at: params.run.createdAt,\n },\n trigger: {\n source: params.triggerPayload.source,\n event: params.triggerPayload.event,\n },\n event: 'data' in params.triggerPayload ? params.triggerPayload.data : null,\n inputs: params.inputs ?? null,\n ...(params.vars === undefined ? {} : {vars: params.vars}),\n };\n}\n\nexport function assembleCreationContext(\n params: AssembleWorkflowRunContextParams,\n): WorkflowEvaluationContext {\n return {\n site: 'run-creation',\n values: assembleWorkflowRunContext(params),\n };\n}\n\nexport interface AssembleExecutionCreationContextParams extends AssembleWorkflowRunContextParams {\n readonly jobId: string;\n readonly sequence: number;\n readonly executionName: string;\n readonly status: JobExecution['status'];\n readonly triggerEvents: readonly JobExecution['triggerEvents'][number][];\n readonly priorExecutions: readonly JobExecution[];\n}\n\nexport function assembleExecutionCreationContext(\n params: AssembleExecutionCreationContextParams,\n): WorkflowEvaluationContext {\n const execution: JobExecution = {\n id: `${params.jobId}:${params.sequence}`,\n jobId: params.jobId,\n sequence: params.sequence,\n name: params.executionName,\n runner: null,\n status: params.status,\n statusReason: null,\n triggerEvents: [...params.triggerEvents],\n outputs: null,\n version: 1,\n createdAt: new Date(),\n updatedAt: new Date(),\n queuedAt: null,\n startedAt: null,\n finishedAt: null,\n timedOutAt: null,\n };\n const executions = assembleExecutionsContext([...params.priorExecutions, execution]);\n const executionValues = executions.executions as unknown[];\n return {\n site: 'execution-creation',\n values: {\n ...assembleWorkflowRunContext(params),\n ...executions,\n execution: executionValues.at(-1),\n },\n };\n}\n\n/**\n * Keeps job-success predicate values aligned with the registry's `executions`\n * type environment.\n */\nexport function assembleExecutionsContext(\n executions: readonly JobExecution[],\n): WorkflowExpressionEvaluationContext {\n return {\n executions: executions.map((execution, index) => assembleExecutionContext(execution, index)),\n };\n}\n\nfunction assembleExecutionContext(execution: JobExecution, index: number): Record<string, unknown> {\n return {\n index,\n name: execution.name,\n status: execution.status,\n started_at: execution.startedAt,\n finished_at: execution.finishedAt,\n events: execution.triggerEvents,\n outputs: execution.outputs ?? {},\n };\n}\n\nexport function assembleJobsContext(\n jobs: readonly JobContextInput[],\n): WorkflowExpressionEvaluationContext & {readonly jobs: Record<string, unknown>} {\n return {\n jobs: Object.fromEntries(jobs.map((input) => [input.job.key, assembleJobContext(input)])),\n };\n}\n\nexport interface AssembleJobActivationContextParams extends AssembleWorkflowRunContextParams {\n readonly jobs: readonly JobContextInput[];\n}\n\nexport function assembleJobActivationContext(\n params: AssembleJobActivationContextParams,\n): WorkflowEvaluationContext {\n return {\n site: 'job-activation',\n values: {\n ...assembleWorkflowRunContext(params),\n ...assembleJobsContext(params.jobs),\n needs: params.jobs.map(assembleJobContext),\n },\n };\n}\n\ntype ListenerSnapshotRoot = 'run' | 'trigger' | 'inputs' | 'job' | 'jobs';\n\nexport interface MatcherSnapshotPlan {\n readonly matcher: JobListeningTrigger;\n readonly roots: ReadonlySet<ListenerSnapshotRoot>;\n readonly jobKeys: ReadonlySet<string>;\n}\n\nexport interface ListenerSnapshotPlan {\n readonly on: readonly MatcherSnapshotPlan[];\n readonly until: readonly MatcherSnapshotPlan[];\n readonly roots: ReadonlySet<ListenerSnapshotRoot>;\n readonly jobKeys: ReadonlySet<string>;\n}\n\nexport function planListenerFilterSnapshots(params: {\n readonly on: readonly JobListeningTrigger[];\n readonly until: readonly JobListeningTrigger[] | null;\n}): ListenerSnapshotPlan {\n const roots = new Set<ListenerSnapshotRoot>();\n const jobKeys = new Set<string>();\n const on = params.on.map((matcher) => planMatcherFilterSnapshot(matcher, roots, jobKeys));\n const until = (params.until ?? []).map((matcher) =>\n planMatcherFilterSnapshot(matcher, roots, jobKeys),\n );\n return {on, until, roots, jobKeys};\n}\n\nfunction planMatcherFilterSnapshot(\n matcher: JobListeningTrigger,\n allRoots: Set<ListenerSnapshotRoot>,\n allJobKeys: Set<string>,\n): MatcherSnapshotPlan {\n if (matcher.filter === undefined) return {matcher, roots: new Set(), jobKeys: new Set()};\n\n let roots: ListenerSnapshotRoot[];\n try {\n roots = extractExactContextRoots(matcher.filter)\n .filter((root) => root !== 'event')\n .filter(isListenerSnapshotRoot);\n } catch {\n return {matcher, roots: new Set(), jobKeys: new Set()};\n }\n\n if (roots.length === 0) return {matcher, roots: new Set(), jobKeys: new Set()};\n\n const jobKeys =\n roots.includes('jobs') && matcher.filter !== undefined\n ? new Set(\n analyzeContextRootKeyAccess(matcher.filter, ['jobs']).references.map(\n (reference) => reference.key,\n ),\n )\n : new Set<string>();\n for (const root of roots) allRoots.add(root);\n for (const key of jobKeys) allJobKeys.add(key);\n return {matcher, roots: new Set(roots), jobKeys};\n}\n\nfunction isListenerSnapshotRoot(root: string): root is ListenerSnapshotRoot {\n return (\n root === 'run' || root === 'trigger' || root === 'inputs' || root === 'job' || root === 'jobs'\n );\n}\n\nexport function assembleListenerSnapshotContext(params: {\n readonly job: Pick<Job, 'key'>;\n readonly run: AssembleWorkflowRunContextParams['run'];\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly plan: ListenerSnapshotPlan;\n readonly dependencyJobs: readonly JobContextInput[];\n}): WorkflowExpressionEvaluationContext {\n const context: Record<string, unknown> = {};\n if (params.plan.roots.has('run') || params.plan.roots.has('trigger')) {\n const runContext = assembleWorkflowRunContext({\n run: params.run,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs,\n });\n if (params.plan.roots.has('run')) context.run = runContext.run;\n if (params.plan.roots.has('trigger')) context.trigger = runContext.trigger;\n }\n\n if (params.plan.roots.has('inputs')) {\n context.inputs = params.inputs ?? null;\n }\n if (params.plan.roots.has('job')) {\n context.job = {key: params.job.key};\n }\n if (params.plan.roots.has('jobs')) {\n context.jobs = requestedJobsContext(params.dependencyJobs, params.plan.jobKeys);\n }\n\n return context;\n}\n\nfunction requestedJobsContext(\n dependencyJobs: readonly JobContextInput[],\n jobKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n if (jobKeys.size === 0) return assembleJobsContext(dependencyJobs).jobs;\n\n const filtered = dependencyJobs.filter(({job}) => jobKeys.has(job.key));\n\n return assembleJobsContext(filtered).jobs;\n}\n\nexport type ListenerTriggerWithSnapshot = JobListeningTrigger & {\n readonly filter_snapshot?: Record<string, unknown>;\n};\n\nexport function applyListenerFilterSnapshots(\n plans: readonly MatcherSnapshotPlan[],\n context: WorkflowExpressionEvaluationContext,\n): ListenerTriggerWithSnapshot[] {\n return plans.map((plan) => {\n const filterSnapshot = filterSnapshotForPlan(plan, context);\n if (filterSnapshot === undefined) return plan.matcher;\n\n return {...plan.matcher, filter_snapshot: filterSnapshot};\n });\n}\n\nfunction filterSnapshotForPlan(\n plan: MatcherSnapshotPlan,\n context: WorkflowExpressionEvaluationContext,\n): Record<string, unknown> | undefined {\n const snapshot: Record<string, unknown> = {};\n for (const root of plan.roots) {\n if (root === 'jobs') {\n const jobsSnapshot = jobsSnapshotForPlan(plan, context);\n if (jobsSnapshot !== undefined) snapshot.jobs = jobsSnapshot;\n continue;\n }\n\n if (root in context) snapshot[root] = context[root];\n }\n\n return Object.keys(snapshot).length === 0 ? undefined : snapshot;\n}\n\nfunction jobsSnapshotForPlan(\n plan: MatcherSnapshotPlan,\n context: WorkflowExpressionEvaluationContext,\n): Record<string, unknown> | undefined {\n if (typeof context.jobs !== 'object' || context.jobs === null) {\n return undefined;\n }\n\n const jobsContext = context.jobs as Record<string, unknown>;\n if (plan.jobKeys.size === 0) return {...jobsContext};\n\n const snapshot = Object.fromEntries(\n [...plan.jobKeys].flatMap((key) =>\n Object.hasOwn(jobsContext, key) ? [[key, jobsContext[key]]] : [],\n ),\n );\n return snapshot;\n}\n\nfunction assembleJobContext({job, executions}: JobContextInput): Record<string, unknown> {\n return {\n key: job.key,\n status: job.status,\n outputs: job.outputs ?? {},\n executions: assembleExecutionsContext(executions).executions,\n };\n}\n\nfunction assembleStepsContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n}): Record<string, Record<string, unknown>> {\n return buildStepAttemptContext(params).stepsContext;\n}\n\nfunction buildStepAttemptContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n}): {\n readonly stepsContext: Record<string, Record<string, unknown>>;\n readonly stepsFailed: boolean;\n readonly orderedAttempts: readonly StepAttempt[];\n readonly stepsByKey: ReadonlyMap<string, Step>;\n readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;\n} {\n const stepsByKey = new Map(\n params.steps.flatMap((step) => (step.key === null ? [] : [[step.key, step] as const])),\n );\n const terminalAttemptsByStepId = new Map<string, StepAttempt[]>();\n const orderedAttempts = [...params.attempts].sort(\n (left, right) => left.executionOrder - right.executionOrder,\n );\n\n for (const attempt of orderedAttempts) {\n if (attempt.status === 'running') continue;\n const attemptsForStep = terminalAttemptsByStepId.get(attempt.stepId) ?? [];\n attemptsForStep.push(attempt);\n terminalAttemptsByStepId.set(attempt.stepId, attemptsForStep);\n }\n\n const stepsContext: Record<string, Record<string, unknown>> = {};\n\n for (const step of params.steps) {\n if (step.key === null) continue;\n const attempts = terminalAttemptsByStepId.get(step.id) ?? [];\n const latestAttempt = attempts.at(-1);\n stepsContext[step.key] = {\n status: step.status,\n ...(latestAttempt === undefined ? {} : latestAttemptFields(latestAttempt)),\n attempts: attempts.map(attemptFields),\n };\n }\n\n return {\n stepsContext,\n stepsFailed: params.steps.some((step) => step.status === 'failed'),\n orderedAttempts,\n stepsByKey,\n terminalAttemptsByStepId,\n };\n}\n\nexport function assembleStepDispatchContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n readonly targetStepId: string;\n readonly jobExecution?: JobExecution;\n readonly jobs?: readonly JobContextInput[];\n}): WorkflowEvaluationContext {\n const targetStep = params.steps.find((step) => step.id === params.targetStepId);\n const stepAttemptContext = buildStepAttemptContext(params);\n const restart =\n targetStep === undefined || targetStep.currentAttempt <= 1\n ? undefined\n : restartProvenance({\n targetStep,\n orderedAttempts: stepAttemptContext.orderedAttempts,\n stepsByKey: stepAttemptContext.stepsByKey,\n terminalAttemptsByStepId: stepAttemptContext.terminalAttemptsByStepId,\n });\n\n return {\n site: 'step-dispatch',\n values: {\n ...(params.jobs === undefined ? {} : assembleJobsContext(params.jobs)),\n ...(params.jobExecution === undefined\n ? {}\n : {\n execution: {\n index: params.jobExecution.sequence,\n name: params.jobExecution.name,\n status: params.jobExecution.status,\n failed: stepAttemptContext.stepsFailed,\n started_at: params.jobExecution.startedAt,\n finished_at: params.jobExecution.finishedAt,\n events: params.jobExecution.triggerEvents,\n outputs: params.jobExecution.outputs ?? {},\n },\n }),\n ...(targetStep === undefined\n ? {}\n : {\n step: {\n attempt: BigInt(targetStep.currentAttempt),\n is_retry: targetStep.currentAttempt > 1,\n ...(restart === undefined ? {} : {restart}),\n },\n }),\n steps: stepAttemptContext.stepsContext,\n },\n };\n}\n\nfunction restartProvenance(params: {\n readonly targetStep: Step;\n readonly orderedAttempts: readonly StepAttempt[];\n readonly stepsByKey: ReadonlyMap<string, Step>;\n readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;\n}): Record<string, unknown> | undefined {\n for (const attempt of [...params.orderedAttempts].reverse()) {\n if (attempt.status !== 'failed' || attempt.restartFeedback === null) continue;\n const restartFromKey = restartFromStepKey(attempt);\n if (restartFromKey === undefined) continue;\n\n const restartFromStep = params.stepsByKey.get(restartFromKey);\n if (restartFromStep === undefined || restartFromStep.position > params.targetStep.position) {\n continue;\n }\n\n const gatingAttempts = params.terminalAttemptsByStepId.get(attempt.stepId) ?? [];\n return {\n from: {\n ...attemptFields(attempt),\n attempts: gatingAttempts.map(attemptFields),\n },\n feedback: attempt.restartFeedback,\n };\n }\n\n return undefined;\n}\n\nfunction restartFromStepKey(attempt: StepAttempt): string | undefined {\n const gate = attempt.config?.gate;\n if (gate === null || typeof gate !== 'object') return undefined;\n const onFailure = (gate as Record<string, unknown>).on_failure;\n if (onFailure === null || typeof onFailure !== 'object') return undefined;\n const restartFrom = (onFailure as Record<string, unknown>).restart_from;\n return typeof restartFrom === 'string' ? restartFrom : undefined;\n}\n\nfunction attemptFields(attempt: StepAttempt): Record<string, unknown> {\n return {\n status: attempt.status,\n outputs: attempt.output ?? {},\n ...(attempt.response === null ? {} : {response: attempt.response}),\n ...(attempt.exitCode === null ? {} : {exit_code: BigInt(attempt.exitCode)}),\n ...(attempt.gateResult === null ? {} : {gate: attempt.gateResult}),\n };\n}\n\nfunction latestAttemptFields(attempt: StepAttempt): Record<string, unknown> {\n const fields = attemptFields(attempt);\n delete fields.status;\n return fields;\n}\n\nexport function assembleGateContext(params: {\n readonly status: StepStatus;\n readonly exitCode: number | null;\n readonly output?: Record<string, unknown> | null | undefined;\n}): WorkflowEvaluationContext {\n return {\n site: 'step-report',\n values: {\n step: {\n ...(params.exitCode === null ? {} : {exit_code: BigInt(params.exitCode)}),\n status: params.status,\n outputs: params.output ?? {},\n },\n },\n };\n}\n\nexport function assembleJobResolutionContext(\n executions: readonly JobExecution[],\n): WorkflowEvaluationContext {\n return {\n site: 'job-resolution',\n values: assembleExecutionsContext(executions),\n };\n}\n\nexport function assembleExecutionResolutionContext(params: {\n readonly run: AssembleWorkflowRunContextParams['run'];\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n readonly job: Pick<Job, 'key'>;\n readonly jobExecution: JobExecution;\n readonly executions: readonly JobExecution[];\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n readonly jobs?: readonly JobContextInput[];\n}): WorkflowEvaluationContext {\n const executions = assembleExecutionsContext(params.executions);\n const executionIndex = params.executions.findIndex(\n (execution) => execution.id === params.jobExecution.id,\n );\n\n return {\n site: 'execution-resolution',\n values: {\n ...assembleWorkflowRunContext(params),\n ...executions,\n ...(params.jobs === undefined ? {} : assembleJobsContext(params.jobs)),\n execution: assembleExecutionContext(\n params.jobExecution,\n executionIndex < 0 ? params.jobExecution.sequence - 1 : executionIndex,\n ),\n job: {key: params.job.key},\n steps: assembleStepsContext({steps: params.steps, attempts: params.attempts}),\n },\n };\n}\n"],"names":["analyzeContextRootKeyAccess","extractExactContextRoots","assembleWorkflowRunContext","params","run","id","name","definition_id","definitionId","project_id","projectId","workspace_id","workspaceId","created_at","createdAt","trigger","source","triggerPayload","event","data","inputs","vars","undefined","assembleCreationContext","site","values","assembleExecutionCreationContext","execution","jobId","sequence","executionName","runner","status","statusReason","triggerEvents","outputs","version","Date","updatedAt","queuedAt","startedAt","finishedAt","timedOutAt","executions","assembleExecutionsContext","priorExecutions","executionValues","at","map","index","assembleExecutionContext","started_at","finished_at","events","assembleJobsContext","jobs","Object","fromEntries","input","job","key","assembleJobContext","assembleJobActivationContext","needs","planListenerFilterSnapshots","roots","Set","jobKeys","on","matcher","planMatcherFilterSnapshot","until","allRoots","allJobKeys","filter","root","isListenerSnapshotRoot","length","includes","references","reference","add","assembleListenerSnapshotContext","context","plan","has","runContext","requestedJobsContext","dependencyJobs","size","filtered","applyListenerFilterSnapshots","plans","filterSnapshot","filterSnapshotForPlan","filter_snapshot","snapshot","jobsSnapshot","jobsSnapshotForPlan","keys","jobsContext","flatMap","hasOwn","assembleStepsContext","buildStepAttemptContext","stepsContext","stepsByKey","Map","steps","step","terminalAttemptsByStepId","orderedAttempts","attempts","sort","left","right","executionOrder","attempt","attemptsForStep","get","stepId","push","set","latestAttempt","latestAttemptFields","attemptFields","stepsFailed","some","assembleStepDispatchContext","targetStep","find","targetStepId","stepAttemptContext","restart","currentAttempt","restartProvenance","jobExecution","failed","BigInt","is_retry","reverse","restartFeedback","restartFromKey","restartFromStepKey","restartFromStep","position","gatingAttempts","from","feedback","gate","config","onFailure","on_failure","restartFrom","restart_from","output","response","exitCode","exit_code","gateResult","fields","assembleGateContext","assembleJobResolutionContext","assembleExecutionResolutionContext","executionIndex","findIndex"],"mappings":"AAAA,SACEA,2BAA2B,EAC3BC,wBAAwB,QAEnB,sBAAsB;AAsB7B,OAAO,SAASC,2BACdC,MAAwC;IAExC,OAAO;QACLC,KAAK;YACHC,IAAIF,OAAOC,GAAG,CAACC,EAAE;YACjBC,MAAMH,OAAOC,GAAG,CAACE,IAAI;YACrBC,eAAeJ,OAAOC,GAAG,CAACI,YAAY;YACtCC,YAAYN,OAAOC,GAAG,CAACM,SAAS;YAChCC,cAAcR,OAAOC,GAAG,CAACQ,WAAW;YACpCC,YAAYV,OAAOC,GAAG,CAACU,SAAS;QAClC;QACAC,SAAS;YACPC,QAAQb,OAAOc,cAAc,CAACD,MAAM;YACpCE,OAAOf,OAAOc,cAAc,CAACC,KAAK;QACpC;QACAA,OAAO,UAAUf,OAAOc,cAAc,GAAGd,OAAOc,cAAc,CAACE,IAAI,GAAG;QACtEC,QAAQjB,OAAOiB,MAAM,IAAI;QACzB,GAAIjB,OAAOkB,IAAI,KAAKC,YAAY,CAAC,IAAI;YAACD,MAAMlB,OAAOkB,IAAI;QAAA,CAAC;IAC1D;AACF;AAEA,OAAO,SAASE,wBACdpB,MAAwC;IAExC,OAAO;QACLqB,MAAM;QACNC,QAAQvB,2BAA2BC;IACrC;AACF;AAWA,OAAO,SAASuB,iCACdvB,MAA8C;IAE9C,MAAMwB,YAA0B;QAC9BtB,IAAI,GAAGF,OAAOyB,KAAK,CAAC,CAAC,EAAEzB,OAAO0B,QAAQ,EAAE;QACxCD,OAAOzB,OAAOyB,KAAK;QACnBC,UAAU1B,OAAO0B,QAAQ;QACzBvB,MAAMH,OAAO2B,aAAa;QAC1BC,QAAQ;QACRC,QAAQ7B,OAAO6B,MAAM;QACrBC,cAAc;QACdC,eAAe;eAAI/B,OAAO+B,aAAa;SAAC;QACxCC,SAAS;QACTC,SAAS;QACTtB,WAAW,IAAIuB;QACfC,WAAW,IAAID;QACfE,UAAU;QACVC,WAAW;QACXC,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AKzD,OAAOwD,GAAG,CAACC,GAAG;YAAA;YACzBgD,OAAOL,qBAAqB;gBAACK,OAAOzG,OAAOyG,KAAK;gBAAEI,UAAU7G,OAAO6G,QAAQ;YAAA;QAC7E;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/step-config/assemble-run-context.ts"],"sourcesContent":["import {\n analyzeContextRootKeyAccess,\n extractExactContextRoots,\n getWorkflowPredicateContextRoots,\n type WorkflowExpressionEvaluationContext,\n type WorkflowPredicateContextRoot,\n} from '@shipfox/expression';\nimport type {Job, JobListeningTrigger} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport type {Step, StepAttempt, StepStatus} from '#core/entities/step.js';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunTriggerReference,\n} from '#core/entities/workflow-run.js';\nimport type {WorkflowEvaluationContext} from './workflow-evaluation-context.js';\n\nexport interface JobContextInput {\n readonly job: Pick<Job, 'key' | 'status' | 'outputs'>;\n readonly executions: readonly JobExecution[];\n}\n\nexport interface AssembleWorkflowRunContextParams {\n readonly run: Pick<\n WorkflowRun,\n | 'id'\n | 'number'\n | 'name'\n | 'workflowName'\n | 'definitionId'\n | 'projectId'\n | 'workspaceId'\n | 'createdAt'\n > & {readonly triggerReference?: WorkflowRunTriggerReference | null | undefined};\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n}\n\nexport function assembleWorkflowRunContext(\n params: AssembleWorkflowRunContextParams,\n): WorkflowExpressionEvaluationContext {\n const triggerReference = params.run.triggerReference;\n return {\n workflow: {\n id: params.run.definitionId,\n name: params.run.workflowName,\n },\n run: {\n id: params.run.id,\n number: params.run.number,\n name: params.run.name,\n project_id: params.run.projectId,\n workspace_id: params.run.workspaceId,\n created_at: params.run.createdAt,\n },\n trigger: {\n source: params.triggerPayload.source,\n event: params.triggerPayload.event,\n project: triggerReference?.project ?? null,\n repository: triggerReference?.repository ?? null,\n ref: triggerReference?.ref ?? null,\n commit: triggerReference?.commit ?? null,\n },\n event: 'data' in params.triggerPayload ? params.triggerPayload.data : null,\n inputs: params.inputs ?? null,\n ...(params.vars === undefined ? {} : {vars: params.vars}),\n };\n}\n\nexport function assembleCreationContext(\n params: AssembleWorkflowRunContextParams,\n): WorkflowEvaluationContext {\n return {\n site: 'run-creation',\n values: assembleWorkflowRunContext(params),\n };\n}\n\nexport interface AssembleExecutionCreationContextParams extends AssembleWorkflowRunContextParams {\n readonly job: Pick<Job, 'id' | 'key' | 'name'>;\n readonly sequence: number;\n readonly nameOverride: string | null;\n readonly executionName: string;\n readonly status: JobExecution['status'];\n readonly triggerEvents: readonly JobExecution['triggerEvents'][number][];\n readonly priorExecutions: readonly JobExecution[];\n}\n\nexport function assembleExecutionCreationContext(\n params: AssembleExecutionCreationContextParams,\n): WorkflowEvaluationContext {\n const execution: JobExecution = {\n id: `${params.job.id}:${params.sequence}`,\n jobId: params.job.id,\n sequence: params.sequence,\n nameOverride: params.nameOverride,\n name: params.executionName,\n runner: null,\n status: params.status,\n statusReason: null,\n triggerEvents: [...params.triggerEvents],\n outputs: null,\n version: 1,\n createdAt: new Date(),\n updatedAt: new Date(),\n queuedAt: null,\n startedAt: null,\n finishedAt: null,\n timedOutAt: null,\n };\n const executions = assembleExecutionsContext([...params.priorExecutions, execution]);\n const executionValues = executions.executions as unknown[];\n return {\n site: 'execution-creation',\n values: {\n ...assembleWorkflowRunContext(params),\n ...executions,\n job: {key: params.job.key, name: params.job.name ?? params.job.key},\n execution: executionValues.at(-1),\n },\n };\n}\n\n/**\n * Keeps job-success predicate values aligned with the registry's `executions`\n * type environment.\n */\nexport function assembleExecutionsContext(\n executions: readonly JobExecution[],\n): WorkflowExpressionEvaluationContext {\n return {\n executions: executions.map((execution, index) => assembleExecutionContext(execution, index)),\n };\n}\n\nfunction assembleExecutionContext(execution: JobExecution, index: number): Record<string, unknown> {\n return {\n index,\n name: execution.name,\n status: execution.status,\n started_at: execution.startedAt,\n finished_at: execution.finishedAt,\n events: execution.triggerEvents,\n outputs: execution.outputs ?? {},\n };\n}\n\nexport function assembleJobsContext(\n jobs: readonly JobContextInput[],\n): WorkflowExpressionEvaluationContext & {readonly jobs: Record<string, unknown>} {\n return {\n jobs: Object.fromEntries(jobs.map((input) => [input.job.key, assembleJobContext(input)])),\n };\n}\n\nexport interface AssembleJobActivationContextParams extends AssembleWorkflowRunContextParams {\n readonly jobs: readonly JobContextInput[];\n}\n\nexport function assembleJobActivationContext(\n params: AssembleJobActivationContextParams,\n): WorkflowEvaluationContext {\n return {\n site: 'job-activation',\n values: {\n ...assembleWorkflowRunContext(params),\n ...assembleJobsContext(params.jobs),\n needs: params.jobs.map(assembleJobContext),\n vars: params.vars ?? {},\n },\n };\n}\n\ntype ListenerPredicateField = 'listener.on' | 'listener.until';\ntype ListenerSnapshotRoot = Exclude<WorkflowPredicateContextRoot<ListenerPredicateField>, 'event'>;\n\nexport interface MatcherSnapshotPlan {\n readonly matcher: JobListeningTrigger;\n readonly roots: ReadonlySet<ListenerSnapshotRoot>;\n readonly jobKeys: ReadonlySet<string>;\n}\n\nexport interface ListenerSnapshotPlan {\n readonly on: readonly MatcherSnapshotPlan[];\n readonly until: readonly MatcherSnapshotPlan[];\n readonly roots: ReadonlySet<ListenerSnapshotRoot>;\n readonly jobKeys: ReadonlySet<string>;\n}\n\nexport function planListenerFilterSnapshots(params: {\n readonly on: readonly JobListeningTrigger[];\n readonly until: readonly JobListeningTrigger[] | null;\n}): ListenerSnapshotPlan {\n const roots = new Set<ListenerSnapshotRoot>();\n const jobKeys = new Set<string>();\n const on = params.on.map((matcher) =>\n planMatcherFilterSnapshot('listener.on', matcher, roots, jobKeys),\n );\n const until = (params.until ?? []).map((matcher) =>\n planMatcherFilterSnapshot('listener.until', matcher, roots, jobKeys),\n );\n return {on, until, roots, jobKeys};\n}\n\nfunction planMatcherFilterSnapshot(\n field: ListenerPredicateField,\n matcher: JobListeningTrigger,\n allRoots: Set<ListenerSnapshotRoot>,\n allJobKeys: Set<string>,\n): MatcherSnapshotPlan {\n if (matcher.filter === undefined) return {matcher, roots: new Set(), jobKeys: new Set()};\n\n let roots: ListenerSnapshotRoot[];\n try {\n roots = extractExactContextRoots(matcher.filter).filter((root) =>\n isListenerSnapshotRoot(field, root),\n );\n } catch {\n return {matcher, roots: new Set(), jobKeys: new Set()};\n }\n\n if (roots.length === 0) return {matcher, roots: new Set(), jobKeys: new Set()};\n\n const jobKeys =\n roots.includes('jobs') && matcher.filter !== undefined\n ? new Set(\n analyzeContextRootKeyAccess(matcher.filter, ['jobs']).references.map(\n (reference) => reference.key,\n ),\n )\n : new Set<string>();\n for (const root of roots) allRoots.add(root);\n for (const key of jobKeys) allJobKeys.add(key);\n return {matcher, roots: new Set(roots), jobKeys};\n}\n\nfunction isListenerSnapshotRoot(\n field: ListenerPredicateField,\n root: string,\n): root is ListenerSnapshotRoot {\n return (\n root !== 'event' &&\n getWorkflowPredicateContextRoots(field).includes(\n root as WorkflowPredicateContextRoot<ListenerPredicateField>,\n )\n );\n}\n\nexport function assembleListenerSnapshotContext(params: {\n readonly job: Pick<Job, 'key'> & Partial<Pick<Job, 'name'>>;\n readonly run: AssembleWorkflowRunContextParams['run'];\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n readonly plan: ListenerSnapshotPlan;\n readonly dependencyJobs: readonly JobContextInput[];\n}): WorkflowExpressionEvaluationContext {\n const context: Record<string, unknown> = {};\n if (\n params.plan.roots.has('workflow') ||\n params.plan.roots.has('run') ||\n params.plan.roots.has('trigger')\n ) {\n const runContext = assembleWorkflowRunContext({\n run: params.run,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs,\n vars: params.vars,\n });\n if (params.plan.roots.has('workflow')) context.workflow = runContext.workflow;\n if (params.plan.roots.has('run')) context.run = runContext.run;\n if (params.plan.roots.has('trigger')) context.trigger = runContext.trigger;\n }\n\n if (params.plan.roots.has('inputs')) {\n context.inputs = params.inputs ?? null;\n }\n if (params.plan.roots.has('vars')) {\n context.vars = params.vars ?? {};\n }\n if (params.plan.roots.has('job')) {\n context.job = {\n key: params.job.key,\n ...(params.job.name === undefined ? {} : {name: params.job.name ?? params.job.key}),\n };\n }\n if (params.plan.roots.has('jobs')) {\n context.jobs = requestedJobsContext(params.dependencyJobs, params.plan.jobKeys);\n }\n\n return context;\n}\n\nfunction requestedJobsContext(\n dependencyJobs: readonly JobContextInput[],\n jobKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n if (jobKeys.size === 0) return assembleJobsContext(dependencyJobs).jobs;\n\n const filtered = dependencyJobs.filter(({job}) => jobKeys.has(job.key));\n\n return assembleJobsContext(filtered).jobs;\n}\n\nexport type ListenerTriggerWithSnapshot = JobListeningTrigger & {\n readonly filter_snapshot?: Record<string, unknown>;\n};\n\nexport function applyListenerFilterSnapshots(\n plans: readonly MatcherSnapshotPlan[],\n context: WorkflowExpressionEvaluationContext,\n): ListenerTriggerWithSnapshot[] {\n return plans.map((plan) => {\n const filterSnapshot = filterSnapshotForPlan(plan, context);\n if (filterSnapshot === undefined) return plan.matcher;\n\n return {...plan.matcher, filter_snapshot: filterSnapshot};\n });\n}\n\nfunction filterSnapshotForPlan(\n plan: MatcherSnapshotPlan,\n context: WorkflowExpressionEvaluationContext,\n): Record<string, unknown> | undefined {\n const snapshot: Record<string, unknown> = {};\n for (const root of plan.roots) {\n if (root === 'jobs') {\n const jobsSnapshot = jobsSnapshotForPlan(plan, context);\n if (jobsSnapshot !== undefined) snapshot.jobs = jobsSnapshot;\n continue;\n }\n\n if (root in context) snapshot[root] = context[root];\n }\n\n return Object.keys(snapshot).length === 0 ? undefined : snapshot;\n}\n\nfunction jobsSnapshotForPlan(\n plan: MatcherSnapshotPlan,\n context: WorkflowExpressionEvaluationContext,\n): Record<string, unknown> | undefined {\n if (typeof context.jobs !== 'object' || context.jobs === null) {\n return undefined;\n }\n\n const jobsContext = context.jobs as Record<string, unknown>;\n if (plan.jobKeys.size === 0) return {...jobsContext};\n\n const snapshot = Object.fromEntries(\n [...plan.jobKeys].flatMap((key) =>\n Object.hasOwn(jobsContext, key) ? [[key, jobsContext[key]]] : [],\n ),\n );\n return snapshot;\n}\n\nfunction assembleJobContext({job, executions}: JobContextInput): Record<string, unknown> {\n return {\n key: job.key,\n status: job.status,\n outputs: job.outputs ?? {},\n executions: assembleExecutionsContext(executions).executions,\n };\n}\n\nfunction assembleStepsContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n}): Record<string, Record<string, unknown>> {\n return buildStepAttemptContext(params).stepsContext;\n}\n\nfunction buildStepAttemptContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n}): {\n readonly stepsContext: Record<string, Record<string, unknown>>;\n readonly stepsFailed: boolean;\n readonly orderedAttempts: readonly StepAttempt[];\n readonly stepsByKey: ReadonlyMap<string, Step>;\n readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;\n} {\n const stepsByKey = new Map(\n params.steps.flatMap((step) => (step.key === null ? [] : [[step.key, step] as const])),\n );\n const terminalAttemptsByStepId = new Map<string, StepAttempt[]>();\n const orderedAttempts = [...params.attempts].sort(\n (left, right) => left.executionOrder - right.executionOrder,\n );\n\n for (const attempt of orderedAttempts) {\n if (attempt.status === 'running') continue;\n const attemptsForStep = terminalAttemptsByStepId.get(attempt.stepId) ?? [];\n attemptsForStep.push(attempt);\n terminalAttemptsByStepId.set(attempt.stepId, attemptsForStep);\n }\n\n const stepsContext: Record<string, Record<string, unknown>> = {};\n\n for (const step of params.steps) {\n if (step.key === null) continue;\n const attempts = terminalAttemptsByStepId.get(step.id) ?? [];\n const latestAttempt = attempts.at(-1);\n stepsContext[step.key] = {\n status: step.status,\n ...(latestAttempt === undefined ? {} : latestAttemptFields(latestAttempt)),\n attempts: attempts.map(attemptFields),\n };\n }\n\n return {\n stepsContext,\n stepsFailed: params.steps.some((step) => step.status === 'failed'),\n orderedAttempts,\n stepsByKey,\n terminalAttemptsByStepId,\n };\n}\n\nexport function assembleStepDispatchContext(params: {\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n readonly targetStepId: string;\n readonly jobExecution?: JobExecution;\n readonly jobs?: readonly JobContextInput[];\n readonly vars?: Record<string, string> | undefined;\n}): WorkflowEvaluationContext {\n const targetStep = params.steps.find((step) => step.id === params.targetStepId);\n const stepAttemptContext = buildStepAttemptContext(params);\n const restart =\n targetStep === undefined || targetStep.currentAttempt <= 1\n ? undefined\n : restartProvenance({\n targetStep,\n orderedAttempts: stepAttemptContext.orderedAttempts,\n stepsByKey: stepAttemptContext.stepsByKey,\n terminalAttemptsByStepId: stepAttemptContext.terminalAttemptsByStepId,\n });\n\n return {\n site: 'step-dispatch',\n values: {\n vars: params.vars ?? {},\n ...assembleJobsContext(params.jobs ?? []),\n ...(params.jobExecution === undefined\n ? {}\n : {\n execution: {\n index: params.jobExecution.sequence,\n name: params.jobExecution.name,\n status: params.jobExecution.status,\n failed: stepAttemptContext.stepsFailed,\n started_at: params.jobExecution.startedAt,\n finished_at: params.jobExecution.finishedAt,\n events: params.jobExecution.triggerEvents,\n outputs: params.jobExecution.outputs ?? {},\n },\n }),\n ...(targetStep === undefined\n ? {}\n : {\n step: {\n attempt: BigInt(targetStep.currentAttempt),\n is_retry: targetStep.currentAttempt > 1,\n ...(restart === undefined ? {} : {restart}),\n },\n }),\n steps: stepAttemptContext.stepsContext,\n },\n };\n}\n\nfunction restartProvenance(params: {\n readonly targetStep: Step;\n readonly orderedAttempts: readonly StepAttempt[];\n readonly stepsByKey: ReadonlyMap<string, Step>;\n readonly terminalAttemptsByStepId: ReadonlyMap<string, readonly StepAttempt[]>;\n}): Record<string, unknown> | undefined {\n for (const attempt of [...params.orderedAttempts].reverse()) {\n if (attempt.status !== 'failed' || attempt.restartFeedback === null) continue;\n const restartFromKey = restartFromStepKey(attempt);\n if (restartFromKey === undefined) continue;\n\n const restartFromStep = params.stepsByKey.get(restartFromKey);\n if (restartFromStep === undefined || restartFromStep.position > params.targetStep.position) {\n continue;\n }\n\n const gatingAttempts = params.terminalAttemptsByStepId.get(attempt.stepId) ?? [];\n return {\n from: {\n ...attemptFields(attempt),\n attempts: gatingAttempts.map(attemptFields),\n },\n feedback: attempt.restartFeedback,\n };\n }\n\n return undefined;\n}\n\nfunction restartFromStepKey(attempt: StepAttempt): string | undefined {\n const gate = attempt.config?.gate;\n if (gate === null || typeof gate !== 'object') return undefined;\n const onFailure = (gate as Record<string, unknown>).on_failure;\n if (onFailure === null || typeof onFailure !== 'object') return undefined;\n const restartFrom = (onFailure as Record<string, unknown>).restart_from;\n return typeof restartFrom === 'string' ? restartFrom : undefined;\n}\n\nfunction attemptFields(attempt: StepAttempt): Record<string, unknown> {\n return {\n status: attempt.status,\n outputs: attempt.output ?? {},\n ...(attempt.response === null ? {} : {response: attempt.response}),\n ...(attempt.exitCode === null ? {} : {exit_code: BigInt(attempt.exitCode)}),\n ...(attempt.gateResult === null ? {} : {gate: attempt.gateResult}),\n };\n}\n\nfunction latestAttemptFields(attempt: StepAttempt): Record<string, unknown> {\n const fields = attemptFields(attempt);\n delete fields.status;\n return fields;\n}\n\nexport function assembleGateContext(params: {\n readonly status: StepStatus;\n readonly exitCode: number | null;\n readonly output?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n}): WorkflowEvaluationContext {\n return {\n site: 'step-report',\n values: {\n vars: params.vars ?? {},\n step: {\n ...(params.exitCode === null ? {} : {exit_code: BigInt(params.exitCode)}),\n status: params.status,\n outputs: params.output ?? {},\n },\n },\n };\n}\n\nexport function assembleJobResolutionContext(params: {\n readonly executions: readonly JobExecution[];\n readonly jobs: readonly JobContextInput[];\n readonly vars?: Record<string, string> | undefined;\n}): WorkflowEvaluationContext {\n return {\n site: 'job-resolution',\n values: {\n ...assembleExecutionsContext(params.executions),\n ...assembleJobsContext(params.jobs),\n vars: params.vars ?? {},\n },\n };\n}\n\nexport function assembleExecutionResolutionContext(params: {\n readonly run: AssembleWorkflowRunContextParams['run'];\n readonly triggerPayload: TriggerPayload;\n readonly inputs?: Record<string, unknown> | null | undefined;\n readonly vars?: Record<string, string> | undefined;\n readonly job: Pick<Job, 'key'> & Partial<Pick<Job, 'name'>>;\n readonly jobExecution: JobExecution;\n readonly executions: readonly JobExecution[];\n readonly steps: readonly Step[];\n readonly attempts: readonly StepAttempt[];\n readonly jobs?: readonly JobContextInput[];\n}): WorkflowEvaluationContext {\n const executions = assembleExecutionsContext(params.executions);\n const executionIndex = params.executions.findIndex(\n (execution) => execution.id === params.jobExecution.id,\n );\n\n return {\n site: 'execution-resolution',\n values: {\n ...assembleWorkflowRunContext(params),\n ...executions,\n ...(params.jobs === undefined ? {} : assembleJobsContext(params.jobs)),\n execution: assembleExecutionContext(\n params.jobExecution,\n executionIndex < 0 ? params.jobExecution.sequence - 1 : executionIndex,\n ),\n job: {\n key: params.job.key,\n ...(params.job.name === undefined ? {} : {name: params.job.name ?? params.job.key}),\n },\n steps: assembleStepsContext({steps: params.steps, attempts: params.attempts}),\n },\n };\n}\n"],"names":["analyzeContextRootKeyAccess","extractExactContextRoots","getWorkflowPredicateContextRoots","assembleWorkflowRunContext","params","triggerReference","run","workflow","id","definitionId","name","workflowName","number","project_id","projectId","workspace_id","workspaceId","created_at","createdAt","trigger","source","triggerPayload","event","project","repository","ref","commit","data","inputs","vars","undefined","assembleCreationContext","site","values","assembleExecutionCreationContext","execution","job","sequence","jobId","nameOverride","executionName","runner","status","statusReason","triggerEvents","outputs","version","Date","updatedAt","queuedAt","startedAt","finishedAt","timedOutAt","executions","assembleExecutionsContext","priorExecutions","executionValues","key","at","map","index","assembleExecutionContext","started_at","finished_at","events","assembleJobsContext","jobs","Object","fromEntries","input","assembleJobContext","assembleJobActivationContext","needs","planListenerFilterSnapshots","roots","Set","jobKeys","on","matcher","planMatcherFilterSnapshot","until","field","allRoots","allJobKeys","filter","root","isListenerSnapshotRoot","length","includes","references","reference","add","assembleListenerSnapshotContext","context","plan","has","runContext","requestedJobsContext","dependencyJobs","size","filtered","applyListenerFilterSnapshots","plans","filterSnapshot","filterSnapshotForPlan","filter_snapshot","snapshot","jobsSnapshot","jobsSnapshotForPlan","keys","jobsContext","flatMap","hasOwn","assembleStepsContext","buildStepAttemptContext","stepsContext","stepsByKey","Map","steps","step","terminalAttemptsByStepId","orderedAttempts","attempts","sort","left","right","executionOrder","attempt","attemptsForStep","get","stepId","push","set","latestAttempt","latestAttemptFields","attemptFields","stepsFailed","some","assembleStepDispatchContext","targetStep","find","targetStepId","stepAttemptContext","restart","currentAttempt","restartProvenance","jobExecution","failed","BigInt","is_retry","reverse","restartFeedback","restartFromKey","restartFromStepKey","restartFromStep","position","gatingAttempts","from","feedback","gate","config","onFailure","on_failure","restartFrom","restart_from","output","response","exitCode","exit_code","gateResult","fields","assembleGateContext","assembleJobResolutionContext","assembleExecutionResolutionContext","executionIndex","findIndex"],"mappings":"AAAA,SACEA,2BAA2B,EAC3BC,wBAAwB,EACxBC,gCAAgC,QAG3B,sBAAsB;AAiC7B,OAAO,SAASC,2BACdC,MAAwC;IAExC,MAAMC,mBAAmBD,OAAOE,GAAG,CAACD,gBAAgB;IACpD,OAAO;QACLE,UAAU;YACRC,IAAIJ,OAAOE,GAAG,CAACG,YAAY;YAC3BC,MAAMN,OAAOE,GAAG,CAACK,YAAY;QAC/B;QACAL,KAAK;YACHE,IAAIJ,OAAOE,GAAG,CAACE,EAAE;YACjBI,QAAQR,OAAOE,GAAG,CAACM,MAAM;YACzBF,MAAMN,OAAOE,GAAG,CAACI,IAAI;YACrBG,YAAYT,OAAOE,GAAG,CAACQ,SAAS;YAChCC,cAAcX,OAAOE,GAAG,CAACU,WAAW;YACpCC,YAAYb,OAAOE,GAAG,CAACY,SAAS;QAClC;QACAC,SAAS;YACPC,QAAQhB,OAAOiB,cAAc,CAACD,MAAM;YACpCE,OAAOlB,OAAOiB,cAAc,CAACC,KAAK;YAClCC,S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,OAAO8D,IAAI,CAAC;YACnCrC,MAAMzB,OAAOyB,IAAI,IAAI,CAAC;QACxB;IACF;AACF;AAEA,OAAO,SAASgJ,mCAAmCzK,MAWlD;IACC,MAAMiD,aAAaC,0BAA0BlD,OAAOiD,UAAU;IAC9D,MAAMyH,iBAAiB1K,OAAOiD,UAAU,CAAC0H,SAAS,CAChD,CAAC5I,YAAcA,UAAU3B,EAAE,KAAKJ,OAAO8I,YAAY,CAAC1I,EAAE;IAGxD,OAAO;QACLwB,MAAM;QACNC,QAAQ;YACN,GAAG9B,2BAA2BC,OAAO;YACrC,GAAGiD,UAAU;YACb,GAAIjD,OAAO8D,IAAI,KAAKpC,YAAY,CAAC,IAAImC,oBAAoB7D,OAAO8D,IAAI,CAAC;YACrE/B,WAAW0B,yBACTzD,OAAO8I,YAAY,EACnB4B,iBAAiB,IAAI1K,OAAO8I,YAAY,CAAC7G,QAAQ,GAAG,IAAIyI;YAE1D1I,KAAK;gBACHqB,KAAKrD,OAAOgC,GAAG,CAACqB,GAAG;gBACnB,GAAIrD,OAAOgC,GAAG,CAAC1B,IAAI,KAAKoB,YAAY,CAAC,IAAI;oBAACpB,MAAMN,OAAOgC,GAAG,CAAC1B,IAAI,IAAIN,OAAOgC,GAAG,CAACqB,GAAG;gBAAA,CAAC;YACpF;YACA6D,OAAOL,qBAAqB;gBAACK,OAAOlH,OAAOkH,KAAK;gBAAEI,UAAUtH,OAAOsH,QAAQ;YAAA;QAC7E;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete-step-dispatch-config.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/complete-step-dispatch-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"complete-step-dispatch-config.d.ts","sourceRoot":"","sources":["../../../src/core/step-config/complete-step-dispatch-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAC,6BAA6B,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAIhF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAEhF,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IACvD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAClE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,OAAO,CAAC;IACV,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,6BAA6B,EAAE,CAAC;CAC1D,CAAC,CA0CD"}
|