tubeless 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli-pipeline-command.d.ts +7 -2
- package/dist/cli/cli-pipeline-command.js +24 -3
- package/dist/cli/cli-pipeline-command.js.map +1 -1
- package/dist/core/child-execution.d.ts +0 -23
- package/dist/core/child-execution.js +15 -15
- package/dist/core/child-execution.js.map +1 -1
- package/dist/core/child-progress.js +9 -2
- package/dist/core/child-progress.js.map +1 -1
- package/dist/core/iteration.d.ts +27 -0
- package/dist/core/iteration.js +111 -0
- package/dist/core/iteration.js.map +1 -0
- package/dist/core/lifecycle.d.ts +7 -5
- package/dist/core/lifecycle.js +36 -4
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/pipeline-artifacts.d.ts +11 -0
- package/dist/core/pipeline-artifacts.js +2 -0
- package/dist/core/pipeline-artifacts.js.map +1 -0
- package/dist/core/pipeline-cache.d.ts +68 -0
- package/dist/core/pipeline-cache.js +157 -0
- package/dist/core/pipeline-cache.js.map +1 -0
- package/dist/core/pipeline-compiler.d.ts +1 -0
- package/dist/core/pipeline-compiler.js +5 -2
- package/dist/core/pipeline-compiler.js.map +1 -1
- package/dist/core/pipeline-definition-identity.d.ts +4 -2
- package/dist/core/pipeline-definition-identity.js +62 -6
- package/dist/core/pipeline-definition-identity.js.map +1 -1
- package/dist/core/pipeline-definition-validation.d.ts +7 -2
- package/dist/core/pipeline-definition-validation.js +22 -2
- package/dist/core/pipeline-definition-validation.js.map +1 -1
- package/dist/core/pipeline-definition.d.ts +6 -0
- package/dist/core/pipeline-definition.js.map +1 -1
- package/dist/core/pipeline-execute.d.ts +1 -6
- package/dist/core/pipeline-execute.js +33 -215
- package/dist/core/pipeline-execute.js.map +1 -1
- package/dist/core/pipeline-execution-error.d.ts +35 -0
- package/dist/core/pipeline-execution-error.js +195 -0
- package/dist/core/pipeline-execution-error.js.map +1 -0
- package/dist/core/pipeline-graph.d.ts +2 -1
- package/dist/core/pipeline-graph.js +10 -4
- package/dist/core/pipeline-graph.js.map +1 -1
- package/dist/core/pipeline-identity.d.ts +1 -0
- package/dist/core/pipeline-identity.js +1 -0
- package/dist/core/pipeline-identity.js.map +1 -1
- package/dist/core/pipeline-mermaid.js +11 -2
- package/dist/core/pipeline-mermaid.js.map +1 -1
- package/dist/core/pipeline-plan.js +4 -0
- package/dist/core/pipeline-plan.js.map +1 -1
- package/dist/core/pipeline-query.d.ts +11 -0
- package/dist/core/pipeline-query.js +10 -0
- package/dist/core/pipeline-query.js.map +1 -0
- package/dist/core/pipeline-run-state.d.ts +4 -4
- package/dist/core/pipeline-run-state.js +10 -16
- package/dist/core/pipeline-run-state.js.map +1 -1
- package/dist/core/pipeline-step-executor.d.ts +4 -0
- package/dist/core/pipeline-step-executor.js +34 -11
- package/dist/core/pipeline-step-executor.js.map +1 -1
- package/dist/core/pipeline-step-metadata.d.ts +1 -0
- package/dist/core/pipeline-step-metadata.js +1 -0
- package/dist/core/pipeline-step-metadata.js.map +1 -1
- package/dist/core/pipeline-steps.d.ts +35 -1
- package/dist/core/pipeline-steps.js +71 -1
- package/dist/core/pipeline-steps.js.map +1 -1
- package/dist/core/pipeline-types.d.ts +30 -4
- package/dist/core/pipeline-types.js.map +1 -1
- package/dist/core/pipeline.d.ts +8 -1
- package/dist/core/pipeline.js +25 -4
- package/dist/core/pipeline.js.map +1 -1
- package/dist/node/node.d.ts +1 -0
- package/dist/node/node.js +1 -0
- package/dist/node/node.js.map +1 -1
- package/dist/project/project-compiler.d.ts +3 -31
- package/dist/project/project-compiler.js +11 -180
- package/dist/project/project-compiler.js.map +1 -1
- package/dist/project/project-registry.d.ts +44 -0
- package/dist/project/project-registry.js +107 -0
- package/dist/project/project-registry.js.map +1 -0
- package/dist/project/project-step-graph.d.ts +9 -0
- package/dist/project/project-step-graph.js +99 -0
- package/dist/project/project-step-graph.js.map +1 -0
- package/dist/render/render.js +1 -1
- package/dist/render/render.js.map +1 -1
- package/dist/reporter/interactive-reporter.js +6 -4
- package/dist/reporter/interactive-reporter.js.map +1 -1
- package/dist/reporter/live-ticker-frame.d.ts +21 -0
- package/dist/reporter/live-ticker-frame.js +196 -0
- package/dist/reporter/live-ticker-frame.js.map +1 -0
- package/dist/reporter/live-ticker-protocol.d.ts +41 -0
- package/dist/reporter/live-ticker-protocol.js +59 -0
- package/dist/reporter/live-ticker-protocol.js.map +1 -0
- package/dist/reporter/live-ticker-worker.js +11 -25
- package/dist/reporter/live-ticker-worker.js.map +1 -1
- package/dist/reporter/live-ticker.d.ts +0 -15
- package/dist/reporter/live-ticker.js +11 -216
- package/dist/reporter/live-ticker.js.map +1 -1
- package/dist/reporter/reporter.d.ts +1 -0
- package/dist/reporter/reporter.js +9 -6
- package/dist/reporter/reporter.js.map +1 -1
- package/dist/run-store/cache-artifact.d.ts +7 -0
- package/dist/run-store/cache-artifact.js +22 -0
- package/dist/run-store/cache-artifact.js.map +1 -0
- package/dist/run-store/definition-diff.js +20 -8
- package/dist/run-store/definition-diff.js.map +1 -1
- package/dist/run-store/definition-projection.d.ts +8 -0
- package/dist/run-store/definition-projection.js +89 -0
- package/dist/run-store/definition-projection.js.map +1 -0
- package/dist/run-store/run-projection.d.ts +15 -0
- package/dist/run-store/run-projection.js +203 -0
- package/dist/run-store/run-projection.js.map +1 -0
- package/dist/run-store/run-store-codec.d.ts +2 -0
- package/dist/run-store/run-store-codec.js +11 -0
- package/dist/run-store/run-store-codec.js.map +1 -1
- package/dist/run-store/run-store-event-decoder.js +3 -0
- package/dist/run-store/run-store-event-decoder.js.map +1 -1
- package/dist/run-store/run-store-reader.d.ts +7 -0
- package/dist/run-store/run-store-reader.js +31 -0
- package/dist/run-store/run-store-reader.js.map +1 -0
- package/dist/run-store/run-store-sqlite.js +23 -7
- package/dist/run-store/run-store-sqlite.js.map +1 -1
- package/dist/run-store/run-store.d.ts +16 -4
- package/dist/run-store/run-store.js +14 -263
- package/dist/run-store/run-store.js.map +1 -1
- package/dist/studio/run-store-ui-api.d.ts +13 -0
- package/dist/studio/run-store-ui-api.js +163 -0
- package/dist/studio/run-store-ui-api.js.map +1 -0
- package/dist/studio/run-store-ui-artifacts.d.ts +5 -0
- package/dist/studio/run-store-ui-artifacts.js +18 -0
- package/dist/studio/run-store-ui-artifacts.js.map +1 -0
- package/dist/studio/run-store-ui-client-browser.js +2 -2
- package/dist/studio/run-store-ui-client-transport.js +34 -3
- package/dist/studio/run-store-ui-client-transport.js.map +1 -1
- package/dist/studio/run-store-ui-client.d.ts +2 -1
- package/dist/studio/run-store-ui-client.js +22 -10
- package/dist/studio/run-store-ui-client.js.map +1 -1
- package/dist/studio/run-store-ui-definitions.js +2 -1
- package/dist/studio/run-store-ui-definitions.js.map +1 -1
- package/dist/studio/run-store-ui-http.d.ts +11 -0
- package/dist/studio/run-store-ui-http.js +52 -0
- package/dist/studio/run-store-ui-http.js.map +1 -1
- package/dist/studio/run-store-ui-metadata.d.ts +13 -0
- package/dist/studio/run-store-ui-metadata.js +32 -0
- package/dist/studio/run-store-ui-metadata.js.map +1 -0
- package/dist/studio/run-store-ui-page.js +8 -0
- package/dist/studio/run-store-ui-page.js.map +1 -1
- package/dist/studio/run-store-ui-state.d.ts +1 -1
- package/dist/studio/run-store-ui-state.js +10 -28
- package/dist/studio/run-store-ui-state.js.map +1 -1
- package/dist/studio/run-store-ui.d.ts +5 -11
- package/dist/studio/run-store-ui.js +5 -203
- package/dist/studio/run-store-ui.js.map +1 -1
- package/dist/testing/testing.d.ts +18 -2
- package/dist/testing/testing.js +35 -2
- package/dist/testing/testing.js.map +1 -1
- package/dist/tracing/artifact-metadata.d.ts +29 -0
- package/dist/tracing/artifact-metadata.js +105 -0
- package/dist/tracing/artifact-metadata.js.map +1 -0
- package/dist/tracing/graph-metadata.d.ts +12 -0
- package/dist/tracing/graph-metadata.js +55 -0
- package/dist/tracing/graph-metadata.js.map +1 -0
- package/dist/tracing/tracing-codec.d.ts +1 -1
- package/dist/tracing/tracing-codec.js +1 -1
- package/dist/tracing/tracing-codec.js.map +1 -1
- package/dist/tracing/tracing-constants.d.ts +1 -1
- package/dist/tracing/tracing-constants.js +1 -1
- package/dist/tracing/tracing-constants.js.map +1 -1
- package/dist/tracing/tracing-contracts.d.ts +3 -1
- package/dist/tracing/tracing-contracts.js.map +1 -1
- package/dist/tracing/tracing-internal.d.ts +2 -0
- package/dist/tracing/tracing-internal.js +36 -13
- package/dist/tracing/tracing-internal.js.map +1 -1
- package/dist/tracing/tracing-schema.d.ts +367 -59
- package/dist/tracing/tracing-schema.js +120 -10
- package/dist/tracing/tracing-schema.js.map +1 -1
- package/dist/utilities/cache-duration.d.ts +2 -0
- package/dist/utilities/cache-duration.js +39 -0
- package/dist/utilities/cache-duration.js.map +1 -0
- package/dist/utilities/cache-key.d.ts +2 -0
- package/dist/utilities/cache-key.js +63 -0
- package/dist/utilities/cache-key.js.map +1 -0
- package/dist/utilities/cache-storage.d.ts +6 -0
- package/dist/utilities/cache-storage.js +83 -0
- package/dist/utilities/cache-storage.js.map +1 -0
- package/dist/utilities/canonical-json.d.ts +2 -0
- package/dist/utilities/canonical-json.js +12 -0
- package/dist/utilities/canonical-json.js.map +1 -0
- package/dist/workbench/workbench-command-execution.d.ts +6 -0
- package/dist/workbench/workbench-command-execution.js +48 -0
- package/dist/workbench/workbench-command-execution.js.map +1 -0
- package/dist/workbench/workbench-commands.js +43 -3
- package/dist/workbench/workbench-commands.js.map +1 -1
- package/dist/workbench/workbench-history.js +12 -18
- package/dist/workbench/workbench-history.js.map +1 -1
- package/dist/workbench/workbench-launch-session.d.ts +2 -2
- package/dist/workbench/workbench-launch-session.js.map +1 -1
- package/dist/workbench/workbench-run.d.ts +0 -4
- package/dist/workbench/workbench-run.js +3 -47
- package/dist/workbench/workbench-run.js.map +1 -1
- package/dist/workbench/workbench-studio-launcher.d.ts +27 -0
- package/dist/workbench/workbench-studio-launcher.js +95 -0
- package/dist/workbench/workbench-studio-launcher.js.map +1 -0
- package/dist/workbench/workbench-ui.js +10 -83
- package/dist/workbench/workbench-ui.js.map +1 -1
- package/docs/README.md +13 -7
- package/docs/agent-guide.md +92 -6
- package/docs/airflow.md +187 -0
- package/docs/api-reference.md +113 -89
- package/docs/api-report.json +30 -6
- package/docs/artifacts.md +177 -0
- package/docs/child-pipeline-composition.md +65 -2
- package/docs/cli.md +14 -0
- package/docs/comparison.md +20 -0
- package/docs/concepts.md +80 -2
- package/docs/dagster.md +161 -0
- package/docs/declarative-pipelines.md +4 -0
- package/docs/graph-metadata.md +108 -0
- package/docs/inngest.md +163 -0
- package/docs/llms.txt +32 -1
- package/docs/recipes.md +87 -33
- package/docs/remote-step-composition.md +6 -0
- package/docs/step-functions.md +190 -0
- package/docs/step-output-cache.md +242 -0
- package/docs/studio.md +42 -14
- package/docs/temporal.md +183 -0
- package/examples/airflow/contract.ts +46 -0
- package/examples/airflow/hosted.ts +70 -0
- package/examples/airflow/remote.ts +175 -0
- package/examples/airflow/tubeless_example.py +49 -0
- package/examples/airflow/worker.ts +24 -0
- package/examples/artifact-lineage.ts +70 -0
- package/examples/dagster/definitions.py +59 -0
- package/examples/dagster/hosted.ts +78 -0
- package/examples/dagster/pipeline.ts +62 -0
- package/examples/dagster/test_definitions.py +47 -0
- package/examples/dagster/tsconfig.build.json +10 -0
- package/examples/dagster/worker.ts +22 -0
- package/examples/graph-metadata.ts +32 -0
- package/examples/inngest/client.ts +4 -0
- package/examples/inngest/functions.ts +65 -0
- package/examples/inngest/pipeline.ts +41 -0
- package/examples/inngest/send.ts +11 -0
- package/examples/inngest/server.ts +17 -0
- package/examples/inngest/tsconfig.build.json +10 -0
- package/examples/iteration.ts +52 -0
- package/examples/parameterized-steps.ts +96 -0
- package/examples/project/tubeless.project.ts +51 -0
- package/examples/step-functions/handler.ts +110 -0
- package/examples/step-functions/input.json +1 -0
- package/examples/step-functions/pipeline.ts +41 -0
- package/examples/step-functions/state-machine.asl.json +41 -0
- package/examples/step-functions/template.json +42 -0
- package/examples/step-output-cache.ts +30 -0
- package/examples/step-output-overrides.ts +41 -0
- package/examples/temporal/activities.ts +94 -0
- package/examples/temporal/client.ts +19 -0
- package/examples/temporal/pipeline.ts +41 -0
- package/examples/temporal/tsconfig.build.json +10 -0
- package/examples/temporal/worker.ts +21 -0
- package/examples/temporal/workflows.ts +16 -0
- package/package.json +13 -4
- package/skills/tubeless/SKILL.md +46 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InferredCliParams, type InferredFlagOverrides } from "./cli-schema.js";
|
|
2
2
|
import type { CliBooleanParam, CliCheckpointConfig, CliCommandDescriptor, CliContext, CliNumberParam, CliParams, CliParamsSchema, CliStringParam } from "./cli-types.js";
|
|
3
|
-
import { type Pipeline, type PipelineHooks, type PipelineInput, type PipelineMermaidOptions, type PipelinePlan, type PipelineResult, type StandardSchemaV1 } from "../core/pipeline.js";
|
|
3
|
+
import { type Pipeline, type PipelineHooks, type PipelineInput, type PipelineMermaidOptions, type StepCachePolicy, type PipelinePlan, type PipelineResult, type StandardSchemaV1 } from "../core/pipeline.js";
|
|
4
4
|
import { type PipelineReporterConfig } from "../reporter/reporter-entry.js";
|
|
5
5
|
export type PipelineCliBuiltins = {
|
|
6
6
|
stepIds: CliStringParam & {
|
|
@@ -11,6 +11,10 @@ export type PipelineCliBuiltins = {
|
|
|
11
11
|
};
|
|
12
12
|
continueOnError: CliBooleanParam;
|
|
13
13
|
maxConcurrency: CliNumberParam;
|
|
14
|
+
cache: CliStringParam & {
|
|
15
|
+
choices: readonly ["use", "recompute", "bypass"];
|
|
16
|
+
optional: true;
|
|
17
|
+
};
|
|
14
18
|
};
|
|
15
19
|
/** Validated domain parameters plus the built-in pipeline execution controls. */
|
|
16
20
|
export type PipelineCliValues<TSchema extends CliParamsSchema> = CliParams<TSchema> & {
|
|
@@ -18,6 +22,7 @@ export type PipelineCliValues<TSchema extends CliParamsSchema> = CliParams<TSche
|
|
|
18
22
|
targets: readonly string[];
|
|
19
23
|
continueOnError: boolean;
|
|
20
24
|
maxConcurrency: number;
|
|
25
|
+
cache?: StepCachePolicy;
|
|
21
26
|
};
|
|
22
27
|
/** Parse result returned by commands created with `definePipelineCommand`. */
|
|
23
28
|
export type PipelineCliParseResult<TSchema extends CliParamsSchema> = {
|
|
@@ -64,7 +69,7 @@ type PipelineCommandHookSets<TResult> = PipelineHooks<TResult> | readonly Pipeli
|
|
|
64
69
|
/** Static or lazily constructed lifecycle hooks for a pipeline command. */
|
|
65
70
|
export type PipelineCommandHookConfig<TResult, TSchema extends CliParamsSchema> = PipelineCommandHookSets<TResult> | ((input: PipelineCommandHookContext<TSchema>) => PipelineCommandHookSets<TResult> | undefined);
|
|
66
71
|
type PipelineCommandMapOptions<TOptions extends object, TSchema extends CliParamsSchema> = (values: PipelineCliValues<TSchema>, context: CliContext) => TOptions | Promise<TOptions>;
|
|
67
|
-
type DefaultPipelineCommandOptions<TSchema extends CliParamsSchema> = Omit<PipelineCliValues<TSchema>, "continueOnError" | "maxConcurrency" | "dryRun" | "resume" | "stepIds" | "targets">;
|
|
72
|
+
type DefaultPipelineCommandOptions<TSchema extends CliParamsSchema> = Omit<PipelineCliValues<TSchema>, "cache" | "continueOnError" | "maxConcurrency" | "dryRun" | "resume" | "stepIds" | "targets">;
|
|
68
73
|
type CanDefaultPipelineCommandOptions<TOptions extends object, TSchema extends CliParamsSchema> = DefaultPipelineCommandOptions<TSchema> extends TOptions ? Exclude<keyof TSchema, keyof TOptions> extends never ? true : false : false;
|
|
69
74
|
interface DefinePipelineCommandConfigBase<TResult, TSchema extends CliParamsSchema> {
|
|
70
75
|
/** Defaults to pipeline.name, then pipeline.id. */
|
|
@@ -5,8 +5,20 @@ import { markPipelineCommand } from "../utilities/pipeline-command-marker.js";
|
|
|
5
5
|
import {} from "../core/pipeline.js";
|
|
6
6
|
import { createPipelineReporter } from "../reporter/reporter-entry.js";
|
|
7
7
|
import { TUBELESS_WORKBENCH_EXIT_CODE } from "./cli-exit.js";
|
|
8
|
-
const PIPELINE_COMMAND_KEYS = new Set([
|
|
9
|
-
|
|
8
|
+
const PIPELINE_COMMAND_KEYS = new Set([
|
|
9
|
+
"cache",
|
|
10
|
+
"continueOnError",
|
|
11
|
+
"maxConcurrency",
|
|
12
|
+
"stepIds",
|
|
13
|
+
"targets",
|
|
14
|
+
]);
|
|
15
|
+
const PIPELINE_COMMAND_FLAGS = new Set([
|
|
16
|
+
"cache",
|
|
17
|
+
"continue-on-error",
|
|
18
|
+
"max-concurrency",
|
|
19
|
+
"step",
|
|
20
|
+
"target",
|
|
21
|
+
]);
|
|
10
22
|
function assertNoPipelineCommandConflicts(params) {
|
|
11
23
|
for (const [key, param] of Object.entries(params)) {
|
|
12
24
|
if (PIPELINE_COMMAND_KEYS.has(key)) {
|
|
@@ -36,6 +48,7 @@ function pipelineRunControlsFromCliValues(values) {
|
|
|
36
48
|
dryRun: values.dryRun,
|
|
37
49
|
continueOnError: values.continueOnError,
|
|
38
50
|
maxConcurrency: values.maxConcurrency,
|
|
51
|
+
...(values.cache !== undefined ? { cache: values.cache } : {}),
|
|
39
52
|
};
|
|
40
53
|
if (values.stepIds.length > 0)
|
|
41
54
|
controls.stepIds = values.stepIds;
|
|
@@ -53,7 +66,7 @@ function isHookConfigFunction(config) {
|
|
|
53
66
|
return typeof config === "function";
|
|
54
67
|
}
|
|
55
68
|
function defaultPipelineCommandOptions(values) {
|
|
56
|
-
const { continueOnError: _continueOnError, maxConcurrency: _maxConcurrency, dryRun: _dryRun, resume: _resume, stepIds: _stepIds, targets: _targets, ...domainValues } = values;
|
|
69
|
+
const { cache: _cache, continueOnError: _continueOnError, maxConcurrency: _maxConcurrency, dryRun: _dryRun, resume: _resume, stepIds: _stepIds, targets: _targets, ...domainValues } = values;
|
|
57
70
|
return domainValues;
|
|
58
71
|
}
|
|
59
72
|
function nonBlankPipelineText(value) {
|
|
@@ -72,6 +85,13 @@ export function definePipelineCommand(pipeline, config = {}) {
|
|
|
72
85
|
assertNoPipelineCommandConflicts(userParams);
|
|
73
86
|
const targetFlagEnabled = pipeline.targetIds.length > 0;
|
|
74
87
|
const bridgeParams = {
|
|
88
|
+
cache: {
|
|
89
|
+
type: "string",
|
|
90
|
+
choices: ["use", "recompute", "bypass"],
|
|
91
|
+
optional: true,
|
|
92
|
+
group: "execution",
|
|
93
|
+
description: "Override the cache policy for opted-in steps, including child pipelines.",
|
|
94
|
+
},
|
|
75
95
|
stepIds: {
|
|
76
96
|
type: "string",
|
|
77
97
|
multiple: true,
|
|
@@ -141,6 +161,7 @@ export function definePipelineCommand(pipeline, config = {}) {
|
|
|
141
161
|
dryRun: values.dryRun,
|
|
142
162
|
continueOnError: pipelineValues.continueOnError,
|
|
143
163
|
maxConcurrency: pipelineValues.maxConcurrency,
|
|
164
|
+
cache: pipelineValues.cache,
|
|
144
165
|
stepIds: pipelineValues.stepIds,
|
|
145
166
|
targets: targetFlagEnabled ? pipelineValues.targets : [],
|
|
146
167
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-pipeline-command.js","sourceRoot":"","sources":["../../src/cli/cli-pipeline-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EASN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAA+B,MAAM,+BAA+B,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AA8H7D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AACnG,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,MAA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AAC,MAAM,CAAC,EAAE;YAChF,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;IAED,SAAS,IAAI,CAAC,QAAQ,GAAqC,EAAE;QAC3D,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,WAAW,CAClB,MAA+B,EAC/B,gBAAsC;QAEtC,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;YAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,0BAA0B,CAAU,MAAM,CAAC,MAAM,CAAC,EAAE;YAChF,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;IAED,OAAO,mBAAmB,CACxB;QACE,QAAQ;QACR,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE;QACpC,qFAAqF;QACrF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,MAAkD,EAAE,gBAAgB,CAAC;QACvF,KAAK;QACL,WAAW;QACX,IAAI;QACJ,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;QACnD,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,EACD,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { createCommand } from \"./cli-command.js\";\nimport { flagName } from \"./cli-parser.js\";\nimport {\n inferCliParams,\n type InferredCliParams,\n type InferredFlagOverrides,\n} from \"./cli-schema.js\";\nimport type {\n CliBooleanParam,\n CliCheckpointConfig,\n CliCommandConfig,\n CliCommandDescriptor,\n CliContext,\n CliNumberParam,\n CliParams,\n CliParamsSchema,\n CliStringParam,\n} from \"./cli-types.js\";\nimport { markPipelineCommand } from \"../utilities/pipeline-command-marker.js\";\nimport {\n type Pipeline,\n type PipelineHooks,\n type PipelineInput,\n type PipelineMermaidOptions,\n type PipelinePlan,\n type PipelineResult,\n type PipelineRunControls,\n type StandardSchemaV1,\n} from \"../core/pipeline.js\";\nimport { createPipelineReporter, type PipelineReporterConfig } from \"../reporter/reporter-entry.js\";\nimport { TUBELESS_WORKBENCH_EXIT_CODE } from \"./cli-exit.js\";\n\nexport type PipelineCliBuiltins = {\n stepIds: CliStringParam & { multiple: true };\n targets: CliStringParam & { multiple: true };\n continueOnError: CliBooleanParam;\n maxConcurrency: CliNumberParam;\n};\n\n/** Validated domain parameters plus the built-in pipeline execution controls. */\nexport type PipelineCliValues<TSchema extends CliParamsSchema> = CliParams<TSchema> & {\n stepIds: readonly string[];\n targets: readonly string[];\n continueOnError: boolean;\n maxConcurrency: number;\n};\n\n/** Parse result returned by commands created with `definePipelineCommand`. */\nexport type PipelineCliParseResult<TSchema extends CliParamsSchema> =\n | { kind: \"values\"; values: PipelineCliValues<TSchema> }\n | { kind: \"help\"; helpText: string }\n | { kind: \"error\"; errors: readonly string[]; helpText: string };\n\n/** Typed CLI facade over a pipeline with planning and graph helpers. */\nexport interface PipelineCommand<\n TSchema extends CliParamsSchema,\n TResult,\n TPipeline extends Pipeline<object, unknown> = Pipeline<object, TResult>,\n> {\n /** Exact pipeline adapted by this command. */\n readonly pipeline: TPipeline;\n readonly descriptor: CliCommandDescriptor;\n /** Stable identity of the wrapped pipeline. */\n readonly id: TPipeline[\"id\"];\n /** Stable definition-order step ids for discovery surfaces such as CLI help. */\n readonly stepIds: TPipeline[\"stepIds\"];\n /** Stable declared goal ids that support dependency-aware target execution. */\n readonly targetIds: TPipeline[\"targetIds\"];\n /** Plan without parsing or requiring domain parameters. */\n plan(controls?: Parameters<TPipeline[\"plan\"]>[0]): PipelinePlan;\n /** Generate a static Mermaid flowchart without running or planning the pipeline. */\n toMermaid(options?: PipelineMermaidOptions): string;\n parse(argv?: readonly string[], context?: Partial<CliContext>): PipelineCliParseResult<TSchema>;\n /** Validate structured form values without tokenizing argv. */\n parseValues(\n values: Record<string, unknown>,\n context?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema>;\n /** Execute already validated form values. */\n execute(values: PipelineCliValues<TSchema>, context?: Partial<CliContext>): Promise<TResult>;\n run(argv?: readonly string[], context?: Partial<CliContext>): Promise<TResult>;\n main(argv?: readonly string[], context?: Partial<CliContext>): Promise<void>;\n}\n\n/** Parsed values and CLI services passed to a pipeline hook factory. */\nexport interface PipelineCommandHookContext<TSchema extends CliParamsSchema> {\n context: CliContext;\n values: PipelineCliValues<TSchema>;\n}\n\n/** One lifecycle hook set or an ordered collection of hook sets. */\ntype PipelineCommandHookSets<TResult> = PipelineHooks<TResult> | readonly PipelineHooks<TResult>[];\n\n/** Static or lazily constructed lifecycle hooks for a pipeline command. */\nexport type PipelineCommandHookConfig<TResult, TSchema extends CliParamsSchema> =\n | PipelineCommandHookSets<TResult>\n | ((input: PipelineCommandHookContext<TSchema>) => PipelineCommandHookSets<TResult> | undefined);\n\ntype PipelineCommandMapOptions<TOptions extends object, TSchema extends CliParamsSchema> = (\n values: PipelineCliValues<TSchema>,\n context: CliContext\n) => TOptions | Promise<TOptions>;\n\ntype DefaultPipelineCommandOptions<TSchema extends CliParamsSchema> = Omit<\n PipelineCliValues<TSchema>,\n \"continueOnError\" | \"maxConcurrency\" | \"dryRun\" | \"resume\" | \"stepIds\" | \"targets\"\n>;\n\ntype CanDefaultPipelineCommandOptions<TOptions extends object, TSchema extends CliParamsSchema> =\n DefaultPipelineCommandOptions<TSchema> extends TOptions\n ? Exclude<keyof TSchema, keyof TOptions> extends never\n ? true\n : false\n : false;\n\ninterface DefinePipelineCommandConfigBase<TResult, TSchema extends CliParamsSchema> {\n /** Defaults to pipeline.name, then pipeline.id. */\n name?: string;\n /** Defaults to pipeline.description. */\n description?: string;\n /** Advanced: replace inferred flags for type-only pipelines or custom CLI inputs. */\n params?: TSchema;\n /** Extra parameter keys accepted in positional order. */\n positionals?: readonly (keyof TSchema & string)[];\n checkpoint?: CliCheckpointConfig;\n /** Expose resume input for application-owned handling without managed checkpointing. */\n resume?: true;\n /** Additional lifecycle hooks, or a factory resolved from parsed values and CLI context. */\n hooks?: PipelineCommandHookConfig<TResult, TSchema>;\n /** Configure plain/interactive reporting, or disable it. Defaults to automatic mode. */\n reporter?: false | PipelineReporterConfig;\n /** Print domain-specific result lines after a successful run. */\n summarize?(\n result: TResult,\n values: PipelineCliValues<TSchema>,\n context: CliContext\n ): readonly string[] | void;\n validate?(values: PipelineCliValues<TSchema>, context: CliContext): string[] | void;\n}\n\n/** Configuration for a typed pipeline command. Mapping is optional only for compatible flags. */\nexport type DefinePipelineCommandConfig<\n TOptions extends object,\n TResult,\n TSchema extends CliParamsSchema,\n> = DefinePipelineCommandConfigBase<TResult, TSchema> &\n (CanDefaultPipelineCommandOptions<TOptions, TSchema> extends true\n ? {\n /** Override the default same-name flag-to-option mapping. */\n mapOptions?: PipelineCommandMapOptions<TOptions, TSchema>;\n }\n : {\n /** Required when parsed flags do not already satisfy the pipeline's domain options. */\n mapOptions: PipelineCommandMapOptions<TOptions, TSchema>;\n });\n\nconst PIPELINE_COMMAND_KEYS = new Set([\"continueOnError\", \"maxConcurrency\", \"stepIds\", \"targets\"]);\nconst PIPELINE_COMMAND_FLAGS = new Set([\"continue-on-error\", \"max-concurrency\", \"step\", \"target\"]);\n\nfunction assertNoPipelineCommandConflicts(params: CliParamsSchema): void {\n for (const [key, param] of Object.entries(params)) {\n if (PIPELINE_COMMAND_KEYS.has(key)) {\n throw new Error(\n `\"${key}\" is a reserved parameter provided automatically by pipeline commands; remove it from params.`\n );\n }\n const flag = flagName(key, param);\n if (PIPELINE_COMMAND_FLAGS.has(flag)) {\n throw new Error(\n `--${flag} is a reserved flag provided automatically by pipeline commands; remove \"${key}\" from params or give it a different flag name.`\n );\n }\n }\n}\n\nfunction normalizePipelineCliValues<TSchema extends CliParamsSchema>(\n values: CliParams<PipelineCliBuiltins & TSchema>\n): PipelineCliValues<TSchema> {\n // SAFETY: `PipelineCliValues<TSchema>` is `CliParams<TSchema>` plus the builtin\n // `stepIds`/`targets`/`continueOnError`/`maxConcurrency` keys, which `CliParams<PipelineCliBuiltins & TSchema>`\n // already provides, so the runtime shape matches the target type.\n const pipelineValues = values as PipelineCliValues<TSchema>;\n const { continueOnError, stepIds, targets } = pipelineValues;\n return {\n ...pipelineValues,\n continueOnError,\n stepIds,\n targets: targets ?? [],\n };\n}\n\nfunction pipelineRunControlsFromCliValues(values: {\n continueOnError: boolean;\n maxConcurrency: number;\n dryRun: boolean;\n stepIds: readonly string[];\n targets: readonly string[];\n}): PipelineRunControls {\n const controls: PipelineRunControls = {\n dryRun: values.dryRun,\n continueOnError: values.continueOnError,\n maxConcurrency: values.maxConcurrency,\n };\n if (values.stepIds.length > 0) controls.stepIds = values.stepIds;\n if (values.targets.length > 0) controls.targets = values.targets;\n return controls;\n}\n\nfunction normalizePipelineHookSets<TResult>(\n hooks: PipelineCommandHookSets<TResult> | undefined\n): PipelineHooks<TResult>[] {\n if (!hooks) return [];\n // SAFETY: a non-array `PipelineCommandHookSets` is always a single `PipelineHooks`.\n return Array.isArray(hooks) ? [...hooks] : [hooks as PipelineHooks<TResult>];\n}\n\nfunction isHookConfigFunction<TResult, TSchema extends CliParamsSchema>(\n config: PipelineCommandHookConfig<TResult, TSchema> | undefined\n): config is (\n input: PipelineCommandHookContext<TSchema>\n) => PipelineCommandHookSets<TResult> | undefined {\n return typeof config === \"function\";\n}\n\nfunction defaultPipelineCommandOptions<TSchema extends CliParamsSchema>(\n values: PipelineCliValues<TSchema>\n): DefaultPipelineCommandOptions<TSchema> {\n const {\n continueOnError: _continueOnError,\n maxConcurrency: _maxConcurrency,\n dryRun: _dryRun,\n resume: _resume,\n stepIds: _stepIds,\n targets: _targets,\n ...domainValues\n } = values;\n return domainValues;\n}\n\nfunction nonBlankPipelineText(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value : undefined;\n}\n\n/** Turn a pipeline into a CLI; infer domain flags from its Standard JSON Schema input. */\nexport function definePipelineCommand<const TPipeline extends Pipeline<object, unknown>>(\n pipeline: TPipeline &\n (keyof PipelineInput<TPipeline> extends never\n ? unknown\n : { readonly optionsSchema: StandardSchemaV1 }),\n config?: Omit<\n DefinePipelineCommandConfigBase<\n PipelineResult<TPipeline>,\n InferredCliParams<NoInfer<PipelineInput<TPipeline>>>\n >,\n \"params\"\n > & {\n params?: never;\n mapOptions?: never;\n /** Advanced: customize flag spelling, aliases, help or environment fallbacks. */\n overrides?: InferredFlagOverrides<NoInfer<PipelineInput<TPipeline>>>;\n }\n): PipelineCommand<\n InferredCliParams<PipelineInput<TPipeline>>,\n PipelineResult<TPipeline>,\n TPipeline\n>;\n/** Advanced: declare CLI inputs explicitly, mapping them only when their shape differs. */\nexport function definePipelineCommand<\n const TPipeline extends Pipeline<object, unknown>,\n const TSchema extends CliParamsSchema = {},\n>(\n pipeline: TPipeline,\n config: DefinePipelineCommandConfig<\n NoInfer<PipelineInput<TPipeline>>,\n PipelineResult<TPipeline>,\n TSchema\n >\n): PipelineCommand<TSchema, PipelineResult<TPipeline>, TPipeline>;\nexport function definePipelineCommand<\n const TPipeline extends Pipeline<object, unknown>,\n const TSchema extends CliParamsSchema = {},\n>(\n pipeline: TPipeline,\n config: DefinePipelineCommandConfigBase<PipelineResult<TPipeline>, TSchema> & {\n mapOptions?: PipelineCommandMapOptions<PipelineInput<TPipeline>, TSchema>;\n overrides?: InferredFlagOverrides<PipelineInput<TPipeline>>;\n } = {}\n): PipelineCommand<TSchema, PipelineResult<TPipeline>, TPipeline> {\n type TOptions = PipelineInput<TPipeline>;\n type TResult = PipelineResult<TPipeline>;\n // SAFETY: explicit params retain TSchema; the inferred overload derives its schema\n // from the same pipeline input type. Type-only pipelines have no runtime fields.\n const userParams = (config.params ??\n (pipeline.optionsSchema && !config.mapOptions\n ? inferCliParams(pipeline.optionsSchema, config.overrides)\n : {})) as TSchema;\n if (config.overrides && (config.params || config.mapOptions || !pipeline.optionsSchema)) {\n throw new Error(\n \"Flag overrides require inferred pipeline flags; use params for an explicit CLI.\"\n );\n }\n assertNoPipelineCommandConflicts(userParams);\n\n const targetFlagEnabled = pipeline.targetIds.length > 0;\n const bridgeParams: CliParamsSchema = {\n stepIds: {\n type: \"string\",\n multiple: true,\n flag: \"step\",\n group: \"execution\",\n exclusive: true,\n choices: pipeline.stepIds,\n description: `Run exactly this step. Steps: ${pipeline.stepIds.join(\", \")}`,\n },\n continueOnError: {\n type: \"boolean\",\n group: \"execution\",\n description: \"Continue independent work after a step fails.\",\n },\n maxConcurrency: {\n type: \"number\",\n group: \"execution\",\n default: 1,\n integer: true,\n min: 1,\n description: \"Maximum simultaneous steps in this run.\",\n },\n };\n if (targetFlagEnabled) {\n bridgeParams.targets = {\n type: \"string\",\n multiple: true,\n flag: \"target\",\n group: \"execution\",\n exclusive: true,\n choices: pipeline.targetIds,\n description: `Run this declared target and its prerequisites. Targets: ${pipeline.targetIds.join(\", \")}`,\n };\n }\n\n // SAFETY: `bridgeParams` supplies the `PipelineCliBuiltins` keys and `userParams` is\n // `TSchema`, so the merged object satisfies `PipelineCliBuiltins & TSchema`.\n const params = { ...bridgeParams, ...userParams } as PipelineCliBuiltins & TSchema;\n const inheritedName = nonBlankPipelineText(pipeline.name);\n const inheritedDescription = nonBlankPipelineText(pipeline.description);\n\n const commandConfig = {\n name: config.name ?? inheritedName ?? pipeline.id,\n description: config.description ?? inheritedDescription,\n params,\n positionals: config.positionals,\n checkpoint: config.checkpoint,\n resume: config.resume,\n validate: (values, context) => {\n const pipelineValues = normalizePipelineCliValues<TSchema>(values);\n const errors = config.validate?.(pipelineValues, context) ?? [];\n if (pipelineValues.stepIds.length > 0 && pipelineValues.targets.length > 0) {\n return [\"--step and --target cannot be used together.\", ...errors];\n }\n return errors.length > 0 ? errors : undefined;\n },\n run: async (values, cliContext) => {\n const pipelineValues = normalizePipelineCliValues<TSchema>(values);\n let mapped: TOptions;\n if (config.mapOptions) {\n mapped = await config.mapOptions(pipelineValues, cliContext);\n } else {\n // SAFETY: `defaultPipelineCommandOptions` returns exactly the domain options the\n // `CanDefaultPipelineCommandOptions` constraint guarantees map to `TOptions`.\n mapped = defaultPipelineCommandOptions(pipelineValues) as TOptions;\n }\n const controls = pipelineRunControlsFromCliValues({\n dryRun: values.dryRun,\n continueOnError: pipelineValues.continueOnError,\n maxConcurrency: pipelineValues.maxConcurrency,\n stepIds: pipelineValues.stepIds,\n targets: targetFlagEnabled ? pipelineValues.targets : [],\n });\n\n const reporter =\n config.reporter === false\n ? undefined\n : createPipelineReporter<TResult>({\n log: cliContext.log,\n ...(config.reporter ?? {}),\n ...(cliContext.reporterOutput ? { output: cliContext.reporterOutput } : {}),\n });\n const runtimeContext = reporter ? { ...cliContext, log: reporter.log } : cliContext;\n let result: TResult;\n try {\n const configuredHooks = isHookConfigFunction(config.hooks)\n ? config.hooks({ context: runtimeContext, values: pipelineValues })\n : config.hooks;\n const hooks: PipelineHooks<TResult>[] = [\n ...normalizePipelineHookSets(cliContext.pipelineContext?.hooks),\n ...(reporter ? [reporter.hooks] : []),\n ...normalizePipelineHookSets(configuredHooks),\n ];\n\n // SAFETY: TResult is extracted from this exact pipeline's runOrThrow return type.\n result = (await pipeline.runOrThrow(mapped, controls, {\n ...cliContext.pipelineContext,\n cwd: runtimeContext.cwd,\n log: runtimeContext.log,\n hooks: hooks.length > 0 ? hooks : undefined,\n signal: runtimeContext.signal,\n })) as TResult;\n } finally {\n reporter?.dispose();\n }\n for (const line of config.summarize?.(result, pipelineValues, cliContext) ?? []) {\n cliContext.log.log(line);\n }\n return result;\n },\n } satisfies CliCommandConfig<PipelineCliBuiltins & TSchema, TResult>;\n\n const command = createCommand(commandConfig, {\n validation: TUBELESS_WORKBENCH_EXIT_CODE.validation,\n });\n\n function parse(\n argv: readonly string[] = process.argv.slice(2),\n contextOverrides?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema> {\n const result = command.parse(argv, contextOverrides);\n return result.kind === \"values\"\n ? { kind: \"values\", values: normalizePipelineCliValues<TSchema>(result.values) }\n : result;\n }\n\n function plan(controls: Parameters<TPipeline[\"plan\"]>[0] = {}): PipelinePlan {\n return pipeline.plan(controls);\n }\n\n function parseValues(\n values: Record<string, unknown>,\n contextOverrides?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema> {\n const result = command.parseValues(values, contextOverrides);\n return result.kind === \"values\"\n ? { kind: \"values\", values: normalizePipelineCliValues<TSchema>(result.values) }\n : result;\n }\n\n return markPipelineCommand(\n {\n pipeline,\n descriptor: command.descriptor,\n id: pipeline.id,\n stepIds: pipeline.stepIds,\n targetIds: pipeline.targetIds,\n execute: (values, contextOverrides) =>\n // SAFETY: `execute` receives `PipelineCliValues<TSchema>` from the public interface,\n // which is a subtype of `CliParams<PipelineCliBuiltins & TSchema>`.\n command.execute(values as CliParams<PipelineCliBuiltins & TSchema>, contextOverrides),\n parse,\n parseValues,\n plan,\n toMermaid: (options) => pipeline.toMermaid(options),\n run: command.run,\n main: command.main,\n },\n pipeline\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cli-pipeline-command.js","sourceRoot":"","sources":["../../src/cli/cli-pipeline-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAUN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAA+B,MAAM,+BAA+B,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAA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AAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE;QACpC,qFAAqF;QACrF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,MAAkD,EAAE,gBAAgB,CAAC;QACvF,KAAK;QACL,WAAW;QACX,IAAI;QACJ,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;QACnD,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,EACD,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { createCommand } from \"./cli-command.js\";\nimport { flagName } from \"./cli-parser.js\";\nimport {\n inferCliParams,\n type InferredCliParams,\n type InferredFlagOverrides,\n} from \"./cli-schema.js\";\nimport type {\n CliBooleanParam,\n CliCheckpointConfig,\n CliCommandConfig,\n CliCommandDescriptor,\n CliContext,\n CliNumberParam,\n CliParams,\n CliParamsSchema,\n CliStringParam,\n} from \"./cli-types.js\";\nimport { markPipelineCommand } from \"../utilities/pipeline-command-marker.js\";\nimport {\n type Pipeline,\n type PipelineHooks,\n type PipelineInput,\n type PipelineMermaidOptions,\n type StepCachePolicy,\n type PipelinePlan,\n type PipelineResult,\n type PipelineRunControls,\n type StandardSchemaV1,\n} from \"../core/pipeline.js\";\nimport { createPipelineReporter, type PipelineReporterConfig } from \"../reporter/reporter-entry.js\";\nimport { TUBELESS_WORKBENCH_EXIT_CODE } from \"./cli-exit.js\";\n\nexport type PipelineCliBuiltins = {\n stepIds: CliStringParam & { multiple: true };\n targets: CliStringParam & { multiple: true };\n continueOnError: CliBooleanParam;\n maxConcurrency: CliNumberParam;\n cache: CliStringParam & { choices: readonly [\"use\", \"recompute\", \"bypass\"]; optional: true };\n};\n\n/** Validated domain parameters plus the built-in pipeline execution controls. */\nexport type PipelineCliValues<TSchema extends CliParamsSchema> = CliParams<TSchema> & {\n stepIds: readonly string[];\n targets: readonly string[];\n continueOnError: boolean;\n maxConcurrency: number;\n cache?: StepCachePolicy;\n};\n\n/** Parse result returned by commands created with `definePipelineCommand`. */\nexport type PipelineCliParseResult<TSchema extends CliParamsSchema> =\n | { kind: \"values\"; values: PipelineCliValues<TSchema> }\n | { kind: \"help\"; helpText: string }\n | { kind: \"error\"; errors: readonly string[]; helpText: string };\n\n/** Typed CLI facade over a pipeline with planning and graph helpers. */\nexport interface PipelineCommand<\n TSchema extends CliParamsSchema,\n TResult,\n TPipeline extends Pipeline<object, unknown> = Pipeline<object, TResult>,\n> {\n /** Exact pipeline adapted by this command. */\n readonly pipeline: TPipeline;\n readonly descriptor: CliCommandDescriptor;\n /** Stable identity of the wrapped pipeline. */\n readonly id: TPipeline[\"id\"];\n /** Stable definition-order step ids for discovery surfaces such as CLI help. */\n readonly stepIds: TPipeline[\"stepIds\"];\n /** Stable declared goal ids that support dependency-aware target execution. */\n readonly targetIds: TPipeline[\"targetIds\"];\n /** Plan without parsing or requiring domain parameters. */\n plan(controls?: Parameters<TPipeline[\"plan\"]>[0]): PipelinePlan;\n /** Generate a static Mermaid flowchart without running or planning the pipeline. */\n toMermaid(options?: PipelineMermaidOptions): string;\n parse(argv?: readonly string[], context?: Partial<CliContext>): PipelineCliParseResult<TSchema>;\n /** Validate structured form values without tokenizing argv. */\n parseValues(\n values: Record<string, unknown>,\n context?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema>;\n /** Execute already validated form values. */\n execute(values: PipelineCliValues<TSchema>, context?: Partial<CliContext>): Promise<TResult>;\n run(argv?: readonly string[], context?: Partial<CliContext>): Promise<TResult>;\n main(argv?: readonly string[], context?: Partial<CliContext>): Promise<void>;\n}\n\n/** Parsed values and CLI services passed to a pipeline hook factory. */\nexport interface PipelineCommandHookContext<TSchema extends CliParamsSchema> {\n context: CliContext;\n values: PipelineCliValues<TSchema>;\n}\n\n/** One lifecycle hook set or an ordered collection of hook sets. */\ntype PipelineCommandHookSets<TResult> = PipelineHooks<TResult> | readonly PipelineHooks<TResult>[];\n\n/** Static or lazily constructed lifecycle hooks for a pipeline command. */\nexport type PipelineCommandHookConfig<TResult, TSchema extends CliParamsSchema> =\n | PipelineCommandHookSets<TResult>\n | ((input: PipelineCommandHookContext<TSchema>) => PipelineCommandHookSets<TResult> | undefined);\n\ntype PipelineCommandMapOptions<TOptions extends object, TSchema extends CliParamsSchema> = (\n values: PipelineCliValues<TSchema>,\n context: CliContext\n) => TOptions | Promise<TOptions>;\n\ntype DefaultPipelineCommandOptions<TSchema extends CliParamsSchema> = Omit<\n PipelineCliValues<TSchema>,\n \"cache\" | \"continueOnError\" | \"maxConcurrency\" | \"dryRun\" | \"resume\" | \"stepIds\" | \"targets\"\n>;\n\ntype CanDefaultPipelineCommandOptions<TOptions extends object, TSchema extends CliParamsSchema> =\n DefaultPipelineCommandOptions<TSchema> extends TOptions\n ? Exclude<keyof TSchema, keyof TOptions> extends never\n ? true\n : false\n : false;\n\ninterface DefinePipelineCommandConfigBase<TResult, TSchema extends CliParamsSchema> {\n /** Defaults to pipeline.name, then pipeline.id. */\n name?: string;\n /** Defaults to pipeline.description. */\n description?: string;\n /** Advanced: replace inferred flags for type-only pipelines or custom CLI inputs. */\n params?: TSchema;\n /** Extra parameter keys accepted in positional order. */\n positionals?: readonly (keyof TSchema & string)[];\n checkpoint?: CliCheckpointConfig;\n /** Expose resume input for application-owned handling without managed checkpointing. */\n resume?: true;\n /** Additional lifecycle hooks, or a factory resolved from parsed values and CLI context. */\n hooks?: PipelineCommandHookConfig<TResult, TSchema>;\n /** Configure plain/interactive reporting, or disable it. Defaults to automatic mode. */\n reporter?: false | PipelineReporterConfig;\n /** Print domain-specific result lines after a successful run. */\n summarize?(\n result: TResult,\n values: PipelineCliValues<TSchema>,\n context: CliContext\n ): readonly string[] | void;\n validate?(values: PipelineCliValues<TSchema>, context: CliContext): string[] | void;\n}\n\n/** Configuration for a typed pipeline command. Mapping is optional only for compatible flags. */\nexport type DefinePipelineCommandConfig<\n TOptions extends object,\n TResult,\n TSchema extends CliParamsSchema,\n> = DefinePipelineCommandConfigBase<TResult, TSchema> &\n (CanDefaultPipelineCommandOptions<TOptions, TSchema> extends true\n ? {\n /** Override the default same-name flag-to-option mapping. */\n mapOptions?: PipelineCommandMapOptions<TOptions, TSchema>;\n }\n : {\n /** Required when parsed flags do not already satisfy the pipeline's domain options. */\n mapOptions: PipelineCommandMapOptions<TOptions, TSchema>;\n });\n\nconst PIPELINE_COMMAND_KEYS = new Set([\n \"cache\",\n \"continueOnError\",\n \"maxConcurrency\",\n \"stepIds\",\n \"targets\",\n]);\nconst PIPELINE_COMMAND_FLAGS = new Set([\n \"cache\",\n \"continue-on-error\",\n \"max-concurrency\",\n \"step\",\n \"target\",\n]);\n\nfunction assertNoPipelineCommandConflicts(params: CliParamsSchema): void {\n for (const [key, param] of Object.entries(params)) {\n if (PIPELINE_COMMAND_KEYS.has(key)) {\n throw new Error(\n `\"${key}\" is a reserved parameter provided automatically by pipeline commands; remove it from params.`\n );\n }\n const flag = flagName(key, param);\n if (PIPELINE_COMMAND_FLAGS.has(flag)) {\n throw new Error(\n `--${flag} is a reserved flag provided automatically by pipeline commands; remove \"${key}\" from params or give it a different flag name.`\n );\n }\n }\n}\n\nfunction normalizePipelineCliValues<TSchema extends CliParamsSchema>(\n values: CliParams<PipelineCliBuiltins & TSchema>\n): PipelineCliValues<TSchema> {\n // SAFETY: `PipelineCliValues<TSchema>` is `CliParams<TSchema>` plus the builtin\n // `stepIds`/`targets`/`continueOnError`/`maxConcurrency` keys, which `CliParams<PipelineCliBuiltins & TSchema>`\n // already provides, so the runtime shape matches the target type.\n const pipelineValues = values as PipelineCliValues<TSchema>;\n const { continueOnError, stepIds, targets } = pipelineValues;\n return {\n ...pipelineValues,\n continueOnError,\n stepIds,\n targets: targets ?? [],\n };\n}\n\nfunction pipelineRunControlsFromCliValues(values: {\n continueOnError: boolean;\n maxConcurrency: number;\n cache?: StepCachePolicy;\n dryRun: boolean;\n stepIds: readonly string[];\n targets: readonly string[];\n}): PipelineRunControls {\n const controls: PipelineRunControls = {\n dryRun: values.dryRun,\n continueOnError: values.continueOnError,\n maxConcurrency: values.maxConcurrency,\n ...(values.cache !== undefined ? { cache: values.cache } : {}),\n };\n if (values.stepIds.length > 0) controls.stepIds = values.stepIds;\n if (values.targets.length > 0) controls.targets = values.targets;\n return controls;\n}\n\nfunction normalizePipelineHookSets<TResult>(\n hooks: PipelineCommandHookSets<TResult> | undefined\n): PipelineHooks<TResult>[] {\n if (!hooks) return [];\n // SAFETY: a non-array `PipelineCommandHookSets` is always a single `PipelineHooks`.\n return Array.isArray(hooks) ? [...hooks] : [hooks as PipelineHooks<TResult>];\n}\n\nfunction isHookConfigFunction<TResult, TSchema extends CliParamsSchema>(\n config: PipelineCommandHookConfig<TResult, TSchema> | undefined\n): config is (\n input: PipelineCommandHookContext<TSchema>\n) => PipelineCommandHookSets<TResult> | undefined {\n return typeof config === \"function\";\n}\n\nfunction defaultPipelineCommandOptions<TSchema extends CliParamsSchema>(\n values: PipelineCliValues<TSchema>\n): DefaultPipelineCommandOptions<TSchema> {\n const {\n cache: _cache,\n continueOnError: _continueOnError,\n maxConcurrency: _maxConcurrency,\n dryRun: _dryRun,\n resume: _resume,\n stepIds: _stepIds,\n targets: _targets,\n ...domainValues\n } = values;\n return domainValues;\n}\n\nfunction nonBlankPipelineText(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value : undefined;\n}\n\n/** Turn a pipeline into a CLI; infer domain flags from its Standard JSON Schema input. */\nexport function definePipelineCommand<const TPipeline extends Pipeline<object, unknown>>(\n pipeline: TPipeline &\n (keyof PipelineInput<TPipeline> extends never\n ? unknown\n : { readonly optionsSchema: StandardSchemaV1 }),\n config?: Omit<\n DefinePipelineCommandConfigBase<\n PipelineResult<TPipeline>,\n InferredCliParams<NoInfer<PipelineInput<TPipeline>>>\n >,\n \"params\"\n > & {\n params?: never;\n mapOptions?: never;\n /** Advanced: customize flag spelling, aliases, help or environment fallbacks. */\n overrides?: InferredFlagOverrides<NoInfer<PipelineInput<TPipeline>>>;\n }\n): PipelineCommand<\n InferredCliParams<PipelineInput<TPipeline>>,\n PipelineResult<TPipeline>,\n TPipeline\n>;\n/** Advanced: declare CLI inputs explicitly, mapping them only when their shape differs. */\nexport function definePipelineCommand<\n const TPipeline extends Pipeline<object, unknown>,\n const TSchema extends CliParamsSchema = {},\n>(\n pipeline: TPipeline,\n config: DefinePipelineCommandConfig<\n NoInfer<PipelineInput<TPipeline>>,\n PipelineResult<TPipeline>,\n TSchema\n >\n): PipelineCommand<TSchema, PipelineResult<TPipeline>, TPipeline>;\nexport function definePipelineCommand<\n const TPipeline extends Pipeline<object, unknown>,\n const TSchema extends CliParamsSchema = {},\n>(\n pipeline: TPipeline,\n config: DefinePipelineCommandConfigBase<PipelineResult<TPipeline>, TSchema> & {\n mapOptions?: PipelineCommandMapOptions<PipelineInput<TPipeline>, TSchema>;\n overrides?: InferredFlagOverrides<PipelineInput<TPipeline>>;\n } = {}\n): PipelineCommand<TSchema, PipelineResult<TPipeline>, TPipeline> {\n type TOptions = PipelineInput<TPipeline>;\n type TResult = PipelineResult<TPipeline>;\n // SAFETY: explicit params retain TSchema; the inferred overload derives its schema\n // from the same pipeline input type. Type-only pipelines have no runtime fields.\n const userParams = (config.params ??\n (pipeline.optionsSchema && !config.mapOptions\n ? inferCliParams(pipeline.optionsSchema, config.overrides)\n : {})) as TSchema;\n if (config.overrides && (config.params || config.mapOptions || !pipeline.optionsSchema)) {\n throw new Error(\n \"Flag overrides require inferred pipeline flags; use params for an explicit CLI.\"\n );\n }\n assertNoPipelineCommandConflicts(userParams);\n\n const targetFlagEnabled = pipeline.targetIds.length > 0;\n const bridgeParams: CliParamsSchema = {\n cache: {\n type: \"string\",\n choices: [\"use\", \"recompute\", \"bypass\"],\n optional: true,\n group: \"execution\",\n description: \"Override the cache policy for opted-in steps, including child pipelines.\",\n },\n stepIds: {\n type: \"string\",\n multiple: true,\n flag: \"step\",\n group: \"execution\",\n exclusive: true,\n choices: pipeline.stepIds,\n description: `Run exactly this step. Steps: ${pipeline.stepIds.join(\", \")}`,\n },\n continueOnError: {\n type: \"boolean\",\n group: \"execution\",\n description: \"Continue independent work after a step fails.\",\n },\n maxConcurrency: {\n type: \"number\",\n group: \"execution\",\n default: 1,\n integer: true,\n min: 1,\n description: \"Maximum simultaneous steps in this run.\",\n },\n };\n if (targetFlagEnabled) {\n bridgeParams.targets = {\n type: \"string\",\n multiple: true,\n flag: \"target\",\n group: \"execution\",\n exclusive: true,\n choices: pipeline.targetIds,\n description: `Run this declared target and its prerequisites. Targets: ${pipeline.targetIds.join(\", \")}`,\n };\n }\n\n // SAFETY: `bridgeParams` supplies the `PipelineCliBuiltins` keys and `userParams` is\n // `TSchema`, so the merged object satisfies `PipelineCliBuiltins & TSchema`.\n const params = { ...bridgeParams, ...userParams } as PipelineCliBuiltins & TSchema;\n const inheritedName = nonBlankPipelineText(pipeline.name);\n const inheritedDescription = nonBlankPipelineText(pipeline.description);\n\n const commandConfig = {\n name: config.name ?? inheritedName ?? pipeline.id,\n description: config.description ?? inheritedDescription,\n params,\n positionals: config.positionals,\n checkpoint: config.checkpoint,\n resume: config.resume,\n validate: (values, context) => {\n const pipelineValues = normalizePipelineCliValues<TSchema>(values);\n const errors = config.validate?.(pipelineValues, context) ?? [];\n if (pipelineValues.stepIds.length > 0 && pipelineValues.targets.length > 0) {\n return [\"--step and --target cannot be used together.\", ...errors];\n }\n return errors.length > 0 ? errors : undefined;\n },\n run: async (values, cliContext) => {\n const pipelineValues = normalizePipelineCliValues<TSchema>(values);\n let mapped: TOptions;\n if (config.mapOptions) {\n mapped = await config.mapOptions(pipelineValues, cliContext);\n } else {\n // SAFETY: `defaultPipelineCommandOptions` returns exactly the domain options the\n // `CanDefaultPipelineCommandOptions` constraint guarantees map to `TOptions`.\n mapped = defaultPipelineCommandOptions(pipelineValues) as TOptions;\n }\n const controls = pipelineRunControlsFromCliValues({\n dryRun: values.dryRun,\n continueOnError: pipelineValues.continueOnError,\n maxConcurrency: pipelineValues.maxConcurrency,\n cache: pipelineValues.cache,\n stepIds: pipelineValues.stepIds,\n targets: targetFlagEnabled ? pipelineValues.targets : [],\n });\n\n const reporter =\n config.reporter === false\n ? undefined\n : createPipelineReporter<TResult>({\n log: cliContext.log,\n ...(config.reporter ?? {}),\n ...(cliContext.reporterOutput ? { output: cliContext.reporterOutput } : {}),\n });\n const runtimeContext = reporter ? { ...cliContext, log: reporter.log } : cliContext;\n let result: TResult;\n try {\n const configuredHooks = isHookConfigFunction(config.hooks)\n ? config.hooks({ context: runtimeContext, values: pipelineValues })\n : config.hooks;\n const hooks: PipelineHooks<TResult>[] = [\n ...normalizePipelineHookSets(cliContext.pipelineContext?.hooks),\n ...(reporter ? [reporter.hooks] : []),\n ...normalizePipelineHookSets(configuredHooks),\n ];\n\n // SAFETY: TResult is extracted from this exact pipeline's runOrThrow return type.\n result = (await pipeline.runOrThrow(mapped, controls, {\n ...cliContext.pipelineContext,\n cwd: runtimeContext.cwd,\n log: runtimeContext.log,\n hooks: hooks.length > 0 ? hooks : undefined,\n signal: runtimeContext.signal,\n })) as TResult;\n } finally {\n reporter?.dispose();\n }\n for (const line of config.summarize?.(result, pipelineValues, cliContext) ?? []) {\n cliContext.log.log(line);\n }\n return result;\n },\n } satisfies CliCommandConfig<PipelineCliBuiltins & TSchema, TResult>;\n\n const command = createCommand(commandConfig, {\n validation: TUBELESS_WORKBENCH_EXIT_CODE.validation,\n });\n\n function parse(\n argv: readonly string[] = process.argv.slice(2),\n contextOverrides?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema> {\n const result = command.parse(argv, contextOverrides);\n return result.kind === \"values\"\n ? { kind: \"values\", values: normalizePipelineCliValues<TSchema>(result.values) }\n : result;\n }\n\n function plan(controls: Parameters<TPipeline[\"plan\"]>[0] = {}): PipelinePlan {\n return pipeline.plan(controls);\n }\n\n function parseValues(\n values: Record<string, unknown>,\n contextOverrides?: Partial<CliContext>\n ): PipelineCliParseResult<TSchema> {\n const result = command.parseValues(values, contextOverrides);\n return result.kind === \"values\"\n ? { kind: \"values\", values: normalizePipelineCliValues<TSchema>(result.values) }\n : result;\n }\n\n return markPipelineCommand(\n {\n pipeline,\n descriptor: command.descriptor,\n id: pipeline.id,\n stepIds: pipeline.stepIds,\n targetIds: pipeline.targetIds,\n execute: (values, contextOverrides) =>\n // SAFETY: `execute` receives `PipelineCliValues<TSchema>` from the public interface,\n // which is a subtype of `CliParams<PipelineCliBuiltins & TSchema>`.\n command.execute(values as CliParams<PipelineCliBuiltins & TSchema>, contextOverrides),\n parse,\n parseValues,\n plan,\n toMermaid: (options) => pipeline.toMermaid(options),\n run: command.run,\n main: command.main,\n },\n pipeline\n );\n}\n"]}
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import type { ToMappedChildStepProgressOptions } from "./mapped-child-progress.js";
|
|
2
2
|
import type { Pipeline, PipelineExecutionContext, PipelineRun, PipelineRunControls, PipelineStepContext } from "./pipeline-types.js";
|
|
3
|
-
export declare class PipelineChildError extends Error {
|
|
4
|
-
readonly cancelled: boolean;
|
|
5
|
-
readonly fanOut?: {
|
|
6
|
-
failures: readonly {
|
|
7
|
-
error: Error;
|
|
8
|
-
key: string;
|
|
9
|
-
index: number;
|
|
10
|
-
cancelled: boolean;
|
|
11
|
-
}[];
|
|
12
|
-
failureCount: number;
|
|
13
|
-
schedulerError?: Error;
|
|
14
|
-
} | undefined;
|
|
15
|
-
constructor(message: string, cancelled?: boolean, cause?: unknown, fanOut?: {
|
|
16
|
-
failures: readonly {
|
|
17
|
-
error: Error;
|
|
18
|
-
key: string;
|
|
19
|
-
index: number;
|
|
20
|
-
cancelled: boolean;
|
|
21
|
-
}[];
|
|
22
|
-
failureCount: number;
|
|
23
|
-
schedulerError?: Error;
|
|
24
|
-
} | undefined);
|
|
25
|
-
}
|
|
26
3
|
type ChildPipeline = Pipeline<object, unknown, string, string>;
|
|
27
4
|
type ChildInputs = Record<string, unknown>;
|
|
28
5
|
export interface SingleChildExecutionConfig<TParentOptions extends object> {
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { throwIfAborted } from "../utilities/abort.js";
|
|
2
2
|
import { emitRejectedPlanLifecycle } from "./lifecycle.js";
|
|
3
3
|
import { runConcurrentPartial } from "../utilities/batch.js";
|
|
4
|
-
import { isPipelineCancellation, PipelineExecutionError } from "./pipeline-
|
|
4
|
+
import { isPipelineCancellation, PipelineChildError, PipelineExecutionError, } from "./pipeline-execution-error.js";
|
|
5
5
|
import { createRunId, RUN_MODEL_VERSION } from "./pipeline-ids.js";
|
|
6
6
|
import { duplicateValues } from "../utilities/collections.js";
|
|
7
7
|
import { EXECUTE_COMPILED_RUN, isCompiledPipeline } from "./pipeline-identity.js";
|
|
8
8
|
import { createMappedChildProgress, createSingleChildProgress } from "./child-progress.js";
|
|
9
|
-
export class PipelineChildError extends Error {
|
|
10
|
-
cancelled;
|
|
11
|
-
fanOut;
|
|
12
|
-
constructor(message, cancelled = false, cause, fanOut) {
|
|
13
|
-
super(message, cause === undefined ? undefined : { cause });
|
|
14
|
-
this.cancelled = cancelled;
|
|
15
|
-
this.fanOut = fanOut;
|
|
16
|
-
this.name = "PipelineChildError";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
9
|
function compiledChildExecute(pipeline) {
|
|
20
10
|
if (!isCompiledPipeline(pipeline))
|
|
21
11
|
return undefined;
|
|
@@ -81,10 +71,20 @@ async function rejectedChildPlanResult(pipeline, plan, domainOptions, controls,
|
|
|
81
71
|
return execute(plan, domainOptions, controls, context);
|
|
82
72
|
}
|
|
83
73
|
function childTracingOptions(context, itemKey = context.trace?.itemKey) {
|
|
84
|
-
|
|
74
|
+
const tracing = context.tracing;
|
|
75
|
+
if (!tracing)
|
|
76
|
+
return undefined;
|
|
77
|
+
return {
|
|
78
|
+
...tracing,
|
|
79
|
+
itemKey,
|
|
80
|
+
// A relation injected by this wrapper belongs to its next child, not descendants.
|
|
81
|
+
iteration: tracing.iteration?.runId === context.runId ? tracing.iteration : undefined,
|
|
82
|
+
};
|
|
85
83
|
}
|
|
86
|
-
function childRunControls(controls, parentDryRun) {
|
|
84
|
+
function childRunControls(controls, parentDryRun, cachePolicy) {
|
|
87
85
|
const resolved = {};
|
|
86
|
+
if (cachePolicy !== undefined || controls?.cache !== undefined)
|
|
87
|
+
resolved.cache = cachePolicy ?? controls?.cache;
|
|
88
88
|
if (controls?.continueOnError !== undefined) {
|
|
89
89
|
resolved.continueOnError = controls.continueOnError;
|
|
90
90
|
}
|
|
@@ -141,7 +141,7 @@ export function createSingleChildRunner(config) {
|
|
|
141
141
|
return async (inputs, context) => {
|
|
142
142
|
const domainOptions = config.mapOptions ? config.mapOptions(inputs, context) : context.options;
|
|
143
143
|
const configuredControls = typeof config.controls === "function" ? config.controls(inputs, context) : config.controls;
|
|
144
|
-
const controls = childRunControls(configuredControls, context.dryRun);
|
|
144
|
+
const controls = childRunControls(configuredControls, context.dryRun, context.cachePolicy);
|
|
145
145
|
const baseChildContext = {
|
|
146
146
|
correlationId: context.correlationId,
|
|
147
147
|
cwd: context.cwd,
|
|
@@ -189,7 +189,7 @@ export function createMappedChildRunner(config) {
|
|
|
189
189
|
const configuredControls = typeof config.controls === "function"
|
|
190
190
|
? config.controls(item, itemIndex, inputs, context)
|
|
191
191
|
: config.controls;
|
|
192
|
-
const controls = childRunControls(configuredControls, context.dryRun);
|
|
192
|
+
const controls = childRunControls(configuredControls, context.dryRun, context.cachePolicy);
|
|
193
193
|
// Plan once per mapped-options bag for progress and execution.
|
|
194
194
|
const childPlan = config.pipeline.plan(controls);
|
|
195
195
|
const childHooks = progress?.plan(key, childPlan) ?? {};
|
|
@@ -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,E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wIfAborted } from \"../utilities/abort.js\";\nimport { emitRejectedPlanLifecycle } from \"./lifecycle.js\";\nimport { runConcurrentPartial } from \"../utilities/batch.js\";\nimport { isPipelineCancellation, PipelineExecutionError } from \"./pipeline-execute.js\";\nimport type { ToMappedChildStepProgressOptions } 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 { createMappedChildProgress, createSingleChildProgress } from \"./child-progress.js\";\nimport type {\n Pipeline,\n PipelineContext,\n PipelineExecutionContext,\n PipelineHooks,\n PipelinePlan,\n PipelineRun,\n PipelineRunControls,\n PipelineRuntime,\n PipelineStepContext,\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\ntype ChildPipeline = Pipeline<object, unknown, string, string>;\n\ntype CompiledChildExecute = (\n plan: PipelinePlan,\n options: object,\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: object,\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: object,\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\nexport interface SingleChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n controls?:\n | PipelineRunControls\n | ((\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ) => PipelineRunControls);\n mapOptions?(inputs: ChildInputs, context: PipelineExecutionContext<TParentOptions>): object;\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 controls?:\n | PipelineRunControls\n | ((\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ) => PipelineRunControls);\n mapOptions(\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): object;\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\nfunction childRunControls(\n controls: PipelineRunControls | undefined,\n parentDryRun: boolean\n): PipelineRunControls {\n const resolved: PipelineRunControls = {};\n if (controls?.continueOnError !== undefined) {\n resolved.continueOnError = controls.continueOnError;\n }\n if (controls?.maxConcurrency !== undefined) {\n resolved.maxConcurrency = controls.maxConcurrency;\n }\n if (controls?.stepIds !== undefined) resolved.stepIds = [...controls.stepIds];\n if (controls?.targets !== undefined) resolved.targets = [...controls.targets];\n if (parentDryRun || controls?.dryRun === true) {\n resolved.dryRun = true;\n } else if (controls?.dryRun !== undefined) {\n resolved.dryRun = false;\n }\n return resolved;\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: object,\n controls: PipelineRunControls,\n context: PipelineContext,\n hooks: PipelineHooks,\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 new PipelineExecutionError(\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 new PipelineExecutionError(\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): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown> {\n return async (inputs, context) => {\n const domainOptions = config.mapOptions ? config.mapOptions(inputs, context) : context.options;\n const configuredControls =\n typeof config.controls === \"function\" ? config.controls(inputs, context) : config.controls;\n const controls = childRunControls(configuredControls, context.dryRun);\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 childHooks = hasProgressObserver(context)\n ? createSingleChildProgress(childPlan, context.reportProgress)\n : {};\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n baseChildContext,\n childHooks,\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): (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 progress = hasProgressObserver(context)\n ? createMappedChildProgress(keys, concurrency, config.progress, context.reportProgress)\n : undefined;\n progress?.publish();\n if (items.length === 0) return [];\n\n const partial = await runConcurrentPartial(\n items,\n { concurrency, signal: context.signal },\n async (item, itemIndex): Promise<Outcome> => {\n const key = keys[itemIndex]!;\n progress?.start(key);\n try {\n throwIfAborted(context.signal, `Mapped child pipeline ${config.pipeline.id}`);\n const domainOptions = config.mapOptions(item, itemIndex, inputs, context);\n const configuredControls =\n typeof config.controls === \"function\"\n ? config.controls(item, itemIndex, inputs, context)\n : config.controls;\n const controls = childRunControls(configuredControls, context.dryRun);\n // Plan once per mapped-options bag for progress and execution.\n const childPlan = config.pipeline.plan(controls);\n const childHooks = progress?.plan(key, childPlan) ?? {};\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 childHooks,\n \"\",\n childPlan\n );\n\n progress?.childCompleted(key);\n\n const value = config.mapResult\n ? config.mapResult(childResult.value, childResult, item, itemIndex, context)\n : childResult.value;\n progress?.complete(key);\n return { key, ok: true, value };\n } catch (error) {\n const cause = error instanceof Error ? error : new Error(String(error));\n progress?.fail(key, cause, isPipelineCancellation(cause, context));\n return { error: cause, key, index: itemIndex, ok: false };\n }\n }\n );\n\n progress?.finish();\n const outcomes = partial.ok\n ? partial.results\n : partial.results.filter((outcome): outcome is Outcome => outcome !== undefined);\n const schedulerFailure = partial.ok\n ? undefined\n : partial.failure instanceof Error\n ? partial.failure\n : new Error(String(partial.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 }) => isPipelineCancellation(error, context)) &&\n (schedulerFailure === undefined || isPipelineCancellation(schedulerFailure, context));\n const primaryError = cancelled\n ? (failures[0]?.error ?? schedulerFailure)\n : (failures.find(({ error }) => !isPipelineCancellation(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: isPipelineCancellation(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,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,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,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AA2B3F,SAAS,oBAAoB,CAAC,QAAuB;IACnD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IACpD,0EAA0E;IAC1E,+EAA+E;IAC/E,+BAA+B;IAC/B,OAAQ,QAA4B,CAAC,oBAAoB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,oBAAoB,CAC3B,QAAuB,EACvB,IAAkB,EAClB,aAAqB,EACrB,QAA6B,EA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,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,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC;iBAClD,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 { runConcurrentPartial } from \"../utilities/batch.js\";\nimport {\n isPipelineCancellation,\n PipelineChildError,\n PipelineExecutionError,\n} from \"./pipeline-execution-error.js\";\nimport type { ToMappedChildStepProgressOptions } 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 { createMappedChildProgress, createSingleChildProgress } from \"./child-progress.js\";\nimport type {\n Pipeline,\n PipelineContext,\n PipelineExecutionContext,\n PipelineHooks,\n PipelinePlan,\n PipelineRun,\n PipelineRunControls,\n PipelineRuntime,\n PipelineStepContext,\n} from \"./pipeline-types.js\";\nimport type { PipelineTracingOptions } from \"../tracing/tracing-contracts.js\";\n\ntype ChildPipeline = Pipeline<object, unknown, string, string>;\n\ntype CompiledChildExecute = (\n plan: PipelinePlan,\n options: object,\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: object,\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: object,\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\nexport interface SingleChildExecutionConfig<TParentOptions extends object> {\n pipeline: ChildPipeline;\n controls?:\n | PipelineRunControls\n | ((\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ) => PipelineRunControls);\n mapOptions?(inputs: ChildInputs, context: PipelineExecutionContext<TParentOptions>): object;\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 controls?:\n | PipelineRunControls\n | ((\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ) => PipelineRunControls);\n mapOptions(\n item: unknown,\n index: number,\n inputs: ChildInputs,\n context: PipelineExecutionContext<TParentOptions>\n ): object;\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 const tracing = context.tracing;\n if (!tracing) return undefined;\n return {\n ...tracing,\n itemKey,\n // A relation injected by this wrapper belongs to its next child, not descendants.\n iteration: tracing.iteration?.runId === context.runId ? tracing.iteration : undefined,\n };\n}\n\nfunction childRunControls(\n controls: PipelineRunControls | undefined,\n parentDryRun: boolean,\n cachePolicy: PipelineRunControls[\"cache\"]\n): PipelineRunControls {\n const resolved: PipelineRunControls = {};\n if (cachePolicy !== undefined || controls?.cache !== undefined)\n resolved.cache = cachePolicy ?? controls?.cache;\n if (controls?.continueOnError !== undefined) {\n resolved.continueOnError = controls.continueOnError;\n }\n if (controls?.maxConcurrency !== undefined) {\n resolved.maxConcurrency = controls.maxConcurrency;\n }\n if (controls?.stepIds !== undefined) resolved.stepIds = [...controls.stepIds];\n if (controls?.targets !== undefined) resolved.targets = [...controls.targets];\n if (parentDryRun || controls?.dryRun === true) {\n resolved.dryRun = true;\n } else if (controls?.dryRun !== undefined) {\n resolved.dryRun = false;\n }\n return resolved;\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: object,\n controls: PipelineRunControls,\n context: PipelineContext,\n hooks: PipelineHooks,\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 new PipelineExecutionError(\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 new PipelineExecutionError(\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): (inputs: ChildInputs, context: PipelineStepContext<TParentOptions>) => Promise<unknown> {\n return async (inputs, context) => {\n const domainOptions = config.mapOptions ? config.mapOptions(inputs, context) : context.options;\n const configuredControls =\n typeof config.controls === \"function\" ? config.controls(inputs, context) : config.controls;\n const controls = childRunControls(configuredControls, context.dryRun, context.cachePolicy);\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 childHooks = hasProgressObserver(context)\n ? createSingleChildProgress(childPlan, context.reportProgress)\n : {};\n const childResult = await runChildPipeline(\n config.pipeline,\n domainOptions,\n controls,\n baseChildContext,\n childHooks,\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): (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 progress = hasProgressObserver(context)\n ? createMappedChildProgress(keys, concurrency, config.progress, context.reportProgress)\n : undefined;\n progress?.publish();\n if (items.length === 0) return [];\n\n const partial = await runConcurrentPartial(\n items,\n { concurrency, signal: context.signal },\n async (item, itemIndex): Promise<Outcome> => {\n const key = keys[itemIndex]!;\n progress?.start(key);\n try {\n throwIfAborted(context.signal, `Mapped child pipeline ${config.pipeline.id}`);\n const domainOptions = config.mapOptions(item, itemIndex, inputs, context);\n const configuredControls =\n typeof config.controls === \"function\"\n ? config.controls(item, itemIndex, inputs, context)\n : config.controls;\n const controls = childRunControls(\n configuredControls,\n context.dryRun,\n context.cachePolicy\n );\n // Plan once per mapped-options bag for progress and execution.\n const childPlan = config.pipeline.plan(controls);\n const childHooks = progress?.plan(key, childPlan) ?? {};\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 childHooks,\n \"\",\n childPlan\n );\n\n progress?.childCompleted(key);\n\n const value = config.mapResult\n ? config.mapResult(childResult.value, childResult, item, itemIndex, context)\n : childResult.value;\n progress?.complete(key);\n return { key, ok: true, value };\n } catch (error) {\n const cause = error instanceof Error ? error : new Error(String(error));\n progress?.fail(key, cause, isPipelineCancellation(cause, context));\n return { error: cause, key, index: itemIndex, ok: false };\n }\n }\n );\n\n progress?.finish();\n const outcomes = partial.ok\n ? partial.results\n : partial.results.filter((outcome): outcome is Outcome => outcome !== undefined);\n const schedulerFailure = partial.ok\n ? undefined\n : partial.failure instanceof Error\n ? partial.failure\n : new Error(String(partial.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 }) => isPipelineCancellation(error, context)) &&\n (schedulerFailure === undefined || isPipelineCancellation(schedulerFailure, context));\n const primaryError = cancelled\n ? (failures[0]?.error ?? schedulerFailure)\n : (failures.find(({ error }) => !isPipelineCancellation(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: isPipelineCancellation(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"]}
|
|
@@ -24,7 +24,8 @@ function sameChildProgress(left, right) {
|
|
|
24
24
|
Object.is(row.completed, other.completed) &&
|
|
25
25
|
Object.is(row.total, other.total) &&
|
|
26
26
|
row.label === other.label &&
|
|
27
|
-
row.status === other.status
|
|
27
|
+
row.status === other.status &&
|
|
28
|
+
row.outputSource === other.outputSource));
|
|
28
29
|
}));
|
|
29
30
|
}
|
|
30
31
|
function sameChildStatus(left, right) {
|
|
@@ -32,7 +33,7 @@ function sameChildStatus(left, right) {
|
|
|
32
33
|
return false;
|
|
33
34
|
if (left.status === "planned" || right.status === "planned")
|
|
34
35
|
return true;
|
|
35
|
-
if (left.attemptId !== right.attemptId)
|
|
36
|
+
if (left.attemptId !== right.attemptId || left.outputSource !== right.outputSource)
|
|
36
37
|
return false;
|
|
37
38
|
if (left.status === "running" || right.status === "running") {
|
|
38
39
|
return (left.status === "running" &&
|
|
@@ -127,6 +128,11 @@ function createChildProgress(plan) {
|
|
|
127
128
|
errorLabel = event.error.message;
|
|
128
129
|
break;
|
|
129
130
|
}
|
|
131
|
+
if (event.outputSource === "override") {
|
|
132
|
+
message += " (overridden)";
|
|
133
|
+
}
|
|
134
|
+
if (event.outputSource === "cache")
|
|
135
|
+
message += " (cached)";
|
|
130
136
|
const previous = terminalSteps.size;
|
|
131
137
|
if (event.status !== "running")
|
|
132
138
|
terminalSteps.add(event.step.id);
|
|
@@ -135,6 +141,7 @@ function createChildProgress(plan) {
|
|
|
135
141
|
id: event.step.id,
|
|
136
142
|
name: event.step.name,
|
|
137
143
|
status: event.status,
|
|
144
|
+
...(event.outputSource ? { outputSource: event.outputSource } : {}),
|
|
138
145
|
};
|
|
139
146
|
if (latest) {
|
|
140
147
|
row.completed = latest.completed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-progress.js","sourceRoot":"","sources":["../../src/core/child-progress.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,0BAA0B,GAG3B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAIpC,SAAS,iBAAiB,CACxB,IAAsC,EACtC,KAAuC;IAEvC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAChC,IACE,CAAC,IAAI;QACL,CAAC,KAAK;QACN,CAAC,MAAM,CAAC,EAAE,CAA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C,CAAC;YACjB,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM;YACJ,IAAI,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,wBAAwB,EAAE,CAAC;gBACjF,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n PipelineHooks,\n PipelinePlan,\n PipelineStepProgress,\n PipelineStepProgressDetail,\n PipelineStepStatus,\n} from \"./pipeline-types.js\";\nimport { hasVisibleStepProgress } from \"./progress.js\";\nimport {\n mappedChildProgressSummary,\n type MappedChildProgressSnapshot,\n type ToMappedChildStepProgressOptions,\n} from \"./mapped-child-progress.js\";\n\nconst LIVE_FAN_OUT_GROUP_LIMIT = 32;\n\ntype ReportProgress = (progress: PipelineStepProgress) => void;\n\nfunction sameChildProgress(\n left: PipelineStepProgress | undefined,\n right: PipelineStepProgress | undefined\n): boolean {\n if (left === right) return true;\n if (\n !left ||\n !right ||\n !Object.is(left.completed, right.completed) ||\n !Object.is(left.total, right.total) ||\n left.message !== right.message\n )\n return false;\n if (left.details === right.details) return true;\n const leftDetails = left.details ?? [];\n const rightDetails = right.details ?? [];\n return (\n leftDetails.length === rightDetails.length &&\n leftDetails.every((row, index) => {\n const other = rightDetails[index]!;\n return (\n row === other ||\n (row.id === other.id &&\n row.name === other.name &&\n Object.is(row.depth, other.depth) &&\n Object.is(row.completed, other.completed) &&\n Object.is(row.total, other.total) &&\n row.label === other.label &&\n row.status === other.status)\n );\n })\n );\n}\n\nfunction sameChildStatus(left: PipelineStepStatus, right: PipelineStepStatus): boolean {\n if (left.status !== right.status) return false;\n if (left.status === \"planned\" || right.status === \"planned\") return true;\n if (left.attemptId !== right.attemptId) return false;\n if (left.status === \"running\" || right.status === \"running\") {\n return (\n left.status === \"running\" &&\n right.status === \"running\" &&\n sameChildProgress(left.progress, right.progress)\n );\n }\n return left.finishedAtMs === right.finishedAtMs;\n}\n\n/** External children may emit either hook family, or both for the same event. */\nfunction childProgressHooks(update: (event: PipelineStepStatus) => void): PipelineHooks {\n const pending = new Map<string, { event: PipelineStepStatus; focused: boolean }>();\n const consume = (event: PipelineStepStatus, focused: boolean): void => {\n const previous = pending.get(event.step.id);\n if (previous && previous.focused !== focused && sameChildStatus(previous.event, event)) {\n pending.delete(event.step.id);\n return;\n }\n pending.set(event.step.id, { event, focused });\n update(event);\n };\n const onFocusedStatus = (event: PipelineStepStatus): void => consume(event, true);\n return {\n onStepStatus: (event) => consume(event, false),\n onStepStart: onFocusedStatus,\n onStepProgress: onFocusedStatus,\n onStepComplete: onFocusedStatus,\n onStepSkip: onFocusedStatus,\n onStepCancel: onFocusedStatus,\n onStepFail: onFocusedStatus,\n };\n}\n\n/** Retain one child's step states without forwarding its lifecycle to parent hooks. */\nfunction createChildProgress(plan: PipelinePlan) {\n const rows = new Map<string, PipelineStepProgressDetail>();\n const progress = new Map<string, PipelineStepProgress>();\n const terminalSteps = new Set<string>();\n for (const step of plan.steps) {\n if (step.selected) rows.set(step.id, { id: step.id, name: step.name, status: \"pending\" });\n }\n return {\n total: plan.ok ? rows.size : 0,\n get completed() {\n return terminalSteps.size;\n },\n complete(): number {\n const previous = terminalSteps.size;\n if (plan.ok) for (const id of rows.keys()) terminalSteps.add(id);\n return terminalSteps.size - previous;\n },\n update(event: PipelineStepStatus) {\n const name = event.step.name ?? event.step.id;\n // Filtered steps are announced by single children, but never counted or\n // included in the retained tree or mapped activity labels.\n if (event.status === \"skipped\" && event.reason === \"filtered\") {\n return { message: `${name}: skipped: filtered`, label: undefined, terminalDelta: 0 };\n }\n if (!rows.has(event.step.id) || event.status === \"planned\") return;\n let message: string;\n let label: string;\n let errorLabel: string | undefined;\n switch (event.status) {\n case \"running\":\n if (event.progress) {\n if (!hasVisibleStepProgress(event.progress)) return;\n progress.set(event.step.id, event.progress);\n message = event.progress.message ?? `${event.progress.completed} completed`;\n label = `${name}:${event.progress.message ?? (event.progress.total !== undefined ? `${event.progress.completed}/${event.progress.total}` : `${event.progress.completed}`)}`;\n } else {\n message = \"started\";\n label = name;\n }\n break;\n case \"completed\":\n message = \"complete\";\n label = `${name}:complete`;\n break;\n case \"skipped\":\n message = `skipped: ${event.reason}`;\n label = `${name}:skipped:${event.reason}`;\n errorLabel = event.message ?? event.reason;\n break;\n case \"cancelled\":\n case \"failed\":\n message = `${event.status}: ${event.error.message}`;\n label = `${name}:${event.status}`;\n errorLabel = event.error.message;\n break;\n }\n const previous = terminalSteps.size;\n if (event.status !== \"running\") terminalSteps.add(event.step.id);\n const latest = progress.get(event.step.id);\n const row: PipelineStepProgressDetail = {\n id: event.step.id,\n name: event.step.name,\n status: event.status,\n };\n if (latest) {\n row.completed = latest.completed;\n row.total = latest.total;\n row.label = latest.message;\n }\n if (errorLabel !== undefined) row.label = errorLabel;\n rows.set(event.step.id, row);\n return {\n message: `${name}: ${message}`,\n label,\n terminalDelta: terminalSteps.size - previous,\n };\n },\n details(): PipelineStepProgressDetail[] {\n return [...rows.values()].flatMap((row) => [\n { ...row },\n ...(progress.get(row.id)?.details ?? []).map((detail) => ({\n ...detail,\n depth: (detail.depth ?? 0) + 1,\n status:\n (detail.status ?? \"running\") === \"running\" && row.status !== \"running\"\n ? row.status\n : detail.status,\n })),\n ]);\n },\n };\n}\n\n/** Project canonical child statuses into the opaque parent's progress. */\nexport function createSingleChildProgress(\n plan: PipelinePlan,\n report: ReportProgress\n): PipelineHooks {\n const child = createChildProgress(plan);\n return childProgressHooks((event) => {\n const update = child.update(event);\n if (!update) return;\n report({\n completed: child.completed,\n total: Math.max(1, child.total),\n message: `${plan.pipelineId}/${update.message}`,\n details: child.details(),\n });\n });\n}\n\n/** Own fan-out counts, activity labels and bounded detail rendering. */\nexport function createMappedChildProgress(\n keys: readonly string[],\n concurrency: number,\n options: ToMappedChildStepProgressOptions | undefined,\n report: ReportProgress\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 itemRows = new Map<string, PipelineStepProgressDetail>(\n keys.map((id) => [id, { id, status: \"pending\" }])\n );\n const children = new Map<string, ReturnType<typeof createChildProgress>>();\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 publish = (spotlight?: string, final = false): void => {\n const snapshot: MappedChildProgressSnapshot = {\n active,\n concurrency,\n failedItems,\n finishedItems,\n itemCount: keys.length,\n plannedChildSteps,\n plannedItems,\n stepsPerItem,\n terminalChildSteps,\n spotlight,\n };\n // Materialize only the visible window. Active and failed sets avoid a\n // scan or sort of the entire fan-out on every child status event.\n const limit = Math.max(0, Math.floor(options?.detailLimit ?? LIVE_FAN_OUT_GROUP_LIMIT)) || 0;\n let visibleKeys: readonly string[];\n if (final && options?.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 ...(children.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 report({ ...mappedChildProgressSummary(snapshot, options), details });\n };\n\n return {\n publish,\n start(key: string): void {\n active.set(key, \"starting\");\n itemRows.set(key, { id: key, status: \"running\" });\n publish();\n },\n plan(key: string, plan: PipelinePlan): PipelineHooks {\n const child = createChildProgress(plan);\n children.set(key, child);\n if (plan.ok) {\n plannedChildSteps += child.total;\n plannedItems += 1;\n stepsPerItem = Math.max(stepsPerItem, child.total);\n }\n return childProgressHooks((event) => {\n const update = child.update(event);\n if (!update || update.label === undefined) return;\n terminalChildSteps += update.terminalDelta;\n active.set(key, update.label);\n publish();\n });\n },\n childCompleted(key: string): void {\n // Public child implementations may return success without emitting all\n // statuses. Reconcile their selected steps before mapping the result.\n terminalChildSteps += children.get(key)?.complete() ?? 0;\n },\n complete(key: string): void {\n active.delete(key);\n itemRows.set(key, { id: key, status: \"completed\" });\n finishedItems += 1;\n publish(`${key}: completed`);\n },\n fail(key: string, error: Error, cancelled: boolean): void {\n active.delete(key);\n itemRows.set(key, {\n id: key,\n status: cancelled ? \"cancelled\" : \"failed\",\n label: error.message,\n });\n failedKeys.add(key);\n failedItems += 1;\n publish(`${key}: failed`);\n },\n finish(): void {\n if (options?.detailLimit === undefined && keys.length > LIVE_FAN_OUT_GROUP_LIMIT) {\n publish(undefined, true);\n }\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"child-progress.js","sourceRoot":"","sources":["../../src/core/child-progress.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,0BAA0B,GAG3B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAIpC,SAAS,iBAAiB,CACxB,IAAsC,EACtC,KAAuC;IAEvC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAChC,IACE,CAAC,IAAI;QACL,CAAC,KAAK;QACN,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;QAC3C,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;QAE9B,OAAO,KAAK,CAAC;IACf,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC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K,EAAE,KAAK,CAAC,OAAO;aACrB,CAAC,CAAC;YACH,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpB,WAAW,IAAI,CAAC,CAAC;YACjB,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM;YACJ,IAAI,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,wBAAwB,EAAE,CAAC;gBACjF,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n PipelineHooks,\n PipelinePlan,\n PipelineStepProgress,\n PipelineStepProgressDetail,\n PipelineStepStatus,\n} from \"./pipeline-types.js\";\nimport { hasVisibleStepProgress } from \"./progress.js\";\nimport {\n mappedChildProgressSummary,\n type MappedChildProgressSnapshot,\n type ToMappedChildStepProgressOptions,\n} from \"./mapped-child-progress.js\";\n\nconst LIVE_FAN_OUT_GROUP_LIMIT = 32;\n\ntype ReportProgress = (progress: PipelineStepProgress) => void;\n\nfunction sameChildProgress(\n left: PipelineStepProgress | undefined,\n right: PipelineStepProgress | undefined\n): boolean {\n if (left === right) return true;\n if (\n !left ||\n !right ||\n !Object.is(left.completed, right.completed) ||\n !Object.is(left.total, right.total) ||\n left.message !== right.message\n )\n return false;\n if (left.details === right.details) return true;\n const leftDetails = left.details ?? [];\n const rightDetails = right.details ?? [];\n return (\n leftDetails.length === rightDetails.length &&\n leftDetails.every((row, index) => {\n const other = rightDetails[index]!;\n return (\n row === other ||\n (row.id === other.id &&\n row.name === other.name &&\n Object.is(row.depth, other.depth) &&\n Object.is(row.completed, other.completed) &&\n Object.is(row.total, other.total) &&\n row.label === other.label &&\n row.status === other.status &&\n row.outputSource === other.outputSource)\n );\n })\n );\n}\n\nfunction sameChildStatus(left: PipelineStepStatus, right: PipelineStepStatus): boolean {\n if (left.status !== right.status) return false;\n if (left.status === \"planned\" || right.status === \"planned\") return true;\n if (left.attemptId !== right.attemptId || left.outputSource !== right.outputSource) return false;\n if (left.status === \"running\" || right.status === \"running\") {\n return (\n left.status === \"running\" &&\n right.status === \"running\" &&\n sameChildProgress(left.progress, right.progress)\n );\n }\n return left.finishedAtMs === right.finishedAtMs;\n}\n\n/** External children may emit either hook family, or both for the same event. */\nfunction childProgressHooks(update: (event: PipelineStepStatus) => void): PipelineHooks {\n const pending = new Map<string, { event: PipelineStepStatus; focused: boolean }>();\n const consume = (event: PipelineStepStatus, focused: boolean): void => {\n const previous = pending.get(event.step.id);\n if (previous && previous.focused !== focused && sameChildStatus(previous.event, event)) {\n pending.delete(event.step.id);\n return;\n }\n pending.set(event.step.id, { event, focused });\n update(event);\n };\n const onFocusedStatus = (event: PipelineStepStatus): void => consume(event, true);\n return {\n onStepStatus: (event) => consume(event, false),\n onStepStart: onFocusedStatus,\n onStepProgress: onFocusedStatus,\n onStepComplete: onFocusedStatus,\n onStepSkip: onFocusedStatus,\n onStepCancel: onFocusedStatus,\n onStepFail: onFocusedStatus,\n };\n}\n\n/** Retain one child's step states without forwarding its lifecycle to parent hooks. */\nfunction createChildProgress(plan: PipelinePlan) {\n const rows = new Map<string, PipelineStepProgressDetail>();\n const progress = new Map<string, PipelineStepProgress>();\n const terminalSteps = new Set<string>();\n for (const step of plan.steps) {\n if (step.selected) rows.set(step.id, { id: step.id, name: step.name, status: \"pending\" });\n }\n return {\n total: plan.ok ? rows.size : 0,\n get completed() {\n return terminalSteps.size;\n },\n complete(): number {\n const previous = terminalSteps.size;\n if (plan.ok) for (const id of rows.keys()) terminalSteps.add(id);\n return terminalSteps.size - previous;\n },\n update(event: PipelineStepStatus) {\n const name = event.step.name ?? event.step.id;\n // Filtered steps are announced by single children, but never counted or\n // included in the retained tree or mapped activity labels.\n if (event.status === \"skipped\" && event.reason === \"filtered\") {\n return { message: `${name}: skipped: filtered`, label: undefined, terminalDelta: 0 };\n }\n if (!rows.has(event.step.id) || event.status === \"planned\") return;\n let message: string;\n let label: string;\n let errorLabel: string | undefined;\n switch (event.status) {\n case \"running\":\n if (event.progress) {\n if (!hasVisibleStepProgress(event.progress)) return;\n progress.set(event.step.id, event.progress);\n message = event.progress.message ?? `${event.progress.completed} completed`;\n label = `${name}:${event.progress.message ?? (event.progress.total !== undefined ? `${event.progress.completed}/${event.progress.total}` : `${event.progress.completed}`)}`;\n } else {\n message = \"started\";\n label = name;\n }\n break;\n case \"completed\":\n message = \"complete\";\n label = `${name}:complete`;\n break;\n case \"skipped\":\n message = `skipped: ${event.reason}`;\n label = `${name}:skipped:${event.reason}`;\n errorLabel = event.message ?? event.reason;\n break;\n case \"cancelled\":\n case \"failed\":\n message = `${event.status}: ${event.error.message}`;\n label = `${name}:${event.status}`;\n errorLabel = event.error.message;\n break;\n }\n if (event.outputSource === \"override\") {\n message += \" (overridden)\";\n }\n if (event.outputSource === \"cache\") message += \" (cached)\";\n const previous = terminalSteps.size;\n if (event.status !== \"running\") terminalSteps.add(event.step.id);\n const latest = progress.get(event.step.id);\n const row: PipelineStepProgressDetail = {\n id: event.step.id,\n name: event.step.name,\n status: event.status,\n ...(event.outputSource ? { outputSource: event.outputSource } : {}),\n };\n if (latest) {\n row.completed = latest.completed;\n row.total = latest.total;\n row.label = latest.message;\n }\n if (errorLabel !== undefined) row.label = errorLabel;\n rows.set(event.step.id, row);\n return {\n message: `${name}: ${message}`,\n label,\n terminalDelta: terminalSteps.size - previous,\n };\n },\n details(): PipelineStepProgressDetail[] {\n return [...rows.values()].flatMap((row) => [\n { ...row },\n ...(progress.get(row.id)?.details ?? []).map((detail) => ({\n ...detail,\n depth: (detail.depth ?? 0) + 1,\n status:\n (detail.status ?? \"running\") === \"running\" && row.status !== \"running\"\n ? row.status\n : detail.status,\n })),\n ]);\n },\n };\n}\n\n/** Project canonical child statuses into the opaque parent's progress. */\nexport function createSingleChildProgress(\n plan: PipelinePlan,\n report: ReportProgress\n): PipelineHooks {\n const child = createChildProgress(plan);\n return childProgressHooks((event) => {\n const update = child.update(event);\n if (!update) return;\n report({\n completed: child.completed,\n total: Math.max(1, child.total),\n message: `${plan.pipelineId}/${update.message}`,\n details: child.details(),\n });\n });\n}\n\n/** Own fan-out counts, activity labels and bounded detail rendering. */\nexport function createMappedChildProgress(\n keys: readonly string[],\n concurrency: number,\n options: ToMappedChildStepProgressOptions | undefined,\n report: ReportProgress\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 itemRows = new Map<string, PipelineStepProgressDetail>(\n keys.map((id) => [id, { id, status: \"pending\" }])\n );\n const children = new Map<string, ReturnType<typeof createChildProgress>>();\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 publish = (spotlight?: string, final = false): void => {\n const snapshot: MappedChildProgressSnapshot = {\n active,\n concurrency,\n failedItems,\n finishedItems,\n itemCount: keys.length,\n plannedChildSteps,\n plannedItems,\n stepsPerItem,\n terminalChildSteps,\n spotlight,\n };\n // Materialize only the visible window. Active and failed sets avoid a\n // scan or sort of the entire fan-out on every child status event.\n const limit = Math.max(0, Math.floor(options?.detailLimit ?? LIVE_FAN_OUT_GROUP_LIMIT)) || 0;\n let visibleKeys: readonly string[];\n if (final && options?.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 ...(children.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 report({ ...mappedChildProgressSummary(snapshot, options), details });\n };\n\n return {\n publish,\n start(key: string): void {\n active.set(key, \"starting\");\n itemRows.set(key, { id: key, status: \"running\" });\n publish();\n },\n plan(key: string, plan: PipelinePlan): PipelineHooks {\n const child = createChildProgress(plan);\n children.set(key, child);\n if (plan.ok) {\n plannedChildSteps += child.total;\n plannedItems += 1;\n stepsPerItem = Math.max(stepsPerItem, child.total);\n }\n return childProgressHooks((event) => {\n const update = child.update(event);\n if (!update || update.label === undefined) return;\n terminalChildSteps += update.terminalDelta;\n active.set(key, update.label);\n publish();\n });\n },\n childCompleted(key: string): void {\n // Public child implementations may return success without emitting all\n // statuses. Reconcile their selected steps before mapping the result.\n terminalChildSteps += children.get(key)?.complete() ?? 0;\n },\n complete(key: string): void {\n active.delete(key);\n itemRows.set(key, { id: key, status: \"completed\" });\n finishedItems += 1;\n publish(`${key}: completed`);\n },\n fail(key: string, error: Error, cancelled: boolean): void {\n active.delete(key);\n itemRows.set(key, {\n id: key,\n status: cancelled ? \"cancelled\" : \"failed\",\n label: error.message,\n });\n failedKeys.add(key);\n failedItems += 1;\n publish(`${key}: failed`);\n },\n finish(): void {\n if (options?.detailLimit === undefined && keys.length > LIVE_FAN_OUT_GROUP_LIMIT) {\n publish(undefined, true);\n }\n },\n };\n}\n"]}
|