@oisincoveney/pipeline 3.24.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/defaults/pipeline.yaml +23 -5
- package/defaults/profiles.yaml +104 -21
- package/dist/argo-graph.js +90 -88
- package/dist/argo-submit.d.ts +110 -138
- package/dist/argo-submit.js +363 -378
- package/dist/argo-workflow.d.ts +156 -177
- package/dist/argo-workflow.js +96 -138
- package/dist/backlog.js +5 -4
- package/dist/bench/eval-report.js +21 -12
- package/dist/claude-settings-config.js +23 -31
- package/dist/claude-user-config.js +6 -16
- package/dist/cli/bootstrap-commands.js +3 -3
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.js +176 -171
- package/dist/cli/factory-commands.js +13 -13
- package/dist/cli/format.js +92 -86
- package/dist/cli/loop-commands.js +21 -21
- package/dist/cli/mcp-gateway-commands.js +12 -12
- package/dist/cli/plan-commands.js +85 -116
- package/dist/cli/program.d.ts +3 -3
- package/dist/cli/program.js +41 -43
- package/dist/cli/run-command.d.ts +1 -1
- package/dist/cli/run-command.js +25 -25
- package/dist/cli/run-commands.js +31 -29
- package/dist/cli/run-resolver.d.ts +1 -1
- package/dist/cli/run-resolver.js +30 -32
- package/dist/cli/run-service.d.ts +2 -3
- package/dist/cli/run-service.js +229 -239
- package/dist/cli/submit-options.js +85 -83
- package/dist/cluster-doctor.js +147 -175
- package/dist/codex-config.js +24 -30
- package/dist/commands/bench-command.js +9 -7
- package/dist/commands/coordinator-command.js +35 -0
- package/dist/commands/pipeline-command.js +13 -7
- package/dist/commands/runner-command-command.js +39 -24
- package/dist/commands/runner-node-command.js +31 -0
- package/dist/commands/ticket/complete.js +29 -33
- package/dist/commands/ticket/create.js +84 -82
- package/dist/commands/ticket/graph-check.js +11 -11
- package/dist/commands/ticket/next.js +36 -36
- package/dist/commands/ticket/sequence.js +11 -12
- package/dist/commands/ticket/shared.d.ts +5 -2
- package/dist/commands/ticket/shared.js +63 -66
- package/dist/commands/ticket/start.js +58 -67
- package/dist/commands/ticket-command.js +2 -2
- package/dist/config/defaults.d.ts +139 -140
- package/dist/config/defaults.js +81 -80
- package/dist/config/lint.js +52 -64
- package/dist/config/load.d.ts +4 -5
- package/dist/config/load.js +64 -74
- package/dist/config/schema/catalog.d.ts +2 -1
- package/dist/config/schema/catalog.js +3 -2
- package/dist/config/schema/mcp.js +46 -52
- package/dist/config/schemas.d.ts +382 -528
- package/dist/config/schemas.js +400 -398
- package/dist/config/validate.d.ts +1 -2
- package/dist/config/validate.js +236 -201
- package/dist/config.d.ts +2 -2
- package/dist/context/repo-map.js +105 -119
- package/dist/coordinator/composition.js +169 -0
- package/dist/coordinator/config.js +71 -0
- package/dist/coordinator/run-owner.js +64 -0
- package/dist/coordinator/wave-advance.js +148 -0
- package/dist/coordinator/wave-scheduler.js +50 -0
- package/dist/credentials/broker.d.ts +6 -8
- package/dist/credentials/broker.js +17 -16
- package/dist/credentials/codex-config.js +15 -19
- package/dist/credentials/file-targets.js +9 -15
- package/dist/credentials/local-codex-auth-sync.js +55 -58
- package/dist/credentials/opencode-config.js +28 -32
- package/dist/credentials/runner.js +13 -13
- package/dist/effect-sync-errors.js +28 -0
- package/dist/factory/create-experiment.js +285 -121
- package/dist/factory/exec.js +10 -12
- package/dist/factory/git-credentials.js +4 -4
- package/dist/factory/stamp-answers.js +10 -11
- package/dist/factory/template-update.js +65 -44
- package/dist/factory-lane.d.ts +26 -40
- package/dist/factory-lane.js +26 -25
- package/dist/gates.js +3 -3
- package/dist/git-remote-url.js +17 -19
- package/dist/hooks.d.ts +26 -26
- package/dist/hooks.js +20 -22
- package/dist/index.d.ts +4 -3
- package/dist/index.js +27 -36
- package/dist/install-commands/claude-code.js +100 -92
- package/dist/install-commands/host-selection.js +3 -6
- package/dist/install-commands/opencode.js +264 -259
- package/dist/install-commands/planner.js +163 -181
- package/dist/install-commands/result-format.js +1 -3
- package/dist/install-commands/shared.js +25 -42
- package/dist/install-commands/writer.js +22 -25
- package/dist/install-commands.js +8 -8
- package/dist/jscpd-output.js +29 -0
- package/dist/json-config-merge.js +14 -20
- package/dist/json-line-values.js +17 -6
- package/dist/loop/argo-poll.d.ts +0 -1
- package/dist/loop/argo-poll.js +15 -95
- package/dist/loop/backlog-records.js +1 -3
- package/dist/loop/controller-deps.js +150 -161
- package/dist/loop/controller.js +164 -186
- package/dist/loop/gh-checks.js +62 -61
- package/dist/loop/gh-runner.js +22 -25
- package/dist/loop/loop-command.js +66 -58
- package/dist/loop/loop-controller-entrypoint.js +29 -30
- package/dist/loop/merge.js +36 -40
- package/dist/loop/run-terminal-poll.js +69 -0
- package/dist/mcp/gateway-config.js +25 -29
- package/dist/mcp/gateway-doctor.js +77 -119
- package/dist/mcp/gateway-reconcile.js +17 -22
- package/dist/mcp/gateway-runtime.js +1 -3
- package/dist/mcp/host-config.js +37 -40
- package/dist/mcp/host-renderers.js +10 -18
- package/dist/mcp/repo-local-backends.js +51 -54
- package/dist/mcp/toolhive-vmcp.js +39 -39
- package/dist/model-resolver.js +29 -33
- package/dist/moka-global-config.d.ts +78 -55
- package/dist/moka-global-config.js +93 -92
- package/dist/moka-submit.d.ts +2179 -866
- package/dist/moka-submit.js +97 -99
- package/dist/opencode-project-config.js +34 -40
- package/dist/package-assets.js +1 -3
- package/dist/path-refs.js +2 -2
- package/dist/pipeline-init.js +25 -25
- package/dist/pipeline-runtime.d.ts +15 -14
- package/dist/pipeline-runtime.js +51 -50
- package/dist/planned-node.js +6 -3
- package/dist/planning/compile.d.ts +5 -5
- package/dist/planning/compile.js +140 -139
- package/dist/planning/dependency-refs.js +5 -5
- package/dist/planning/generate.d.ts +1296 -1296
- package/dist/planning/generate.js +307 -314
- package/dist/planning/graph.d.ts +0 -1
- package/dist/planning/graph.js +131 -149
- package/dist/remote/argo/model.d.ts +104 -122
- package/dist/remote/argo/model.js +205 -197
- package/dist/remote/argo/policy.js +39 -47
- package/dist/remote/argo/storage.js +81 -85
- package/dist/remote/jobs/execution-identity.js +70 -0
- package/dist/remote/jobs/job-outcome.js +108 -0
- package/dist/remote/jobs/manifest.js +96 -0
- package/dist/remote/jobs/model.d.ts +158 -0
- package/dist/remote/jobs/model.js +162 -0
- package/dist/remote/jobs/node-bootstrap.js +213 -0
- package/dist/remote/jobs/policy.js +123 -0
- package/dist/remote/jobs/reconcile.js +100 -0
- package/dist/remote/jobs/run-spec-client.js +64 -0
- package/dist/remote/jobs/run-spec-path.js +31 -0
- package/dist/remote/jobs/run-spec-server.d.ts +34 -0
- package/dist/remote/jobs/run-spec-server.js +116 -0
- package/dist/remote/jobs/submit.d.ts +23 -0
- package/dist/remote/jobs/submit.js +116 -0
- package/dist/remote/jobs/watch.js +59 -0
- package/dist/remote/submit/argo-submission.d.ts +3 -1
- package/dist/remote/submit/argo-submission.js +53 -58
- package/dist/remote/submit/compilation.d.ts +2 -0
- package/dist/remote/submit/compilation.js +46 -49
- package/dist/remote/submit/event-boundary.js +62 -76
- package/dist/remote/submit/hook-events.d.ts +6 -0
- package/dist/remote/submit/io.d.ts +7 -1
- package/dist/remote/submit/io.js +40 -43
- package/dist/remote/submit/jobs-submission.d.ts +59 -0
- package/dist/remote/submit/jobs-submission.js +97 -0
- package/dist/remote/submit/jobs-submit-result.d.ts +25 -0
- package/dist/remote/submit/jobs-submit-result.js +34 -0
- package/dist/remote/submit/options.d.ts +49 -0
- package/dist/remote/submit/options.js +27 -0
- package/dist/remote/submit/service.d.ts +40 -1
- package/dist/remote/submit/service.js +67 -49
- package/dist/run-control/command-context.js +6 -8
- package/dist/run-control/commands.js +10 -10
- package/dist/run-control/contracts.d.ts +52 -101
- package/dist/run-control/contracts.js +83 -69
- package/dist/run-control/detach.js +66 -72
- package/dist/run-control/execution-store.js +0 -0
- package/dist/run-control/file-errors.js +1 -3
- package/dist/run-control/logical-segment.js +3 -3
- package/dist/run-control/next-node.js +67 -78
- package/dist/run-control/postgres/postgres-run-control-store.js +196 -225
- package/dist/run-control/resume-command.js +34 -41
- package/dist/run-control/run-artifacts-command.js +84 -105
- package/dist/run-control/run-command-domain.js +7 -11
- package/dist/run-control/run-control-store.js +9 -9
- package/dist/run-control/run-query-command.js +73 -100
- package/dist/run-control/run-record.js +5 -3
- package/dist/run-control/run-state-lock.js +5 -5
- package/dist/run-control/runtime-event-projection.js +38 -50
- package/dist/run-control/runtime-reporter.js +86 -102
- package/dist/run-control/stop-command.js +42 -53
- package/dist/run-control/store-fs-effects.js +3 -1
- package/dist/run-control/store-manifest.js +38 -13
- package/dist/run-control/store-paths.js +3 -3
- package/dist/run-control/store.js +1 -1
- package/dist/run-control/submit-result.js +21 -21
- package/dist/run-control/supervisor.js +78 -68
- package/dist/run-control/workspace.js +2 -2
- package/dist/run-state/git-refs.js +258 -307
- package/dist/runner/opencode-excludes.js +4 -4
- package/dist/runner/subprocess-result.js +28 -37
- package/dist/runner/subprocess.js +41 -41
- package/dist/runner/timeouts.js +14 -13
- package/dist/runner-command/dynamic-command.js +46 -39
- package/dist/runner-command/environment-commands.js +91 -0
- package/dist/runner-command/finalize.js +174 -153
- package/dist/runner-command/lifecycle-context.js +115 -130
- package/dist/runner-command/lifecycle.js +78 -72
- package/dist/runner-command/pre-schedule.js +203 -223
- package/dist/runner-command/run.js +450 -448
- package/dist/runner-command/schedule-source-options.js +8 -10
- package/dist/runner-command/select-ready-wave.js +39 -30
- package/dist/runner-command/task-descriptor.js +11 -17
- package/dist/runner-command-contract.d.ts +147 -157
- package/dist/runner-command-contract.js +403 -411
- package/dist/runner-event-schema.d.ts +364 -505
- package/dist/runner-event-schema.js +187 -175
- package/dist/runner-event-sink.js +37 -43
- package/dist/runner-output.js +6 -6
- package/dist/runner.d.ts +57 -37
- package/dist/runner.js +176 -127
- package/dist/runtime/actor-ids.d.ts +1 -0
- package/dist/runtime/actor-ids.js +2 -2
- package/dist/runtime/agent-node/agent-node.js +99 -110
- package/dist/runtime/agent-node/handoff-finalization.js +23 -24
- package/dist/runtime/agent-node/model-selection.js +19 -22
- package/dist/runtime/agent-node/output-finalization.js +174 -204
- package/dist/runtime/agent-node/prompt-rendering.js +208 -251
- package/dist/runtime/agent-node/session-execution.js +43 -39
- package/dist/runtime/builtins/builtins.js +218 -284
- package/dist/runtime/changed-files/changed-files.js +29 -34
- package/dist/runtime/command-executor/command-executor.js +31 -23
- package/dist/runtime/config-error.js +1 -3
- package/dist/runtime/context/context.js +35 -37
- package/dist/runtime/contracts/contracts.d.ts +3 -0
- package/dist/runtime/contracts/index.d.ts +1 -1
- package/dist/runtime/detached-race.js +11 -14
- package/dist/runtime/drain-merge/drain-merge.js +139 -164
- package/dist/runtime/durable-store/acquisition.js +5 -3
- package/dist/runtime/durable-store/durable-store.d.ts +3 -1
- package/dist/runtime/durable-store/postgres/client.js +29 -0
- package/dist/runtime/durable-store/postgres/migrate-substrate.js +34 -29
- package/dist/runtime/durable-store/postgres/postgres-store.js +18 -20
- package/dist/runtime/events/events.js +273 -331
- package/dist/runtime/events/index.js +2 -2
- package/dist/runtime/execution-envelope.js +44 -0
- package/dist/runtime/gates/adjudication/llm-judge.js +21 -24
- package/dist/runtime/gates/adjudication/structured-claim.js +15 -16
- package/dist/runtime/gates/adjudicator/adjudicator.js +27 -27
- package/dist/runtime/gates/adjudicator/index.js +2 -2
- package/dist/runtime/gates/contract.js +5 -9
- package/dist/runtime/gates/gates.js +9 -8
- package/dist/runtime/gates/kinds/acceptance/acceptance.js +68 -71
- package/dist/runtime/gates/kinds/acceptance/index.js +2 -2
- package/dist/runtime/gates/kinds/artifact/artifact.js +4 -4
- package/dist/runtime/gates/kinds/artifact/index.js +2 -2
- package/dist/runtime/gates/kinds/builtin/builtin.js +4 -4
- package/dist/runtime/gates/kinds/builtin/index.js +2 -2
- package/dist/runtime/gates/kinds/changed-files/changed-files.js +31 -35
- package/dist/runtime/gates/kinds/changed-files/index.js +2 -2
- package/dist/runtime/gates/kinds/command/command.js +3 -3
- package/dist/runtime/gates/kinds/command/index.js +2 -2
- package/dist/runtime/gates/kinds/json-schema/index.js +2 -2
- package/dist/runtime/gates/kinds/json-schema/json-schema.js +7 -6
- package/dist/runtime/gates/kinds/verdict/index.js +2 -2
- package/dist/runtime/gates/kinds/verdict/verdict.js +3 -3
- package/dist/runtime/gates/orchestrator.js +72 -86
- package/dist/runtime/gates/registry.js +1 -3
- package/dist/runtime/handoff.d.ts +2 -1
- package/dist/runtime/handoff.js +43 -46
- package/dist/runtime/hooks/command-hook.js +57 -71
- package/dist/runtime/hooks/context.js +21 -25
- package/dist/runtime/hooks/events.js +84 -100
- package/dist/runtime/hooks/execution.js +6 -12
- package/dist/runtime/hooks/hooks.js +34 -23
- package/dist/runtime/hooks/invocation.js +23 -29
- package/dist/runtime/hooks/module-hook.js +36 -35
- package/dist/runtime/hooks/policy.js +32 -29
- package/dist/runtime/hooks/results.js +56 -66
- package/dist/runtime/journal-acquisition.d.ts +3 -2
- package/dist/runtime/journal-acquisition.js +14 -14
- package/dist/runtime/json-validation/json-validation.js +51 -72
- package/dist/runtime/launch-plan-args.js +39 -0
- package/dist/runtime/local-scheduler.js +46 -48
- package/dist/runtime/node-execution.js +376 -445
- package/dist/runtime/node-protocol/node-protocol.js +36 -79
- package/dist/runtime/node-state-store.d.ts +4 -1
- package/dist/runtime/node-state-store.js +13 -57
- package/dist/runtime/node-state-tracker.js +46 -54
- package/dist/runtime/open-pull-request/open-pull-request.js +201 -187
- package/dist/runtime/opencode-adapter.js +23 -24
- package/dist/runtime/opencode-agent-name.js +6 -6
- package/dist/runtime/opencode-runtime.js +115 -93
- package/dist/runtime/opencode-server.js +39 -53
- package/dist/runtime/opencode-session-executor.js +312 -344
- package/dist/runtime/parallel-node/parallel-node.js +123 -134
- package/dist/runtime/parallel-worktrees/parallel-worktrees.js +90 -73
- package/dist/runtime/protected-paths/protected-paths.js +70 -71
- package/dist/runtime/remediation/remediation.js +202 -231
- package/dist/runtime/retry.js +8 -10
- package/dist/runtime/run-journal.d.ts +2 -0
- package/dist/runtime/run-journal.js +7 -7
- package/dist/runtime/runtime-results.js +54 -69
- package/dist/runtime/scheduled-dependencies.d.ts +2 -1
- package/dist/runtime/scheduled-dependencies.js +61 -75
- package/dist/runtime/scheduler.js +179 -202
- package/dist/runtime/services/agent-node-runtime-service.js +3 -3
- package/dist/runtime/services/backlog-service.d.ts +1 -2
- package/dist/runtime/services/backlog-service.js +8 -14
- package/dist/runtime/services/command-executor-service.js +1 -1
- package/dist/runtime/services/config-io-service.js +24 -21
- package/dist/runtime/services/drain-merge-git-service.js +1 -1
- package/dist/runtime/services/file-system-service.js +9 -7
- package/dist/runtime/services/git-porcelain-service.js +6 -6
- package/dist/runtime/services/kubernetes-argo-service.d.ts +10 -3
- package/dist/runtime/services/kubernetes-argo-service.js +90 -84
- package/dist/runtime/services/kubernetes-jobs-read-service.js +115 -0
- package/dist/runtime/services/kubernetes-jobs-service.d.ts +37 -0
- package/dist/runtime/services/kubernetes-jobs-service.js +45 -0
- package/dist/runtime/services/kubernetes-jobs-watch-service.js +61 -0
- package/dist/runtime/services/kubernetes-lease-service.js +21 -0
- package/dist/runtime/services/mcp-gateway-service.js +143 -94
- package/dist/runtime/services/open-pull-request-git-service.js +1 -3
- package/dist/runtime/services/opencode-runtime-server-service.js +10 -12
- package/dist/runtime/services/opencode-sdk-service.js +7 -7
- package/dist/runtime/services/repo-io-service.js +10 -12
- package/dist/runtime/services/run-journal-file-service.js +2 -2
- package/dist/runtime/services/runner-command-io-service.js +48 -52
- package/dist/runtime/services/runner-event-sink-http-service.js +32 -39
- package/dist/runtime/step/step-node.js +15 -15
- package/dist/runtime/workflow-execution.js +56 -57
- package/dist/runtime/workflow-lifecycle.js +82 -101
- package/dist/runtime/yeet-event-record.js +104 -0
- package/dist/runtime/yeet-executor.js +184 -0
- package/dist/safe-json.js +16 -16
- package/dist/schedule/backlog-context.js +122 -116
- package/dist/schedule/baseline.js +249 -255
- package/dist/schedule/passes/coverage.js +63 -68
- package/dist/schedule/passes/drain-merge.js +34 -40
- package/dist/schedule/passes/ids.js +15 -17
- package/dist/schedule/passes/models.js +40 -37
- package/dist/schedule/passes/open-pull-request.js +16 -20
- package/dist/schedule/passes/references.js +18 -22
- package/dist/schedule/prompts.js +135 -141
- package/dist/schedule/scheduling-roles.js +8 -14
- package/dist/schema-boundary.d.ts +4 -0
- package/dist/schema-boundary.js +145 -0
- package/dist/serialized-write-queue.js +2 -2
- package/dist/standard-output-schemas.js +61 -59
- package/dist/strings.js +12 -12
- package/dist/task-ref.js +5 -5
- package/dist/tickets/apply-ticket-plan.js +52 -61
- package/dist/tickets/backlog-task-store.d.ts +15 -23
- package/dist/tickets/backlog-task-store.js +82 -94
- package/dist/tickets/completion/complete-ticket.js +53 -59
- package/dist/tickets/ticket-graph-dto.d.ts +24 -48
- package/dist/tickets/ticket-graph-dto.js +40 -40
- package/dist/tickets/ticket-graph.d.ts +7 -2
- package/dist/tickets/ticket-graph.js +36 -50
- package/dist/tickets/ticket-plan-command-args.js +6 -10
- package/dist/tickets/ticket-plan-render.js +10 -16
- package/dist/tickets/ticket-plan.d.ts +32 -41
- package/dist/tickets/ticket-plan.js +97 -77
- package/dist/tickets/ticket-selection.d.ts +3 -1
- package/dist/tickets/ticket-selection.js +37 -52
- package/dist/tickets/ticket-task-index.js +13 -17
- package/dist/tickets/validation-error-format.js +3 -10
- package/dist/token-estimator.js +12 -7
- package/dist/unknown-fields.js +21 -0
- package/dist/workflow-submit-contract.d.ts +9 -10
- package/dist/workflow-submit-contract.js +10 -9
- package/docs/adr-moka-postgres-schema-isolation.md +48 -0
- package/docs/adr-opencode-first-goal-loop-runtime.md +11 -11
- package/docs/config-architecture.md +13 -13
- package/docs/mcp-host-isolation.md +1 -0
- package/docs/moka-orchestrator-design.md +3 -3
- package/docs/operator-guide.md +1 -1
- package/docs/pipeline-console-runner-contract.md +10 -6
- package/docs/runtime-actor-model.md +18 -18
- package/docs/runtime-test-subsystems.md +200 -0
- package/docs/slash-command-adapter-contract.md +3 -3
- package/package.json +49 -85
- package/dist/config/schema/reference-validation.js +0 -83
package/dist/cli/run-service.js
CHANGED
|
@@ -11,78 +11,68 @@ import { createRunStoreRuntimeReporter } from "../run-control/runtime-reporter.j
|
|
|
11
11
|
import { createTerminalRuntimeReporter, formatRuntimeFailure, formatRuntimeResult } from "./format.js";
|
|
12
12
|
import { startDetachedRunController } from "../run-control/detach.js";
|
|
13
13
|
import { createRunControlSupervisor } from "../run-control/supervisor.js";
|
|
14
|
-
import { Effect } from "effect";
|
|
15
14
|
import { readFileSync } from "node:fs";
|
|
16
15
|
import { resolve } from "node:path";
|
|
16
|
+
import { Effect } from "effect";
|
|
17
17
|
//#region src/cli/run-service.ts
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const detachedRunControllerInput = (input) => ({
|
|
19
|
+
entrypoint: input.prepared.entrypoint,
|
|
20
|
+
runId: input.runId,
|
|
21
|
+
...input.prepared.schedule !== void 0 && input.prepared.schedule !== "" ? { schedule: input.prepared.schedule } : {},
|
|
22
|
+
task: input.task,
|
|
23
|
+
workflow: input.prepared.workflow,
|
|
24
|
+
workspaceRoot: input.worktreePath
|
|
25
|
+
});
|
|
26
|
+
const withRunId = (inputs) => ({
|
|
27
|
+
...inputs,
|
|
28
|
+
runId: inputs.runId ?? generateRuntimeRunId()
|
|
29
|
+
});
|
|
30
|
+
const runWithFlushedReporter = async (flush, run) => {
|
|
23
31
|
try {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
entrypoint: options.entrypoint,
|
|
28
|
-
pipelineRunner: options.pipelineRunner,
|
|
29
|
-
runControl: options.runControl,
|
|
30
|
-
runId: options.runId,
|
|
31
|
-
runStoreMode: options.runStoreMode,
|
|
32
|
-
schedule: options.schedule,
|
|
33
|
-
supervised: options.supervised,
|
|
34
|
-
supervisor: options.supervisor,
|
|
35
|
-
task: description,
|
|
36
|
-
workflow: options.workflow,
|
|
37
|
-
worktreePath
|
|
38
|
-
});
|
|
39
|
-
} catch (err) {
|
|
40
|
-
return Promise.reject(err);
|
|
32
|
+
return await run();
|
|
33
|
+
} finally {
|
|
34
|
+
await flush();
|
|
41
35
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.log(formatDetachedRunFollowUp(runId));
|
|
79
|
-
}
|
|
80
|
-
function persistDetachedRunController(input) {
|
|
81
|
-
return Effect.runPromise(withRunControlStoreScoped(input.worktreePath, (store) => Effect.gen(function* () {
|
|
36
|
+
};
|
|
37
|
+
const requireRunId = (runId = "") => {
|
|
38
|
+
if (runId === "") throw new Error("Run id is required for local run-control persistence.");
|
|
39
|
+
return runId;
|
|
40
|
+
};
|
|
41
|
+
const DEFAULT_RUN_CONTROL_OPTIONS = {
|
|
42
|
+
effort: "normal",
|
|
43
|
+
mode: "write",
|
|
44
|
+
target: "local"
|
|
45
|
+
};
|
|
46
|
+
const resolvedRunControlOptions = (input = {}) => ({
|
|
47
|
+
...DEFAULT_RUN_CONTROL_OPTIONS,
|
|
48
|
+
...input
|
|
49
|
+
});
|
|
50
|
+
const plannedRunStoreNodeIds = (inputs) => {
|
|
51
|
+
if (inputs.pipelineRunner !== void 0) return [];
|
|
52
|
+
const workflowId = resolveWorkflowSelection(inputs.config, inputs.workflow, inputs.entrypoint);
|
|
53
|
+
return flattenNodes(compileWorkflowPlan(inputs.config, workflowId).topologicalOrder, (node) => node.children).map((node) => node.id);
|
|
54
|
+
};
|
|
55
|
+
const detachedRunRecord = (input) => ({
|
|
56
|
+
...resolvedRunControlOptions(input.runControl),
|
|
57
|
+
nodeIds: plannedRunStoreNodeIds({
|
|
58
|
+
config: input.prepared.config,
|
|
59
|
+
entrypoint: input.prepared.entrypoint,
|
|
60
|
+
runControl: input.runControl,
|
|
61
|
+
runId: input.runId,
|
|
62
|
+
schedule: input.prepared.schedule,
|
|
63
|
+
task: input.task,
|
|
64
|
+
workflow: input.prepared.workflow,
|
|
65
|
+
worktreePath: input.worktreePath
|
|
66
|
+
}),
|
|
67
|
+
runId: input.runId,
|
|
68
|
+
...input.prepared.scheduleArtifact !== void 0 && input.prepared.scheduleArtifact !== "" ? { schedule: input.prepared.scheduleArtifact } : {}
|
|
69
|
+
});
|
|
70
|
+
const persistDetachedRunController = async (input) => {
|
|
71
|
+
await Effect.runPromise(withRunControlStoreScoped(input.worktreePath, (store) => Effect.gen(function* effectBody() {
|
|
82
72
|
yield* store.createRun(detachedRunRecord(input));
|
|
83
73
|
const launch = yield* Effect.tryPromise({
|
|
84
74
|
catch: (error) => error,
|
|
85
|
-
try: () => startDetachedRunController(detachedRunControllerInput(input))
|
|
75
|
+
try: async () => await startDetachedRunController(detachedRunControllerInput(input))
|
|
86
76
|
});
|
|
87
77
|
yield* store.updateRunController({
|
|
88
78
|
controller: {
|
|
@@ -95,130 +85,14 @@ function persistDetachedRunController(input) {
|
|
|
95
85
|
runId: input.runId
|
|
96
86
|
});
|
|
97
87
|
})));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
entrypoint: input.prepared.entrypoint,
|
|
102
|
-
runId: input.runId,
|
|
103
|
-
...input.prepared.schedule ? { schedule: input.prepared.schedule } : {},
|
|
104
|
-
task: input.task,
|
|
105
|
-
workflow: input.prepared.workflow,
|
|
106
|
-
workspaceRoot: input.worktreePath
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function detachedRunRecord(input) {
|
|
110
|
-
return {
|
|
111
|
-
...resolvedRunControlOptions(input.runControl),
|
|
112
|
-
nodeIds: plannedRunStoreNodeIds({
|
|
113
|
-
config: input.prepared.config,
|
|
114
|
-
entrypoint: input.prepared.entrypoint,
|
|
115
|
-
runId: input.runId,
|
|
116
|
-
runControl: input.runControl,
|
|
117
|
-
schedule: input.prepared.schedule,
|
|
118
|
-
task: input.task,
|
|
119
|
-
workflow: input.prepared.workflow,
|
|
120
|
-
worktreePath: input.worktreePath
|
|
121
|
-
}),
|
|
122
|
-
runId: input.runId,
|
|
123
|
-
...input.prepared.scheduleArtifact ? { schedule: input.prepared.scheduleArtifact } : {}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function withRunId(inputs) {
|
|
127
|
-
return {
|
|
128
|
-
...inputs,
|
|
129
|
-
runId: inputs.runId ?? generateRuntimeRunId()
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
async function runConfiguredPipeline(rawInputs) {
|
|
133
|
-
const inputs = withRunId(rawInputs);
|
|
134
|
-
const config = loadPipelineConfig(inputs.worktreePath, { allowMissingLintFileReferences: true });
|
|
135
|
-
if (inputs.schedule) {
|
|
136
|
-
const scheduleYaml = readFileSync(inputs.schedule, "utf8");
|
|
137
|
-
const compiled = compileScheduleArtifact(config, parseScheduleArtifact(scheduleYaml, inputs.schedule), inputs.worktreePath);
|
|
138
|
-
await runAndPrintPipeline({
|
|
139
|
-
...inputs,
|
|
140
|
-
config: compiled.config,
|
|
141
|
-
scheduleArtifact: scheduleYaml,
|
|
142
|
-
workflow: compiled.workflowId
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const scheduledEntrypoint = scheduledEntrypointId(config, inputs.workflow, inputs.entrypoint);
|
|
147
|
-
if (scheduledEntrypoint) {
|
|
148
|
-
if (inputs.pipelineRunner) {
|
|
149
|
-
await runAndPrintPipeline({
|
|
150
|
-
...inputs,
|
|
151
|
-
config
|
|
152
|
-
});
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const result = await generateScheduleArtifactInMemory({
|
|
156
|
-
config,
|
|
157
|
-
entrypointId: scheduledEntrypoint,
|
|
158
|
-
runId: inputs.runId,
|
|
159
|
-
task: inputs.task,
|
|
160
|
-
worktreePath: inputs.worktreePath
|
|
161
|
-
});
|
|
162
|
-
console.log("Schedule generated in memory");
|
|
163
|
-
const scheduleYaml = result.yaml;
|
|
164
|
-
const compiled = compileScheduleArtifact(config, parseScheduleArtifact(scheduleYaml, "schedule.yaml"), inputs.worktreePath);
|
|
165
|
-
await runAndPrintPipeline({
|
|
166
|
-
...inputs,
|
|
167
|
-
config: compiled.config,
|
|
168
|
-
scheduleArtifact: scheduleYaml,
|
|
169
|
-
workflow: compiled.workflowId
|
|
170
|
-
});
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
await runAndPrintPipeline({
|
|
174
|
-
...inputs,
|
|
175
|
-
config
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
async function runAndPrintPipeline(inputs) {
|
|
179
|
-
await Effect.runPromise(withRunControlStoreScoped(inputs.worktreePath, (store) => Effect.tryPromise({
|
|
180
|
-
catch: (error) => error,
|
|
181
|
-
try: () => runAndPrintPipelineWithStore(inputs, store)
|
|
182
|
-
})));
|
|
183
|
-
}
|
|
184
|
-
async function runAndPrintPipelineWithStore(inputs, store) {
|
|
185
|
-
const runner = inputs.pipelineRunner ?? runPipelineFromConfig;
|
|
186
|
-
const runStoreReporter = await createRunStoreReporter(inputs, createTerminalRuntimeReporter(), store);
|
|
187
|
-
printSupervisedFollowUp(inputs);
|
|
188
|
-
const result = await runPipelineSafely(inputs, runner, runStoreReporter);
|
|
189
|
-
console.log(formatRuntimeResult(result));
|
|
190
|
-
if (result.outcome !== "PASS") throw new Error(formatRuntimeFailureWithFollowUp(result, inputs));
|
|
191
|
-
}
|
|
192
|
-
function printSupervisedFollowUp(inputs) {
|
|
193
|
-
if (inputs.supervised) console.log(formatSupervisedRunFollowUp(requireRunId(inputs.runId)));
|
|
194
|
-
}
|
|
195
|
-
function runPipelineSafely(inputs, runner, runStoreReporter) {
|
|
196
|
-
return runWithFlushedReporter(runStoreReporter.flush, () => runner({
|
|
197
|
-
config: inputs.config,
|
|
198
|
-
entrypoint: inputs.entrypoint,
|
|
199
|
-
reporter: runStoreReporter.reporter,
|
|
200
|
-
runId: inputs.runId,
|
|
201
|
-
task: inputs.task,
|
|
202
|
-
workflowId: inputs.workflow,
|
|
203
|
-
worktreePath: inputs.worktreePath
|
|
204
|
-
})).catch((error) => {
|
|
205
|
-
throw runtimeErrorWithFollowUp(error, inputs);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
async function runWithFlushedReporter(flush, run) {
|
|
209
|
-
try {
|
|
210
|
-
return await run();
|
|
211
|
-
} finally {
|
|
212
|
-
await flush();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
async function createLocalRunStoreRuntimeReporter(inputs, reporter, store) {
|
|
88
|
+
};
|
|
89
|
+
const createLocalRunStoreRuntimeReporter = async (inputs, reporter, store) => {
|
|
216
90
|
const runId = requireRunId(inputs.runId);
|
|
217
91
|
await Effect.runPromise(store.createRun({
|
|
218
92
|
...resolvedRunControlOptions(inputs.runControl),
|
|
219
93
|
nodeIds: plannedRunStoreNodeIds(inputs),
|
|
220
94
|
runId,
|
|
221
|
-
...inputs.scheduleArtifact ? { schedule: inputs.scheduleArtifact } : {}
|
|
95
|
+
...inputs.scheduleArtifact !== void 0 && inputs.scheduleArtifact !== "" ? { schedule: inputs.scheduleArtifact } : {}
|
|
222
96
|
}));
|
|
223
97
|
return createRunStoreRuntimeReporter({
|
|
224
98
|
reporter,
|
|
@@ -226,11 +100,11 @@ async function createLocalRunStoreRuntimeReporter(inputs, reporter, store) {
|
|
|
226
100
|
store,
|
|
227
101
|
workspaceRoot: inputs.worktreePath
|
|
228
102
|
});
|
|
229
|
-
}
|
|
230
|
-
|
|
103
|
+
};
|
|
104
|
+
const createRunStoreReporter = (inputs, reporter, store) => {
|
|
231
105
|
if (inputs.runStoreMode === "reuse") {
|
|
232
106
|
const runId = requireRunId(inputs.runId);
|
|
233
|
-
if (inputs.supervisor) {
|
|
107
|
+
if (inputs.supervisor === true) {
|
|
234
108
|
const supervisor = createRunControlSupervisor({
|
|
235
109
|
reporter,
|
|
236
110
|
runId,
|
|
@@ -251,71 +125,167 @@ function createRunStoreReporter(inputs, reporter, store) {
|
|
|
251
125
|
});
|
|
252
126
|
}
|
|
253
127
|
return createLocalRunStoreRuntimeReporter(inputs, reporter, store);
|
|
254
|
-
}
|
|
255
|
-
function requireRunId(runId) {
|
|
256
|
-
if (!runId) throw new Error("Run id is required for local run-control persistence.");
|
|
257
|
-
return runId;
|
|
258
|
-
}
|
|
259
|
-
function resolvedRunControlOptions(input) {
|
|
260
|
-
return {
|
|
261
|
-
...DEFAULT_RUN_CONTROL_OPTIONS,
|
|
262
|
-
...input
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
const DEFAULT_RUN_CONTROL_OPTIONS = {
|
|
266
|
-
effort: "normal",
|
|
267
|
-
mode: "write",
|
|
268
|
-
target: "local"
|
|
269
128
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
`Status: moka status ${runId}`,
|
|
286
|
-
`Logs: moka logs ${runId}`,
|
|
287
|
-
`Stop: moka stop ${runId}`
|
|
288
|
-
].join("\n");
|
|
289
|
-
}
|
|
290
|
-
function formatRuntimeFailureWithFollowUp(result, inputs) {
|
|
129
|
+
const formatSupervisedRunFollowUp = (runId) => [
|
|
130
|
+
`Run id: ${runId}`,
|
|
131
|
+
`Status: moka status ${runId}`,
|
|
132
|
+
`Logs: moka logs ${runId}`
|
|
133
|
+
].join("\n");
|
|
134
|
+
const printSupervisedFollowUp = (inputs) => {
|
|
135
|
+
if (inputs.supervised === true) console.log(formatSupervisedRunFollowUp(requireRunId(inputs.runId)));
|
|
136
|
+
};
|
|
137
|
+
const formatDetachedRunFollowUp = (runId) => [
|
|
138
|
+
`Run id: ${runId}`,
|
|
139
|
+
`Status: moka status ${runId}`,
|
|
140
|
+
`Logs: moka logs ${runId}`,
|
|
141
|
+
`Stop: moka stop ${runId}`
|
|
142
|
+
].join("\n");
|
|
143
|
+
const formatRuntimeFailureWithFollowUp = (result, inputs) => {
|
|
291
144
|
const message = formatRuntimeFailure(result);
|
|
292
|
-
if (!(inputs.supervised && inputs.runId)) return message;
|
|
145
|
+
if (!(inputs.supervised === true && inputs.runId !== void 0)) return message;
|
|
293
146
|
return [
|
|
294
147
|
message,
|
|
295
148
|
"",
|
|
296
149
|
formatSupervisedRunFollowUp(inputs.runId)
|
|
297
150
|
].join("\n");
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (!(inputs.supervised && inputs.runId)) return error;
|
|
151
|
+
};
|
|
152
|
+
const runtimeErrorWithFollowUp = (error, inputs) => {
|
|
153
|
+
if (!(inputs.supervised === true && inputs.runId !== void 0)) return error;
|
|
301
154
|
const message = error instanceof Error ? error.message : String(error);
|
|
302
155
|
return new Error([
|
|
303
156
|
message,
|
|
304
157
|
"",
|
|
305
158
|
formatSupervisedRunFollowUp(inputs.runId)
|
|
306
159
|
].join("\n"));
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
160
|
+
};
|
|
161
|
+
const runPipelineSafely = async (inputs, runner, runStoreReporter) => await runWithFlushedReporter(runStoreReporter.flush, async () => await runner({
|
|
162
|
+
config: inputs.config,
|
|
163
|
+
entrypoint: inputs.entrypoint,
|
|
164
|
+
reporter: runStoreReporter.reporter,
|
|
165
|
+
runId: inputs.runId,
|
|
166
|
+
task: inputs.task,
|
|
167
|
+
workflowId: inputs.workflow,
|
|
168
|
+
worktreePath: inputs.worktreePath
|
|
169
|
+
})).catch((error) => {
|
|
170
|
+
throw runtimeErrorWithFollowUp(error, inputs);
|
|
171
|
+
});
|
|
172
|
+
const runAndPrintPipelineWithStore = async (inputs, store) => {
|
|
173
|
+
const runner = inputs.pipelineRunner ?? runPipelineFromConfig;
|
|
174
|
+
const terminalReporter = createTerminalRuntimeReporter();
|
|
175
|
+
const runStoreReporter = await createRunStoreReporter(inputs, terminalReporter, store);
|
|
176
|
+
printSupervisedFollowUp(inputs);
|
|
177
|
+
const result = await runPipelineSafely(inputs, runner, runStoreReporter);
|
|
178
|
+
console.log(formatRuntimeResult(result));
|
|
179
|
+
if (result.outcome !== "PASS") throw new Error(formatRuntimeFailureWithFollowUp(result, inputs));
|
|
180
|
+
};
|
|
181
|
+
const runAndPrintPipeline = async (inputs) => {
|
|
182
|
+
await Effect.runPromise(withRunControlStoreScoped(inputs.worktreePath, (store) => Effect.tryPromise({
|
|
183
|
+
catch: (error) => error,
|
|
184
|
+
try: async () => {
|
|
185
|
+
await runAndPrintPipelineWithStore(inputs, store);
|
|
186
|
+
}
|
|
187
|
+
})));
|
|
188
|
+
};
|
|
189
|
+
const scheduledEntrypointById = (config, id) => {
|
|
190
|
+
if (!Object.hasOwn(config.entrypoints, id)) return "";
|
|
191
|
+
return "schedule" in config.entrypoints[id] ? id : "";
|
|
192
|
+
};
|
|
193
|
+
const scheduledEntrypointId = (config, workflowId, entrypointId) => workflowId !== void 0 && workflowId !== "" ? "" : scheduledEntrypointById(config, entrypointId ?? "execute");
|
|
194
|
+
const runConfiguredPipeline = async (rawInputs) => {
|
|
195
|
+
const inputs = withRunId(rawInputs);
|
|
196
|
+
const config = loadPipelineConfig(inputs.worktreePath, { allowMissingLintFileReferences: true });
|
|
197
|
+
if (inputs.schedule !== void 0 && inputs.schedule !== "") {
|
|
198
|
+
const scheduleYaml = readFileSync(inputs.schedule, "utf-8");
|
|
199
|
+
const compiled = compileScheduleArtifact(config, parseScheduleArtifact(scheduleYaml, inputs.schedule), inputs.worktreePath);
|
|
200
|
+
await runAndPrintPipeline({
|
|
201
|
+
...inputs,
|
|
202
|
+
config: compiled.config,
|
|
203
|
+
scheduleArtifact: scheduleYaml,
|
|
204
|
+
workflow: compiled.workflowId
|
|
205
|
+
});
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const scheduledEntrypoint = scheduledEntrypointId(config, inputs.workflow, inputs.entrypoint);
|
|
209
|
+
if (scheduledEntrypoint !== "") {
|
|
210
|
+
if (inputs.pipelineRunner !== void 0) {
|
|
211
|
+
await runAndPrintPipeline({
|
|
212
|
+
...inputs,
|
|
213
|
+
config
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const result = await generateScheduleArtifactInMemory({
|
|
218
|
+
config,
|
|
219
|
+
entrypointId: scheduledEntrypoint,
|
|
220
|
+
runId: inputs.runId,
|
|
221
|
+
task: inputs.task,
|
|
222
|
+
worktreePath: inputs.worktreePath
|
|
223
|
+
});
|
|
224
|
+
console.log("Schedule generated in memory");
|
|
225
|
+
const scheduleYaml = result.yaml;
|
|
226
|
+
const compiled = compileScheduleArtifact(config, parseScheduleArtifact(scheduleYaml, "schedule.yaml"), inputs.worktreePath);
|
|
227
|
+
await runAndPrintPipeline({
|
|
228
|
+
...inputs,
|
|
229
|
+
config: compiled.config,
|
|
230
|
+
scheduleArtifact: scheduleYaml,
|
|
231
|
+
workflow: compiled.workflowId
|
|
232
|
+
});
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
await runAndPrintPipeline({
|
|
236
|
+
...inputs,
|
|
237
|
+
config
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Config-driven `execute` entrypoint. Package-owned defaults are the source of
|
|
242
|
+
* truth; repo-local pipeline files are ignored by runtime loading.
|
|
243
|
+
*/
|
|
244
|
+
const execute = async (description, options = {}) => {
|
|
245
|
+
try {
|
|
246
|
+
if (!description.trim()) throw new Error("Task description is required");
|
|
247
|
+
const worktreePath = process.env.PIPELINE_TARGET_PATH ?? process.cwd();
|
|
248
|
+
return runConfiguredPipeline({
|
|
249
|
+
entrypoint: options.entrypoint,
|
|
250
|
+
pipelineRunner: options.pipelineRunner,
|
|
251
|
+
runControl: options.runControl,
|
|
252
|
+
runId: options.runId,
|
|
253
|
+
runStoreMode: options.runStoreMode,
|
|
254
|
+
schedule: options.schedule,
|
|
255
|
+
supervised: options.supervised,
|
|
256
|
+
supervisor: options.supervisor,
|
|
257
|
+
task: description,
|
|
258
|
+
workflow: options.workflow,
|
|
259
|
+
worktreePath
|
|
260
|
+
});
|
|
261
|
+
} catch (error) {
|
|
262
|
+
await Promise.reject(error);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const quick = async (description, options = {}) => {
|
|
267
|
+
await execute(description, {
|
|
268
|
+
...options,
|
|
269
|
+
entrypoint: "quick",
|
|
270
|
+
runControl: {
|
|
271
|
+
...options.runControl,
|
|
272
|
+
effort: "quick"
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
const runLocalResolvedTask = async (task, execution, runControl) => {
|
|
277
|
+
await execute(task, {
|
|
278
|
+
entrypoint: execution.entrypoint,
|
|
279
|
+
runControl,
|
|
280
|
+
schedule: execution.schedule,
|
|
281
|
+
supervised: true,
|
|
282
|
+
workflow: execution.workflow
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
const prepareDetachedRun = async (input) => {
|
|
286
|
+
if (input.execution.schedule !== void 0 && input.execution.schedule !== "") {
|
|
317
287
|
const schedule = resolve(input.execution.schedule);
|
|
318
|
-
const scheduleYaml = readFileSync(schedule, "
|
|
288
|
+
const scheduleYaml = readFileSync(schedule, "utf-8");
|
|
319
289
|
const compiled = compileScheduleArtifact(input.config, parseScheduleArtifact(scheduleYaml, schedule), input.worktreePath);
|
|
320
290
|
return {
|
|
321
291
|
config: compiled.config,
|
|
@@ -325,7 +295,7 @@ async function prepareDetachedRun(input) {
|
|
|
325
295
|
};
|
|
326
296
|
}
|
|
327
297
|
const scheduledEntrypoint = scheduledEntrypointId(input.config, input.execution.workflow, input.execution.entrypoint);
|
|
328
|
-
if (
|
|
298
|
+
if (scheduledEntrypoint === "") return {
|
|
329
299
|
config: input.config,
|
|
330
300
|
entrypoint: input.execution.entrypoint,
|
|
331
301
|
workflow: input.execution.workflow
|
|
@@ -345,6 +315,26 @@ async function prepareDetachedRun(input) {
|
|
|
345
315
|
scheduleArtifact: scheduleYaml,
|
|
346
316
|
workflow: compiled.workflowId
|
|
347
317
|
};
|
|
348
|
-
}
|
|
318
|
+
};
|
|
319
|
+
const runDetachedResolvedTask = async (task, execution, runControl) => {
|
|
320
|
+
const worktreePath = process.env.PIPELINE_TARGET_PATH ?? process.cwd();
|
|
321
|
+
const runId = generateRuntimeRunId();
|
|
322
|
+
const config = loadPipelineConfig(worktreePath, { allowMissingLintFileReferences: true });
|
|
323
|
+
const prepared = await prepareDetachedRun({
|
|
324
|
+
config,
|
|
325
|
+
execution,
|
|
326
|
+
runId,
|
|
327
|
+
task,
|
|
328
|
+
worktreePath
|
|
329
|
+
});
|
|
330
|
+
await persistDetachedRunController({
|
|
331
|
+
prepared,
|
|
332
|
+
runControl,
|
|
333
|
+
runId,
|
|
334
|
+
task,
|
|
335
|
+
worktreePath
|
|
336
|
+
});
|
|
337
|
+
console.log(formatDetachedRunFollowUp(runId));
|
|
338
|
+
};
|
|
349
339
|
//#endregion
|
|
350
340
|
export { execute, quick, runDetachedResolvedTask, runLocalResolvedTask };
|