@workflow/world-testing 4.1.25 → 4.1.26

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.
@@ -51637,7 +51637,7 @@ init_dist();
51637
51637
  init_node();
51638
51638
 
51639
51639
  // ../core/dist/version.js
51640
- var version2 = "4.8.10";
51640
+ var version2 = "4.8.11";
51641
51641
 
51642
51642
  // ../core/dist/runtime/world.js
51643
51643
  var import_node_module = require("node:module");
@@ -55344,13 +55344,17 @@ function createEventsDispatcher(agentOverrides) {
55344
55344
  ...h2 ? getEventsAgentOptions() : getEventsAgentOptionsNoH2(),
55345
55345
  ...agentOverrides
55346
55346
  }), getEventsRetryAgentOptions());
55347
- if (!h2) {
55347
+ if (!h2 || !supportsCompose(agent)) {
55348
55348
  return agent;
55349
55349
  }
55350
55350
  const streamedBodyAgent = new import_undici2.RetryAgent(new import_undici2.Agent({ ...getEventsAgentOptionsNoH2(), ...agentOverrides }), getEventsRetryAgentOptions());
55351
55351
  return withBoundLifecycle(agent, agent.compose(createH2MultiplexInterceptor(streamedBodyAgent)), streamedBodyAgent);
55352
55352
  }
55353
55353
  __name(createEventsDispatcher, "createEventsDispatcher");
55354
+ function supportsCompose(dispatcher) {
55355
+ return typeof dispatcher.compose === "function";
55356
+ }
55357
+ __name(supportsCompose, "supportsCompose");
55354
55358
  function withBoundLifecycle(agent, composed, companion) {
55355
55359
  return new Proxy(composed, {
55356
55360
  get: /* @__PURE__ */ __name((target2, key) => {
@@ -55373,7 +55377,8 @@ function createStreamDispatcher(retryOptions, agentOverrides) {
55373
55377
  }
55374
55378
  __name(createStreamDispatcher, "createStreamDispatcher");
55375
55379
  function createQueueDispatcher() {
55376
- return new import_undici2.RetryAgent(new import_undici2.Agent(getQueueAgentOptions()).compose(deadlineInterceptor(getQueueRequestTimeoutMs())), getRetryAgentOptions());
55380
+ const agent = new import_undici2.Agent(getQueueAgentOptions());
55381
+ return new import_undici2.RetryAgent(supportsCompose(agent) ? agent.compose(deadlineInterceptor(getQueueRequestTimeoutMs())) : agent, getRetryAgentOptions());
55377
55382
  }
55378
55383
  __name(createQueueDispatcher, "createQueueDispatcher");
55379
55384
  function getDefaultQueueDispatcher() {
@@ -62893,7 +62898,7 @@ var import_oidc3 = __toESM(require_dist(), 1);
62893
62898
  init_dist();
62894
62899
 
62895
62900
  // ../world-vercel/dist/version.js
62896
- var version3 = "4.7.5";
62901
+ var version3 = "4.7.6";
62897
62902
 
62898
62903
  // ../world-vercel/dist/utils.js
62899
62904
  var WORKFLOW_SERVER_URL_OVERRIDE = "";
@@ -63254,10 +63259,21 @@ var MAX_DELAY_SECONDS = Number(
63254
63259
  var HANDLER_ERROR_RETRY_AFTER_SECONDS = 1;
63255
63260
  var HANDLER_ERROR_MAX_RETRY_AFTER_SECONDS = 900;
63256
63261
  var HANDLER_ERROR_RETRY_JITTER_RATIO = 0.25;
63257
- function getHandlerErrorRetryAfterSeconds(deliveryCount) {
63262
+ function getErrorRetryAfterSeconds(error48) {
63263
+ if (typeof error48 !== "object" || error48 === null)
63264
+ return void 0;
63265
+ const retryAfter = error48.retryAfter;
63266
+ if (typeof retryAfter !== "number" || !Number.isFinite(retryAfter) || retryAfter <= 0) {
63267
+ return void 0;
63268
+ }
63269
+ return Math.min(Math.ceil(retryAfter), HANDLER_ERROR_MAX_RETRY_AFTER_SECONDS);
63270
+ }
63271
+ __name(getErrorRetryAfterSeconds, "getErrorRetryAfterSeconds");
63272
+ function getHandlerErrorRetryAfterSeconds(error48, deliveryCount) {
63258
63273
  const backoffSeconds = Math.min(Math.max(HANDLER_ERROR_RETRY_AFTER_SECONDS, 2 ** (deliveryCount - 1)), HANDLER_ERROR_MAX_RETRY_AFTER_SECONDS);
63259
63274
  const jitterSeconds = Math.floor(Math.random() * (Math.ceil(backoffSeconds * HANDLER_ERROR_RETRY_JITTER_RATIO) + 1));
63260
- return Math.max(HANDLER_ERROR_RETRY_AFTER_SECONDS, backoffSeconds - jitterSeconds);
63275
+ const jitteredBackoffSeconds = Math.max(HANDLER_ERROR_RETRY_AFTER_SECONDS, backoffSeconds - jitterSeconds);
63276
+ return Math.max(jitteredBackoffSeconds, getErrorRetryAfterSeconds(error48) ?? HANDLER_ERROR_RETRY_AFTER_SECONDS);
63261
63277
  }
63262
63278
  __name(getHandlerErrorRetryAfterSeconds, "getHandlerErrorRetryAfterSeconds");
63263
63279
  function getHeadersFromPayload(payload) {
@@ -63361,7 +63377,7 @@ function createQueue2(config3) {
63361
63377
  // redrive in lockstep. Workflow handlers are event-sourced and must
63362
63378
  // remain idempotent because queue retries can happen close together.
63363
63379
  retry: /* @__PURE__ */ __name((error48, { messageId, deliveryCount }) => {
63364
- const afterSeconds = getHandlerErrorRetryAfterSeconds(deliveryCount);
63380
+ const afterSeconds = getHandlerErrorRetryAfterSeconds(error48, deliveryCount);
63365
63381
  console.error(`[workflow] Queue handler failed for message "${messageId}" on delivery attempt ${deliveryCount}; retrying in ${afterSeconds}s:`, error48);
63366
63382
  return { afterSeconds };
63367
63383
  }, "retry")
@@ -1,17 +1,30 @@
1
1
  {
2
2
  "version": "1.0.0",
3
3
  "steps": {
4
+ "workflows/event-limit.ts": {
5
+ "tick": {
6
+ "stepId": "step//./workflows/event-limit//tick"
7
+ }
8
+ },
4
9
  "workflows/addition.ts": {
5
10
  "add": {
6
11
  "stepId": "step//./workflows/addition//add"
7
12
  }
8
13
  },
9
- "workflows/retriable-and-fatal.ts": {
10
- "stepThatFails": {
11
- "stepId": "step//./workflows/retriable-and-fatal//stepThatFails"
14
+ "workflows/null-byte.ts": {
15
+ "nullByteStep": {
16
+ "stepId": "step//./workflows/null-byte//nullByteStep"
17
+ }
18
+ },
19
+ "workflow/dist/internal/builtins.js": {
20
+ "__builtin_response_array_buffer": {
21
+ "stepId": "__builtin_response_array_buffer"
12
22
  },
13
- "stepThatThrowsRetryableError": {
14
- "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
23
+ "__builtin_response_json": {
24
+ "stepId": "__builtin_response_json"
25
+ },
26
+ "__builtin_response_text": {
27
+ "stepId": "__builtin_response_text"
15
28
  }
16
29
  },
17
30
  "workflows/noop.ts": {
@@ -19,14 +32,12 @@
19
32
  "stepId": "step//./workflows/noop//noop"
20
33
  }
21
34
  },
22
- "workflows/null-byte.ts": {
23
- "nullByteStep": {
24
- "stepId": "step//./workflows/null-byte//nullByteStep"
25
- }
26
- },
27
- "workflow/dist/stdlib.js": {
28
- "fetch": {
29
- "stepId": "step//workflow@4.8.10//fetch"
35
+ "workflows/retriable-and-fatal.ts": {
36
+ "stepThatFails": {
37
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatFails"
38
+ },
39
+ "stepThatThrowsRetryableError": {
40
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
30
41
  }
31
42
  },
32
43
  "workflows/hooks.ts": {
@@ -34,24 +45,70 @@
34
45
  "stepId": "step//./workflows/hooks//writeEvent"
35
46
  }
36
47
  },
37
- "workflows/event-limit.ts": {
38
- "tick": {
39
- "stepId": "step//./workflows/event-limit//tick"
40
- }
41
- },
42
- "workflow/dist/internal/builtins.js": {
43
- "__builtin_response_array_buffer": {
44
- "stepId": "__builtin_response_array_buffer"
45
- },
46
- "__builtin_response_json": {
47
- "stepId": "__builtin_response_json"
48
- },
49
- "__builtin_response_text": {
50
- "stepId": "__builtin_response_text"
48
+ "workflow/dist/stdlib.js": {
49
+ "fetch": {
50
+ "stepId": "step//workflow@4.8.11//fetch"
51
51
  }
52
52
  }
53
53
  },
54
54
  "workflows": {
55
+ "workflows/event-limit.ts": {
56
+ "runawayWorkflow": {
57
+ "workflowId": "workflow//./workflows/event-limit//runawayWorkflow",
58
+ "graph": {
59
+ "nodes": [
60
+ {
61
+ "id": "start",
62
+ "type": "workflowStart",
63
+ "data": {
64
+ "label": "Start: runawayWorkflow",
65
+ "nodeKind": "workflow_start"
66
+ }
67
+ },
68
+ {
69
+ "id": "node_0",
70
+ "type": "step",
71
+ "data": {
72
+ "label": "tick",
73
+ "nodeKind": "step",
74
+ "stepId": "step//./workflows/event-limit//tick"
75
+ },
76
+ "metadata": {
77
+ "loopId": "loop_0"
78
+ }
79
+ },
80
+ {
81
+ "id": "end",
82
+ "type": "workflowEnd",
83
+ "data": {
84
+ "label": "Return",
85
+ "nodeKind": "workflow_end"
86
+ }
87
+ }
88
+ ],
89
+ "edges": [
90
+ {
91
+ "id": "e_node_0_back_node_0",
92
+ "source": "node_0",
93
+ "target": "node_0",
94
+ "type": "loop"
95
+ },
96
+ {
97
+ "id": "e_start_node_0",
98
+ "source": "start",
99
+ "target": "node_0",
100
+ "type": "default"
101
+ },
102
+ {
103
+ "id": "e_node_0_end",
104
+ "source": "node_0",
105
+ "target": "end",
106
+ "type": "default"
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ },
55
112
  "workflows/addition.ts": {
56
113
  "addition": {
57
114
  "workflowId": "workflow//./workflows/addition//addition",
@@ -100,16 +157,16 @@
100
157
  }
101
158
  }
102
159
  },
103
- "workflows/retriable-and-fatal.ts": {
104
- "retryableAndFatalErrorWorkflow": {
105
- "workflowId": "workflow//./workflows/retriable-and-fatal//retryableAndFatalErrorWorkflow",
160
+ "workflows/null-byte.ts": {
161
+ "nullByteWorkflow": {
162
+ "workflowId": "workflow//./workflows/null-byte//nullByteWorkflow",
106
163
  "graph": {
107
164
  "nodes": [
108
165
  {
109
166
  "id": "start",
110
167
  "type": "workflowStart",
111
168
  "data": {
112
- "label": "Start: retryableAndFatalErrorWorkflow",
169
+ "label": "Start: nullByteWorkflow",
113
170
  "nodeKind": "workflow_start"
114
171
  }
115
172
  },
@@ -117,9 +174,9 @@
117
174
  "id": "node_0",
118
175
  "type": "step",
119
176
  "data": {
120
- "label": "stepThatThrowsRetryableError",
177
+ "label": "nullByteStep",
121
178
  "nodeKind": "step",
122
- "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
179
+ "stepId": "step//./workflows/null-byte//nullByteStep"
123
180
  }
124
181
  },
125
182
  {
@@ -211,16 +268,16 @@
211
268
  }
212
269
  }
213
270
  },
214
- "workflows/null-byte.ts": {
215
- "nullByteWorkflow": {
216
- "workflowId": "workflow//./workflows/null-byte//nullByteWorkflow",
271
+ "workflows/retriable-and-fatal.ts": {
272
+ "retryableAndFatalErrorWorkflow": {
273
+ "workflowId": "workflow//./workflows/retriable-and-fatal//retryableAndFatalErrorWorkflow",
217
274
  "graph": {
218
275
  "nodes": [
219
276
  {
220
277
  "id": "start",
221
278
  "type": "workflowStart",
222
279
  "data": {
223
- "label": "Start: nullByteWorkflow",
280
+ "label": "Start: retryableAndFatalErrorWorkflow",
224
281
  "nodeKind": "workflow_start"
225
282
  }
226
283
  },
@@ -228,9 +285,9 @@
228
285
  "id": "node_0",
229
286
  "type": "step",
230
287
  "data": {
231
- "label": "nullByteStep",
288
+ "label": "stepThatThrowsRetryableError",
232
289
  "nodeKind": "step",
233
- "stepId": "step//./workflows/null-byte//nullByteStep"
290
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
234
291
  }
235
292
  },
236
293
  {
@@ -331,63 +388,6 @@
331
388
  ]
332
389
  }
333
390
  }
334
- },
335
- "workflows/event-limit.ts": {
336
- "runawayWorkflow": {
337
- "workflowId": "workflow//./workflows/event-limit//runawayWorkflow",
338
- "graph": {
339
- "nodes": [
340
- {
341
- "id": "start",
342
- "type": "workflowStart",
343
- "data": {
344
- "label": "Start: runawayWorkflow",
345
- "nodeKind": "workflow_start"
346
- }
347
- },
348
- {
349
- "id": "node_0",
350
- "type": "step",
351
- "data": {
352
- "label": "tick",
353
- "nodeKind": "step",
354
- "stepId": "step//./workflows/event-limit//tick"
355
- },
356
- "metadata": {
357
- "loopId": "loop_0"
358
- }
359
- },
360
- {
361
- "id": "end",
362
- "type": "workflowEnd",
363
- "data": {
364
- "label": "Return",
365
- "nodeKind": "workflow_end"
366
- }
367
- }
368
- ],
369
- "edges": [
370
- {
371
- "id": "e_node_0_back_node_0",
372
- "source": "node_0",
373
- "target": "node_0",
374
- "type": "loop"
375
- },
376
- {
377
- "id": "e_start_node_0",
378
- "source": "start",
379
- "target": "node_0",
380
- "type": "default"
381
- },
382
- {
383
- "id": "e_node_0_end",
384
- "source": "node_0",
385
- "target": "end",
386
- "type": "default"
387
- }
388
- ]
389
- }
390
- }
391
391
  }
392
392
  },
393
393
  "classes": {}