@cascade-flow/runner 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -78
- package/dist/checkpoint-ipc.d.ts +82 -0
- package/dist/checkpoint-ipc.d.ts.map +1 -0
- package/dist/index.d.ts +16 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +456 -503
- package/dist/index.js.map +8 -7
- package/dist/step-executor.d.ts +9 -12
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/subprocess-executor.d.ts +6 -1
- package/dist/subprocess-executor.d.ts.map +1 -1
- package/dist/validation.d.ts +27 -0
- package/dist/validation.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/step-executor.d.ts
CHANGED
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Step executor - runs a single step in isolation
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Environment variables:
|
|
6
|
+
* - CF_STEP_INPUT_FILE: Path to temp file containing JSON input (required)
|
|
7
|
+
* - STEP_OUTPUT_FILE: Path to write step result as JSON (required)
|
|
8
|
+
* - CF_CHECKPOINT_DIR: Path to directory for checkpoint IPC (optional)
|
|
9
|
+
*
|
|
10
|
+
* Input format (in CF_STEP_INPUT_FILE):
|
|
6
11
|
* {
|
|
7
12
|
* "stepPath": "/path/to/step.ts",
|
|
8
13
|
* "dependencies": { "depName": <serialized-output> },
|
|
9
14
|
* "ctx": { "runId": "...", ... }
|
|
10
15
|
* }
|
|
11
16
|
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
* When STEP_OUTPUT_FILE is set:
|
|
16
|
-
* - Outputs to file: Step result as JSON
|
|
17
|
-
* - Outputs to stdout: console.log/info output
|
|
18
|
-
* - Outputs to stderr: console.error/warn output
|
|
19
|
-
*
|
|
20
|
-
* When STEP_OUTPUT_FILE is NOT set (backward compatibility):
|
|
21
|
-
* - Outputs to stdout: Step result as JSON
|
|
22
|
-
* - Outputs to stderr: All console output (redirected)
|
|
17
|
+
* Output:
|
|
18
|
+
* - Step result written to STEP_OUTPUT_FILE as JSON
|
|
19
|
+
* - stdout/stderr: console output from step
|
|
23
20
|
*/
|
|
24
21
|
export {};
|
|
25
22
|
//# sourceMappingURL=step-executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-executor.d.ts","sourceRoot":"","sources":["../src/step-executor.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"step-executor.d.ts","sourceRoot":"","sources":["../src/step-executor.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogEntry } from "@cascade-flow/backend-interface";
|
|
2
2
|
import type { StepOutput, RunnerContext } from "@cascade-flow/workflow";
|
|
3
|
+
import { type CheckpointData, type CheckpointFailedData } from "./checkpoint-ipc.ts";
|
|
3
4
|
type SubprocessOptions = {
|
|
4
5
|
signal?: AbortSignal;
|
|
5
6
|
};
|
|
@@ -16,9 +17,13 @@ type SubprocessOptions = {
|
|
|
16
17
|
* @param attemptNumber - Current attempt number (for retries)
|
|
17
18
|
* @param outputPath - Path where subprocess should write output JSON
|
|
18
19
|
* @param onLog - Optional callback for real-time log emission
|
|
20
|
+
* @param onCheckpoint - Optional callback for persisting checkpoints
|
|
21
|
+
* @param onCheckpointFailed - Optional callback for persisting checkpoint failures
|
|
22
|
+
* @param existingCheckpoints - Existing checkpoints to replay (name -> data[] by sequence)
|
|
23
|
+
* @param options - Additional options (signal for abort)
|
|
19
24
|
* @returns Promise resolving to step result and collected logs
|
|
20
25
|
*/
|
|
21
|
-
export declare function executeStepInSubprocess(stepFile: string, stepId: string, dependencies: Record<string, unknown>, ctx: RunnerContext, attemptNumber: number, outputPath: string, onLog?: (log: LogEntry) => void | Promise<void>, options?: SubprocessOptions): Promise<{
|
|
26
|
+
export declare function executeStepInSubprocess(stepFile: string, stepId: string, dependencies: Record<string, unknown>, ctx: RunnerContext, attemptNumber: number, outputPath: string, onLog?: (log: LogEntry) => void | Promise<void>, onCheckpoint?: (checkpoint: CheckpointData) => Promise<void>, onCheckpointFailed?: (checkpoint: CheckpointFailedData) => Promise<void>, existingCheckpoints?: Map<string, string[]>, options?: SubprocessOptions): Promise<{
|
|
22
27
|
result: StepOutput;
|
|
23
28
|
logs: LogEntry[];
|
|
24
29
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subprocess-executor.d.ts","sourceRoot":"","sources":["../src/subprocess-executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subprocess-executor.d.ts","sourceRoot":"","sources":["../src/subprocess-executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAQL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AA4H7B,KAAK,iBAAiB,GAAG;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AA2LF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,GAAG,EAAE,aAAa,EAClB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC/C,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,EAC5D,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,EACxE,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC3C,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAwOnD"}
|
package/dist/validation.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Step validation - detects circular dependencies and other graph issues
|
|
3
3
|
*/
|
|
4
4
|
import type { LoadedStep } from "./types.ts";
|
|
5
|
+
import type { Backend } from "@cascade-flow/backend-interface";
|
|
5
6
|
/**
|
|
6
7
|
* Detects circular dependencies in the step dependency graph
|
|
7
8
|
* Uses depth-first search to find cycles
|
|
@@ -10,4 +11,30 @@ import type { LoadedStep } from "./types.ts";
|
|
|
10
11
|
* @throws Error if a cycle is detected
|
|
11
12
|
*/
|
|
12
13
|
export declare function detectCycles(steps: LoadedStep[]): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get all steps that depend on a given target step (directly or transitively)
|
|
16
|
+
*
|
|
17
|
+
* This builds a reverse dependency map and performs DFS to find all dependents.
|
|
18
|
+
* Used for rerun-from-step functionality to determine which steps need re-execution.
|
|
19
|
+
*
|
|
20
|
+
* @param targetStepId - The step ID to find dependents for
|
|
21
|
+
* @param allSteps - Array of all loaded steps in the workflow
|
|
22
|
+
* @returns Set of step IDs that depend on the target step (excluding the target itself)
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAllDependents(targetStepId: string, allSteps: LoadedStep[]): Set<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Get parent workflow version and log any version differences
|
|
27
|
+
*
|
|
28
|
+
* Checks if the workflow structure has changed since the parent run
|
|
29
|
+
* and logs informational messages about version differences.
|
|
30
|
+
* Used for rerun-from-step functionality.
|
|
31
|
+
*
|
|
32
|
+
* @param workflowSlug - Workflow identifier
|
|
33
|
+
* @param parentRunId - Parent run ID to compare against
|
|
34
|
+
* @param currentVersionId - Current workflow version ID
|
|
35
|
+
* @param backend - Backend instance to load version info
|
|
36
|
+
* @param log - Optional log function for version info
|
|
37
|
+
* @returns Parent version ID
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateWorkflowVersion(workflowSlug: string, parentRunId: string, currentVersionId: string, backend: Backend, log?: (msg: string) => void): Promise<string>;
|
|
13
40
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAgBtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,UAAU,EAAE,GACrB,GAAG,CAAC,MAAM,CAAC,CA8Bb;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,OAAO,EAChB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1B,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cascade-flow/runner",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"test:coverage": "bun test --coverage"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@cascade-flow/backend-filesystem": "0.2.
|
|
26
|
-
"@cascade-flow/backend-interface": "0.2.
|
|
27
|
-
"@cascade-flow/workflow": "0.2.
|
|
25
|
+
"@cascade-flow/backend-filesystem": "0.2.6",
|
|
26
|
+
"@cascade-flow/backend-interface": "0.2.4",
|
|
27
|
+
"@cascade-flow/workflow": "0.2.6",
|
|
28
28
|
"zod": "^4.1.12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|