openworkflow 0.4.0 → 0.4.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.
Files changed (133) hide show
  1. package/README.md +17 -11
  2. package/dist/backend-sqlite/backend.d.ts +38 -0
  3. package/dist/backend-sqlite/backend.d.ts.map +1 -0
  4. package/dist/backend-sqlite/backend.js +628 -0
  5. package/dist/backend-sqlite/backend.js.map +1 -0
  6. package/dist/backend-sqlite/index.d.ts +2 -0
  7. package/dist/backend-sqlite/index.d.ts.map +1 -0
  8. package/dist/backend-sqlite/index.js +2 -0
  9. package/dist/backend-sqlite/index.js.map +1 -0
  10. package/dist/backend-sqlite/sqlite.d.ts +45 -0
  11. package/dist/backend-sqlite/sqlite.d.ts.map +1 -0
  12. package/dist/backend-sqlite/sqlite.js +229 -0
  13. package/dist/backend-sqlite/sqlite.js.map +1 -0
  14. package/dist/config/config.d.ts +102 -0
  15. package/dist/config/config.d.ts.map +1 -0
  16. package/dist/config/config.js +29 -0
  17. package/dist/config/config.js.map +1 -0
  18. package/dist/config/index.d.ts +3 -0
  19. package/dist/config/index.d.ts.map +1 -0
  20. package/dist/config/index.js +2 -0
  21. package/dist/config/index.js.map +1 -0
  22. package/dist/config.d.ts +28 -0
  23. package/dist/config.d.ts.map +1 -0
  24. package/dist/config.js +41 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/core/backend-test-suite.d.ts +22 -0
  27. package/dist/core/backend-test-suite.d.ts.map +1 -0
  28. package/dist/core/backend-test-suite.js +960 -0
  29. package/dist/core/backend-test-suite.js.map +1 -0
  30. package/dist/core/backend.d.ts +103 -0
  31. package/dist/core/backend.d.ts.map +1 -0
  32. package/dist/core/backend.js +2 -0
  33. package/dist/core/backend.js.map +1 -0
  34. package/dist/core/backend.testsuite.d.ts +21 -0
  35. package/dist/core/backend.testsuite.d.ts.map +1 -0
  36. package/dist/core/backend.testsuite.js +958 -0
  37. package/dist/core/backend.testsuite.js.map +1 -0
  38. package/dist/{duration.d.ts → core/duration.d.ts} +2 -1
  39. package/dist/core/duration.d.ts.map +1 -0
  40. package/dist/{duration.js → core/duration.js} +6 -5
  41. package/dist/core/duration.js.map +1 -0
  42. package/dist/core/duration.test.d.ts +2 -0
  43. package/dist/core/duration.test.d.ts.map +1 -0
  44. package/dist/core/duration.test.js +264 -0
  45. package/dist/core/duration.test.js.map +1 -0
  46. package/dist/core/json.d.ts +5 -0
  47. package/dist/core/json.d.ts.map +1 -0
  48. package/dist/core/json.js +2 -0
  49. package/dist/core/json.js.map +1 -0
  50. package/dist/core/result.d.ts +12 -0
  51. package/dist/core/result.d.ts.map +1 -0
  52. package/dist/core/result.js +7 -0
  53. package/dist/core/result.js.map +1 -0
  54. package/dist/core/result.test.d.ts +2 -0
  55. package/dist/core/result.test.d.ts.map +1 -0
  56. package/dist/core/result.test.js +11 -0
  57. package/dist/core/result.test.js.map +1 -0
  58. package/dist/core/retry.d.ts +16 -0
  59. package/dist/core/retry.d.ts.map +1 -0
  60. package/dist/{backend.js → core/retry.js} +1 -3
  61. package/dist/core/retry.js.map +1 -0
  62. package/dist/core/retry.test.d.ts +2 -0
  63. package/dist/core/retry.test.d.ts.map +1 -0
  64. package/dist/core/retry.test.js +36 -0
  65. package/dist/core/retry.test.js.map +1 -0
  66. package/dist/core/schema.d.ts.map +1 -0
  67. package/dist/core/schema.js.map +1 -0
  68. package/dist/core/step.d.ts +120 -0
  69. package/dist/core/step.d.ts.map +1 -0
  70. package/dist/core/step.js +101 -0
  71. package/dist/core/step.js.map +1 -0
  72. package/dist/core/step.test.d.ts +2 -0
  73. package/dist/core/step.test.d.ts.map +1 -0
  74. package/dist/core/step.test.js +340 -0
  75. package/dist/core/step.test.js.map +1 -0
  76. package/dist/core/workflow.d.ts +108 -0
  77. package/dist/core/workflow.d.ts.map +1 -0
  78. package/dist/core/workflow.js +79 -0
  79. package/dist/core/workflow.js.map +1 -0
  80. package/dist/core/workflow.test.d.ts +2 -0
  81. package/dist/core/workflow.test.d.ts.map +1 -0
  82. package/dist/core/workflow.test.js +216 -0
  83. package/dist/core/workflow.test.js.map +1 -0
  84. package/dist/execution/execution.d.ts +91 -0
  85. package/dist/execution/execution.d.ts.map +1 -0
  86. package/dist/execution/execution.js +188 -0
  87. package/dist/execution/execution.js.map +1 -0
  88. package/dist/execution/execution.test.d.ts +2 -0
  89. package/dist/execution/execution.test.d.ts.map +1 -0
  90. package/dist/execution/execution.test.js +382 -0
  91. package/dist/execution/execution.test.js.map +1 -0
  92. package/dist/global.d.ts +62 -0
  93. package/dist/global.d.ts.map +1 -0
  94. package/dist/global.js +78 -0
  95. package/dist/global.js.map +1 -0
  96. package/dist/index.d.ts +9 -5
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +4 -3
  99. package/dist/index.js.map +1 -1
  100. package/dist/sdk/sdk.d.ts +182 -0
  101. package/dist/sdk/sdk.d.ts.map +1 -0
  102. package/dist/sdk/sdk.js +208 -0
  103. package/dist/sdk/sdk.js.map +1 -0
  104. package/dist/sdk/sdk.test.d.ts +2 -0
  105. package/dist/sdk/sdk.test.d.ts.map +1 -0
  106. package/dist/sdk/sdk.test.js +195 -0
  107. package/dist/sdk/sdk.test.js.map +1 -0
  108. package/dist/tsconfig.tsbuildinfo +1 -1
  109. package/dist/{worker.d.ts → worker/worker.d.ts} +3 -3
  110. package/dist/worker/worker.d.ts.map +1 -0
  111. package/dist/worker/worker.js +208 -0
  112. package/dist/worker/worker.js.map +1 -0
  113. package/dist/worker/worker.test.d.ts +2 -0
  114. package/dist/worker/worker.test.d.ts.map +1 -0
  115. package/dist/worker/worker.test.js +786 -0
  116. package/dist/worker/worker.test.js.map +1 -0
  117. package/package.json +6 -6
  118. package/dist/backend.d.ts +0 -173
  119. package/dist/backend.d.ts.map +0 -1
  120. package/dist/backend.js.map +0 -1
  121. package/dist/client.d.ts +0 -153
  122. package/dist/client.d.ts.map +0 -1
  123. package/dist/client.js +0 -151
  124. package/dist/client.js.map +0 -1
  125. package/dist/duration.d.ts.map +0 -1
  126. package/dist/duration.js.map +0 -1
  127. package/dist/schema.d.ts.map +0 -1
  128. package/dist/schema.js.map +0 -1
  129. package/dist/worker.d.ts.map +0 -1
  130. package/dist/worker.js +0 -384
  131. package/dist/worker.js.map +0 -1
  132. /package/dist/{schema.d.ts → core/schema.d.ts} +0 -0
  133. /package/dist/{schema.js → core/schema.js} +0 -0
package/dist/worker.js DELETED
@@ -1,384 +0,0 @@
1
- import { parseDuration } from "./duration.js";
2
- import { randomUUID } from "node:crypto";
3
- const DEFAULT_LEASE_DURATION_MS = 30 * 1000; // 30s
4
- const DEFAULT_POLL_INTERVAL_MS = 100; // 100ms
5
- const DEFAULT_CONCURRENCY = 1;
6
- /**
7
- * Signal thrown when a workflow needs to sleep. Contains the time when the
8
- * workflow should resume.
9
- */
10
- class SleepSignal extends Error {
11
- resumeAt;
12
- constructor(resumeAt) {
13
- super("SleepSignal");
14
- this.name = "SleepSignal";
15
- this.resumeAt = resumeAt;
16
- }
17
- }
18
- /**
19
- * Runs workflows by polling the backend, dispatching runs across a concurrency
20
- * pool, and heartbeating/extending leases.
21
- */
22
- export class Worker {
23
- backend;
24
- workerIds;
25
- registeredWorkflows = new Map();
26
- activeExecutions = new Set();
27
- running = false;
28
- loopPromise = null;
29
- constructor(options) {
30
- this.backend = options.backend;
31
- const concurrency = Math.max(DEFAULT_CONCURRENCY, options.concurrency ?? DEFAULT_CONCURRENCY);
32
- // generate worker IDs for every concurrency slot
33
- this.workerIds = Array.from({ length: concurrency }, () => randomUUID());
34
- // register workflows
35
- for (const workflow of options.workflows) {
36
- this.registeredWorkflows.set(workflow.name, workflow);
37
- }
38
- }
39
- /**
40
- * Start the worker. It will begin polling for and executing workflows.
41
- */
42
- async start() {
43
- if (this.running)
44
- return;
45
- this.running = true;
46
- this.loopPromise = this.runLoop();
47
- await Promise.resolve();
48
- }
49
- /**
50
- * Stop the worker gracefully. Waits for all active workflow runs to complete
51
- * before returning.
52
- */
53
- async stop() {
54
- this.running = false;
55
- // wait for the poll loop to stop
56
- if (this.loopPromise)
57
- await this.loopPromise;
58
- // wait for all active executions to finish
59
- while (this.activeExecutions.size > 0)
60
- await sleep(100);
61
- }
62
- /**
63
- * Processes one round of work claims and execution. Exposed for testing.
64
- * Returns the number of workflow runs claimed.
65
- */
66
- async tick() {
67
- const availableSlots = this.concurrency - this.activeExecutions.size;
68
- if (availableSlots <= 0)
69
- return 0;
70
- // claim work for each available slot
71
- const claims = Array.from({ length: availableSlots }, (_, i) => {
72
- const availableWorkerId = this.workerIds[i % this.workerIds.length];
73
- return availableWorkerId
74
- ? this.claimAndProcessWorkflowRunInBackground(availableWorkerId)
75
- : Promise.resolve(null);
76
- });
77
- const claimed = await Promise.all(claims);
78
- return claimed.filter((run) => run !== null).length;
79
- }
80
- /**
81
- * Get the configured concurrency limit.
82
- */
83
- get concurrency() {
84
- return this.workerIds.length;
85
- }
86
- /*
87
- * Main run loop that continuously ticks while the worker is running.
88
- * Only sleeps when no work was claimed to avoid busy-waiting.
89
- */
90
- async runLoop() {
91
- while (this.running) {
92
- try {
93
- const claimedCount = await this.tick();
94
- // only sleep if we didn't claim any work
95
- if (claimedCount === 0) {
96
- await sleep(DEFAULT_POLL_INTERVAL_MS);
97
- }
98
- }
99
- catch (error) {
100
- console.error("Worker tick failed:", error);
101
- await sleep(DEFAULT_POLL_INTERVAL_MS);
102
- }
103
- }
104
- }
105
- /*
106
- * Cclaim and process a workflow run for the given worker ID. Do not await the
107
- * processing here to avoid blocking the caller.
108
- * Returns the claimed workflow run, or null if none was available.
109
- */
110
- async claimAndProcessWorkflowRunInBackground(workerId) {
111
- // claim workflow run
112
- const workflowRun = await this.backend.claimWorkflowRun({
113
- workerId,
114
- leaseDurationMs: DEFAULT_LEASE_DURATION_MS,
115
- });
116
- if (!workflowRun)
117
- return null;
118
- // find workflow definition
119
- const workflow = this.registeredWorkflows.get(workflowRun.workflowName);
120
- if (!workflow) {
121
- await this.backend.failWorkflowRun({
122
- workflowRunId: workflowRun.id,
123
- workerId,
124
- error: {
125
- message: `Workflow "${workflowRun.workflowName}" is not registered`,
126
- },
127
- });
128
- return null;
129
- }
130
- // create execution and start processing *async* w/o blocking
131
- const execution = new WorkflowExecution({
132
- backend: this.backend,
133
- workflowRun,
134
- workerId,
135
- });
136
- this.activeExecutions.add(execution);
137
- this.processExecutionInBackground(execution, workflow)
138
- .catch(() => {
139
- // errors are already handled in processExecution
140
- })
141
- .finally(() => {
142
- execution.stopHeartbeat();
143
- this.activeExecutions.delete(execution);
144
- });
145
- return workflowRun;
146
- }
147
- /**
148
- * Process a workflow execution, handling heartbeats, step execution, and
149
- * marking success or failure.
150
- */
151
- async processExecutionInBackground(execution, workflow) {
152
- // start heartbeating
153
- execution.startHeartbeat();
154
- try {
155
- // load all pages of step history
156
- const attempts = [];
157
- let cursor;
158
- do {
159
- const response = await this.backend.listStepAttempts({
160
- workflowRunId: execution.workflowRun.id,
161
- ...(cursor ? { after: cursor } : {}),
162
- limit: 1000,
163
- });
164
- attempts.push(...response.data);
165
- cursor = response.pagination.next ?? undefined;
166
- } while (cursor);
167
- // mark any sleep steps as completed if their sleep duration has elapsed,
168
- // or rethrow SleepSignal if still sleeping
169
- for (let i = 0; i < attempts.length; i++) {
170
- const attempt = attempts[i];
171
- if (!attempt)
172
- continue;
173
- if (attempt.status === "running" &&
174
- attempt.kind === "sleep" &&
175
- attempt.context?.kind === "sleep") {
176
- const now = Date.now();
177
- const resumeAt = new Date(attempt.context.resumeAt);
178
- const resumeAtMs = resumeAt.getTime();
179
- if (now < resumeAtMs) {
180
- // sleep duration HAS NOT elapsed yet, throw signal to put workflow
181
- // back to sleep
182
- throw new SleepSignal(resumeAt);
183
- }
184
- // sleep duration HAS elapsed, mark the step as completed and continue
185
- const completed = await this.backend.completeStepAttempt({
186
- workflowRunId: execution.workflowRun.id,
187
- stepAttemptId: attempt.id,
188
- workerId: execution.workerId,
189
- output: null,
190
- });
191
- // update cache w/ completed attempt
192
- attempts[i] = completed;
193
- }
194
- }
195
- // create step executor
196
- const executor = new StepExecutor({
197
- backend: this.backend,
198
- workflowRunId: execution.workflowRun.id,
199
- workerId: execution.workerId,
200
- attempts,
201
- });
202
- // execute workflow
203
- const output = await workflow.fn({
204
- input: execution.workflowRun.input,
205
- step: executor,
206
- version: execution.workflowRun.version,
207
- });
208
- // mark success
209
- await this.backend.completeWorkflowRun({
210
- workflowRunId: execution.workflowRun.id,
211
- workerId: execution.workerId,
212
- output: (output ?? null),
213
- });
214
- }
215
- catch (error) {
216
- // handle sleep signal by setting workflow to sleeping status
217
- if (error instanceof SleepSignal) {
218
- await this.backend.sleepWorkflowRun({
219
- workflowRunId: execution.workflowRun.id,
220
- workerId: execution.workerId,
221
- availableAt: error.resumeAt,
222
- });
223
- return;
224
- }
225
- // mark failure
226
- await this.backend.failWorkflowRun({
227
- workflowRunId: execution.workflowRun.id,
228
- workerId: execution.workerId,
229
- error: serializeError(error),
230
- });
231
- }
232
- }
233
- }
234
- /**
235
- * Tracks a claimed workflow run and maintains its heartbeat lease for the
236
- * worker.
237
- */
238
- class WorkflowExecution {
239
- backend;
240
- workflowRun;
241
- workerId;
242
- heartbeatTimer = null;
243
- constructor(options) {
244
- this.backend = options.backend;
245
- this.workflowRun = options.workflowRun;
246
- this.workerId = options.workerId;
247
- }
248
- /**
249
- * Start the heartbeat loop for this execution, heartbeating at half the lease
250
- * duration.
251
- */
252
- startHeartbeat() {
253
- const leaseDurationMs = DEFAULT_LEASE_DURATION_MS;
254
- const heartbeatIntervalMs = leaseDurationMs / 2;
255
- this.heartbeatTimer = setInterval(() => {
256
- this.backend
257
- .extendWorkflowRunLease({
258
- workflowRunId: this.workflowRun.id,
259
- workerId: this.workerId,
260
- leaseDurationMs,
261
- })
262
- .catch((error) => {
263
- console.error("Heartbeat failed:", error);
264
- });
265
- }, heartbeatIntervalMs);
266
- }
267
- /**
268
- * Stop the heartbeat loop.
269
- */
270
- stopHeartbeat() {
271
- if (this.heartbeatTimer) {
272
- clearInterval(this.heartbeatTimer);
273
- this.heartbeatTimer = null;
274
- }
275
- }
276
- }
277
- /**
278
- * Replays prior step attempts and persists new ones while memoizing
279
- * deterministic step outputs.
280
- */
281
- class StepExecutor {
282
- backend;
283
- workflowRunId;
284
- workerId;
285
- successfulAttemptsByName = new Map();
286
- constructor(options) {
287
- this.backend = options.backend;
288
- this.workflowRunId = options.workflowRunId;
289
- this.workerId = options.workerId;
290
- // load successful attempts into history
291
- for (const attempt of options.attempts) {
292
- // 'succeeded' status is deprecated
293
- if (attempt.status === "succeeded" || attempt.status === "completed") {
294
- this.successfulAttemptsByName.set(attempt.stepName, attempt);
295
- }
296
- }
297
- }
298
- async run(config, fn) {
299
- const { name } = config;
300
- // return cached result if available
301
- const existingAttempt = this.successfulAttemptsByName.get(name);
302
- if (existingAttempt) {
303
- return existingAttempt.output;
304
- }
305
- // not in cache, create new step attempt
306
- const attempt = await this.backend.createStepAttempt({
307
- workflowRunId: this.workflowRunId,
308
- workerId: this.workerId,
309
- stepName: name,
310
- kind: "function",
311
- config: {},
312
- context: null,
313
- });
314
- try {
315
- // execute step function
316
- const result = await fn();
317
- // convert undefined to null for JSON compatibility
318
- const output = (result ?? null);
319
- // mark success
320
- const savedAttempt = await this.backend.completeStepAttempt({
321
- workflowRunId: this.workflowRunId,
322
- stepAttemptId: attempt.id,
323
- workerId: this.workerId,
324
- output,
325
- });
326
- // cache result
327
- this.successfulAttemptsByName.set(name, savedAttempt);
328
- return savedAttempt.output;
329
- }
330
- catch (error) {
331
- // mark failure
332
- await this.backend.failStepAttempt({
333
- workflowRunId: this.workflowRunId,
334
- stepAttemptId: attempt.id,
335
- workerId: this.workerId,
336
- error: serializeError(error),
337
- });
338
- throw error;
339
- }
340
- }
341
- async sleep(name, duration) {
342
- // return cached result if this sleep already completed
343
- const existingAttempt = this.successfulAttemptsByName.get(name);
344
- if (existingAttempt)
345
- return;
346
- // create new step attempt for the sleep
347
- const durationMs = parseDuration(duration);
348
- const resumeAt = new Date(Date.now() + durationMs);
349
- await this.backend.createStepAttempt({
350
- workflowRunId: this.workflowRunId,
351
- workerId: this.workerId,
352
- stepName: name,
353
- kind: "sleep",
354
- config: {},
355
- context: {
356
- kind: "sleep",
357
- resumeAt: resumeAt.toISOString(),
358
- },
359
- });
360
- // throw sleep signal to trigger postponement
361
- // we do not mark the step as completed here; it will be updated
362
- // when the workflow resumes
363
- throw new SleepSignal(resumeAt);
364
- }
365
- }
366
- /**
367
- * Serialize an error to a JSON-compatible format.
368
- */
369
- function serializeError(error) {
370
- if (error instanceof Error) {
371
- return {
372
- name: error.name,
373
- message: error.message,
374
- stack: error.stack ?? null,
375
- };
376
- }
377
- return {
378
- message: String(error),
379
- };
380
- }
381
- function sleep(ms) {
382
- return new Promise((resolve) => setTimeout(resolve, ms));
383
- }
384
- //# sourceMappingURL=worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../worker.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACnD,MAAM,wBAAwB,GAAG,GAAG,CAAC,CAAC,QAAQ;AAC9C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAY,SAAQ,KAAK;IACpB,QAAQ,CAAO;IAExB,YAAY,QAAc;QACxB,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAYD;;;GAGG;AACH,MAAM,OAAO,MAAM;IACA,OAAO,CAAU;IACjB,SAAS,CAAW;IACpB,mBAAmB,GAAG,IAAI,GAAG,EAG3C,CAAC;IACa,gBAAgB,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC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