flowcraft 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +37 -134
  2. package/dist/analysis.d.ts +43 -0
  3. package/dist/analysis.js +3 -0
  4. package/dist/chunk-4PELJWF7.js +29 -0
  5. package/dist/chunk-4PELJWF7.js.map +1 -0
  6. package/dist/chunk-55J6XMHW.js +3 -0
  7. package/dist/{chunk-7XUN3OQT.js.map → chunk-55J6XMHW.js.map} +1 -1
  8. package/dist/chunk-5EHIPX23.js +202 -0
  9. package/dist/chunk-5EHIPX23.js.map +1 -0
  10. package/dist/chunk-5QMPFUKA.js +40 -0
  11. package/dist/chunk-5QMPFUKA.js.map +1 -0
  12. package/dist/chunk-5ZWYSKMH.js +147 -0
  13. package/dist/chunk-5ZWYSKMH.js.map +1 -0
  14. package/dist/chunk-5ZXV3R5D.js +28 -0
  15. package/dist/chunk-5ZXV3R5D.js.map +1 -0
  16. package/dist/chunk-CO5BTPKI.js +410 -0
  17. package/dist/chunk-CO5BTPKI.js.map +1 -0
  18. package/dist/chunk-CSZ6EOWG.js +61 -0
  19. package/dist/chunk-CSZ6EOWG.js.map +1 -0
  20. package/dist/chunk-CYHZ2YVH.js +24 -0
  21. package/dist/chunk-CYHZ2YVH.js.map +1 -0
  22. package/dist/chunk-DSYAC4WB.js +27 -0
  23. package/dist/chunk-DSYAC4WB.js.map +1 -0
  24. package/dist/chunk-HMR2GEGE.js +3 -0
  25. package/dist/{chunk-F2RSES6P.js.map → chunk-HMR2GEGE.js.map} +1 -1
  26. package/dist/chunk-HN72TZY5.js +110 -0
  27. package/dist/chunk-HN72TZY5.js.map +1 -0
  28. package/dist/chunk-KWQHFT7E.js +49 -0
  29. package/dist/chunk-KWQHFT7E.js.map +1 -0
  30. package/dist/chunk-PH2IYZHV.js +48 -0
  31. package/dist/chunk-PH2IYZHV.js.map +1 -0
  32. package/dist/chunk-QRMUKDSP.js +141 -0
  33. package/dist/chunk-QRMUKDSP.js.map +1 -0
  34. package/dist/chunk-UETC63DP.js +65 -0
  35. package/dist/chunk-UETC63DP.js.map +1 -0
  36. package/dist/chunk-UMXW3TCY.js +165 -0
  37. package/dist/chunk-UMXW3TCY.js.map +1 -0
  38. package/dist/context.d.ts +23 -105
  39. package/dist/context.js +1 -1
  40. package/dist/errors.d.ts +15 -31
  41. package/dist/errors.js +1 -1
  42. package/dist/evaluator.d.ts +30 -0
  43. package/dist/evaluator.js +3 -0
  44. package/dist/evaluator.js.map +1 -0
  45. package/dist/flow.d.ts +55 -0
  46. package/dist/flow.js +4 -0
  47. package/dist/flow.js.map +1 -0
  48. package/dist/index.d.ts +15 -16
  49. package/dist/index.js +17 -25
  50. package/dist/linter.d.ts +24 -0
  51. package/dist/linter.js +4 -0
  52. package/dist/linter.js.map +1 -0
  53. package/dist/logger.d.ts +15 -40
  54. package/dist/logger.js +1 -1
  55. package/dist/node.d.ts +1 -0
  56. package/dist/node.js +3 -0
  57. package/dist/node.js.map +1 -0
  58. package/dist/runtime/adapter.d.ts +94 -0
  59. package/dist/runtime/adapter.js +15 -0
  60. package/dist/runtime/adapter.js.map +1 -0
  61. package/dist/runtime/executors.d.ts +26 -0
  62. package/dist/runtime/executors.js +4 -0
  63. package/dist/runtime/executors.js.map +1 -0
  64. package/dist/runtime/index.d.ts +7 -0
  65. package/dist/runtime/index.js +16 -0
  66. package/dist/runtime/runtime.d.ts +34 -0
  67. package/dist/runtime/runtime.js +14 -0
  68. package/dist/runtime/runtime.js.map +1 -0
  69. package/dist/runtime/state.d.ts +21 -0
  70. package/dist/runtime/state.js +4 -0
  71. package/dist/runtime/state.js.map +1 -0
  72. package/dist/runtime/traverser.d.ts +25 -0
  73. package/dist/runtime/traverser.js +5 -0
  74. package/dist/runtime/traverser.js.map +1 -0
  75. package/dist/runtime/types.d.ts +15 -0
  76. package/dist/runtime/types.js +3 -0
  77. package/dist/sanitizer.d.ts +10 -0
  78. package/dist/sanitizer.js +3 -0
  79. package/dist/{utils/sanitize.js.map → sanitizer.js.map} +1 -1
  80. package/dist/serializer.d.ts +16 -0
  81. package/dist/serializer.js +3 -0
  82. package/dist/serializer.js.map +1 -0
  83. package/dist/types-lG3xCzp_.d.ts +206 -0
  84. package/dist/types.d.ts +1 -3
  85. package/dist/types.js +1 -1
  86. package/package.json +10 -21
  87. package/LICENSE +0 -21
  88. package/dist/builder/graph/graph.d.ts +0 -57
  89. package/dist/builder/graph/graph.js +0 -21
  90. package/dist/builder/graph/graph.js.map +0 -1
  91. package/dist/builder/graph/index.d.ts +0 -8
  92. package/dist/builder/graph/index.js +0 -23
  93. package/dist/builder/graph/internal-nodes.d.ts +0 -59
  94. package/dist/builder/graph/internal-nodes.js +0 -20
  95. package/dist/builder/graph/internal-nodes.js.map +0 -1
  96. package/dist/builder/graph/runner.d.ts +0 -51
  97. package/dist/builder/graph/runner.js +0 -21
  98. package/dist/builder/graph/runner.js.map +0 -1
  99. package/dist/builder/graph/types.d.ts +0 -3
  100. package/dist/builder/graph/types.js +0 -3
  101. package/dist/builder/index.d.ts +0 -8
  102. package/dist/builder/index.js +0 -24
  103. package/dist/builder/index.js.map +0 -1
  104. package/dist/builder/patterns.d.ts +0 -136
  105. package/dist/builder/patterns.js +0 -19
  106. package/dist/builder/patterns.js.map +0 -1
  107. package/dist/chunk-3YMBNZ77.js +0 -441
  108. package/dist/chunk-3YMBNZ77.js.map +0 -1
  109. package/dist/chunk-64DNBF5W.js +0 -36
  110. package/dist/chunk-64DNBF5W.js.map +0 -1
  111. package/dist/chunk-6QCXIRLA.js +0 -18
  112. package/dist/chunk-6QCXIRLA.js.map +0 -1
  113. package/dist/chunk-7XUN3OQT.js +0 -3
  114. package/dist/chunk-AOHBHYF6.js +0 -7
  115. package/dist/chunk-AOHBHYF6.js.map +0 -1
  116. package/dist/chunk-BRFMFLR6.js +0 -85
  117. package/dist/chunk-BRFMFLR6.js.map +0 -1
  118. package/dist/chunk-ELEHMJPM.js +0 -13
  119. package/dist/chunk-ELEHMJPM.js.map +0 -1
  120. package/dist/chunk-F2RSES6P.js +0 -3
  121. package/dist/chunk-F6C6J7HK.js +0 -3
  122. package/dist/chunk-F6C6J7HK.js.map +0 -1
  123. package/dist/chunk-GMKJ34T2.js +0 -3
  124. package/dist/chunk-GMKJ34T2.js.map +0 -1
  125. package/dist/chunk-HEO3XL4Z.js +0 -328
  126. package/dist/chunk-HEO3XL4Z.js.map +0 -1
  127. package/dist/chunk-IIKTTIW5.js +0 -56
  128. package/dist/chunk-IIKTTIW5.js.map +0 -1
  129. package/dist/chunk-KOBEU2EM.js +0 -3
  130. package/dist/chunk-KOBEU2EM.js.map +0 -1
  131. package/dist/chunk-L5PK5VL2.js +0 -178
  132. package/dist/chunk-L5PK5VL2.js.map +0 -1
  133. package/dist/chunk-P3RPDZHO.js +0 -36
  134. package/dist/chunk-P3RPDZHO.js.map +0 -1
  135. package/dist/chunk-PNWOW52F.js +0 -19
  136. package/dist/chunk-PNWOW52F.js.map +0 -1
  137. package/dist/chunk-R27FIYR5.js +0 -62
  138. package/dist/chunk-R27FIYR5.js.map +0 -1
  139. package/dist/chunk-S4WFNGQG.js +0 -17
  140. package/dist/chunk-S4WFNGQG.js.map +0 -1
  141. package/dist/chunk-TS3M7MWA.js +0 -3
  142. package/dist/chunk-TS3M7MWA.js.map +0 -1
  143. package/dist/chunk-UY4PNPBX.js +0 -156
  144. package/dist/chunk-UY4PNPBX.js.map +0 -1
  145. package/dist/chunk-VMH2LRM6.js +0 -114
  146. package/dist/chunk-VMH2LRM6.js.map +0 -1
  147. package/dist/chunk-VZDHIOCH.js +0 -76
  148. package/dist/chunk-VZDHIOCH.js.map +0 -1
  149. package/dist/chunk-WGVHM7DU.js +0 -66
  150. package/dist/chunk-WGVHM7DU.js.map +0 -1
  151. package/dist/chunk-WR5PDOPP.js +0 -91
  152. package/dist/chunk-WR5PDOPP.js.map +0 -1
  153. package/dist/chunk-YR433ZDA.js +0 -20
  154. package/dist/chunk-YR433ZDA.js.map +0 -1
  155. package/dist/executors/in-memory.d.ts +0 -39
  156. package/dist/executors/in-memory.js +0 -6
  157. package/dist/executors/in-memory.js.map +0 -1
  158. package/dist/executors/types.d.ts +0 -3
  159. package/dist/executors/types.js +0 -3
  160. package/dist/executors/types.js.map +0 -1
  161. package/dist/functions.d.ts +0 -88
  162. package/dist/functions.js +0 -21
  163. package/dist/functions.js.map +0 -1
  164. package/dist/types-U76Ukj96.d.ts +0 -609
  165. package/dist/utils/analysis.d.ts +0 -75
  166. package/dist/utils/analysis.js +0 -3
  167. package/dist/utils/index.d.ts +0 -8
  168. package/dist/utils/index.js +0 -10
  169. package/dist/utils/index.js.map +0 -1
  170. package/dist/utils/mermaid.d.ts +0 -46
  171. package/dist/utils/mermaid.js +0 -4
  172. package/dist/utils/mermaid.js.map +0 -1
  173. package/dist/utils/middleware.d.ts +0 -11
  174. package/dist/utils/middleware.js +0 -3
  175. package/dist/utils/middleware.js.map +0 -1
  176. package/dist/utils/sanitize.d.ts +0 -19
  177. package/dist/utils/sanitize.js +0 -3
  178. package/dist/utils/sleep.d.ts +0 -9
  179. package/dist/utils/sleep.js +0 -4
  180. package/dist/utils/sleep.js.map +0 -1
  181. package/dist/workflow/AbstractNode.d.ts +0 -3
  182. package/dist/workflow/AbstractNode.js +0 -4
  183. package/dist/workflow/AbstractNode.js.map +0 -1
  184. package/dist/workflow/Flow.d.ts +0 -3
  185. package/dist/workflow/Flow.js +0 -16
  186. package/dist/workflow/Flow.js.map +0 -1
  187. package/dist/workflow/Node.d.ts +0 -3
  188. package/dist/workflow/Node.js +0 -15
  189. package/dist/workflow/Node.js.map +0 -1
  190. package/dist/workflow/index.d.ts +0 -4
  191. package/dist/workflow/index.js +0 -18
  192. package/dist/workflow/index.js.map +0 -1
  193. package/dist/workflow/node-patterns.d.ts +0 -55
  194. package/dist/workflow/node-patterns.js +0 -16
  195. package/dist/workflow/node-patterns.js.map +0 -1
  196. package/dist/workflow/registry.d.ts +0 -17
  197. package/dist/workflow/registry.js +0 -3
  198. package/dist/workflow/registry.js.map +0 -1
  199. /package/dist/{utils/analysis.js.map → analysis.js.map} +0 -0
  200. /package/dist/{builder/graph → runtime}/index.js.map +0 -0
  201. /package/dist/{builder/graph → runtime}/types.js.map +0 -0
package/dist/index.js CHANGED
@@ -1,27 +1,19 @@
1
- import './chunk-TS3M7MWA.js';
2
- export { compose, contextNode, mapNode, pipeline, transformNode } from './chunk-P3RPDZHO.js';
3
- export { TypedContext, composeContext, contextKey, lens } from './chunk-R27FIYR5.js';
4
- import './chunk-F2RSES6P.js';
5
- import './chunk-GMKJ34T2.js';
6
- import './chunk-KOBEU2EM.js';
7
- export { BlueprintExecutor, GraphBuilder, createNodeRegistry } from './chunk-3YMBNZ77.js';
8
- export { ConditionalJoinNode, InputMappingNode, OutputMappingNode, ParallelBranchContainer, SubWorkflowContainerNode } from './chunk-WGVHM7DU.js';
9
- export { BatchFlow, ParallelBatchFlow, ParallelFlow, SequenceFlow, filterCollection, mapCollection, reduceCollection } from './chunk-L5PK5VL2.js';
10
- import './chunk-F6C6J7HK.js';
11
- export { Flow } from './chunk-UY4PNPBX.js';
12
- export { ExecNode, PostNode, PreNode } from './chunk-ELEHMJPM.js';
13
- export { Node } from './chunk-HEO3XL4Z.js';
14
- import './chunk-7XUN3OQT.js';
15
- export { analyzeGraph, checkForCycles, createNodeRule, isNodeType } from './chunk-WR5PDOPP.js';
16
- export { generateMermaidFromBlueprint, generateMermaidGraph } from './chunk-VMH2LRM6.js';
17
- export { sanitizeGraph } from './chunk-YR433ZDA.js';
18
- export { sleep } from './chunk-6QCXIRLA.js';
19
- export { InMemoryExecutor } from './chunk-BRFMFLR6.js';
20
- export { applyMiddleware } from './chunk-PNWOW52F.js';
21
- export { AbstractNode } from './chunk-VZDHIOCH.js';
22
- import './chunk-S4WFNGQG.js';
23
- export { AbortError, FatalWorkflowError, WorkflowError } from './chunk-64DNBF5W.js';
24
- export { ConsoleLogger, NullLogger } from './chunk-IIKTTIW5.js';
25
- export { DEFAULT_ACTION, FILTER_FAILED } from './chunk-AOHBHYF6.js';
1
+ import './chunk-55J6XMHW.js';
2
+ import './chunk-HMR2GEGE.js';
3
+ export { BaseDistributedAdapter } from './chunk-5EHIPX23.js';
4
+ export { FlowRuntime } from './chunk-CO5BTPKI.js';
5
+ export { WorkflowState } from './chunk-CSZ6EOWG.js';
6
+ export { GraphTraverser } from './chunk-UMXW3TCY.js';
7
+ export { sanitizeBlueprint } from './chunk-DSYAC4WB.js';
8
+ import './chunk-CYHZ2YVH.js';
9
+ export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor } from './chunk-QRMUKDSP.js';
10
+ export { AsyncContextView, Context } from './chunk-KWQHFT7E.js';
11
+ export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-5ZXV3R5D.js';
12
+ export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
13
+ export { Flow, createFlow } from './chunk-5ZWYSKMH.js';
14
+ export { BaseNode, isNodeClass } from './chunk-5QMPFUKA.js';
15
+ export { lintBlueprint } from './chunk-UETC63DP.js';
16
+ export { analyzeBlueprint, checkForCycles, generateMermaid } from './chunk-HN72TZY5.js';
17
+ export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
26
18
  //# sourceMappingURL=index.js.map
27
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,24 @@
1
+ import { W as WorkflowBlueprint, d as NodeFunction, e as NodeClass } from './types-lG3xCzp_.js';
2
+
3
+ type LinterIssueCode = 'INVALID_EDGE_SOURCE' | 'INVALID_EDGE_TARGET' | 'MISSING_NODE_IMPLEMENTATION' | 'ORPHAN_NODE';
4
+ interface LinterIssue {
5
+ code: LinterIssueCode;
6
+ message: string;
7
+ nodeId?: string;
8
+ relatedId?: string;
9
+ }
10
+ interface LinterResult {
11
+ isValid: boolean;
12
+ issues: LinterIssue[];
13
+ }
14
+ /**
15
+ * Statically analyzes a workflow blueprint against a registry of implementations
16
+ * to find common errors before runtime.
17
+ *
18
+ * @param blueprint The WorkflowBlueprint to analyze.
19
+ * @param registry A map of node implementations (functions or classes) to check against.
20
+ * @returns A LinterResult object containing any issues found.
21
+ */
22
+ declare function lintBlueprint(blueprint: WorkflowBlueprint, registry: Map<string, NodeFunction | NodeClass> | Record<string, NodeFunction | NodeClass>): LinterResult;
23
+
24
+ export { type LinterIssue, type LinterIssueCode, type LinterResult, lintBlueprint };
package/dist/linter.js ADDED
@@ -0,0 +1,4 @@
1
+ export { lintBlueprint } from './chunk-UETC63DP.js';
2
+ import './chunk-HN72TZY5.js';
3
+ //# sourceMappingURL=linter.js.map
4
+ //# sourceMappingURL=linter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"linter.js"}
package/dist/logger.d.ts CHANGED
@@ -1,43 +1,18 @@
1
- /**
2
- * Defines the interface for a logger that can be used by the workflow engine.
3
- * This allows for plugging in any logging library (e.g., Pino, Winston).
4
- */
5
- interface Logger {
6
- debug: (message: string, context?: object) => void;
7
- info: (message: string, context?: object) => void;
8
- warn: (message: string, context?: object) => void;
9
- error: (message: string, context?: object) => void;
10
- }
11
- /**
12
- * A logger implementation that performs no action (a "no-op" logger).
13
- * This is the default logger used by the framework if none is provided,
14
- * making Flowcraft silent out-of-the-box.
15
- */
16
- declare class NullLogger implements Logger {
17
- debug(): void;
18
- info(): void;
19
- warn(): void;
20
- error(): void;
1
+ import { l as ILogger } from './types-lG3xCzp_.js';
2
+
3
+ /** A logger implementation that outputs to the console. */
4
+ declare class ConsoleLogger implements ILogger {
5
+ debug(message: string, meta?: Record<string, any>): void;
6
+ info(message: string, meta?: Record<string, any>): void;
7
+ warn(message: string, meta?: Record<string, any>): void;
8
+ error(message: string, meta?: Record<string, any>): void;
21
9
  }
22
- type LogLevel = 'debug' | 'info' | 'warn' | 'error';
23
- /**
24
- * A default logger implementation that writes messages to the `console`.
25
- * It supports a minimum log level to control verbosity.
26
- */
27
- declare class ConsoleLogger implements Logger {
28
- private minLevel;
29
- /**
30
- * @param options Configuration for the logger.
31
- * @param options.level The minimum level of messages to log. Defaults to 'info'.
32
- */
33
- constructor(options?: {
34
- level?: LogLevel;
35
- });
36
- private log;
37
- debug(message: string, context?: object): void;
38
- info(message: string, context?: object): void;
39
- warn(message: string, context?: object): void;
40
- error(message: string, context?: object): void;
10
+ /** A logger implementation that does nothing (no-op). */
11
+ declare class NullLogger implements ILogger {
12
+ debug(_message: string, _meta?: Record<string, any>): void;
13
+ info(_message: string, _meta?: Record<string, any>): void;
14
+ warn(_message: string, _meta?: Record<string, any>): void;
15
+ error(_message: string, _meta?: Record<string, any>): void;
41
16
  }
42
17
 
43
- export { ConsoleLogger, type Logger, NullLogger };
18
+ export { ConsoleLogger, NullLogger };
package/dist/logger.js CHANGED
@@ -1,3 +1,3 @@
1
- export { ConsoleLogger, NullLogger } from './chunk-IIKTTIW5.js';
1
+ export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
2
2
  //# sourceMappingURL=logger.js.map
3
3
  //# sourceMappingURL=logger.js.map
package/dist/node.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { B as BaseNode, i as isNodeClass } from './types-lG3xCzp_.js';
package/dist/node.js ADDED
@@ -0,0 +1,3 @@
1
+ export { BaseNode, isNodeClass } from './chunk-5QMPFUKA.js';
2
+ //# sourceMappingURL=node.js.map
3
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"node.js"}
@@ -0,0 +1,94 @@
1
+ import { j as RuntimeOptions, n as ISerializer, h as IAsyncContext, p as WorkflowResult, W as WorkflowBlueprint } from '../types-lG3xCzp_.js';
2
+ import { FlowRuntime } from './runtime.js';
3
+ import './state.js';
4
+ import './types.js';
5
+
6
+ /**
7
+ * Defines the contract for an atomic, distributed key-value store required by
8
+ * the adapter for coordination tasks like fan-in joins and locking.
9
+ */
10
+ interface ICoordinationStore {
11
+ /** Atomically increments a key and returns the new value. Ideal for 'all' joins. */
12
+ increment: (key: string, ttlSeconds: number) => Promise<number>;
13
+ /** Sets a key only if it does not already exist. Ideal for 'any' joins (locking). */
14
+ setIfNotExist: (key: string, value: string, ttlSeconds: number) => Promise<boolean>;
15
+ /** Deletes a key. Used for cleanup. */
16
+ delete: (key: string) => Promise<void>;
17
+ }
18
+ /** Configuration options for constructing a BaseDistributedAdapter. */
19
+ interface AdapterOptions {
20
+ runtimeOptions: RuntimeOptions<any>;
21
+ coordinationStore: ICoordinationStore;
22
+ }
23
+ /** The data payload expected for a job in the queue. */
24
+ interface JobPayload {
25
+ runId: string;
26
+ blueprintId: string;
27
+ nodeId: string;
28
+ }
29
+ /**
30
+ * The base class for all distributed adapters. It handles the technology-agnostic
31
+ * orchestration logic and leaves queue-specific implementation to subclasses.
32
+ */
33
+ declare abstract class BaseDistributedAdapter {
34
+ protected readonly runtime: FlowRuntime<any, any>;
35
+ protected readonly store: ICoordinationStore;
36
+ protected readonly serializer: ISerializer;
37
+ constructor(options: AdapterOptions);
38
+ /**
39
+ * Starts the worker, which begins listening for and processing jobs from the queue.
40
+ */
41
+ start(): void;
42
+ /**
43
+ * Creates a technology-specific distributed context for a given workflow run.
44
+ * @param runId The unique ID for the workflow execution.
45
+ */
46
+ protected abstract createContext(runId: string): IAsyncContext<Record<string, any>>;
47
+ /**
48
+ * Sets up the listener for the message queue. The implementation should call the
49
+ * provided `handler` function for each new job received.
50
+ * @param handler The core logic to execute for each job.
51
+ */
52
+ protected abstract processJobs(handler: (job: JobPayload) => Promise<void>): void;
53
+ /**
54
+ * Enqueues a new job onto the message queue.
55
+ * @param job The payload for the job to be enqueued.
56
+ */
57
+ protected abstract enqueueJob(job: JobPayload): Promise<void>;
58
+ /**
59
+ * Publishes the final result of a completed or failed workflow run.
60
+ * @param runId The unique ID of the workflow run.
61
+ * @param result The final status and payload of the workflow.
62
+ */
63
+ protected abstract publishFinalResult(runId: string, result: {
64
+ status: 'completed' | 'failed';
65
+ payload?: WorkflowResult;
66
+ reason?: string;
67
+ }): Promise<void>;
68
+ /**
69
+ * Hook called at the start of job processing. Subclasses can override this
70
+ * to perform additional setup (e.g., timestamp tracking for reconciliation).
71
+ */
72
+ protected onJobStart(_runId: string, _blueprintId: string, _nodeId: string): Promise<void>;
73
+ /**
74
+ * The main handler for processing a single job from the queue.
75
+ */
76
+ protected handleJob(job: JobPayload): Promise<void>;
77
+ /**
78
+ * Encapsulates the fan-in join logic using the coordination store.
79
+ */
80
+ protected isReadyForFanIn(runId: string, blueprint: WorkflowBlueprint, targetNodeId: string): Promise<boolean>;
81
+ /**
82
+ * Reconciles the state of a workflow run. It inspects the persisted
83
+ * context to find completed nodes, determines the next set of executable
84
+ * nodes (the frontier), and enqueues jobs for them if they aren't
85
+ * already running. This is the core of the resume functionality.
86
+ *
87
+ * @param runId The unique ID of the workflow execution to reconcile.
88
+ * @returns The set of node IDs that were enqueued for execution.
89
+ */
90
+ reconcile(runId: string): Promise<Set<string>>;
91
+ private calculateResumedFrontier;
92
+ }
93
+
94
+ export { type AdapterOptions, BaseDistributedAdapter, type ICoordinationStore, type JobPayload };
@@ -0,0 +1,15 @@
1
+ export { BaseDistributedAdapter } from '../chunk-5EHIPX23.js';
2
+ import '../chunk-CO5BTPKI.js';
3
+ import '../chunk-CSZ6EOWG.js';
4
+ import '../chunk-UMXW3TCY.js';
5
+ import '../chunk-DSYAC4WB.js';
6
+ import '../chunk-CYHZ2YVH.js';
7
+ import '../chunk-QRMUKDSP.js';
8
+ import '../chunk-KWQHFT7E.js';
9
+ import '../chunk-5ZXV3R5D.js';
10
+ import '../chunk-PH2IYZHV.js';
11
+ import '../chunk-5QMPFUKA.js';
12
+ import '../chunk-HN72TZY5.js';
13
+ import '../chunk-4PELJWF7.js';
14
+ //# sourceMappingURL=adapter.js.map
15
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"adapter.js"}
@@ -0,0 +1,26 @@
1
+ import { N as NodeDefinition, c as NodeContext, b as NodeResult, d as NodeFunction, m as IEventBus, e as NodeClass, C as ContextImplementation } from '../types-lG3xCzp_.js';
2
+
3
+ interface ExecutionStrategy {
4
+ execute: (nodeDef: NodeDefinition, context: NodeContext<any, any, any>, executionId?: string, signal?: AbortSignal) => Promise<NodeResult<any, any>>;
5
+ }
6
+ declare class FunctionNodeExecutor implements ExecutionStrategy {
7
+ private implementation;
8
+ private maxRetries;
9
+ private eventBus;
10
+ constructor(implementation: NodeFunction, maxRetries: number, eventBus: IEventBus);
11
+ execute(nodeDef: NodeDefinition, context: NodeContext<any, any, any>, executionId?: string, signal?: AbortSignal): Promise<NodeResult<any, any>>;
12
+ }
13
+ declare class ClassNodeExecutor implements ExecutionStrategy {
14
+ private implementation;
15
+ private maxRetries;
16
+ private eventBus;
17
+ constructor(implementation: NodeClass, maxRetries: number, eventBus: IEventBus);
18
+ execute(nodeDef: NodeDefinition, context: NodeContext<any, any, any>, executionId?: string, signal?: AbortSignal): Promise<NodeResult<any, any>>;
19
+ }
20
+ declare class BuiltInNodeExecutor implements ExecutionStrategy {
21
+ private executeBuiltIn;
22
+ constructor(executeBuiltIn: (nodeDef: NodeDefinition, context: ContextImplementation<any>) => Promise<NodeResult<any, any>>);
23
+ execute(nodeDef: NodeDefinition, context: NodeContext<Record<string, unknown>, Record<string, unknown>, any>): Promise<NodeResult<any, any>>;
24
+ }
25
+
26
+ export { BuiltInNodeExecutor, ClassNodeExecutor, type ExecutionStrategy, FunctionNodeExecutor };
@@ -0,0 +1,4 @@
1
+ export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor } from '../chunk-QRMUKDSP.js';
2
+ import '../chunk-5ZXV3R5D.js';
3
+ //# sourceMappingURL=executors.js.map
4
+ //# sourceMappingURL=executors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"executors.js"}
@@ -0,0 +1,7 @@
1
+ export { AdapterOptions, BaseDistributedAdapter, ICoordinationStore, JobPayload } from './adapter.js';
2
+ export { BuiltInNodeExecutor, ClassNodeExecutor, ExecutionStrategy, FunctionNodeExecutor } from './executors.js';
3
+ export { FlowRuntime } from './runtime.js';
4
+ export { WorkflowState } from './state.js';
5
+ export { GraphTraverser } from './traverser.js';
6
+ import '../types-lG3xCzp_.js';
7
+ import './types.js';
@@ -0,0 +1,16 @@
1
+ import '../chunk-HMR2GEGE.js';
2
+ export { BaseDistributedAdapter } from '../chunk-5EHIPX23.js';
3
+ export { FlowRuntime } from '../chunk-CO5BTPKI.js';
4
+ export { WorkflowState } from '../chunk-CSZ6EOWG.js';
5
+ export { GraphTraverser } from '../chunk-UMXW3TCY.js';
6
+ import '../chunk-DSYAC4WB.js';
7
+ import '../chunk-CYHZ2YVH.js';
8
+ export { BuiltInNodeExecutor, ClassNodeExecutor, FunctionNodeExecutor } from '../chunk-QRMUKDSP.js';
9
+ import '../chunk-KWQHFT7E.js';
10
+ import '../chunk-5ZXV3R5D.js';
11
+ import '../chunk-PH2IYZHV.js';
12
+ import '../chunk-5QMPFUKA.js';
13
+ import '../chunk-HN72TZY5.js';
14
+ import '../chunk-4PELJWF7.js';
15
+ //# sourceMappingURL=index.js.map
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,34 @@
1
+ import { j as RuntimeOptions, W as WorkflowBlueprint, p as WorkflowResult, b as NodeResult, C as ContextImplementation, N as NodeDefinition, E as EdgeDefinition } from '../types-lG3xCzp_.js';
2
+ import { WorkflowState } from './state.js';
3
+ import { IRuntime } from './types.js';
4
+
5
+ declare class FlowRuntime<TContext extends Record<string, any>, TDependencies extends Record<string, any>> implements IRuntime<TContext, TDependencies> {
6
+ private registry;
7
+ private blueprints;
8
+ private dependencies;
9
+ private logger;
10
+ private eventBus;
11
+ private serializer;
12
+ private middleware;
13
+ private evaluator;
14
+ options: RuntimeOptions<TDependencies>;
15
+ constructor(options: RuntimeOptions<TDependencies>);
16
+ run(blueprint: WorkflowBlueprint, initialState?: Partial<TContext> | string, options?: {
17
+ functionRegistry?: Map<string, any>;
18
+ strict?: boolean;
19
+ signal?: AbortSignal;
20
+ concurrency?: number;
21
+ }): Promise<WorkflowResult<TContext>>;
22
+ executeNode(blueprint: WorkflowBlueprint, nodeId: string, state: WorkflowState<TContext>, allPredecessors?: Map<string, Set<string>>, functionRegistry?: Map<string, any>, executionId?: string, signal?: AbortSignal): Promise<NodeResult<any, any>>;
23
+ private getExecutor;
24
+ private executeWithFallback;
25
+ determineNextNodes(blueprint: WorkflowBlueprint, nodeId: string, result: NodeResult<any, any>, context: ContextImplementation<TContext>): Promise<{
26
+ node: NodeDefinition;
27
+ edge: EdgeDefinition;
28
+ }[]>;
29
+ applyEdgeTransform(edge: EdgeDefinition, sourceResult: NodeResult<any, any>, targetNode: NodeDefinition, context: ContextImplementation<TContext>, allPredecessors?: Map<string, Set<string>>): Promise<void>;
30
+ private _resolveNodeInput;
31
+ protected _executeBuiltInNode(nodeDef: NodeDefinition, contextImpl: ContextImplementation<TContext>): Promise<NodeResult<any, any>>;
32
+ }
33
+
34
+ export { FlowRuntime };
@@ -0,0 +1,14 @@
1
+ export { FlowRuntime } from '../chunk-CO5BTPKI.js';
2
+ import '../chunk-CSZ6EOWG.js';
3
+ import '../chunk-UMXW3TCY.js';
4
+ import '../chunk-DSYAC4WB.js';
5
+ import '../chunk-CYHZ2YVH.js';
6
+ import '../chunk-QRMUKDSP.js';
7
+ import '../chunk-KWQHFT7E.js';
8
+ import '../chunk-5ZXV3R5D.js';
9
+ import '../chunk-PH2IYZHV.js';
10
+ import '../chunk-5QMPFUKA.js';
11
+ import '../chunk-HN72TZY5.js';
12
+ import '../chunk-4PELJWF7.js';
13
+ //# sourceMappingURL=runtime.js.map
14
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"runtime.js"}
@@ -0,0 +1,21 @@
1
+ import { C as ContextImplementation, o as WorkflowError, p as WorkflowResult, n as ISerializer } from '../types-lG3xCzp_.js';
2
+
3
+ declare class WorkflowState<TContext extends Record<string, any>> {
4
+ private _completedNodes;
5
+ private errors;
6
+ private anyFallbackExecuted;
7
+ private context;
8
+ constructor(initialData: Partial<TContext>);
9
+ addCompletedNode(nodeId: string, output: any): void;
10
+ addError(nodeId: string, error: Error): void;
11
+ clearError(nodeId: string): void;
12
+ markFallbackExecuted(): void;
13
+ getContext(): ContextImplementation<TContext>;
14
+ getCompletedNodes(): Set<string>;
15
+ getErrors(): WorkflowError[];
16
+ getAnyFallbackExecuted(): boolean;
17
+ getStatus(allNodeIds: Set<string>, _fallbackNodeIds: Set<string>): WorkflowResult['status'];
18
+ toResult(serializer: ISerializer): WorkflowResult<TContext>;
19
+ }
20
+
21
+ export { WorkflowState };
@@ -0,0 +1,4 @@
1
+ export { WorkflowState } from '../chunk-CSZ6EOWG.js';
2
+ import '../chunk-KWQHFT7E.js';
3
+ //# sourceMappingURL=state.js.map
4
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"state.js"}
@@ -0,0 +1,25 @@
1
+ import { W as WorkflowBlueprint } from '../types-lG3xCzp_.js';
2
+ import { WorkflowState } from './state.js';
3
+ import { IRuntime } from './types.js';
4
+
5
+ declare class GraphTraverser<TContext extends Record<string, any>, TDependencies extends Record<string, any>> {
6
+ private runtime;
7
+ private state;
8
+ private functionRegistry;
9
+ private executionId;
10
+ private signal?;
11
+ private concurrency?;
12
+ private frontier;
13
+ private allPredecessors;
14
+ private dynamicBlueprint;
15
+ constructor(blueprint: WorkflowBlueprint, runtime: IRuntime<TContext, TDependencies>, state: WorkflowState<TContext>, functionRegistry: Map<string, any> | undefined, executionId: string, signal?: AbortSignal | undefined, concurrency?: number | undefined);
16
+ private isFallbackNode;
17
+ traverse(): Promise<void>;
18
+ private executeWithConcurrency;
19
+ private handleDynamicNodes;
20
+ getAllNodeIds(): Set<string>;
21
+ getFallbackNodeIds(): Set<string>;
22
+ getDynamicBlueprint(): WorkflowBlueprint;
23
+ }
24
+
25
+ export { GraphTraverser };
@@ -0,0 +1,5 @@
1
+ export { GraphTraverser } from '../chunk-UMXW3TCY.js';
2
+ import '../chunk-5ZXV3R5D.js';
3
+ import '../chunk-HN72TZY5.js';
4
+ //# sourceMappingURL=traverser.js.map
5
+ //# sourceMappingURL=traverser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"traverser.js"}
@@ -0,0 +1,15 @@
1
+ import { R as RuntimeDependencies, j as RuntimeOptions, W as WorkflowBlueprint, b as NodeResult, C as ContextImplementation, N as NodeDefinition, E as EdgeDefinition } from '../types-lG3xCzp_.js';
2
+ import { WorkflowState } from './state.js';
3
+
4
+ /** Interface for the core runtime operations used by the traverser. */
5
+ interface IRuntime<TContext extends Record<string, any> = Record<string, any>, TDependencies extends RuntimeDependencies = RuntimeDependencies> {
6
+ options: RuntimeOptions<TDependencies>;
7
+ executeNode: (blueprint: WorkflowBlueprint, nodeId: string, state: WorkflowState<TContext>, allPredecessors?: Map<string, Set<string>>, functionRegistry?: Map<string, any>, executionId?: string, signal?: AbortSignal) => Promise<NodeResult>;
8
+ determineNextNodes: (blueprint: WorkflowBlueprint, nodeId: string, result: NodeResult, context: ContextImplementation<TContext>) => Promise<{
9
+ node: NodeDefinition;
10
+ edge: EdgeDefinition;
11
+ }[]>;
12
+ applyEdgeTransform: (edge: EdgeDefinition, sourceResult: NodeResult, targetNode: NodeDefinition, context: ContextImplementation<TContext>, allPredecessors?: Map<string, Set<string>>) => Promise<void>;
13
+ }
14
+
15
+ export type { IRuntime };
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=types.js.map
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,10 @@
1
+ import { W as WorkflowBlueprint } from './types-lG3xCzp_.js';
2
+
3
+ /**
4
+ * Sanitizes a raw workflow blueprint by removing extra properties
5
+ * added by UI tools (e.g., position, style) and keeping only the
6
+ * properties defined in NodeDefinition and EdgeDefinition.
7
+ */
8
+ declare function sanitizeBlueprint(raw: any): WorkflowBlueprint;
9
+
10
+ export { sanitizeBlueprint };
@@ -0,0 +1,3 @@
1
+ export { sanitizeBlueprint } from './chunk-DSYAC4WB.js';
2
+ //# sourceMappingURL=sanitizer.js.map
3
+ //# sourceMappingURL=sanitizer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"sanitize.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"sanitizer.js"}
@@ -0,0 +1,16 @@
1
+ import { n as ISerializer } from './types-lG3xCzp_.js';
2
+
3
+ /**
4
+ * A default serializer using standard JSON.
5
+ *
6
+ * @warning This implementation is lossy and does not handle complex data types
7
+ * like `Date`, `Map`, `Set`, `undefined`, etc. It is recommended to provide a robust
8
+ * serializer like `superjson` if working with complex data types.
9
+ */
10
+ declare class JsonSerializer implements ISerializer {
11
+ private hasWarned;
12
+ serialize(data: Record<string, any>): string;
13
+ deserialize(text: string): Record<string, any>;
14
+ }
15
+
16
+ export { JsonSerializer };
@@ -0,0 +1,3 @@
1
+ export { JsonSerializer } from './chunk-CYHZ2YVH.js';
2
+ //# sourceMappingURL=serializer.js.map
3
+ //# sourceMappingURL=serializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"serializer.js"}