@oisincoveney/pipeline 3.24.2 → 3.24.3

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.
Files changed (326) hide show
  1. package/README.md +2 -2
  2. package/defaults/pipeline.yaml +23 -5
  3. package/defaults/profiles.yaml +104 -21
  4. package/dist/argo-graph.js +88 -88
  5. package/dist/argo-submit.d.ts +109 -137
  6. package/dist/argo-submit.js +337 -360
  7. package/dist/argo-workflow.d.ts +156 -176
  8. package/dist/argo-workflow.js +96 -138
  9. package/dist/backlog.js +5 -4
  10. package/dist/bench/eval-report.js +21 -12
  11. package/dist/claude-settings-config.js +23 -31
  12. package/dist/claude-user-config.js +6 -16
  13. package/dist/cli/bootstrap-commands.js +3 -3
  14. package/dist/cli/doctor.d.ts +1 -1
  15. package/dist/cli/doctor.js +172 -169
  16. package/dist/cli/factory-commands.js +12 -11
  17. package/dist/cli/format.js +92 -86
  18. package/dist/cli/loop-commands.js +21 -21
  19. package/dist/cli/mcp-gateway-commands.js +12 -12
  20. package/dist/cli/plan-commands.js +85 -116
  21. package/dist/cli/program.d.ts +2 -2
  22. package/dist/cli/program.js +35 -43
  23. package/dist/cli/run-command.js +25 -25
  24. package/dist/cli/run-commands.js +25 -25
  25. package/dist/cli/run-resolver.d.ts +1 -1
  26. package/dist/cli/run-resolver.js +30 -32
  27. package/dist/cli/run-service.d.ts +2 -2
  28. package/dist/cli/run-service.js +226 -239
  29. package/dist/cli/submit-options.js +78 -82
  30. package/dist/cluster-doctor.js +147 -175
  31. package/dist/codex-config.js +24 -30
  32. package/dist/commands/bench-command.js +9 -7
  33. package/dist/commands/pipeline-command.js +9 -5
  34. package/dist/commands/runner-command-command.js +28 -18
  35. package/dist/commands/ticket/complete.js +29 -33
  36. package/dist/commands/ticket/create.js +82 -82
  37. package/dist/commands/ticket/graph-check.js +11 -11
  38. package/dist/commands/ticket/next.js +36 -36
  39. package/dist/commands/ticket/sequence.js +10 -12
  40. package/dist/commands/ticket/shared.d.ts +1 -1
  41. package/dist/commands/ticket/shared.js +63 -66
  42. package/dist/commands/ticket/start.js +58 -67
  43. package/dist/commands/ticket-command.js +2 -2
  44. package/dist/config/defaults.d.ts +139 -139
  45. package/dist/config/defaults.js +81 -80
  46. package/dist/config/lint.js +52 -64
  47. package/dist/config/load.d.ts +4 -4
  48. package/dist/config/load.js +62 -74
  49. package/dist/config/schema/catalog.js +1 -1
  50. package/dist/config/schema/mcp.js +46 -52
  51. package/dist/config/schemas.d.ts +375 -525
  52. package/dist/config/schemas.js +397 -397
  53. package/dist/config/validate.d.ts +1 -1
  54. package/dist/config/validate.js +236 -201
  55. package/dist/context/repo-map.js +102 -119
  56. package/dist/credentials/broker.d.ts +6 -8
  57. package/dist/credentials/broker.js +17 -16
  58. package/dist/credentials/codex-config.js +15 -19
  59. package/dist/credentials/file-targets.js +9 -15
  60. package/dist/credentials/local-codex-auth-sync.js +55 -58
  61. package/dist/credentials/opencode-config.js +28 -32
  62. package/dist/credentials/runner.js +13 -13
  63. package/dist/effect-sync-errors.js +28 -0
  64. package/dist/factory/create-experiment.js +38 -42
  65. package/dist/factory/exec.js +10 -12
  66. package/dist/factory/git-credentials.js +4 -4
  67. package/dist/factory/stamp-answers.js +10 -11
  68. package/dist/factory/template-update.js +65 -44
  69. package/dist/factory-lane.d.ts +26 -40
  70. package/dist/factory-lane.js +26 -25
  71. package/dist/gates.js +3 -3
  72. package/dist/git-remote-url.js +17 -19
  73. package/dist/hooks.d.ts +26 -25
  74. package/dist/hooks.js +20 -22
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +21 -35
  77. package/dist/install-commands/claude-code.js +96 -92
  78. package/dist/install-commands/host-selection.js +3 -6
  79. package/dist/install-commands/opencode.js +263 -259
  80. package/dist/install-commands/planner.js +159 -180
  81. package/dist/install-commands/result-format.js +1 -3
  82. package/dist/install-commands/shared.js +25 -42
  83. package/dist/install-commands/writer.js +22 -25
  84. package/dist/install-commands.js +8 -8
  85. package/dist/jscpd-output.js +29 -0
  86. package/dist/json-config-merge.js +14 -20
  87. package/dist/json-line-values.js +17 -6
  88. package/dist/loop/argo-poll.js +52 -71
  89. package/dist/loop/backlog-records.js +1 -3
  90. package/dist/loop/controller-deps.js +146 -159
  91. package/dist/loop/controller.js +162 -186
  92. package/dist/loop/gh-checks.js +62 -61
  93. package/dist/loop/gh-runner.js +22 -25
  94. package/dist/loop/loop-command.js +66 -58
  95. package/dist/loop/loop-controller-entrypoint.js +28 -30
  96. package/dist/loop/merge.js +36 -40
  97. package/dist/mcp/gateway-config.js +25 -29
  98. package/dist/mcp/gateway-doctor.js +104 -116
  99. package/dist/mcp/gateway-reconcile.js +17 -22
  100. package/dist/mcp/gateway-runtime.js +1 -3
  101. package/dist/mcp/host-config.js +37 -40
  102. package/dist/mcp/host-renderers.js +10 -18
  103. package/dist/mcp/repo-local-backends.js +50 -54
  104. package/dist/mcp/toolhive-vmcp.js +39 -39
  105. package/dist/model-resolver.js +29 -33
  106. package/dist/moka-global-config.d.ts +78 -54
  107. package/dist/moka-global-config.js +90 -92
  108. package/dist/moka-submit.d.ts +2163 -864
  109. package/dist/moka-submit.js +97 -99
  110. package/dist/opencode-project-config.js +34 -40
  111. package/dist/package-assets.js +1 -3
  112. package/dist/path-refs.js +2 -2
  113. package/dist/pipeline-init.js +25 -25
  114. package/dist/pipeline-runtime.d.ts +11 -11
  115. package/dist/pipeline-runtime.js +49 -50
  116. package/dist/planned-node.js +6 -3
  117. package/dist/planning/compile.d.ts +3 -3
  118. package/dist/planning/compile.js +140 -139
  119. package/dist/planning/dependency-refs.js +5 -5
  120. package/dist/planning/generate.d.ts +1293 -1293
  121. package/dist/planning/generate.js +305 -314
  122. package/dist/planning/graph.js +131 -149
  123. package/dist/remote/argo/model.d.ts +103 -121
  124. package/dist/remote/argo/model.js +205 -197
  125. package/dist/remote/argo/policy.js +39 -47
  126. package/dist/remote/argo/storage.js +81 -85
  127. package/dist/remote/submit/argo-submission.js +53 -58
  128. package/dist/remote/submit/compilation.js +46 -49
  129. package/dist/remote/submit/event-boundary.js +62 -76
  130. package/dist/remote/submit/hook-events.d.ts +5 -0
  131. package/dist/remote/submit/io.js +40 -43
  132. package/dist/remote/submit/options.d.ts +50 -0
  133. package/dist/remote/submit/options.js +27 -0
  134. package/dist/remote/submit/service.js +45 -49
  135. package/dist/run-control/command-context.js +6 -8
  136. package/dist/run-control/commands.js +10 -10
  137. package/dist/run-control/contracts.d.ts +40 -100
  138. package/dist/run-control/contracts.js +56 -69
  139. package/dist/run-control/detach.js +66 -72
  140. package/dist/run-control/file-errors.js +1 -3
  141. package/dist/run-control/logical-segment.js +3 -3
  142. package/dist/run-control/next-node.js +66 -78
  143. package/dist/run-control/postgres/postgres-run-control-store.js +195 -224
  144. package/dist/run-control/resume-command.js +33 -41
  145. package/dist/run-control/run-artifacts-command.js +83 -105
  146. package/dist/run-control/run-command-domain.js +7 -11
  147. package/dist/run-control/run-control-store.js +9 -9
  148. package/dist/run-control/run-query-command.js +73 -100
  149. package/dist/run-control/run-record.js +2 -2
  150. package/dist/run-control/run-state-lock.js +5 -5
  151. package/dist/run-control/runtime-event-projection.js +38 -50
  152. package/dist/run-control/runtime-reporter.js +84 -102
  153. package/dist/run-control/stop-command.js +42 -53
  154. package/dist/run-control/store-fs-effects.js +3 -1
  155. package/dist/run-control/store-manifest.js +38 -13
  156. package/dist/run-control/store-paths.js +3 -3
  157. package/dist/run-control/store.js +1 -1
  158. package/dist/run-control/submit-result.js +21 -21
  159. package/dist/run-control/supervisor.js +77 -68
  160. package/dist/run-control/workspace.js +2 -2
  161. package/dist/run-state/git-refs.js +257 -307
  162. package/dist/runner/opencode-excludes.js +4 -4
  163. package/dist/runner/subprocess-result.js +28 -37
  164. package/dist/runner/subprocess.js +41 -41
  165. package/dist/runner/timeouts.js +14 -13
  166. package/dist/runner-command/dynamic-command.js +46 -39
  167. package/dist/runner-command/finalize.js +174 -153
  168. package/dist/runner-command/lifecycle-context.js +112 -130
  169. package/dist/runner-command/lifecycle.js +77 -71
  170. package/dist/runner-command/pre-schedule.js +201 -222
  171. package/dist/runner-command/run.js +432 -447
  172. package/dist/runner-command/schedule-source-options.js +8 -10
  173. package/dist/runner-command/select-ready-wave.js +38 -29
  174. package/dist/runner-command/task-descriptor.js +11 -17
  175. package/dist/runner-command-contract.d.ts +147 -156
  176. package/dist/runner-command-contract.js +401 -410
  177. package/dist/runner-event-schema.d.ts +364 -504
  178. package/dist/runner-event-schema.js +187 -175
  179. package/dist/runner-event-sink.js +37 -43
  180. package/dist/runner-output.js +6 -6
  181. package/dist/runner.d.ts +56 -36
  182. package/dist/runner.js +175 -127
  183. package/dist/runtime/actor-ids.js +2 -2
  184. package/dist/runtime/agent-node/agent-node.js +99 -111
  185. package/dist/runtime/agent-node/handoff-finalization.js +23 -24
  186. package/dist/runtime/agent-node/model-selection.js +19 -22
  187. package/dist/runtime/agent-node/output-finalization.js +174 -205
  188. package/dist/runtime/agent-node/prompt-rendering.js +207 -251
  189. package/dist/runtime/agent-node/session-execution.js +34 -38
  190. package/dist/runtime/builtins/builtins.js +212 -284
  191. package/dist/runtime/changed-files/changed-files.js +26 -34
  192. package/dist/runtime/command-executor/command-executor.js +31 -23
  193. package/dist/runtime/config-error.js +1 -3
  194. package/dist/runtime/context/context.js +35 -37
  195. package/dist/runtime/contracts/index.d.ts +1 -1
  196. package/dist/runtime/detached-race.js +11 -14
  197. package/dist/runtime/drain-merge/drain-merge.js +137 -163
  198. package/dist/runtime/durable-store/acquisition.js +5 -3
  199. package/dist/runtime/durable-store/durable-store.d.ts +1 -1
  200. package/dist/runtime/durable-store/postgres/migrate-substrate.js +36 -33
  201. package/dist/runtime/durable-store/postgres/postgres-store.js +17 -18
  202. package/dist/runtime/events/events.js +255 -323
  203. package/dist/runtime/gates/adjudication/llm-judge.js +21 -24
  204. package/dist/runtime/gates/adjudication/structured-claim.js +15 -16
  205. package/dist/runtime/gates/adjudicator/adjudicator.js +27 -27
  206. package/dist/runtime/gates/adjudicator/index.js +2 -2
  207. package/dist/runtime/gates/contract.js +5 -9
  208. package/dist/runtime/gates/gates.js +9 -8
  209. package/dist/runtime/gates/kinds/acceptance/acceptance.js +66 -70
  210. package/dist/runtime/gates/kinds/acceptance/index.js +2 -2
  211. package/dist/runtime/gates/kinds/artifact/artifact.js +4 -4
  212. package/dist/runtime/gates/kinds/artifact/index.js +2 -2
  213. package/dist/runtime/gates/kinds/builtin/builtin.js +4 -4
  214. package/dist/runtime/gates/kinds/builtin/index.js +2 -2
  215. package/dist/runtime/gates/kinds/changed-files/changed-files.js +31 -35
  216. package/dist/runtime/gates/kinds/changed-files/index.js +2 -2
  217. package/dist/runtime/gates/kinds/command/command.js +3 -3
  218. package/dist/runtime/gates/kinds/command/index.js +2 -2
  219. package/dist/runtime/gates/kinds/json-schema/index.js +2 -2
  220. package/dist/runtime/gates/kinds/json-schema/json-schema.js +7 -6
  221. package/dist/runtime/gates/kinds/verdict/index.js +2 -2
  222. package/dist/runtime/gates/kinds/verdict/verdict.js +3 -3
  223. package/dist/runtime/gates/orchestrator.js +72 -86
  224. package/dist/runtime/gates/registry.js +1 -3
  225. package/dist/runtime/handoff.d.ts +1 -1
  226. package/dist/runtime/handoff.js +43 -46
  227. package/dist/runtime/hooks/command-hook.js +57 -71
  228. package/dist/runtime/hooks/context.js +21 -25
  229. package/dist/runtime/hooks/events.js +84 -100
  230. package/dist/runtime/hooks/execution.js +6 -12
  231. package/dist/runtime/hooks/hooks.js +34 -23
  232. package/dist/runtime/hooks/invocation.js +23 -29
  233. package/dist/runtime/hooks/module-hook.js +35 -35
  234. package/dist/runtime/hooks/policy.js +32 -29
  235. package/dist/runtime/hooks/results.js +56 -66
  236. package/dist/runtime/journal-acquisition.d.ts +1 -1
  237. package/dist/runtime/journal-acquisition.js +14 -14
  238. package/dist/runtime/json-validation/json-validation.js +50 -72
  239. package/dist/runtime/local-scheduler.js +46 -48
  240. package/dist/runtime/node-execution.js +375 -446
  241. package/dist/runtime/node-protocol/node-protocol.js +36 -79
  242. package/dist/runtime/node-state-store.d.ts +1 -1
  243. package/dist/runtime/node-state-store.js +13 -57
  244. package/dist/runtime/node-state-tracker.js +46 -54
  245. package/dist/runtime/open-pull-request/open-pull-request.js +143 -187
  246. package/dist/runtime/opencode-adapter.js +23 -24
  247. package/dist/runtime/opencode-agent-name.js +6 -6
  248. package/dist/runtime/opencode-runtime.js +92 -92
  249. package/dist/runtime/opencode-server.js +39 -53
  250. package/dist/runtime/opencode-session-executor.js +315 -334
  251. package/dist/runtime/parallel-node/parallel-node.js +122 -134
  252. package/dist/runtime/parallel-worktrees/parallel-worktrees.js +90 -73
  253. package/dist/runtime/protected-paths/protected-paths.js +70 -71
  254. package/dist/runtime/remediation/remediation.js +202 -231
  255. package/dist/runtime/retry.js +8 -10
  256. package/dist/runtime/run-journal.js +7 -7
  257. package/dist/runtime/runtime-results.js +54 -69
  258. package/dist/runtime/scheduled-dependencies.d.ts +1 -1
  259. package/dist/runtime/scheduled-dependencies.js +59 -74
  260. package/dist/runtime/scheduler.js +177 -202
  261. package/dist/runtime/services/agent-node-runtime-service.js +3 -3
  262. package/dist/runtime/services/backlog-service.js +8 -14
  263. package/dist/runtime/services/command-executor-service.js +1 -1
  264. package/dist/runtime/services/config-io-service.js +24 -21
  265. package/dist/runtime/services/drain-merge-git-service.js +1 -1
  266. package/dist/runtime/services/file-system-service.js +9 -7
  267. package/dist/runtime/services/git-porcelain-service.js +6 -6
  268. package/dist/runtime/services/kubernetes-argo-service.d.ts +10 -2
  269. package/dist/runtime/services/kubernetes-argo-service.js +90 -84
  270. package/dist/runtime/services/mcp-gateway-service.js +82 -81
  271. package/dist/runtime/services/open-pull-request-git-service.js +1 -3
  272. package/dist/runtime/services/opencode-runtime-server-service.js +10 -12
  273. package/dist/runtime/services/opencode-sdk-service.js +7 -7
  274. package/dist/runtime/services/repo-io-service.js +10 -12
  275. package/dist/runtime/services/run-journal-file-service.js +2 -2
  276. package/dist/runtime/services/runner-command-io-service.js +48 -52
  277. package/dist/runtime/services/runner-event-sink-http-service.js +31 -39
  278. package/dist/runtime/step/step-node.js +15 -15
  279. package/dist/runtime/workflow-execution.js +55 -57
  280. package/dist/runtime/workflow-lifecycle.js +81 -101
  281. package/dist/safe-json.js +16 -16
  282. package/dist/schedule/backlog-context.js +120 -116
  283. package/dist/schedule/baseline.js +249 -255
  284. package/dist/schedule/passes/coverage.js +63 -68
  285. package/dist/schedule/passes/drain-merge.js +34 -40
  286. package/dist/schedule/passes/ids.js +15 -17
  287. package/dist/schedule/passes/models.js +40 -37
  288. package/dist/schedule/passes/open-pull-request.js +12 -18
  289. package/dist/schedule/passes/references.js +18 -22
  290. package/dist/schedule/prompts.js +134 -141
  291. package/dist/schedule/scheduling-roles.js +8 -14
  292. package/dist/schema-boundary.d.ts +1 -0
  293. package/dist/schema-boundary.js +145 -0
  294. package/dist/serialized-write-queue.js +2 -2
  295. package/dist/standard-output-schemas.js +61 -59
  296. package/dist/strings.js +12 -12
  297. package/dist/task-ref.js +5 -5
  298. package/dist/tickets/apply-ticket-plan.js +51 -61
  299. package/dist/tickets/backlog-task-store.d.ts +13 -22
  300. package/dist/tickets/backlog-task-store.js +80 -94
  301. package/dist/tickets/completion/complete-ticket.js +53 -59
  302. package/dist/tickets/ticket-graph-dto.d.ts +24 -47
  303. package/dist/tickets/ticket-graph-dto.js +40 -40
  304. package/dist/tickets/ticket-graph.d.ts +7 -1
  305. package/dist/tickets/ticket-graph.js +36 -50
  306. package/dist/tickets/ticket-plan-command-args.js +6 -10
  307. package/dist/tickets/ticket-plan-render.js +10 -16
  308. package/dist/tickets/ticket-plan.d.ts +31 -40
  309. package/dist/tickets/ticket-plan.js +97 -77
  310. package/dist/tickets/ticket-selection.d.ts +1 -1
  311. package/dist/tickets/ticket-selection.js +37 -52
  312. package/dist/tickets/ticket-task-index.js +13 -17
  313. package/dist/tickets/validation-error-format.js +3 -10
  314. package/dist/token-estimator.js +12 -7
  315. package/dist/unknown-fields.js +21 -0
  316. package/dist/workflow-submit-contract.d.ts +9 -9
  317. package/dist/workflow-submit-contract.js +10 -9
  318. package/docs/adr-opencode-first-goal-loop-runtime.md +11 -11
  319. package/docs/config-architecture.md +13 -13
  320. package/docs/mcp-host-isolation.md +1 -0
  321. package/docs/moka-orchestrator-design.md +3 -3
  322. package/docs/operator-guide.md +1 -1
  323. package/docs/runtime-actor-model.md +18 -18
  324. package/docs/slash-command-adapter-contract.md +3 -3
  325. package/package.json +73 -76
  326. package/dist/config/schema/reference-validation.js +0 -83
@@ -1,186 +1,166 @@
1
1
  import { WorkflowExecutionPlan } from "./planning/compile.js";
2
2
  import { buildDynamicRunnerArgoWorkflowOptionsSchema, buildRunnerArgoWorkflowOptionsSchema } from "./remote/argo/model.js";
3
- import { z } from "zod";
4
3
 
5
4
  //#region src/argo-workflow.d.ts
6
- declare const runnerArgoWorkflowManifestSchema: z.ZodObject<{
7
- apiVersion: z.ZodLiteral<"argoproj.io/v1alpha1">;
8
- kind: z.ZodLiteral<"Workflow">;
9
- metadata: z.ZodObject<{
10
- annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
- generateName: z.ZodOptional<z.ZodString>;
12
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
- name: z.ZodOptional<z.ZodString>;
14
- namespace: z.ZodString;
15
- }, z.core.$strict>;
16
- spec: z.ZodObject<{
17
- activeDeadlineSeconds: z.ZodOptional<z.ZodNumber>;
18
- entrypoint: z.ZodLiteral<"pipeline">;
19
- imagePullSecrets: z.ZodOptional<z.ZodArray<z.ZodObject<{
20
- name: z.ZodString;
21
- }, z.core.$strict>>>;
22
- podMetadata: z.ZodOptional<z.ZodObject<{
23
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
24
- }, z.core.$strict>>;
25
- serviceAccountName: z.ZodString;
26
- onExit: z.ZodOptional<z.ZodString>;
27
- templates: z.ZodArray<z.ZodObject<{
28
- container: z.ZodOptional<z.ZodObject<{
29
- args: z.ZodArray<z.ZodString>;
30
- command: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
- env: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
32
- name: z.ZodString;
33
- value: z.ZodString;
34
- }, z.core.$strict>, z.ZodObject<{
35
- name: z.ZodString;
36
- valueFrom: z.ZodObject<{
37
- secretKeyRef: z.ZodObject<{
38
- key: z.ZodString;
39
- name: z.ZodString;
40
- }, z.core.$strict>;
41
- }, z.core.$strict>;
42
- }, z.core.$strict>]>>>;
43
- image: z.ZodString;
44
- imagePullPolicy: z.ZodEnum<{
45
- Always: "Always";
46
- IfNotPresent: "IfNotPresent";
47
- Never: "Never";
48
- }>;
49
- name: z.ZodOptional<z.ZodString>;
50
- resources: z.ZodOptional<z.ZodObject<{
51
- limits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
52
- requests: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
53
- }, z.core.$strict>>;
54
- volumeMounts: z.ZodArray<z.ZodObject<{
55
- mountPath: z.ZodString;
56
- name: z.ZodString;
57
- readOnly: z.ZodOptional<z.ZodBoolean>;
58
- subPath: z.ZodOptional<z.ZodString>;
59
- }, z.core.$strict>>;
60
- }, z.core.$strict>>;
61
- dag: z.ZodOptional<z.ZodObject<{
62
- tasks: z.ZodArray<z.ZodObject<{
63
- arguments: z.ZodOptional<z.ZodObject<{
64
- artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
- from: z.ZodOptional<z.ZodString>;
66
- name: z.ZodString;
67
- path: z.ZodOptional<z.ZodString>;
68
- }, z.core.$strict>>>;
69
- parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
- name: z.ZodString;
71
- value: z.ZodString;
72
- }, z.core.$strict>>>;
73
- }, z.core.$strict>>;
74
- dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
- name: z.ZodString;
76
- template: z.ZodString;
77
- when: z.ZodOptional<z.ZodString>;
78
- withParam: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strict>>;
80
- }, z.core.$strict>>;
81
- inputs: z.ZodOptional<z.ZodObject<{
82
- artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
83
- from: z.ZodOptional<z.ZodString>;
84
- name: z.ZodString;
85
- path: z.ZodOptional<z.ZodString>;
86
- }, z.core.$strict>>>;
87
- parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
- name: z.ZodString;
89
- }, z.core.$strict>>>;
90
- }, z.core.$strict>>;
91
- outputs: z.ZodOptional<z.ZodObject<{
92
- artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
93
- from: z.ZodOptional<z.ZodString>;
94
- name: z.ZodString;
95
- path: z.ZodOptional<z.ZodString>;
96
- }, z.core.$strict>>>;
97
- parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
- name: z.ZodString;
99
- valueFrom: z.ZodObject<{
100
- path: z.ZodString;
101
- }, z.core.$strict>;
102
- }, z.core.$strict>>>;
103
- }, z.core.$strict>>;
104
- steps: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
105
- arguments: z.ZodOptional<z.ZodObject<{
106
- parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
- name: z.ZodString;
108
- value: z.ZodString;
109
- }, z.core.$strict>>>;
110
- }, z.core.$strict>>;
111
- name: z.ZodString;
112
- template: z.ZodString;
113
- when: z.ZodOptional<z.ZodString>;
114
- withParam: z.ZodOptional<z.ZodString>;
115
- }, z.core.$strict>>>>;
116
- activeDeadlineSeconds: z.ZodOptional<z.ZodNumber>;
117
- name: z.ZodString;
118
- retryStrategy: z.ZodOptional<z.ZodObject<{
119
- expression: z.ZodOptional<z.ZodString>;
120
- limit: z.ZodOptional<z.ZodString>;
121
- retryPolicy: z.ZodEnum<{
122
- Always: "Always";
123
- OnError: "OnError";
124
- OnFailure: "OnFailure";
125
- OnTransientError: "OnTransientError";
126
- }>;
127
- }, z.core.$strict>>;
128
- }, z.core.$strict>>;
129
- podGC: z.ZodOptional<z.ZodObject<{
130
- deleteDelayDuration: z.ZodOptional<z.ZodString>;
131
- labelSelector: z.ZodOptional<z.ZodObject<{
132
- matchExpressions: z.ZodOptional<z.ZodArray<z.ZodObject<{
133
- key: z.ZodString;
134
- operator: z.ZodEnum<{
135
- DoesNotExist: "DoesNotExist";
136
- Exists: "Exists";
137
- In: "In";
138
- NotIn: "NotIn";
5
+ declare const runnerArgoWorkflowManifestSchema: import("effect/Schema").Struct<{
6
+ readonly apiVersion: import("effect/Schema").Literal<"argoproj.io/v1alpha1">;
7
+ readonly kind: import("effect/Schema").Literal<"Workflow">;
8
+ readonly metadata: import("effect/Schema").Struct<{
9
+ readonly annotations: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
10
+ readonly generateName: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
11
+ readonly labels: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").NonEmptyString, import("effect/Schema").NonEmptyString>>;
12
+ readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
13
+ readonly namespace: import("effect/Schema").NonEmptyString;
14
+ }>;
15
+ readonly spec: import("effect/Schema").Struct<{
16
+ readonly activeDeadlineSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
17
+ readonly entrypoint: import("effect/Schema").Literal<"pipeline">;
18
+ readonly imagePullSecrets: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
19
+ readonly name: import("effect/Schema").NonEmptyString;
20
+ }>>>>;
21
+ readonly onExit: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
22
+ readonly podGC: import("effect/Schema").optional<import("effect/Schema").Struct<{
23
+ readonly deleteDelayDuration: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
24
+ readonly labelSelector: import("effect/Schema").optional<import("effect/Schema").Struct<{
25
+ readonly matchExpressions: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
26
+ readonly key: import("effect/Schema").NonEmptyString;
27
+ readonly operator: import("effect/Schema").Literals<readonly ["In", "NotIn", "Exists", "DoesNotExist"]>;
28
+ readonly values: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").String>>>;
29
+ }>>>>;
30
+ readonly matchLabels: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").NonEmptyString, import("effect/Schema").String>>;
31
+ }>>;
32
+ readonly strategy: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["OnPodCompletion", "OnPodSuccess", "OnWorkflowCompletion", "OnWorkflowSuccess"]>>;
33
+ }>>;
34
+ readonly podMetadata: import("effect/Schema").optional<import("effect/Schema").Struct<{
35
+ readonly labels: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").NonEmptyString, import("effect/Schema").NonEmptyString>>;
36
+ }>>;
37
+ readonly serviceAccountName: import("effect/Schema").NonEmptyString;
38
+ readonly templates: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
39
+ readonly activeDeadlineSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
40
+ readonly container: import("effect/Schema").optional<import("effect/Schema").Struct<{
41
+ readonly args: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").NonEmptyString>>;
42
+ readonly command: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").NonEmptyString>>>;
43
+ readonly env: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
44
+ readonly name: import("effect/Schema").NonEmptyString;
45
+ readonly value: import("effect/Schema").String;
46
+ }>, import("effect/Schema").Struct<{
47
+ readonly name: import("effect/Schema").NonEmptyString;
48
+ readonly valueFrom: import("effect/Schema").Struct<{
49
+ readonly secretKeyRef: import("effect/Schema").Struct<{
50
+ readonly key: import("effect/Schema").NonEmptyString;
51
+ readonly name: import("effect/Schema").NonEmptyString;
52
+ }>;
53
+ }>;
54
+ }>]>>>>;
55
+ readonly image: import("effect/Schema").NonEmptyString;
56
+ readonly imagePullPolicy: import("effect/Schema").Literals<readonly ["Always", "IfNotPresent", "Never"]>;
57
+ readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
58
+ readonly resources: import("effect/Schema").optional<import("effect/Schema").Struct<{
59
+ readonly limits: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
60
+ readonly requests: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
61
+ }>>;
62
+ readonly volumeMounts: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
63
+ readonly mountPath: import("effect/Schema").NonEmptyString;
64
+ readonly name: import("effect/Schema").NonEmptyString;
65
+ readonly readOnly: import("effect/Schema").optional<import("effect/Schema").Boolean>;
66
+ readonly subPath: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
67
+ }>>>;
68
+ }>>;
69
+ readonly dag: import("effect/Schema").optional<import("effect/Schema").Struct<{
70
+ readonly tasks: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
71
+ readonly arguments: import("effect/Schema").optional<import("effect/Schema").Struct<{
72
+ readonly artifacts: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
73
+ readonly from: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
74
+ readonly name: import("effect/Schema").NonEmptyString;
75
+ readonly path: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
76
+ }>>>>;
77
+ readonly parameters: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
78
+ readonly name: import("effect/Schema").NonEmptyString;
79
+ readonly value: import("effect/Schema").String;
80
+ }>>>>;
81
+ }>>;
82
+ readonly dependencies: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").NonEmptyString>>>;
83
+ readonly name: import("effect/Schema").NonEmptyString;
84
+ readonly template: import("effect/Schema").NonEmptyString;
85
+ readonly when: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
86
+ readonly withParam: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
87
+ }>>>;
88
+ }>>;
89
+ readonly inputs: import("effect/Schema").optional<import("effect/Schema").Struct<{
90
+ readonly artifacts: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
91
+ readonly from: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
92
+ readonly name: import("effect/Schema").NonEmptyString;
93
+ readonly path: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
94
+ }>>>>;
95
+ readonly parameters: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
96
+ readonly name: import("effect/Schema").NonEmptyString;
97
+ }>>>>;
98
+ }>>;
99
+ readonly name: import("effect/Schema").NonEmptyString;
100
+ readonly outputs: import("effect/Schema").optional<import("effect/Schema").Struct<{
101
+ readonly artifacts: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
102
+ readonly from: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
103
+ readonly name: import("effect/Schema").NonEmptyString;
104
+ readonly path: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
105
+ }>>>>;
106
+ readonly parameters: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
107
+ readonly name: import("effect/Schema").NonEmptyString;
108
+ readonly valueFrom: import("effect/Schema").Struct<{
109
+ readonly path: import("effect/Schema").NonEmptyString;
139
110
  }>;
140
- values: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
- }, z.core.$strict>>>;
142
- matchLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
143
- }, z.core.$strict>>;
144
- strategy: z.ZodOptional<z.ZodEnum<{
145
- OnPodCompletion: "OnPodCompletion";
146
- OnPodSuccess: "OnPodSuccess";
147
- OnWorkflowCompletion: "OnWorkflowCompletion";
148
- OnWorkflowSuccess: "OnWorkflowSuccess";
111
+ }>>>>;
112
+ }>>;
113
+ readonly retryStrategy: import("effect/Schema").optional<import("effect/Schema").Struct<{
114
+ readonly expression: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
115
+ readonly limit: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
116
+ readonly retryPolicy: import("effect/Schema").Literals<readonly ["Always", "OnError", "OnFailure", "OnTransientError"]>;
117
+ }>>;
118
+ readonly steps: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
119
+ readonly arguments: import("effect/Schema").optional<import("effect/Schema").Struct<{
120
+ readonly parameters: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
121
+ readonly name: import("effect/Schema").NonEmptyString;
122
+ readonly value: import("effect/Schema").String;
123
+ }>>>>;
124
+ }>>;
125
+ readonly name: import("effect/Schema").NonEmptyString;
126
+ readonly template: import("effect/Schema").NonEmptyString;
127
+ readonly when: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
128
+ readonly withParam: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
129
+ }>>>>>>;
130
+ }>>>;
131
+ readonly ttlStrategy: import("effect/Schema").optional<import("effect/Schema").Struct<{
132
+ readonly secondsAfterCompletion: import("effect/Schema").optional<import("effect/Schema").Number>;
133
+ readonly secondsAfterFailure: import("effect/Schema").optional<import("effect/Schema").Number>;
134
+ readonly secondsAfterSuccess: import("effect/Schema").optional<import("effect/Schema").Number>;
135
+ }>>;
136
+ readonly volumes: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
137
+ readonly configMap: import("effect/Schema").optional<import("effect/Schema").Struct<{
138
+ readonly items: import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
139
+ readonly key: import("effect/Schema").NonEmptyString;
140
+ readonly path: import("effect/Schema").NonEmptyString;
141
+ }>>>;
142
+ readonly name: import("effect/Schema").NonEmptyString;
143
+ }>>;
144
+ readonly name: import("effect/Schema").NonEmptyString;
145
+ readonly secret: import("effect/Schema").optional<import("effect/Schema").Struct<{
146
+ readonly defaultMode: import("effect/Schema").optional<import("effect/Schema").Number>;
147
+ readonly items: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
148
+ readonly key: import("effect/Schema").NonEmptyString;
149
+ readonly path: import("effect/Schema").NonEmptyString;
150
+ }>>>>;
151
+ readonly optional: import("effect/Schema").optional<import("effect/Schema").Boolean>;
152
+ readonly secretName: import("effect/Schema").NonEmptyString;
149
153
  }>>;
150
- }, z.core.$strict>>;
151
- ttlStrategy: z.ZodOptional<z.ZodObject<{
152
- secondsAfterCompletion: z.ZodOptional<z.ZodNumber>;
153
- secondsAfterFailure: z.ZodOptional<z.ZodNumber>;
154
- secondsAfterSuccess: z.ZodOptional<z.ZodNumber>;
155
- }, z.core.$strict>>;
156
- volumes: z.ZodArray<z.ZodObject<{
157
- configMap: z.ZodOptional<z.ZodObject<{
158
- items: z.ZodArray<z.ZodObject<{
159
- key: z.ZodString;
160
- path: z.ZodString;
161
- }, z.core.$strict>>;
162
- name: z.ZodString;
163
- }, z.core.$strict>>;
164
- name: z.ZodString;
165
- secret: z.ZodOptional<z.ZodObject<{
166
- defaultMode: z.ZodOptional<z.ZodNumber>;
167
- items: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
- key: z.ZodString;
169
- path: z.ZodString;
170
- }, z.core.$strict>>>;
171
- optional: z.ZodOptional<z.ZodBoolean>;
172
- secretName: z.ZodString;
173
- }, z.core.$strict>>;
174
- }, z.core.$strict>>;
175
- }, z.core.$strict>;
176
- }, z.core.$strict>;
177
- type ArgoWorkflowManifest = z.infer<typeof runnerArgoWorkflowManifestSchema>;
178
- type BuildRunnerArgoWorkflowOptions = z.input<typeof buildRunnerArgoWorkflowOptionsSchema> & {
154
+ }>>>;
155
+ }>;
156
+ }>;
157
+ type ArgoWorkflowManifest = typeof runnerArgoWorkflowManifestSchema.Type;
158
+ type BuildRunnerArgoWorkflowOptions = typeof buildRunnerArgoWorkflowOptionsSchema.Encoded & {
179
159
  plan: WorkflowExecutionPlan;
180
160
  };
181
- type BuildDynamicRunnerArgoWorkflowOptions = z.input<typeof buildDynamicRunnerArgoWorkflowOptionsSchema>;
182
- declare function buildRunnerArgoWorkflowManifest(rawOptions: BuildRunnerArgoWorkflowOptions): ArgoWorkflowManifest;
183
- declare function buildDynamicRunnerArgoWorkflowManifest(rawOptions: BuildDynamicRunnerArgoWorkflowOptions): ArgoWorkflowManifest;
184
- declare function stringifyRunnerArgoWorkflow(workflow: ArgoWorkflowManifest): string;
161
+ type BuildDynamicRunnerArgoWorkflowOptions = typeof buildDynamicRunnerArgoWorkflowOptionsSchema.Encoded;
162
+ declare const stringifyRunnerArgoWorkflow: (workflow: ArgoWorkflowManifest) => string;
163
+ declare const buildRunnerArgoWorkflowManifest: (rawOptions: BuildRunnerArgoWorkflowOptions) => ArgoWorkflowManifest;
164
+ declare const buildDynamicRunnerArgoWorkflowManifest: (rawOptions: BuildDynamicRunnerArgoWorkflowOptions) => ArgoWorkflowManifest;
185
165
  //#endregion
186
166
  export { ArgoWorkflowManifest, BuildDynamicRunnerArgoWorkflowOptions, BuildRunnerArgoWorkflowOptions, buildDynamicRunnerArgoWorkflowManifest, buildRunnerArgoWorkflowManifest, runnerArgoWorkflowManifestSchema, stringifyRunnerArgoWorkflow };
@@ -1,3 +1,4 @@
1
+ import { parseStrictWithSchema, parseWithSchema } from "./schema-boundary.js";
1
2
  import { compileArgoExecutionGraph } from "./argo-graph.js";
2
3
  import { RUNNER_WORKFLOW_ENTRYPOINT, RUNNER_WORKFLOW_START_TASK } from "./remote/argo/policy.js";
3
4
  import { buildDynamicRunnerArgoWorkflowOptionsSchema, buildRunnerArgoWorkflowOptionsSchema, createRunnerArgoWorkflowManifestSchema } from "./remote/argo/model.js";
@@ -6,144 +7,64 @@ import { READY_NODE_IDS_PARAMETER, dynamicPreScheduleTemplate, dynamicReadyWaveS
6
7
  import { stringify } from "yaml";
7
8
  //#region src/argo-workflow.ts
8
9
  const runnerArgoWorkflowManifestSchema = createRunnerArgoWorkflowManifestSchema();
9
- function buildRunnerArgoWorkflowManifest(rawOptions) {
10
- const options = parsedBuildOptions(rawOptions);
11
- const graph = compileArgoExecutionGraph(options.plan);
12
- const storage = runnerWorkflowStorage(options, graph.tasks);
13
- return runnerArgoWorkflowManifestSchema.parse({
14
- apiVersion: "argoproj.io/v1alpha1",
15
- kind: "Workflow",
16
- metadata: workflowMetadata(options),
17
- spec: workflowSpec(options, graph.tasks, storage)
18
- });
19
- }
20
- function buildDynamicRunnerArgoWorkflowManifest(rawOptions) {
21
- const options = buildDynamicRunnerArgoWorkflowOptionsSchema.parse(rawOptions);
22
- const storage = dynamicRunnerWorkflowStorage(options);
23
- return runnerArgoWorkflowManifestSchema.parse({
24
- apiVersion: "argoproj.io/v1alpha1",
25
- kind: "Workflow",
26
- metadata: dynamicWorkflowMetadata(options),
27
- spec: dynamicWorkflowSpec(options, storage)
28
- });
29
- }
30
- function stringifyRunnerArgoWorkflow(workflow) {
31
- return stringify(runnerArgoWorkflowManifestSchema.parse(workflow));
32
- }
33
- function parsedBuildOptions(rawOptions) {
10
+ const stringifyRunnerArgoWorkflow = (workflow) => stringify(parseWithSchema(runnerArgoWorkflowManifestSchema, workflow, { onExcessProperty: "preserve" }));
11
+ const parsedBuildOptions = (rawOptions) => {
34
12
  const { plan, ...schemaOptions } = rawOptions;
35
13
  return {
36
- ...buildRunnerArgoWorkflowOptionsSchema.parse(schemaOptions),
14
+ ...parseStrictWithSchema(buildRunnerArgoWorkflowOptionsSchema, schemaOptions),
37
15
  plan
38
16
  };
39
- }
40
- function workflowMetadata(options) {
41
- return {
42
- annotations: compactRecord(options.annotations),
43
- ...options.name ? { name: options.name } : {},
44
- ...options.generateName ? { generateName: options.generateName } : {},
45
- labels: compactRecord({
46
- "pipeline.oisin.dev/source": "argo-workflow",
47
- "pipeline.oisin.dev/workflow": options.plan.workflowId,
48
- ...options.labels
49
- }),
50
- namespace: options.namespace
51
- };
52
- }
53
- function dynamicWorkflowMetadata(options) {
54
- return {
55
- annotations: compactRecord(options.annotations),
56
- ...options.name ? { name: options.name } : {},
57
- ...options.generateName ? { generateName: options.generateName } : {},
58
- labels: compactRecord({
59
- "pipeline.oisin.dev/source": "argo-workflow",
60
- "pipeline.oisin.dev/workflow": options.workflowId,
61
- ...options.labels
62
- }),
63
- namespace: options.namespace
64
- };
65
- }
66
- function workflowSpec(options, tasks, storage) {
67
- return {
68
- ...options.activeDeadlineSeconds ? { activeDeadlineSeconds: options.activeDeadlineSeconds } : {},
69
- entrypoint: RUNNER_WORKFLOW_ENTRYPOINT,
70
- ...options.imagePullSecretName ? { imagePullSecrets: [{ name: options.imagePullSecretName }] } : {},
71
- serviceAccountName: options.serviceAccountName,
72
- onExit: "pipeline-finalizer",
73
- templates: workflowTemplates(options, tasks, storage.volumeMounts),
74
- ...options.ttlStrategy ? { ttlStrategy: options.ttlStrategy } : {},
75
- volumes: storage.volumes
76
- };
77
- }
78
- function dynamicWorkflowSpec(options, storage) {
79
- return {
80
- ...options.activeDeadlineSeconds ? { activeDeadlineSeconds: options.activeDeadlineSeconds } : {},
81
- entrypoint: RUNNER_WORKFLOW_ENTRYPOINT,
82
- ...options.imagePullSecretName ? { imagePullSecrets: [{ name: options.imagePullSecretName }] } : {},
83
- serviceAccountName: options.serviceAccountName,
84
- onExit: "pipeline-finalizer",
85
- templates: dynamicWorkflowTemplates(options, storage.volumeMounts),
86
- ...options.ttlStrategy ? { ttlStrategy: options.ttlStrategy } : {},
87
- volumes: storage.volumes
88
- };
89
- }
90
- function workflowTemplates(options, tasks, volumeMounts) {
91
- return [
92
- workflowDagTemplate(tasks),
93
- runnerLifecycleTemplate(options, volumeMounts),
94
- ...tasks.map((task) => runnerCommandTemplate(task, options, volumeMounts)),
95
- runnerFinalizerTemplate(options, volumeMounts)
96
- ];
97
- }
98
- function dynamicWorkflowTemplates(options, volumeMounts) {
99
- return [
100
- dynamicWorkflowEntrypointTemplate(),
101
- dynamicDrainTemplate(),
102
- dynamicPreScheduleTemplate("pre-research", options, volumeMounts),
103
- dynamicPreScheduleTemplate("pre-planning", options, volumeMounts),
104
- dynamicPreScheduleTemplate("generate-schedule", options, volumeMounts),
105
- dynamicReadyWaveSelectorTemplate(options, volumeMounts),
106
- dynamicRunnerCommandTemplate(options, volumeMounts),
107
- dynamicRunnerFinalizerTemplate(options, volumeMounts)
108
- ];
109
- }
110
- function workflowDagTemplate(tasks) {
111
- return {
112
- dag: { tasks: [{
113
- name: RUNNER_WORKFLOW_START_TASK,
114
- template: RUNNER_WORKFLOW_START_TASK
115
- }, ...tasks.map((task) => ({
116
- dependencies: [RUNNER_WORKFLOW_START_TASK, ...task.dependencies],
117
- name: task.taskName,
118
- template: task.templateName
119
- }))] },
120
- name: RUNNER_WORKFLOW_ENTRYPOINT
121
- };
122
- }
123
- function dynamicWorkflowEntrypointTemplate() {
124
- return {
125
- name: RUNNER_WORKFLOW_ENTRYPOINT,
126
- steps: [
127
- [{
128
- name: "pre-research",
129
- template: "pre-research"
130
- }],
131
- [{
132
- name: "pre-planning",
133
- template: "pre-planning"
134
- }],
135
- [{
136
- name: "generate-schedule",
137
- template: "generate-schedule"
138
- }],
139
- [{
140
- name: "drain-ready-waves",
141
- template: "drain-ready-waves"
142
- }]
143
- ]
144
- };
145
- }
146
- function dynamicDrainTemplate() {
17
+ };
18
+ const workflowDagTemplate = (tasks) => ({
19
+ dag: { tasks: [{
20
+ name: RUNNER_WORKFLOW_START_TASK,
21
+ template: RUNNER_WORKFLOW_START_TASK
22
+ }, ...tasks.map((task) => ({
23
+ dependencies: [RUNNER_WORKFLOW_START_TASK, ...task.dependencies],
24
+ name: task.taskName,
25
+ template: task.templateName
26
+ }))] },
27
+ name: RUNNER_WORKFLOW_ENTRYPOINT
28
+ });
29
+ const workflowTemplates = (options, tasks, volumeMounts) => [
30
+ workflowDagTemplate(tasks),
31
+ runnerLifecycleTemplate(options, volumeMounts),
32
+ ...tasks.map((task) => runnerCommandTemplate(task, options, volumeMounts)),
33
+ runnerFinalizerTemplate(options, volumeMounts)
34
+ ];
35
+ const workflowSpecBase = (options, storage, templates) => ({
36
+ ...options.activeDeadlineSeconds === void 0 ? {} : { activeDeadlineSeconds: options.activeDeadlineSeconds },
37
+ entrypoint: RUNNER_WORKFLOW_ENTRYPOINT,
38
+ ...options.imagePullSecretName !== void 0 && options.imagePullSecretName.length > 0 ? { imagePullSecrets: [{ name: options.imagePullSecretName }] } : {},
39
+ onExit: "pipeline-finalizer",
40
+ serviceAccountName: options.serviceAccountName,
41
+ templates,
42
+ ...options.ttlStrategy ? { ttlStrategy: options.ttlStrategy } : {},
43
+ volumes: storage.volumes
44
+ });
45
+ const workflowSpec = (options, tasks, storage) => workflowSpecBase(options, storage, workflowTemplates(options, tasks, storage.volumeMounts));
46
+ const dynamicWorkflowEntrypointTemplate = () => ({
47
+ name: RUNNER_WORKFLOW_ENTRYPOINT,
48
+ steps: [
49
+ [{
50
+ name: "pre-research",
51
+ template: "pre-research"
52
+ }],
53
+ [{
54
+ name: "pre-planning",
55
+ template: "pre-planning"
56
+ }],
57
+ [{
58
+ name: "generate-schedule",
59
+ template: "generate-schedule"
60
+ }],
61
+ [{
62
+ name: "drain-ready-waves",
63
+ template: "drain-ready-waves"
64
+ }]
65
+ ]
66
+ });
67
+ const dynamicDrainTemplate = () => {
147
68
  const readyExpression = `{{steps.select-ready-wave.outputs.parameters.${READY_NODE_IDS_PARAMETER}}} != []`;
148
69
  return {
149
70
  name: "drain-ready-waves",
@@ -169,9 +90,46 @@ function dynamicDrainTemplate() {
169
90
  }]
170
91
  ]
171
92
  };
172
- }
173
- function compactRecord(input) {
174
- return Object.fromEntries(Object.entries(input).filter((entry) => entry[1] !== void 0));
175
- }
93
+ };
94
+ const dynamicWorkflowTemplates = (options, volumeMounts) => [
95
+ dynamicWorkflowEntrypointTemplate(),
96
+ dynamicDrainTemplate(),
97
+ dynamicPreScheduleTemplate("pre-research", options, volumeMounts),
98
+ dynamicPreScheduleTemplate("pre-planning", options, volumeMounts),
99
+ dynamicPreScheduleTemplate("generate-schedule", options, volumeMounts),
100
+ dynamicReadyWaveSelectorTemplate(options, volumeMounts),
101
+ dynamicRunnerCommandTemplate(options, volumeMounts),
102
+ dynamicRunnerFinalizerTemplate(options, volumeMounts)
103
+ ];
104
+ const dynamicWorkflowSpec = (options, storage) => workflowSpecBase(options, storage, dynamicWorkflowTemplates(options, storage.volumeMounts));
105
+ const compactRecord = (input) => Object.fromEntries(Object.entries(input).filter((entry) => entry[1] !== void 0));
106
+ const workflowMetadata = (options, workflowId) => ({
107
+ annotations: compactRecord(options.annotations),
108
+ ...options.name !== void 0 && options.name.length > 0 ? { name: options.name } : {},
109
+ ...options.generateName !== void 0 && options.generateName.length > 0 ? { generateName: options.generateName } : {},
110
+ labels: compactRecord({
111
+ "pipeline.oisin.dev/source": "argo-workflow",
112
+ "pipeline.oisin.dev/workflow": workflowId,
113
+ ...options.labels
114
+ }),
115
+ namespace: options.namespace
116
+ });
117
+ const runnerArgoWorkflowManifest = (options, workflowId, spec) => parseStrictWithSchema(runnerArgoWorkflowManifestSchema, {
118
+ apiVersion: "argoproj.io/v1alpha1",
119
+ kind: "Workflow",
120
+ metadata: workflowMetadata(options, workflowId),
121
+ spec
122
+ });
123
+ const buildRunnerArgoWorkflowManifest = (rawOptions) => {
124
+ const options = parsedBuildOptions(rawOptions);
125
+ const graph = compileArgoExecutionGraph(options.plan);
126
+ const storage = runnerWorkflowStorage(options, graph.tasks);
127
+ return runnerArgoWorkflowManifest(options, options.plan.workflowId, workflowSpec(options, graph.tasks, storage));
128
+ };
129
+ const buildDynamicRunnerArgoWorkflowManifest = (rawOptions) => {
130
+ const options = parseStrictWithSchema(buildDynamicRunnerArgoWorkflowOptionsSchema, rawOptions);
131
+ const storage = dynamicRunnerWorkflowStorage(options);
132
+ return runnerArgoWorkflowManifest(options, options.workflowId, dynamicWorkflowSpec(options, storage));
133
+ };
176
134
  //#endregion
177
135
  export { buildDynamicRunnerArgoWorkflowManifest, buildRunnerArgoWorkflowManifest, runnerArgoWorkflowManifestSchema, stringifyRunnerArgoWorkflow };
package/dist/backlog.js CHANGED
@@ -1,13 +1,14 @@
1
+ import { Option } from "effect";
1
2
  //#region src/backlog.ts
2
3
  /**
3
4
  * `backlog task create` (with `--plain`) prints `Task <PREFIX>-<id> - <title>`
4
5
  * on the second non-blank line. We accept custom all-caps Backlog prefixes and
5
6
  * subtask ids like `PIPE-3.1`.
6
7
  */
7
- const TASK_ID_RE = /^Task\s+([A-Z]+-[\w.]+)\b/m;
8
- function parseBacklogTaskId(stdout) {
8
+ const TASK_ID_RE = /^Task\s+([A-Z]+-[\w.]+)\b/mu;
9
+ const parseBacklogTaskId = (stdout) => {
9
10
  const m = TASK_ID_RE.exec(stdout);
10
- return m ? m[1] : null;
11
- }
11
+ return m === null ? Option.none() : Option.some(m[1]);
12
+ };
12
13
  //#endregion
13
14
  export { parseBacklogTaskId };