@orbytautomation/engine 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +127 -108
  2. package/dist/core/EngineConfig.d.ts +1 -1
  3. package/dist/core/EngineConfig.d.ts.map +1 -1
  4. package/dist/core/EngineConfig.js +55 -0
  5. package/dist/core/EngineConfig.js.map +1 -1
  6. package/dist/core/OrbytEngine.d.ts +27 -1
  7. package/dist/core/OrbytEngine.d.ts.map +1 -1
  8. package/dist/core/OrbytEngine.js +475 -6
  9. package/dist/core/OrbytEngine.js.map +1 -1
  10. package/dist/distributed/DistributedStepWorker.d.ts +40 -0
  11. package/dist/distributed/DistributedStepWorker.d.ts.map +1 -0
  12. package/dist/distributed/DistributedStepWorker.js +96 -0
  13. package/dist/distributed/DistributedStepWorker.js.map +1 -0
  14. package/dist/distributed/DistributedWorkflowOrchestrator.d.ts +51 -0
  15. package/dist/distributed/DistributedWorkflowOrchestrator.d.ts.map +1 -0
  16. package/dist/distributed/DistributedWorkflowOrchestrator.js +430 -0
  17. package/dist/distributed/DistributedWorkflowOrchestrator.js.map +1 -0
  18. package/dist/distributed/FileDistributedJobQueue.d.ts +29 -0
  19. package/dist/distributed/FileDistributedJobQueue.d.ts.map +1 -0
  20. package/dist/distributed/FileDistributedJobQueue.js +170 -0
  21. package/dist/distributed/FileDistributedJobQueue.js.map +1 -0
  22. package/dist/distributed/InMemoryDistributedJobQueue.d.ts +26 -0
  23. package/dist/distributed/InMemoryDistributedJobQueue.d.ts.map +1 -0
  24. package/dist/distributed/InMemoryDistributedJobQueue.js +130 -0
  25. package/dist/distributed/InMemoryDistributedJobQueue.js.map +1 -0
  26. package/dist/distributed/index.d.ts +5 -0
  27. package/dist/distributed/index.d.ts.map +1 -0
  28. package/dist/distributed/index.js +5 -0
  29. package/dist/distributed/index.js.map +1 -0
  30. package/dist/errors/FieldRegistry.d.ts +6 -2
  31. package/dist/errors/FieldRegistry.d.ts.map +1 -1
  32. package/dist/errors/FieldRegistry.js +11 -0
  33. package/dist/errors/FieldRegistry.js.map +1 -1
  34. package/dist/execution/ExecutionEngine.d.ts.map +1 -1
  35. package/dist/execution/ExecutionEngine.js +2 -1
  36. package/dist/execution/ExecutionEngine.js.map +1 -1
  37. package/dist/execution/InternalExecutionContext.d.ts.map +1 -1
  38. package/dist/execution/InternalExecutionContext.js +3 -1
  39. package/dist/execution/InternalExecutionContext.js.map +1 -1
  40. package/dist/execution/WorkflowExecutor.d.ts +5 -0
  41. package/dist/execution/WorkflowExecutor.d.ts.map +1 -1
  42. package/dist/execution/WorkflowExecutor.js +195 -7
  43. package/dist/execution/WorkflowExecutor.js.map +1 -1
  44. package/dist/explanation/ExplanationGenerator.d.ts.map +1 -1
  45. package/dist/explanation/ExplanationGenerator.js +6 -0
  46. package/dist/explanation/ExplanationGenerator.js.map +1 -1
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +1 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/parser/SchemaValidator.d.ts +13 -0
  52. package/dist/parser/SchemaValidator.d.ts.map +1 -1
  53. package/dist/parser/SchemaValidator.js +175 -1
  54. package/dist/parser/SchemaValidator.js.map +1 -1
  55. package/dist/parser/WorkflowParser.d.ts +5 -0
  56. package/dist/parser/WorkflowParser.d.ts.map +1 -1
  57. package/dist/parser/WorkflowParser.js +20 -0
  58. package/dist/parser/WorkflowParser.js.map +1 -1
  59. package/dist/scheduling/JobScheduler.d.ts +12 -0
  60. package/dist/scheduling/JobScheduler.d.ts.map +1 -1
  61. package/dist/scheduling/JobScheduler.js +136 -20
  62. package/dist/scheduling/JobScheduler.js.map +1 -1
  63. package/dist/scheduling/Scheduler.d.ts +3 -0
  64. package/dist/scheduling/Scheduler.d.ts.map +1 -1
  65. package/dist/scheduling/Scheduler.js +3 -0
  66. package/dist/scheduling/Scheduler.js.map +1 -1
  67. package/dist/scheduling/workers/workflow-worker.js +59 -3
  68. package/dist/scheduling/workers/workflow-worker.js.map +1 -1
  69. package/dist/storage/CheckpointStore.d.ts +59 -0
  70. package/dist/storage/CheckpointStore.d.ts.map +1 -0
  71. package/dist/storage/CheckpointStore.js +62 -0
  72. package/dist/storage/CheckpointStore.js.map +1 -0
  73. package/dist/storage/index.d.ts +1 -0
  74. package/dist/storage/index.d.ts.map +1 -1
  75. package/dist/storage/index.js +1 -0
  76. package/dist/storage/index.js.map +1 -1
  77. package/dist/testing/integration/distributed/distributed-smoke.d.ts +3 -0
  78. package/dist/testing/integration/distributed/distributed-smoke.d.ts.map +1 -0
  79. package/dist/testing/integration/distributed/distributed-smoke.js +80 -0
  80. package/dist/testing/integration/distributed/distributed-smoke.js.map +1 -0
  81. package/dist/types/core-types.d.ts +278 -1
  82. package/dist/types/core-types.d.ts.map +1 -1
  83. package/dist/types/core-types.js.map +1 -1
  84. package/dist/usage/FileSpoolUsageCollector.d.ts +74 -0
  85. package/dist/usage/FileSpoolUsageCollector.d.ts.map +1 -0
  86. package/dist/usage/FileSpoolUsageCollector.js +225 -0
  87. package/dist/usage/FileSpoolUsageCollector.js.map +1 -0
  88. package/dist/usage/NoOpUsageCollector.d.ts +35 -0
  89. package/dist/usage/NoOpUsageCollector.d.ts.map +1 -0
  90. package/dist/usage/NoOpUsageCollector.js +40 -0
  91. package/dist/usage/NoOpUsageCollector.js.map +1 -0
  92. package/dist/usage/UsageEventFactory.d.ts +80 -0
  93. package/dist/usage/UsageEventFactory.d.ts.map +1 -0
  94. package/dist/usage/UsageEventFactory.js +117 -0
  95. package/dist/usage/UsageEventFactory.js.map +1 -0
  96. package/dist/usage/index.d.ts +11 -0
  97. package/dist/usage/index.d.ts.map +1 -0
  98. package/dist/usage/index.js +11 -0
  99. package/dist/usage/index.js.map +1 -0
  100. package/package.json +7 -3
@@ -0,0 +1,430 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { performance } from 'node:perf_hooks';
3
+ import { ContextStore } from '../context/ContextStore.js';
4
+ import { createExecutionNode } from '../execution/ExecutionNode.js';
5
+ import { ExecutionPlanner } from '../execution/ExecutionPlan.js';
6
+ import { LoggerManager } from '../logging/LoggerManager.js';
7
+ import { createEvent } from '../events/EngineEvents.js';
8
+ import { EngineEventType, } from '../types/core-types.js';
9
+ import { DistributedStepWorker } from './DistributedStepWorker.js';
10
+ /**
11
+ * Distributed workflow runtime orchestrator.
12
+ *
13
+ * Responsibilities:
14
+ * - Build DAG plan
15
+ * - Enqueue ready step jobs
16
+ * - Track step completion state
17
+ * - React to worker outcomes and unlock dependent steps
18
+ */
19
+ export class DistributedWorkflowOrchestrator {
20
+ queue;
21
+ stepExecutor;
22
+ workerCount;
23
+ pollIntervalMs;
24
+ eventBus;
25
+ hookManager;
26
+ executionStore;
27
+ checkpointStore;
28
+ leaseExtensionMs;
29
+ constructor(options) {
30
+ this.queue = options.queue;
31
+ this.stepExecutor = options.stepExecutor;
32
+ this.workerCount = Math.max(1, options.workerCount ?? 4);
33
+ this.pollIntervalMs = Math.max(10, options.pollIntervalMs ?? 50);
34
+ this.eventBus = options.eventBus;
35
+ this.hookManager = options.hookManager;
36
+ this.executionStore = options.executionStore;
37
+ this.checkpointStore = options.checkpointStore;
38
+ this.leaseExtensionMs = Math.max(500, options.leaseExtensionMs ?? 5_000);
39
+ }
40
+ async execute(workflow, options = {}) {
41
+ const startedAt = new Date();
42
+ const workflowStart = performance.now();
43
+ const runId = options.resumeFromRunId || this.generateRunId();
44
+ const workflowId = workflow.name || runId;
45
+ const workflowName = workflow.metadata?.name || workflow.name || 'unnamed-workflow';
46
+ const logger = LoggerManager.getLogger();
47
+ this.executionStore?.begin(runId, workflowName, startedAt);
48
+ const contextStore = new ContextStore({
49
+ executionId: runId,
50
+ workflowId,
51
+ workflowName,
52
+ version: workflow.metadata?.version || workflow.version,
53
+ description: workflow.metadata?.description || workflow.description,
54
+ tags: workflow.metadata?.tags || workflow.tags,
55
+ owner: workflow.metadata?.owner || workflow.owner,
56
+ env: {
57
+ ...(workflow.context || {}),
58
+ ...(options.env || {}),
59
+ },
60
+ inputs: options.inputs,
61
+ secrets: options.secrets,
62
+ metadata: {
63
+ createdAt: workflow.metadata?.createdAt || new Date().toISOString(),
64
+ updatedAt: workflow.metadata?.updatedAt,
65
+ annotations: {},
66
+ },
67
+ context: options.context,
68
+ triggeredBy: options.triggeredBy,
69
+ });
70
+ this.stepExecutor.setContextStore(contextStore);
71
+ const stepResults = new Map();
72
+ const stepsById = new Map(workflow.steps.map((step) => [step.id, step]));
73
+ const plan = ExecutionPlanner.plan(this.convertToExecutionNodes(workflow.steps));
74
+ const reverseDeps = this.buildReverseDeps(workflow.steps);
75
+ const unresolvedDeps = this.buildDependencyCounters(workflow.steps);
76
+ const queuedSteps = new Set();
77
+ const terminalSteps = new Set();
78
+ const hookContext = {
79
+ workflowId,
80
+ workflowName,
81
+ runId,
82
+ triggeredBy: options.triggeredBy,
83
+ inputs: options.inputs,
84
+ env: options.env,
85
+ metadata: workflow.metadata,
86
+ startTime: startedAt.getTime(),
87
+ };
88
+ let resumed = false;
89
+ if (options.resumeFromRunId && this.checkpointStore) {
90
+ resumed = this.restoreFromCheckpoint(workflow, options.resumeFromRunId, options.resumePolicy ?? 'strict', contextStore, stepResults, terminalSteps);
91
+ }
92
+ this.saveCheckpoint(workflow, runId, 'running', stepResults, contextStore, startedAt, resumed ? 'workflow-resumed' : 'workflow-started');
93
+ await this.eventBus?.emit(createEvent(EngineEventType.WORKFLOW_STARTED, {
94
+ workflowId,
95
+ workflowName,
96
+ runId,
97
+ triggeredBy: options.triggeredBy,
98
+ inputs: options.inputs,
99
+ }, { workflowId, runId }));
100
+ if (resumed) {
101
+ await this.eventBus?.emit(createEvent(EngineEventType.WORKFLOW_RESUMED, {
102
+ workflowId,
103
+ workflowName,
104
+ runId,
105
+ triggeredBy: options.triggeredBy,
106
+ }, { workflowId, runId }));
107
+ await this.hookManager?.runOnResume(hookContext);
108
+ }
109
+ await this.hookManager?.runBeforeWorkflow(hookContext);
110
+ for (const completedStepId of terminalSteps) {
111
+ this.unlockDependents(completedStepId, reverseDeps, unresolvedDeps, queuedSteps, stepsById, workflowId, runId);
112
+ }
113
+ let workflowError;
114
+ let aborted = false;
115
+ const workers = Array.from({ length: this.workerCount }, (_, index) => new DistributedStepWorker({
116
+ workerId: `dist-worker-${index + 1}`,
117
+ queue: this.queue,
118
+ stepExecutor: this.stepExecutor,
119
+ resolveStep: (job) => stepsById.get(job.stepId),
120
+ resolveContext: () => contextStore.getResolutionContext(),
121
+ onStepFinished: async (job, result) => {
122
+ stepResults.set(job.stepId, result);
123
+ terminalSteps.add(job.stepId);
124
+ this.executionStore?.stepUpdate(runId, result);
125
+ this.saveCheckpoint(workflow, runId, 'running', stepResults, contextStore, startedAt, 'step-updated');
126
+ await this.unlockDependents(job.stepId, reverseDeps, unresolvedDeps, queuedSteps, stepsById, workflowId, runId);
127
+ },
128
+ onStepFailed: async (job, error, outcome) => {
129
+ if (outcome === 'requeued') {
130
+ return;
131
+ }
132
+ const failedResult = {
133
+ stepId: job.stepId,
134
+ status: 'failure',
135
+ output: null,
136
+ error,
137
+ attempts: Math.max(1, job.attempts + 1),
138
+ duration: 0,
139
+ startedAt: new Date(),
140
+ completedAt: new Date(),
141
+ };
142
+ stepResults.set(job.stepId, failedResult);
143
+ terminalSteps.add(job.stepId);
144
+ this.executionStore?.stepUpdate(runId, failedResult);
145
+ this.saveCheckpoint(workflow, runId, 'running', stepResults, contextStore, startedAt, 'step-updated');
146
+ const step = stepsById.get(job.stepId);
147
+ const continueOnError = options.continueOnError ?? workflow.policies?.failure === 'continue';
148
+ if (!continueOnError && !step?.continueOnError) {
149
+ aborted = true;
150
+ workflowError = error;
151
+ return;
152
+ }
153
+ await this.unlockDependents(job.stepId, reverseDeps, unresolvedDeps, queuedSteps, stepsById, workflowId, runId);
154
+ },
155
+ pollIntervalMs: this.pollIntervalMs,
156
+ leaseExtensionMs: this.leaseExtensionMs,
157
+ }));
158
+ const initialSteps = ExecutionPlanner.getInitialNodes(plan)
159
+ .map((node) => stepsById.get(node.stepId))
160
+ .filter((step) => !!step);
161
+ for (const step of initialSteps) {
162
+ await this.enqueueStepJob({ workflowId, runId, step, queuedSteps });
163
+ }
164
+ workers.forEach((worker) => worker.start());
165
+ try {
166
+ const timeoutMs = options.timeout;
167
+ const startWait = Date.now();
168
+ while (terminalSteps.size < workflow.steps.length && !aborted) {
169
+ const queueStats = await this.queue.getStats();
170
+ if (queueStats.queued === 0 && queueStats.leased === 0) {
171
+ break;
172
+ }
173
+ if (timeoutMs && Date.now() - startWait > timeoutMs) {
174
+ aborted = true;
175
+ workflowError = new Error(`Workflow '${workflowId}' exceeded timeout of ${timeoutMs}ms`);
176
+ break;
177
+ }
178
+ await this.sleep(this.pollIntervalMs);
179
+ }
180
+ }
181
+ finally {
182
+ workers.forEach((worker) => worker.stop());
183
+ }
184
+ const completedAt = new Date();
185
+ const duration = Math.round(performance.now() - workflowStart);
186
+ const failedSteps = Array.from(stepResults.values()).filter((result) => result.status === 'failure').length;
187
+ const status = workflowError
188
+ ? (workflowError.message.includes('timeout') ? 'timeout' : 'failure')
189
+ : failedSteps > 0
190
+ ? 'partial'
191
+ : 'success';
192
+ const finalStoreStatus = status === 'timeout' ? 'timeout' : status === 'failure' ? 'failed' : 'completed';
193
+ this.executionStore?.finalize(runId, finalStoreStatus, completedAt, Array.from(stepResults.values()), duration, workflowError);
194
+ this.saveCheckpoint(workflow, runId, finalStoreStatus, stepResults, contextStore, startedAt, status === 'timeout' ? 'workflow-timeout' : status === 'failure' ? 'workflow-failed' : 'workflow-completed', completedAt);
195
+ if (status === 'success' || status === 'partial') {
196
+ await this.eventBus?.emit(createEvent(EngineEventType.WORKFLOW_COMPLETED, {
197
+ workflowId,
198
+ workflowName,
199
+ runId,
200
+ durationMs: duration,
201
+ stepCount: workflow.steps.length,
202
+ }, { workflowId, runId }));
203
+ await this.hookManager?.runAfterWorkflow(hookContext);
204
+ }
205
+ else {
206
+ await this.eventBus?.emit(createEvent(EngineEventType.WORKFLOW_FAILED, {
207
+ workflowId,
208
+ workflowName,
209
+ runId,
210
+ error: workflowError?.message || 'Distributed execution failed',
211
+ durationMs: duration,
212
+ }, { workflowId, runId }));
213
+ if (workflowError) {
214
+ await this.hookManager?.runOnError(hookContext, workflowError);
215
+ }
216
+ }
217
+ logger.info('[DistributedWorkflowOrchestrator] Workflow execution finished', {
218
+ workflowId,
219
+ runId,
220
+ status,
221
+ workerCount: this.workerCount,
222
+ totalSteps: workflow.steps.length,
223
+ terminalSteps: terminalSteps.size,
224
+ duration,
225
+ });
226
+ return {
227
+ workflowName: workflow.name || 'unnamed-workflow',
228
+ executionId: runId,
229
+ status,
230
+ stepResults,
231
+ duration,
232
+ startedAt,
233
+ completedAt,
234
+ error: workflowError,
235
+ metadata: {
236
+ totalSteps: workflow.steps.length,
237
+ successfulSteps: Array.from(stepResults.values()).filter((result) => result.status === 'success').length,
238
+ failedSteps,
239
+ skippedSteps: Array.from(stepResults.values()).filter((result) => result.status === 'skipped').length,
240
+ phases: plan.phases.length,
241
+ },
242
+ };
243
+ }
244
+ async enqueueStepJob(params) {
245
+ const { workflowId, runId, step, queuedSteps } = params;
246
+ if (queuedSteps.has(step.id)) {
247
+ return;
248
+ }
249
+ const job = {
250
+ jobId: this.generateJobId(),
251
+ runId,
252
+ workflowId,
253
+ stepId: step.id,
254
+ uses: step.action,
255
+ input: step.input,
256
+ attempts: 0,
257
+ maxAttempts: (step.retry?.max ?? 0) + 1,
258
+ status: 'queued',
259
+ createdAt: Date.now(),
260
+ updatedAt: Date.now(),
261
+ };
262
+ queuedSteps.add(step.id);
263
+ await this.queue.push(job);
264
+ }
265
+ buildDependencyCounters(steps) {
266
+ const counters = new Map();
267
+ for (const step of steps) {
268
+ counters.set(step.id, step.needs?.length ?? 0);
269
+ }
270
+ return counters;
271
+ }
272
+ buildReverseDeps(steps) {
273
+ const reverse = new Map();
274
+ for (const step of steps) {
275
+ if (!reverse.has(step.id)) {
276
+ reverse.set(step.id, []);
277
+ }
278
+ for (const dependency of step.needs || []) {
279
+ const existing = reverse.get(dependency) ?? [];
280
+ existing.push(step.id);
281
+ reverse.set(dependency, existing);
282
+ }
283
+ }
284
+ return reverse;
285
+ }
286
+ async unlockDependents(completedStepId, reverseDeps, unresolvedDeps, queuedSteps, stepsById, workflowId, runId) {
287
+ const dependents = reverseDeps.get(completedStepId) || [];
288
+ for (const dependentId of dependents) {
289
+ const remaining = (unresolvedDeps.get(dependentId) ?? 1) - 1;
290
+ unresolvedDeps.set(dependentId, remaining);
291
+ if (remaining <= 0) {
292
+ const step = stepsById.get(dependentId);
293
+ if (step) {
294
+ await this.enqueueStepJob({
295
+ workflowId,
296
+ runId,
297
+ step,
298
+ queuedSteps,
299
+ });
300
+ }
301
+ }
302
+ }
303
+ }
304
+ restoreFromCheckpoint(workflow, runId, policy, contextStore, stepResults, terminalSteps) {
305
+ if (!this.checkpointStore) {
306
+ return false;
307
+ }
308
+ const snapshot = this.checkpointStore.load(runId);
309
+ if (!snapshot) {
310
+ if (policy === 'strict') {
311
+ throw new Error(`Resume failed: checkpoint not found for runId '${runId}'`);
312
+ }
313
+ return false;
314
+ }
315
+ if (snapshot.workflowId !== (workflow.name || runId)) {
316
+ if (policy === 'strict') {
317
+ throw new Error(`Resume failed: checkpoint workflow '${snapshot.workflowId}' mismatch`);
318
+ }
319
+ return false;
320
+ }
321
+ if (snapshot.status === 'completed' || snapshot.status === 'failed' || snapshot.status === 'timeout') {
322
+ if (policy === 'strict') {
323
+ throw new Error(`Resume failed: checkpoint for runId '${runId}' is terminal (${snapshot.status})`);
324
+ }
325
+ return false;
326
+ }
327
+ for (const [stepId, output] of Object.entries(snapshot.context.stepOutputs ?? {})) {
328
+ contextStore.setStepOutput(stepId, output);
329
+ }
330
+ for (const [stepId, state] of Object.entries(snapshot.stepStates)) {
331
+ if (state.status !== 'success' && state.status !== 'skipped') {
332
+ continue;
333
+ }
334
+ const now = new Date();
335
+ const completedAt = state.completedAt ? new Date(state.completedAt) : now;
336
+ const status = state.status === 'success' ? 'success' : 'skipped';
337
+ const stepResult = {
338
+ stepId,
339
+ status,
340
+ output: state.output ?? null,
341
+ attempts: state.attempts || 1,
342
+ duration: state.durationMs ?? 0,
343
+ startedAt: now,
344
+ completedAt,
345
+ };
346
+ stepResults.set(stepId, stepResult);
347
+ terminalSteps.add(stepId);
348
+ }
349
+ return true;
350
+ }
351
+ saveCheckpoint(workflow, runId, status, stepResults, contextStore, startedAt, reason, completedAt) {
352
+ if (!this.checkpointStore) {
353
+ return;
354
+ }
355
+ const stepStates = {};
356
+ for (const [stepId, result] of stepResults.entries()) {
357
+ stepStates[stepId] = {
358
+ id: stepId,
359
+ status: result.status,
360
+ attempts: result.attempts,
361
+ output: result.output,
362
+ error: result.error?.message,
363
+ durationMs: result.duration,
364
+ completedAt: result.completedAt.toISOString(),
365
+ };
366
+ }
367
+ const context = contextStore.getResolutionContext();
368
+ this.checkpointStore.save({
369
+ runId,
370
+ workflowId: workflow.name || runId,
371
+ status,
372
+ stepStates,
373
+ context: {
374
+ env: context.env,
375
+ inputs: context.inputs,
376
+ custom: context.context,
377
+ stepOutputs: Object.fromEntries(context.steps.entries()),
378
+ },
379
+ metadata: {
380
+ startedAt: startedAt.getTime(),
381
+ updatedAt: Date.now(),
382
+ completedAt: completedAt?.getTime(),
383
+ checkpointReason: reason,
384
+ },
385
+ });
386
+ }
387
+ convertToExecutionNodes(steps) {
388
+ return steps.map((step) => {
389
+ const timeout = step.timeout ? this.parseTimeoutString(step.timeout) : undefined;
390
+ const maxRetries = step.retry?.max ?? 0;
391
+ return createExecutionNode()
392
+ .setStepId(step.id)
393
+ .setUses(step.action)
394
+ .setInput(step.input)
395
+ .setDependencies(step.needs)
396
+ .setCondition(step.when)
397
+ .setMaxRetries(maxRetries)
398
+ .setTimeout(timeout)
399
+ .setAdapter(null)
400
+ .build();
401
+ });
402
+ }
403
+ parseTimeoutString(timeout) {
404
+ const match = timeout.match(/^([0-9]+)(ms|s|m|h)$/);
405
+ if (!match) {
406
+ throw new Error(`Invalid timeout format: ${timeout}. Expected format: <number><unit>`);
407
+ }
408
+ const value = parseInt(match[1], 10);
409
+ const unit = match[2];
410
+ if (unit === 'ms')
411
+ return value;
412
+ if (unit === 's')
413
+ return value * 1000;
414
+ if (unit === 'm')
415
+ return value * 60 * 1000;
416
+ if (unit === 'h')
417
+ return value * 60 * 60 * 1000;
418
+ throw new Error(`Unsupported timeout unit: ${unit}`);
419
+ }
420
+ generateRunId() {
421
+ return `dist-exec-${Date.now()}-${randomUUID().split('-')[0]}`;
422
+ }
423
+ generateJobId() {
424
+ return `dist-job-${Date.now()}-${randomUUID().split('-')[0]}`;
425
+ }
426
+ sleep(ms) {
427
+ return new Promise((resolve) => setTimeout(resolve, ms));
428
+ }
429
+ }
430
+ //# sourceMappingURL=DistributedWorkflowOrchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DistributedWorkflowOrchestrator.js","sourceRoot":"","sources":["../../src/distributed/DistributedWorkflowOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EACL,eAAe,GAQhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAkBnE;;;;;;;;GAQG;AACH,MAAM,OAAO,+BAA+B;IACzB,KAAK,CAAsB;IAC3B,YAAY,CAAe;IAC3B,WAAW,CAAS;IACp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EO,aAAa;QACnB,OAAO,YAAY,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import { type DistributedJobQueue, type DistributedQueueStats, type DistributedStepJob } from '../types/core-types.js';
2
+ export interface FileDistributedJobQueueOptions {
3
+ stateDir: string;
4
+ leaseMs?: number;
5
+ stateFileName?: string;
6
+ }
7
+ /**
8
+ * File-backed distributed queue.
9
+ *
10
+ * This provides cross-process durability on a single machine without
11
+ * requiring Redis. For multi-node deployments, use an external queue backend.
12
+ */
13
+ export declare class FileDistributedJobQueue implements DistributedJobQueue {
14
+ private readonly adapter;
15
+ private readonly leaseMs;
16
+ private readonly stateFileName;
17
+ constructor(options: FileDistributedJobQueueOptions);
18
+ push(job: DistributedStepJob): Promise<void>;
19
+ pull(workerId: string): Promise<DistributedStepJob | null>;
20
+ ack(jobId: string): Promise<void>;
21
+ nack(jobId: string, error: Error, requeue?: boolean): Promise<'requeued' | 'failed' | 'missing'>;
22
+ extendLease(jobId: string, workerId: string, leaseMs?: number): Promise<boolean>;
23
+ getStats(): Promise<DistributedQueueStats>;
24
+ private ensureState;
25
+ private readState;
26
+ private writeState;
27
+ private requeueExpired;
28
+ }
29
+ //# sourceMappingURL=FileDistributedJobQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileDistributedJobQueue.d.ts","sourceRoot":"","sources":["../../src/distributed/FileDistributedJobQueue.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAShC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,OAAO,EAAE,8BAA8B;IAO7C,IAAI,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB5C,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAwB1D,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IAiC7F,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBhF,QAAQ,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAahD,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;CAyBvB"}
@@ -0,0 +1,170 @@
1
+ import { FileStorageAdapter } from '../storage/FileStorageAdapter.js';
2
+ /**
3
+ * File-backed distributed queue.
4
+ *
5
+ * This provides cross-process durability on a single machine without
6
+ * requiring Redis. For multi-node deployments, use an external queue backend.
7
+ */
8
+ export class FileDistributedJobQueue {
9
+ adapter;
10
+ leaseMs;
11
+ stateFileName;
12
+ constructor(options) {
13
+ this.adapter = new FileStorageAdapter(options.stateDir);
14
+ this.leaseMs = options.leaseMs ?? 30_000;
15
+ this.stateFileName = options.stateFileName ?? 'distributed-queue.json';
16
+ this.ensureState();
17
+ }
18
+ async push(job) {
19
+ const state = this.readState();
20
+ this.requeueExpired(state);
21
+ const now = Date.now();
22
+ state.queued.push({
23
+ ...job,
24
+ status: 'queued',
25
+ attempts: Math.max(0, job.attempts ?? 0),
26
+ maxAttempts: Math.max(1, job.maxAttempts ?? 1),
27
+ createdAt: job.createdAt || now,
28
+ updatedAt: now,
29
+ workerId: undefined,
30
+ leaseExpiresAt: undefined,
31
+ lastError: undefined,
32
+ });
33
+ this.writeState(state);
34
+ }
35
+ async pull(workerId) {
36
+ const state = this.readState();
37
+ this.requeueExpired(state);
38
+ const job = state.queued.shift();
39
+ if (!job) {
40
+ this.writeState(state);
41
+ return null;
42
+ }
43
+ const now = Date.now();
44
+ const leased = {
45
+ ...job,
46
+ status: 'leased',
47
+ workerId,
48
+ leaseExpiresAt: now + this.leaseMs,
49
+ updatedAt: now,
50
+ };
51
+ state.leased.push(leased);
52
+ this.writeState(state);
53
+ return leased;
54
+ }
55
+ async ack(jobId) {
56
+ const state = this.readState();
57
+ this.requeueExpired(state);
58
+ const idx = state.leased.findIndex((job) => job.jobId === jobId);
59
+ if (idx === -1) {
60
+ this.writeState(state);
61
+ return;
62
+ }
63
+ const [job] = state.leased.splice(idx, 1);
64
+ state.completed.push({
65
+ ...job,
66
+ status: 'completed',
67
+ workerId: undefined,
68
+ leaseExpiresAt: undefined,
69
+ updatedAt: Date.now(),
70
+ });
71
+ this.writeState(state);
72
+ }
73
+ async nack(jobId, error, requeue = true) {
74
+ const state = this.readState();
75
+ this.requeueExpired(state);
76
+ const idx = state.leased.findIndex((job) => job.jobId === jobId);
77
+ if (idx === -1) {
78
+ this.writeState(state);
79
+ return 'missing';
80
+ }
81
+ const [job] = state.leased.splice(idx, 1);
82
+ const updated = {
83
+ ...job,
84
+ attempts: job.attempts + 1,
85
+ lastError: error.message,
86
+ workerId: undefined,
87
+ leaseExpiresAt: undefined,
88
+ updatedAt: Date.now(),
89
+ };
90
+ if (requeue && updated.attempts < updated.maxAttempts) {
91
+ updated.status = 'queued';
92
+ state.queued.push(updated);
93
+ this.writeState(state);
94
+ return 'requeued';
95
+ }
96
+ updated.status = 'failed';
97
+ state.failed.push(updated);
98
+ this.writeState(state);
99
+ return 'failed';
100
+ }
101
+ async extendLease(jobId, workerId, leaseMs) {
102
+ const state = this.readState();
103
+ this.requeueExpired(state);
104
+ const job = state.leased.find((entry) => entry.jobId === jobId);
105
+ if (!job || job.workerId !== workerId) {
106
+ this.writeState(state);
107
+ return false;
108
+ }
109
+ job.leaseExpiresAt = Date.now() + (leaseMs ?? this.leaseMs);
110
+ job.updatedAt = Date.now();
111
+ this.writeState(state);
112
+ return true;
113
+ }
114
+ async getStats() {
115
+ const state = this.readState();
116
+ this.requeueExpired(state);
117
+ this.writeState(state);
118
+ return {
119
+ queued: state.queued.length,
120
+ leased: state.leased.length,
121
+ completed: state.completed.length,
122
+ failed: state.failed.length,
123
+ };
124
+ }
125
+ ensureState() {
126
+ this.adapter.ensureDir();
127
+ if (!this.adapter.exists(this.stateFileName)) {
128
+ this.writeState({
129
+ queued: [],
130
+ leased: [],
131
+ completed: [],
132
+ failed: [],
133
+ });
134
+ }
135
+ }
136
+ readState() {
137
+ this.ensureState();
138
+ return this.adapter.readJson(this.stateFileName) ?? {
139
+ queued: [],
140
+ leased: [],
141
+ completed: [],
142
+ failed: [],
143
+ };
144
+ }
145
+ writeState(state) {
146
+ this.adapter.saveJson(this.stateFileName, state);
147
+ }
148
+ requeueExpired(state) {
149
+ if (state.leased.length === 0) {
150
+ return;
151
+ }
152
+ const now = Date.now();
153
+ const remainingLeased = [];
154
+ for (const job of state.leased) {
155
+ if (!job.leaseExpiresAt || job.leaseExpiresAt > now) {
156
+ remainingLeased.push(job);
157
+ continue;
158
+ }
159
+ state.queued.push({
160
+ ...job,
161
+ status: 'queued',
162
+ workerId: undefined,
163
+ leaseExpiresAt: undefined,
164
+ updatedAt: now,
165
+ });
166
+ }
167
+ state.leased = remainingLeased;
168
+ }
169
+ }
170
+ //# sourceMappingURL=FileDistributedJobQueue.js.map