tubeless 0.2.3 → 0.2.5

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 (182) hide show
  1. package/README.md +52 -52
  2. package/dist/cli/cli-types.d.ts +2 -2
  3. package/dist/cli/cli-types.js.map +1 -1
  4. package/dist/cli/cli.d.ts +3 -3
  5. package/dist/cli/cli.js +0 -2
  6. package/dist/cli/cli.js.map +1 -1
  7. package/dist/core/child-execution.js +2 -4
  8. package/dist/core/child-execution.js.map +1 -1
  9. package/dist/core/lifecycle.d.ts +1 -1
  10. package/dist/core/lifecycle.js.map +1 -1
  11. package/dist/core/pipeline-compiler.d.ts +17 -0
  12. package/dist/core/pipeline-compiler.js +44 -0
  13. package/dist/core/pipeline-compiler.js.map +1 -0
  14. package/dist/core/pipeline-definition-validation.d.ts +4 -0
  15. package/dist/core/pipeline-definition-validation.js +101 -0
  16. package/dist/core/pipeline-definition-validation.js.map +1 -0
  17. package/dist/core/pipeline-definition.d.ts +28 -0
  18. package/dist/core/pipeline-definition.js +2 -0
  19. package/dist/core/pipeline-definition.js.map +1 -0
  20. package/dist/core/pipeline-disposition.d.ts +26 -0
  21. package/dist/core/pipeline-disposition.js +44 -0
  22. package/dist/core/pipeline-disposition.js.map +1 -0
  23. package/dist/core/pipeline-errors.d.ts +8 -0
  24. package/dist/core/pipeline-errors.js +20 -0
  25. package/dist/core/pipeline-errors.js.map +1 -0
  26. package/dist/core/pipeline-execute.d.ts +1 -1
  27. package/dist/core/pipeline-execute.js +5 -2
  28. package/dist/core/pipeline-execute.js.map +1 -1
  29. package/dist/core/pipeline-finalizer.d.ts +18 -0
  30. package/dist/core/pipeline-finalizer.js +37 -0
  31. package/dist/core/pipeline-finalizer.js.map +1 -0
  32. package/dist/core/pipeline-graph.d.ts +23 -0
  33. package/dist/core/pipeline-graph.js +135 -0
  34. package/dist/core/pipeline-graph.js.map +1 -0
  35. package/dist/core/pipeline-identity.d.ts +5 -0
  36. package/dist/core/pipeline-identity.js +11 -0
  37. package/dist/core/pipeline-identity.js.map +1 -0
  38. package/dist/core/pipeline-mermaid.d.ts +4 -0
  39. package/dist/core/pipeline-mermaid.js +56 -0
  40. package/dist/core/pipeline-mermaid.js.map +1 -0
  41. package/dist/core/pipeline-plan.d.ts +5 -94
  42. package/dist/core/pipeline-plan.js +5 -454
  43. package/dist/core/pipeline-plan.js.map +1 -1
  44. package/dist/core/pipeline-step-executor.d.ts +1 -1
  45. package/dist/core/pipeline-step-executor.js.map +1 -1
  46. package/dist/core/pipeline-step-metadata.d.ts +4 -0
  47. package/dist/core/pipeline-step-metadata.js +5 -0
  48. package/dist/core/pipeline-step-metadata.js.map +1 -0
  49. package/dist/core/pipeline-steps.d.ts +1 -1
  50. package/dist/core/pipeline-steps.js +1 -1
  51. package/dist/core/pipeline-steps.js.map +1 -1
  52. package/dist/core/pipeline-types.d.ts +10 -10
  53. package/dist/core/pipeline-types.js +8 -0
  54. package/dist/core/pipeline-types.js.map +1 -1
  55. package/dist/core/pipeline.d.ts +8 -9
  56. package/dist/core/pipeline.js +9 -6
  57. package/dist/core/pipeline.js.map +1 -1
  58. package/dist/node/node.d.ts +0 -3
  59. package/dist/node/node.js +0 -3
  60. package/dist/node/node.js.map +1 -1
  61. package/dist/{workbench/workbench-project.js → project/project-manifest.js} +1 -1
  62. package/dist/project/project-manifest.js.map +1 -0
  63. package/dist/project/project.d.ts +1 -0
  64. package/dist/project/project.js +2 -0
  65. package/dist/project/project.js.map +1 -0
  66. package/dist/reporter/reporter-entry.d.ts +1 -2
  67. package/dist/reporter/reporter-entry.js +1 -2
  68. package/dist/reporter/reporter-entry.js.map +1 -1
  69. package/dist/run-store/run-store-codec.d.ts +4 -0
  70. package/dist/run-store/run-store-codec.js +31 -0
  71. package/dist/run-store/run-store-codec.js.map +1 -0
  72. package/dist/run-store/run-store-sqlite.js +9 -55
  73. package/dist/run-store/run-store-sqlite.js.map +1 -1
  74. package/dist/run-store/run-store.d.ts +1 -1
  75. package/dist/run-store/run-store.js.map +1 -1
  76. package/dist/studio/run-store-ui-client-app.d.ts +12 -0
  77. package/dist/studio/run-store-ui-client-app.js +224 -0
  78. package/dist/studio/run-store-ui-client-app.js.map +1 -0
  79. package/dist/studio/run-store-ui-client-browser.d.ts +1 -0
  80. package/dist/studio/run-store-ui-client-browser.js +2 -0
  81. package/dist/studio/run-store-ui-client-commands.d.ts +18 -0
  82. package/dist/studio/run-store-ui-client-commands.js +98 -0
  83. package/dist/studio/run-store-ui-client-commands.js.map +1 -0
  84. package/dist/studio/run-store-ui-client-form.d.ts +2 -0
  85. package/dist/studio/run-store-ui-client-form.js +10 -0
  86. package/dist/studio/run-store-ui-client-form.js.map +1 -1
  87. package/dist/studio/run-store-ui-client-modals.d.ts +20 -0
  88. package/dist/studio/run-store-ui-client-modals.js +154 -0
  89. package/dist/studio/run-store-ui-client-modals.js.map +1 -0
  90. package/dist/studio/run-store-ui-client-model.d.ts +0 -21
  91. package/dist/studio/run-store-ui-client-model.js +2 -24
  92. package/dist/studio/run-store-ui-client-model.js.map +1 -1
  93. package/dist/studio/run-store-ui-client-runs.d.ts +24 -0
  94. package/dist/studio/run-store-ui-client-runs.js +78 -0
  95. package/dist/studio/run-store-ui-client-runs.js.map +1 -0
  96. package/dist/studio/run-store-ui-client-shared.d.ts +22 -0
  97. package/dist/studio/run-store-ui-client-shared.js +63 -0
  98. package/dist/studio/run-store-ui-client-shared.js.map +1 -0
  99. package/dist/studio/run-store-ui-client-transport.js +7 -12
  100. package/dist/studio/run-store-ui-client-transport.js.map +1 -1
  101. package/dist/studio/run-store-ui-client.d.ts +1 -1
  102. package/dist/studio/run-store-ui-client.js +8 -6
  103. package/dist/studio/run-store-ui-client.js.map +1 -1
  104. package/dist/studio/run-store-ui-page.d.ts +2 -2
  105. package/dist/studio/run-store-ui-page.js +7 -71
  106. package/dist/studio/run-store-ui-page.js.map +1 -1
  107. package/dist/studio/run-store-ui.d.ts +1 -1
  108. package/dist/studio/run-store-ui.js +3 -4
  109. package/dist/studio/run-store-ui.js.map +1 -1
  110. package/dist/tracing/tracing-codec.d.ts +4 -5
  111. package/dist/tracing/tracing-codec.js +8 -824
  112. package/dist/tracing/tracing-codec.js.map +1 -1
  113. package/dist/tracing/tracing-contracts.d.ts +31 -0
  114. package/dist/tracing/tracing-contracts.js +2 -0
  115. package/dist/tracing/tracing-contracts.js.map +1 -0
  116. package/dist/tracing/tracing-internal.d.ts +1 -1
  117. package/dist/tracing/tracing-internal.js.map +1 -1
  118. package/dist/tracing/tracing-schema.d.ts +809 -0
  119. package/dist/tracing/tracing-schema.js +429 -0
  120. package/dist/tracing/tracing-schema.js.map +1 -0
  121. package/dist/tracing/tracing.d.ts +2 -193
  122. package/dist/tracing/tracing.js.map +1 -1
  123. package/dist/tracing/wire-schema.d.ts +50 -0
  124. package/dist/tracing/wire-schema.js +193 -0
  125. package/dist/tracing/wire-schema.js.map +1 -0
  126. package/dist/workbench/pipeline-module.js +4 -4
  127. package/dist/workbench/pipeline-module.js.map +1 -1
  128. package/dist/workbench/workbench-project-loader.d.ts +1 -1
  129. package/dist/workbench/workbench-project-loader.js +1 -1
  130. package/dist/workbench/workbench-project-loader.js.map +1 -1
  131. package/dist/workbench/workbench-ui.js +13 -37
  132. package/dist/workbench/workbench-ui.js.map +1 -1
  133. package/docs/README.md +4 -3
  134. package/docs/agent-guide.md +29 -44
  135. package/docs/api-reference.md +31 -172
  136. package/docs/api-report.json +33 -206
  137. package/docs/child-pipeline-composition.md +0 -3
  138. package/docs/cli.md +50 -5
  139. package/docs/comparison.md +2 -1
  140. package/docs/concepts.md +16 -25
  141. package/docs/getting-started.md +7 -5
  142. package/docs/llms.txt +2 -5
  143. package/docs/recipes.md +28 -31
  144. package/docs/studio.md +6 -44
  145. package/examples/catalog/tubeless.project.ts +5 -2
  146. package/examples/tracing.ts +96 -5
  147. package/package.json +13 -56
  148. package/skills/tubeless/SKILL.md +6 -1
  149. package/dist/node/env.d.ts +0 -1
  150. package/dist/node/env.js +0 -8
  151. package/dist/node/env.js.map +0 -1
  152. package/dist/node/file-utils.d.ts +0 -3
  153. package/dist/node/file-utils.js +0 -17
  154. package/dist/node/file-utils.js.map +0 -1
  155. package/dist/node/paths.d.ts +0 -8
  156. package/dist/node/paths.js +0 -19
  157. package/dist/node/paths.js.map +0 -1
  158. package/dist/reporter/prompt-select.d.ts +0 -80
  159. package/dist/reporter/prompt-select.js +0 -197
  160. package/dist/reporter/prompt-select.js.map +0 -1
  161. package/dist/studio/run-store-ui-client-controller.d.ts +0 -9
  162. package/dist/studio/run-store-ui-client-controller.js +0 -479
  163. package/dist/studio/run-store-ui-client-controller.js.map +0 -1
  164. package/dist/studio/run-store-ui-client-source.d.ts +0 -1
  165. package/dist/studio/run-store-ui-client-source.js +0 -1
  166. package/dist/studio/run-store-ui-client-views.d.ts +0 -24
  167. package/dist/studio/run-store-ui-client-views.js +0 -676
  168. package/dist/studio/run-store-ui-client-views.js.map +0 -1
  169. package/dist/tracing/tracing-json.d.ts +0 -11
  170. package/dist/tracing/tracing-json.js +0 -8
  171. package/dist/tracing/tracing-json.js.map +0 -1
  172. package/dist/tracing/tracing-otel.d.ts +0 -35
  173. package/dist/tracing/tracing-otel.js +0 -76
  174. package/dist/tracing/tracing-otel.js.map +0 -1
  175. package/dist/workbench/workbench-project.js.map +0 -1
  176. package/dist/workbench/workbench-studio.d.ts +0 -29
  177. package/dist/workbench/workbench-studio.js +0 -61
  178. package/dist/workbench/workbench-studio.js.map +0 -1
  179. package/examples/catalog/tubeless.studio.ts +0 -20
  180. package/examples/local-observability.ts +0 -105
  181. package/examples/rendering.ts +0 -34
  182. /package/dist/{workbench/workbench-project.d.ts → project/project-manifest.d.ts} +0 -0
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
  <h1 align="center">Tubeless</h1>
7
7
  <p align="center">
8
- Define a typed graph. Plan a target. Run it from Node.
8
+ Typed execution pipelines. Keep your workflow rolling.
9
9
  </p>
10
10
  <p align="center">
11
11
  <a href="https://www.npmjs.com/package/tubeless"><img alt="npm" src="https://img.shields.io/npm/v/tubeless?style=flat-square&labelColor=121212&color=c4a046"></a>
@@ -13,22 +13,32 @@
13
13
  <a href="./LICENSE"><img alt="MIT" src="https://img.shields.io/npm/l/tubeless?style=flat-square&labelColor=121212&color=c4c0b4"></a>
14
14
  </p>
15
15
 
16
- Typed, observable data pipelines you import from TypeScript or run from a Bun
17
- CLI. It is a library, not a hosted workflow engine or a Make/npm-scripts
18
- replacement. Tubeless is pre-1.0; its public API may change.
16
+ Tubeless is a TypeScript toolkit for work that unfolds in steps. It fits data
17
+ pipelines, multi-step application workflows, and AI workloads—anywhere you want
18
+ explicit dependencies, typed handoffs, and inspectable execution.
19
+
20
+ Pipelines run in your process with no runtime dependencies. You can preview
21
+ execution, select a target and its dependencies, compose child pipelines, and
22
+ track progress. An optional CLI and local studio help you run and inspect jobs.
23
+ For scheduling or crash recovery, pair it with a [queue or workflow engine](./docs/comparison.md).
24
+
25
+ ## Installation
19
26
 
20
27
  ```sh
21
28
  npm install tubeless
22
29
  ```
23
30
 
24
- Also `pnpm add tubeless`, `yarn add tubeless`, or `bun add tubeless`. Library
25
- imports are ESM-only on Node.js 22+. The `tubeless` CLI requires Bun 1.3.14+;
26
- `npx tubeless` works anywhere with Bun installed and otherwise prints Bun
27
- install instructions. Linux and macOS are supported; Windows is untested. See
28
- [install and runtime](./docs/getting-started.md#install).
31
+ The library uses ESM and requires Node.js 22 or later. The CLI also requires
32
+ Bun 1.3.14 or later. Linux and macOS are supported; Windows is untested.
33
+ See [installation and runtime support](./docs/getting-started.md#install).
34
+
35
+ Tubeless is pre-1.0, so the public API may change between releases.
29
36
 
30
37
  ## Quick start
31
38
 
39
+ This pipeline loads a list of strings, normalizes them, and returns the result.
40
+ Declaring `load` as a dependency gives `normalize` a typed input.
41
+
32
42
  ```ts
33
43
  import { createSteps, definePipeline, requireOutputs } from "tubeless";
34
44
 
@@ -58,12 +68,15 @@ const rows = await ImportPipeline.runOrThrow({ lines: [" Alpha ", "", "Beta"] })
58
68
  // ["alpha", "beta"]
59
69
  ```
60
70
 
61
- `createSteps` types domain options only. Runs accept built-in controls beside
62
- them. Use `runOrThrow` when failure should throw, `run` for the structured
63
- report, `plan` when nothing should execute, and `toMermaid` for the static
64
- graph.
71
+ `runOrThrow` returns the result or throws if the run fails. Use `run` for a
72
+ report with step statuses, errors, and timings; `plan` to preview execution; or
73
+ `toMermaid` to draw the graph. See the [getting started guide](./docs/getting-started.md).
74
+
75
+ ## Use the CLI
65
76
 
66
- ## Inspect, plan, or run
77
+ Define commands with `tubeless/cli` and catalogs with `tubeless/project`.
78
+ The [CLI guide](./docs/cli.md) explains how to set up the manifest and commands.
79
+ With an `import-rows` command registered, you can run:
67
80
 
68
81
  ```sh
69
82
  bunx tubeless list # reads ./tubeless.project.ts
@@ -71,49 +84,36 @@ bunx tubeless inspect import-rows
71
84
  bunx tubeless run import-rows -- --source input.json
72
85
  ```
73
86
 
74
- The project manifest explicitly registers stable command IDs, module paths, and
75
- execution cwd without scanning the filesystem. The CLI loads TypeScript modules
76
- with Bun; existing file-oriented commands remain available. Application flags
77
- go after `--`. `history` lists recorded
78
- `--store` runs or reads a finished `--trace` artifact without opening the studio. See
79
- [the CLI](./docs/cli.md) and [the local studio](./docs/studio.md).
80
-
81
- ## Choose the right pattern
82
-
83
- | You need to… | Start with |
84
- | -------------------------------------------- | ------------------------------------------------------------------------- |
85
- | Run typed steps in dependency order | [Sequential pipeline](./examples/typed-import.ts) |
86
- | Validate external boundary values | [Validated boundaries](./examples/validated-boundaries.ts) |
87
- | Preview writes safely | [Dry runs and write gates](./examples/publish-with-gates.ts) |
88
- | Skip work intentionally at runtime | [Conditional step](./examples/conditional-step.ts) |
89
- | Continue independent work after a failure | [Best-effort execution](./examples/best-effort.ts) |
90
- | Reuse a pipeline inside another | [Child pipeline](./examples/child-pipeline.ts) |
91
- | Run a step on another engine | [Remote steps](./examples/remote-steps.ts) |
92
- | Run one child pipeline for many items | [Fan-out and progress](./examples/fan-out-progress.ts) |
93
- | Resume long API work safely | [Retry, rate limit, and checkpoint](./examples/resumable-enrichment.ts) |
94
- | Watch the live TTY reporter | [Live TUI](./examples/live-tui.ts) |
95
- | Watch many primitives on a road-race weekend | [Peloton pipeline](./examples/peloton.ts) |
96
- | Turn a pipeline into a typed script | [Pipeline CLI](./examples/cli-job.ts) |
97
- | Render plans and errors consistently | [Human and JSON rendering](./examples/rendering.ts) |
98
- | Test deterministic execution | [Cancellation and test injection](./examples/cancellation-and-testing.ts) |
99
- | Export lifecycle telemetry | [Structured tracing](./examples/tracing.ts) |
100
- | Persist and inspect local runs | [Local observability](./examples/local-observability.ts) |
101
-
102
- Install the [agent skill pack](./docs/agent-skills.md) with `npx skills add chetmancini/tubeless` to convert existing code using `tubeless-make-pipeline`. The [recipe index](./docs/recipes.md) explains each pattern.
103
-
104
- ## Docs
105
-
106
- [Website](https://tubeless.io/) ·
107
- [Getting started](./docs/getting-started.md) · [CLI](./docs/cli.md) ·
87
+ The CLI loads TypeScript modules with Bun. Pass application flags after `--`.
88
+ Record runs with `--store` or save a portable trace with `--trace`, then inspect
89
+ them with `tubeless history` or the [local studio](./docs/studio.md).
90
+
91
+ ## Find your route
92
+
93
+ - Start with a [typed import](./examples/typed-import.ts) or add
94
+ [dry runs and write gates](./examples/publish-with-gates.ts) to a publishing job.
95
+ - Build a larger workflow with [child pipelines](./examples/child-pipeline.ts)
96
+ and [fan-out](./examples/fan-out-progress.ts).
97
+ - Take the [peloton example](./examples/peloton.ts) for a spin: a road-race weekend
98
+ workflow that brings several pipeline features together.
99
+
100
+ The [recipe index](./docs/recipes.md) covers validation, retries, tracing, testing,
101
+ and more. For help authoring pipelines with a coding agent, install the
102
+ [agent skill pack](./docs/agent-skills.md) with `npx skills add chetmancini/tubeless`.
103
+
104
+ ## Documentation
105
+
106
+ [Website](https://tubeless.io/) · [Getting started](./docs/getting-started.md) · [CLI](./docs/cli.md) ·
108
107
  [Studio](./docs/studio.md) · [Concepts](./docs/concepts.md) ·
109
108
  [Comparison](./docs/comparison.md) · [API](./docs/api-reference.md) ·
110
- [Agents](./docs/agent-guide.md) · [Studio OpenAPI](https://tubeless.io/openapi.json)
109
+ [Agents](./docs/agent-guide.md)
111
110
 
112
111
  ## Contributing
113
112
 
114
- Pull requests are accepted for now; the maintainer set stays small. See
115
- [CONTRIBUTING.md](./CONTRIBUTING.md). Report vulnerabilities privately
116
- through [SECURITY.md](./SECURITY.md).
113
+ Bug reports, documentation improvements, and focused pull requests are welcome.
114
+ Open an [issue](https://github.com/chetmancini/tubeless/issues) before starting a
115
+ large change or changing the public API. See [CONTRIBUTING.md](./CONTRIBUTING.md)
116
+ for local setup and checks, and [SECURITY.md](./SECURITY.md) to report a vulnerability privately.
117
117
 
118
118
  ## License
119
119
 
@@ -49,7 +49,7 @@ export interface CliBooleanParam extends CliParamBase {
49
49
  }
50
50
  export interface CliPathParam extends CliParamBase {
51
51
  type: "path";
52
- /** Relative defaults and values are resolved against `context.cwd`, like `definePaths`. */
52
+ /** Relative defaults and values are resolved against `context.cwd`. */
53
53
  default?: string;
54
54
  optional?: boolean;
55
55
  /** Validates the resolved path exists before `run` is called. */
@@ -135,7 +135,7 @@ export type CliParams<TSchema extends CliParamsSchema> = {
135
135
  export interface CliContext {
136
136
  cwd: string;
137
137
  /** Environment used for `param.env` fallbacks. Defaults to `process.env`. */
138
- env?: NodeJS.ProcessEnv;
138
+ env?: Record<string, string | undefined>;
139
139
  log: PipelineLogger;
140
140
  /** Optional executor-only context used when this command runs a pipeline. */
141
141
  pipelineContext?: Omit<PipelineContext, "cwd" | "log" | "signal">;
@@ -1 +1 @@
1
- {"version":3,"file":"cli-types.js","sourceRoot":"","sources":["../../src/cli/cli-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAgLpE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEhC,MAAM;IACN,QAAQ;IAFnB,YACW,MAAyB,EACzB,QAAgB;QAEzB,KAAK,CAAC,oCAAoC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;sBAHrF,MAAM;wBACN,QAAQ;QAGjB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACpB,QAAQ;IAA7B,YAAqB,QAAgB;QACnC,KAAK,CAAC,QAAQ,CAAC,CAAC;wBADG,QAAQ;QAE3B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import type { CheckpointStore } from \"../node/checkpoint.js\";\nimport type { PipelineContext, PipelineLogger } from \"../core/pipeline.js\";\nimport { brandTubelessError } from \"../utilities/tubeless-error.js\";\n\n/**\n * Typed command-line entry points for scripts, mirroring how `definePipeline` turns a\n * declarative step list into a runnable pipeline: declare a flag schema once and get a\n * fully-typed, validated `values` object handed to `run`, instead of each script hand-\n * rolling its own `process.argv` scanning and `as` casts.\n */\n\nexport type CliParamType = \"string\" | \"number\" | \"boolean\" | \"path\";\n\ninterface CliParamBase {\n /** Shown next to the flag in generated `--help` output. */\n description?: string;\n /** UI adapters place execution controls in one section. Built-ins set this. */\n group?: \"execution\";\n /** UI adapters treat exclusive repeatable parameters as mutually exclusive. Built-ins set this on step and target selection. */\n exclusive?: true;\n /** Overrides the derived `--flag-name`; defaults to the kebab-case of the schema key. */\n flag?: string;\n /** Optional one-letter alias, for example `short: \"v\"` enables `-v`. */\n short?: string;\n /**\n * Optional environment-variable fallback. Explicit argv values always win;\n * the environment value is validated like argv but never echoed in errors.\n */\n env?: string;\n}\n\nexport interface CliStringParam extends CliParamBase {\n type: \"string\";\n choices?: readonly string[];\n default?: string;\n optional?: boolean;\n /** Repeatable: `--flag a --flag b` accumulates into `readonly string[]`, `[]` when absent. Cannot combine with `default`. */\n multiple?: boolean;\n}\n\nexport interface CliNumberParam extends CliParamBase {\n type: \"number\";\n default?: number;\n optional?: boolean;\n integer?: boolean;\n min?: number;\n max?: number;\n /** Repeatable: `--flag 1 --flag 2` accumulates into `readonly number[]`, `[]` when absent. Cannot combine with `default`. */\n multiple?: boolean;\n}\n\nexport interface CliBooleanParam extends CliParamBase {\n type: \"boolean\";\n /** Defaults to `false`. A bare `--flag` sets `true`; `--no-flag` sets `false`. */\n default?: boolean;\n}\n\nexport interface CliPathParam extends CliParamBase {\n type: \"path\";\n /** Relative defaults and values are resolved against `context.cwd`, like `definePaths`. */\n default?: string;\n optional?: boolean;\n /** Validates the resolved path exists before `run` is called. */\n mustExist?: boolean;\n /** Only checked when `mustExist` is true; asserts the resolved path's kind. */\n kind?: \"file\" | \"directory\";\n}\n\nexport type CliParam = CliStringParam | CliNumberParam | CliBooleanParam | CliPathParam;\n\nexport type CliParamsSchema = Record<string, CliParam>;\n\n/** JSON-safe description of one validated command parameter for non-terminal clients. */\nexport interface CliParameterDescriptor {\n readonly choices?: readonly string[];\n readonly default?: string | number | boolean;\n readonly description?: string;\n readonly environment?: string;\n readonly exclusive?: true;\n readonly flag: string;\n readonly group?: \"execution\";\n readonly integer?: boolean;\n readonly key: string;\n readonly max?: number;\n readonly min?: number;\n readonly multiple: boolean;\n readonly mustExist?: boolean;\n readonly pathKind?: \"directory\" | \"file\";\n readonly positional: boolean;\n readonly required: boolean;\n readonly short?: string;\n readonly type: CliParamType;\n}\n\n/** Immutable, presentation-neutral command contract shared by CLI and UI adapters. */\nexport interface CliCommandDescriptor {\n readonly description?: string;\n readonly name: string;\n readonly parameters: readonly CliParameterDescriptor[];\n}\n\ntype CliScalarStringValue<P extends CliParam> = P extends {\n choices: readonly (infer TChoice extends string)[];\n}\n ? TChoice\n : string;\n\ntype CliParamValue<P extends CliParam> = P extends { type: \"string\" }\n ? P extends { multiple: true }\n ? readonly CliScalarStringValue<P>[]\n : CliScalarStringValue<P>\n : P extends { type: \"number\" }\n ? P extends { multiple: true }\n ? readonly number[]\n : number\n : P extends { type: \"boolean\" }\n ? boolean\n : P extends { type: \"path\" }\n ? string\n : never;\n\n/**\n * A field is optional in the parsed output only when it's explicitly marked `optional:\n * true` (booleans never are — an absent boolean flag just means `false`). A field with a\n * `default` is also always present at runtime, but that's already covered: schemas\n * shouldn't combine `default` with `optional: true`, and if one does, the parsed type is\n * merely wider than necessary (`T | undefined` instead of `T`), never wrong.\n */\ntype CliParamIsOptional<P extends CliParam> = P extends { type: \"boolean\" }\n ? false\n : P extends { multiple: true }\n ? false\n : P extends { optional: true }\n ? true\n : false;\n\ntype RequiredCliParams<TSchema extends CliParamsSchema> = {\n [K in keyof TSchema as CliParamIsOptional<TSchema[K]> extends true ? never : K]: CliParamValue<\n TSchema[K]\n >;\n};\n\ntype OptionalCliParams<TSchema extends CliParamsSchema> = {\n [K in keyof TSchema as CliParamIsOptional<TSchema[K]> extends true ? K : never]?: CliParamValue<\n TSchema[K]\n >;\n};\n\n/**\n * Every command's parsed values include `dryRun` and `resume`, whether or not `TSchema`\n * declares them. `resume` is `false` unless `--resume` is passed or `checkpoint.defaultResume`\n * is `true`; it's meaningful even without `checkpoint` configured — a command can implement\n * its own \"is this done\" check and just read `values.resume` directly.\n */\nexport type CliParams<TSchema extends CliParamsSchema> = {\n dryRun: boolean;\n resume: boolean;\n} & RequiredCliParams<TSchema> &\n OptionalCliParams<TSchema>;\n\nexport interface CliContext {\n cwd: string;\n /** Environment used for `param.env` fallbacks. Defaults to `process.env`. */\n env?: NodeJS.ProcessEnv;\n log: PipelineLogger;\n /** Optional executor-only context used when this command runs a pipeline. */\n pipelineContext?: Omit<PipelineContext, \"cwd\" | \"log\" | \"signal\">;\n /** Optional caller-owned cancellation signal forwarded to command work. */\n signal?: AbortSignal;\n /** Present whenever the command's `checkpoint` config is set; see `CliCheckpointConfig`. */\n checkpoint?: CheckpointStore;\n}\n\nexport type CliParseResult<TSchema extends CliParamsSchema> =\n | { kind: \"values\"; values: CliParams<TSchema> }\n | { kind: \"help\"; helpText: string }\n | { kind: \"error\"; errors: readonly string[]; helpText: string };\n\nexport class CliValidationError extends Error {\n constructor(\n readonly errors: readonly string[],\n readonly helpText: string\n ) {\n super(`Invalid command-line arguments:\\n${errors.map((error) => ` - ${error}`).join(\"\\n\")}`);\n this.name = \"CliValidationError\";\n brandTubelessError(this, \"cli-validation\");\n }\n}\n\nexport class CliHelpRequested extends Error {\n constructor(readonly helpText: string) {\n super(helpText);\n this.name = \"CliHelpRequested\";\n brandTubelessError(this, \"cli-help\");\n }\n}\n\nexport interface CliCheckpointConfig {\n /** Relative paths resolve against `context.cwd`, like `CliPathParam`. */\n path: string;\n /**\n * Defaults to `true`: a fully successful, non-dry-run `run` clears the checkpoint —\n * the one-shot resumable-job pattern (start fresh next time). Set `false` for an\n * incrementally-growing \"done\" set (e.g. entity enrichment) that must never auto-clear,\n * since clearing it would cause already-processed items to be reprocessed.\n */\n clearOnSuccess?: boolean;\n /**\n * Defaults to `false`: start fresh unless `--resume` is passed. Set `true` to always\n * resume by default (skip already-recorded items every run); `--no-resume` is the free\n * opt-out, since boolean flags already support `--no-<flag>` negation.\n */\n defaultResume?: boolean;\n}\n\nexport interface CliCommandConfig<TSchema extends CliParamsSchema, TResult> {\n /** Shown in generated usage text; defaults to the running script's file name. */\n name?: string;\n description?: string;\n /** `dryRun`/`--dry-run` and `-h`/`--help` are provided automatically; don't redeclare them. */\n params: TSchema;\n /**\n * Schema keys accepted in positional order. Flags for an earlier positional\n * let the next positional fill the next unset field; a repeatable positional\n * must be last.\n */\n positionals?: readonly (keyof TSchema & string)[];\n /**\n * Opts into a managed checkpoint file. Adds a reserved `--resume`/`--no-resume` flag\n * (also don't redeclare a `resume` param) and populates `context.checkpoint` before\n * `run` is called: resolved fresh (existing file cleared) unless resuming, and cleared\n * again after a successful non-dry-run unless `clearOnSuccess` is `false`.\n */\n checkpoint?: CliCheckpointConfig;\n /** Runs after every field passes its own validation; return error messages to reject. */\n validate?(values: CliParams<TSchema>, context: CliContext): string[] | void;\n run(values: CliParams<TSchema>, context: CliContext): TResult | Promise<TResult>;\n}\n\nexport interface CliCommand<TSchema extends CliParamsSchema, TResult> {\n /** Structured schema metadata for adapters that should not parse generated help text. */\n readonly descriptor: CliCommandDescriptor;\n /** Pure: parses and validates without calling `run` or touching the process. */\n parse(argv?: readonly string[], context?: Partial<CliContext>): CliParseResult<TSchema>;\n /** Validates structured parameter values without tokenizing command-line arguments. */\n parseValues(\n values: Record<string, unknown>,\n context?: Partial<CliContext>\n ): CliParseResult<TSchema>;\n /** Calls `run` from already validated parameter values. */\n execute(values: CliParams<TSchema>, context?: Partial<CliContext>): Promise<TResult>;\n /** Parses and calls `run`; throws `CliValidationError`/`CliHelpRequested` instead of running it. */\n run(argv?: readonly string[], context?: Partial<CliContext>): Promise<TResult>;\n /**\n * Entry point for `if (import.meta.main) void command.main();`. Prints help/errors and\n * sets `process.exitCode` — never calls `process.exit`, so buffered output still flushes\n * — instead of throwing.\n */\n main(argv?: readonly string[], context?: Partial<CliContext>): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"cli-types.js","sourceRoot":"","sources":["../../src/cli/cli-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAgLpE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEhC,MAAM;IACN,QAAQ;IAFnB,YACW,MAAyB,EACzB,QAAgB;QAEzB,KAAK,CAAC,oCAAoC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;sBAHrF,MAAM;wBACN,QAAQ;QAGjB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACpB,QAAQ;IAA7B,YAAqB,QAAgB;QACnC,KAAK,CAAC,QAAQ,CAAC,CAAC;wBADG,QAAQ;QAE3B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import type { CheckpointStore } from \"../node/checkpoint.js\";\nimport type { PipelineContext, PipelineLogger } from \"../core/pipeline.js\";\nimport { brandTubelessError } from \"../utilities/tubeless-error.js\";\n\n/**\n * Typed command-line entry points for scripts, mirroring how `definePipeline` turns a\n * declarative step list into a runnable pipeline: declare a flag schema once and get a\n * fully-typed, validated `values` object handed to `run`, instead of each script hand-\n * rolling its own `process.argv` scanning and `as` casts.\n */\n\nexport type CliParamType = \"string\" | \"number\" | \"boolean\" | \"path\";\n\ninterface CliParamBase {\n /** Shown next to the flag in generated `--help` output. */\n description?: string;\n /** UI adapters place execution controls in one section. Built-ins set this. */\n group?: \"execution\";\n /** UI adapters treat exclusive repeatable parameters as mutually exclusive. Built-ins set this on step and target selection. */\n exclusive?: true;\n /** Overrides the derived `--flag-name`; defaults to the kebab-case of the schema key. */\n flag?: string;\n /** Optional one-letter alias, for example `short: \"v\"` enables `-v`. */\n short?: string;\n /**\n * Optional environment-variable fallback. Explicit argv values always win;\n * the environment value is validated like argv but never echoed in errors.\n */\n env?: string;\n}\n\nexport interface CliStringParam extends CliParamBase {\n type: \"string\";\n choices?: readonly string[];\n default?: string;\n optional?: boolean;\n /** Repeatable: `--flag a --flag b` accumulates into `readonly string[]`, `[]` when absent. Cannot combine with `default`. */\n multiple?: boolean;\n}\n\nexport interface CliNumberParam extends CliParamBase {\n type: \"number\";\n default?: number;\n optional?: boolean;\n integer?: boolean;\n min?: number;\n max?: number;\n /** Repeatable: `--flag 1 --flag 2` accumulates into `readonly number[]`, `[]` when absent. Cannot combine with `default`. */\n multiple?: boolean;\n}\n\nexport interface CliBooleanParam extends CliParamBase {\n type: \"boolean\";\n /** Defaults to `false`. A bare `--flag` sets `true`; `--no-flag` sets `false`. */\n default?: boolean;\n}\n\nexport interface CliPathParam extends CliParamBase {\n type: \"path\";\n /** Relative defaults and values are resolved against `context.cwd`. */\n default?: string;\n optional?: boolean;\n /** Validates the resolved path exists before `run` is called. */\n mustExist?: boolean;\n /** Only checked when `mustExist` is true; asserts the resolved path's kind. */\n kind?: \"file\" | \"directory\";\n}\n\nexport type CliParam = CliStringParam | CliNumberParam | CliBooleanParam | CliPathParam;\n\nexport type CliParamsSchema = Record<string, CliParam>;\n\n/** JSON-safe description of one validated command parameter for non-terminal clients. */\nexport interface CliParameterDescriptor {\n readonly choices?: readonly string[];\n readonly default?: string | number | boolean;\n readonly description?: string;\n readonly environment?: string;\n readonly exclusive?: true;\n readonly flag: string;\n readonly group?: \"execution\";\n readonly integer?: boolean;\n readonly key: string;\n readonly max?: number;\n readonly min?: number;\n readonly multiple: boolean;\n readonly mustExist?: boolean;\n readonly pathKind?: \"directory\" | \"file\";\n readonly positional: boolean;\n readonly required: boolean;\n readonly short?: string;\n readonly type: CliParamType;\n}\n\n/** Immutable, presentation-neutral command contract shared by CLI and UI adapters. */\nexport interface CliCommandDescriptor {\n readonly description?: string;\n readonly name: string;\n readonly parameters: readonly CliParameterDescriptor[];\n}\n\ntype CliScalarStringValue<P extends CliParam> = P extends {\n choices: readonly (infer TChoice extends string)[];\n}\n ? TChoice\n : string;\n\ntype CliParamValue<P extends CliParam> = P extends { type: \"string\" }\n ? P extends { multiple: true }\n ? readonly CliScalarStringValue<P>[]\n : CliScalarStringValue<P>\n : P extends { type: \"number\" }\n ? P extends { multiple: true }\n ? readonly number[]\n : number\n : P extends { type: \"boolean\" }\n ? boolean\n : P extends { type: \"path\" }\n ? string\n : never;\n\n/**\n * A field is optional in the parsed output only when it's explicitly marked `optional:\n * true` (booleans never are — an absent boolean flag just means `false`). A field with a\n * `default` is also always present at runtime, but that's already covered: schemas\n * shouldn't combine `default` with `optional: true`, and if one does, the parsed type is\n * merely wider than necessary (`T | undefined` instead of `T`), never wrong.\n */\ntype CliParamIsOptional<P extends CliParam> = P extends { type: \"boolean\" }\n ? false\n : P extends { multiple: true }\n ? false\n : P extends { optional: true }\n ? true\n : false;\n\ntype RequiredCliParams<TSchema extends CliParamsSchema> = {\n [K in keyof TSchema as CliParamIsOptional<TSchema[K]> extends true ? never : K]: CliParamValue<\n TSchema[K]\n >;\n};\n\ntype OptionalCliParams<TSchema extends CliParamsSchema> = {\n [K in keyof TSchema as CliParamIsOptional<TSchema[K]> extends true ? K : never]?: CliParamValue<\n TSchema[K]\n >;\n};\n\n/**\n * Every command's parsed values include `dryRun` and `resume`, whether or not `TSchema`\n * declares them. `resume` is `false` unless `--resume` is passed or `checkpoint.defaultResume`\n * is `true`; it's meaningful even without `checkpoint` configured — a command can implement\n * its own \"is this done\" check and just read `values.resume` directly.\n */\nexport type CliParams<TSchema extends CliParamsSchema> = {\n dryRun: boolean;\n resume: boolean;\n} & RequiredCliParams<TSchema> &\n OptionalCliParams<TSchema>;\n\nexport interface CliContext {\n cwd: string;\n /** Environment used for `param.env` fallbacks. Defaults to `process.env`. */\n env?: Record<string, string | undefined>;\n log: PipelineLogger;\n /** Optional executor-only context used when this command runs a pipeline. */\n pipelineContext?: Omit<PipelineContext, \"cwd\" | \"log\" | \"signal\">;\n /** Optional caller-owned cancellation signal forwarded to command work. */\n signal?: AbortSignal;\n /** Present whenever the command's `checkpoint` config is set; see `CliCheckpointConfig`. */\n checkpoint?: CheckpointStore;\n}\n\nexport type CliParseResult<TSchema extends CliParamsSchema> =\n | { kind: \"values\"; values: CliParams<TSchema> }\n | { kind: \"help\"; helpText: string }\n | { kind: \"error\"; errors: readonly string[]; helpText: string };\n\nexport class CliValidationError extends Error {\n constructor(\n readonly errors: readonly string[],\n readonly helpText: string\n ) {\n super(`Invalid command-line arguments:\\n${errors.map((error) => ` - ${error}`).join(\"\\n\")}`);\n this.name = \"CliValidationError\";\n brandTubelessError(this, \"cli-validation\");\n }\n}\n\nexport class CliHelpRequested extends Error {\n constructor(readonly helpText: string) {\n super(helpText);\n this.name = \"CliHelpRequested\";\n brandTubelessError(this, \"cli-help\");\n }\n}\n\nexport interface CliCheckpointConfig {\n /** Relative paths resolve against `context.cwd`, like `CliPathParam`. */\n path: string;\n /**\n * Defaults to `true`: a fully successful, non-dry-run `run` clears the checkpoint —\n * the one-shot resumable-job pattern (start fresh next time). Set `false` for an\n * incrementally-growing \"done\" set (e.g. entity enrichment) that must never auto-clear,\n * since clearing it would cause already-processed items to be reprocessed.\n */\n clearOnSuccess?: boolean;\n /**\n * Defaults to `false`: start fresh unless `--resume` is passed. Set `true` to always\n * resume by default (skip already-recorded items every run); `--no-resume` is the free\n * opt-out, since boolean flags already support `--no-<flag>` negation.\n */\n defaultResume?: boolean;\n}\n\nexport interface CliCommandConfig<TSchema extends CliParamsSchema, TResult> {\n /** Shown in generated usage text; defaults to the running script's file name. */\n name?: string;\n description?: string;\n /** `dryRun`/`--dry-run` and `-h`/`--help` are provided automatically; don't redeclare them. */\n params: TSchema;\n /**\n * Schema keys accepted in positional order. Flags for an earlier positional\n * let the next positional fill the next unset field; a repeatable positional\n * must be last.\n */\n positionals?: readonly (keyof TSchema & string)[];\n /**\n * Opts into a managed checkpoint file. Adds a reserved `--resume`/`--no-resume` flag\n * (also don't redeclare a `resume` param) and populates `context.checkpoint` before\n * `run` is called: resolved fresh (existing file cleared) unless resuming, and cleared\n * again after a successful non-dry-run unless `clearOnSuccess` is `false`.\n */\n checkpoint?: CliCheckpointConfig;\n /** Runs after every field passes its own validation; return error messages to reject. */\n validate?(values: CliParams<TSchema>, context: CliContext): string[] | void;\n run(values: CliParams<TSchema>, context: CliContext): TResult | Promise<TResult>;\n}\n\nexport interface CliCommand<TSchema extends CliParamsSchema, TResult> {\n /** Structured schema metadata for adapters that should not parse generated help text. */\n readonly descriptor: CliCommandDescriptor;\n /** Pure: parses and validates without calling `run` or touching the process. */\n parse(argv?: readonly string[], context?: Partial<CliContext>): CliParseResult<TSchema>;\n /** Validates structured parameter values without tokenizing command-line arguments. */\n parseValues(\n values: Record<string, unknown>,\n context?: Partial<CliContext>\n ): CliParseResult<TSchema>;\n /** Calls `run` from already validated parameter values. */\n execute(values: CliParams<TSchema>, context?: Partial<CliContext>): Promise<TResult>;\n /** Parses and calls `run`; throws `CliValidationError`/`CliHelpRequested` instead of running it. */\n run(argv?: readonly string[], context?: Partial<CliContext>): Promise<TResult>;\n /**\n * Entry point for `if (import.meta.main) void command.main();`. Prints help/errors and\n * sets `process.exitCode` — never calls `process.exit`, so buffered output still flushes\n * — instead of throwing.\n */\n main(argv?: readonly string[], context?: Partial<CliContext>): Promise<void>;\n}\n"]}
package/dist/cli/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CliHelpRequested, CliValidationError, type CliBooleanParam, type CliCheckpointConfig, type CliCommand, type CliCommandConfig, type CliCommandDescriptor, type CliContext, type CliNumberParam, type CliParam, type CliParameterDescriptor, type CliParams, type CliParamsSchema, type CliParamType, type CliParseResult, type CliPathParam, type CliStringParam, } from "./cli-types.js";
2
2
  export { defineCommand } from "./cli-command.js";
3
- export { definePipelineCommand, type DefinePipelineCommandConfig, type PipelineCliBuiltins, type PipelineCliParseResult, type PipelineCliValues, type PipelineCommand, type PipelineCommandHookConfig, type PipelineCommandHookContext, type PipelineCommandHookSets, } from "./cli-pipeline-command.js";
4
- export { normalizeMultiSelectChoices, parseMultiSelectInput, promptMultiSelect, type MultiSelectChoice, type MultiSelectResult, type ParseMultiSelectInputOptions, type PromptMultiSelectOptions, } from "../reporter/prompt-select.js";
5
- export { TUBELESS_WORKBENCH_EXIT_CODE } from "./cli-exit.js";
3
+ export { definePipelineCommand, type DefinePipelineCommandConfig, type PipelineCliParseResult, type PipelineCliValues, type PipelineCommand, type PipelineCommandHookConfig, type PipelineCommandHookContext, type PipelineCommandHookSets, } from "./cli-pipeline-command.js";
4
+ export type { PipelineReporterConfig, PipelineReporterMode, ReporterOutput, } from "../reporter/interactive-reporter.js";
5
+ export type { ReporterColorMode, ReporterSymbolMode, ReporterTerminalCapabilities, RunReporterConfig, } from "../reporter/reporter.js";
package/dist/cli/cli.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export { CliHelpRequested, CliValidationError, } from "./cli-types.js";
2
2
  export { defineCommand } from "./cli-command.js";
3
3
  export { definePipelineCommand, } from "./cli-pipeline-command.js";
4
- export { normalizeMultiSelectChoices, parseMultiSelectInput, promptMultiSelect, } from "../reporter/prompt-select.js";
5
- export { TUBELESS_WORKBENCH_EXIT_CODE } from "./cli-exit.js";
6
4
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GAgBnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,qBAAqB,GAStB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,iBAAiB,GAKlB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export {\n CliHelpRequested,\n CliValidationError,\n type CliBooleanParam,\n type CliCheckpointConfig,\n type CliCommand,\n type CliCommandConfig,\n type CliCommandDescriptor,\n type CliContext,\n type CliNumberParam,\n type CliParam,\n type CliParameterDescriptor,\n type CliParams,\n type CliParamsSchema,\n type CliParamType,\n type CliParseResult,\n type CliPathParam,\n type CliStringParam,\n} from \"./cli-types.js\";\nexport { defineCommand } from \"./cli-command.js\";\nexport {\n definePipelineCommand,\n type DefinePipelineCommandConfig,\n type PipelineCliBuiltins,\n type PipelineCliParseResult,\n type PipelineCliValues,\n type PipelineCommand,\n type PipelineCommandHookConfig,\n type PipelineCommandHookContext,\n type PipelineCommandHookSets,\n} from \"./cli-pipeline-command.js\";\nexport {\n normalizeMultiSelectChoices,\n parseMultiSelectInput,\n promptMultiSelect,\n type MultiSelectChoice,\n type MultiSelectResult,\n type ParseMultiSelectInputOptions,\n type PromptMultiSelectOptions,\n} from \"../reporter/prompt-select.js\";\nexport { TUBELESS_WORKBENCH_EXIT_CODE } from \"./cli-exit.js\";\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GAgBnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,qBAAqB,GAQtB,MAAM,2BAA2B,CAAC","sourcesContent":["export {\n CliHelpRequested,\n CliValidationError,\n type CliBooleanParam,\n type CliCheckpointConfig,\n type CliCommand,\n type CliCommandConfig,\n type CliCommandDescriptor,\n type CliContext,\n type CliNumberParam,\n type CliParam,\n type CliParameterDescriptor,\n type CliParams,\n type CliParamsSchema,\n type CliParamType,\n type CliParseResult,\n type CliPathParam,\n type CliStringParam,\n} from \"./cli-types.js\";\nexport { defineCommand } from \"./cli-command.js\";\nexport {\n definePipelineCommand,\n type DefinePipelineCommandConfig,\n type PipelineCliParseResult,\n type PipelineCliValues,\n type PipelineCommand,\n type PipelineCommandHookConfig,\n type PipelineCommandHookContext,\n type PipelineCommandHookSets,\n} from \"./cli-pipeline-command.js\";\nexport type {\n PipelineReporterConfig,\n PipelineReporterMode,\n ReporterOutput,\n} from \"../reporter/interactive-reporter.js\";\nexport type {\n ReporterColorMode,\n ReporterSymbolMode,\n ReporterTerminalCapabilities,\n RunReporterConfig,\n} from \"../reporter/reporter.js\";\n"]}
@@ -4,7 +4,7 @@ import { runConcurrentSettled } from "../utilities/batch.js";
4
4
  import { toMappedChildStepProgress, } from "./mapped-child-progress.js";
5
5
  import { createRunId, RUN_MODEL_VERSION } from "./pipeline-ids.js";
6
6
  import { duplicateValues } from "../utilities/collections.js";
7
- import { EXECUTE_COMPILED_RUN, isCompiledPipeline } from "./pipeline-plan.js";
7
+ import { EXECUTE_COMPILED_RUN, isCompiledPipeline } from "./pipeline-identity.js";
8
8
  import { createChildProgress } from "./child-progress.js";
9
9
  import { hasVisibleStepProgress } from "./progress.js";
10
10
  export class PipelineChildError extends Error {
@@ -46,8 +46,6 @@ function publicChildRuntime(context) {
46
46
  runtime.hooks = context.hooks;
47
47
  if (context.parentRunId)
48
48
  runtime.parentRunId = context.parentRunId;
49
- if (context.runId)
50
- runtime.runId = context.runId;
51
49
  if (context.signal)
52
50
  runtime.signal = context.signal;
53
51
  if (context.tracing)
@@ -69,7 +67,7 @@ async function failedPublicChildPlanRun(pipeline, plan, controls, context) {
69
67
  steps: [],
70
68
  version: RUN_MODEL_VERSION,
71
69
  };
72
- const correlationId = context.correlationId ?? context.runId;
70
+ const correlationId = context.correlationId;
73
71
  if (correlationId !== undefined)
74
72
  result.correlationId = correlationId;
75
73
  if (context.parentRunId)
@@ -1 +1 @@
1
- {"version":3,"file":"child-execution.js","sourceRoot":"","sources":["../../src/core/child-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,yBAAyB,GAG1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE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AC,EAAE,eAAe,QAAQ,CAAC,MAAM,aAAa,OAAO,EAAE;gBACjG,CAAC,CAAC,yBAAyB,MAAM,CAAC,QAAQ,CAAC,EAAE,YAAY,YAAY,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC;YAClG,MAAM,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE;gBAC7D,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;oBAC9D,KAAK;oBACL,GAAG;oBACH,KAAK;oBACL,SAAS,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;iBACvD,CAAC,CAAC;gBACH,YAAY,EAAE,QAAQ,CAAC,MAAM;gBAC7B,cAAc,EAAE,gBAAgB;aACjC,CAAC,CAAC;QACL,CAAC;QACD,uEAAuE;QACvE,uEAAuE;QACvE,2EAA2E;QAC3E,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAE,OAA0C,CAAC,KAAK,CAAC,CAAC;IACtF,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { throwIfAborted } from \"../utilities/abort.js\";\nimport { emitRejectedPlanLifecycle } from \"./lifecycle.js\";\nimport { runConcurrentSettled } from \"../utilities/batch.js\";\nimport {\n toMappedChildStepProgress,\n type MappedChildProgressSnapshot,\n type ToMappedChildStepProgressOptions,\n} from \"./mapped-child-progress.js\";\nimport { createRunId, RUN_MODEL_VERSION } from \"./pipeline-ids.js\";\nimport { duplicateValues } from \"../utilities/collections.js\";\nimport { EXECUTE_COMPILED_RUN, isCompiledPipeline } from \"./pipeline-plan.js\";\nimport { createChildProgress } from \"./child-progress.js\";\nimport { hasVisibleStepProgress } from \"./progress.js\";\nimport type {\n Pipeline,\n PipelineContext,\n PipelineExecutionContext,\n PipelineHooks,\n PipelinePlan,\n PipelinePlanStep,\n PipelineRun,\n PipelineRunControls,\n PipelineRunOptions,\n PipelineRuntime,\n PipelineStepContext,\n PipelineStepProgressDetail,\n} from \"./pipeline-types.js\";\nimport type { PipelineTracingOptions } from \"../tracing/tracing.js\";\n\nexport class PipelineChildError extends Error {\n constructor(\n message: string,\n readonly cancelled = false,\n cause?: unknown,\n readonly fanOut?: {\n failures: readonly { error: Error; key: string; index: number; cancelled: boolean }[];\n failureCount: number;\n schedulerError?: Error;\n }\n ) {\n super(message, cause === undefined ? undefined : { cause });\n this.name = \"PipelineChildError\";\n }\n}\n\nconst LIVE_FAN_OUT_GROUP_LIMIT = 32;\n\ntype ChildPipeline = Pipeline<object, unknown, string, string>;\n\ntype CompiledChildExecute = (\n plan: PipelinePlan,\n options: PipelineRunOptions,\n controls: PipelineRunControls,\n context?: Partial<PipelineContext>\n) => Promise<PipelineRun<unknown>>;\n\ntype ExecutableChild = ChildPipeline & {\n [EXECUTE_COMPILED_RUN]?: CompiledChildExecute;\n};\n\nfunction compiledChildExecute(pipeline: ChildPipeline): CompiledChildExecute | undefined {\n if (!isCompiledPipeline(pipeline)) return undefined;\n // SAFETY: branded pipelines are the `definePipeline` object, which always\n // stamps `EXECUTE_COMPILED_RUN`. Wrappers that inherit the symbol are rejected\n // by the identity check above.\n return (pipeline as ExecutableChild)[EXECUTE_COMPILED_RUN];\n}\n\nfunction executeCompiledChild(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const execute = compiledChildExecute(pipeline);\n if (execute === undefined) {\n return pipeline.run(domainOptions, controls, context);\n }\n return execute(plan, domainOptions, controls, context);\n}\n\nfunction publicChildRuntime(context: PipelineContext): PipelineRuntime {\n const runtime: PipelineRuntime = {\n cwd: context.cwd,\n log: context.log,\n now: context.now ?? Date.now,\n sleep: context.sleep ?? (async () => undefined),\n };\n if (context.correlationId !== undefined) runtime.correlationId = context.correlationId;\n if (context.hooks) runtime.hooks = context.hooks;\n if (context.parentRunId) runtime.parentRunId = context.parentRunId;\n if (context.runId) runtime.runId = context.runId;\n if (context.signal) runtime.signal = context.signal;\n if (context.tracing) runtime.tracing = context.tracing;\n return runtime;\n}\n\nasync function failedPublicChildPlanRun(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const runtime = publicChildRuntime(context);\n const startedAtMs = runtime.now();\n const result: PipelineRun<unknown> = {\n pipelineId: pipeline.id,\n dryRun: controls.dryRun === true,\n errors: [...plan.errors],\n finalized: false,\n finishedAtMs: runtime.now(),\n runId: createRunId(pipeline.id),\n startedAtMs,\n status: \"failed\",\n steps: [],\n version: RUN_MODEL_VERSION,\n };\n const correlationId = context.correlationId ?? context.runId;\n if (correlationId !== undefined) result.correlationId = correlationId;\n if (context.parentRunId) result.parentRunId = context.parentRunId;\n await emitRejectedPlanLifecycle(pipeline.id, pipeline.targetIds, plan, runtime, result);\n return result;\n}\n\nasync function rejectedChildPlanResult(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const execute = compiledChildExecute(pipeline);\n if (execute === undefined) {\n return failedPublicChildPlanRun(pipeline, plan, controls, context);\n }\n return execute(plan, domainOptions, controls, context);\n}\n\ntype ChildInputs = Record<string, unknown>;\n\ninterface ChildExecutionDependencies<TParentOptions extends object> {\n createExecutionError(result: PipelineRun<unknown>, message: string): Error;\n isCancellation(cause: unknown, context: PipelineExecutionContext<TParentOptions>): boolean;\n}\n\nexport interface SingleChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n mapOptions(\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): PipelineRunOptions;\n mapResult?(\n value: unknown,\n result: PipelineRun<unknown>,\n context: PipelineStepContext<TParentOptions>\n ): unknown;\n}\n\nexport interface MappedChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n items(\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): readonly unknown[] | Promise<readonly unknown[]>;\n key(item: unknown, index: number): string;\n concurrency?:\n | number\n | ((inputs: ChildInputs, context: PipelineExecutionContext<TParentOptions>) => number);\n progress?: ToMappedChildStepProgressOptions;\n mapOptions(\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): PipelineRunOptions;\n mapResult?(\n value: unknown,\n result: PipelineRun<unknown>,\n item: unknown,\n index: number,\n context: PipelineStepContext<TParentOptions>\n ): unknown;\n}\n\nfunction childTracingOptions(\n context: PipelineExecutionContext<object>,\n itemKey = context.trace?.itemKey\n): PipelineTracingOptions | undefined {\n return context.tracing ? { ...context.tracing, itemKey } : undefined;\n}\n\nconst CHILD_RUN_CONTROL_KEYS = [\"continueOnError\", \"dryRun\", \"stepIds\", \"targets\"] as const;\n\nfunction isChildRunControlKey(\n property: PropertyKey\n): property is (typeof CHILD_RUN_CONTROL_KEYS)[number] {\n return (\n typeof property === \"string\" &&\n // SAFETY: `includes` membership over the literal tuple guarantees the cast\n // target is exactly one of the declared run-control keys.\n CHILD_RUN_CONTROL_KEYS.includes(property as (typeof CHILD_RUN_CONTROL_KEYS)[number])\n );\n}\n\ninterface ChildRunBags {\n controls: PipelineRunControls;\n domainOptions: PipelineRunOptions;\n}\n\nfunction splitChildRunOptions(options: PipelineRunOptions): ChildRunBags {\n const controls: PipelineRunControls = {};\n let hasControls = false;\n for (const key of CHILD_RUN_CONTROL_KEYS) {\n if (!Object.prototype.hasOwnProperty.call(options, key)) continue;\n hasControls = true;\n Object.assign(controls, { [key]: options[key] });\n }\n if (!hasControls) {\n return { controls, domainOptions: options };\n }\n return { controls, domainOptions: createChildDomainOptionsView(options) };\n}\n\nfunction createChildDomainOptionsView(options: PipelineRunOptions): PipelineRunOptions {\n // SAFETY: proxy an empty facade so hiding non-configurable control keys on a\n // frozen mapOptions bag does not violate proxy invariants. Reads still use\n // `options` as the receiver so accessors and methods keep their original `this`.\n return new Proxy({} as PipelineRunOptions, {\n get(_target, property) {\n if (isChildRunControlKey(property)) return undefined;\n const value = readChildOptionProperty(options, property);\n return value instanceof Function ? value.bind(options) : value;\n },\n has(_target, property) {\n return !isChildRunControlKey(property) && property in options;\n },\n ownKeys() {\n return Reflect.ownKeys(options).filter((property) => !isChildRunControlKey(property));\n },\n getOwnPropertyDescriptor(_target, property) {\n if (isChildRunControlKey(property)) return undefined;\n const descriptor = Reflect.getOwnPropertyDescriptor(options, property);\n if (descriptor === undefined) return undefined;\n return { ...descriptor, configurable: true };\n },\n getPrototypeOf() {\n return Object.getPrototypeOf(options);\n },\n set(_target, property, value) {\n if (isChildRunControlKey(property)) return true;\n return Reflect.set(options, property, value, options);\n },\n });\n}\n\nfunction readChildOptionProperty(options: PipelineRunOptions, property: PropertyKey): unknown {\n // SAFETY: child mapOptions is an untyped bag; this index reads the requested\n // key on that original object so accessors keep it as `this`.\n return options[property as keyof PipelineRunOptions];\n}\n\nfunction childRunBags(options: PipelineRunOptions, dryRun: boolean): ChildRunBags {\n const { controls, domainOptions } = splitChildRunOptions(options);\n return { controls: { ...controls, dryRun }, domainOptions };\n}\n\nfunction isConcurrencyFunction<TOptions extends object>(\n concurrency:\n | number\n | ((inputs: ChildInputs, context: PipelineExecutionContext<TOptions>) => number)\n | undefined\n): concurrency is (inputs: ChildInputs, context: PipelineExecutionContext<TOptions>) => number {\n return typeof concurrency === \"function\";\n}\n\nfunction firstChildFailure(result: PipelineRun<unknown>) {\n const firstFailedStep = result.steps.find(\n ({ status }) => status === \"failed\" || status === \"cancelled\"\n );\n const firstError =\n firstFailedStep && \"error\" in firstFailedStep ? firstFailedStep.error : result.errors[0];\n return {\n failureLocation: firstFailedStep?.id ?? firstError?.stepId ?? \"unknown step\",\n message: firstError?.message ?? \"unknown error\",\n };\n}\n\nasync function runChildPipeline(\n pipeline: ChildPipeline,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext,\n hooks: PipelineHooks,\n dependencies: ChildExecutionDependencies<object>,\n messagePrefix = \"\",\n plan: PipelinePlan\n): Promise<PipelineRun<unknown>> {\n if (!plan.ok) {\n const firstError = plan.errors[0];\n const result = await rejectedChildPlanResult(pipeline, plan, domainOptions, controls, {\n ...context,\n hooks,\n });\n throw dependencies.createExecutionError(\n result,\n `${messagePrefix}could not start: ${firstError?.message ?? \"invalid plan\"}`\n );\n }\n\n const result = await executeCompiledChild(pipeline, plan, domainOptions, controls, {\n ...context,\n hooks,\n });\n if (result.status !== \"completed\") {\n const { failureLocation, message } = firstChildFailure(result);\n throw dependencies.createExecutionError(\n result,\n `${messagePrefix}failed at ${failureLocation}: ${message}`\n );\n }\n return result;\n}\n\nfunction hasProgressObserver(context: PipelineContext): boolean {\n const hooks = Array.isArray(context.hooks) ? context.hooks : [context.hooks];\n return (\n Boolean(context.tracing) || hooks.some((hook) => hook?.onStepProgress || hook?.onStepStatus)\n );\n}\n\nexport function createSingleChildRunner<TParentOptions extends object>(\n config: SingleChildExecutionConfig<TParentOptions>,\n dependencies: ChildExecutionDependencies<TParentOptions>\n): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown> {\n return async (inputs, context) => {\n const { controls, domainOptions } = childRunBags(\n config.mapOptions(inputs, context),\n context.dryRun\n );\n const baseChildContext: PipelineContext = {\n correlationId: context.correlationId,\n cwd: context.cwd,\n log: context.log,\n now: context.now,\n parentRunId: context.runId,\n signal: context.signal,\n sleep: context.sleep,\n tracing: childTracingOptions(context),\n };\n // Plan once for progress totals and execution. Invalid plans fail before child.run.\n const childPlan = config.pipeline.plan(controls);\n const selectedStepCount = childPlan.ok\n ? childPlan.steps.filter((step) => step.selected).length\n : 0;\n const childProgress = hasProgressObserver(context) ? createChildProgress(childPlan) : undefined;\n const terminalSteps = new Set<string>();\n const report = (step: PipelinePlanStep, message: string, terminal = false): void => {\n if (!childProgress) return;\n if (terminal) terminalSteps.add(step.id);\n context.reportProgress({\n details: childProgress.details(),\n completed: terminalSteps.size,\n total: Math.max(1, selectedStepCount),\n message: `${config.pipeline.id}/${step.name ?? step.id}: ${message}`,\n });\n };\n const childHooks: PipelineHooks = {\n onStepStatus: childProgress?.update,\n onStepStart: ({ step }) => report(step, \"started\"),\n onStepProgress: ({ progress, step }) => {\n if (!hasVisibleStepProgress(progress)) return;\n report(step, progress.message ?? `${progress.completed} completed`);\n },\n onStepComplete: ({ step }) => report(step, \"complete\", true),\n onStepSkip: ({ reason, step }) => report(step, `skipped: ${reason}`, reason !== \"filtered\"),\n onStepCancel: ({ error, step }) => report(step, `cancelled: ${error.message}`, true),\n onStepFail: ({ error, step }) => report(step, `failed: ${error.message}`, true),\n };\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n baseChildContext,\n childProgress ? childHooks : {},\n dependencies,\n `Child pipeline ${config.pipeline.id} `,\n childPlan\n );\n\n return config.mapResult\n ? config.mapResult(childResult.value, childResult, context)\n : childResult.value;\n };\n}\n\nexport function createMappedChildRunner<TParentOptions extends object>(\n config: MappedChildExecutionConfig<TParentOptions>,\n dependencies: ChildExecutionDependencies<TParentOptions>\n): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown[]> {\n return async (inputs, context) => {\n const items = [...(await config.items(inputs, context))];\n const keys = items.map((item, index) => config.key(item, index));\n const duplicateKeys = duplicateValues(keys);\n if (duplicateKeys.length > 0) {\n throw new PipelineChildError(\n `Mapped child pipeline ${config.pipeline.id} received duplicate item keys: ${duplicateKeys.join(\", \")}`\n );\n }\n const concurrency = Math.max(\n 1,\n isConcurrencyFunction(config.concurrency)\n ? config.concurrency(inputs, context)\n : (config.concurrency ?? 1)\n );\n type Outcome =\n | { key: string; ok: true; value: unknown }\n | { error: Error; key: string; index: number; ok: false };\n\n const active = new Map<string, string>();\n const failedKeys = new Set<string>();\n const itemIndexes = new Map(keys.map((key, index) => [key, index]));\n const observesProgress = hasProgressObserver(context);\n const itemRows = new Map<string, PipelineStepProgressDetail>(\n keys.map((id) => [id, { id, status: \"pending\" }])\n );\n const itemProgress = new Map<string, ReturnType<typeof createChildProgress>>();\n const childTerminalSteps = new Map<string, Set<string>>();\n let finishedItems = 0;\n let failedItems = 0;\n let stepsPerItem = 0;\n let plannedChildSteps = 0;\n let plannedItems = 0;\n let terminalChildSteps = 0;\n\n const publishProgress = (spotlight?: string, final = false): void => {\n if (!observesProgress) return;\n const snapshot: MappedChildProgressSnapshot = {\n active,\n concurrency,\n failedItems,\n finishedItems,\n itemCount: items.length,\n plannedChildSteps,\n plannedItems,\n stepsPerItem,\n terminalChildSteps,\n spotlight,\n };\n // Materialize a bounded live window; expand the default final snapshot once.\n // Active and failed sets avoid scanning or sorting the full fan-out per event.\n const limit =\n Math.max(0, Math.floor(config.progress?.detailLimit ?? LIVE_FAN_OUT_GROUP_LIMIT)) || 0;\n let visibleKeys: readonly string[];\n if (final && config.progress?.detailLimit === undefined) {\n visibleKeys = keys;\n } else {\n const visible = new Set<string>();\n for (const candidates of [active.keys(), failedKeys.keys(), keys.values()]) {\n for (const key of candidates) {\n if (visible.size >= limit) break;\n visible.add(key);\n }\n }\n visibleKeys = [...visible].sort(\n (left, right) => itemIndexes.get(left)! - itemIndexes.get(right)!\n );\n }\n const details = visibleKeys.flatMap((key) => [\n { ...itemRows.get(key)! },\n ...(itemProgress.get(key)?.details() ?? []).map((detail) => ({\n ...detail,\n depth: (detail.depth ?? 0) + 1,\n })),\n ]);\n if (visibleKeys.length < keys.length) {\n details.push({ id: `+${keys.length - visibleKeys.length} more`, status: \"pending\" });\n }\n context.reportProgress({ ...toMappedChildStepProgress(snapshot, config.progress), details });\n };\n const markChildTerminal = (itemKey: string, stepId: string, label: string): void => {\n let seen = childTerminalSteps.get(itemKey);\n if (!seen) {\n seen = new Set();\n childTerminalSteps.set(itemKey, seen);\n }\n if (!seen.has(stepId)) {\n seen.add(stepId);\n terminalChildSteps += 1;\n }\n active.set(itemKey, label);\n publishProgress();\n };\n\n if (items.length === 0) {\n publishProgress();\n return [];\n }\n publishProgress();\n\n const settled = await runConcurrentSettled(\n items,\n { concurrency, signal: context.signal },\n async (item, itemIndex): Promise<Outcome> => {\n const key = keys[itemIndex]!;\n active.set(key, \"starting\");\n itemRows.set(key, { id: key, status: \"running\" });\n publishProgress();\n try {\n throwIfAborted(context.signal, `Mapped child pipeline ${config.pipeline.id}`);\n const { controls, domainOptions } = childRunBags(\n config.mapOptions(item, itemIndex, inputs, context),\n context.dryRun\n );\n // Plan once per mapped-options bag for progress and execution.\n const childPlan = config.pipeline.plan(controls);\n if (childPlan.ok) {\n const plannedSteps = childPlan.steps.filter((step) => step.selected).length;\n plannedChildSteps += plannedSteps;\n plannedItems += 1;\n if (plannedSteps > stepsPerItem) stepsPerItem = plannedSteps;\n }\n\n const childProgress = observesProgress ? createChildProgress(childPlan) : undefined;\n if (childProgress) itemProgress.set(key, childProgress);\n const childHooks: PipelineHooks = {\n onStepStatus: childProgress?.update,\n onStepStart: ({ step }) => {\n active.set(key, step.name ?? step.id);\n publishProgress();\n },\n onStepProgress: ({ progress, step }) => {\n if (!hasVisibleStepProgress(progress)) return;\n const detail =\n progress.message ??\n (progress.total !== undefined\n ? `${progress.completed}/${progress.total}`\n : `${progress.completed}`);\n active.set(key, `${step.name ?? step.id}:${detail}`);\n publishProgress();\n },\n onStepComplete: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:complete`),\n onStepSkip: ({ reason, step }) => {\n if (reason === \"filtered\") return;\n markChildTerminal(key, step.id, `${step.name ?? step.id}:skipped:${reason}`);\n },\n onStepCancel: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:cancelled`),\n onStepFail: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:failed`),\n };\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n {\n correlationId: context.correlationId,\n cwd: context.cwd,\n log: context.log,\n now: context.now,\n parentRunId: context.runId,\n signal: context.signal,\n sleep: context.sleep,\n tracing: childTracingOptions(context, key),\n },\n observesProgress ? childHooks : {},\n dependencies,\n \"\",\n childPlan\n );\n\n const seen = childTerminalSteps.get(key) ?? new Set<string>();\n if (childPlan.ok) {\n for (const planStep of childPlan.steps) {\n if (!planStep.selected || seen.has(planStep.id)) continue;\n seen.add(planStep.id);\n terminalChildSteps += 1;\n }\n }\n childTerminalSteps.set(key, seen);\n\n const value = config.mapResult\n ? config.mapResult(childResult.value, childResult, item, itemIndex, context)\n : childResult.value;\n active.delete(key);\n itemRows.set(key, { id: key, status: \"completed\" });\n finishedItems += 1;\n publishProgress(`${key}: completed`);\n return { key, ok: true, value };\n } catch (error) {\n const cause = error instanceof Error ? error : new Error(String(error));\n active.delete(key);\n itemRows.set(key, {\n id: key,\n status: dependencies.isCancellation(cause, context) ? \"cancelled\" : \"failed\",\n label: cause.message,\n });\n failedKeys.add(key);\n failedItems += 1;\n publishProgress(`${key}: failed`);\n return { error: cause, key, index: itemIndex, ok: false };\n }\n }\n );\n\n if (config.progress?.detailLimit === undefined && keys.length > LIVE_FAN_OUT_GROUP_LIMIT) {\n publishProgress(undefined, true);\n }\n const outcomes = settled.results.filter((outcome): outcome is Outcome => outcome !== undefined);\n const schedulerFailure =\n settled.failure === undefined\n ? undefined\n : settled.failure instanceof Error\n ? settled.failure\n : new Error(String(settled.failure));\n\n const failures = outcomes.filter(\n (outcome): outcome is Extract<Outcome, { ok: false }> => !outcome.ok\n );\n if (failures.length > 0 || schedulerFailure !== undefined) {\n const details = failures.map(({ error, key }) => `${key}: ${error.message}`).join(\"; \");\n const cancelled =\n failures.every(({ error }) => dependencies.isCancellation(error, context)) &&\n (schedulerFailure === undefined || dependencies.isCancellation(schedulerFailure, context));\n const primaryError = cancelled\n ? (failures[0]?.error ?? schedulerFailure)\n : (failures.find(({ error }) => !dependencies.isCancellation(error, context))?.error ??\n failures[0]?.error ??\n schedulerFailure);\n const message =\n failures.length > 0\n ? `Mapped child pipeline ${config.pipeline.id} failed for ${failures.length} item(s): ${details}`\n : `Mapped child pipeline ${config.pipeline.id} failed: ${primaryError?.message ?? \"aborted\"}`;\n throw new PipelineChildError(message, cancelled, primaryError, {\n failures: failures.slice(0, 32).map(({ error, key, index }) => ({\n error,\n key,\n index,\n cancelled: dependencies.isCancellation(error, context),\n })),\n failureCount: failures.length,\n schedulerError: schedulerFailure,\n });\n }\n // SAFETY: when failures.length === 0 every outcome was produced by the\n // success branch (return { key, ok: true, value }), so each outcome is\n // necessarily `{ ok: true }`; the assertion narrows the union accordingly.\n return outcomes.map((outcome) => (outcome as Extract<Outcome, { ok: true }>).value);\n };\n}\n"]}
1
+ {"version":3,"file":"child-execution.js","sourceRoot":"","sources":["../../src/core/child-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,yBAAyB,GAG1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAiBvD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGhC,SAAS;IAET,MAAM;IAJjB,YACE,OAAe,EACN,SAAS,GAAG,KAAK,EAC1B,KAAe,EACN,MAIR;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,C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C,CAAC;oBAC9D,KAAK;oBACL,GAAG;oBACH,KAAK;oBACL,SAAS,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;iBACvD,CAAC,CAAC;gBACH,YAAY,EAAE,QAAQ,CAAC,MAAM;gBAC7B,cAAc,EAAE,gBAAgB;aACjC,CAAC,CAAC;QACL,CAAC;QACD,uEAAuE;QACvE,uEAAuE;QACvE,2EAA2E;QAC3E,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAE,OAA0C,CAAC,KAAK,CAAC,CAAC;IACtF,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { throwIfAborted } from \"../utilities/abort.js\";\nimport { emitRejectedPlanLifecycle } from \"./lifecycle.js\";\nimport { runConcurrentSettled } from \"../utilities/batch.js\";\nimport {\n toMappedChildStepProgress,\n type MappedChildProgressSnapshot,\n type ToMappedChildStepProgressOptions,\n} from \"./mapped-child-progress.js\";\nimport { createRunId, RUN_MODEL_VERSION } from \"./pipeline-ids.js\";\nimport { duplicateValues } from \"../utilities/collections.js\";\nimport { EXECUTE_COMPILED_RUN, isCompiledPipeline } from \"./pipeline-identity.js\";\nimport { createChildProgress } from \"./child-progress.js\";\nimport { hasVisibleStepProgress } from \"./progress.js\";\nimport type {\n Pipeline,\n PipelineContext,\n PipelineExecutionContext,\n PipelineHooks,\n PipelinePlan,\n PipelinePlanStep,\n PipelineRun,\n PipelineRunControls,\n PipelineRunOptions,\n PipelineRuntime,\n PipelineStepContext,\n PipelineStepProgressDetail,\n} from \"./pipeline-types.js\";\nimport type { PipelineTracingOptions } from \"../tracing/tracing-contracts.js\";\n\nexport class PipelineChildError extends Error {\n constructor(\n message: string,\n readonly cancelled = false,\n cause?: unknown,\n readonly fanOut?: {\n failures: readonly { error: Error; key: string; index: number; cancelled: boolean }[];\n failureCount: number;\n schedulerError?: Error;\n }\n ) {\n super(message, cause === undefined ? undefined : { cause });\n this.name = \"PipelineChildError\";\n }\n}\n\nconst LIVE_FAN_OUT_GROUP_LIMIT = 32;\n\ntype ChildPipeline = Pipeline<object, unknown, string, string>;\n\ntype CompiledChildExecute = (\n plan: PipelinePlan,\n options: PipelineRunOptions,\n controls: PipelineRunControls,\n context?: Partial<PipelineContext>\n) => Promise<PipelineRun<unknown>>;\n\ntype ExecutableChild = ChildPipeline & {\n [EXECUTE_COMPILED_RUN]?: CompiledChildExecute;\n};\n\nfunction compiledChildExecute(pipeline: ChildPipeline): CompiledChildExecute | undefined {\n if (!isCompiledPipeline(pipeline)) return undefined;\n // SAFETY: branded pipelines are the `definePipeline` object, which always\n // stamps `EXECUTE_COMPILED_RUN`. Wrappers that inherit the symbol are rejected\n // by the identity check above.\n return (pipeline as ExecutableChild)[EXECUTE_COMPILED_RUN];\n}\n\nfunction executeCompiledChild(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const execute = compiledChildExecute(pipeline);\n if (execute === undefined) {\n return pipeline.run(domainOptions, controls, context);\n }\n return execute(plan, domainOptions, controls, context);\n}\n\nfunction publicChildRuntime(context: PipelineContext): PipelineRuntime {\n const runtime: PipelineRuntime = {\n cwd: context.cwd,\n log: context.log,\n now: context.now ?? Date.now,\n sleep: context.sleep ?? (async () => undefined),\n };\n if (context.correlationId !== undefined) runtime.correlationId = context.correlationId;\n if (context.hooks) runtime.hooks = context.hooks;\n if (context.parentRunId) runtime.parentRunId = context.parentRunId;\n if (context.signal) runtime.signal = context.signal;\n if (context.tracing) runtime.tracing = context.tracing;\n return runtime;\n}\n\nasync function failedPublicChildPlanRun(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const runtime = publicChildRuntime(context);\n const startedAtMs = runtime.now();\n const result: PipelineRun<unknown> = {\n pipelineId: pipeline.id,\n dryRun: controls.dryRun === true,\n errors: [...plan.errors],\n finalized: false,\n finishedAtMs: runtime.now(),\n runId: createRunId(pipeline.id),\n startedAtMs,\n status: \"failed\",\n steps: [],\n version: RUN_MODEL_VERSION,\n };\n const correlationId = context.correlationId;\n if (correlationId !== undefined) result.correlationId = correlationId;\n if (context.parentRunId) result.parentRunId = context.parentRunId;\n await emitRejectedPlanLifecycle(pipeline.id, pipeline.targetIds, plan, runtime, result);\n return result;\n}\n\nasync function rejectedChildPlanResult(\n pipeline: ChildPipeline,\n plan: PipelinePlan,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext\n): Promise<PipelineRun<unknown>> {\n const execute = compiledChildExecute(pipeline);\n if (execute === undefined) {\n return failedPublicChildPlanRun(pipeline, plan, controls, context);\n }\n return execute(plan, domainOptions, controls, context);\n}\n\ntype ChildInputs = Record<string, unknown>;\n\ninterface ChildExecutionDependencies<TParentOptions extends object> {\n createExecutionError(result: PipelineRun<unknown>, message: string): Error;\n isCancellation(cause: unknown, context: PipelineExecutionContext<TParentOptions>): boolean;\n}\n\nexport interface SingleChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n mapOptions(\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): PipelineRunOptions;\n mapResult?(\n value: unknown,\n result: PipelineRun<unknown>,\n context: PipelineStepContext<TParentOptions>\n ): unknown;\n}\n\nexport interface MappedChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n items(\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): readonly unknown[] | Promise<readonly unknown[]>;\n key(item: unknown, index: number): string;\n concurrency?:\n | number\n | ((inputs: ChildInputs, context: PipelineExecutionContext<TParentOptions>) => number);\n progress?: ToMappedChildStepProgressOptions;\n mapOptions(\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): PipelineRunOptions;\n mapResult?(\n value: unknown,\n result: PipelineRun<unknown>,\n item: unknown,\n index: number,\n context: PipelineStepContext<TParentOptions>\n ): unknown;\n}\n\nfunction childTracingOptions(\n context: PipelineExecutionContext<object>,\n itemKey = context.trace?.itemKey\n): PipelineTracingOptions | undefined {\n return context.tracing ? { ...context.tracing, itemKey } : undefined;\n}\n\nconst CHILD_RUN_CONTROL_KEYS = [\"continueOnError\", \"dryRun\", \"stepIds\", \"targets\"] as const;\n\nfunction isChildRunControlKey(\n property: PropertyKey\n): property is (typeof CHILD_RUN_CONTROL_KEYS)[number] {\n return (\n typeof property === \"string\" &&\n // SAFETY: `includes` membership over the literal tuple guarantees the cast\n // target is exactly one of the declared run-control keys.\n CHILD_RUN_CONTROL_KEYS.includes(property as (typeof CHILD_RUN_CONTROL_KEYS)[number])\n );\n}\n\ninterface ChildRunBags {\n controls: PipelineRunControls;\n domainOptions: PipelineRunOptions;\n}\n\nfunction splitChildRunOptions(options: PipelineRunOptions): ChildRunBags {\n const controls: PipelineRunControls = {};\n let hasControls = false;\n for (const key of CHILD_RUN_CONTROL_KEYS) {\n if (!Object.prototype.hasOwnProperty.call(options, key)) continue;\n hasControls = true;\n Object.assign(controls, { [key]: options[key] });\n }\n if (!hasControls) {\n return { controls, domainOptions: options };\n }\n return { controls, domainOptions: createChildDomainOptionsView(options) };\n}\n\nfunction createChildDomainOptionsView(options: PipelineRunOptions): PipelineRunOptions {\n // SAFETY: proxy an empty facade so hiding non-configurable control keys on a\n // frozen mapOptions bag does not violate proxy invariants. Reads still use\n // `options` as the receiver so accessors and methods keep their original `this`.\n return new Proxy({} as PipelineRunOptions, {\n get(_target, property) {\n if (isChildRunControlKey(property)) return undefined;\n const value = readChildOptionProperty(options, property);\n return value instanceof Function ? value.bind(options) : value;\n },\n has(_target, property) {\n return !isChildRunControlKey(property) && property in options;\n },\n ownKeys() {\n return Reflect.ownKeys(options).filter((property) => !isChildRunControlKey(property));\n },\n getOwnPropertyDescriptor(_target, property) {\n if (isChildRunControlKey(property)) return undefined;\n const descriptor = Reflect.getOwnPropertyDescriptor(options, property);\n if (descriptor === undefined) return undefined;\n return { ...descriptor, configurable: true };\n },\n getPrototypeOf() {\n return Object.getPrototypeOf(options);\n },\n set(_target, property, value) {\n if (isChildRunControlKey(property)) return true;\n return Reflect.set(options, property, value, options);\n },\n });\n}\n\nfunction readChildOptionProperty(options: PipelineRunOptions, property: PropertyKey): unknown {\n // SAFETY: child mapOptions is an untyped bag; this index reads the requested\n // key on that original object so accessors keep it as `this`.\n return options[property as keyof PipelineRunOptions];\n}\n\nfunction childRunBags(options: PipelineRunOptions, dryRun: boolean): ChildRunBags {\n const { controls, domainOptions } = splitChildRunOptions(options);\n return { controls: { ...controls, dryRun }, domainOptions };\n}\n\nfunction isConcurrencyFunction<TOptions extends object>(\n concurrency:\n | number\n | ((inputs: ChildInputs, context: PipelineExecutionContext<TOptions>) => number)\n | undefined\n): concurrency is (inputs: ChildInputs, context: PipelineExecutionContext<TOptions>) => number {\n return typeof concurrency === \"function\";\n}\n\nfunction firstChildFailure(result: PipelineRun<unknown>) {\n const firstFailedStep = result.steps.find(\n ({ status }) => status === \"failed\" || status === \"cancelled\"\n );\n const firstError =\n firstFailedStep && \"error\" in firstFailedStep ? firstFailedStep.error : result.errors[0];\n return {\n failureLocation: firstFailedStep?.id ?? firstError?.stepId ?? \"unknown step\",\n message: firstError?.message ?? \"unknown error\",\n };\n}\n\nasync function runChildPipeline(\n pipeline: ChildPipeline,\n domainOptions: PipelineRunOptions,\n controls: PipelineRunControls,\n context: PipelineContext,\n hooks: PipelineHooks,\n dependencies: ChildExecutionDependencies<object>,\n messagePrefix = \"\",\n plan: PipelinePlan\n): Promise<PipelineRun<unknown>> {\n if (!plan.ok) {\n const firstError = plan.errors[0];\n const result = await rejectedChildPlanResult(pipeline, plan, domainOptions, controls, {\n ...context,\n hooks,\n });\n throw dependencies.createExecutionError(\n result,\n `${messagePrefix}could not start: ${firstError?.message ?? \"invalid plan\"}`\n );\n }\n\n const result = await executeCompiledChild(pipeline, plan, domainOptions, controls, {\n ...context,\n hooks,\n });\n if (result.status !== \"completed\") {\n const { failureLocation, message } = firstChildFailure(result);\n throw dependencies.createExecutionError(\n result,\n `${messagePrefix}failed at ${failureLocation}: ${message}`\n );\n }\n return result;\n}\n\nfunction hasProgressObserver(context: PipelineContext): boolean {\n const hooks = Array.isArray(context.hooks) ? context.hooks : [context.hooks];\n return (\n Boolean(context.tracing) || hooks.some((hook) => hook?.onStepProgress || hook?.onStepStatus)\n );\n}\n\nexport function createSingleChildRunner<TParentOptions extends object>(\n config: SingleChildExecutionConfig<TParentOptions>,\n dependencies: ChildExecutionDependencies<TParentOptions>\n): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown> {\n return async (inputs, context) => {\n const { controls, domainOptions } = childRunBags(\n config.mapOptions(inputs, context),\n context.dryRun\n );\n const baseChildContext: PipelineContext = {\n correlationId: context.correlationId,\n cwd: context.cwd,\n log: context.log,\n now: context.now,\n parentRunId: context.runId,\n signal: context.signal,\n sleep: context.sleep,\n tracing: childTracingOptions(context),\n };\n // Plan once for progress totals and execution. Invalid plans fail before child.run.\n const childPlan = config.pipeline.plan(controls);\n const selectedStepCount = childPlan.ok\n ? childPlan.steps.filter((step) => step.selected).length\n : 0;\n const childProgress = hasProgressObserver(context) ? createChildProgress(childPlan) : undefined;\n const terminalSteps = new Set<string>();\n const report = (step: PipelinePlanStep, message: string, terminal = false): void => {\n if (!childProgress) return;\n if (terminal) terminalSteps.add(step.id);\n context.reportProgress({\n details: childProgress.details(),\n completed: terminalSteps.size,\n total: Math.max(1, selectedStepCount),\n message: `${config.pipeline.id}/${step.name ?? step.id}: ${message}`,\n });\n };\n const childHooks: PipelineHooks = {\n onStepStatus: childProgress?.update,\n onStepStart: ({ step }) => report(step, \"started\"),\n onStepProgress: ({ progress, step }) => {\n if (!hasVisibleStepProgress(progress)) return;\n report(step, progress.message ?? `${progress.completed} completed`);\n },\n onStepComplete: ({ step }) => report(step, \"complete\", true),\n onStepSkip: ({ reason, step }) => report(step, `skipped: ${reason}`, reason !== \"filtered\"),\n onStepCancel: ({ error, step }) => report(step, `cancelled: ${error.message}`, true),\n onStepFail: ({ error, step }) => report(step, `failed: ${error.message}`, true),\n };\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n baseChildContext,\n childProgress ? childHooks : {},\n dependencies,\n `Child pipeline ${config.pipeline.id} `,\n childPlan\n );\n\n return config.mapResult\n ? config.mapResult(childResult.value, childResult, context)\n : childResult.value;\n };\n}\n\nexport function createMappedChildRunner<TParentOptions extends object>(\n config: MappedChildExecutionConfig<TParentOptions>,\n dependencies: ChildExecutionDependencies<TParentOptions>\n): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown[]> {\n return async (inputs, context) => {\n const items = [...(await config.items(inputs, context))];\n const keys = items.map((item, index) => config.key(item, index));\n const duplicateKeys = duplicateValues(keys);\n if (duplicateKeys.length > 0) {\n throw new PipelineChildError(\n `Mapped child pipeline ${config.pipeline.id} received duplicate item keys: ${duplicateKeys.join(\", \")}`\n );\n }\n const concurrency = Math.max(\n 1,\n isConcurrencyFunction(config.concurrency)\n ? config.concurrency(inputs, context)\n : (config.concurrency ?? 1)\n );\n type Outcome =\n | { key: string; ok: true; value: unknown }\n | { error: Error; key: string; index: number; ok: false };\n\n const active = new Map<string, string>();\n const failedKeys = new Set<string>();\n const itemIndexes = new Map(keys.map((key, index) => [key, index]));\n const observesProgress = hasProgressObserver(context);\n const itemRows = new Map<string, PipelineStepProgressDetail>(\n keys.map((id) => [id, { id, status: \"pending\" }])\n );\n const itemProgress = new Map<string, ReturnType<typeof createChildProgress>>();\n const childTerminalSteps = new Map<string, Set<string>>();\n let finishedItems = 0;\n let failedItems = 0;\n let stepsPerItem = 0;\n let plannedChildSteps = 0;\n let plannedItems = 0;\n let terminalChildSteps = 0;\n\n const publishProgress = (spotlight?: string, final = false): void => {\n if (!observesProgress) return;\n const snapshot: MappedChildProgressSnapshot = {\n active,\n concurrency,\n failedItems,\n finishedItems,\n itemCount: items.length,\n plannedChildSteps,\n plannedItems,\n stepsPerItem,\n terminalChildSteps,\n spotlight,\n };\n // Materialize a bounded live window; expand the default final snapshot once.\n // Active and failed sets avoid scanning or sorting the full fan-out per event.\n const limit =\n Math.max(0, Math.floor(config.progress?.detailLimit ?? LIVE_FAN_OUT_GROUP_LIMIT)) || 0;\n let visibleKeys: readonly string[];\n if (final && config.progress?.detailLimit === undefined) {\n visibleKeys = keys;\n } else {\n const visible = new Set<string>();\n for (const candidates of [active.keys(), failedKeys.keys(), keys.values()]) {\n for (const key of candidates) {\n if (visible.size >= limit) break;\n visible.add(key);\n }\n }\n visibleKeys = [...visible].sort(\n (left, right) => itemIndexes.get(left)! - itemIndexes.get(right)!\n );\n }\n const details = visibleKeys.flatMap((key) => [\n { ...itemRows.get(key)! },\n ...(itemProgress.get(key)?.details() ?? []).map((detail) => ({\n ...detail,\n depth: (detail.depth ?? 0) + 1,\n })),\n ]);\n if (visibleKeys.length < keys.length) {\n details.push({ id: `+${keys.length - visibleKeys.length} more`, status: \"pending\" });\n }\n context.reportProgress({ ...toMappedChildStepProgress(snapshot, config.progress), details });\n };\n const markChildTerminal = (itemKey: string, stepId: string, label: string): void => {\n let seen = childTerminalSteps.get(itemKey);\n if (!seen) {\n seen = new Set();\n childTerminalSteps.set(itemKey, seen);\n }\n if (!seen.has(stepId)) {\n seen.add(stepId);\n terminalChildSteps += 1;\n }\n active.set(itemKey, label);\n publishProgress();\n };\n\n if (items.length === 0) {\n publishProgress();\n return [];\n }\n publishProgress();\n\n const settled = await runConcurrentSettled(\n items,\n { concurrency, signal: context.signal },\n async (item, itemIndex): Promise<Outcome> => {\n const key = keys[itemIndex]!;\n active.set(key, \"starting\");\n itemRows.set(key, { id: key, status: \"running\" });\n publishProgress();\n try {\n throwIfAborted(context.signal, `Mapped child pipeline ${config.pipeline.id}`);\n const { controls, domainOptions } = childRunBags(\n config.mapOptions(item, itemIndex, inputs, context),\n context.dryRun\n );\n // Plan once per mapped-options bag for progress and execution.\n const childPlan = config.pipeline.plan(controls);\n if (childPlan.ok) {\n const plannedSteps = childPlan.steps.filter((step) => step.selected).length;\n plannedChildSteps += plannedSteps;\n plannedItems += 1;\n if (plannedSteps > stepsPerItem) stepsPerItem = plannedSteps;\n }\n\n const childProgress = observesProgress ? createChildProgress(childPlan) : undefined;\n if (childProgress) itemProgress.set(key, childProgress);\n const childHooks: PipelineHooks = {\n onStepStatus: childProgress?.update,\n onStepStart: ({ step }) => {\n active.set(key, step.name ?? step.id);\n publishProgress();\n },\n onStepProgress: ({ progress, step }) => {\n if (!hasVisibleStepProgress(progress)) return;\n const detail =\n progress.message ??\n (progress.total !== undefined\n ? `${progress.completed}/${progress.total}`\n : `${progress.completed}`);\n active.set(key, `${step.name ?? step.id}:${detail}`);\n publishProgress();\n },\n onStepComplete: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:complete`),\n onStepSkip: ({ reason, step }) => {\n if (reason === \"filtered\") return;\n markChildTerminal(key, step.id, `${step.name ?? step.id}:skipped:${reason}`);\n },\n onStepCancel: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:cancelled`),\n onStepFail: ({ step }) =>\n markChildTerminal(key, step.id, `${step.name ?? step.id}:failed`),\n };\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n {\n correlationId: context.correlationId,\n cwd: context.cwd,\n log: context.log,\n now: context.now,\n parentRunId: context.runId,\n signal: context.signal,\n sleep: context.sleep,\n tracing: childTracingOptions(context, key),\n },\n observesProgress ? childHooks : {},\n dependencies,\n \"\",\n childPlan\n );\n\n const seen = childTerminalSteps.get(key) ?? new Set<string>();\n if (childPlan.ok) {\n for (const planStep of childPlan.steps) {\n if (!planStep.selected || seen.has(planStep.id)) continue;\n seen.add(planStep.id);\n terminalChildSteps += 1;\n }\n }\n childTerminalSteps.set(key, seen);\n\n const value = config.mapResult\n ? config.mapResult(childResult.value, childResult, item, itemIndex, context)\n : childResult.value;\n active.delete(key);\n itemRows.set(key, { id: key, status: \"completed\" });\n finishedItems += 1;\n publishProgress(`${key}: completed`);\n return { key, ok: true, value };\n } catch (error) {\n const cause = error instanceof Error ? error : new Error(String(error));\n active.delete(key);\n itemRows.set(key, {\n id: key,\n status: dependencies.isCancellation(cause, context) ? \"cancelled\" : \"failed\",\n label: cause.message,\n });\n failedKeys.add(key);\n failedItems += 1;\n publishProgress(`${key}: failed`);\n return { error: cause, key, index: itemIndex, ok: false };\n }\n }\n );\n\n if (config.progress?.detailLimit === undefined && keys.length > LIVE_FAN_OUT_GROUP_LIMIT) {\n publishProgress(undefined, true);\n }\n const outcomes = settled.results.filter((outcome): outcome is Outcome => outcome !== undefined);\n const schedulerFailure =\n settled.failure === undefined\n ? undefined\n : settled.failure instanceof Error\n ? settled.failure\n : new Error(String(settled.failure));\n\n const failures = outcomes.filter(\n (outcome): outcome is Extract<Outcome, { ok: false }> => !outcome.ok\n );\n if (failures.length > 0 || schedulerFailure !== undefined) {\n const details = failures.map(({ error, key }) => `${key}: ${error.message}`).join(\"; \");\n const cancelled =\n failures.every(({ error }) => dependencies.isCancellation(error, context)) &&\n (schedulerFailure === undefined || dependencies.isCancellation(schedulerFailure, context));\n const primaryError = cancelled\n ? (failures[0]?.error ?? schedulerFailure)\n : (failures.find(({ error }) => !dependencies.isCancellation(error, context))?.error ??\n failures[0]?.error ??\n schedulerFailure);\n const message =\n failures.length > 0\n ? `Mapped child pipeline ${config.pipeline.id} failed for ${failures.length} item(s): ${details}`\n : `Mapped child pipeline ${config.pipeline.id} failed: ${primaryError?.message ?? \"aborted\"}`;\n throw new PipelineChildError(message, cancelled, primaryError, {\n failures: failures.slice(0, 32).map(({ error, key, index }) => ({\n error,\n key,\n index,\n cancelled: dependencies.isCancellation(error, context),\n })),\n failureCount: failures.length,\n schedulerError: schedulerFailure,\n });\n }\n // SAFETY: when failures.length === 0 every outcome was produced by the\n // success branch (return { key, ok: true, value }), so each outcome is\n // necessarily `{ ok: true }`; the assertion narrows the union accordingly.\n return outcomes.map((outcome) => (outcome as Extract<Outcome, { ok: true }>).value);\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { PipelineError, PipelinePlan, PipelineRun, PipelineRuntime, PipelineStepStatus } from "./pipeline-types.js";
2
2
  import { type PipelineTraceEmitter } from "../tracing/tracing-internal.js";
3
- import type { PipelineTraceAttributes } from "../tracing/tracing.js";
3
+ import type { PipelineTraceAttributes } from "../tracing/tracing-contracts.js";
4
4
  /** Internal canonical lifecycle stream. Hooks and tracing are projections of it. */
5
5
  export interface PipelineLifecycleObserver {
6
6
  finalizeComplete(durationMs: number, value: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/core/lifecycle.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AA2BxC,SAAS,QAAQ,CAAC,OAAwB,EAAE,IAAoC;IAC9E,IAAI,CAAC,OAAO,CAAC,KAAK;QAAE,OAAO;IAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChF,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CACd,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,UAAkB,EAClB,OAAwB,EACxB,KAAuC;IAEvC,OAAO;QACL,aAAa,CAAC,IA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CAC/C,UAAU,EACV,OAAO,EACP,0BAA0B,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAC5F,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import type {\n PipelineError,\n PipelineHooks,\n PipelinePlan,\n PipelineRun,\n PipelineRuntime,\n PipelineStepStatus,\n} from \"./pipeline-types.js\";\nimport {\n createPipelineTraceEmitter,\n type PipelineTraceEmitter,\n} from \"../tracing/tracing-internal.js\";\nimport type { PipelineTraceAttributes, PipelineTraceContext } from \"../tracing/tracing.js\";\n\n/** Internal canonical lifecycle stream. Hooks and tracing are projections of it. */\nexport interface PipelineLifecycleObserver {\n finalizeComplete(durationMs: number, value: unknown): void;\n finalizeError(error: PipelineError, durationMs: number): void;\n finalizeStart(): void;\n flush(): Promise<void>;\n log(\n level: \"error\" | \"log\" | \"warn\",\n message: unknown,\n params?: readonly unknown[],\n stepId?: string,\n attemptId?: string\n ): void;\n pipelineComplete(result: PipelineRun<unknown>): void;\n pipelineStart(plan: PipelinePlan, targetIds: readonly string[]): void;\n reportAttempt(\n stepId: string,\n attempt: number,\n attributes?: PipelineTraceAttributes,\n attemptId?: string\n ): void;\n stepStatus(event: PipelineStepStatus, trace?: boolean): void;\n}\n\nfunction emitHook(runtime: PipelineRuntime, emit: (hooks: PipelineHooks) => void): void {\n if (!runtime.hooks) return;\n const hookSets = Array.isArray(runtime.hooks) ? runtime.hooks : [runtime.hooks];\n for (const hooks of hookSets) {\n try {\n emit(hooks);\n } catch (error) {\n runtime.log.warn(\n `Pipeline hook failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n}\n\nexport function createPipelineLifecycleObserver(\n pipelineId: string,\n runtime: PipelineRuntime,\n trace: PipelineTraceEmitter | undefined\n): PipelineLifecycleObserver {\n return {\n pipelineStart(plan, targetIds) {\n emitHook(runtime, (hooks) => hooks.onPipelineStart?.(plan));\n trace?.pipelineStart(plan, targetIds);\n },\n stepStatus(event, traceStatus = true) {\n emitHook(runtime, (hooks) => hooks.onStepStatus?.(event));\n switch (event.status) {\n case \"planned\":\n emitHook(runtime, (hooks) => hooks.onStepPlan?.(event));\n break;\n case \"running\":\n if (event.progress) {\n const progress = event.progress;\n emitHook(runtime, (hooks) => hooks.onStepProgress?.({ ...event, progress }));\n } else {\n emitHook(runtime, (hooks) =>\n hooks.onStepStart?.({\n attemptId: event.attemptId,\n pipelineId: event.pipelineId,\n status: \"running\",\n step: event.step,\n })\n );\n }\n break;\n case \"cancelled\":\n emitHook(runtime, (hooks) => hooks.onStepCancel?.(event));\n break;\n case \"failed\":\n emitHook(runtime, (hooks) => hooks.onStepFail?.(event));\n break;\n case \"skipped\":\n emitHook(runtime, (hooks) => hooks.onStepSkip?.(event));\n break;\n case \"completed\":\n emitHook(runtime, (hooks) => hooks.onStepComplete?.(event));\n break;\n }\n if (traceStatus) trace?.stepStatus(event);\n },\n reportAttempt: (stepId, attempt, attributes, attemptId) =>\n trace?.reportAttempt(stepId, attempt, attributes, attemptId),\n log: (level, message, params, stepId, attemptId) =>\n trace?.log(level, message, params, stepId, attemptId),\n finalizeStart() {\n emitHook(runtime, (hooks) => hooks.onFinalizeStart?.({ pipelineId }));\n trace?.finalizeStart();\n },\n finalizeComplete(durationMs, value) {\n emitHook(runtime, (hooks) => hooks.onFinalizeComplete?.({ durationMs, pipelineId, value }));\n trace?.finalizeComplete(durationMs);\n },\n finalizeError(error, durationMs) {\n emitHook(runtime, (hooks) => hooks.onFinalizeError?.({ durationMs, error, pipelineId }));\n trace?.finalizeError(error, durationMs);\n },\n pipelineComplete(result) {\n emitHook(runtime, (hooks) => hooks.onPipelineComplete?.(result));\n trace?.pipelineComplete(result);\n },\n flush: () => trace?.flush() ?? Promise.resolve(),\n };\n}\n\n/** Same start/complete projection executePlannedRun uses for an invalid plan. */\nexport async function emitRejectedPlanLifecycle(\n pipelineId: string,\n targetIds: readonly string[],\n plan: PipelinePlan,\n runtime: PipelineRuntime,\n result: PipelineRun<unknown>\n): Promise<void> {\n const identity: PipelineTraceContext = { runId: result.runId };\n if (result.correlationId !== undefined) identity.correlationId = result.correlationId;\n if (result.parentRunId) identity.parentRunId = result.parentRunId;\n if (runtime.tracing?.itemKey) identity.itemKey = runtime.tracing.itemKey;\n const lifecycle = createPipelineLifecycleObserver(\n pipelineId,\n runtime,\n createPipelineTraceEmitter(pipelineId, runtime.tracing, runtime.log, identity, runtime.now)\n );\n lifecycle.pipelineStart(plan, targetIds);\n lifecycle.pipelineComplete(result);\n await lifecycle.flush();\n}\n"]}
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/core/lifecycle.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AA8BxC,SAAS,QAAQ,CAAC,OAAwB,EAAE,IAAoC;IAC9E,IAAI,CAAC,OAAO,CAAC,KAAK;QAAE,OAAO;IAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChF,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CACd,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClF,CAAC;QACJ,CAAC;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C,OAAO,EAAE,OAAO;QAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACzE,MAAM,SAAS,GAAG,+BAA+B,CAC/C,UAAU,EACV,OAAO,EACP,0BAA0B,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAC5F,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import type {\n PipelineError,\n PipelineHooks,\n PipelinePlan,\n PipelineRun,\n PipelineRuntime,\n PipelineStepStatus,\n} from \"./pipeline-types.js\";\nimport {\n createPipelineTraceEmitter,\n type PipelineTraceEmitter,\n} from \"../tracing/tracing-internal.js\";\nimport type {\n PipelineTraceAttributes,\n PipelineTraceContext,\n} from \"../tracing/tracing-contracts.js\";\n\n/** Internal canonical lifecycle stream. Hooks and tracing are projections of it. */\nexport interface PipelineLifecycleObserver {\n finalizeComplete(durationMs: number, value: unknown): void;\n finalizeError(error: PipelineError, durationMs: number): void;\n finalizeStart(): void;\n flush(): Promise<void>;\n log(\n level: \"error\" | \"log\" | \"warn\",\n message: unknown,\n params?: readonly unknown[],\n stepId?: string,\n attemptId?: string\n ): void;\n pipelineComplete(result: PipelineRun<unknown>): void;\n pipelineStart(plan: PipelinePlan, targetIds: readonly string[]): void;\n reportAttempt(\n stepId: string,\n attempt: number,\n attributes?: PipelineTraceAttributes,\n attemptId?: string\n ): void;\n stepStatus(event: PipelineStepStatus, trace?: boolean): void;\n}\n\nfunction emitHook(runtime: PipelineRuntime, emit: (hooks: PipelineHooks) => void): void {\n if (!runtime.hooks) return;\n const hookSets = Array.isArray(runtime.hooks) ? runtime.hooks : [runtime.hooks];\n for (const hooks of hookSets) {\n try {\n emit(hooks);\n } catch (error) {\n runtime.log.warn(\n `Pipeline hook failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n}\n\nexport function createPipelineLifecycleObserver(\n pipelineId: string,\n runtime: PipelineRuntime,\n trace: PipelineTraceEmitter | undefined\n): PipelineLifecycleObserver {\n return {\n pipelineStart(plan, targetIds) {\n emitHook(runtime, (hooks) => hooks.onPipelineStart?.(plan));\n trace?.pipelineStart(plan, targetIds);\n },\n stepStatus(event, traceStatus = true) {\n emitHook(runtime, (hooks) => hooks.onStepStatus?.(event));\n switch (event.status) {\n case \"planned\":\n emitHook(runtime, (hooks) => hooks.onStepPlan?.(event));\n break;\n case \"running\":\n if (event.progress) {\n const progress = event.progress;\n emitHook(runtime, (hooks) => hooks.onStepProgress?.({ ...event, progress }));\n } else {\n emitHook(runtime, (hooks) =>\n hooks.onStepStart?.({\n attemptId: event.attemptId,\n pipelineId: event.pipelineId,\n status: \"running\",\n step: event.step,\n })\n );\n }\n break;\n case \"cancelled\":\n emitHook(runtime, (hooks) => hooks.onStepCancel?.(event));\n break;\n case \"failed\":\n emitHook(runtime, (hooks) => hooks.onStepFail?.(event));\n break;\n case \"skipped\":\n emitHook(runtime, (hooks) => hooks.onStepSkip?.(event));\n break;\n case \"completed\":\n emitHook(runtime, (hooks) => hooks.onStepComplete?.(event));\n break;\n }\n if (traceStatus) trace?.stepStatus(event);\n },\n reportAttempt: (stepId, attempt, attributes, attemptId) =>\n trace?.reportAttempt(stepId, attempt, attributes, attemptId),\n log: (level, message, params, stepId, attemptId) =>\n trace?.log(level, message, params, stepId, attemptId),\n finalizeStart() {\n emitHook(runtime, (hooks) => hooks.onFinalizeStart?.({ pipelineId }));\n trace?.finalizeStart();\n },\n finalizeComplete(durationMs, value) {\n emitHook(runtime, (hooks) => hooks.onFinalizeComplete?.({ durationMs, pipelineId, value }));\n trace?.finalizeComplete(durationMs);\n },\n finalizeError(error, durationMs) {\n emitHook(runtime, (hooks) => hooks.onFinalizeError?.({ durationMs, error, pipelineId }));\n trace?.finalizeError(error, durationMs);\n },\n pipelineComplete(result) {\n emitHook(runtime, (hooks) => hooks.onPipelineComplete?.(result));\n trace?.pipelineComplete(result);\n },\n flush: () => trace?.flush() ?? Promise.resolve(),\n };\n}\n\n/** Same start/complete projection executePlannedRun uses for an invalid plan. */\nexport async function emitRejectedPlanLifecycle(\n pipelineId: string,\n targetIds: readonly string[],\n plan: PipelinePlan,\n runtime: PipelineRuntime,\n result: PipelineRun<unknown>\n): Promise<void> {\n const identity: PipelineTraceContext = { runId: result.runId };\n if (result.correlationId !== undefined) identity.correlationId = result.correlationId;\n if (result.parentRunId) identity.parentRunId = result.parentRunId;\n if (runtime.tracing?.itemKey) identity.itemKey = runtime.tracing.itemKey;\n const lifecycle = createPipelineLifecycleObserver(\n pipelineId,\n runtime,\n createPipelineTraceEmitter(pipelineId, runtime.tracing, runtime.log, identity, runtime.now)\n );\n lifecycle.pipelineStart(plan, targetIds);\n lifecycle.pipelineComplete(result);\n await lifecycle.flush();\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { PipelineDefinition, StepsOptions } from "./pipeline-definition.js";
2
+ import { type CompiledStepGraph } from "./pipeline-graph.js";
3
+ import type { AnyStep } from "./pipeline-steps.js";
4
+ import type { StandardSchemaV1 } from "./pipeline-types.js";
5
+ export interface CompiledPipeline<TSteps extends readonly AnyStep[] = readonly AnyStep[], TResult = unknown, TTargets extends readonly TSteps[number][] = readonly [], TResultSchema extends StandardSchemaV1 | undefined = undefined> {
6
+ readonly declaredTargets: readonly AnyStep<StepsOptions<TSteps>>[];
7
+ readonly finalize: PipelineDefinition<TSteps, TResult, TTargets, TResultSchema>["finalize"];
8
+ readonly id: string;
9
+ readonly optionsSchema: StandardSchemaV1 | undefined;
10
+ readonly orderedSteps: readonly AnyStep<StepsOptions<TSteps>>[];
11
+ readonly requiredFinalizerSteps: readonly AnyStep<StepsOptions<TSteps>>[] | undefined;
12
+ readonly stepGraph: ReadonlyMap<AnyStep, CompiledStepGraph>;
13
+ readonly resultSchema: TResultSchema | undefined;
14
+ readonly stepIds: readonly string[];
15
+ readonly targetIds: readonly string[];
16
+ }
17
+ export declare function compilePipeline<TSteps extends readonly AnyStep[], TResult, TTargets extends readonly TSteps[number][], TResultSchema extends StandardSchemaV1 | undefined>(definition: PipelineDefinition<TSteps, TResult, TTargets, TResultSchema>): CompiledPipeline<TSteps, TResult, TTargets, TResultSchema>;