@workflow/world-testing 5.0.0-beta.23 → 5.0.0-beta.25
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.
|
@@ -19065,10 +19065,11 @@ function matchesDebugNamespace2(namespace, patternList) {
|
|
|
19065
19065
|
}
|
|
19066
19066
|
return enabled;
|
|
19067
19067
|
}
|
|
19068
|
-
function createLogger2(namespace) {
|
|
19068
|
+
function createLogger2(namespace, options = {}) {
|
|
19069
19069
|
const build = /* @__PURE__ */ __name((parentMetadata) => {
|
|
19070
|
+
const getDebugNamespace = /* @__PURE__ */ __name((level) => options.debugNamespace ?? `workflow:${namespace}:${level}`, "getDebugNamespace");
|
|
19070
19071
|
const logger = /* @__PURE__ */ __name((level) => {
|
|
19071
|
-
const debugNamespace =
|
|
19072
|
+
const debugNamespace = getDebugNamespace(level);
|
|
19072
19073
|
return (message, metadata) => {
|
|
19073
19074
|
const hasParent = Object.keys(parentMetadata).length > 0;
|
|
19074
19075
|
const hasCallSite = metadata && Object.keys(metadata).length > 0;
|
|
@@ -19103,7 +19104,7 @@ function createLogger2(namespace) {
|
|
|
19103
19104
|
}, "build");
|
|
19104
19105
|
return build({});
|
|
19105
19106
|
}
|
|
19106
|
-
var stepLogger2, runtimeLogger2, webhookLogger2, eventsLogger2, adapterLogger2;
|
|
19107
|
+
var stepLogger2, runtimeLogger2, webhookLogger2, eventsLogger2, adapterLogger2, buildLogger2;
|
|
19107
19108
|
var init_logger2 = __esm({
|
|
19108
19109
|
"../core/dist/logger.js"() {
|
|
19109
19110
|
"use strict";
|
|
@@ -19116,6 +19117,9 @@ var init_logger2 = __esm({
|
|
|
19116
19117
|
webhookLogger2 = createLogger2("webhook");
|
|
19117
19118
|
eventsLogger2 = createLogger2("events");
|
|
19118
19119
|
adapterLogger2 = createLogger2("adapter");
|
|
19120
|
+
buildLogger2 = createLogger2("build", {
|
|
19121
|
+
debugNamespace: "workflow:build"
|
|
19122
|
+
});
|
|
19119
19123
|
}
|
|
19120
19124
|
});
|
|
19121
19125
|
|
|
@@ -19200,7 +19204,7 @@ var version4;
|
|
|
19200
19204
|
var init_version3 = __esm({
|
|
19201
19205
|
"../core/dist/version.js"() {
|
|
19202
19206
|
"use strict";
|
|
19203
|
-
version4 = "5.0.0-beta.
|
|
19207
|
+
version4 = "5.0.0-beta.25";
|
|
19204
19208
|
}
|
|
19205
19209
|
});
|
|
19206
19210
|
|
|
@@ -25533,7 +25537,7 @@ function attachAbortListenerOnce2(signal, streamName, runId, cryptoKey, ops) {
|
|
|
25533
25537
|
})());
|
|
25534
25538
|
}, { once: true });
|
|
25535
25539
|
}
|
|
25536
|
-
function getExternalReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
25540
|
+
function getExternalReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
25537
25541
|
return {
|
|
25538
25542
|
...getAllBaseReducers2(global2),
|
|
25539
25543
|
ReadableStream: /* @__PURE__ */ __name((value) => {
|
|
@@ -25547,7 +25551,7 @@ function getExternalReducers2(global2 = globalThis, ops, runId, cryptoKey, frame
|
|
|
25547
25551
|
const streamId = (global2[STABLE_ULID2] || defaultUlid2)();
|
|
25548
25552
|
const name = `strm_${streamId}`;
|
|
25549
25553
|
const type = getStreamType2(value);
|
|
25550
|
-
const writable = new WorkflowServerWritableStream2(runId, name);
|
|
25554
|
+
const writable = new WorkflowServerWritableStream2(runId, name, runReadyBarrier);
|
|
25551
25555
|
if (type === "bytes") {
|
|
25552
25556
|
if (framedByteStreams) {
|
|
25553
25557
|
ops.push(value.pipeThrough(getByteFramingStream2()).pipeTo(writable));
|
|
@@ -25555,7 +25559,7 @@ function getExternalReducers2(global2 = globalThis, ops, runId, cryptoKey, frame
|
|
|
25555
25559
|
ops.push(value.pipeTo(writable));
|
|
25556
25560
|
}
|
|
25557
25561
|
} else {
|
|
25558
|
-
ops.push(value.pipeThrough(getSerializeStream2(getExternalReducers2(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
25562
|
+
ops.push(value.pipeThrough(getSerializeStream2(getExternalReducers2(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
25559
25563
|
}
|
|
25560
25564
|
const s = { name };
|
|
25561
25565
|
if (type)
|
|
@@ -25664,7 +25668,7 @@ function getWorkflowReducers2(global2 = globalThis) {
|
|
|
25664
25668
|
}, "AbortSignal")
|
|
25665
25669
|
};
|
|
25666
25670
|
}
|
|
25667
|
-
function getStepReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
25671
|
+
function getStepReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
25668
25672
|
return {
|
|
25669
25673
|
...getAllBaseReducers2(global2),
|
|
25670
25674
|
ReadableStream: /* @__PURE__ */ __name((value) => {
|
|
@@ -25683,7 +25687,7 @@ function getStepReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByt
|
|
|
25683
25687
|
name = `strm_${streamId}`;
|
|
25684
25688
|
type = getStreamType2(value);
|
|
25685
25689
|
framing = type === "bytes" && framedByteStreams ? "framed-v1" : framing;
|
|
25686
|
-
const writable = new WorkflowServerWritableStream2(runId, name);
|
|
25690
|
+
const writable = new WorkflowServerWritableStream2(runId, name, runReadyBarrier);
|
|
25687
25691
|
if (type === "bytes") {
|
|
25688
25692
|
if (framing === "framed-v1") {
|
|
25689
25693
|
ops.push(value.pipeThrough(getByteFramingStream2()).pipeTo(writable));
|
|
@@ -25691,7 +25695,7 @@ function getStepReducers2(global2 = globalThis, ops, runId, cryptoKey, framedByt
|
|
|
25691
25695
|
ops.push(value.pipeTo(writable));
|
|
25692
25696
|
}
|
|
25693
25697
|
} else {
|
|
25694
|
-
ops.push(value.pipeThrough(getSerializeStream2(getStepReducers2(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
25698
|
+
ops.push(value.pipeThrough(getSerializeStream2(getStepReducers2(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
25695
25699
|
}
|
|
25696
25700
|
}
|
|
25697
25701
|
const s = { name };
|
|
@@ -26300,16 +26304,16 @@ async function hydrateStepArguments2(value, runId, key, ops = [], global2 = glob
|
|
|
26300
26304
|
await recordCompression2(compressionStats, "deserialize");
|
|
26301
26305
|
return result;
|
|
26302
26306
|
}
|
|
26303
|
-
async function dehydrateStepReturnValue2(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
26307
|
+
async function dehydrateStepReturnValue2(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier) {
|
|
26304
26308
|
if (v1Compat) {
|
|
26305
|
-
const str = stringify2(value, getStepReducers2(global2, ops, runId, key, framedByteStreams));
|
|
26309
|
+
const str = stringify2(value, getStepReducers2(global2, ops, runId, key, framedByteStreams, runReadyBarrier));
|
|
26306
26310
|
return revive2(str);
|
|
26307
26311
|
}
|
|
26308
26312
|
try {
|
|
26309
26313
|
const compressionStats = {};
|
|
26310
26314
|
const result = await serialize3(value, key, {
|
|
26311
26315
|
global: global2,
|
|
26312
|
-
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams)),
|
|
26316
|
+
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams, runReadyBarrier)),
|
|
26313
26317
|
compression,
|
|
26314
26318
|
compressionStats
|
|
26315
26319
|
});
|
|
@@ -26510,7 +26514,16 @@ var init_serialization4 = __esm({
|
|
|
26510
26514
|
static {
|
|
26511
26515
|
__name(this, "WorkflowServerWritableStream");
|
|
26512
26516
|
}
|
|
26513
|
-
|
|
26517
|
+
/**
|
|
26518
|
+
* @param runReadyBarrier Turbo mode only: a promise that resolves once the
|
|
26519
|
+
* backgrounded `run_started` has landed. When the step body runs
|
|
26520
|
+
* optimistically (before `run_started` is durable), the first chunk write to
|
|
26521
|
+
* a brand-new stream would otherwise reach the World before the run exists
|
|
26522
|
+
* and be rejected as run-not-found. Awaiting this once before the first
|
|
26523
|
+
* flush/close orders the write after the run's creation. `undefined` outside
|
|
26524
|
+
* turbo and on the await path, where the run was already durable.
|
|
26525
|
+
*/
|
|
26526
|
+
constructor(runId, name, runReadyBarrier) {
|
|
26514
26527
|
if (typeof runId !== "string") {
|
|
26515
26528
|
throw new WorkflowRuntimeError2(`"runId" must be a string, got "${typeof runId}"`);
|
|
26516
26529
|
}
|
|
@@ -26518,6 +26531,16 @@ var init_serialization4 = __esm({
|
|
|
26518
26531
|
throw new WorkflowRuntimeError2(`"name" is required, got "${name}"`);
|
|
26519
26532
|
}
|
|
26520
26533
|
const worldPromise = getWorldLazy2();
|
|
26534
|
+
let pendingRunReady = runReadyBarrier;
|
|
26535
|
+
const ensureRunReady = /* @__PURE__ */ __name(async () => {
|
|
26536
|
+
if (pendingRunReady) {
|
|
26537
|
+
try {
|
|
26538
|
+
await pendingRunReady;
|
|
26539
|
+
} catch {
|
|
26540
|
+
}
|
|
26541
|
+
pendingRunReady = void 0;
|
|
26542
|
+
}
|
|
26543
|
+
}, "ensureRunReady");
|
|
26521
26544
|
let buffer3 = [];
|
|
26522
26545
|
let flushTimer = null;
|
|
26523
26546
|
let flushPromise = null;
|
|
@@ -26529,6 +26552,7 @@ var init_serialization4 = __esm({
|
|
|
26529
26552
|
}
|
|
26530
26553
|
if (buffer3.length === 0)
|
|
26531
26554
|
return;
|
|
26555
|
+
await ensureRunReady();
|
|
26532
26556
|
const chunksToFlush = buffer3.slice();
|
|
26533
26557
|
const world = await worldPromise;
|
|
26534
26558
|
if (resolvedFlushIntervalMs === void 0) {
|
|
@@ -26578,6 +26602,7 @@ var init_serialization4 = __esm({
|
|
|
26578
26602
|
flushPromise = null;
|
|
26579
26603
|
}
|
|
26580
26604
|
await flush();
|
|
26605
|
+
await ensureRunReady();
|
|
26581
26606
|
const world = await worldPromise;
|
|
26582
26607
|
await world.streams.close(runId, name);
|
|
26583
26608
|
},
|
|
@@ -77300,10 +77325,11 @@ function matchesDebugNamespace(namespace, patternList) {
|
|
|
77300
77325
|
return enabled;
|
|
77301
77326
|
}
|
|
77302
77327
|
__name(matchesDebugNamespace, "matchesDebugNamespace");
|
|
77303
|
-
function createLogger(namespace) {
|
|
77328
|
+
function createLogger(namespace, options = {}) {
|
|
77304
77329
|
const build = /* @__PURE__ */ __name2((parentMetadata) => {
|
|
77330
|
+
const getDebugNamespace = /* @__PURE__ */ __name2((level) => options.debugNamespace ?? `workflow:${namespace}:${level}`, "getDebugNamespace");
|
|
77305
77331
|
const logger = /* @__PURE__ */ __name2((level) => {
|
|
77306
|
-
const debugNamespace =
|
|
77332
|
+
const debugNamespace = getDebugNamespace(level);
|
|
77307
77333
|
return (message, metadata) => {
|
|
77308
77334
|
const hasParent = Object.keys(parentMetadata).length > 0;
|
|
77309
77335
|
const hasCallSite = metadata && Object.keys(metadata).length > 0;
|
|
@@ -77355,6 +77381,7 @@ var runtimeLogger;
|
|
|
77355
77381
|
var webhookLogger;
|
|
77356
77382
|
var eventsLogger;
|
|
77357
77383
|
var adapterLogger;
|
|
77384
|
+
var buildLogger;
|
|
77358
77385
|
var init_logger = __esm2({
|
|
77359
77386
|
"../core/dist/logger.js"() {
|
|
77360
77387
|
"use strict";
|
|
@@ -77367,6 +77394,9 @@ var init_logger = __esm2({
|
|
|
77367
77394
|
webhookLogger = createLogger("webhook");
|
|
77368
77395
|
eventsLogger = createLogger("events");
|
|
77369
77396
|
adapterLogger = createLogger("adapter");
|
|
77397
|
+
buildLogger = createLogger("build", {
|
|
77398
|
+
debugNamespace: "workflow:build"
|
|
77399
|
+
});
|
|
77370
77400
|
}
|
|
77371
77401
|
});
|
|
77372
77402
|
function rethrowIfRuntimeError(error482) {
|
|
@@ -79577,7 +79607,7 @@ var version2;
|
|
|
79577
79607
|
var init_version = __esm2({
|
|
79578
79608
|
"../core/dist/version.js"() {
|
|
79579
79609
|
"use strict";
|
|
79580
|
-
version2 = "5.0.0-beta.
|
|
79610
|
+
version2 = "5.0.0-beta.25";
|
|
79581
79611
|
}
|
|
79582
79612
|
});
|
|
79583
79613
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
@@ -81515,7 +81545,7 @@ function attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops) {
|
|
|
81515
81545
|
});
|
|
81516
81546
|
}
|
|
81517
81547
|
__name(attachAbortListenerOnce, "attachAbortListenerOnce");
|
|
81518
|
-
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
81548
|
+
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
81519
81549
|
return {
|
|
81520
81550
|
...getAllBaseReducers(global2),
|
|
81521
81551
|
ReadableStream: /* @__PURE__ */ __name2((value) => {
|
|
@@ -81528,7 +81558,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
81528
81558
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
81529
81559
|
const name = `strm_${streamId}`;
|
|
81530
81560
|
const type = getStreamType(value);
|
|
81531
|
-
const writable = new WorkflowServerWritableStream(runId, name);
|
|
81561
|
+
const writable = new WorkflowServerWritableStream(runId, name, runReadyBarrier);
|
|
81532
81562
|
if (type === "bytes") {
|
|
81533
81563
|
if (framedByteStreams) {
|
|
81534
81564
|
ops.push(value.pipeThrough(getByteFramingStream()).pipeTo(writable));
|
|
@@ -81536,7 +81566,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
81536
81566
|
ops.push(value.pipeTo(writable));
|
|
81537
81567
|
}
|
|
81538
81568
|
} else {
|
|
81539
|
-
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
81569
|
+
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
81540
81570
|
}
|
|
81541
81571
|
const s = {
|
|
81542
81572
|
name
|
|
@@ -81644,7 +81674,7 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
81644
81674
|
};
|
|
81645
81675
|
}
|
|
81646
81676
|
__name(getWorkflowReducers, "getWorkflowReducers");
|
|
81647
|
-
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false) {
|
|
81677
|
+
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
81648
81678
|
return {
|
|
81649
81679
|
...getAllBaseReducers(global2),
|
|
81650
81680
|
ReadableStream: /* @__PURE__ */ __name2((value) => {
|
|
@@ -81662,7 +81692,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
81662
81692
|
name = `strm_${streamId}`;
|
|
81663
81693
|
type = getStreamType(value);
|
|
81664
81694
|
framing = type === "bytes" && framedByteStreams ? "framed-v1" : framing;
|
|
81665
|
-
const writable = new WorkflowServerWritableStream(runId, name);
|
|
81695
|
+
const writable = new WorkflowServerWritableStream(runId, name, runReadyBarrier);
|
|
81666
81696
|
if (type === "bytes") {
|
|
81667
81697
|
if (framing === "framed-v1") {
|
|
81668
81698
|
ops.push(value.pipeThrough(getByteFramingStream()).pipeTo(writable));
|
|
@@ -81670,7 +81700,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
81670
81700
|
ops.push(value.pipeTo(writable));
|
|
81671
81701
|
}
|
|
81672
81702
|
} else {
|
|
81673
|
-
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams), cryptoKey)).pipeTo(writable));
|
|
81703
|
+
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
81674
81704
|
}
|
|
81675
81705
|
}
|
|
81676
81706
|
const s = {
|
|
@@ -82191,16 +82221,16 @@ async function hydrateStepArguments(value, runId, key, ops = [], global2 = globa
|
|
|
82191
82221
|
return result;
|
|
82192
82222
|
}
|
|
82193
82223
|
__name(hydrateStepArguments, "hydrateStepArguments");
|
|
82194
|
-
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
82224
|
+
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier) {
|
|
82195
82225
|
if (v1Compat) {
|
|
82196
|
-
const str = stringify(value, getStepReducers(global2, ops, runId, key, framedByteStreams));
|
|
82226
|
+
const str = stringify(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier));
|
|
82197
82227
|
return revive(str);
|
|
82198
82228
|
}
|
|
82199
82229
|
try {
|
|
82200
82230
|
const compressionStats = {};
|
|
82201
82231
|
const result = await serialize2(value, key, {
|
|
82202
82232
|
global: global2,
|
|
82203
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams)),
|
|
82233
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier)),
|
|
82204
82234
|
compression,
|
|
82205
82235
|
compressionStats
|
|
82206
82236
|
});
|
|
@@ -82358,7 +82388,16 @@ var init_serialization2 = __esm2({
|
|
|
82358
82388
|
static {
|
|
82359
82389
|
__name2(this, "WorkflowServerWritableStream");
|
|
82360
82390
|
}
|
|
82361
|
-
|
|
82391
|
+
/**
|
|
82392
|
+
* @param runReadyBarrier Turbo mode only: a promise that resolves once the
|
|
82393
|
+
* backgrounded `run_started` has landed. When the step body runs
|
|
82394
|
+
* optimistically (before `run_started` is durable), the first chunk write to
|
|
82395
|
+
* a brand-new stream would otherwise reach the World before the run exists
|
|
82396
|
+
* and be rejected as run-not-found. Awaiting this once before the first
|
|
82397
|
+
* flush/close orders the write after the run's creation. `undefined` outside
|
|
82398
|
+
* turbo and on the await path, where the run was already durable.
|
|
82399
|
+
*/
|
|
82400
|
+
constructor(runId, name, runReadyBarrier) {
|
|
82362
82401
|
if (typeof runId !== "string") {
|
|
82363
82402
|
throw new WorkflowRuntimeError(`"runId" must be a string, got "${typeof runId}"`);
|
|
82364
82403
|
}
|
|
@@ -82366,6 +82405,16 @@ var init_serialization2 = __esm2({
|
|
|
82366
82405
|
throw new WorkflowRuntimeError(`"name" is required, got "${name}"`);
|
|
82367
82406
|
}
|
|
82368
82407
|
const worldPromise = getWorldLazy();
|
|
82408
|
+
let pendingRunReady = runReadyBarrier;
|
|
82409
|
+
const ensureRunReady = /* @__PURE__ */ __name2(async () => {
|
|
82410
|
+
if (pendingRunReady) {
|
|
82411
|
+
try {
|
|
82412
|
+
await pendingRunReady;
|
|
82413
|
+
} catch {
|
|
82414
|
+
}
|
|
82415
|
+
pendingRunReady = void 0;
|
|
82416
|
+
}
|
|
82417
|
+
}, "ensureRunReady");
|
|
82369
82418
|
let buffer22 = [];
|
|
82370
82419
|
let flushTimer = null;
|
|
82371
82420
|
let flushPromise = null;
|
|
@@ -82376,6 +82425,7 @@ var init_serialization2 = __esm2({
|
|
|
82376
82425
|
flushTimer = null;
|
|
82377
82426
|
}
|
|
82378
82427
|
if (buffer22.length === 0) return;
|
|
82428
|
+
await ensureRunReady();
|
|
82379
82429
|
const chunksToFlush = buffer22.slice();
|
|
82380
82430
|
const world = await worldPromise;
|
|
82381
82431
|
if (resolvedFlushIntervalMs === void 0) {
|
|
@@ -82425,6 +82475,7 @@ var init_serialization2 = __esm2({
|
|
|
82425
82475
|
flushPromise = null;
|
|
82426
82476
|
}
|
|
82427
82477
|
await flush();
|
|
82478
|
+
await ensureRunReady();
|
|
82428
82479
|
const world = await worldPromise;
|
|
82429
82480
|
await world.streams.close(runId, name);
|
|
82430
82481
|
},
|
|
@@ -82814,7 +82865,7 @@ __name2(start, "start");
|
|
|
82814
82865
|
value: "start",
|
|
82815
82866
|
configurable: true
|
|
82816
82867
|
});
|
|
82817
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
82868
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.25//start");
|
|
82818
82869
|
function isRetryableStartError(err) {
|
|
82819
82870
|
if (ThrottleError.is(err)) return true;
|
|
82820
82871
|
if (WorkflowWorldError.is(err) && err.status && err.status >= 500) return true;
|
|
@@ -83148,7 +83199,7 @@ var Run = class _Run {
|
|
|
83148
83199
|
value: "wakeUp",
|
|
83149
83200
|
configurable: true
|
|
83150
83201
|
});
|
|
83151
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83202
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#wakeUp");
|
|
83152
83203
|
(function(__wf_fn, __wf_id) {
|
|
83153
83204
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83154
83205
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83157,7 +83208,7 @@ var Run = class _Run {
|
|
|
83157
83208
|
value: "cancel",
|
|
83158
83209
|
configurable: true
|
|
83159
83210
|
});
|
|
83160
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83211
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#cancel");
|
|
83161
83212
|
(function(__wf_fn, __wf_id) {
|
|
83162
83213
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83163
83214
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83166,7 +83217,7 @@ var Run = class _Run {
|
|
|
83166
83217
|
value: "getReadable",
|
|
83167
83218
|
configurable: true
|
|
83168
83219
|
});
|
|
83169
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83220
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#getReadable");
|
|
83170
83221
|
(function(__wf_fn, __wf_id) {
|
|
83171
83222
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83172
83223
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83175,7 +83226,7 @@ var Run = class _Run {
|
|
|
83175
83226
|
value: "exists",
|
|
83176
83227
|
configurable: true
|
|
83177
83228
|
});
|
|
83178
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83229
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#exists");
|
|
83179
83230
|
(function(__wf_fn, __wf_id) {
|
|
83180
83231
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83181
83232
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83184,7 +83235,7 @@ var Run = class _Run {
|
|
|
83184
83235
|
value: "status",
|
|
83185
83236
|
configurable: true
|
|
83186
83237
|
});
|
|
83187
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83238
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#status");
|
|
83188
83239
|
(function(__wf_fn, __wf_id) {
|
|
83189
83240
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83190
83241
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83193,7 +83244,7 @@ var Run = class _Run {
|
|
|
83193
83244
|
value: "returnValue",
|
|
83194
83245
|
configurable: true
|
|
83195
83246
|
});
|
|
83196
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83247
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#returnValue");
|
|
83197
83248
|
(function(__wf_fn, __wf_id) {
|
|
83198
83249
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83199
83250
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83202,7 +83253,7 @@ var Run = class _Run {
|
|
|
83202
83253
|
value: "workflowName",
|
|
83203
83254
|
configurable: true
|
|
83204
83255
|
});
|
|
83205
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83256
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#workflowName");
|
|
83206
83257
|
(function(__wf_fn, __wf_id) {
|
|
83207
83258
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83208
83259
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83211,7 +83262,7 @@ var Run = class _Run {
|
|
|
83211
83262
|
value: "createdAt",
|
|
83212
83263
|
configurable: true
|
|
83213
83264
|
});
|
|
83214
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83265
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#createdAt");
|
|
83215
83266
|
(function(__wf_fn, __wf_id) {
|
|
83216
83267
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83217
83268
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83220,7 +83271,7 @@ var Run = class _Run {
|
|
|
83220
83271
|
value: "startedAt",
|
|
83221
83272
|
configurable: true
|
|
83222
83273
|
});
|
|
83223
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83274
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#startedAt");
|
|
83224
83275
|
(function(__wf_fn, __wf_id) {
|
|
83225
83276
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83226
83277
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83229,7 +83280,7 @@ var Run = class _Run {
|
|
|
83229
83280
|
value: "completedAt",
|
|
83230
83281
|
configurable: true
|
|
83231
83282
|
});
|
|
83232
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83283
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.25//Run#completedAt");
|
|
83233
83284
|
(function(__wf_cls, __wf_id) {
|
|
83234
83285
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83235
83286
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -83239,7 +83290,7 @@ var Run = class _Run {
|
|
|
83239
83290
|
enumerable: false,
|
|
83240
83291
|
configurable: false
|
|
83241
83292
|
});
|
|
83242
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
83293
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.25//Run");
|
|
83243
83294
|
async function fetch2(...args) {
|
|
83244
83295
|
return globalThis.fetch(...args);
|
|
83245
83296
|
}
|
|
@@ -84449,6 +84500,10 @@ function hasTag(fileId, tag) {
|
|
|
84449
84500
|
return fileId.endsWith(`.${tag}`);
|
|
84450
84501
|
}
|
|
84451
84502
|
__name(hasTag, "hasTag");
|
|
84503
|
+
function isUntagged(fileId) {
|
|
84504
|
+
return !TAG_PATTERN.test(fileId);
|
|
84505
|
+
}
|
|
84506
|
+
__name(isUntagged, "isUntagged");
|
|
84452
84507
|
function taggedPath(basedir, entityDir, fileId, tag) {
|
|
84453
84508
|
assertSafeEntityId("fileId", fileId);
|
|
84454
84509
|
if (tag !== void 0)
|
|
@@ -85190,34 +85245,54 @@ function createQueue(config4) {
|
|
|
85190
85245
|
await semaphore.acquire();
|
|
85191
85246
|
}
|
|
85192
85247
|
const MAX_LOCAL_SAFETY_LIMIT = 256;
|
|
85248
|
+
let delivery = 0;
|
|
85193
85249
|
try {
|
|
85194
|
-
for (let
|
|
85250
|
+
for (let loop = 0; loop < MAX_LOCAL_SAFETY_LIMIT; loop++) {
|
|
85195
85251
|
const headers = {
|
|
85196
85252
|
...opts?.headers,
|
|
85197
85253
|
"content-type": "application/json",
|
|
85198
85254
|
"x-vqs-queue-name": queueName,
|
|
85199
85255
|
"x-vqs-message-id": messageId,
|
|
85200
|
-
"x-vqs-message-attempt": String(
|
|
85256
|
+
"x-vqs-message-attempt": String(delivery + 1)
|
|
85201
85257
|
};
|
|
85202
85258
|
const directHandler = directHandlers.get(prefix);
|
|
85203
85259
|
let response;
|
|
85204
|
-
|
|
85205
|
-
|
|
85206
|
-
|
|
85207
|
-
|
|
85208
|
-
|
|
85209
|
-
|
|
85210
|
-
|
|
85211
|
-
|
|
85212
|
-
|
|
85213
|
-
|
|
85214
|
-
|
|
85215
|
-
|
|
85216
|
-
|
|
85217
|
-
|
|
85218
|
-
|
|
85260
|
+
try {
|
|
85261
|
+
if (directHandler) {
|
|
85262
|
+
const req = new Request(`http://localhost/.well-known/workflow/v1/${pathname}`, {
|
|
85263
|
+
method: "POST",
|
|
85264
|
+
headers,
|
|
85265
|
+
body
|
|
85266
|
+
});
|
|
85267
|
+
response = await directHandler(req);
|
|
85268
|
+
} else {
|
|
85269
|
+
const baseUrl = await resolveBaseUrl(config4);
|
|
85270
|
+
response = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
|
|
85271
|
+
method: "POST",
|
|
85272
|
+
duplex: "half",
|
|
85273
|
+
dispatcher: httpAgent,
|
|
85274
|
+
headers,
|
|
85275
|
+
body
|
|
85276
|
+
});
|
|
85277
|
+
}
|
|
85278
|
+
} catch (err) {
|
|
85279
|
+
const name = err?.name;
|
|
85280
|
+
if (closeSignal.aborted || name === "AbortError" || name === "ResponseAborted") {
|
|
85281
|
+
return;
|
|
85282
|
+
}
|
|
85283
|
+
if (isDetachedArrayBufferQueueError(err))
|
|
85284
|
+
throw err;
|
|
85285
|
+
console.error(`[world-local] Queue delivery failed at the transport (loop ${loop + 1}), retrying`, {
|
|
85286
|
+
queueName,
|
|
85287
|
+
messageId,
|
|
85288
|
+
...runId && { runId },
|
|
85289
|
+
...stepId && { stepId },
|
|
85290
|
+
error: String(err)
|
|
85219
85291
|
});
|
|
85292
|
+
await setTimeout2(5e3, void 0, { signal: closeSignal });
|
|
85293
|
+
continue;
|
|
85220
85294
|
}
|
|
85295
|
+
delivery++;
|
|
85221
85296
|
const text = await response.text();
|
|
85222
85297
|
if (response.ok) {
|
|
85223
85298
|
try {
|
|
@@ -85235,7 +85310,7 @@ function createQueue(config4) {
|
|
|
85235
85310
|
}
|
|
85236
85311
|
return;
|
|
85237
85312
|
}
|
|
85238
|
-
console.error(`[world-local] Queue message failed (attempt ${
|
|
85313
|
+
console.error(`[world-local] Queue message failed (attempt ${delivery}, HTTP ${response.status})`, {
|
|
85239
85314
|
queueName,
|
|
85240
85315
|
messageId,
|
|
85241
85316
|
...runId && { runId },
|
|
@@ -87022,13 +87097,14 @@ function createLocalWorld(args) {
|
|
|
87022
87097
|
if (!recoverActiveRuns) {
|
|
87023
87098
|
return;
|
|
87024
87099
|
}
|
|
87025
|
-
const
|
|
87100
|
+
const fileIdFilter = tag ? (fileId) => hasTag(fileId, tag) : isUntagged;
|
|
87101
|
+
const recoveryRuns = {
|
|
87026
87102
|
...storage.runs,
|
|
87027
87103
|
list: /* @__PURE__ */ __name(((params) => storage.runs.list({
|
|
87028
87104
|
...params,
|
|
87029
|
-
fileIdFilter
|
|
87105
|
+
fileIdFilter
|
|
87030
87106
|
})), "list")
|
|
87031
|
-
}
|
|
87107
|
+
};
|
|
87032
87108
|
await reenqueueActiveRuns(recoveryRuns, queue.queue, "world-local");
|
|
87033
87109
|
},
|
|
87034
87110
|
async close() {
|
|
@@ -87087,34 +87163,69 @@ import { webcrypto } from "node:crypto";
|
|
|
87087
87163
|
// ../world-vercel/dist/http-client.js
|
|
87088
87164
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
87089
87165
|
var _dispatcher;
|
|
87166
|
+
var _eventsDispatcher;
|
|
87167
|
+
var _streamDispatcher;
|
|
87168
|
+
var BASE_AGENT_OPTIONS = {
|
|
87169
|
+
connections: 8,
|
|
87170
|
+
keepAliveTimeout: 1e4,
|
|
87171
|
+
// HTTP/1.1 pipelining is disabled (pipelining: 1) because it causes
|
|
87172
|
+
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
87173
|
+
pipelining: 1
|
|
87174
|
+
};
|
|
87175
|
+
var DEFAULT_AGENT_OPTIONS = {
|
|
87176
|
+
...BASE_AGENT_OPTIONS,
|
|
87177
|
+
allowH2: false
|
|
87178
|
+
};
|
|
87179
|
+
var EVENTS_AGENT_OPTIONS = {
|
|
87180
|
+
...BASE_AGENT_OPTIONS,
|
|
87181
|
+
allowH2: true
|
|
87182
|
+
};
|
|
87183
|
+
var RETRY_AGENT_OPTIONS = {
|
|
87184
|
+
// Observe Retry-After header if received
|
|
87185
|
+
retryAfter: true
|
|
87186
|
+
// By default, we observe re-try headers, and also separately
|
|
87187
|
+
// re-try on these status codes: 429 / 500 / 502 / 503 / 504.
|
|
87188
|
+
// TODO: We might want to let 429s pass through, so that we can do
|
|
87189
|
+
// runtime retry-after handling through the queue.
|
|
87190
|
+
};
|
|
87191
|
+
var STREAM_RETRY_OPTIONS = {
|
|
87192
|
+
retryAfter: true,
|
|
87193
|
+
methods: ["PUT"],
|
|
87194
|
+
statusCodes: [429]
|
|
87195
|
+
};
|
|
87090
87196
|
function getDispatcher(config4) {
|
|
87091
87197
|
return config4?.dispatcher ?? getDefaultDispatcher();
|
|
87092
87198
|
}
|
|
87093
87199
|
__name(getDispatcher, "getDispatcher");
|
|
87200
|
+
function getEventsDispatcher(config4) {
|
|
87201
|
+
return config4?.dispatcher ?? getDefaultEventsDispatcher();
|
|
87202
|
+
}
|
|
87203
|
+
__name(getEventsDispatcher, "getEventsDispatcher");
|
|
87204
|
+
function getStreamDispatcher(config4) {
|
|
87205
|
+
return config4?.dispatcher ?? getDefaultStreamDispatcher();
|
|
87206
|
+
}
|
|
87207
|
+
__name(getStreamDispatcher, "getStreamDispatcher");
|
|
87094
87208
|
function getDefaultDispatcher() {
|
|
87095
87209
|
if (!_dispatcher) {
|
|
87096
|
-
_dispatcher = new import_undici2.RetryAgent(new import_undici2.Agent(
|
|
87097
|
-
connections: 8,
|
|
87098
|
-
keepAliveTimeout: 1e4,
|
|
87099
|
-
// H2 is specifically incompatible with SvelteKit on Vercel prod. Everything else
|
|
87100
|
-
// runs fine.
|
|
87101
|
-
// TODO: Investigate/fix the failure on SvelteKit so we can re-enable H2.
|
|
87102
|
-
allowH2: false,
|
|
87103
|
-
// HTTP/1.1 pipelining is disabled (pipelining: 1) because it causes
|
|
87104
|
-
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
87105
|
-
pipelining: 1
|
|
87106
|
-
}), {
|
|
87107
|
-
// Observe Retry-After header if received
|
|
87108
|
-
retryAfter: true
|
|
87109
|
-
// By default, we observe re-try headers, and also separately
|
|
87110
|
-
// re-try on these status codes: 429 / 500 / 502 / 503 / 504.
|
|
87111
|
-
// TODO: We might want to let 429s pass through, so that we can do
|
|
87112
|
-
// runtime retry-after handling through the queue.
|
|
87113
|
-
});
|
|
87210
|
+
_dispatcher = new import_undici2.RetryAgent(new import_undici2.Agent(DEFAULT_AGENT_OPTIONS), RETRY_AGENT_OPTIONS);
|
|
87114
87211
|
}
|
|
87115
87212
|
return _dispatcher;
|
|
87116
87213
|
}
|
|
87117
87214
|
__name(getDefaultDispatcher, "getDefaultDispatcher");
|
|
87215
|
+
function getDefaultEventsDispatcher() {
|
|
87216
|
+
if (!_eventsDispatcher) {
|
|
87217
|
+
_eventsDispatcher = new import_undici2.RetryAgent(new import_undici2.Agent(EVENTS_AGENT_OPTIONS), RETRY_AGENT_OPTIONS);
|
|
87218
|
+
}
|
|
87219
|
+
return _eventsDispatcher;
|
|
87220
|
+
}
|
|
87221
|
+
__name(getDefaultEventsDispatcher, "getDefaultEventsDispatcher");
|
|
87222
|
+
function getDefaultStreamDispatcher() {
|
|
87223
|
+
if (!_streamDispatcher) {
|
|
87224
|
+
_streamDispatcher = new import_undici2.RetryAgent(new import_undici2.Agent(EVENTS_AGENT_OPTIONS), STREAM_RETRY_OPTIONS);
|
|
87225
|
+
}
|
|
87226
|
+
return _streamDispatcher;
|
|
87227
|
+
}
|
|
87228
|
+
__name(getDefaultStreamDispatcher, "getDefaultStreamDispatcher");
|
|
87118
87229
|
|
|
87119
87230
|
// ../world-vercel/dist/encryption.js
|
|
87120
87231
|
var KEY_BYTES = 32;
|
|
@@ -94322,7 +94433,7 @@ import os from "node:os";
|
|
|
94322
94433
|
import { inspect } from "node:util";
|
|
94323
94434
|
|
|
94324
94435
|
// ../world-vercel/dist/version.js
|
|
94325
|
-
var version5 = "5.0.0-beta.
|
|
94436
|
+
var version5 = "5.0.0-beta.21";
|
|
94326
94437
|
|
|
94327
94438
|
// ../world-vercel/dist/utils.js
|
|
94328
94439
|
var HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
@@ -94942,7 +95053,7 @@ async function fetchV4(url3, init, config4) {
|
|
|
94942
95053
|
headers: init.headers,
|
|
94943
95054
|
body: init.body,
|
|
94944
95055
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
|
|
94945
|
-
dispatcher:
|
|
95056
|
+
dispatcher: getEventsDispatcher(config4)
|
|
94946
95057
|
});
|
|
94947
95058
|
}
|
|
94948
95059
|
__name(fetchV4, "fetchV4");
|
|
@@ -95838,7 +95949,9 @@ function createStreamer2(config4) {
|
|
|
95838
95949
|
const response = await fetch(url3, {
|
|
95839
95950
|
method: "PUT",
|
|
95840
95951
|
body: chunk,
|
|
95841
|
-
headers: httpConfig.headers
|
|
95952
|
+
headers: httpConfig.headers,
|
|
95953
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
|
|
95954
|
+
dispatcher: getStreamDispatcher(config4)
|
|
95842
95955
|
});
|
|
95843
95956
|
const text = await response.text();
|
|
95844
95957
|
if (!response.ok) {
|
|
@@ -95858,7 +95971,9 @@ function createStreamer2(config4) {
|
|
|
95858
95971
|
const response = await fetch(url3, {
|
|
95859
95972
|
method: "PUT",
|
|
95860
95973
|
body,
|
|
95861
|
-
headers: httpConfig.headers
|
|
95974
|
+
headers: httpConfig.headers,
|
|
95975
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
|
|
95976
|
+
dispatcher: getStreamDispatcher(config4)
|
|
95862
95977
|
});
|
|
95863
95978
|
const text = await response.text();
|
|
95864
95979
|
if (!response.ok) {
|
|
@@ -95873,7 +95988,9 @@ function createStreamer2(config4) {
|
|
|
95873
95988
|
const url3 = getStreamUrl(name, resolvedRunId, httpConfig);
|
|
95874
95989
|
const response = await fetch(url3, {
|
|
95875
95990
|
method: "PUT",
|
|
95876
|
-
headers: httpConfig.headers
|
|
95991
|
+
headers: httpConfig.headers,
|
|
95992
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
|
|
95993
|
+
dispatcher: getStreamDispatcher(config4)
|
|
95877
95994
|
});
|
|
95878
95995
|
const text = await response.text();
|
|
95879
95996
|
if (!response.ok) {
|
|
@@ -96553,13 +96670,14 @@ async function executeStep(params) {
|
|
|
96553
96670
|
return { type: "failed" };
|
|
96554
96671
|
}
|
|
96555
96672
|
const preCompletionOps = [];
|
|
96673
|
+
const ops = [];
|
|
96674
|
+
let opsSettled = true;
|
|
96556
96675
|
try {
|
|
96557
96676
|
const attempt = step.attempt;
|
|
96558
96677
|
if (!step.startedAt) {
|
|
96559
96678
|
throw new WorkflowRuntimeError2(`Step "${stepId}" has no "startedAt" timestamp`);
|
|
96560
96679
|
}
|
|
96561
96680
|
const stepStartedAt = step.startedAt;
|
|
96562
|
-
const ops = [];
|
|
96563
96681
|
const encryptionKey = params.encryptionKey ?? await getEncryptionKey();
|
|
96564
96682
|
const hydratedInput = await trace3("step.hydrate", {}, async (hydrateSpan) => {
|
|
96565
96683
|
const startTime = Date.now();
|
|
@@ -96594,7 +96712,12 @@ async function executeStep(params) {
|
|
|
96594
96712
|
ops,
|
|
96595
96713
|
preCompletionOps,
|
|
96596
96714
|
closureVars: hydratedInput.closureVars,
|
|
96597
|
-
encryptionKey
|
|
96715
|
+
encryptionKey,
|
|
96716
|
+
// Turbo optimistic start runs this body before `run_started` is
|
|
96717
|
+
// durable. Expose the barrier so a direct step-body world write
|
|
96718
|
+
// (e.g. `experimental_setAttributes`) can order itself after the
|
|
96719
|
+
// run exists. Undefined on the await path (run already durable).
|
|
96720
|
+
runReadyBarrier: optimisticStart ? params.runReadyBarrier : void 0
|
|
96598
96721
|
}, () => stepFn.apply(thisVal, args));
|
|
96599
96722
|
});
|
|
96600
96723
|
const executionTimeMs = Date.now() - executionStartTime;
|
|
@@ -96603,7 +96726,20 @@ async function executeStep(params) {
|
|
|
96603
96726
|
});
|
|
96604
96727
|
result = await trace3("step.dehydrate", {}, async (dehydrateSpan) => {
|
|
96605
96728
|
const startTime = Date.now();
|
|
96606
|
-
const dehydrated = await dehydrateStepReturnValue2(
|
|
96729
|
+
const dehydrated = await dehydrateStepReturnValue2(
|
|
96730
|
+
result,
|
|
96731
|
+
workflowRunId,
|
|
96732
|
+
encryptionKey,
|
|
96733
|
+
ops,
|
|
96734
|
+
globalThis,
|
|
96735
|
+
false,
|
|
96736
|
+
false,
|
|
96737
|
+
compression,
|
|
96738
|
+
// Turbo optimistic start: a returned stream is piped to the server
|
|
96739
|
+
// after the body but within this same op flush, so gate its first
|
|
96740
|
+
// write on the run-ready barrier. Undefined on the await path.
|
|
96741
|
+
optimisticStart ? params.runReadyBarrier : void 0
|
|
96742
|
+
);
|
|
96607
96743
|
const durationMs = Date.now() - startTime;
|
|
96608
96744
|
dehydrateSpan?.setAttributes({
|
|
96609
96745
|
...QueueSerializeTimeMs2(durationMs),
|
|
@@ -96611,7 +96747,6 @@ async function executeStep(params) {
|
|
|
96611
96747
|
});
|
|
96612
96748
|
return dehydrated;
|
|
96613
96749
|
});
|
|
96614
|
-
let opsSettled = true;
|
|
96615
96750
|
if (ops.length > 0) {
|
|
96616
96751
|
const opsPromise = Promise.all(ops);
|
|
96617
96752
|
safeWaitUntil2(opsPromise, (err) => {
|
|
@@ -96640,45 +96775,6 @@ async function executeStep(params) {
|
|
|
96640
96775
|
await Promise.all(preCompletionOps).catch(() => {
|
|
96641
96776
|
});
|
|
96642
96777
|
}
|
|
96643
|
-
let stepCompleted409 = false;
|
|
96644
|
-
const completedResult = await world.events.create(workflowRunId, {
|
|
96645
|
-
eventType: "step_completed",
|
|
96646
|
-
specVersion: SPEC_VERSION_CURRENT2,
|
|
96647
|
-
correlationId: stepId,
|
|
96648
|
-
eventData: {
|
|
96649
|
-
stepName,
|
|
96650
|
-
workflowName,
|
|
96651
|
-
result
|
|
96652
|
-
}
|
|
96653
|
-
}, params.inlineDeltaSinceCursor !== void 0 ? { sinceCursor: params.inlineDeltaSinceCursor } : void 0).catch((err) => {
|
|
96654
|
-
if (EntityConflictError2.is(err)) {
|
|
96655
|
-
runtimeLogger2.info("Tried completing step, but step has already finished.", {
|
|
96656
|
-
workflowRunId,
|
|
96657
|
-
stepId,
|
|
96658
|
-
stepName,
|
|
96659
|
-
message: err.message
|
|
96660
|
-
});
|
|
96661
|
-
stepCompleted409 = true;
|
|
96662
|
-
return void 0;
|
|
96663
|
-
}
|
|
96664
|
-
throw err;
|
|
96665
|
-
});
|
|
96666
|
-
if (stepCompleted409) {
|
|
96667
|
-
return { type: "skipped" };
|
|
96668
|
-
}
|
|
96669
|
-
const inlineDelta = completedResult ? extractInlineDelta(completedResult, params.inlineDeltaSinceCursor !== void 0) : void 0;
|
|
96670
|
-
span?.setAttributes({
|
|
96671
|
-
...StepStatus2("completed"),
|
|
96672
|
-
...StepResultType2(typeof result)
|
|
96673
|
-
});
|
|
96674
|
-
if (ops.length > 0) {
|
|
96675
|
-
stepLogger2.debug("Step has pending ops", {
|
|
96676
|
-
workflowRunId,
|
|
96677
|
-
stepName,
|
|
96678
|
-
opsCount: ops.length
|
|
96679
|
-
});
|
|
96680
|
-
}
|
|
96681
|
-
return { type: "completed", hasPendingOps: !opsSettled, inlineDelta };
|
|
96682
96778
|
} catch (err) {
|
|
96683
96779
|
if (optimisticStart) {
|
|
96684
96780
|
const reconcile = await reconcileOptimisticStart();
|
|
@@ -96839,6 +96935,51 @@ async function executeStep(params) {
|
|
|
96839
96935
|
});
|
|
96840
96936
|
return { type: "retry", timeoutSeconds };
|
|
96841
96937
|
}
|
|
96938
|
+
let completedResult;
|
|
96939
|
+
try {
|
|
96940
|
+
completedResult = await world.events.create(workflowRunId, {
|
|
96941
|
+
eventType: "step_completed",
|
|
96942
|
+
specVersion: SPEC_VERSION_CURRENT2,
|
|
96943
|
+
correlationId: stepId,
|
|
96944
|
+
eventData: {
|
|
96945
|
+
stepName,
|
|
96946
|
+
workflowName,
|
|
96947
|
+
result
|
|
96948
|
+
}
|
|
96949
|
+
}, params.inlineDeltaSinceCursor !== void 0 ? { sinceCursor: params.inlineDeltaSinceCursor } : void 0);
|
|
96950
|
+
} catch (err) {
|
|
96951
|
+
if (EntityConflictError2.is(err)) {
|
|
96952
|
+
runtimeLogger2.info("Tried completing step, but step has already finished.", {
|
|
96953
|
+
workflowRunId,
|
|
96954
|
+
stepId,
|
|
96955
|
+
stepName,
|
|
96956
|
+
message: err.message
|
|
96957
|
+
});
|
|
96958
|
+
return { type: "skipped" };
|
|
96959
|
+
}
|
|
96960
|
+
if (RunExpiredError.is(err)) {
|
|
96961
|
+
stepLogger2.info("Workflow run already completed, skipping step", {
|
|
96962
|
+
workflowRunId,
|
|
96963
|
+
stepId,
|
|
96964
|
+
message: err.message
|
|
96965
|
+
});
|
|
96966
|
+
return { type: "gone" };
|
|
96967
|
+
}
|
|
96968
|
+
throw err;
|
|
96969
|
+
}
|
|
96970
|
+
const inlineDelta = extractInlineDelta(completedResult, params.inlineDeltaSinceCursor !== void 0);
|
|
96971
|
+
span?.setAttributes({
|
|
96972
|
+
...StepStatus2("completed"),
|
|
96973
|
+
...StepResultType2(typeof result)
|
|
96974
|
+
});
|
|
96975
|
+
if (ops.length > 0) {
|
|
96976
|
+
stepLogger2.debug("Step has pending ops", {
|
|
96977
|
+
workflowRunId,
|
|
96978
|
+
stepName,
|
|
96979
|
+
opsCount: ops.length
|
|
96980
|
+
});
|
|
96981
|
+
}
|
|
96982
|
+
return { type: "completed", hasPendingOps: !opsSettled, inlineDelta };
|
|
96842
96983
|
});
|
|
96843
96984
|
}
|
|
96844
96985
|
__name(executeStep, "executeStep");
|
|
@@ -117063,10 +117204,10 @@ var Run = class _Run {
|
|
|
117063
117204
|
return this.getReadable();
|
|
117064
117205
|
}
|
|
117065
117206
|
};
|
|
117066
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117067
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117068
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117069
|
-
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117207
|
+
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#wakeUp");
|
|
117208
|
+
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#cancel");
|
|
117209
|
+
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#getReadable");
|
|
117210
|
+
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#exists");
|
|
117070
117211
|
Object.defineProperty(Run.prototype, "exists", {
|
|
117071
117212
|
get() {
|
|
117072
117213
|
return __step_Run$exists.call(this);
|
|
@@ -117074,7 +117215,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
117074
117215
|
configurable: true,
|
|
117075
117216
|
enumerable: false
|
|
117076
117217
|
});
|
|
117077
|
-
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117218
|
+
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#status");
|
|
117078
117219
|
Object.defineProperty(Run.prototype, "status", {
|
|
117079
117220
|
get() {
|
|
117080
117221
|
return __step_Run$status.call(this);
|
|
@@ -117082,7 +117223,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
117082
117223
|
configurable: true,
|
|
117083
117224
|
enumerable: false
|
|
117084
117225
|
});
|
|
117085
|
-
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117226
|
+
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#returnValue");
|
|
117086
117227
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
117087
117228
|
get() {
|
|
117088
117229
|
return __step_Run$returnValue.call(this);
|
|
@@ -117090,7 +117231,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
117090
117231
|
configurable: true,
|
|
117091
117232
|
enumerable: false
|
|
117092
117233
|
});
|
|
117093
|
-
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117234
|
+
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#workflowName");
|
|
117094
117235
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
117095
117236
|
get() {
|
|
117096
117237
|
return __step_Run$workflowName.call(this);
|
|
@@ -117098,7 +117239,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
117098
117239
|
configurable: true,
|
|
117099
117240
|
enumerable: false
|
|
117100
117241
|
});
|
|
117101
|
-
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117242
|
+
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#createdAt");
|
|
117102
117243
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
117103
117244
|
get() {
|
|
117104
117245
|
return __step_Run$createdAt.call(this);
|
|
@@ -117106,7 +117247,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
117106
117247
|
configurable: true,
|
|
117107
117248
|
enumerable: false
|
|
117108
117249
|
});
|
|
117109
|
-
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117250
|
+
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#startedAt");
|
|
117110
117251
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
117111
117252
|
get() {
|
|
117112
117253
|
return __step_Run$startedAt.call(this);
|
|
@@ -117114,7 +117255,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
117114
117255
|
configurable: true,
|
|
117115
117256
|
enumerable: false
|
|
117116
117257
|
});
|
|
117117
|
-
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
117258
|
+
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.25//Run#completedAt");
|
|
117118
117259
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
117119
117260
|
get() {
|
|
117120
117261
|
return __step_Run$completedAt.call(this);
|
|
@@ -117131,7 +117272,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
117131
117272
|
enumerable: false,
|
|
117132
117273
|
configurable: false
|
|
117133
117274
|
});
|
|
117134
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
117275
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.25//Run");
|
|
117135
117276
|
|
|
117136
117277
|
// ../core/dist/workflow/create-hook.js
|
|
117137
117278
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|