flowcraft 2.2.0 → 2.3.1
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 +40 -34
- package/dist/analysis.d.ts +3 -1
- package/dist/chunk-33NO4PUJ.js +74 -0
- package/dist/chunk-33NO4PUJ.js.map +1 -0
- package/dist/chunk-BC4G7OM6.js +42 -0
- package/dist/chunk-BC4G7OM6.js.map +1 -0
- package/dist/chunk-BCRWXTWX.js +21 -0
- package/dist/chunk-BCRWXTWX.js.map +1 -0
- package/dist/chunk-BN4MV36K.js +25 -0
- package/dist/chunk-BN4MV36K.js.map +1 -0
- package/dist/{chunk-ZCHFZBGL.js → chunk-C4HYIJI3.js} +120 -5
- package/dist/chunk-C4HYIJI3.js.map +1 -0
- package/dist/chunk-CD3Q4N6V.js +13 -0
- package/dist/chunk-CD3Q4N6V.js.map +1 -0
- package/dist/chunk-CD4FUZOJ.js +114 -0
- package/dist/chunk-CD4FUZOJ.js.map +1 -0
- package/dist/chunk-DL7KVYZF.js +39 -0
- package/dist/chunk-DL7KVYZF.js.map +1 -0
- package/dist/chunk-FRKO3WX4.js +32 -0
- package/dist/chunk-FRKO3WX4.js.map +1 -0
- package/dist/chunk-G53CSLBF.js +54 -0
- package/dist/chunk-G53CSLBF.js.map +1 -0
- package/dist/chunk-G5BGBPFP.js +172 -0
- package/dist/chunk-G5BGBPFP.js.map +1 -0
- package/dist/chunk-HAZ26F3P.js +98 -0
- package/dist/chunk-HAZ26F3P.js.map +1 -0
- package/dist/chunk-HKX7WQLS.js +446 -0
- package/dist/chunk-HKX7WQLS.js.map +1 -0
- package/dist/{chunk-U5V5O5MN.js → chunk-LNK7LZER.js} +5 -3
- package/dist/chunk-LNK7LZER.js.map +1 -0
- package/dist/chunk-MCGK3FXQ.js +143 -0
- package/dist/chunk-MCGK3FXQ.js.map +1 -0
- package/dist/chunk-MKNZBKSR.js +90 -0
- package/dist/chunk-MKNZBKSR.js.map +1 -0
- package/dist/chunk-MUYLRTSR.js +82 -0
- package/dist/chunk-MUYLRTSR.js.map +1 -0
- package/dist/chunk-NVJ3ZO3P.js +3 -0
- package/dist/{chunk-HMR2GEGE.js.map → chunk-NVJ3ZO3P.js.map} +1 -1
- package/dist/chunk-NVLZFLYM.js +3 -0
- package/dist/chunk-NVLZFLYM.js.map +1 -0
- package/dist/chunk-ONH7PIJZ.js +300 -0
- package/dist/chunk-ONH7PIJZ.js.map +1 -0
- package/dist/chunk-QNYXQKFW.js +25 -0
- package/dist/chunk-QNYXQKFW.js.map +1 -0
- package/dist/chunk-RM677CNU.js +52 -0
- package/dist/chunk-RM677CNU.js.map +1 -0
- package/dist/chunk-WWGFIYKW.js +47 -0
- package/dist/chunk-WWGFIYKW.js.map +1 -0
- package/dist/chunk-XNRIM27H.js +76 -0
- package/dist/chunk-XNRIM27H.js.map +1 -0
- package/dist/{chunk-QLGJUDQF.js → chunk-ZNL7ZXPR.js} +26 -11
- package/dist/chunk-ZNL7ZXPR.js.map +1 -0
- package/dist/container-factory.d.ts +17 -0
- package/dist/container-factory.js +13 -0
- package/dist/container-factory.js.map +1 -0
- package/dist/container.d.ts +23 -0
- package/dist/container.js +3 -0
- package/dist/container.js.map +1 -0
- package/dist/context.d.ts +3 -1
- package/dist/errors.d.ts +18 -17
- package/dist/errors.js +1 -1
- package/dist/evaluator.d.ts +3 -1
- package/dist/flow.d.ts +12 -2
- package/dist/flow.js +2 -2
- package/dist/index.d.ts +7 -8
- package/dist/index.js +26 -14
- package/dist/linter.d.ts +3 -1
- package/dist/logger.d.ts +3 -1
- package/dist/node.d.ts +3 -1
- package/dist/node.js +1 -1
- package/dist/nodes/batch-gather.d.ts +9 -0
- package/dist/nodes/batch-gather.js +4 -0
- package/dist/nodes/batch-gather.js.map +1 -0
- package/dist/nodes/batch-scatter.d.ts +9 -0
- package/dist/nodes/batch-scatter.js +4 -0
- package/dist/nodes/batch-scatter.js.map +1 -0
- package/dist/nodes/subflow.d.ts +9 -0
- package/dist/nodes/subflow.js +10 -0
- package/dist/nodes/subflow.js.map +1 -0
- package/dist/nodes/wait.d.ts +9 -0
- package/dist/nodes/wait.js +4 -0
- package/dist/nodes/wait.js.map +1 -0
- package/dist/runtime/adapter.d.ts +3 -5
- package/dist/runtime/adapter.js +19 -9
- package/dist/runtime/execution-context.d.ts +3 -0
- package/dist/runtime/execution-context.js +6 -0
- package/dist/runtime/execution-context.js.map +1 -0
- package/dist/runtime/executors.d.ts +3 -26
- package/dist/runtime/executors.js +2 -2
- package/dist/runtime/index.d.ts +5 -7
- package/dist/runtime/index.js +21 -10
- package/dist/runtime/node-executor-factory.d.ts +12 -0
- package/dist/runtime/node-executor-factory.js +6 -0
- package/dist/runtime/node-executor-factory.js.map +1 -0
- package/dist/runtime/orchestrator.d.ts +9 -0
- package/dist/runtime/orchestrator.js +8 -0
- package/dist/runtime/orchestrator.js.map +1 -0
- package/dist/runtime/orchestrators/step-by-step.d.ts +16 -0
- package/dist/runtime/orchestrators/step-by-step.js +5 -0
- package/dist/runtime/orchestrators/step-by-step.js.map +1 -0
- package/dist/runtime/orchestrators/utils.d.ts +35 -0
- package/dist/runtime/orchestrators/utils.js +4 -0
- package/dist/runtime/orchestrators/utils.js.map +1 -0
- package/dist/runtime/runtime.d.ts +3 -41
- package/dist/runtime/runtime.js +18 -8
- package/dist/runtime/state.d.ts +3 -21
- package/dist/runtime/state.js +2 -1
- package/dist/runtime/traverser.d.ts +3 -26
- package/dist/runtime/traverser.js +1 -2
- package/dist/runtime/types.d.ts +3 -16
- package/dist/runtime/types.js +1 -1
- package/dist/runtime/workflow-logic-handler.d.ts +17 -0
- package/dist/runtime/workflow-logic-handler.js +5 -0
- package/dist/runtime/workflow-logic-handler.js.map +1 -0
- package/dist/sanitizer.d.ts +3 -1
- package/dist/serializer.d.ts +3 -1
- package/dist/testing/event-logger.d.ts +63 -0
- package/dist/testing/event-logger.js +3 -0
- package/dist/testing/event-logger.js.map +1 -0
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/index.js +31 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/run-with-trace.d.ts +38 -0
- package/dist/testing/run-with-trace.js +29 -0
- package/dist/testing/run-with-trace.js.map +1 -0
- package/dist/testing/stepper.d.ts +79 -0
- package/dist/testing/stepper.js +11 -0
- package/dist/testing/stepper.js.map +1 -0
- package/dist/types-ezHUBdpL.d.ts +564 -0
- package/dist/types.d.ts +3 -1
- package/package.json +55 -51
- package/LICENSE +0 -21
- package/dist/chunk-5ZXV3R5D.js +0 -28
- package/dist/chunk-5ZXV3R5D.js.map +0 -1
- package/dist/chunk-GEKDR2SS.js +0 -201
- package/dist/chunk-GEKDR2SS.js.map +0 -1
- package/dist/chunk-HMR2GEGE.js +0 -3
- package/dist/chunk-M2FRTT2K.js +0 -144
- package/dist/chunk-M2FRTT2K.js.map +0 -1
- package/dist/chunk-OTS5YJ3S.js +0 -494
- package/dist/chunk-OTS5YJ3S.js.map +0 -1
- package/dist/chunk-QLGJUDQF.js.map +0 -1
- package/dist/chunk-U5V5O5MN.js.map +0 -1
- package/dist/chunk-VSGQDLBF.js +0 -61
- package/dist/chunk-VSGQDLBF.js.map +0 -1
- package/dist/chunk-ZCHFZBGL.js.map +0 -1
- package/dist/types-CsTeXTiA.d.ts +0 -222
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FlowRuntime } from './chunk-
|
|
2
|
-
import { JsonSerializer } from './chunk-CYHZ2YVH.js';
|
|
1
|
+
import { FlowRuntime } from './chunk-HKX7WQLS.js';
|
|
3
2
|
import { analyzeBlueprint } from './chunk-233SESC2.js';
|
|
3
|
+
import { JsonSerializer } from './chunk-CYHZ2YVH.js';
|
|
4
4
|
|
|
5
5
|
// src/runtime/adapter.ts
|
|
6
6
|
var BaseDistributedAdapter = class {
|
|
@@ -56,16 +56,20 @@ var BaseDistributedAdapter = class {
|
|
|
56
56
|
};
|
|
57
57
|
try {
|
|
58
58
|
const result = await this.runtime.executeNode(blueprint, nodeId, workerState);
|
|
59
|
-
await context.set(nodeId
|
|
59
|
+
await context.set(`_outputs.${nodeId}`, result.output);
|
|
60
60
|
const analysis = analyzeBlueprint(blueprint);
|
|
61
61
|
const isTerminalNode = analysis.terminalNodeIds.includes(nodeId);
|
|
62
62
|
if (isTerminalNode) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
)
|
|
63
|
+
const allContextKeys = Object.keys(await context.toJSON());
|
|
64
|
+
const completedNodes = /* @__PURE__ */ new Set();
|
|
65
|
+
for (const key of allContextKeys) {
|
|
66
|
+
if (key.startsWith("_outputs.")) {
|
|
67
|
+
completedNodes.add(key.substring("_outputs.".length));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
66
70
|
const allTerminalNodesCompleted = analysis.terminalNodeIds.every((terminalId) => completedNodes.has(terminalId));
|
|
67
71
|
if (allTerminalNodesCompleted) {
|
|
68
|
-
console.log(`[Adapter]
|
|
72
|
+
console.log(`[Adapter] All terminal nodes completed for Run ID: ${runId}. Declaring workflow complete.`);
|
|
69
73
|
const finalContext = await context.toJSON();
|
|
70
74
|
const finalResult = {
|
|
71
75
|
context: finalContext,
|
|
@@ -121,7 +125,7 @@ var BaseDistributedAdapter = class {
|
|
|
121
125
|
return true;
|
|
122
126
|
}
|
|
123
127
|
const poisonKey = `flowcraft:fanin:poison:${runId}:${targetNodeId}`;
|
|
124
|
-
const isPoisoned =
|
|
128
|
+
const isPoisoned = await this.store.get(poisonKey);
|
|
125
129
|
if (isPoisoned) {
|
|
126
130
|
console.log(`[Adapter] Node '${targetNodeId}' is poisoned due to failed predecessor. Failing immediately.`);
|
|
127
131
|
throw new Error(`Node '${targetNodeId}' failed due to poisoned predecessor in run '${runId}'`);
|
|
@@ -175,12 +179,23 @@ var BaseDistributedAdapter = class {
|
|
|
175
179
|
throw new Error(`Cannot reconcile runId '${runId}': Blueprint with ID '${blueprintId}' not found.`);
|
|
176
180
|
}
|
|
177
181
|
const state = await context.toJSON();
|
|
178
|
-
const completedNodes = new Set(
|
|
182
|
+
const completedNodes = /* @__PURE__ */ new Set();
|
|
183
|
+
for (const key of Object.keys(state)) {
|
|
184
|
+
if (key.startsWith("_outputs.")) {
|
|
185
|
+
completedNodes.add(key.substring("_outputs.".length));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
179
188
|
const frontier = this.calculateResumedFrontier(blueprint, completedNodes);
|
|
180
189
|
const enqueuedNodes = /* @__PURE__ */ new Set();
|
|
181
190
|
for (const nodeId of frontier) {
|
|
182
191
|
const nodeDef = blueprint.nodes.find((n) => n.id === nodeId);
|
|
183
192
|
const joinStrategy = nodeDef?.config?.joinStrategy || "all";
|
|
193
|
+
const poisonKey = `flowcraft:fanin:poison:${runId}:${nodeId}`;
|
|
194
|
+
const isPoisoned = await this.store.get(poisonKey);
|
|
195
|
+
if (isPoisoned) {
|
|
196
|
+
console.log(`[Adapter] Reconciling: Node '${nodeId}' is poisoned, skipping.`, { runId });
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
184
199
|
let shouldEnqueue = false;
|
|
185
200
|
if (joinStrategy === "any") {
|
|
186
201
|
const lockKey = `flowcraft:joinlock:${runId}:${nodeId}`;
|
|
@@ -259,5 +274,5 @@ var BaseDistributedAdapter = class {
|
|
|
259
274
|
};
|
|
260
275
|
|
|
261
276
|
export { BaseDistributedAdapter };
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
263
|
-
//# sourceMappingURL=chunk-
|
|
277
|
+
//# sourceMappingURL=chunk-ZNL7ZXPR.js.map
|
|
278
|
+
//# sourceMappingURL=chunk-ZNL7ZXPR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/adapter.ts"],"names":["nodeId"],"mappings":";;;;;AA4CO,IAAe,yBAAf,MAAsC;AAAA,EACzB,OAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EAEnB,YAAY,OAAA,EAAyB;AACpC,IAAA,IAAA,CAAK,OAAA,GAAU,IAAI,WAAA,CAAY,OAAA,CAA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AA0B,KAAK,CAAA,CAAA,EAAI,UAAU,EAAE,CAAA,CAAA;AACjE,UAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,SAAA,EAAW,aAAa,IAAI,CAAA;AAC3D,UAAA,OAAA,CAAQ,GAAA;AAAA,YACP,CAAA,uDAAA,EAA0D,SAAA,CAAU,EAAE,CAAA,6BAAA,EAAgC,YAAY,CAAA,CAAA;AAAA,WACnH;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD","file":"chunk-ZNL7ZXPR.js","sourcesContent":["import { analyzeBlueprint } from '../analysis'\nimport { JsonSerializer } from '../serializer'\nimport type {\n\tIAsyncContext,\n\tISerializer,\n\tNodeResult,\n\tRuntimeOptions,\n\tWorkflowBlueprint,\n\tWorkflowResult,\n} from '../types'\nimport { FlowRuntime } from './runtime'\n\n/**\n * Defines the contract for an atomic, distributed key-value store required by\n * the adapter for coordination tasks like fan-in joins and locking.\n */\nexport interface ICoordinationStore {\n\t/** Atomically increments a key and returns the new value. Ideal for 'all' joins. */\n\tincrement: (key: string, ttlSeconds: number) => Promise<number>\n\t/** Sets a key only if it does not already exist. Ideal for 'any' joins (locking). */\n\tsetIfNotExist: (key: string, value: string, ttlSeconds: number) => Promise<boolean>\n\t/** Deletes a key. Used for cleanup. */\n\tdelete: (key: string) => Promise<void>\n\t/** Gets the value of a key. */\n\tget: (key: string) => Promise<string | undefined>\n}\n\n/** Configuration options for constructing a BaseDistributedAdapter. */\nexport interface AdapterOptions {\n\truntimeOptions: RuntimeOptions<any>\n\tcoordinationStore: ICoordinationStore\n}\n\n/** The data payload expected for a job in the queue. */\nexport interface JobPayload {\n\trunId: string\n\tblueprintId: string\n\tnodeId: string\n}\n\n/**\n * The base class for all distributed adapters. It handles the technology-agnostic\n * orchestration logic and leaves queue-specific implementation to subclasses.\n */\nexport abstract class BaseDistributedAdapter {\n\tprotected readonly runtime: FlowRuntime<any, any>\n\tprotected readonly store: ICoordinationStore\n\tprotected readonly serializer: ISerializer\n\n\tconstructor(options: AdapterOptions) {\n\t\tthis.runtime = new FlowRuntime(options.runtimeOptions)\n\t\tthis.store = options.coordinationStore\n\t\tthis.serializer = options.runtimeOptions.serializer || new JsonSerializer()\n\t\tconsole.log('[Adapter] BaseDistributedAdapter initialized.')\n\t}\n\n\t/**\n\t * Starts the worker, which begins listening for and processing jobs from the queue.\n\t */\n\tpublic start(): void {\n\t\tconsole.log('[Adapter] Starting worker...')\n\t\tthis.processJobs(this.handleJob.bind(this))\n\t}\n\n\t/**\n\t * Creates a technology-specific distributed context for a given workflow run.\n\t * @param runId The unique ID for the workflow execution.\n\t */\n\tprotected abstract createContext(runId: string): IAsyncContext<Record<string, any>>\n\t/**\n\t * Sets up the listener for the message queue. The implementation should call the\n\t * provided `handler` function for each new job received.\n\t * @param handler The core logic to execute for each job.\n\t */\n\tprotected abstract processJobs(handler: (job: JobPayload) => Promise<void>): void\n\n\t/**\n\t * Enqueues a new job onto the message queue.\n\t * @param job The payload for the job to be enqueued.\n\t */\n\tprotected abstract enqueueJob(job: JobPayload): Promise<void>\n\n\t/**\n\t * Publishes the final result of a completed or failed workflow run.\n\t * @param runId The unique ID of the workflow run.\n\t * @param result The final status and payload of the workflow.\n\t */\n\tprotected abstract publishFinalResult(\n\t\trunId: string,\n\t\tresult: {\n\t\t\tstatus: 'completed' | 'failed'\n\t\t\tpayload?: WorkflowResult\n\t\t\treason?: string\n\t\t},\n\t): Promise<void>\n\n\t/**\n\t * Hook called at the start of job processing. Subclasses can override this\n\t * to perform additional setup (e.g., timestamp tracking for reconciliation).\n\t */\n\tprotected async onJobStart(_runId: string, _blueprintId: string, _nodeId: string): Promise<void> {\n\t\t// default implementation does nothing\n\t}\n\n\t/**\n\t * The main handler for processing a single job from the queue.\n\t */\n\tprotected async handleJob(job: JobPayload): Promise<void> {\n\t\tconst { runId, blueprintId, nodeId } = job\n\n\t\tawait this.onJobStart(runId, blueprintId, nodeId)\n\n\t\tconst blueprint = this.runtime.options.blueprints?.[blueprintId]\n\t\tif (!blueprint) {\n\t\t\tconst reason = `Blueprint with ID '${blueprintId}' not found in the worker's runtime registry.`\n\t\t\tconsole.error(`[Adapter] FATAL: ${reason}`)\n\t\t\tawait this.publishFinalResult(runId, { status: 'failed', reason })\n\t\t\treturn\n\t\t}\n\n\t\tconst context = this.createContext(runId)\n\n\t\t// persist the blueprintId for the reconcile method to find later\n\t\tconst hasBlueprintId = await context.has('blueprintId' as any)\n\t\tif (!hasBlueprintId) {\n\t\t\tawait context.set('blueprintId' as any, blueprintId)\n\t\t\t// also store in coordination store as fallback\n\t\t\tconst blueprintKey = `flowcraft:blueprint:${runId}`\n\t\t\tawait this.store.setIfNotExist(blueprintKey, blueprintId, 3600)\n\t\t}\n\t\tconst workerState = {\n\t\t\tgetContext: () => context,\n\t\t\tmarkFallbackExecuted: () => {},\n\t\t\taddError: (nodeId: string, error: Error) => {\n\t\t\t\tconsole.error(`[Adapter] Error in node ${nodeId}:`, error)\n\t\t\t},\n\t\t} as any\n\n\t\ttry {\n\t\t\tconst result: NodeResult<any, any> = await this.runtime.executeNode(blueprint, nodeId, workerState)\n\t\t\tawait context.set(`_outputs.${nodeId}` as any, result.output)\n\n\t\t\tconst analysis = analyzeBlueprint(blueprint)\n\t\t\tconst isTerminalNode = analysis.terminalNodeIds.includes(nodeId)\n\n\t\t\tif (isTerminalNode) {\n\t\t\t\tconst allContextKeys = Object.keys(await context.toJSON())\n\t\t\t\tconst completedNodes = new Set<string>()\n\t\t\t\tfor (const key of allContextKeys) {\n\t\t\t\t\tif (key.startsWith('_outputs.')) {\n\t\t\t\t\t\tcompletedNodes.add(key.substring('_outputs.'.length))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst allTerminalNodesCompleted = analysis.terminalNodeIds.every((terminalId) => completedNodes.has(terminalId))\n\n\t\t\t\tif (allTerminalNodesCompleted) {\n\t\t\t\t\tconsole.log(`[Adapter] All terminal nodes completed for Run ID: ${runId}. Declaring workflow complete.`)\n\t\t\t\t\tconst finalContext = await context.toJSON()\n\t\t\t\t\tconst finalResult: WorkflowResult = {\n\t\t\t\t\t\tcontext: finalContext,\n\t\t\t\t\t\tserializedContext: this.serializer.serialize(finalContext),\n\t\t\t\t\t\tstatus: 'completed',\n\t\t\t\t\t}\n\t\t\t\t\tawait this.publishFinalResult(runId, {\n\t\t\t\t\t\tstatus: 'completed',\n\t\t\t\t\t\tpayload: finalResult,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`[Adapter] Terminal node '${nodeId}' completed for Run ID '${runId}', but other terminal nodes are still running.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst nextNodes = await this.runtime.determineNextNodes(blueprint, nodeId, result, context, runId)\n\n\t\t\t// stop if a branch terminates but it wasn't a terminal node\n\t\t\tif (nextNodes.length === 0 && !isTerminalNode) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Adapter] Non-terminal node '${nodeId}' reached end of branch for Run ID '${runId}'. This branch will now terminate.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor (const { node: nextNodeDef, edge } of nextNodes) {\n\t\t\t\tawait this.runtime.applyEdgeTransform(edge, result, nextNodeDef, context)\n\t\t\t\tconst isReady = await this.isReadyForFanIn(runId, blueprint, nextNodeDef.id)\n\t\t\t\tif (isReady) {\n\t\t\t\t\tconsole.log(`[Adapter] Node '${nextNodeDef.id}' is ready. Enqueuing job.`)\n\t\t\t\t\tawait this.enqueueJob({ runId, blueprintId, nodeId: nextNodeDef.id })\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(`[Adapter] Node '${nextNodeDef.id}' is waiting for other predecessors to complete.`)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error: any) {\n\t\t\tconst reason = error.message || 'Unknown execution error'\n\t\t\tconsole.error(`[Adapter] FATAL: Job for node '${nodeId}' failed for Run ID '${runId}': ${reason}`)\n\t\t\tawait this.publishFinalResult(runId, { status: 'failed', reason })\n\t\t\tawait this.writePoisonPillForSuccessors(runId, blueprint, nodeId)\n\t\t}\n\t}\n\n\t/**\n\t * Encapsulates the fan-in join logic using the coordination store.\n\t */\n\tprotected async isReadyForFanIn(runId: string, blueprint: WorkflowBlueprint, targetNodeId: string): Promise<boolean> {\n\t\tconst targetNode = blueprint.nodes.find((n) => n.id === targetNodeId)\n\t\tif (!targetNode) {\n\t\t\tthrow new Error(`Node '${targetNodeId}' not found in blueprint`)\n\t\t}\n\t\tconst joinStrategy = targetNode.config?.joinStrategy || 'all'\n\t\tconst predecessors = blueprint.edges.filter((e) => e.target === targetNodeId)\n\n\t\tif (predecessors.length <= 1) {\n\t\t\treturn true\n\t\t}\n\n\t\tconst poisonKey = `flowcraft:fanin:poison:${runId}:${targetNodeId}`\n\t\tconst isPoisoned = await this.store.get(poisonKey)\n\t\tif (isPoisoned) {\n\t\t\tconsole.log(`[Adapter] Node '${targetNodeId}' is poisoned due to failed predecessor. Failing immediately.`)\n\t\t\tthrow new Error(`Node '${targetNodeId}' failed due to poisoned predecessor in run '${runId}'`)\n\t\t}\n\n\t\tif (joinStrategy === 'any') {\n\t\t\tconst lockKey = `flowcraft:joinlock:${runId}:${targetNodeId}`\n\t\t\tconst isLocked = await this.store.setIfNotExist(lockKey, 'locked', 3600)\n\t\t\tif (!isLocked) {\n\t\t\t\t// Check if it's cancelled\n\t\t\t\tconst cancelKey = `flowcraft:fanin:cancel:${runId}:${targetNodeId}`\n\t\t\t\tconst isCancelled = !(await this.store.setIfNotExist(cancelKey, 'cancelled', 3600))\n\t\t\t\tif (isCancelled) {\n\t\t\t\t\tconsole.log(`[Adapter] Node '${targetNodeId}' is cancelled due to failed predecessor. Failing immediately.`)\n\t\t\t\t\tthrow new Error(`Node '${targetNodeId}' failed due to cancelled predecessor in run '${runId}'`)\n\t\t\t\t}\n\t\t\t\treturn false // Already locked by another predecessor\n\t\t\t}\n\t\t\treturn true\n\t\t} else {\n\t\t\tconst fanInKey = `flowcraft:fanin:${runId}:${targetNodeId}`\n\t\t\tconst readyCount = await this.store.increment(fanInKey, 3600)\n\t\t\tif (readyCount >= predecessors.length) {\n\t\t\t\tawait this.store.delete(fanInKey)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Reconciles the state of a workflow run. It inspects the persisted\n\t * context to find completed nodes, determines the next set of executable\n\t * nodes (the frontier), and enqueues jobs for them if they aren't\n\t * already running. This is the core of the resume functionality.\n\t *\n\t * @param runId The unique ID of the workflow execution to reconcile.\n\t * @returns The set of node IDs that were enqueued for execution.\n\t */\n\tpublic async reconcile(runId: string): Promise<Set<string>> {\n\t\tconst context = this.createContext(runId)\n\t\tlet blueprintId = (await context.get('blueprintId' as any)) as string | undefined\n\n\t\tif (!blueprintId) {\n\t\t\t// fallback to coordination store\n\t\t\tconst blueprintKey = `flowcraft:blueprint:${runId}`\n\t\t\tblueprintId = await this.store.get(blueprintKey)\n\t\t\tif (blueprintId) {\n\t\t\t\t// set it back in context for future use\n\t\t\t\tawait context.set('blueprintId' as any, blueprintId)\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Cannot reconcile runId '${runId}': blueprintId not found in context or coordination store.`)\n\t\t\t}\n\t\t}\n\t\tconst blueprint = this.runtime.options.blueprints?.[blueprintId]\n\t\tif (!blueprint) {\n\t\t\tthrow new Error(`Cannot reconcile runId '${runId}': Blueprint with ID '${blueprintId}' not found.`)\n\t\t}\n\n\t\tconst state = await context.toJSON()\n\t\t// filter out internal keys\n\t\tconst completedNodes = new Set<string>()\n\t\tfor (const key of Object.keys(state)) {\n\t\t\tif (key.startsWith('_outputs.')) {\n\t\t\t\tcompletedNodes.add(key.substring('_outputs.'.length))\n\t\t\t}\n\t\t}\n\n\t\tconst frontier = this.calculateResumedFrontier(blueprint, completedNodes)\n\n\t\tconst enqueuedNodes = new Set<string>()\n\t\tfor (const nodeId of frontier) {\n\t\t\tconst nodeDef = blueprint.nodes.find((n) => n.id === nodeId)\n\t\t\tconst joinStrategy = nodeDef?.config?.joinStrategy || 'all'\n\n\t\t\tconst poisonKey = `flowcraft:fanin:poison:${runId}:${nodeId}`\n\t\t\tconst isPoisoned = await this.store.get(poisonKey)\n\t\t\tif (isPoisoned) {\n\t\t\t\tconsole.log(`[Adapter] Reconciling: Node '${nodeId}' is poisoned, skipping.`, { runId })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlet shouldEnqueue = false\n\n\t\t\tif (joinStrategy === 'any') {\n\t\t\t\t// acquire the permanent join lock\n\t\t\t\tconst lockKey = `flowcraft:joinlock:${runId}:${nodeId}`\n\t\t\t\tif (await this.store.setIfNotExist(lockKey, 'locked-by-reconcile', 3600)) {\n\t\t\t\t\tshouldEnqueue = true\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(`[Adapter] Reconciling: Node '${nodeId}' is an 'any' join and is already locked.`, { runId })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 'all' joins and single-predecessor nodes use a temporary lock\n\t\t\t\tconst lockKey = `flowcraft:nodelock:${runId}:${nodeId}`\n\t\t\t\tif (await this.store.setIfNotExist(lockKey, 'locked', 120)) {\n\t\t\t\t\tshouldEnqueue = true\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(`[Adapter] Reconciling: Node '${nodeId}' is already locked.`, { runId })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (shouldEnqueue) {\n\t\t\t\tconsole.log(`[Adapter] Reconciling: Enqueuing ready job for node '${nodeId}'`, { runId })\n\t\t\t\tawait this.enqueueJob({ runId, blueprintId: blueprint.id, nodeId })\n\t\t\t\tenqueuedNodes.add(nodeId)\n\t\t\t}\n\t\t}\n\n\t\treturn enqueuedNodes\n\t}\n\n\tprivate calculateResumedFrontier(blueprint: WorkflowBlueprint, completedNodes: Set<string>): Set<string> {\n\t\tconst newFrontier = new Set<string>()\n\t\tconst allPredecessors = new Map<string, Set<string>>()\n\t\t// (logic extracted from the GraphTraverser)\n\t\tfor (const node of blueprint.nodes) {\n\t\t\tallPredecessors.set(node.id, new Set())\n\t\t}\n\t\tfor (const edge of blueprint.edges) {\n\t\t\tallPredecessors.get(edge.target)?.add(edge.source)\n\t\t}\n\n\t\tfor (const node of blueprint.nodes) {\n\t\t\tif (completedNodes.has(node.id)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst predecessors = allPredecessors.get(node.id) ?? new Set()\n\t\t\tif (predecessors.size === 0 && !completedNodes.has(node.id)) {\n\t\t\t\tnewFrontier.add(node.id)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst joinStrategy = node.config?.joinStrategy || 'all'\n\t\t\tconst completedPredecessors = [...predecessors].filter((p) => completedNodes.has(p))\n\n\t\t\tconst isReady =\n\t\t\t\tjoinStrategy === 'any' ? completedPredecessors.length > 0 : completedPredecessors.length === predecessors.size\n\n\t\t\tif (isReady) {\n\t\t\t\tnewFrontier.add(node.id)\n\t\t\t}\n\t\t}\n\t\treturn newFrontier\n\t}\n\n\t/**\n\t * Writes a poison pill for 'all' join successors and a cancellation pill for 'any' join successors of a failed node to prevent stalling or ambiguous states.\n\t */\n\tprivate async writePoisonPillForSuccessors(\n\t\trunId: string,\n\t\tblueprint: WorkflowBlueprint,\n\t\tfailedNodeId: string,\n\t): Promise<void> {\n\t\tconst successors = blueprint.edges\n\t\t\t.filter((edge) => edge.source === failedNodeId)\n\t\t\t.map((edge) => edge.target)\n\t\t\t.map((targetId) => blueprint.nodes.find((node) => node.id === targetId))\n\t\t\t.filter((node) => node)\n\n\t\tfor (const successor of successors) {\n\t\t\tif (successor) {\n\t\t\t\tconst joinStrategy = successor.config?.joinStrategy || 'all'\n\t\t\t\tif (joinStrategy === 'all') {\n\t\t\t\t\tconst poisonKey = `flowcraft:fanin:poison:${runId}:${successor.id}`\n\t\t\t\t\tawait this.store.setIfNotExist(poisonKey, 'poisoned', 3600)\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`[Adapter] Wrote poison pill for 'all' join node '${successor.id}' due to failed predecessor '${failedNodeId}'`,\n\t\t\t\t\t)\n\t\t\t\t} else if (joinStrategy === 'any') {\n\t\t\t\t\tconst cancelKey = `flowcraft:fanin:cancel:${runId}:${successor.id}`\n\t\t\t\t\tawait this.store.setIfNotExist(cancelKey, 'cancelled', 3600)\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`[Adapter] Wrote cancellation pill for 'any' join node '${successor.id}' due to failed predecessor '${failedNodeId}'`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DIContainer } from './container.js';
|
|
2
|
+
import { u as RuntimeDependencies, x as ILogger, A as ISerializer, w as IEvaluator, z as IEventBus, M as Middleware, n as NodeFunction, o as NodeClass, g as WorkflowBlueprint } from './types-ezHUBdpL.js';
|
|
3
|
+
import './errors.js';
|
|
4
|
+
|
|
5
|
+
interface ContainerOptions<TDependencies extends RuntimeDependencies = RuntimeDependencies> {
|
|
6
|
+
logger?: ILogger;
|
|
7
|
+
serializer?: ISerializer;
|
|
8
|
+
evaluator?: IEvaluator;
|
|
9
|
+
eventBus?: IEventBus;
|
|
10
|
+
middleware?: Middleware[];
|
|
11
|
+
registry?: Record<string, NodeFunction | NodeClass>;
|
|
12
|
+
blueprints?: Record<string, WorkflowBlueprint>;
|
|
13
|
+
dependencies?: TDependencies;
|
|
14
|
+
}
|
|
15
|
+
declare function createDefaultContainer<TDependencies extends RuntimeDependencies = RuntimeDependencies>(options?: ContainerOptions<TDependencies>): DIContainer;
|
|
16
|
+
|
|
17
|
+
export { type ContainerOptions, createDefaultContainer };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createDefaultContainer } from './chunk-QNYXQKFW.js';
|
|
2
|
+
import './chunk-33NO4PUJ.js';
|
|
3
|
+
import './chunk-HAZ26F3P.js';
|
|
4
|
+
import './chunk-FRKO3WX4.js';
|
|
5
|
+
import './chunk-CD4FUZOJ.js';
|
|
6
|
+
import './chunk-4PELJWF7.js';
|
|
7
|
+
import './chunk-CYHZ2YVH.js';
|
|
8
|
+
import './chunk-WWGFIYKW.js';
|
|
9
|
+
import './chunk-R3HQXIEL.js';
|
|
10
|
+
import './chunk-BCRWXTWX.js';
|
|
11
|
+
import './chunk-PH2IYZHV.js';
|
|
12
|
+
//# sourceMappingURL=container-factory.js.map
|
|
13
|
+
//# sourceMappingURL=container-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"container-factory.js"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type ServiceToken<_T = any> = string | symbol;
|
|
2
|
+
declare class DIContainer {
|
|
3
|
+
private services;
|
|
4
|
+
private factories;
|
|
5
|
+
register<T>(token: ServiceToken<T>, implementation: T): void;
|
|
6
|
+
registerFactory<T>(token: ServiceToken<T>, factory: (container: DIContainer) => T): void;
|
|
7
|
+
resolve<T>(token: ServiceToken<T>): T;
|
|
8
|
+
has(token: ServiceToken): boolean;
|
|
9
|
+
createChild(): DIContainer;
|
|
10
|
+
}
|
|
11
|
+
declare const ServiceTokens: {
|
|
12
|
+
readonly Logger: symbol;
|
|
13
|
+
readonly Serializer: symbol;
|
|
14
|
+
readonly Evaluator: symbol;
|
|
15
|
+
readonly EventBus: symbol;
|
|
16
|
+
readonly Orchestrator: symbol;
|
|
17
|
+
readonly Middleware: symbol;
|
|
18
|
+
readonly NodeRegistry: symbol;
|
|
19
|
+
readonly BlueprintRegistry: symbol;
|
|
20
|
+
readonly Dependencies: symbol;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { DIContainer, type ServiceToken, ServiceTokens };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"container.js"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as ISyncContext, t as IAsyncContext } from './types-ezHUBdpL.js';
|
|
2
|
+
import './errors.js';
|
|
3
|
+
import './container.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* A default, high-performance, in-memory implementation of ISyncContext using a Map.
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A single, comprehensive error class for the framework.
|
|
3
|
+
* Use this for all errors to ensure consistent structure and easy debugging.
|
|
4
|
+
*/
|
|
5
|
+
declare class FlowcraftError extends Error {
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly nodeId?: string;
|
|
8
|
+
readonly blueprintId?: string;
|
|
9
|
+
readonly executionId?: string;
|
|
10
|
+
readonly isFatal: boolean;
|
|
11
|
+
constructor(message: string, options?: {
|
|
12
|
+
cause?: Error;
|
|
13
|
+
nodeId?: string;
|
|
14
|
+
blueprintId?: string;
|
|
15
|
+
executionId?: string;
|
|
16
|
+
isFatal?: boolean;
|
|
17
|
+
});
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export {
|
|
20
|
+
export { FlowcraftError };
|
package/dist/errors.js
CHANGED
package/dist/evaluator.d.ts
CHANGED
package/dist/flow.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as NodeFunction, o as NodeClass, h as NodeDefinition, j as EdgeDefinition, g as WorkflowBlueprint, U as UIGraph } from './types-ezHUBdpL.js';
|
|
2
|
+
import './errors.js';
|
|
3
|
+
import './container.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* A fluent API for programmatically constructing a WorkflowBlueprint.
|
|
@@ -8,6 +10,7 @@ declare class Flow<TContext extends Record<string, any> = Record<string, any>, T
|
|
|
8
10
|
private functionRegistry;
|
|
9
11
|
private loopControllerIds;
|
|
10
12
|
private loopDefinitions;
|
|
13
|
+
private batchDefinitions;
|
|
11
14
|
private cycleEntryPoints;
|
|
12
15
|
constructor(id: string);
|
|
13
16
|
node<TInput = any, TOutput = any, TAction extends string = string>(id: string, implementation: NodeFunction<TContext, TDependencies, TInput, TOutput, TAction> | NodeClass<TContext, TDependencies, TInput, TOutput, TAction>, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
@@ -32,6 +35,12 @@ declare class Flow<TContext extends Record<string, any> = Record<string, any>, T
|
|
|
32
35
|
}): Flow<TContext & {
|
|
33
36
|
[K in TOutputKey]: TWorkerOutput[];
|
|
34
37
|
}, TDependencies>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a wait node that pauses workflow execution for external input.
|
|
40
|
+
* @param id A unique identifier for the wait node.
|
|
41
|
+
* @param options Optional configuration for the wait node.
|
|
42
|
+
*/
|
|
43
|
+
wait(id: string, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
35
44
|
/**
|
|
36
45
|
* Creates a loop pattern in the workflow graph.
|
|
37
46
|
* @param id A unique identifier for the loop construct.
|
|
@@ -56,7 +65,8 @@ declare class Flow<TContext extends Record<string, any> = Record<string, any>, T
|
|
|
56
65
|
*/
|
|
57
66
|
setCycleEntryPoint(nodeId: string): this;
|
|
58
67
|
toBlueprint(): WorkflowBlueprint;
|
|
59
|
-
getFunctionRegistry(): Map<string,
|
|
68
|
+
getFunctionRegistry(): Map<string, NodeFunction | NodeClass>;
|
|
69
|
+
toGraphRepresentation(): UIGraph;
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
62
72
|
* Helper function to create a new Flow builder instance.
|
package/dist/flow.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
export { BlueprintAnalysis, Cycles, analyzeBlueprint, checkForCycles, generateMermaid } from './analysis.js';
|
|
2
|
+
export { DIContainer, ServiceToken, ServiceTokens } from './container.js';
|
|
3
|
+
export { ContainerOptions, createDefaultContainer } from './container-factory.js';
|
|
2
4
|
export { AsyncContextView, Context } from './context.js';
|
|
3
|
-
export {
|
|
5
|
+
export { FlowcraftError } from './errors.js';
|
|
4
6
|
export { PropertyEvaluator, UnsafeEvaluator } from './evaluator.js';
|
|
5
7
|
export { Flow, createFlow } from './flow.js';
|
|
6
8
|
export { LinterIssue, LinterIssueCode, LinterResult, lintBlueprint } from './linter.js';
|
|
7
9
|
export { ConsoleLogger, NullLogger } from './logger.js';
|
|
8
|
-
export { B as BaseNode, C as ContextImplementation,
|
|
10
|
+
export { B as BaseNode, C as ClassNodeExecutor, r as ContextImplementation, j as EdgeDefinition, e as ExecutionServices, E as ExecutionStrategy, c as FlowRuntime, y as FlowcraftEvent, F as FunctionNodeExecutor, G as GraphTraverser, t as IAsyncContext, w as IEvaluator, z as IEventBus, x as ILogger, I as IOrchestrator, f as IRuntime, A as ISerializer, s as ISyncContext, M as Middleware, o as NodeClass, k as NodeConfig, m as NodeContext, h as NodeDefinition, N as NodeExecutionResult, b as NodeExecutor, a as NodeExecutorConfig, d as NodeExecutorFactory, n as NodeFunction, p as NodeImplementation, q as NodeRegistry, l as NodeResult, R as ReadyNode, u as RuntimeDependencies, v as RuntimeOptions, U as UIGraph, g as WorkflowBlueprint, D as WorkflowError, J as WorkflowResult, W as WorkflowState, H as WorkflowStatus, i as isNodeClass } from './types-ezHUBdpL.js';
|
|
9
11
|
export { AdapterOptions, BaseDistributedAdapter, ICoordinationStore, JobPayload } from './runtime/adapter.js';
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export { WorkflowState } from './runtime/state.js';
|
|
13
|
-
export { GraphTraverser } from './runtime/traverser.js';
|
|
12
|
+
export { DefaultOrchestrator } from './runtime/orchestrator.js';
|
|
13
|
+
export { executeBatch, processResults } from './runtime/orchestrators/utils.js';
|
|
14
14
|
export { sanitizeBlueprint } from './sanitizer.js';
|
|
15
|
-
|
|
16
|
-
import './runtime/types.js';
|
|
15
|
+
export { JsonSerializer } from './serializer.js';
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
export { BaseDistributedAdapter } from './chunk-
|
|
4
|
-
export { FlowRuntime } from './chunk-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
import './chunk-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export { CancelledWorkflowError, FatalNodeExecutionError, NodeExecutionError } from './chunk-5ZXV3R5D.js';
|
|
12
|
-
export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
|
|
13
|
-
export { Flow, createFlow } from './chunk-ZCHFZBGL.js';
|
|
14
|
-
export { BaseNode, isNodeClass } from './chunk-U5V5O5MN.js';
|
|
1
|
+
import './chunk-NVJ3ZO3P.js';
|
|
2
|
+
import './chunk-NVLZFLYM.js';
|
|
3
|
+
export { BaseDistributedAdapter } from './chunk-ZNL7ZXPR.js';
|
|
4
|
+
export { FlowRuntime } from './chunk-HKX7WQLS.js';
|
|
5
|
+
import './chunk-MCGK3FXQ.js';
|
|
6
|
+
import './chunk-MKNZBKSR.js';
|
|
7
|
+
export { GraphTraverser } from './chunk-G5BGBPFP.js';
|
|
8
|
+
import './chunk-CD3Q4N6V.js';
|
|
9
|
+
import './chunk-DL7KVYZF.js';
|
|
10
|
+
export { ClassNodeExecutor, FunctionNodeExecutor, NodeExecutor } from './chunk-ONH7PIJZ.js';
|
|
15
11
|
export { lintBlueprint } from './chunk-EUJWJWFA.js';
|
|
12
|
+
export { sanitizeBlueprint } from './chunk-DSYAC4WB.js';
|
|
13
|
+
import './chunk-55J6XMHW.js';
|
|
14
|
+
import './chunk-BC4G7OM6.js';
|
|
15
|
+
import './chunk-RM677CNU.js';
|
|
16
16
|
export { analyzeBlueprint, checkForCycles, generateMermaid } from './chunk-233SESC2.js';
|
|
17
|
+
export { createDefaultContainer } from './chunk-QNYXQKFW.js';
|
|
18
|
+
export { DefaultOrchestrator } from './chunk-33NO4PUJ.js';
|
|
19
|
+
export { executeBatch, processResults } from './chunk-HAZ26F3P.js';
|
|
20
|
+
import './chunk-FRKO3WX4.js';
|
|
21
|
+
export { WorkflowState } from './chunk-CD4FUZOJ.js';
|
|
17
22
|
export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
|
|
23
|
+
export { JsonSerializer } from './chunk-CYHZ2YVH.js';
|
|
24
|
+
export { DIContainer, ServiceTokens } from './chunk-WWGFIYKW.js';
|
|
25
|
+
export { AsyncContextView, Context } from './chunk-R3HQXIEL.js';
|
|
26
|
+
export { FlowcraftError } from './chunk-BCRWXTWX.js';
|
|
27
|
+
export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
|
|
28
|
+
export { Flow, createFlow } from './chunk-C4HYIJI3.js';
|
|
29
|
+
export { BaseNode, isNodeClass } from './chunk-LNK7LZER.js';
|
|
18
30
|
//# sourceMappingURL=index.js.map
|
|
19
31
|
//# sourceMappingURL=index.js.map
|
package/dist/linter.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as WorkflowBlueprint, n as NodeFunction, o as NodeClass } from './types-ezHUBdpL.js';
|
|
2
|
+
import './errors.js';
|
|
3
|
+
import './container.js';
|
|
2
4
|
|
|
3
5
|
type LinterIssueCode = 'INVALID_EDGE_SOURCE' | 'INVALID_EDGE_TARGET' | 'MISSING_NODE_IMPLEMENTATION' | 'ORPHAN_NODE' | 'INVALID_BATCH_WORKER_KEY' | 'INVALID_SUBFLOW_BLUEPRINT_ID';
|
|
4
6
|
interface LinterIssue {
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as ILogger } from './types-ezHUBdpL.js';
|
|
2
|
+
import './errors.js';
|
|
3
|
+
import './container.js';
|
|
2
4
|
|
|
3
5
|
/** A logger implementation that outputs to the console. */
|
|
4
6
|
declare class ConsoleLogger implements ILogger {
|
package/dist/node.d.ts
CHANGED
package/dist/node.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { B as BaseNode, m as NodeContext, l as NodeResult } from '../types-ezHUBdpL.js';
|
|
2
|
+
import '../errors.js';
|
|
3
|
+
import '../container.js';
|
|
4
|
+
|
|
5
|
+
declare class BatchGatherNode extends BaseNode {
|
|
6
|
+
exec(_prepResult: any, context: NodeContext<any, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { BatchGatherNode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"batch-gather.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { B as BaseNode, m as NodeContext, l as NodeResult } from '../types-ezHUBdpL.js';
|
|
2
|
+
import '../errors.js';
|
|
3
|
+
import '../container.js';
|
|
4
|
+
|
|
5
|
+
declare class BatchScatterNode extends BaseNode {
|
|
6
|
+
exec(_prepResult: any, context: NodeContext<any, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { BatchScatterNode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"batch-scatter.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { B as BaseNode, m as NodeContext, l as NodeResult } from '../types-ezHUBdpL.js';
|
|
2
|
+
import '../errors.js';
|
|
3
|
+
import '../container.js';
|
|
4
|
+
|
|
5
|
+
declare class SubflowNode extends BaseNode {
|
|
6
|
+
exec(_prepResult: any, context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { SubflowNode };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { SubflowNode } from '../chunk-MKNZBKSR.js';
|
|
2
|
+
import '../chunk-G5BGBPFP.js';
|
|
3
|
+
import '../chunk-233SESC2.js';
|
|
4
|
+
import '../chunk-FRKO3WX4.js';
|
|
5
|
+
import '../chunk-CD4FUZOJ.js';
|
|
6
|
+
import '../chunk-R3HQXIEL.js';
|
|
7
|
+
import '../chunk-BCRWXTWX.js';
|
|
8
|
+
import '../chunk-LNK7LZER.js';
|
|
9
|
+
//# sourceMappingURL=subflow.js.map
|
|
10
|
+
//# sourceMappingURL=subflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subflow.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { B as BaseNode, m as NodeContext, l as NodeResult } from '../types-ezHUBdpL.js';
|
|
2
|
+
import '../errors.js';
|
|
3
|
+
import '../container.js';
|
|
4
|
+
|
|
5
|
+
declare class WaitNode extends BaseNode {
|
|
6
|
+
exec(_prepResult: any, context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { WaitNode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"wait.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import '
|
|
4
|
-
import './state.js';
|
|
5
|
-
import './types.js';
|
|
1
|
+
import { v as RuntimeOptions, c as FlowRuntime, A as ISerializer, t as IAsyncContext, J as WorkflowResult, g as WorkflowBlueprint } from '../types-ezHUBdpL.js';
|
|
2
|
+
import '../errors.js';
|
|
3
|
+
import '../container.js';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Defines the contract for an atomic, distributed key-value store required by
|
package/dist/runtime/adapter.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
export { BaseDistributedAdapter } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { BaseDistributedAdapter } from '../chunk-ZNL7ZXPR.js';
|
|
2
|
+
import '../chunk-HKX7WQLS.js';
|
|
3
|
+
import '../chunk-MCGK3FXQ.js';
|
|
4
|
+
import '../chunk-MKNZBKSR.js';
|
|
5
|
+
import '../chunk-G5BGBPFP.js';
|
|
6
|
+
import '../chunk-CD3Q4N6V.js';
|
|
7
|
+
import '../chunk-DL7KVYZF.js';
|
|
8
|
+
import '../chunk-ONH7PIJZ.js';
|
|
5
9
|
import '../chunk-DSYAC4WB.js';
|
|
10
|
+
import '../chunk-BC4G7OM6.js';
|
|
11
|
+
import '../chunk-RM677CNU.js';
|
|
12
|
+
import '../chunk-233SESC2.js';
|
|
13
|
+
import '../chunk-33NO4PUJ.js';
|
|
14
|
+
import '../chunk-HAZ26F3P.js';
|
|
15
|
+
import '../chunk-FRKO3WX4.js';
|
|
16
|
+
import '../chunk-CD4FUZOJ.js';
|
|
17
|
+
import '../chunk-4PELJWF7.js';
|
|
6
18
|
import '../chunk-CYHZ2YVH.js';
|
|
7
|
-
import '../chunk-
|
|
19
|
+
import '../chunk-WWGFIYKW.js';
|
|
8
20
|
import '../chunk-R3HQXIEL.js';
|
|
9
|
-
import '../chunk-
|
|
21
|
+
import '../chunk-BCRWXTWX.js';
|
|
10
22
|
import '../chunk-PH2IYZHV.js';
|
|
11
|
-
import '../chunk-
|
|
12
|
-
import '../chunk-233SESC2.js';
|
|
13
|
-
import '../chunk-4PELJWF7.js';
|
|
23
|
+
import '../chunk-LNK7LZER.js';
|
|
14
24
|
//# sourceMappingURL=adapter.js.map
|
|
15
25
|
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"execution-context.js"}
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
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 };
|
|
1
|
+
import '../errors.js';
|
|
2
|
+
export { C as ClassNodeExecutor, E as ExecutionStrategy, F as FunctionNodeExecutor, N as NodeExecutionResult, b as NodeExecutor, a as NodeExecutorConfig } from '../types-ezHUBdpL.js';
|
|
3
|
+
import '../container.js';
|