@cascade-flow/runner 0.2.11 → 0.2.18
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/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +187 -148
- package/dist/index.js.map +5 -5
- package/dist/subprocess-executor.d.ts +20 -4
- package/dist/subprocess-executor.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import type { LogEntry } from "@cascade-flow/backend-interface";
|
|
1
|
+
import type { LogEntry, ResourceUsage } from "@cascade-flow/backend-interface";
|
|
2
2
|
import type { StepOutput, RunnerContext } from "@cascade-flow/workflow";
|
|
3
3
|
import { type CheckpointData, type CheckpointFailedData } from "./checkpoint-ipc.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Typed error class for subprocess step execution failures.
|
|
6
|
+
* Replaces ad-hoc `(error as any).resourceUsage` / `(error as any).isCrash` mutation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class StepExecutionError extends Error {
|
|
9
|
+
resourceUsage?: ResourceUsage;
|
|
10
|
+
isCrash?: boolean;
|
|
11
|
+
constructor(message: string, opts?: {
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
resourceUsage?: ResourceUsage;
|
|
14
|
+
isCrash?: boolean;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
4
17
|
type SubprocessOptions = {
|
|
5
18
|
signal?: AbortSignal;
|
|
19
|
+
onPid?: (pid: number) => void;
|
|
6
20
|
};
|
|
7
21
|
/**
|
|
8
22
|
* Execute a step in an isolated child process
|
|
9
23
|
*
|
|
10
|
-
* Spawns a subprocess using
|
|
11
|
-
*
|
|
24
|
+
* Spawns a subprocess using Bun.spawn, captures stdout/stderr,
|
|
25
|
+
* reads step output from a file, and collects resource usage metrics.
|
|
12
26
|
*
|
|
13
27
|
* @param stepFile - Absolute path to the step.ts file
|
|
14
28
|
* @param stepId - Unique identifier of the step (directory name)
|
|
@@ -21,11 +35,13 @@ type SubprocessOptions = {
|
|
|
21
35
|
* @param onCheckpointFailed - Optional callback for persisting checkpoint failures
|
|
22
36
|
* @param existingCheckpoints - Existing checkpoints to replay (name -> data[] by sequence)
|
|
23
37
|
* @param options - Additional options (signal for abort)
|
|
24
|
-
* @returns Promise resolving to step result and
|
|
38
|
+
* @returns Promise resolving to step result, collected logs, and resource usage
|
|
25
39
|
*/
|
|
26
40
|
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<{
|
|
27
41
|
result: StepOutput;
|
|
28
42
|
logs: LogEntry[];
|
|
43
|
+
resourceUsage?: ResourceUsage;
|
|
44
|
+
pid: number;
|
|
29
45
|
}>;
|
|
30
46
|
export {};
|
|
31
47
|
//# sourceMappingURL=subprocess-executor.d.ts.map
|
|
@@ -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":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAQL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;gBACN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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.3.
|
|
25
|
+
"@cascade-flow/backend-filesystem": "0.2.18",
|
|
26
|
+
"@cascade-flow/backend-interface": "0.2.9",
|
|
27
|
+
"@cascade-flow/workflow": "0.3.5",
|
|
28
28
|
"zod": "^4.1.12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|