flowcraft 2.6.1 → 2.7.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.
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/persistent-event-bus.d.ts +69 -0
- package/dist/adapters/persistent-event-bus.js +3 -0
- package/dist/adapters/persistent-event-bus.js.map +1 -0
- package/dist/analysis.d.ts +1 -1
- package/dist/chunk-3Y5O5EGB.js +3 -0
- package/dist/{chunk-NVJ3ZO3P.js.map → chunk-3Y5O5EGB.js.map} +1 -1
- package/dist/{chunk-BTCZU2DJ.js → chunk-4TVWI6Y6.js} +4 -4
- package/dist/{chunk-BTCZU2DJ.js.map → chunk-4TVWI6Y6.js.map} +1 -1
- package/dist/{chunk-6X5BERRF.js → chunk-6RKHCJUU.js} +2 -2
- package/dist/{chunk-6X5BERRF.js.map → chunk-6RKHCJUU.js.map} +1 -1
- package/dist/{chunk-MUYLRTSR.js → chunk-7EBKWATZ.js} +9 -5
- package/dist/chunk-7EBKWATZ.js.map +1 -0
- package/dist/{chunk-IWTFVGMK.js → chunk-AKDL2ZX7.js} +2 -2
- package/dist/{chunk-IWTFVGMK.js.map → chunk-AKDL2ZX7.js.map} +1 -1
- package/dist/chunk-ASJYJ3NF.js +46 -0
- package/dist/chunk-ASJYJ3NF.js.map +1 -0
- package/dist/chunk-HFJXYY4E.js +3 -0
- package/dist/chunk-HFJXYY4E.js.map +1 -0
- package/dist/{chunk-VB7VNXR7.js → chunk-HXSK5P2X.js} +11 -5
- package/dist/chunk-HXSK5P2X.js.map +1 -0
- package/dist/{chunk-2YLGY3R2.js → chunk-K6ID3GRG.js} +7 -7
- package/dist/chunk-K6ID3GRG.js.map +1 -0
- package/dist/{chunk-QSQ2BSGG.js → chunk-LU5SLE3P.js} +4 -4
- package/dist/{chunk-QSQ2BSGG.js.map → chunk-LU5SLE3P.js.map} +1 -1
- package/dist/{chunk-N4NLAIEN.js → chunk-LWN7HOD3.js} +4 -3
- package/dist/chunk-LWN7HOD3.js.map +1 -0
- package/dist/{chunk-SF5GQHUU.js → chunk-N63S5NEG.js} +10 -3
- package/dist/chunk-N63S5NEG.js.map +1 -0
- package/dist/{chunk-C3ZT7FNO.js → chunk-RAZWRNAJ.js} +5 -5
- package/dist/chunk-RAZWRNAJ.js.map +1 -0
- package/dist/{chunk-NQORJ53O.js → chunk-RF5EYEO6.js} +4 -4
- package/dist/{chunk-NQORJ53O.js.map → chunk-RF5EYEO6.js.map} +1 -1
- package/dist/chunk-TKSSRS5U.js +39 -0
- package/dist/chunk-TKSSRS5U.js.map +1 -0
- package/dist/{chunk-3YV6X6VQ.js → chunk-TTOS7NW3.js} +5 -5
- package/dist/chunk-TTOS7NW3.js.map +1 -0
- package/dist/chunk-UNORA7EM.js +103 -0
- package/dist/chunk-UNORA7EM.js.map +1 -0
- package/dist/{chunk-34LDT5EG.js → chunk-VDVUF25G.js} +65 -16
- package/dist/chunk-VDVUF25G.js.map +1 -0
- package/dist/{chunk-5BOUGXZO.js → chunk-VSKDQVCG.js} +16 -4
- package/dist/chunk-VSKDQVCG.js.map +1 -0
- package/dist/{chunk-O3QJFRXS.js → chunk-W4IAXDO4.js} +28 -6
- package/dist/chunk-W4IAXDO4.js.map +1 -0
- package/dist/{chunk-XDI4TJHA.js → chunk-ZETQCNEF.js} +49 -5
- package/dist/chunk-ZETQCNEF.js.map +1 -0
- package/dist/container-factory.d.ts +1 -1
- package/dist/container-factory.js +7 -7
- package/dist/context.d.ts +15 -2
- package/dist/context.js +1 -1
- package/dist/error-mapper.d.ts +1 -1
- package/dist/evaluator.d.ts +1 -1
- package/dist/flow.d.ts +3 -3
- package/dist/flow.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +21 -18
- package/dist/linter.d.ts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/nodes/batch-gather.d.ts +1 -1
- package/dist/nodes/batch-scatter.d.ts +1 -1
- package/dist/nodes/sleep.d.ts +1 -1
- package/dist/nodes/subflow.d.ts +1 -1
- package/dist/nodes/subflow.js +4 -4
- package/dist/nodes/wait.d.ts +1 -1
- package/dist/nodes/webhook.d.ts +1 -1
- package/dist/runtime/adapter.d.ts +3 -1
- package/dist/runtime/adapter.js +15 -15
- package/dist/runtime/execution-context.d.ts +1 -1
- package/dist/runtime/execution-context.js +3 -3
- package/dist/runtime/executors.d.ts +1 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +17 -16
- package/dist/runtime/node-executor-factory.d.ts +1 -1
- package/dist/runtime/orchestrator.d.ts +1 -1
- package/dist/runtime/orchestrator.js +5 -5
- package/dist/runtime/orchestrators/replay.d.ts +45 -0
- package/dist/runtime/orchestrators/replay.js +3 -0
- package/dist/runtime/orchestrators/replay.js.map +1 -0
- package/dist/runtime/orchestrators/step-by-step.d.ts +1 -1
- package/dist/runtime/orchestrators/step-by-step.js +2 -2
- package/dist/runtime/orchestrators/utils.d.ts +1 -1
- package/dist/runtime/orchestrators/utils.js +1 -1
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/runtime.js +14 -14
- package/dist/runtime/scheduler.d.ts +1 -1
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/traverser.d.ts +1 -1
- package/dist/runtime/types.d.ts +1 -1
- package/dist/runtime/workflow-logic-handler.d.ts +2 -2
- package/dist/runtime/workflow-logic-handler.js +2 -2
- package/dist/sanitizer.d.ts +1 -2
- package/dist/sanitizer.js +1 -1
- package/dist/serializer.d.ts +1 -1
- package/dist/serializer.js +1 -1
- package/dist/testing/event-logger.d.ts +1 -1
- package/dist/testing/event-logger.js +1 -1
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +23 -20
- package/dist/testing/run-with-trace.d.ts +1 -1
- package/dist/testing/run-with-trace.js +19 -18
- package/dist/testing/stepper.d.ts +1 -1
- package/dist/testing/stepper.js +6 -6
- package/dist/{types-Cv5JcMwI.d.ts → types-D-dVKe4_.d.ts} +48 -5
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-2YLGY3R2.js.map +0 -1
- package/dist/chunk-34LDT5EG.js.map +0 -1
- package/dist/chunk-3YV6X6VQ.js.map +0 -1
- package/dist/chunk-5BOUGXZO.js.map +0 -1
- package/dist/chunk-C3ZT7FNO.js.map +0 -1
- package/dist/chunk-HLN72CCU.js +0 -43
- package/dist/chunk-HLN72CCU.js.map +0 -1
- package/dist/chunk-MUYLRTSR.js.map +0 -1
- package/dist/chunk-N4NLAIEN.js.map +0 -1
- package/dist/chunk-NVJ3ZO3P.js +0 -3
- package/dist/chunk-O3QJFRXS.js.map +0 -1
- package/dist/chunk-SF5GQHUU.js.map +0 -1
- package/dist/chunk-VB7VNXR7.js.map +0 -1
- package/dist/chunk-XDI4TJHA.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/state.ts"],"names":[],"mappings":";;;;AAIO,IAAM,gBAAN,MAA0D;AAAA,EACxD,eAAA,uBAAsB,GAAA,EAAY;AAAA,EAClC,SAA0B,EAAC;AAAA,EAC3B,mBAAA,GAAsB,KAAA;AAAA,EACtB,OAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,gBAAA,uBAAuB,GAAA,EAAY;AAAA,EACnC,gBAAA,uBAAuB,GAAA,EAAiB;AAAA,EAEhD,YAAY,WAAA,EAAgC;AAC3C,IAAA,IAAA,CAAK,OAAA,GAAU,IAAI,mBAAA,CAAoB,IAAI,iBAAiB,IAAI,OAAA,CAAsB,WAAW,CAAC,CAAC,CAAA;AACnG,IAAA,IAAK,YAAoB,gBAAA,EAAkB;AAC1C,MAAA,IAAA,CAAK,WAAA,GAAc,IAAA;AACnB,MAAA,MAAM,cAAe,WAAA,CAAoB,gBAAA;AACzC,MAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,WAA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AyB,CAAA;AAAA,IAC9C;AAAA,EACD;AAAA,EAEA,SAAA,CAAU,sBAAsB,KAAA,EAAiC;AAChE,IAAA,IAAI,IAAA,CAAK,aAAa,OAAO,UAAA;AAC7B,IAAA,IAAI,IAAA,CAAK,qBAAqB,OAAO,WAAA;AACrC,IAAA,IAAI,IAAA,CAAK,MAAA,CAAO,MAAA,GAAS,CAAA,EAAG,OAAO,QAAA;AACnC,IAAA,IAAI,qBAAqB,OAAO,WAAA;AAChC,IAAA,OAAO,SAAA;AAAA,EACR;AAAA,EAEA,MAAM,QAAA,CAAS,UAAA,EAAyB,WAAA,EAAyD;AAChG,IAAA,MAAM,WAAA,GAAe,MAAM,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAO;AAC/C,IAAA,IAAI,CAAC,IAAA,CAAK,WAAA,IAAgB,WAAA,CAAoB,gBAAA,EAAkB;AAC/D,MAAA,OAAQ,WAAA,CAAoB,gBAAA;AAC5B,MAAA,OAAQ,WAAA,CAAoB,gBAAA;AAAA,IAC7B;AACA,IAAA,IAAI,WAAA,EAAa;AACf,MAAC,YAAoB,YAAA,GAAe,WAAA;AAAA,IACtC;AACA,IAAA,OAAO;AAAA,MACN,OAAA,EAAS,WAAA;AAAA,MACT,iBAAA,EAAmB,UAAA,CAAW,SAAA,CAAU,WAAW,CAAA;AAAA,MACnD,MAAA,EAAQ,KAAK,SAAA,EAAU;AAAA,MACvB,QAAQ,IAAA,CAAK,MAAA,CAAO,MAAA,GAAS,CAAA,GAAI,KAAK,MAAA,GAAS;AAAA,KAChD;AAAA,EACD;AACD","file":"chunk-VSKDQVCG.js","sourcesContent":["import { AsyncContextView, Context as SyncContext, TrackedAsyncContext } from '../context'\nimport { FlowcraftError } from '../errors'\nimport type { IAsyncContext, ISerializer, WorkflowError, WorkflowResult } from '../types'\n\nexport class WorkflowState<TContext extends Record<string, any>> {\n\tprivate _completedNodes = new Set<string>()\n\tprivate errors: WorkflowError[] = []\n\tprivate anyFallbackExecuted = false\n\tprivate context: IAsyncContext<TContext>\n\tprivate _isAwaiting = false\n\tprivate _awaitingNodeIds = new Set<string>()\n\tprivate _awaitingDetails = new Map<string, any>()\n\n\tconstructor(initialData: Partial<TContext>) {\n\t\tthis.context = new TrackedAsyncContext(new AsyncContextView(new SyncContext<TContext>(initialData)))\n\t\tif ((initialData as any)._awaitingNodeIds) {\n\t\t\tthis._isAwaiting = true\n\t\t\tconst awaitingIds = (initialData as any)._awaitingNodeIds\n\t\t\tif (Array.isArray(awaitingIds)) {\n\t\t\t\tfor (const id of awaitingIds) {\n\t\t\t\t\tthis._awaitingNodeIds.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ((initialData as any)._awaitingDetails) {\n\t\t\tthis._awaitingDetails = new Map(Object.entries((initialData as any)._awaitingDetails))\n\t\t}\n\t\tfor (const key of Object.keys(initialData)) {\n\t\t\tif (key.startsWith('_outputs.')) {\n\t\t\t\tconst nodeId = key.substring('_outputs.'.length)\n\t\t\t\tthis._completedNodes.add(nodeId)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Configure the context to emit events when modified.\n\t * This is called after the ExecutionContext is created.\n\t */\n\tsetEventEmitter(eventBus: any, executionId: string, sourceNode?: string): void {\n\t\tif (this.context instanceof TrackedAsyncContext) {\n\t\t\tthis.context.configureEventEmitter(eventBus, executionId, sourceNode)\n\t\t}\n\t}\n\n\tasync addCompletedNode(nodeId: string, output: any) {\n\t\tthis._completedNodes.add(nodeId)\n\t\tawait this.context.set(`_outputs.${nodeId}` as any, output)\n\t}\n\n\taddError(nodeId: string, error: Error) {\n\t\tconst flowcraftError = new FlowcraftError(error.message, {\n\t\t\tcause: error,\n\t\t\tnodeId,\n\t\t\tisFatal: false,\n\t\t})\n\t\tthis.errors.push({\n\t\t\t...flowcraftError,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\toriginalError: error, // legacy compatibility\n\t\t})\n\t}\n\n\tclearError(nodeId: string) {\n\t\tthis.errors = this.errors.filter((err) => err.nodeId !== nodeId)\n\t}\n\n\tmarkFallbackExecuted() {\n\t\tthis.anyFallbackExecuted = true\n\t}\n\n\tgetContext(): IAsyncContext<TContext> {\n\t\treturn this.context\n\t}\n\n\tgetCompletedNodes(): Set<string> {\n\t\treturn new Set(this._completedNodes)\n\t}\n\n\tgetErrors(): WorkflowError[] {\n\t\treturn this.errors\n\t}\n\n\tgetAnyFallbackExecuted(): boolean {\n\t\treturn this.anyFallbackExecuted\n\t}\n\n\tasync markAsAwaiting(nodeId: string, details?: any): Promise<void> {\n\t\tthis._isAwaiting = true\n\t\tthis._awaitingNodeIds.add(nodeId)\n\t\tif (details) {\n\t\t\tthis._awaitingDetails.set(nodeId, details)\n\t\t}\n\t\tawait this.context.set('_awaitingNodeIds' as any, Array.from(this._awaitingNodeIds))\n\t\tawait this.context.set('_awaitingDetails' as any, Object.fromEntries(this._awaitingDetails))\n\t}\n\n\tisAwaiting(): boolean {\n\t\treturn this._isAwaiting && this._awaitingNodeIds.size > 0\n\t}\n\n\tgetAwaitingNodeIds(): string[] {\n\t\treturn Array.from(this._awaitingNodeIds)\n\t}\n\n\tgetAwaitingDetails(nodeId: string): any {\n\t\treturn this._awaitingDetails.get(nodeId)\n\t}\n\n\tclearAwaiting(nodeId?: string): void {\n\t\tif (nodeId) {\n\t\t\tthis._awaitingNodeIds.delete(nodeId)\n\t\t\tthis._awaitingDetails.delete(nodeId)\n\t\t} else {\n\t\t\tthis._awaitingNodeIds.clear()\n\t\t\tthis._awaitingDetails.clear()\n\t\t}\n\t\tthis._isAwaiting = this._awaitingNodeIds.size > 0\n\n\t\tif (this._awaitingNodeIds.size > 0) {\n\t\t\tthis.context.set('_awaitingNodeIds' as any, Array.from(this._awaitingNodeIds))\n\t\t\tthis.context.set('_awaitingDetails' as any, Object.fromEntries(this._awaitingDetails))\n\t\t} else {\n\t\t\tthis.context.delete('_awaitingNodeIds' as any)\n\t\t\tthis.context.delete('_awaitingDetails' as any)\n\t\t}\n\t}\n\n\tgetStatus(isTraversalComplete = false): WorkflowResult['status'] {\n\t\tif (this._isAwaiting) return 'awaiting'\n\t\tif (this.anyFallbackExecuted) return 'completed'\n\t\tif (this.errors.length > 0) return 'failed'\n\t\tif (isTraversalComplete) return 'completed'\n\t\treturn 'stalled'\n\t}\n\n\tasync toResult(serializer: ISerializer, executionId?: string): Promise<WorkflowResult<TContext>> {\n\t\tconst contextJSON = (await this.context.toJSON()) as TContext\n\t\tif (!this._isAwaiting && (contextJSON as any)._awaitingNodeIds) {\n\t\t\tdelete (contextJSON as any)._awaitingNodeIds\n\t\t\tdelete (contextJSON as any)._awaitingDetails\n\t\t}\n\t\tif (executionId) {\n\t\t\t;(contextJSON as any)._executionId = executionId\n\t\t}\n\t\treturn {\n\t\t\tcontext: contextJSON,\n\t\t\tserializedContext: serializer.serialize(contextJSON),\n\t\t\tstatus: this.getStatus(),\n\t\t\terrors: this.errors.length > 0 ? this.errors : undefined,\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FlowRuntime } from './chunk-
|
|
1
|
+
import { FlowRuntime } from './chunk-VDVUF25G.js';
|
|
2
2
|
import { analyzeBlueprint } from './chunk-ZLW4QOTS.js';
|
|
3
3
|
import { ConsoleLogger } from './chunk-4PELJWF7.js';
|
|
4
|
-
import { JsonSerializer } from './chunk-
|
|
5
|
-
import { TrackedAsyncContext } from './chunk-
|
|
4
|
+
import { JsonSerializer } from './chunk-6RKHCJUU.js';
|
|
5
|
+
import { TrackedAsyncContext } from './chunk-ZETQCNEF.js';
|
|
6
6
|
|
|
7
7
|
// src/runtime/adapter.ts
|
|
8
8
|
var BaseDistributedAdapter = class {
|
|
@@ -10,6 +10,7 @@ var BaseDistributedAdapter = class {
|
|
|
10
10
|
store;
|
|
11
11
|
serializer;
|
|
12
12
|
logger;
|
|
13
|
+
eventBus;
|
|
13
14
|
constructor(options) {
|
|
14
15
|
const runtimeOptions = {
|
|
15
16
|
...options.runtimeOptions,
|
|
@@ -22,6 +23,7 @@ var BaseDistributedAdapter = class {
|
|
|
22
23
|
this.store = options.coordinationStore;
|
|
23
24
|
this.serializer = options.runtimeOptions.serializer || new JsonSerializer();
|
|
24
25
|
this.logger = options.runtimeOptions.logger || new ConsoleLogger();
|
|
26
|
+
this.eventBus = options.eventBus;
|
|
25
27
|
this.logger.info("[Adapter] BaseDistributedAdapter initialized.");
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
@@ -42,6 +44,7 @@ var BaseDistributedAdapter = class {
|
|
|
42
44
|
*/
|
|
43
45
|
async handleJob(job) {
|
|
44
46
|
const { runId, blueprintId, nodeId } = job;
|
|
47
|
+
const startTime = Date.now();
|
|
45
48
|
await this.onJobStart(runId, blueprintId, nodeId);
|
|
46
49
|
const blueprint = this.runtime.options.blueprints?.[blueprintId];
|
|
47
50
|
if (!blueprint) {
|
|
@@ -132,20 +135,39 @@ var BaseDistributedAdapter = class {
|
|
|
132
135
|
return;
|
|
133
136
|
}
|
|
134
137
|
for (const { node: nextNodeDef, edge } of nextNodes) {
|
|
135
|
-
await this.runtime.applyEdgeTransform(edge, result, nextNodeDef, context);
|
|
138
|
+
await this.runtime.applyEdgeTransform(edge, result, nextNodeDef, context, void 0, runId);
|
|
136
139
|
const isReady = await this.isReadyForFanIn(runId, blueprint, nextNodeDef.id);
|
|
137
140
|
if (isReady) {
|
|
138
141
|
this.logger.info(`[Adapter] Node '${nextNodeDef.id}' is ready. Enqueuing job.`);
|
|
139
142
|
await this.enqueueJob({ runId, blueprintId, nodeId: nextNodeDef.id });
|
|
143
|
+
if (this.eventBus) {
|
|
144
|
+
await this.eventBus.emit({
|
|
145
|
+
type: "job:enqueued",
|
|
146
|
+
payload: { runId, blueprintId, nodeId: nextNodeDef.id }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
140
149
|
} else {
|
|
141
150
|
this.logger.info(`[Adapter] Node '${nextNodeDef.id}' is waiting for other predecessors to complete.`);
|
|
142
151
|
}
|
|
143
152
|
}
|
|
153
|
+
const duration = Date.now() - startTime;
|
|
154
|
+
if (this.eventBus) {
|
|
155
|
+
await this.eventBus.emit({
|
|
156
|
+
type: "job:processed",
|
|
157
|
+
payload: { runId, blueprintId, nodeId, duration, success: true }
|
|
158
|
+
});
|
|
159
|
+
}
|
|
144
160
|
} catch (error) {
|
|
145
161
|
const reason = error.message || "Unknown execution error";
|
|
146
162
|
this.logger.error(`[Adapter] FATAL: Job for node '${nodeId}' failed for Run ID '${runId}': ${reason}`);
|
|
147
163
|
await this.publishFinalResult(runId, { status: "failed", reason });
|
|
148
164
|
await this.writePoisonPillForSuccessors(runId, blueprint, nodeId);
|
|
165
|
+
if (this.eventBus) {
|
|
166
|
+
await this.eventBus.emit({
|
|
167
|
+
type: "job:failed",
|
|
168
|
+
payload: { runId, blueprintId, nodeId, error }
|
|
169
|
+
});
|
|
170
|
+
}
|
|
149
171
|
} finally {
|
|
150
172
|
clearInterval(heartbeatInterval);
|
|
151
173
|
}
|
|
@@ -318,5 +340,5 @@ var BaseDistributedAdapter = class {
|
|
|
318
340
|
};
|
|
319
341
|
|
|
320
342
|
export { BaseDistributedAdapter };
|
|
321
|
-
//# sourceMappingURL=chunk-
|
|
322
|
-
//# sourceMappingURL=chunk-
|
|
343
|
+
//# sourceMappingURL=chunk-W4IAXDO4.js.map
|
|
344
|
+
//# sourceMappingURL=chunk-W4IAXDO4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/adapter.ts"],"names":["blueprintKey","nodeId"],"mappings":";;;;;;;AAmDO,IAAe,yBAAf,MAAsC;AAAA,EACzB,OAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EAEnB,YAAY,OAAA,EAAyB;AACpC,IAAA,MAAM,cAAA,GAAiB;AAAA,MACtB,GAAG,OAAA,CAAQ,cAAA;AAAA,MACX,YAAA,EAAc;AAAA,QACb,GAAG,QAAQ,cAAA,CAAe,YAAA;A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EAAQ,YAAA,IAAgB,KAAA;AACvD,QAAA,IAAI,iBAAiB,KAAA,EAAO;AAC3B,UAAA,MAAM,SAAA,GAAY,CAAA,uBAAA,EAA0B,KAAK,CAAA,CAAA,EAAI,UAAU,EAAE,CAAA,CAAA;AACjE,UAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,SAAA,EAAW,YAAY,IAAI,CAAA;AAC1D,UAAA,IAAA,CAAK,MAAA,CAAO,IAAA;AAAA,YACX,CAAA,iDAAA,EAAoD,SAAA,CAAU,EAAE,CAAA,6BAAA,EAAgC,YAAY,CAAA,CAAA;AAAA,WAC7G;AAAA,QACD,CAAA,MAAA,IAAW,iBAAiB,KAAA,EAAO;AAClC,UAAA,MAAM,SAAA,GAAY,CAAA,uBAAA,EAA0B,KAAK,CAAA,CAAA,EAAI,UAAU,EAAE,CAAA,CAAA;AACjE,UAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,SAAA,EAAW,aAAa,IAAI,CAAA;AAC3D,UAAA,IAAA,CAAK,MAAA,CAAO,IAAA;AAAA,YACX,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-W4IAXDO4.js","sourcesContent":["import { analyzeBlueprint } from '../analysis'\nimport { TrackedAsyncContext } from '../context'\nimport { ConsoleLogger } from '../logger'\nimport { JsonSerializer } from '../serializer'\nimport type {\n\tIAsyncContext,\n\tIEventBus,\n\tILogger,\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/** Extends the TTL of an existing key. Used for heartbeat mechanism in long-running jobs. */\n\textendTTL: (key: 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\teventBus?: IEventBus\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\tprotected readonly logger: ILogger\n\tprotected readonly eventBus?: IEventBus\n\n\tconstructor(options: AdapterOptions) {\n\t\tconst runtimeOptions = {\n\t\t\t...options.runtimeOptions,\n\t\t\tdependencies: {\n\t\t\t\t...options.runtimeOptions.dependencies,\n\t\t\t\tadapter: this,\n\t\t\t} as any,\n\t\t}\n\t\tthis.runtime = new FlowRuntime(runtimeOptions)\n\t\tthis.store = options.coordinationStore\n\t\tthis.serializer = options.runtimeOptions.serializer || new JsonSerializer()\n\t\tthis.logger = options.runtimeOptions.logger || new ConsoleLogger()\n\t\tthis.eventBus = options.eventBus\n\t\tthis.logger.info('[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\tthis.logger.info('[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 * Registers a webhook endpoint for a specific node in a workflow run.\n\t * @param runId The unique ID of the workflow run.\n\t * @param nodeId The ID of the node that will wait for the webhook.\n\t * @returns The URL and event name for the webhook.\n\t */\n\tpublic abstract registerWebhookEndpoint(runId: string, nodeId: string): Promise<{ url: string; event: string }>\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\t\tconst startTime = Date.now()\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\tthis.logger.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\tconst storedVersion = await context.get('blueprintVersion' as any)\n\t\tconst currentVersion = blueprint.metadata?.version || null\n\t\tif (storedVersion !== currentVersion) {\n\t\t\tconst reason = `Blueprint version mismatch: stored version '${storedVersion}', current version '${currentVersion}'. Rejecting job to prevent state corruption.`\n\t\t\tthis.logger.warn(`[Adapter] Version mismatch for run ${runId}, node ${nodeId}: ${reason}`)\n\t\t\treturn\n\t\t}\n\n\t\t// persist the blueprintId and version 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\tawait context.set('blueprintVersion' as any, blueprint.metadata?.version || null)\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\n\t\t// heartbeat to extend TTLs of coordination keys for long-running jobs\n\t\tconst joinLockKey = `flowcraft:joinlock:${runId}:${nodeId}`\n\t\tconst fanInKey = `flowcraft:fanin:${runId}:${nodeId}`\n\t\tconst blueprintKey = `flowcraft:blueprint:${runId}`\n\t\tconst heartbeatInterval = setInterval(async () => {\n\t\t\tawait this.store.extendTTL(joinLockKey, 3600)\n\t\t\tawait this.store.extendTTL(fanInKey, 3600)\n\t\t\tawait this.store.extendTTL(blueprintKey, 3600)\n\t\t\tthis.logger.debug(`[Adapter] Extended TTLs for run ${runId}, node ${nodeId}`)\n\t\t}, 1800000) // 30 minutes\n\n\t\ttry {\n\t\t\tconst workerState = {\n\t\t\t\tgetContext: () => context,\n\t\t\t\tmarkFallbackExecuted: () => {},\n\t\t\t\taddError: (nodeId: string, error: Error) => {\n\t\t\t\t\tthis.logger.error(`[Adapter] Error in node ${nodeId}:`, error)\n\t\t\t\t},\n\t\t\t} as any\n\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\tif (context instanceof TrackedAsyncContext) {\n\t\t\t\tconst deltas = context.getDeltas()\n\t\t\t\tif (deltas.length > 0) {\n\t\t\t\t\tawait context.patch(deltas)\n\t\t\t\t\tcontext.clearDeltas()\n\t\t\t\t}\n\t\t\t}\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\tthis.logger.info(`[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\tclearInterval(heartbeatInterval)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tthis.logger.info(\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\tthis.logger.info(\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\tclearInterval(heartbeatInterval)\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, undefined, runId)\n\t\t\t\tconst isReady = await this.isReadyForFanIn(runId, blueprint, nextNodeDef.id)\n\t\t\t\tif (isReady) {\n\t\t\t\t\tthis.logger.info(`[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\tif (this.eventBus) {\n\t\t\t\t\t\tawait this.eventBus.emit({\n\t\t\t\t\t\t\ttype: 'job:enqueued',\n\t\t\t\t\t\t\tpayload: { runId, blueprintId, nodeId: nextNodeDef.id },\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.logger.info(`[Adapter] Node '${nextNodeDef.id}' is waiting for other predecessors to complete.`)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst duration = Date.now() - startTime\n\t\t\tif (this.eventBus) {\n\t\t\t\tawait this.eventBus.emit({\n\t\t\t\t\ttype: 'job:processed',\n\t\t\t\t\tpayload: { runId, blueprintId, nodeId, duration, success: true },\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\tthis.logger.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\n\t\t\tif (this.eventBus) {\n\t\t\t\tawait this.eventBus.emit({\n\t\t\t\t\ttype: 'job:failed',\n\t\t\t\t\tpayload: { runId, blueprintId, nodeId, error },\n\t\t\t\t})\n\t\t\t}\n\t\t} finally {\n\t\t\tclearInterval(heartbeatInterval)\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\tthis.logger.info(`[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 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\tthis.logger.info(\n\t\t\t\t\t\t`[Adapter] Node '${targetNodeId}' is cancelled due to failed predecessor. Failing immediately.`,\n\t\t\t\t\t)\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 && !(await context.has('blueprintVersion' as any))) {\n\t\t\tawait context.set('blueprintVersion' as any, blueprint.metadata?.version || null)\n\t\t}\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\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\tthis.logger.info(`[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\tthis.logger.info(`[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\tthis.logger.info(`[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\tthis.logger.info(`[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\tthis.logger.info(\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\tthis.logger.info(\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"]}
|
|
@@ -50,22 +50,52 @@ var TrackedAsyncContext = class {
|
|
|
50
50
|
type = "async";
|
|
51
51
|
deltas = [];
|
|
52
52
|
innerContext;
|
|
53
|
-
|
|
53
|
+
eventBus;
|
|
54
|
+
executionId;
|
|
55
|
+
sourceNode;
|
|
56
|
+
constructor(innerContext, eventBus, executionId, sourceNode) {
|
|
54
57
|
this.innerContext = innerContext;
|
|
58
|
+
this.eventBus = eventBus;
|
|
59
|
+
this.executionId = executionId;
|
|
60
|
+
this.sourceNode = sourceNode;
|
|
55
61
|
}
|
|
56
62
|
async get(key) {
|
|
57
63
|
return this.innerContext.get(key);
|
|
58
64
|
}
|
|
59
65
|
async set(key, value) {
|
|
60
66
|
this.deltas.push({ op: "set", key, value });
|
|
61
|
-
|
|
67
|
+
await this.innerContext.set(key, value);
|
|
68
|
+
if (this.eventBus && this.executionId) {
|
|
69
|
+
await this.eventBus.emit({
|
|
70
|
+
type: "context:change",
|
|
71
|
+
payload: {
|
|
72
|
+
sourceNode: this.sourceNode || "unknown",
|
|
73
|
+
key,
|
|
74
|
+
op: "set",
|
|
75
|
+
value,
|
|
76
|
+
executionId: this.executionId
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
62
80
|
}
|
|
63
81
|
async has(key) {
|
|
64
82
|
return this.innerContext.has(key);
|
|
65
83
|
}
|
|
66
84
|
async delete(key) {
|
|
67
85
|
this.deltas.push({ op: "delete", key });
|
|
68
|
-
|
|
86
|
+
const result = await this.innerContext.delete(key);
|
|
87
|
+
if (this.eventBus && this.executionId && result) {
|
|
88
|
+
await this.eventBus.emit({
|
|
89
|
+
type: "context:change",
|
|
90
|
+
payload: {
|
|
91
|
+
sourceNode: this.sourceNode || "unknown",
|
|
92
|
+
key,
|
|
93
|
+
op: "delete",
|
|
94
|
+
executionId: this.executionId
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
69
99
|
}
|
|
70
100
|
toJSON() {
|
|
71
101
|
return this.innerContext.toJSON();
|
|
@@ -88,8 +118,22 @@ var TrackedAsyncContext = class {
|
|
|
88
118
|
clearDeltas() {
|
|
89
119
|
this.deltas = [];
|
|
90
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Configures the event emitter for tracking context changes.
|
|
123
|
+
* This enables the context to emit events when set/delete operations occur,
|
|
124
|
+
* allowing for external monitoring and persistence of context mutations.
|
|
125
|
+
*
|
|
126
|
+
* @param eventBus - The event bus instance to emit context change events
|
|
127
|
+
* @param executionId - The unique identifier for the current workflow execution
|
|
128
|
+
* @param sourceNode - Optional identifier for the node that triggered the context change
|
|
129
|
+
*/
|
|
130
|
+
configureEventEmitter(eventBus, executionId, sourceNode) {
|
|
131
|
+
this.eventBus = eventBus;
|
|
132
|
+
this.executionId = executionId;
|
|
133
|
+
this.sourceNode = sourceNode;
|
|
134
|
+
}
|
|
91
135
|
};
|
|
92
136
|
|
|
93
137
|
export { AsyncContextView, Context, TrackedAsyncContext };
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
138
|
+
//# sourceMappingURL=chunk-ZETQCNEF.js.map
|
|
139
|
+
//# sourceMappingURL=chunk-ZETQCNEF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context.ts"],"names":[],"mappings":";AAKO,IAAM,UAAN,MAAsF;AAAA,EAC5E,IAAA,GAAO,MAAA;AAAA,EACf,IAAA;AAAA,EAER,WAAA,CAAY,WAAA,GAAiC,EAAC,EAAG;AAChD,IAAA,IAAA,CAAK,OAAO,IAAI,GAAA,CAAI,MAAA,CAAO,OAAA,CAAQ,WAAW,CAAC,CAAA;AAAA,EAChD;AAAA,EAGA,IAAI,GAAA,EAA8B;AACjC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AAAA,EACzB;AAAA,EAGA,GAAA,CAAI,KAAa,KAAA,EAAkB;AAClC,IAAA,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,KAAK,CAAA;AAAA,EACzB;AAAA,EAGA,IAAI,GAAA,EAAsB;AACzB,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AAAA,EACzB;AAAA,EAGA,OAAO,GAAA,EAAsB;AAC5B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,MAAA,CAAO,GAAG,CAAA;AAAA,EAC5B;AAAA,EAEA,MAAA,GAA8B;AAC7B,IAAA,OAAO,MAAA,CAAO,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AAAA,EACpC;AACD;AAMO,IAAM,mBAAN,MAAgG;AAAA,EAGtG,YAAoB,WAAA,EAAqC;AAArC,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAAsC;AAAA,EAF1C,IA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ncContext, PatchOperation } from './types'\n\n/**\n * A default, high-performance, in-memory implementation of ISyncContext using a Map.\n */\nexport class Context<TContext extends Record<string, any>> implements ISyncContext<TContext> {\n\tpublic readonly type = 'sync' as const\n\tprivate data: Map<string, any>\n\n\tconstructor(initialData: Partial<TContext> = {}) {\n\t\tthis.data = new Map(Object.entries(initialData))\n\t}\n\n\tget<K extends keyof TContext>(key: K): TContext[K] | undefined\n\tget(key: string): any | undefined {\n\t\treturn this.data.get(key)\n\t}\n\n\tset<K extends keyof TContext>(key: K, value: TContext[K]): void\n\tset(key: string, value: any): void {\n\t\tthis.data.set(key, value)\n\t}\n\n\thas<K extends keyof TContext>(key: K): boolean\n\thas(key: string): boolean {\n\t\treturn this.data.has(key)\n\t}\n\n\tdelete<K extends keyof TContext>(key: K): boolean\n\tdelete(key: string): boolean {\n\t\treturn this.data.delete(key)\n\t}\n\n\ttoJSON(): Record<string, any> {\n\t\treturn Object.fromEntries(this.data)\n\t}\n}\n\n/**\n * An adapter that provides a consistent, Promise-based view of a synchronous context.\n * This is created by the runtime and is transparent to the node author.\n */\nexport class AsyncContextView<TContext extends Record<string, any>> implements IAsyncContext<TContext> {\n\tpublic readonly type = 'async' as const\n\n\tconstructor(private syncContext: ISyncContext<TContext>) {}\n\n\tget<K extends keyof TContext>(key: K): Promise<TContext[K] | undefined>\n\tget(key: string): Promise<any | undefined> {\n\t\treturn Promise.resolve(this.syncContext.get(key))\n\t}\n\n\tset<K extends keyof TContext>(key: K, value: TContext[K]): Promise<void>\n\tset(key: string, value: any): Promise<void> {\n\t\tthis.syncContext.set(key, value)\n\t\treturn Promise.resolve()\n\t}\n\n\thas<K extends keyof TContext>(key: K): Promise<boolean>\n\thas(key: string): Promise<boolean> {\n\t\treturn Promise.resolve(this.syncContext.has(key))\n\t}\n\n\tdelete<K extends keyof TContext>(key: K): Promise<boolean>\n\tdelete(key: string): Promise<boolean> {\n\t\treturn Promise.resolve(this.syncContext.delete(key))\n\t}\n\n\ttoJSON(): Promise<Record<string, any>> {\n\t\treturn Promise.resolve(this.syncContext.toJSON())\n\t}\n\n\tasync patch(_operations: PatchOperation[]): Promise<void> {\n\t\tthrow new Error('Patch operations not supported by AsyncContextView')\n\t}\n}\n\n/**\n * A proxy wrapper that tracks changes to an async context for delta-based persistence.\n * Records all mutations (set/delete operations) to enable efficient partial updates.\n */\nexport class TrackedAsyncContext<TContext extends Record<string, any>> implements IAsyncContext<TContext> {\n\tpublic readonly type = 'async' as const\n\tprivate deltas: PatchOperation[] = []\n\tprivate innerContext: IAsyncContext<TContext>\n\tprivate eventBus?: any\n\tprivate executionId?: string\n\tprivate sourceNode?: string\n\n\tconstructor(innerContext: IAsyncContext<TContext>, eventBus?: any, executionId?: string, sourceNode?: string) {\n\t\tthis.innerContext = innerContext\n\t\tthis.eventBus = eventBus\n\t\tthis.executionId = executionId\n\t\tthis.sourceNode = sourceNode\n\t}\n\n\tasync get<K extends keyof TContext>(key: K): Promise<TContext[K] | undefined>\n\tasync get(key: string): Promise<any | undefined> {\n\t\treturn this.innerContext.get(key)\n\t}\n\n\tasync set<K extends keyof TContext>(key: K, value: TContext[K]): Promise<void>\n\tasync set(key: string, value: any): Promise<void> {\n\t\tthis.deltas.push({ op: 'set', key, value })\n\t\tawait this.innerContext.set(key, value)\n\t\tif (this.eventBus && this.executionId) {\n\t\t\tawait this.eventBus.emit({\n\t\t\t\ttype: 'context:change',\n\t\t\t\tpayload: {\n\t\t\t\t\tsourceNode: this.sourceNode || 'unknown',\n\t\t\t\t\tkey,\n\t\t\t\t\top: 'set',\n\t\t\t\t\tvalue,\n\t\t\t\t\texecutionId: this.executionId,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tasync has<K extends keyof TContext>(key: K): Promise<boolean>\n\tasync has(key: string): Promise<boolean> {\n\t\treturn this.innerContext.has(key)\n\t}\n\n\tasync delete<K extends keyof TContext>(key: K): Promise<boolean>\n\tasync delete(key: string): Promise<boolean> {\n\t\tthis.deltas.push({ op: 'delete', key })\n\t\tconst result = await this.innerContext.delete(key)\n\t\tif (this.eventBus && this.executionId && result) {\n\t\t\tawait this.eventBus.emit({\n\t\t\t\ttype: 'context:change',\n\t\t\t\tpayload: {\n\t\t\t\t\tsourceNode: this.sourceNode || 'unknown',\n\t\t\t\t\tkey,\n\t\t\t\t\top: 'delete',\n\t\t\t\t\texecutionId: this.executionId,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\treturn result\n\t}\n\n\ttoJSON(): Promise<Record<string, any>> {\n\t\treturn this.innerContext.toJSON()\n\t}\n\n\tasync patch(operations: PatchOperation[]): Promise<void> {\n\t\tif (this.innerContext.patch) {\n\t\t\treturn this.innerContext.patch(operations)\n\t\t}\n\n\t\tfor (const op of operations) {\n\t\t\tif (op.op === 'set') {\n\t\t\t\tawait this.innerContext.set(op.key, op.value)\n\t\t\t} else if (op.op === 'delete') {\n\t\t\t\tawait this.innerContext.delete(op.key)\n\t\t\t}\n\t\t}\n\t}\n\n\tgetDeltas(): PatchOperation[] {\n\t\treturn [...this.deltas]\n\t}\n\n\tclearDeltas(): void {\n\t\tthis.deltas = []\n\t}\n\n\t/**\n\t * Configures the event emitter for tracking context changes.\n\t * This enables the context to emit events when set/delete operations occur,\n\t * allowing for external monitoring and persistence of context mutations.\n\t *\n\t * @param eventBus - The event bus instance to emit context change events\n\t * @param executionId - The unique identifier for the current workflow execution\n\t * @param sourceNode - Optional identifier for the node that triggered the context change\n\t */\n\tconfigureEventEmitter(eventBus: any, executionId: string, sourceNode?: string): void {\n\t\tthis.eventBus = eventBus\n\t\tthis.executionId = executionId\n\t\tthis.sourceNode = sourceNode\n\t}\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DIContainer } from './container.js';
|
|
2
|
-
import { v as RuntimeDependencies, y as ILogger, D as ISerializer, x as IEvaluator, A as IEventBus, M as Middleware, o as NodeFunction, p as NodeClass, h as WorkflowBlueprint } from './types-
|
|
2
|
+
import { v as RuntimeDependencies, y as ILogger, D as ISerializer, x as IEvaluator, A as IEventBus, M as Middleware, o as NodeFunction, p as NodeClass, h as WorkflowBlueprint } from './types-D-dVKe4_.js';
|
|
3
3
|
import './errors.js';
|
|
4
4
|
|
|
5
5
|
interface ContainerOptions<TDependencies extends RuntimeDependencies = RuntimeDependencies> {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { createDefaultContainer } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
export { createDefaultContainer } from './chunk-LU5SLE3P.js';
|
|
2
|
+
import './chunk-TTOS7NW3.js';
|
|
3
|
+
import './chunk-N63S5NEG.js';
|
|
4
|
+
import './chunk-LWN7HOD3.js';
|
|
5
|
+
import './chunk-VSKDQVCG.js';
|
|
6
6
|
import './chunk-4PELJWF7.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-6RKHCJUU.js';
|
|
8
8
|
import './chunk-WWGFIYKW.js';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-ZETQCNEF.js';
|
|
10
10
|
import './chunk-BCRWXTWX.js';
|
|
11
11
|
import './chunk-PH2IYZHV.js';
|
|
12
12
|
//# sourceMappingURL=container-factory.js.map
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ISyncContext, u as IAsyncContext, P as PatchOperation } from './types-
|
|
1
|
+
import { t as ISyncContext, u as IAsyncContext, P as PatchOperation } from './types-D-dVKe4_.js';
|
|
2
2
|
import './errors.js';
|
|
3
3
|
import './container.js';
|
|
4
4
|
|
|
@@ -38,7 +38,10 @@ declare class TrackedAsyncContext<TContext extends Record<string, any>> implemen
|
|
|
38
38
|
readonly type: "async";
|
|
39
39
|
private deltas;
|
|
40
40
|
private innerContext;
|
|
41
|
-
|
|
41
|
+
private eventBus?;
|
|
42
|
+
private executionId?;
|
|
43
|
+
private sourceNode?;
|
|
44
|
+
constructor(innerContext: IAsyncContext<TContext>, eventBus?: any, executionId?: string, sourceNode?: string);
|
|
42
45
|
get<K extends keyof TContext>(key: K): Promise<TContext[K] | undefined>;
|
|
43
46
|
set<K extends keyof TContext>(key: K, value: TContext[K]): Promise<void>;
|
|
44
47
|
has<K extends keyof TContext>(key: K): Promise<boolean>;
|
|
@@ -47,6 +50,16 @@ declare class TrackedAsyncContext<TContext extends Record<string, any>> implemen
|
|
|
47
50
|
patch(operations: PatchOperation[]): Promise<void>;
|
|
48
51
|
getDeltas(): PatchOperation[];
|
|
49
52
|
clearDeltas(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Configures the event emitter for tracking context changes.
|
|
55
|
+
* This enables the context to emit events when set/delete operations occur,
|
|
56
|
+
* allowing for external monitoring and persistence of context mutations.
|
|
57
|
+
*
|
|
58
|
+
* @param eventBus - The event bus instance to emit context change events
|
|
59
|
+
* @param executionId - The unique identifier for the current workflow execution
|
|
60
|
+
* @param sourceNode - Optional identifier for the node that triggered the context change
|
|
61
|
+
*/
|
|
62
|
+
configureEventEmitter(eventBus: any, executionId: string, sourceNode?: string): void;
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
export { AsyncContextView, Context, TrackedAsyncContext };
|
package/dist/context.js
CHANGED
package/dist/error-mapper.d.ts
CHANGED
package/dist/evaluator.d.ts
CHANGED
package/dist/flow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as NodeFunction, p as NodeClass, j as NodeDefinition, k as EdgeDefinition, h as WorkflowBlueprint, U as UIGraph } from './types-
|
|
1
|
+
import { o as NodeFunction, p as NodeClass, j as NodeDefinition, k as EdgeDefinition, h as WorkflowBlueprint, U as UIGraph } from './types-D-dVKe4_.js';
|
|
2
2
|
import './errors.js';
|
|
3
3
|
import './container.js';
|
|
4
4
|
|
|
@@ -41,8 +41,8 @@ declare class FlowBuilder<TContext extends Record<string, any> = Record<string,
|
|
|
41
41
|
* @param options Configuration for the sleep duration.
|
|
42
42
|
*/
|
|
43
43
|
sleep(id: string, options: {
|
|
44
|
-
/** The duration to sleep in milliseconds. */
|
|
45
|
-
duration: number;
|
|
44
|
+
/** The duration to sleep in milliseconds or a string like '5s', '1m', '2h', '1d'. */
|
|
45
|
+
duration: number | string;
|
|
46
46
|
}): this;
|
|
47
47
|
/**
|
|
48
48
|
* Creates a wait node that pauses workflow execution for external input.
|
package/dist/flow.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { IEventStore, InMemoryEventStore, PersistentEventBusAdapter } from './adapters/persistent-event-bus.js';
|
|
1
2
|
export { BlueprintAnalysis, Cycles, analyzeBlueprint, checkForCycles, generateMermaid, generateMermaidForRun } from './analysis.js';
|
|
2
3
|
export { DIContainer, ServiceToken, ServiceTokens } from './container.js';
|
|
3
4
|
export { ContainerOptions, createDefaultContainer } from './container-factory.js';
|
|
@@ -8,9 +9,10 @@ export { PropertyEvaluator, UnsafeEvaluator } from './evaluator.js';
|
|
|
8
9
|
export { FlowBuilder, createFlow } from './flow.js';
|
|
9
10
|
export { LinterIssue, LinterIssueCode, LinterResult, lintBlueprint } from './linter.js';
|
|
10
11
|
export { ConsoleLogger, NullLogger } from './logger.js';
|
|
11
|
-
export { B as BaseNode, C as ClassNodeExecutor, s as ContextImplementation, k as EdgeDefinition, e as ExecutionServices, E as ExecutionStrategy, c as FlowRuntime, z as FlowcraftEvent, F as FunctionNodeExecutor, G as GraphTraverser, u as IAsyncContext, x as IEvaluator, A as IEventBus, y as ILogger, I as IOrchestrator, f as IRuntime, D as ISerializer, t as ISyncContext, M as Middleware, p as NodeClass, l as NodeConfig, n as NodeContext, j as NodeDefinition, N as NodeExecutionResult, b as NodeExecutor, a as NodeExecutorConfig, d as NodeExecutorFactory, o as NodeFunction, q as NodeImplementation, r as NodeRegistry, m as NodeResult, P as PatchOperation, R as ReadyNode, v as RuntimeDependencies, w as RuntimeOptions, S as SourceLocation, U as UIGraph, h as WorkflowBlueprint, g as WorkflowBlueprintMetadata, H as WorkflowError, K as WorkflowResult, W as WorkflowState, J as WorkflowStatus, i as isNodeClass } from './types-
|
|
12
|
+
export { B as BaseNode, C as ClassNodeExecutor, s as ContextImplementation, k as EdgeDefinition, e as ExecutionServices, E as ExecutionStrategy, c as FlowRuntime, z as FlowcraftEvent, F as FunctionNodeExecutor, G as GraphTraverser, u as IAsyncContext, x as IEvaluator, A as IEventBus, y as ILogger, I as IOrchestrator, f as IRuntime, D as ISerializer, t as ISyncContext, M as Middleware, p as NodeClass, l as NodeConfig, n as NodeContext, j as NodeDefinition, N as NodeExecutionResult, b as NodeExecutor, a as NodeExecutorConfig, d as NodeExecutorFactory, o as NodeFunction, q as NodeImplementation, r as NodeRegistry, m as NodeResult, P as PatchOperation, R as ReadyNode, v as RuntimeDependencies, w as RuntimeOptions, S as SourceLocation, U as UIGraph, h as WorkflowBlueprint, g as WorkflowBlueprintMetadata, H as WorkflowError, K as WorkflowResult, W as WorkflowState, J as WorkflowStatus, i as isNodeClass } from './types-D-dVKe4_.js';
|
|
12
13
|
export { AdapterOptions, BaseDistributedAdapter, ICoordinationStore, JobPayload } from './runtime/adapter.js';
|
|
13
14
|
export { DefaultOrchestrator } from './runtime/orchestrator.js';
|
|
15
|
+
export { ReplayOrchestrator } from './runtime/orchestrators/replay.js';
|
|
14
16
|
export { executeBatch, processResults } from './runtime/orchestrators/utils.js';
|
|
15
17
|
export { sanitizeBlueprint } from './sanitizer.js';
|
|
16
18
|
export { JsonSerializer } from './serializer.js';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import './chunk-3Y5O5EGB.js';
|
|
2
|
+
export { InMemoryEventStore, PersistentEventBusAdapter } from './chunk-ASJYJ3NF.js';
|
|
3
|
+
import './chunk-HFJXYY4E.js';
|
|
4
|
+
export { ReplayOrchestrator } from './chunk-UNORA7EM.js';
|
|
2
5
|
import './chunk-NVLZFLYM.js';
|
|
3
|
-
export { BaseDistributedAdapter } from './chunk-
|
|
4
|
-
export { FlowRuntime } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
+
export { BaseDistributedAdapter } from './chunk-W4IAXDO4.js';
|
|
7
|
+
export { FlowRuntime } from './chunk-VDVUF25G.js';
|
|
8
|
+
import './chunk-HXSK5P2X.js';
|
|
6
9
|
import './chunk-DL7KVYZF.js';
|
|
7
|
-
export { ClassNodeExecutor, FunctionNodeExecutor, NodeExecutor } from './chunk-ONH7PIJZ.js';
|
|
8
10
|
import './chunk-LM4ACVHL.js';
|
|
9
|
-
import './chunk-BC4G7OM6.js';
|
|
10
|
-
import './chunk-RM677CNU.js';
|
|
11
11
|
import './chunk-HNHM3FDK.js';
|
|
12
|
-
import './chunk-
|
|
13
|
-
export { GraphTraverser } from './chunk-H4JTZYIT.js';
|
|
12
|
+
import './chunk-4TVWI6Y6.js';
|
|
14
13
|
import './chunk-IDTYHLDQ.js';
|
|
15
14
|
import './chunk-I53JB2KW.js';
|
|
15
|
+
export { ClassNodeExecutor, FunctionNodeExecutor, NodeExecutor } from './chunk-ONH7PIJZ.js';
|
|
16
|
+
export { GraphTraverser } from './chunk-H4JTZYIT.js';
|
|
17
|
+
import './chunk-BC4G7OM6.js';
|
|
18
|
+
import './chunk-RM677CNU.js';
|
|
16
19
|
export { lintBlueprint } from './chunk-IKOTX22J.js';
|
|
17
|
-
export { sanitizeBlueprint } from './chunk-
|
|
20
|
+
export { sanitizeBlueprint } from './chunk-TKSSRS5U.js';
|
|
18
21
|
import './chunk-55J6XMHW.js';
|
|
19
22
|
export { analyzeBlueprint, checkForCycles, generateMermaid, generateMermaidForRun } from './chunk-ZLW4QOTS.js';
|
|
20
|
-
export { createDefaultContainer } from './chunk-
|
|
21
|
-
export { DefaultOrchestrator } from './chunk-
|
|
22
|
-
export { executeBatch, processResults } from './chunk-
|
|
23
|
-
import './chunk-
|
|
24
|
-
export { WorkflowState } from './chunk-
|
|
23
|
+
export { createDefaultContainer } from './chunk-LU5SLE3P.js';
|
|
24
|
+
export { DefaultOrchestrator } from './chunk-TTOS7NW3.js';
|
|
25
|
+
export { executeBatch, processResults } from './chunk-N63S5NEG.js';
|
|
26
|
+
import './chunk-LWN7HOD3.js';
|
|
27
|
+
export { WorkflowState } from './chunk-VSKDQVCG.js';
|
|
25
28
|
export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
|
|
26
|
-
export { JsonSerializer } from './chunk-
|
|
29
|
+
export { JsonSerializer } from './chunk-6RKHCJUU.js';
|
|
27
30
|
export { DIContainer, ServiceTokens } from './chunk-WWGFIYKW.js';
|
|
28
|
-
export { AsyncContextView, Context, TrackedAsyncContext } from './chunk-
|
|
31
|
+
export { AsyncContextView, Context, TrackedAsyncContext } from './chunk-ZETQCNEF.js';
|
|
29
32
|
export { createErrorMapper } from './chunk-27STBUGG.js';
|
|
30
33
|
export { FlowcraftError } from './chunk-BCRWXTWX.js';
|
|
31
34
|
export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
|
|
32
|
-
export { FlowBuilder, createFlow } from './chunk-
|
|
35
|
+
export { FlowBuilder, createFlow } from './chunk-AKDL2ZX7.js';
|
|
33
36
|
export { BaseNode, isNodeClass } from './chunk-LNK7LZER.js';
|
|
34
37
|
//# sourceMappingURL=index.js.map
|
|
35
38
|
//# sourceMappingURL=index.js.map
|
package/dist/linter.d.ts
CHANGED
package/dist/logger.d.ts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/nodes/sleep.d.ts
CHANGED
package/dist/nodes/subflow.d.ts
CHANGED
package/dist/nodes/subflow.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { SubflowNode } from '../chunk-
|
|
1
|
+
export { SubflowNode } from '../chunk-4TVWI6Y6.js';
|
|
2
2
|
import '../chunk-H4JTZYIT.js';
|
|
3
3
|
import '../chunk-ZLW4QOTS.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-LWN7HOD3.js';
|
|
5
|
+
import '../chunk-VSKDQVCG.js';
|
|
6
|
+
import '../chunk-ZETQCNEF.js';
|
|
7
7
|
import '../chunk-BCRWXTWX.js';
|
|
8
8
|
import '../chunk-LNK7LZER.js';
|
|
9
9
|
//# sourceMappingURL=subflow.js.map
|
package/dist/nodes/wait.d.ts
CHANGED
package/dist/nodes/webhook.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as RuntimeOptions, c as FlowRuntime, D as ISerializer, y as ILogger, u as IAsyncContext, K as WorkflowResult, h as WorkflowBlueprint } from '../types-
|
|
1
|
+
import { w as RuntimeOptions, A as IEventBus, c as FlowRuntime, D as ISerializer, y as ILogger, u as IAsyncContext, K as WorkflowResult, h as WorkflowBlueprint } from '../types-D-dVKe4_.js';
|
|
2
2
|
import '../errors.js';
|
|
3
3
|
import '../container.js';
|
|
4
4
|
|
|
@@ -22,6 +22,7 @@ interface ICoordinationStore {
|
|
|
22
22
|
interface AdapterOptions {
|
|
23
23
|
runtimeOptions: RuntimeOptions<any>;
|
|
24
24
|
coordinationStore: ICoordinationStore;
|
|
25
|
+
eventBus?: IEventBus;
|
|
25
26
|
}
|
|
26
27
|
/** The data payload expected for a job in the queue. */
|
|
27
28
|
interface JobPayload {
|
|
@@ -38,6 +39,7 @@ declare abstract class BaseDistributedAdapter {
|
|
|
38
39
|
protected readonly store: ICoordinationStore;
|
|
39
40
|
protected readonly serializer: ISerializer;
|
|
40
41
|
protected readonly logger: ILogger;
|
|
42
|
+
protected readonly eventBus?: IEventBus;
|
|
41
43
|
constructor(options: AdapterOptions);
|
|
42
44
|
/**
|
|
43
45
|
* Starts the worker, which begins listening for and processing jobs from the queue.
|