@workflow/world-testing 5.0.0-beta.34 → 5.0.0-beta.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.well-known/workflow/v1/flow.mjs +554 -111
- package/dist/.well-known/workflow/v1/manifest.json +493 -211
- package/dist/.well-known/workflow/v1/step.mjs +91 -21
- package/dist/src/index.d.mts.map +1 -1
- package/dist/src/index.mjs +3 -1
- package/dist/src/lineage.d.mts +8 -0
- package/dist/src/lineage.d.mts.map +1 -0
- package/dist/src/lineage.mjs +48 -0
- package/package.json +8 -8
|
@@ -14879,12 +14879,14 @@ function applyAttributeChanges(existing, changes) {
|
|
|
14879
14879
|
}
|
|
14880
14880
|
return next2;
|
|
14881
14881
|
}
|
|
14882
|
-
var RESERVED_ATTRIBUTE_KEY_PREFIX2, ATTRIBUTE_KEY_MAX_LENGTH2, ATTRIBUTE_VALUE_MAX_BYTES2, ATTRIBUTE_MAX_PER_RUN2, AttributeChangeSchema2, AttributeChangesSchema2, AttributeValidationError2, valueByteLength2;
|
|
14882
|
+
var RESERVED_ATTRIBUTE_KEY_PREFIX2, ROOT_RUN_ID_ATTRIBUTE2, PARENT_RUN_ID_ATTRIBUTE2, ATTRIBUTE_KEY_MAX_LENGTH2, ATTRIBUTE_VALUE_MAX_BYTES2, ATTRIBUTE_MAX_PER_RUN2, AttributeChangeSchema2, AttributeChangesSchema2, AttributeValidationError2, valueByteLength2;
|
|
14883
14883
|
var init_attributes2 = __esm({
|
|
14884
14884
|
"../world/dist/attributes.js"() {
|
|
14885
14885
|
"use strict";
|
|
14886
14886
|
init_zod2();
|
|
14887
14887
|
RESERVED_ATTRIBUTE_KEY_PREFIX2 = "$";
|
|
14888
|
+
ROOT_RUN_ID_ATTRIBUTE2 = `${RESERVED_ATTRIBUTE_KEY_PREFIX2}rootRunId`;
|
|
14889
|
+
PARENT_RUN_ID_ATTRIBUTE2 = `${RESERVED_ATTRIBUTE_KEY_PREFIX2}parentRunId`;
|
|
14888
14890
|
ATTRIBUTE_KEY_MAX_LENGTH2 = 256;
|
|
14889
14891
|
ATTRIBUTE_VALUE_MAX_BYTES2 = 256;
|
|
14890
14892
|
ATTRIBUTE_MAX_PER_RUN2 = 64;
|
|
@@ -15110,6 +15112,17 @@ var init_events2 = __esm({
|
|
|
15110
15112
|
// stso.
|
|
15111
15113
|
stepCount: external_exports2.number().int().positive().optional(),
|
|
15112
15114
|
eventCount: external_exports2.number().int().positive().optional(),
|
|
15115
|
+
// Run-started-to-first-step: milliseconds from the `run_started` response
|
|
15116
|
+
// landing (or, under turbo, the local run synthesis instant) until this
|
|
15117
|
+
// step's start POST was issued. A sub-window of ttfs. Only reported
|
|
15118
|
+
// alongside the same eligibility as ttfs.
|
|
15119
|
+
rsfs: external_exports2.number().optional(),
|
|
15120
|
+
// Synchronous workflow-function replay duration of only the FINAL replay
|
|
15121
|
+
// pass within the rsfs window (the pass that scheduled the first step),
|
|
15122
|
+
// excluding awaited network I/O — not accumulated across earlier
|
|
15123
|
+
// pre-first-step passes, so it is not "the replay portion of rsfs". Only
|
|
15124
|
+
// present alongside rsfs, and only for the run's first step.
|
|
15125
|
+
finalSchedulingReplay: external_exports2.number().optional(),
|
|
15113
15126
|
// Names of the runtime's optional startup-latency optimizations that were
|
|
15114
15127
|
// active for this measurement (e.g. 'turbo', 'lazyStepStart',
|
|
15115
15128
|
// 'optimisticStart'), so latency metrics can be segmented by them.
|
|
@@ -16208,10 +16221,12 @@ __export(dist_exports, {
|
|
|
16208
16221
|
HookSchema: () => HookSchema2,
|
|
16209
16222
|
LegacySerializedDataSchemaV1: () => LegacySerializedDataSchemaV12,
|
|
16210
16223
|
MessageId: () => MessageId2,
|
|
16224
|
+
PARENT_RUN_ID_ATTRIBUTE: () => PARENT_RUN_ID_ATTRIBUTE2,
|
|
16211
16225
|
PaginatedResponseSchema: () => PaginatedResponseSchema,
|
|
16212
16226
|
QueuePayloadSchema: () => QueuePayloadSchema2,
|
|
16213
16227
|
QueuePrefix: () => QueuePrefix2,
|
|
16214
16228
|
RESERVED_ATTRIBUTE_KEY_PREFIX: () => RESERVED_ATTRIBUTE_KEY_PREFIX2,
|
|
16229
|
+
ROOT_RUN_ID_ATTRIBUTE: () => ROOT_RUN_ID_ATTRIBUTE2,
|
|
16215
16230
|
RUN_EVENT_TYPES: () => RUN_EVENT_TYPES2,
|
|
16216
16231
|
RunInputSchema: () => RunInputSchema2,
|
|
16217
16232
|
SPEC_VERSION_CURRENT: () => SPEC_VERSION_CURRENT2,
|
|
@@ -16679,7 +16694,7 @@ function buildFramedDetails2(hint3, slug) {
|
|
|
16679
16694
|
out.push({ label: "docs", value: `${BASE_URL2}/${slug}` });
|
|
16680
16695
|
return out;
|
|
16681
16696
|
}
|
|
16682
|
-
var BASE_URL2, ERROR_SLUGS2, WorkflowError2, WorkflowWorldError2, WorkflowRunFailedError2, WorkflowRunNotCompletedError2, WorkflowRuntimeError2, CorruptedEventLogError, ReplayDivergenceError, RuntimeDecryptionError2, SerializationError2, StepNotRegisteredError2, WorkflowNotRegisteredError2, WorkflowRunNotFoundError2, HookConflictError2, HookNotFoundError2, EntityConflictError2, RunExpiredError, TooEarlyError, ThrottleError2, WorkflowRunCancelledError2, RunNotSupportedError, FatalError2, RetryableError2, FATAL_ERROR_KEY2, RETRYABLE_ERROR_KEY2, HOOK_CONFLICT_ERROR_KEY2, RUNTIME_DECRYPTION_ERROR_KEY2;
|
|
16697
|
+
var BASE_URL2, ERROR_SLUGS2, WorkflowError2, WorkflowWorldError2, WorkflowRunFailedError2, WorkflowRunNotCompletedError2, WorkflowRuntimeError2, CorruptedEventLogError, ReplayDivergenceError, RuntimeDecryptionError2, SerializationError2, StepNotRegisteredError2, WorkflowNotRegisteredError2, WorkflowRunNotFoundError2, HookConflictError2, HookNotFoundError2, EntityConflictError2, RunExpiredError, TooEarlyError, ThrottleError2, PreconditionFailedError, WorkflowRunCancelledError2, RunNotSupportedError, FatalError2, RetryableError2, FATAL_ERROR_KEY2, RETRYABLE_ERROR_KEY2, HOOK_CONFLICT_ERROR_KEY2, RUNTIME_DECRYPTION_ERROR_KEY2;
|
|
16683
16698
|
var init_dist7 = __esm({
|
|
16684
16699
|
"../errors/dist/index.js"() {
|
|
16685
16700
|
"use strict";
|
|
@@ -17004,6 +17019,18 @@ Caused by: ${options.cause.stack}`;
|
|
|
17004
17019
|
return isError2(value) && value.name === "ThrottleError";
|
|
17005
17020
|
}
|
|
17006
17021
|
};
|
|
17022
|
+
PreconditionFailedError = class extends WorkflowWorldError2 {
|
|
17023
|
+
static {
|
|
17024
|
+
__name(this, "PreconditionFailedError");
|
|
17025
|
+
}
|
|
17026
|
+
constructor(message, options) {
|
|
17027
|
+
super(message, { status: 412, retryAfter: options?.retryAfter });
|
|
17028
|
+
this.name = "PreconditionFailedError";
|
|
17029
|
+
}
|
|
17030
|
+
static is(value) {
|
|
17031
|
+
return isError2(value) && value.name === "PreconditionFailedError";
|
|
17032
|
+
}
|
|
17033
|
+
};
|
|
17007
17034
|
WorkflowRunCancelledError2 = class extends WorkflowError2 {
|
|
17008
17035
|
static {
|
|
17009
17036
|
__name(this, "WorkflowRunCancelledError");
|
|
@@ -20055,9 +20082,9 @@ var require_util = __commonJS({
|
|
|
20055
20082
|
yield* this[kBody];
|
|
20056
20083
|
}
|
|
20057
20084
|
};
|
|
20058
|
-
function
|
|
20085
|
+
function noop3() {
|
|
20059
20086
|
}
|
|
20060
|
-
__name(
|
|
20087
|
+
__name(noop3, "noop");
|
|
20061
20088
|
function wrapRequestBody(body) {
|
|
20062
20089
|
if (isStream(body)) {
|
|
20063
20090
|
if (bodyLength(body) === 0) {
|
|
@@ -20760,7 +20787,7 @@ var require_util = __commonJS({
|
|
|
20760
20787
|
__name(errorRequest, "errorRequest");
|
|
20761
20788
|
var setupConnectTimeout = process.platform === "win32" ? (socketWeakRef, opts) => {
|
|
20762
20789
|
if (!opts.timeout) {
|
|
20763
|
-
return
|
|
20790
|
+
return noop3;
|
|
20764
20791
|
}
|
|
20765
20792
|
let s1 = null;
|
|
20766
20793
|
let s2 = null;
|
|
@@ -20776,7 +20803,7 @@ var require_util = __commonJS({
|
|
|
20776
20803
|
};
|
|
20777
20804
|
} : (socketWeakRef, opts) => {
|
|
20778
20805
|
if (!opts.timeout) {
|
|
20779
|
-
return
|
|
20806
|
+
return noop3;
|
|
20780
20807
|
}
|
|
20781
20808
|
let s1 = null;
|
|
20782
20809
|
const fastTimer = timers.setFastTimeout(() => {
|
|
@@ -25496,13 +25523,13 @@ var require_body = __commonJS({
|
|
|
25496
25523
|
var { runtimeFeatures } = require_runtime_features();
|
|
25497
25524
|
var random = runtimeFeatures.has("crypto") ? __require("node:crypto").randomInt : (max) => Math.floor(Math.random() * max);
|
|
25498
25525
|
var textEncoder = new TextEncoder();
|
|
25499
|
-
function
|
|
25526
|
+
function noop3() {
|
|
25500
25527
|
}
|
|
25501
|
-
__name(
|
|
25528
|
+
__name(noop3, "noop");
|
|
25502
25529
|
var streamRegistry = new FinalizationRegistry((weakRef) => {
|
|
25503
25530
|
const stream = weakRef.deref();
|
|
25504
25531
|
if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
|
|
25505
|
-
stream.cancel("Response object has been garbage collected").catch(
|
|
25532
|
+
stream.cancel("Response object has been garbage collected").catch(noop3);
|
|
25506
25533
|
}
|
|
25507
25534
|
});
|
|
25508
25535
|
function extractBody(object3, keepalive = false) {
|
|
@@ -27867,7 +27894,7 @@ var require_client = __commonJS({
|
|
|
27867
27894
|
var getDefaultNodeMaxHeaderSize = http && http.maxHeaderSize && Number.isInteger(http.maxHeaderSize) && http.maxHeaderSize > 0 ? () => http.maxHeaderSize : () => {
|
|
27868
27895
|
throw new InvalidArgumentError("http module not available or http.maxHeaderSize invalid");
|
|
27869
27896
|
};
|
|
27870
|
-
var
|
|
27897
|
+
var noop3 = /* @__PURE__ */ __name(() => {
|
|
27871
27898
|
}, "noop");
|
|
27872
27899
|
function getPipelining(client) {
|
|
27873
27900
|
return client[kPipelining] ?? client[kHTTPContext]?.defaultPipelining ?? 1;
|
|
@@ -28174,7 +28201,7 @@ var require_client = __commonJS({
|
|
|
28174
28201
|
return;
|
|
28175
28202
|
}
|
|
28176
28203
|
if (client.destroyed) {
|
|
28177
|
-
util.destroy(socket.on("error",
|
|
28204
|
+
util.destroy(socket.on("error", noop3), new ClientDestroyedError());
|
|
28178
28205
|
client[kResume]();
|
|
28179
28206
|
return;
|
|
28180
28207
|
}
|
|
@@ -28182,7 +28209,7 @@ var require_client = __commonJS({
|
|
|
28182
28209
|
try {
|
|
28183
28210
|
client[kHTTPContext] = socket.alpnProtocol === "h2" ? connectH2(client, socket) : connectH1(client, socket);
|
|
28184
28211
|
} catch (err2) {
|
|
28185
|
-
socket.destroy().on("error",
|
|
28212
|
+
socket.destroy().on("error", noop3);
|
|
28186
28213
|
handleConnectError(client, err2, { host, hostname: hostname5, protocol, port });
|
|
28187
28214
|
client[kResume]();
|
|
28188
28215
|
return;
|
|
@@ -29846,7 +29873,7 @@ var require_proxy_agent = __commonJS({
|
|
|
29846
29873
|
return new Pool(origin, opts);
|
|
29847
29874
|
}
|
|
29848
29875
|
__name(defaultFactory, "defaultFactory");
|
|
29849
|
-
var
|
|
29876
|
+
var noop3 = /* @__PURE__ */ __name(() => {
|
|
29850
29877
|
}, "noop");
|
|
29851
29878
|
function defaultAgentFactory(origin, opts) {
|
|
29852
29879
|
if (opts.connections === 1) {
|
|
@@ -29990,7 +30017,7 @@ var require_proxy_agent = __commonJS({
|
|
|
29990
30017
|
};
|
|
29991
30018
|
const { socket, statusCode } = await this[kClient].connect(connectParams);
|
|
29992
30019
|
if (statusCode !== 200) {
|
|
29993
|
-
socket.on("error",
|
|
30020
|
+
socket.on("error", noop3).destroy();
|
|
29994
30021
|
callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`));
|
|
29995
30022
|
return;
|
|
29996
30023
|
}
|
|
@@ -30628,7 +30655,7 @@ var require_readable = __commonJS({
|
|
|
30628
30655
|
var kContentLength = /* @__PURE__ */ Symbol("kContentLength");
|
|
30629
30656
|
var kUsed = /* @__PURE__ */ Symbol("kUsed");
|
|
30630
30657
|
var kBytesRead = /* @__PURE__ */ Symbol("kBytesRead");
|
|
30631
|
-
var
|
|
30658
|
+
var noop3 = /* @__PURE__ */ __name(() => {
|
|
30632
30659
|
}, "noop");
|
|
30633
30660
|
var BodyReadable = class extends Readable {
|
|
30634
30661
|
static {
|
|
@@ -30856,7 +30883,7 @@ var require_readable = __commonJS({
|
|
|
30856
30883
|
} else {
|
|
30857
30884
|
this.on("close", resolve2);
|
|
30858
30885
|
}
|
|
30859
|
-
this.on("error",
|
|
30886
|
+
this.on("error", noop3).on("data", () => {
|
|
30860
30887
|
if (this[kBytesRead] > limit) {
|
|
30861
30888
|
this.destroy();
|
|
30862
30889
|
}
|
|
@@ -31034,9 +31061,9 @@ var require_api_request = __commonJS({
|
|
|
31034
31061
|
var { Readable } = require_readable();
|
|
31035
31062
|
var { InvalidArgumentError, RequestAbortedError } = require_errors();
|
|
31036
31063
|
var util = require_util();
|
|
31037
|
-
function
|
|
31064
|
+
function noop3() {
|
|
31038
31065
|
}
|
|
31039
|
-
__name(
|
|
31066
|
+
__name(noop3, "noop");
|
|
31040
31067
|
var RequestHandler = class extends AsyncResource {
|
|
31041
31068
|
static {
|
|
31042
31069
|
__name(this, "RequestHandler");
|
|
@@ -31065,7 +31092,7 @@ var require_api_request = __commonJS({
|
|
|
31065
31092
|
super("UNDICI_REQUEST");
|
|
31066
31093
|
} catch (err) {
|
|
31067
31094
|
if (util.isStream(body)) {
|
|
31068
|
-
util.destroy(body.on("error",
|
|
31095
|
+
util.destroy(body.on("error", noop3), err);
|
|
31069
31096
|
}
|
|
31070
31097
|
throw err;
|
|
31071
31098
|
}
|
|
@@ -31088,7 +31115,7 @@ var require_api_request = __commonJS({
|
|
|
31088
31115
|
this.removeAbortListener = util.addAbortListener(signal, () => {
|
|
31089
31116
|
this.reason = signal.reason ?? new RequestAbortedError();
|
|
31090
31117
|
if (this.res) {
|
|
31091
|
-
util.destroy(this.res.on("error",
|
|
31118
|
+
util.destroy(this.res.on("error", noop3), this.reason);
|
|
31092
31119
|
} else if (this.abort) {
|
|
31093
31120
|
this.abort(this.reason);
|
|
31094
31121
|
}
|
|
@@ -31142,7 +31169,7 @@ var require_api_request = __commonJS({
|
|
|
31142
31169
|
});
|
|
31143
31170
|
} catch (err) {
|
|
31144
31171
|
this.res = null;
|
|
31145
|
-
util.destroy(res.on("error",
|
|
31172
|
+
util.destroy(res.on("error", noop3), err);
|
|
31146
31173
|
queueMicrotask(() => {
|
|
31147
31174
|
throw err;
|
|
31148
31175
|
});
|
|
@@ -31167,13 +31194,13 @@ var require_api_request = __commonJS({
|
|
|
31167
31194
|
if (res) {
|
|
31168
31195
|
this.res = null;
|
|
31169
31196
|
queueMicrotask(() => {
|
|
31170
|
-
util.destroy(res.on("error",
|
|
31197
|
+
util.destroy(res.on("error", noop3), err);
|
|
31171
31198
|
});
|
|
31172
31199
|
}
|
|
31173
31200
|
if (body) {
|
|
31174
31201
|
this.body = null;
|
|
31175
31202
|
if (util.isStream(body)) {
|
|
31176
|
-
body.on("error",
|
|
31203
|
+
body.on("error", noop3);
|
|
31177
31204
|
util.destroy(body, err);
|
|
31178
31205
|
}
|
|
31179
31206
|
}
|
|
@@ -31273,9 +31300,9 @@ var require_api_stream = __commonJS({
|
|
|
31273
31300
|
var { InvalidArgumentError, InvalidReturnValueError } = require_errors();
|
|
31274
31301
|
var util = require_util();
|
|
31275
31302
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
31276
|
-
function
|
|
31303
|
+
function noop3() {
|
|
31277
31304
|
}
|
|
31278
|
-
__name(
|
|
31305
|
+
__name(noop3, "noop");
|
|
31279
31306
|
var StreamHandler = class extends AsyncResource {
|
|
31280
31307
|
static {
|
|
31281
31308
|
__name(this, "StreamHandler");
|
|
@@ -31304,7 +31331,7 @@ var require_api_stream = __commonJS({
|
|
|
31304
31331
|
super("UNDICI_STREAM");
|
|
31305
31332
|
} catch (err) {
|
|
31306
31333
|
if (util.isStream(body)) {
|
|
31307
|
-
util.destroy(body.on("error",
|
|
31334
|
+
util.destroy(body.on("error", noop3), err);
|
|
31308
31335
|
}
|
|
31309
31336
|
throw err;
|
|
31310
31337
|
}
|
|
@@ -31447,9 +31474,9 @@ var require_api_pipeline = __commonJS({
|
|
|
31447
31474
|
} = require_errors();
|
|
31448
31475
|
var util = require_util();
|
|
31449
31476
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
31450
|
-
function
|
|
31477
|
+
function noop3() {
|
|
31451
31478
|
}
|
|
31452
|
-
__name(
|
|
31479
|
+
__name(noop3, "noop");
|
|
31453
31480
|
var kResume = /* @__PURE__ */ Symbol("resume");
|
|
31454
31481
|
var PipelineRequest = class extends Readable {
|
|
31455
31482
|
static {
|
|
@@ -31517,7 +31544,7 @@ var require_api_pipeline = __commonJS({
|
|
|
31517
31544
|
this.abort = null;
|
|
31518
31545
|
this.context = null;
|
|
31519
31546
|
this.onInfo = onInfo || null;
|
|
31520
|
-
this.req = new PipelineRequest().on("error",
|
|
31547
|
+
this.req = new PipelineRequest().on("error", noop3);
|
|
31521
31548
|
this.ret = new Duplex({
|
|
31522
31549
|
readableObjectMode: opts.objectMode,
|
|
31523
31550
|
autoDestroy: true,
|
|
@@ -31588,7 +31615,7 @@ var require_api_pipeline = __commonJS({
|
|
|
31588
31615
|
context: context2
|
|
31589
31616
|
});
|
|
31590
31617
|
} catch (err) {
|
|
31591
|
-
this.res.on("error",
|
|
31618
|
+
this.res.on("error", noop3);
|
|
31592
31619
|
throw err;
|
|
31593
31620
|
}
|
|
31594
31621
|
if (!body || typeof body.on !== "function") {
|
|
@@ -33943,7 +33970,7 @@ var require_redirect_handler = __commonJS({
|
|
|
33943
33970
|
var EE = __require("node:events");
|
|
33944
33971
|
var redirectableStatusCodes = [300, 301, 302, 303, 307, 308];
|
|
33945
33972
|
var kBody = /* @__PURE__ */ Symbol("body");
|
|
33946
|
-
var
|
|
33973
|
+
var noop3 = /* @__PURE__ */ __name(() => {
|
|
33947
33974
|
}, "noop");
|
|
33948
33975
|
var BodyAsyncIterable = class {
|
|
33949
33976
|
static {
|
|
@@ -34012,14 +34039,14 @@ var require_redirect_handler = __commonJS({
|
|
|
34012
34039
|
if ((statusCode === 301 || statusCode === 302) && this.opts.method === "POST") {
|
|
34013
34040
|
this.opts.method = "GET";
|
|
34014
34041
|
if (util.isStream(this.opts.body)) {
|
|
34015
|
-
util.destroy(this.opts.body.on("error",
|
|
34042
|
+
util.destroy(this.opts.body.on("error", noop3));
|
|
34016
34043
|
}
|
|
34017
34044
|
this.opts.body = null;
|
|
34018
34045
|
}
|
|
34019
34046
|
if (statusCode === 303 && this.opts.method !== "HEAD") {
|
|
34020
34047
|
this.opts.method = "GET";
|
|
34021
34048
|
if (util.isStream(this.opts.body)) {
|
|
34022
|
-
util.destroy(this.opts.body.on("error",
|
|
34049
|
+
util.destroy(this.opts.body.on("error", noop3));
|
|
34023
34050
|
}
|
|
34024
34051
|
this.opts.body = null;
|
|
34025
34052
|
}
|
|
@@ -35569,9 +35596,9 @@ var require_cache_handler = __commonJS({
|
|
|
35569
35596
|
isEtagUsable
|
|
35570
35597
|
} = require_cache2();
|
|
35571
35598
|
var { parseHttpDate } = require_date();
|
|
35572
|
-
function
|
|
35599
|
+
function noop3() {
|
|
35573
35600
|
}
|
|
35574
|
-
__name(
|
|
35601
|
+
__name(noop3, "noop");
|
|
35575
35602
|
var HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
35576
35603
|
200,
|
|
35577
35604
|
203,
|
|
@@ -35654,7 +35681,7 @@ var require_cache_handler = __commonJS({
|
|
|
35654
35681
|
const handler = this;
|
|
35655
35682
|
if (!util.safeHTTPMethods.includes(this.#cacheKey.method) && statusCode >= 200 && statusCode <= 399) {
|
|
35656
35683
|
try {
|
|
35657
|
-
this.#store.delete(this.#cacheKey)?.catch?.(
|
|
35684
|
+
this.#store.delete(this.#cacheKey)?.catch?.(noop3);
|
|
35658
35685
|
} catch {
|
|
35659
35686
|
}
|
|
35660
35687
|
return downstreamOnHeaders();
|
|
@@ -45121,7 +45148,7 @@ var init_log_format2 = __esm({
|
|
|
45121
45148
|
function SemanticConvention3(...names) {
|
|
45122
45149
|
return (value) => Object.fromEntries(names.map((name) => [name, value]));
|
|
45123
45150
|
}
|
|
45124
|
-
var WorkflowName2, WorkflowOperation2, WorkflowRunId3, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowTraceMode2, WorkflowTurbo2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, WorkflowOwnedRecoverySteps2, WorkflowBackstopWakesArmed2, WorkflowRouteType2, WorkflowRouteHandlerCached2, WorkflowRouteInvocationCount2, WorkflowRouteEntrypointAgeMs2, WorkflowRouteModuleBodyInitMs2, StepName2, StepId3, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepTtfsMs2, StepStsoMs2, StepLatencyOptimizations2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, QueueOverheadMs2, DeploymentId2, HookToken2, HookId2, HookFound2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod2, HttpRoute2, UrlFull2, ServerAddress2, ServerPort2, HttpResponseStatusCode2, ErrorType2, WorldParseFormat2, WorkflowEventsPagesLoaded2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, SerializationOperation2, SerializationCompressed2, SerializationCodec2, SerializationUncompressedBytes2, SerializationStoredBytes2, SerializationCompressionRatio2, PeerService3, RpcSystem3, RpcService3, RpcMethod3, ErrorRetryable2, ErrorCategory2;
|
|
45151
|
+
var WorkflowName2, WorkflowOperation2, WorkflowRunId3, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowTraceMode2, WorkflowTurbo2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, WorkflowOwnedRecoverySteps2, WorkflowBackstopWakesArmed2, WorkflowRouteType2, WorkflowRouteHandlerCached2, WorkflowRouteInvocationCount2, WorkflowRouteEntrypointAgeMs2, WorkflowRouteModuleBodyInitMs2, StepName2, StepId3, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepTtfsMs2, StepStsoMs2, StepRsfsMs2, StepFinalSchedulingReplayMs2, StepLatencyOptimizations2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, QueueOverheadMs2, DeploymentId2, HookToken2, HookId2, HookFound2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod2, HttpRoute2, UrlFull2, ServerAddress2, ServerPort2, HttpResponseStatusCode2, ErrorType2, WorldParseFormat2, WorkflowEventsPagesLoaded2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, SerializationOperation2, SerializationCompressed2, SerializationCodec2, SerializationUncompressedBytes2, SerializationStoredBytes2, SerializationCompressionRatio2, PeerService3, RpcSystem3, RpcService3, RpcMethod3, ErrorRetryable2, ErrorCategory2;
|
|
45125
45152
|
var init_semantic_conventions2 = __esm({
|
|
45126
45153
|
"../core/dist/telemetry/semantic-conventions.js"() {
|
|
45127
45154
|
"use strict";
|
|
@@ -45158,6 +45185,8 @@ var init_semantic_conventions2 = __esm({
|
|
|
45158
45185
|
StepTracePropagated2 = SemanticConvention3("step.trace.propagated");
|
|
45159
45186
|
StepTtfsMs2 = SemanticConvention3("step.ttfs_ms");
|
|
45160
45187
|
StepStsoMs2 = SemanticConvention3("step.stso_ms");
|
|
45188
|
+
StepRsfsMs2 = SemanticConvention3("step.rsfs_ms");
|
|
45189
|
+
StepFinalSchedulingReplayMs2 = SemanticConvention3("step.final_scheduling_replay_ms");
|
|
45161
45190
|
StepLatencyOptimizations2 = SemanticConvention3("step.latency_optimizations");
|
|
45162
45191
|
StepSkipped2 = SemanticConvention3("step.skipped");
|
|
45163
45192
|
StepSkipReason2 = SemanticConvention3("step.skip_reason");
|
|
@@ -45585,7 +45614,7 @@ var version4;
|
|
|
45585
45614
|
var init_version3 = __esm({
|
|
45586
45615
|
"../core/dist/version.js"() {
|
|
45587
45616
|
"use strict";
|
|
45588
|
-
version4 = "5.0.0-beta.
|
|
45617
|
+
version4 = "5.0.0-beta.35";
|
|
45589
45618
|
}
|
|
45590
45619
|
});
|
|
45591
45620
|
|
|
@@ -45760,6 +45789,41 @@ async function loadWorkflowRunEvents(runId, afterCursor) {
|
|
|
45760
45789
|
return { events: loadedEvents, cursor };
|
|
45761
45790
|
});
|
|
45762
45791
|
}
|
|
45792
|
+
function isPreconditionGuardEnabled() {
|
|
45793
|
+
return process.env.WORKFLOW_PRECONDITION_GUARD === "1";
|
|
45794
|
+
}
|
|
45795
|
+
function latestEventStateUpdatedAt(events) {
|
|
45796
|
+
const last = events[events.length - 1];
|
|
45797
|
+
if (!last) {
|
|
45798
|
+
return void 0;
|
|
45799
|
+
}
|
|
45800
|
+
const eventId = last.eventId;
|
|
45801
|
+
const underscore = eventId.lastIndexOf("_");
|
|
45802
|
+
const rawUlid = underscore === -1 ? eventId : eventId.slice(underscore + 1);
|
|
45803
|
+
return ulidToDate(rawUlid)?.getTime() ?? void 0;
|
|
45804
|
+
}
|
|
45805
|
+
function stateUpdatedAtForCreate(events) {
|
|
45806
|
+
return isPreconditionGuardEnabled() ? latestEventStateUpdatedAt(events) : void 0;
|
|
45807
|
+
}
|
|
45808
|
+
async function withPreconditionRetry(runId, log, op) {
|
|
45809
|
+
for (let attempt = 0; ; attempt++) {
|
|
45810
|
+
try {
|
|
45811
|
+
return await op(stateUpdatedAtForCreate(log.events));
|
|
45812
|
+
} catch (error95) {
|
|
45813
|
+
if (!PreconditionFailedError.is(error95) || attempt >= PRECONDITION_MAX_RELOAD_RETRIES) {
|
|
45814
|
+
throw error95;
|
|
45815
|
+
}
|
|
45816
|
+
runtimeLogger2.info("Event creation rejected as stale; reloading event log and retrying", {
|
|
45817
|
+
workflowRunId: runId,
|
|
45818
|
+
attempt: attempt + 1,
|
|
45819
|
+
maxRetries: PRECONDITION_MAX_RELOAD_RETRIES
|
|
45820
|
+
});
|
|
45821
|
+
const loaded = await loadWorkflowRunEvents(runId, log.cursor ?? void 0);
|
|
45822
|
+
appendUniqueEvents(log.events, new Set(log.events.map((e) => e.eventId)), loaded.events);
|
|
45823
|
+
log.cursor = loaded.cursor ?? log.cursor;
|
|
45824
|
+
}
|
|
45825
|
+
}
|
|
45826
|
+
}
|
|
45763
45827
|
function withHealthCheck(handler, worldSpecVersion) {
|
|
45764
45828
|
return async (req) => {
|
|
45765
45829
|
const url3 = new URL(req.url);
|
|
@@ -45830,7 +45894,7 @@ function memoizeEncryptionKey(world, runOrId) {
|
|
|
45830
45894
|
return cached3;
|
|
45831
45895
|
};
|
|
45832
45896
|
}
|
|
45833
|
-
var SAFE_WORKFLOW_NAME_PATTERN2, generateId2, HEALTH_CHECK_CORS_HEADERS;
|
|
45897
|
+
var SAFE_WORKFLOW_NAME_PATTERN2, generateId2, PRECONDITION_MAX_RELOAD_RETRIES, HEALTH_CHECK_CORS_HEADERS;
|
|
45834
45898
|
var init_helpers2 = __esm({
|
|
45835
45899
|
"../core/dist/runtime/helpers.js"() {
|
|
45836
45900
|
"use strict";
|
|
@@ -45856,6 +45920,11 @@ var init_helpers2 = __esm({
|
|
|
45856
45920
|
__name(assertEventPaginationProgress, "assertEventPaginationProgress");
|
|
45857
45921
|
__name(shouldRetryWithoutEventCursor, "shouldRetryWithoutEventCursor");
|
|
45858
45922
|
__name(loadWorkflowRunEvents, "loadWorkflowRunEvents");
|
|
45923
|
+
PRECONDITION_MAX_RELOAD_RETRIES = 2;
|
|
45924
|
+
__name(isPreconditionGuardEnabled, "isPreconditionGuardEnabled");
|
|
45925
|
+
__name(latestEventStateUpdatedAt, "latestEventStateUpdatedAt");
|
|
45926
|
+
__name(stateUpdatedAtForCreate, "stateUpdatedAtForCreate");
|
|
45927
|
+
__name(withPreconditionRetry, "withPreconditionRetry");
|
|
45859
45928
|
HEALTH_CHECK_CORS_HEADERS = {
|
|
45860
45929
|
"Access-Control-Allow-Origin": "*",
|
|
45861
45930
|
"Access-Control-Allow-Methods": "POST, OPTIONS, GET, HEAD",
|
|
@@ -71113,6 +71182,8 @@ function validateAttributeChanges(changes, context2 = {}) {
|
|
|
71113
71182
|
}
|
|
71114
71183
|
__name(validateAttributeChanges, "validateAttributeChanges");
|
|
71115
71184
|
var RESERVED_ATTRIBUTE_KEY_PREFIX;
|
|
71185
|
+
var ROOT_RUN_ID_ATTRIBUTE;
|
|
71186
|
+
var PARENT_RUN_ID_ATTRIBUTE;
|
|
71116
71187
|
var ATTRIBUTE_KEY_MAX_LENGTH;
|
|
71117
71188
|
var ATTRIBUTE_VALUE_MAX_BYTES;
|
|
71118
71189
|
var ATTRIBUTE_MAX_PER_RUN;
|
|
@@ -71125,6 +71196,8 @@ var init_attributes = __esm2({
|
|
|
71125
71196
|
"use strict";
|
|
71126
71197
|
init_zod();
|
|
71127
71198
|
RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
71199
|
+
ROOT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}rootRunId`;
|
|
71200
|
+
PARENT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId`;
|
|
71128
71201
|
ATTRIBUTE_KEY_MAX_LENGTH = 256;
|
|
71129
71202
|
ATTRIBUTE_VALUE_MAX_BYTES = 256;
|
|
71130
71203
|
ATTRIBUTE_MAX_PER_RUN = 64;
|
|
@@ -71329,6 +71402,17 @@ var init_events = __esm2({
|
|
|
71329
71402
|
// stso.
|
|
71330
71403
|
stepCount: external_exports.number().int().positive().optional(),
|
|
71331
71404
|
eventCount: external_exports.number().int().positive().optional(),
|
|
71405
|
+
// Run-started-to-first-step: milliseconds from the `run_started` response
|
|
71406
|
+
// landing (or, under turbo, the local run synthesis instant) until this
|
|
71407
|
+
// step's start POST was issued. A sub-window of ttfs. Only reported
|
|
71408
|
+
// alongside the same eligibility as ttfs.
|
|
71409
|
+
rsfs: external_exports.number().optional(),
|
|
71410
|
+
// Synchronous workflow-function replay duration of only the FINAL replay
|
|
71411
|
+
// pass within the rsfs window (the pass that scheduled the first step),
|
|
71412
|
+
// excluding awaited network I/O — not accumulated across earlier
|
|
71413
|
+
// pre-first-step passes, so it is not "the replay portion of rsfs". Only
|
|
71414
|
+
// present alongside rsfs, and only for the run's first step.
|
|
71415
|
+
finalSchedulingReplay: external_exports.number().optional(),
|
|
71332
71416
|
// Names of the runtime's optional startup-latency optimizations that were
|
|
71333
71417
|
// active for this measurement (e.g. 'turbo', 'lazyStepStart',
|
|
71334
71418
|
// 'optimisticStart'), so latency metrics can be segmented by them.
|
|
@@ -74667,6 +74751,8 @@ var StepMaxRetries;
|
|
|
74667
74751
|
var StepTracePropagated;
|
|
74668
74752
|
var StepTtfsMs;
|
|
74669
74753
|
var StepStsoMs;
|
|
74754
|
+
var StepRsfsMs;
|
|
74755
|
+
var StepFinalSchedulingReplayMs;
|
|
74670
74756
|
var StepLatencyOptimizations;
|
|
74671
74757
|
var StepSkipped;
|
|
74672
74758
|
var StepSkipReason;
|
|
@@ -74752,6 +74838,8 @@ var init_semantic_conventions = __esm2({
|
|
|
74752
74838
|
StepTracePropagated = SemanticConvention("step.trace.propagated");
|
|
74753
74839
|
StepTtfsMs = SemanticConvention("step.ttfs_ms");
|
|
74754
74840
|
StepStsoMs = SemanticConvention("step.stso_ms");
|
|
74841
|
+
StepRsfsMs = SemanticConvention("step.rsfs_ms");
|
|
74842
|
+
StepFinalSchedulingReplayMs = SemanticConvention("step.final_scheduling_replay_ms");
|
|
74755
74843
|
StepLatencyOptimizations = SemanticConvention("step.latency_optimizations");
|
|
74756
74844
|
StepSkipped = SemanticConvention("step.skipped");
|
|
74757
74845
|
StepSkipReason = SemanticConvention("step.skip_reason");
|
|
@@ -79347,7 +79435,7 @@ var version2;
|
|
|
79347
79435
|
var init_version = __esm2({
|
|
79348
79436
|
"../core/dist/version.js"() {
|
|
79349
79437
|
"use strict";
|
|
79350
|
-
version2 = "5.0.0-beta.
|
|
79438
|
+
version2 = "5.0.0-beta.35";
|
|
79351
79439
|
}
|
|
79352
79440
|
});
|
|
79353
79441
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
@@ -82609,6 +82697,7 @@ __name2(isRetryableWorldError, "isRetryableWorldError");
|
|
|
82609
82697
|
init_encryption();
|
|
82610
82698
|
init_logger();
|
|
82611
82699
|
init_serialization2();
|
|
82700
|
+
init_context_storage();
|
|
82612
82701
|
init_semantic_conventions();
|
|
82613
82702
|
init_telemetry();
|
|
82614
82703
|
init_version();
|
|
@@ -82618,6 +82707,17 @@ init_wait_until();
|
|
|
82618
82707
|
init_world_compatibility();
|
|
82619
82708
|
var CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
82620
82709
|
var ulid3 = monotonicFactory();
|
|
82710
|
+
function resolveLineageAttributes() {
|
|
82711
|
+
const store = contextStorage.getStore();
|
|
82712
|
+
const parentRunId = store?.workflowMetadata?.workflowRunId;
|
|
82713
|
+
if (!parentRunId) return void 0;
|
|
82714
|
+
return {
|
|
82715
|
+
[ROOT_RUN_ID_ATTRIBUTE]: store.rootRunId ?? parentRunId,
|
|
82716
|
+
[PARENT_RUN_ID_ATTRIBUTE]: parentRunId
|
|
82717
|
+
};
|
|
82718
|
+
}
|
|
82719
|
+
__name(resolveLineageAttributes, "resolveLineageAttributes");
|
|
82720
|
+
__name2(resolveLineageAttributes, "resolveLineageAttributes");
|
|
82621
82721
|
var hasWarnedLatestNoOp = false;
|
|
82622
82722
|
async function start(workflow, argsOrOptions, options) {
|
|
82623
82723
|
return await waitedUntil(() => {
|
|
@@ -82702,9 +82802,14 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
82702
82802
|
value
|
|
82703
82803
|
]));
|
|
82704
82804
|
}
|
|
82705
|
-
const
|
|
82706
|
-
|
|
82707
|
-
...
|
|
82805
|
+
const lineage = specVersion >= SPEC_VERSION_SUPPORTS_ATTRIBUTES ? resolveLineageAttributes() : void 0;
|
|
82806
|
+
const runAttributes = lineage ? {
|
|
82807
|
+
...lineage,
|
|
82808
|
+
...attributes
|
|
82809
|
+
} : attributes;
|
|
82810
|
+
const attributeSeed = runAttributes ? {
|
|
82811
|
+
attributes: runAttributes,
|
|
82812
|
+
...allowReservedAttributes || lineage != null ? {
|
|
82708
82813
|
allowReservedAttributes: true
|
|
82709
82814
|
} : {}
|
|
82710
82815
|
} : {};
|
|
@@ -82819,7 +82924,7 @@ __name2(start, "start");
|
|
|
82819
82924
|
value: "start",
|
|
82820
82925
|
configurable: true
|
|
82821
82926
|
});
|
|
82822
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
82927
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.35//start");
|
|
82823
82928
|
async function wakeUpRun(world, runId, options) {
|
|
82824
82929
|
try {
|
|
82825
82930
|
const run22 = await world.runs.get(runId, {
|
|
@@ -83155,7 +83260,7 @@ var Run = class _Run {
|
|
|
83155
83260
|
value: "wakeUp",
|
|
83156
83261
|
configurable: true
|
|
83157
83262
|
});
|
|
83158
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83263
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#wakeUp");
|
|
83159
83264
|
(function(__wf_fn, __wf_id) {
|
|
83160
83265
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83161
83266
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83164,7 +83269,7 @@ var Run = class _Run {
|
|
|
83164
83269
|
value: "cancel",
|
|
83165
83270
|
configurable: true
|
|
83166
83271
|
});
|
|
83167
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83272
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#cancel");
|
|
83168
83273
|
(function(__wf_fn, __wf_id) {
|
|
83169
83274
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83170
83275
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83173,7 +83278,7 @@ var Run = class _Run {
|
|
|
83173
83278
|
value: "getReadable",
|
|
83174
83279
|
configurable: true
|
|
83175
83280
|
});
|
|
83176
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83281
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#getReadable");
|
|
83177
83282
|
(function(__wf_fn, __wf_id) {
|
|
83178
83283
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83179
83284
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83182,7 +83287,7 @@ var Run = class _Run {
|
|
|
83182
83287
|
value: "exists",
|
|
83183
83288
|
configurable: true
|
|
83184
83289
|
});
|
|
83185
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83290
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#exists");
|
|
83186
83291
|
(function(__wf_fn, __wf_id) {
|
|
83187
83292
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83188
83293
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83191,7 +83296,7 @@ var Run = class _Run {
|
|
|
83191
83296
|
value: "status",
|
|
83192
83297
|
configurable: true
|
|
83193
83298
|
});
|
|
83194
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83299
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#status");
|
|
83195
83300
|
(function(__wf_fn, __wf_id) {
|
|
83196
83301
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83197
83302
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83200,7 +83305,7 @@ var Run = class _Run {
|
|
|
83200
83305
|
value: "returnValue",
|
|
83201
83306
|
configurable: true
|
|
83202
83307
|
});
|
|
83203
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83308
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#returnValue");
|
|
83204
83309
|
(function(__wf_fn, __wf_id) {
|
|
83205
83310
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83206
83311
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83209,7 +83314,7 @@ var Run = class _Run {
|
|
|
83209
83314
|
value: "workflowName",
|
|
83210
83315
|
configurable: true
|
|
83211
83316
|
});
|
|
83212
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83317
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#workflowName");
|
|
83213
83318
|
(function(__wf_fn, __wf_id) {
|
|
83214
83319
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83215
83320
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83218,7 +83323,7 @@ var Run = class _Run {
|
|
|
83218
83323
|
value: "createdAt",
|
|
83219
83324
|
configurable: true
|
|
83220
83325
|
});
|
|
83221
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83326
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#createdAt");
|
|
83222
83327
|
(function(__wf_fn, __wf_id) {
|
|
83223
83328
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83224
83329
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83227,7 +83332,7 @@ var Run = class _Run {
|
|
|
83227
83332
|
value: "startedAt",
|
|
83228
83333
|
configurable: true
|
|
83229
83334
|
});
|
|
83230
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83335
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#startedAt");
|
|
83231
83336
|
(function(__wf_fn, __wf_id) {
|
|
83232
83337
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83233
83338
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83236,7 +83341,7 @@ var Run = class _Run {
|
|
|
83236
83341
|
value: "completedAt",
|
|
83237
83342
|
configurable: true
|
|
83238
83343
|
});
|
|
83239
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
83344
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.35//Run#completedAt");
|
|
83240
83345
|
(function(__wf_cls, __wf_id) {
|
|
83241
83346
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83242
83347
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -83246,7 +83351,7 @@ var Run = class _Run {
|
|
|
83246
83351
|
enumerable: false,
|
|
83247
83352
|
configurable: false
|
|
83248
83353
|
});
|
|
83249
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
83354
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.35//Run");
|
|
83250
83355
|
async function fetch2(...args) {
|
|
83251
83356
|
return globalThis.fetch(...args);
|
|
83252
83357
|
}
|
|
@@ -83612,13 +83717,56 @@ async function hookWorkflow(token) {
|
|
|
83612
83717
|
__name(hookWorkflow, "hookWorkflow");
|
|
83613
83718
|
__name2(hookWorkflow, "hookWorkflow");
|
|
83614
83719
|
hookWorkflow.workflowId = "workflow//./workflows/inline-execution//hookWorkflow";
|
|
83720
|
+
async function noop() {
|
|
83721
|
+
}
|
|
83722
|
+
__name(noop, "noop");
|
|
83723
|
+
__name2(noop, "noop");
|
|
83724
|
+
(function(__wf_fn, __wf_id) {
|
|
83725
|
+
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83726
|
+
__wf_reg.set(__wf_id, __wf_fn);
|
|
83727
|
+
__wf_fn.stepId = __wf_id;
|
|
83728
|
+
Object.defineProperty(__wf_fn, "name", {
|
|
83729
|
+
value: "noop",
|
|
83730
|
+
configurable: true
|
|
83731
|
+
});
|
|
83732
|
+
})(noop, "step//./workflows/lineage//noop");
|
|
83733
|
+
async function bodyStartsChild() {
|
|
83734
|
+
throw new Error("You attempted to execute workflow bodyStartsChild function directly. To start a workflow, use start(bodyStartsChild) from workflow/api");
|
|
83735
|
+
}
|
|
83736
|
+
__name(bodyStartsChild, "bodyStartsChild");
|
|
83737
|
+
__name2(bodyStartsChild, "bodyStartsChild");
|
|
83738
|
+
bodyStartsChild.workflowId = "workflow//./workflows/lineage//bodyStartsChild";
|
|
83739
|
+
async function spawnedChild() {
|
|
83740
|
+
throw new Error("You attempted to execute workflow spawnedChild function directly. To start a workflow, use start(spawnedChild) from workflow/api");
|
|
83741
|
+
}
|
|
83742
|
+
__name(spawnedChild, "spawnedChild");
|
|
83743
|
+
__name2(spawnedChild, "spawnedChild");
|
|
83744
|
+
spawnedChild.workflowId = "workflow//./workflows/lineage//spawnedChild";
|
|
83745
|
+
async function chainRoot() {
|
|
83746
|
+
throw new Error("You attempted to execute workflow chainRoot function directly. To start a workflow, use start(chainRoot) from workflow/api");
|
|
83747
|
+
}
|
|
83748
|
+
__name(chainRoot, "chainRoot");
|
|
83749
|
+
__name2(chainRoot, "chainRoot");
|
|
83750
|
+
chainRoot.workflowId = "workflow//./workflows/lineage//chainRoot";
|
|
83751
|
+
async function chainMiddle() {
|
|
83752
|
+
throw new Error("You attempted to execute workflow chainMiddle function directly. To start a workflow, use start(chainMiddle) from workflow/api");
|
|
83753
|
+
}
|
|
83754
|
+
__name(chainMiddle, "chainMiddle");
|
|
83755
|
+
__name2(chainMiddle, "chainMiddle");
|
|
83756
|
+
chainMiddle.workflowId = "workflow//./workflows/lineage//chainMiddle";
|
|
83757
|
+
async function chainLeaf() {
|
|
83758
|
+
throw new Error("You attempted to execute workflow chainLeaf function directly. To start a workflow, use start(chainLeaf) from workflow/api");
|
|
83759
|
+
}
|
|
83760
|
+
__name(chainLeaf, "chainLeaf");
|
|
83761
|
+
__name2(chainLeaf, "chainLeaf");
|
|
83762
|
+
chainLeaf.workflowId = "workflow//./workflows/lineage//chainLeaf";
|
|
83615
83763
|
var count = 0;
|
|
83616
|
-
async function
|
|
83764
|
+
async function noop2(_i) {
|
|
83617
83765
|
count++;
|
|
83618
83766
|
return count;
|
|
83619
83767
|
}
|
|
83620
|
-
__name(
|
|
83621
|
-
__name2(
|
|
83768
|
+
__name(noop2, "noop2");
|
|
83769
|
+
__name2(noop2, "noop");
|
|
83622
83770
|
(function(__wf_fn, __wf_id) {
|
|
83623
83771
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
83624
83772
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -83627,7 +83775,7 @@ __name2(noop, "noop");
|
|
|
83627
83775
|
value: "noop",
|
|
83628
83776
|
configurable: true
|
|
83629
83777
|
});
|
|
83630
|
-
})(
|
|
83778
|
+
})(noop2, "step//./workflows/noop//noop");
|
|
83631
83779
|
async function brokenWf() {
|
|
83632
83780
|
throw new Error("You attempted to execute workflow brokenWf function directly. To start a workflow, use start(brokenWf) from workflow/api");
|
|
83633
83781
|
}
|
|
@@ -83997,6 +84145,18 @@ var config3 = once3(() => {
|
|
|
83997
84145
|
const baseUrl = getBaseUrlFromEnv();
|
|
83998
84146
|
return { dataDir, baseUrl };
|
|
83999
84147
|
});
|
|
84148
|
+
function resolveRecoverActiveRuns(config4) {
|
|
84149
|
+
if (config4.recoverActiveRuns !== void 0) {
|
|
84150
|
+
return config4.recoverActiveRuns;
|
|
84151
|
+
}
|
|
84152
|
+
const raw = process.env.WORKFLOW_LOCAL_RECOVER_ACTIVE_RUNS?.toLowerCase();
|
|
84153
|
+
if (raw === "0" || raw === "false")
|
|
84154
|
+
return false;
|
|
84155
|
+
if (raw === "1" || raw === "true")
|
|
84156
|
+
return true;
|
|
84157
|
+
return true;
|
|
84158
|
+
}
|
|
84159
|
+
__name(resolveRecoverActiveRuns, "resolveRecoverActiveRuns");
|
|
84000
84160
|
function resolveDirectBaseUrl(config4) {
|
|
84001
84161
|
return config4.baseUrl ?? process.env.WORKFLOW_LOCAL_BASE_URL ?? createWorkflowBaseUrl("http://localhost");
|
|
84002
84162
|
}
|
|
@@ -87193,7 +87353,7 @@ function createWorld(args) {
|
|
|
87193
87353
|
const tag = mergedConfig.tag;
|
|
87194
87354
|
const queue = createQueue(mergedConfig);
|
|
87195
87355
|
const { clearCache: clearStorageCache, ...storage } = createStorage(mergedConfig.dataDir, tag);
|
|
87196
|
-
const recoverActiveRuns = mergedConfig
|
|
87356
|
+
const recoverActiveRuns = resolveRecoverActiveRuns(mergedConfig);
|
|
87197
87357
|
return {
|
|
87198
87358
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
87199
87359
|
...queue,
|
|
@@ -87955,13 +88115,155 @@ async function handleReplayBudgetExhausted(args) {
|
|
|
87955
88115
|
}
|
|
87956
88116
|
__name(handleReplayBudgetExhausted, "handleReplayBudgetExhausted");
|
|
87957
88117
|
|
|
88118
|
+
// ../world-vercel/dist/run-id/codec.js
|
|
88119
|
+
var ENCODING3 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
88120
|
+
var DECODE_TABLE = (() => {
|
|
88121
|
+
const table = new Int8Array(128).fill(-1);
|
|
88122
|
+
for (let i = 0; i < ENCODING3.length; i++) {
|
|
88123
|
+
table[ENCODING3.charCodeAt(i)] = i;
|
|
88124
|
+
}
|
|
88125
|
+
for (let i = 0; i < ENCODING3.length; i++) {
|
|
88126
|
+
const lower = ENCODING3[i].toLowerCase();
|
|
88127
|
+
if (lower !== ENCODING3[i]) {
|
|
88128
|
+
table[lower.charCodeAt(0)] = i;
|
|
88129
|
+
}
|
|
88130
|
+
}
|
|
88131
|
+
return table;
|
|
88132
|
+
})();
|
|
88133
|
+
var ULID_LENGTH = 26;
|
|
88134
|
+
var ULID_BYTE_LENGTH = 16;
|
|
88135
|
+
var TAG_BIT_MASK = 128;
|
|
88136
|
+
var REGION_MASK = 252;
|
|
88137
|
+
var VERSION_HIGH_MASK = 3;
|
|
88138
|
+
var VERSION_LOW_MASK = 224;
|
|
88139
|
+
var REGION_BYTE_INDEX = 6;
|
|
88140
|
+
var VERSION_LOW_BYTE_INDEX = 7;
|
|
88141
|
+
var VERSION_BIT_WIDTH = 5;
|
|
88142
|
+
var REGION_BIT_WIDTH = 6;
|
|
88143
|
+
var MAX_VERSION = (1 << VERSION_BIT_WIDTH) - 1;
|
|
88144
|
+
var MAX_REGION = (1 << REGION_BIT_WIDTH) - 1;
|
|
88145
|
+
function ulidToBytes(ulid8) {
|
|
88146
|
+
if (typeof ulid8 !== "string") {
|
|
88147
|
+
throw new TypeError(`Expected ULID string, got ${typeof ulid8}`);
|
|
88148
|
+
}
|
|
88149
|
+
if (ulid8.length !== ULID_LENGTH) {
|
|
88150
|
+
throw new Error(`Invalid ULID length: expected ${ULID_LENGTH}, got ${ulid8.length}`);
|
|
88151
|
+
}
|
|
88152
|
+
const values = new Uint8Array(ULID_LENGTH);
|
|
88153
|
+
for (let i = 0; i < ULID_LENGTH; i++) {
|
|
88154
|
+
const code3 = ulid8.charCodeAt(i);
|
|
88155
|
+
const v = code3 < 128 ? DECODE_TABLE[code3] : -1;
|
|
88156
|
+
if (v < 0) {
|
|
88157
|
+
throw new Error(`Invalid Crockford-Base32 character at index ${i}: ${JSON.stringify(ulid8[i])}`);
|
|
88158
|
+
}
|
|
88159
|
+
values[i] = v;
|
|
88160
|
+
}
|
|
88161
|
+
if ((values[0] & 24) !== 0) {
|
|
88162
|
+
throw new Error(`Invalid ULID: top 2 bits must be zero (first char > '7'): ${JSON.stringify(ulid8[0])}`);
|
|
88163
|
+
}
|
|
88164
|
+
const out = new Uint8Array(ULID_BYTE_LENGTH);
|
|
88165
|
+
let bitBuf = values[0] & 7;
|
|
88166
|
+
let bitCount = 3;
|
|
88167
|
+
let outIdx = 0;
|
|
88168
|
+
for (let i = 1; i < ULID_LENGTH; i++) {
|
|
88169
|
+
bitBuf = bitBuf << 5 | values[i];
|
|
88170
|
+
bitCount += 5;
|
|
88171
|
+
while (bitCount >= 8) {
|
|
88172
|
+
bitCount -= 8;
|
|
88173
|
+
out[outIdx++] = bitBuf >> bitCount & 255;
|
|
88174
|
+
}
|
|
88175
|
+
}
|
|
88176
|
+
if (outIdx !== ULID_BYTE_LENGTH || bitCount !== 0) {
|
|
88177
|
+
throw new Error("Internal error: ULID bit packing did not consume cleanly");
|
|
88178
|
+
}
|
|
88179
|
+
return out;
|
|
88180
|
+
}
|
|
88181
|
+
__name(ulidToBytes, "ulidToBytes");
|
|
88182
|
+
function bytesToUlid(bytes) {
|
|
88183
|
+
if (bytes.length !== ULID_BYTE_LENGTH) {
|
|
88184
|
+
throw new Error(`Invalid byte length: expected ${ULID_BYTE_LENGTH}, got ${bytes.length}`);
|
|
88185
|
+
}
|
|
88186
|
+
let bitBuf = 0;
|
|
88187
|
+
let bitCount = 0;
|
|
88188
|
+
bitBuf = 0;
|
|
88189
|
+
bitCount = 2;
|
|
88190
|
+
let out = "";
|
|
88191
|
+
for (let i = 0; i < ULID_BYTE_LENGTH; i++) {
|
|
88192
|
+
bitBuf = bitBuf << 8 | bytes[i];
|
|
88193
|
+
bitCount += 8;
|
|
88194
|
+
while (bitCount >= 5) {
|
|
88195
|
+
bitCount -= 5;
|
|
88196
|
+
out += ENCODING3[bitBuf >> bitCount & 31];
|
|
88197
|
+
}
|
|
88198
|
+
}
|
|
88199
|
+
if (out.length !== ULID_LENGTH || bitCount !== 0) {
|
|
88200
|
+
throw new Error("Internal error: ULID bit packing did not flush cleanly");
|
|
88201
|
+
}
|
|
88202
|
+
return out;
|
|
88203
|
+
}
|
|
88204
|
+
__name(bytesToUlid, "bytesToUlid");
|
|
88205
|
+
|
|
88206
|
+
// ../world-vercel/dist/run-id/regions.js
|
|
88207
|
+
var REGION_IDS = {
|
|
88208
|
+
unknown: 0,
|
|
88209
|
+
iad1: 1,
|
|
88210
|
+
sfo1: 2,
|
|
88211
|
+
pdx1: 3,
|
|
88212
|
+
cle1: 4,
|
|
88213
|
+
yul1: 5,
|
|
88214
|
+
gru1: 6,
|
|
88215
|
+
dub1: 7,
|
|
88216
|
+
lhr1: 8,
|
|
88217
|
+
cdg1: 9,
|
|
88218
|
+
fra1: 10,
|
|
88219
|
+
bru1: 11,
|
|
88220
|
+
arn1: 12,
|
|
88221
|
+
hel1: 13,
|
|
88222
|
+
zrh1: 14,
|
|
88223
|
+
cpt1: 15,
|
|
88224
|
+
dxb1: 16,
|
|
88225
|
+
bom1: 17,
|
|
88226
|
+
sin1: 18,
|
|
88227
|
+
hkg1: 19,
|
|
88228
|
+
hnd1: 20,
|
|
88229
|
+
icn1: 21,
|
|
88230
|
+
kix1: 22,
|
|
88231
|
+
syd1: 23
|
|
88232
|
+
};
|
|
88233
|
+
var REGION_CODES_BY_ID = new Map(Object.entries(REGION_IDS).filter((entry) => entry[0] !== "unknown").map(([code3, id]) => [id, code3]));
|
|
88234
|
+
function lookupRegion(regionId) {
|
|
88235
|
+
return REGION_CODES_BY_ID.get(regionId) ?? null;
|
|
88236
|
+
}
|
|
88237
|
+
__name(lookupRegion, "lookupRegion");
|
|
88238
|
+
|
|
88239
|
+
// ../world-vercel/dist/run-id/index.js
|
|
88240
|
+
function decode5(taggedUlid) {
|
|
88241
|
+
const bytes = ulidToBytes(taggedUlid);
|
|
88242
|
+
const tagged = (bytes[0] & TAG_BIT_MASK) !== 0;
|
|
88243
|
+
bytes[0] = bytes[0] & ~TAG_BIT_MASK;
|
|
88244
|
+
const ulid8 = bytesToUlid(bytes);
|
|
88245
|
+
if (!tagged) {
|
|
88246
|
+
return { tagged: false, ulid: ulid8, version: null, regionId: null, region: null };
|
|
88247
|
+
}
|
|
88248
|
+
const regionId = (bytes[REGION_BYTE_INDEX] & REGION_MASK) >> 2;
|
|
88249
|
+
const version5 = (bytes[REGION_BYTE_INDEX] & VERSION_HIGH_MASK) << 3 | (bytes[VERSION_LOW_BYTE_INDEX] & VERSION_LOW_MASK) >> 5;
|
|
88250
|
+
return {
|
|
88251
|
+
tagged: true,
|
|
88252
|
+
ulid: ulid8,
|
|
88253
|
+
version: version5,
|
|
88254
|
+
regionId,
|
|
88255
|
+
region: lookupRegion(regionId)
|
|
88256
|
+
};
|
|
88257
|
+
}
|
|
88258
|
+
__name(decode5, "decode");
|
|
88259
|
+
|
|
87958
88260
|
// ../core/dist/runtime/run-id-time.js
|
|
87959
88261
|
init_node2();
|
|
87960
88262
|
var RUN_ID_PREFIX = "wrun_";
|
|
87961
88263
|
function runIdCreatedAt(runId) {
|
|
87962
88264
|
const ulidPart = runId.startsWith(RUN_ID_PREFIX) ? runId.slice(RUN_ID_PREFIX.length) : runId;
|
|
87963
88265
|
try {
|
|
87964
|
-
return decodeTime(ulidPart);
|
|
88266
|
+
return decodeTime(decode5(ulidPart).ulid);
|
|
87965
88267
|
} catch {
|
|
87966
88268
|
return void 0;
|
|
87967
88269
|
}
|
|
@@ -88107,6 +88409,7 @@ __name(getPortLazy, "getPortLazy");
|
|
|
88107
88409
|
init_helpers2();
|
|
88108
88410
|
|
|
88109
88411
|
// ../core/dist/runtime/step-latency.js
|
|
88412
|
+
var MAX_CLOCK_SKEW_MS = 6e4;
|
|
88110
88413
|
var TTFS_DISQUALIFYING_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
88111
88414
|
"step_created",
|
|
88112
88415
|
"step_started",
|
|
@@ -88148,6 +88451,7 @@ function computeStepLatencyTracking(params) {
|
|
|
88148
88451
|
stepCount = terminalStepIds.size;
|
|
88149
88452
|
eventCount = events.length;
|
|
88150
88453
|
}
|
|
88454
|
+
const rsfsEligible = ttfsEligible && params.runStartedReceivedAtMs !== void 0;
|
|
88151
88455
|
if (!ttfsEligible && prevStepEndMs === void 0) {
|
|
88152
88456
|
return void 0;
|
|
88153
88457
|
}
|
|
@@ -88159,6 +88463,10 @@ function computeStepLatencyTracking(params) {
|
|
|
88159
88463
|
preStepBlockingMs: preStepAttrStartMs !== void 0 ? params.preStepBlockingBeforeAttrMs ?? 0 : params.preStepBlockingMs,
|
|
88160
88464
|
...preStepAttrStartMs !== void 0 ? { preStepAttrStartMs } : {}
|
|
88161
88465
|
} : {},
|
|
88466
|
+
...rsfsEligible ? {
|
|
88467
|
+
rsfsAnchorMs: params.runStartedReceivedAtMs,
|
|
88468
|
+
replayMs: params.replayMs
|
|
88469
|
+
} : {},
|
|
88162
88470
|
...prevStepEndMs !== void 0 ? { prevStepEndMs, stepCount, eventCount } : {},
|
|
88163
88471
|
turbo: params.turbo
|
|
88164
88472
|
};
|
|
@@ -88170,8 +88478,12 @@ function computeStepLatencyEventData(params) {
|
|
|
88170
88478
|
return void 0;
|
|
88171
88479
|
}
|
|
88172
88480
|
const ttfsEndMs = tracking.preStepAttrStartMs ?? params.stepCodeStartedAtMs;
|
|
88173
|
-
const
|
|
88174
|
-
const
|
|
88481
|
+
const rawTtfs = tracking.ttfsAnchorMs !== void 0 ? ttfsEndMs - tracking.ttfsAnchorMs - (tracking.preStepBlockingMs ?? 0) : void 0;
|
|
88482
|
+
const ttfs = rawTtfs !== void 0 && rawTtfs >= -MAX_CLOCK_SKEW_MS ? Math.max(0, rawTtfs) : void 0;
|
|
88483
|
+
const rawStso = tracking.prevStepEndMs !== void 0 ? params.stepCodeStartedAtMs - tracking.prevStepEndMs : void 0;
|
|
88484
|
+
const stso = rawStso !== void 0 && rawStso >= -MAX_CLOCK_SKEW_MS ? Math.max(0, rawStso) : void 0;
|
|
88485
|
+
const rsfs = tracking.rsfsAnchorMs !== void 0 && params.stepStartPostSentAtMs !== void 0 ? Math.max(0, params.stepStartPostSentAtMs - tracking.rsfsAnchorMs) : void 0;
|
|
88486
|
+
const finalSchedulingReplay = tracking.replayMs !== void 0 ? Math.max(0, tracking.replayMs) : void 0;
|
|
88175
88487
|
if (ttfs === void 0 && stso === void 0) {
|
|
88176
88488
|
return void 0;
|
|
88177
88489
|
}
|
|
@@ -88187,6 +88499,8 @@ function computeStepLatencyEventData(params) {
|
|
|
88187
88499
|
...stso !== void 0 ? { stso } : {},
|
|
88188
88500
|
...stso !== void 0 && tracking.stepCount !== void 0 ? { stepCount: tracking.stepCount } : {},
|
|
88189
88501
|
...stso !== void 0 && tracking.eventCount !== void 0 ? { eventCount: tracking.eventCount } : {},
|
|
88502
|
+
...rsfs !== void 0 ? { rsfs } : {},
|
|
88503
|
+
...finalSchedulingReplay !== void 0 ? { finalSchedulingReplay } : {},
|
|
88190
88504
|
optimizations
|
|
88191
88505
|
};
|
|
88192
88506
|
}
|
|
@@ -88322,6 +88636,7 @@ async function executeStep(params) {
|
|
|
88322
88636
|
}, "startErrorToResult");
|
|
88323
88637
|
const optimisticStart = params.lazyStepInput !== void 0 && (isOptimisticInlineStartEnabled() || params.forceOptimisticStart === true && !isOptimisticInlineStartExplicitlyDisabled());
|
|
88324
88638
|
let step;
|
|
88639
|
+
let stepStartPostSentAtMs;
|
|
88325
88640
|
let optimisticStartSettled;
|
|
88326
88641
|
const reconcileOptimisticStart = /* @__PURE__ */ __name(async () => {
|
|
88327
88642
|
if (!optimisticStartSettled)
|
|
@@ -88335,18 +88650,21 @@ async function executeStep(params) {
|
|
|
88335
88650
|
return mapped;
|
|
88336
88651
|
}, "reconcileOptimisticStart");
|
|
88337
88652
|
if (optimisticStart) {
|
|
88338
|
-
const startedPromise = (params.runReadyBarrier ?? Promise.resolve()).then(() =>
|
|
88339
|
-
|
|
88340
|
-
|
|
88341
|
-
|
|
88342
|
-
|
|
88343
|
-
|
|
88344
|
-
|
|
88345
|
-
|
|
88346
|
-
|
|
88347
|
-
|
|
88348
|
-
|
|
88349
|
-
|
|
88653
|
+
const startedPromise = (params.runReadyBarrier ?? Promise.resolve()).then(() => {
|
|
88654
|
+
stepStartPostSentAtMs = Date.now();
|
|
88655
|
+
return world.events.create(workflowRunId, {
|
|
88656
|
+
eventType: "step_started",
|
|
88657
|
+
specVersion: SPEC_VERSION_CURRENT2,
|
|
88658
|
+
correlationId: stepId,
|
|
88659
|
+
eventData: {
|
|
88660
|
+
stepName,
|
|
88661
|
+
workflowName,
|
|
88662
|
+
input: params.lazyStepInput,
|
|
88663
|
+
// Inline-ownership stamp — see StepExecutorParams.ownerMessageId.
|
|
88664
|
+
...params.ownerMessageId !== void 0 ? { ownerMessageId: params.ownerMessageId } : {}
|
|
88665
|
+
}
|
|
88666
|
+
});
|
|
88667
|
+
});
|
|
88350
88668
|
optimisticStartSettled = startedPromise.then(() => ({ ok: true }), (err) => ({ ok: false, err }));
|
|
88351
88669
|
const now = /* @__PURE__ */ new Date();
|
|
88352
88670
|
step = {
|
|
@@ -88363,6 +88681,7 @@ async function executeStep(params) {
|
|
|
88363
88681
|
} else {
|
|
88364
88682
|
try {
|
|
88365
88683
|
const ownershipStamp = params.ownerMessageId !== void 0 ? { ownerMessageId: params.ownerMessageId } : {};
|
|
88684
|
+
stepStartPostSentAtMs = Date.now();
|
|
88366
88685
|
const startResult = await world.events.create(workflowRunId, {
|
|
88367
88686
|
eventType: "step_started",
|
|
88368
88687
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
@@ -88442,6 +88761,19 @@ async function executeStep(params) {
|
|
|
88442
88761
|
const ops = [];
|
|
88443
88762
|
let opsSettled = true;
|
|
88444
88763
|
let latencyEventData;
|
|
88764
|
+
const backfillOptimisticRsfs = /* @__PURE__ */ __name(() => {
|
|
88765
|
+
if (!latencyEventData || latencyEventData.rsfs !== void 0)
|
|
88766
|
+
return;
|
|
88767
|
+
const anchorMs = params.latencyTracking?.rsfsAnchorMs;
|
|
88768
|
+
if (anchorMs === void 0 || stepStartPostSentAtMs === void 0)
|
|
88769
|
+
return;
|
|
88770
|
+
latencyEventData.rsfs = Math.max(0, stepStartPostSentAtMs - anchorMs);
|
|
88771
|
+
if (span) {
|
|
88772
|
+
span.setAttributes({
|
|
88773
|
+
...StepRsfsMs2(latencyEventData.rsfs)
|
|
88774
|
+
});
|
|
88775
|
+
}
|
|
88776
|
+
}, "backfillOptimisticRsfs");
|
|
88445
88777
|
try {
|
|
88446
88778
|
const attempt = step.attempt;
|
|
88447
88779
|
if (!step.startedAt) {
|
|
@@ -88470,12 +88802,15 @@ async function executeStep(params) {
|
|
|
88470
88802
|
stepCodeStartedAtMs: executionStartTime,
|
|
88471
88803
|
attempt,
|
|
88472
88804
|
lazyStepStart: params.lazyStepInput !== void 0,
|
|
88473
|
-
optimisticStart
|
|
88805
|
+
optimisticStart,
|
|
88806
|
+
stepStartPostSentAtMs
|
|
88474
88807
|
});
|
|
88475
88808
|
if (latencyEventData) {
|
|
88476
88809
|
span?.setAttributes({
|
|
88477
88810
|
...latencyEventData.ttfs !== void 0 ? StepTtfsMs2(latencyEventData.ttfs) : {},
|
|
88478
88811
|
...latencyEventData.stso !== void 0 ? StepStsoMs2(latencyEventData.stso) : {},
|
|
88812
|
+
...latencyEventData.rsfs !== void 0 ? StepRsfsMs2(latencyEventData.rsfs) : {},
|
|
88813
|
+
...latencyEventData.finalSchedulingReplay !== void 0 ? StepFinalSchedulingReplayMs2(latencyEventData.finalSchedulingReplay) : {},
|
|
88479
88814
|
...StepLatencyOptimizations2(latencyEventData.optimizations ?? [])
|
|
88480
88815
|
});
|
|
88481
88816
|
}
|
|
@@ -88496,6 +88831,7 @@ async function executeStep(params) {
|
|
|
88496
88831
|
features: { encryption: !!encryptionKey }
|
|
88497
88832
|
},
|
|
88498
88833
|
workflowDeploymentId: params.workflowDeploymentId,
|
|
88834
|
+
rootRunId: params.rootRunId,
|
|
88499
88835
|
ops,
|
|
88500
88836
|
preCompletionOps,
|
|
88501
88837
|
closureVars: hydratedInput.closureVars,
|
|
@@ -88565,6 +88901,7 @@ async function executeStep(params) {
|
|
|
88565
88901
|
const reconcile = await reconcileOptimisticStart();
|
|
88566
88902
|
if (reconcile)
|
|
88567
88903
|
return reconcile;
|
|
88904
|
+
backfillOptimisticRsfs();
|
|
88568
88905
|
}
|
|
88569
88906
|
if (preCompletionOps.length > 0) {
|
|
88570
88907
|
await Promise.all(preCompletionOps).catch(() => {
|
|
@@ -88575,6 +88912,7 @@ async function executeStep(params) {
|
|
|
88575
88912
|
const reconcile = await reconcileOptimisticStart();
|
|
88576
88913
|
if (reconcile)
|
|
88577
88914
|
return reconcile;
|
|
88915
|
+
backfillOptimisticRsfs();
|
|
88578
88916
|
}
|
|
88579
88917
|
if (preCompletionOps.length > 0) {
|
|
88580
88918
|
await Promise.all(preCompletionOps).catch(() => {
|
|
@@ -88853,9 +89191,10 @@ init_logger2();
|
|
|
88853
89191
|
init_serialization4();
|
|
88854
89192
|
init_semantic_conventions2();
|
|
88855
89193
|
init_util4();
|
|
88856
|
-
|
|
89194
|
+
init_helpers2();
|
|
89195
|
+
async function createHookEvent({ runId, hookEvent, queueItem, requestId, createEvent }) {
|
|
88857
89196
|
try {
|
|
88858
|
-
const result = await
|
|
89197
|
+
const result = await createEvent(hookEvent, {
|
|
88859
89198
|
requestId
|
|
88860
89199
|
});
|
|
88861
89200
|
if (result.event?.eventType === "hook_conflict") {
|
|
@@ -88893,7 +89232,7 @@ async function createHookEvent({ world, runId, hookEvent, queueItem, requestId }
|
|
|
88893
89232
|
}
|
|
88894
89233
|
}
|
|
88895
89234
|
__name(createHookEvent, "createHookEvent");
|
|
88896
|
-
async function handleSuspension({ suspension, world, run: run3, span, requestId, runReadyBarrier }) {
|
|
89235
|
+
async function handleSuspension({ suspension, world, run: run3, span, requestId, eventLog, runReadyBarrier }) {
|
|
88897
89236
|
const runId = run3.runId;
|
|
88898
89237
|
const ensureRunReady = /* @__PURE__ */ __name(async () => {
|
|
88899
89238
|
if (runReadyBarrier) {
|
|
@@ -88903,6 +89242,12 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
88903
89242
|
}
|
|
88904
89243
|
}
|
|
88905
89244
|
}, "ensureRunReady");
|
|
89245
|
+
const createGuarded = /* @__PURE__ */ __name((data, params) => {
|
|
89246
|
+
if (!eventLog) {
|
|
89247
|
+
return world.events.create(runId, data, params);
|
|
89248
|
+
}
|
|
89249
|
+
return withPreconditionRetry(runId, eventLog, (stateUpdatedAt) => world.events.create(runId, data, { ...params, stateUpdatedAt }));
|
|
89250
|
+
}, "createGuarded");
|
|
88906
89251
|
const stepItems = suspension.steps.filter((item) => item.type === "step");
|
|
88907
89252
|
const allHookItems = suspension.steps.filter((item) => item.type === "hook");
|
|
88908
89253
|
const waitItems = suspension.steps.filter((item) => item.type === "wait");
|
|
@@ -88933,7 +89278,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
88933
89278
|
}
|
|
88934
89279
|
};
|
|
88935
89280
|
try {
|
|
88936
|
-
await
|
|
89281
|
+
await createGuarded(hookDisposedEvent, { requestId });
|
|
88937
89282
|
} catch (err) {
|
|
88938
89283
|
if (EntityConflictError2.is(err)) {
|
|
88939
89284
|
runtimeLogger2.info("Hook already disposed, skipping duplicate disposal", {
|
|
@@ -88982,11 +89327,11 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
88982
89327
|
}
|
|
88983
89328
|
};
|
|
88984
89329
|
const result = await createHookEvent({
|
|
88985
|
-
world,
|
|
88986
89330
|
runId,
|
|
88987
89331
|
hookEvent,
|
|
88988
89332
|
queueItem,
|
|
88989
|
-
requestId
|
|
89333
|
+
requestId,
|
|
89334
|
+
createEvent: createGuarded
|
|
88990
89335
|
});
|
|
88991
89336
|
hasHookConflict ||= result.hasHookConflict;
|
|
88992
89337
|
hasAwaitedHookCreation ||= result.hasAwaitedHookCreation;
|
|
@@ -89005,7 +89350,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
89005
89350
|
await Promise.all(hooksNeedingAbort.map(async (queueItem) => {
|
|
89006
89351
|
try {
|
|
89007
89352
|
const abortPayload = await dehydrateStepArguments2({ aborted: true, reason: queueItem.abortReason }, runId, encryptionKey, suspension.globalThis, false, compression);
|
|
89008
|
-
await
|
|
89353
|
+
await createGuarded({
|
|
89009
89354
|
eventType: "hook_received",
|
|
89010
89355
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
89011
89356
|
correlationId: queueItem.correlationId,
|
|
@@ -89070,7 +89415,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
89070
89415
|
};
|
|
89071
89416
|
try {
|
|
89072
89417
|
await ensureRunReady();
|
|
89073
|
-
await
|
|
89418
|
+
await createGuarded(stepEvent, { requestId });
|
|
89074
89419
|
createdStepCorrelationIds.add(queueItem.correlationId);
|
|
89075
89420
|
} catch (err) {
|
|
89076
89421
|
if (EntityConflictError2.is(err)) {
|
|
@@ -89099,7 +89444,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId,
|
|
|
89099
89444
|
};
|
|
89100
89445
|
try {
|
|
89101
89446
|
await ensureRunReady();
|
|
89102
|
-
await
|
|
89447
|
+
await createGuarded(waitEvent, { requestId });
|
|
89103
89448
|
} catch (err) {
|
|
89104
89449
|
if (EntityConflictError2.is(err)) {
|
|
89105
89450
|
runtimeLogger2.info("Wait already exists, continuing", {
|
|
@@ -89277,7 +89622,7 @@ var StringReader = class {
|
|
|
89277
89622
|
return idx === -1 ? buffer3.length : idx;
|
|
89278
89623
|
}
|
|
89279
89624
|
};
|
|
89280
|
-
function
|
|
89625
|
+
function decode6(mappings) {
|
|
89281
89626
|
const { length } = mappings;
|
|
89282
89627
|
const reader = new StringReader(mappings);
|
|
89283
89628
|
const decoded = [];
|
|
@@ -89319,7 +89664,7 @@ function decode5(mappings) {
|
|
|
89319
89664
|
} while (reader.pos <= length);
|
|
89320
89665
|
return decoded;
|
|
89321
89666
|
}
|
|
89322
|
-
__name(
|
|
89667
|
+
__name(decode6, "decode");
|
|
89323
89668
|
function sort(line) {
|
|
89324
89669
|
line.sort(sortComparator);
|
|
89325
89670
|
}
|
|
@@ -89674,7 +90019,7 @@ function cast(map3) {
|
|
|
89674
90019
|
__name(cast, "cast");
|
|
89675
90020
|
function decodedMappings(map3) {
|
|
89676
90021
|
var _a3;
|
|
89677
|
-
return (_a3 = cast(map3))._decoded || (_a3._decoded =
|
|
90022
|
+
return (_a3 = cast(map3))._decoded || (_a3._decoded = decode6(cast(map3)._encoded));
|
|
89678
90023
|
}
|
|
89679
90024
|
__name(decodedMappings, "decodedMappings");
|
|
89680
90025
|
function originalPositionFor(map3, needle) {
|
|
@@ -91585,6 +91930,7 @@ init_capabilities2();
|
|
|
91585
91930
|
init_encryption3();
|
|
91586
91931
|
init_logger2();
|
|
91587
91932
|
init_serialization4();
|
|
91933
|
+
init_context_storage2();
|
|
91588
91934
|
init_semantic_conventions2();
|
|
91589
91935
|
init_telemetry2();
|
|
91590
91936
|
init_version3();
|
|
@@ -91961,6 +92307,10 @@ function hasRecordedTerminalRunEvent(events, runId) {
|
|
|
91961
92307
|
return true;
|
|
91962
92308
|
}
|
|
91963
92309
|
__name(hasRecordedTerminalRunEvent, "hasRecordedTerminalRunEvent");
|
|
92310
|
+
function rootRunIdFrom(attributes, runId) {
|
|
92311
|
+
return attributes?.[ROOT_RUN_ID_ATTRIBUTE2] ?? runId;
|
|
92312
|
+
}
|
|
92313
|
+
__name(rootRunIdFrom, "rootRunIdFrom");
|
|
91964
92314
|
function hasOpenHookOrWait(events) {
|
|
91965
92315
|
const disposedHookIds = /* @__PURE__ */ new Set();
|
|
91966
92316
|
const completedWaitIds = /* @__PURE__ */ new Set();
|
|
@@ -92064,6 +92414,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92064
92414
|
let preloadedEvents;
|
|
92065
92415
|
let preloadedEventsCursor;
|
|
92066
92416
|
let invocationStartedClean;
|
|
92417
|
+
let runStartedReceivedAtMs;
|
|
92067
92418
|
let preStepBlockingMs = 0;
|
|
92068
92419
|
let preStepBlockingBeforeAttrMs;
|
|
92069
92420
|
const turbo = isTurboEnabled() && runInput !== void 0 && metadata.attempt === 1 && incomingStepId === void 0 && !replayDivergence;
|
|
@@ -92115,6 +92466,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92115
92466
|
workflowDeploymentId: bgRun.deploymentId,
|
|
92116
92467
|
workflowName,
|
|
92117
92468
|
workflowStartedAt: bgStartedAt,
|
|
92469
|
+
rootRunId: rootRunIdFrom(bgRun.attributes, runId),
|
|
92118
92470
|
stepId: incomingStepId,
|
|
92119
92471
|
stepName: incomingStepName,
|
|
92120
92472
|
runSpecVersion: bgRun.specVersion
|
|
@@ -92258,6 +92610,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92258
92610
|
updatedAt: now
|
|
92259
92611
|
};
|
|
92260
92612
|
workflowStartedAt = +now;
|
|
92613
|
+
runStartedReceivedAtMs = +now;
|
|
92261
92614
|
span?.setAttributes({
|
|
92262
92615
|
...WorkflowRunStatus2("running"),
|
|
92263
92616
|
...WorkflowStartedAt2(workflowStartedAt)
|
|
@@ -92270,6 +92623,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92270
92623
|
throw new WorkflowRuntimeError2(`Event creation for 'run_started' did not return the run entity for run "${runId}"`);
|
|
92271
92624
|
}
|
|
92272
92625
|
workflowRun = result.run;
|
|
92626
|
+
runStartedReceivedAtMs = Date.now();
|
|
92273
92627
|
if (result.events && result.events.length > 0 && result.hasMore !== true) {
|
|
92274
92628
|
preloadedEvents = result.events;
|
|
92275
92629
|
preloadedEventsCursor = result.cursor;
|
|
@@ -92406,10 +92760,15 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92406
92760
|
}
|
|
92407
92761
|
}));
|
|
92408
92762
|
for (const waitEvent of waitsToComplete) {
|
|
92763
|
+
const waitLog = {
|
|
92764
|
+
events,
|
|
92765
|
+
cursor: eventsCursor
|
|
92766
|
+
};
|
|
92409
92767
|
try {
|
|
92410
|
-
await world.events.create(runId, waitEvent, {
|
|
92411
|
-
requestId
|
|
92412
|
-
|
|
92768
|
+
await withPreconditionRetry(runId, waitLog, (stateUpdatedAt) => world.events.create(runId, waitEvent, {
|
|
92769
|
+
requestId,
|
|
92770
|
+
stateUpdatedAt
|
|
92771
|
+
}));
|
|
92413
92772
|
} catch (err) {
|
|
92414
92773
|
if (EntityConflictError2.is(err)) {
|
|
92415
92774
|
runtimeLogger2.info("Wait already completed, skipping", {
|
|
@@ -92419,6 +92778,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92419
92778
|
continue;
|
|
92420
92779
|
}
|
|
92421
92780
|
throw err;
|
|
92781
|
+
} finally {
|
|
92782
|
+
eventsCursor = waitLog.cursor;
|
|
92422
92783
|
}
|
|
92423
92784
|
}
|
|
92424
92785
|
if (waitsToComplete.length > 0) {
|
|
@@ -92481,7 +92842,10 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92481
92842
|
eventType: "run_completed",
|
|
92482
92843
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
92483
92844
|
eventData: { output: result }
|
|
92484
|
-
}, {
|
|
92845
|
+
}, {
|
|
92846
|
+
requestId,
|
|
92847
|
+
stateUpdatedAt: stateUpdatedAtForCreate(events)
|
|
92848
|
+
});
|
|
92485
92849
|
} catch (err) {
|
|
92486
92850
|
if (EntityConflictError2.is(err) || RunExpiredError.is(err)) {
|
|
92487
92851
|
runtimeLogger2.info("Tried completing workflow run, but run has already finished.", { workflowRunId: runId, message: err.message });
|
|
@@ -92495,10 +92859,11 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92495
92859
|
return;
|
|
92496
92860
|
} catch (err) {
|
|
92497
92861
|
if (WorkflowSuspension2.is(err)) {
|
|
92862
|
+
const replayDurationMs = Date.now() - replayStart;
|
|
92498
92863
|
runtimeLogger2.debug("Workflow suspended", {
|
|
92499
92864
|
workflowRunId: runId,
|
|
92500
92865
|
loopIteration,
|
|
92501
|
-
replayMs:
|
|
92866
|
+
replayMs: replayDurationMs,
|
|
92502
92867
|
steps: err.stepCount,
|
|
92503
92868
|
hooks: err.hookCount,
|
|
92504
92869
|
waits: err.waitCount
|
|
@@ -92508,6 +92873,13 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92508
92873
|
runtimeLogger2.debug(suspensionMessage);
|
|
92509
92874
|
}
|
|
92510
92875
|
const suspensionStart = Date.now();
|
|
92876
|
+
if (!cachedEvents) {
|
|
92877
|
+
throw new Error("Invariant violation: workflow suspended before its event log was loaded");
|
|
92878
|
+
}
|
|
92879
|
+
const suspensionLog = {
|
|
92880
|
+
events: cachedEvents,
|
|
92881
|
+
cursor: eventsCursor
|
|
92882
|
+
};
|
|
92511
92883
|
let suspensionResult;
|
|
92512
92884
|
try {
|
|
92513
92885
|
suspensionResult = await handleSuspension({
|
|
@@ -92516,9 +92888,14 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92516
92888
|
run: workflowRun,
|
|
92517
92889
|
span,
|
|
92518
92890
|
requestId,
|
|
92891
|
+
eventLog: suspensionLog,
|
|
92519
92892
|
runReadyBarrier
|
|
92520
92893
|
});
|
|
92521
92894
|
} catch (suspensionError) {
|
|
92895
|
+
if (PreconditionFailedError.is(suspensionError)) {
|
|
92896
|
+
runtimeLogger2.warn("Suspension event creation rejected as stale after reload retries; re-invoking run for a fresh replay", { workflowRunId: runId, loopIteration });
|
|
92897
|
+
return await reinvoke(0);
|
|
92898
|
+
}
|
|
92522
92899
|
if (!FatalError2.is(suspensionError)) {
|
|
92523
92900
|
throw suspensionError;
|
|
92524
92901
|
}
|
|
@@ -92558,6 +92935,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92558
92935
|
});
|
|
92559
92936
|
return;
|
|
92560
92937
|
}
|
|
92938
|
+
eventsCursor = suspensionLog.cursor;
|
|
92561
92939
|
preStepBlockingMs += suspensionResult.hookCreationMs;
|
|
92562
92940
|
if (suspensionResult.hasAttributeEvents && preStepBlockingBeforeAttrMs === void 0) {
|
|
92563
92941
|
preStepBlockingBeforeAttrMs = preStepBlockingMs;
|
|
@@ -92667,6 +93045,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92667
93045
|
events: cachedEvents ?? [],
|
|
92668
93046
|
invocationStartedClean: invocationStartedClean === true,
|
|
92669
93047
|
runCreatedAtMs: runIdCreatedAt(runId) ?? (turbo ? void 0 : +workflowRun.createdAt),
|
|
93048
|
+
runStartedReceivedAtMs,
|
|
93049
|
+
replayMs: replayDurationMs,
|
|
92670
93050
|
preStepBlockingMs,
|
|
92671
93051
|
preStepBlockingBeforeAttrMs,
|
|
92672
93052
|
// This suspension's own hook/wait writes are not in
|
|
@@ -92685,6 +93065,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92685
93065
|
workflowDeploymentId: workflowRun.deploymentId,
|
|
92686
93066
|
workflowName,
|
|
92687
93067
|
workflowStartedAt,
|
|
93068
|
+
rootRunId: rootRunIdFrom(workflowRun.attributes, runId),
|
|
92688
93069
|
stepId: s.correlationId,
|
|
92689
93070
|
stepName: s.stepName,
|
|
92690
93071
|
runSpecVersion: workflowRun.specVersion,
|
|
@@ -92797,6 +93178,10 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
92797
93178
|
}
|
|
92798
93179
|
}
|
|
92799
93180
|
} else {
|
|
93181
|
+
if (PreconditionFailedError.is(err)) {
|
|
93182
|
+
runtimeLogger2.warn("Event creation rejected as stale; re-invoking run for a fresh replay", { workflowRunId: runId, loopIteration });
|
|
93183
|
+
return await reinvoke(0);
|
|
93184
|
+
}
|
|
92800
93185
|
if (isRetryableWorldError2(err)) {
|
|
92801
93186
|
runLogger.warn("Transient world error during replay; redelivering via queue instead of failing the run", {
|
|
92802
93187
|
errorName: err instanceof Error ? err.name : "UnknownError",
|
|
@@ -93661,10 +94046,10 @@ var Run = class _Run {
|
|
|
93661
94046
|
return this.getReadable();
|
|
93662
94047
|
}
|
|
93663
94048
|
};
|
|
93664
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
93665
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
93666
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
93667
|
-
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94049
|
+
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#wakeUp");
|
|
94050
|
+
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#cancel");
|
|
94051
|
+
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#getReadable");
|
|
94052
|
+
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#exists");
|
|
93668
94053
|
Object.defineProperty(Run.prototype, "exists", {
|
|
93669
94054
|
get() {
|
|
93670
94055
|
return __step_Run$exists.call(this);
|
|
@@ -93672,7 +94057,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
93672
94057
|
configurable: true,
|
|
93673
94058
|
enumerable: false
|
|
93674
94059
|
});
|
|
93675
|
-
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94060
|
+
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#status");
|
|
93676
94061
|
Object.defineProperty(Run.prototype, "status", {
|
|
93677
94062
|
get() {
|
|
93678
94063
|
return __step_Run$status.call(this);
|
|
@@ -93680,7 +94065,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
93680
94065
|
configurable: true,
|
|
93681
94066
|
enumerable: false
|
|
93682
94067
|
});
|
|
93683
|
-
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94068
|
+
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#returnValue");
|
|
93684
94069
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
93685
94070
|
get() {
|
|
93686
94071
|
return __step_Run$returnValue.call(this);
|
|
@@ -93688,7 +94073,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
93688
94073
|
configurable: true,
|
|
93689
94074
|
enumerable: false
|
|
93690
94075
|
});
|
|
93691
|
-
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94076
|
+
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#workflowName");
|
|
93692
94077
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
93693
94078
|
get() {
|
|
93694
94079
|
return __step_Run$workflowName.call(this);
|
|
@@ -93696,7 +94081,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
93696
94081
|
configurable: true,
|
|
93697
94082
|
enumerable: false
|
|
93698
94083
|
});
|
|
93699
|
-
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94084
|
+
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#createdAt");
|
|
93700
94085
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
93701
94086
|
get() {
|
|
93702
94087
|
return __step_Run$createdAt.call(this);
|
|
@@ -93704,7 +94089,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
93704
94089
|
configurable: true,
|
|
93705
94090
|
enumerable: false
|
|
93706
94091
|
});
|
|
93707
|
-
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94092
|
+
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#startedAt");
|
|
93708
94093
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
93709
94094
|
get() {
|
|
93710
94095
|
return __step_Run$startedAt.call(this);
|
|
@@ -93712,7 +94097,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
93712
94097
|
configurable: true,
|
|
93713
94098
|
enumerable: false
|
|
93714
94099
|
});
|
|
93715
|
-
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
94100
|
+
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.35//Run#completedAt");
|
|
93716
94101
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
93717
94102
|
get() {
|
|
93718
94103
|
return __step_Run$completedAt.call(this);
|
|
@@ -93729,7 +94114,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
93729
94114
|
enumerable: false,
|
|
93730
94115
|
configurable: false
|
|
93731
94116
|
});
|
|
93732
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
94117
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.35//Run");
|
|
93733
94118
|
|
|
93734
94119
|
// ../core/dist/workflow/create-hook.js
|
|
93735
94120
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|
|
@@ -94488,9 +94873,9 @@ function nullish(input) {
|
|
|
94488
94873
|
}
|
|
94489
94874
|
__name(nullish, "nullish");
|
|
94490
94875
|
function cleanRegex(source) {
|
|
94491
|
-
const
|
|
94876
|
+
const start2 = source.startsWith("^") ? 1 : 0;
|
|
94492
94877
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
94493
|
-
return source.slice(
|
|
94878
|
+
return source.slice(start2, end);
|
|
94494
94879
|
}
|
|
94495
94880
|
__name(cleanRegex, "cleanRegex");
|
|
94496
94881
|
function floatSafeRemainder(val, step) {
|
|
@@ -98105,9 +98490,9 @@ var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (i
|
|
|
98105
98490
|
}
|
|
98106
98491
|
const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
|
|
98107
98492
|
if (!source) throw new Error(\`Invalid template literal part: \${part._zod.traits}\`);
|
|
98108
|
-
const
|
|
98493
|
+
const start2 = source.startsWith("^") ? 1 : 0;
|
|
98109
98494
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
98110
|
-
regexParts.push(source.slice(
|
|
98495
|
+
regexParts.push(source.slice(start2, end));
|
|
98111
98496
|
} else if (part === null || primitiveTypes.has(typeof part)) {
|
|
98112
98497
|
regexParts.push(escapeRegex(\`\${part}\`));
|
|
98113
98498
|
} else {
|
|
@@ -108757,6 +109142,9 @@ __name(date4, "date");
|
|
|
108757
109142
|
config(en_default());
|
|
108758
109143
|
|
|
108759
109144
|
// ../world/dist/attributes.js
|
|
109145
|
+
var RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
109146
|
+
var ROOT_RUN_ID_ATTRIBUTE = \`\${RESERVED_ATTRIBUTE_KEY_PREFIX}rootRunId\`;
|
|
109147
|
+
var PARENT_RUN_ID_ATTRIBUTE = \`\${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId\`;
|
|
108760
109148
|
var AttributeChangeSchema = external_exports.object({
|
|
108761
109149
|
key: external_exports.string(),
|
|
108762
109150
|
value: external_exports.union([
|
|
@@ -108887,6 +109275,17 @@ var stepLatencyTelemetryFields = {
|
|
|
108887
109275
|
// stso.
|
|
108888
109276
|
stepCount: external_exports.number().int().positive().optional(),
|
|
108889
109277
|
eventCount: external_exports.number().int().positive().optional(),
|
|
109278
|
+
// Run-started-to-first-step: milliseconds from the \`run_started\` response
|
|
109279
|
+
// landing (or, under turbo, the local run synthesis instant) until this
|
|
109280
|
+
// step's start POST was issued. A sub-window of ttfs. Only reported
|
|
109281
|
+
// alongside the same eligibility as ttfs.
|
|
109282
|
+
rsfs: external_exports.number().optional(),
|
|
109283
|
+
// Synchronous workflow-function replay duration of only the FINAL replay
|
|
109284
|
+
// pass within the rsfs window (the pass that scheduled the first step),
|
|
109285
|
+
// excluding awaited network I/O \u2014 not accumulated across earlier
|
|
109286
|
+
// pre-first-step passes, so it is not "the replay portion of rsfs". Only
|
|
109287
|
+
// present alongside rsfs, and only for the run's first step.
|
|
109288
|
+
finalSchedulingReplay: external_exports.number().optional(),
|
|
108890
109289
|
// Names of the runtime's optional startup-latency optimizations that were
|
|
108891
109290
|
// active for this measurement (e.g. 'turbo', 'lazyStepStart',
|
|
108892
109291
|
// 'optimisticStart'), so latency metrics can be segmented by them.
|
|
@@ -109673,14 +110072,58 @@ __name(hookWorkflow, "hookWorkflow");
|
|
|
109673
110072
|
hookWorkflow.workflowId = "workflow//./workflows/inline-execution//hookWorkflow";
|
|
109674
110073
|
globalThis.__private_workflows.set("workflow//./workflows/inline-execution//hookWorkflow", hookWorkflow);
|
|
109675
110074
|
|
|
110075
|
+
// ../core/dist/runtime/start.js
|
|
110076
|
+
var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.0.0-beta.35//start");
|
|
110077
|
+
|
|
110078
|
+
// workflows/lineage.ts
|
|
110079
|
+
var noop = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//./workflows/lineage//noop");
|
|
110080
|
+
async function bodyStartsChild() {
|
|
110081
|
+
await noop();
|
|
110082
|
+
const child = await start(spawnedChild, []);
|
|
110083
|
+
return child.runId;
|
|
110084
|
+
}
|
|
110085
|
+
__name(bodyStartsChild, "bodyStartsChild");
|
|
110086
|
+
bodyStartsChild.workflowId = "workflow//./workflows/lineage//bodyStartsChild";
|
|
110087
|
+
globalThis.__private_workflows.set("workflow//./workflows/lineage//bodyStartsChild", bodyStartsChild);
|
|
110088
|
+
async function spawnedChild() {
|
|
110089
|
+
await noop();
|
|
110090
|
+
return "done";
|
|
110091
|
+
}
|
|
110092
|
+
__name(spawnedChild, "spawnedChild");
|
|
110093
|
+
spawnedChild.workflowId = "workflow//./workflows/lineage//spawnedChild";
|
|
110094
|
+
globalThis.__private_workflows.set("workflow//./workflows/lineage//spawnedChild", spawnedChild);
|
|
110095
|
+
async function chainRoot() {
|
|
110096
|
+
await noop();
|
|
110097
|
+
const middle = await start(chainMiddle, []);
|
|
110098
|
+
return middle.runId;
|
|
110099
|
+
}
|
|
110100
|
+
__name(chainRoot, "chainRoot");
|
|
110101
|
+
chainRoot.workflowId = "workflow//./workflows/lineage//chainRoot";
|
|
110102
|
+
globalThis.__private_workflows.set("workflow//./workflows/lineage//chainRoot", chainRoot);
|
|
110103
|
+
async function chainMiddle() {
|
|
110104
|
+
await noop();
|
|
110105
|
+
const leaf = await start(chainLeaf, []);
|
|
110106
|
+
return leaf.runId;
|
|
110107
|
+
}
|
|
110108
|
+
__name(chainMiddle, "chainMiddle");
|
|
110109
|
+
chainMiddle.workflowId = "workflow//./workflows/lineage//chainMiddle";
|
|
110110
|
+
globalThis.__private_workflows.set("workflow//./workflows/lineage//chainMiddle", chainMiddle);
|
|
110111
|
+
async function chainLeaf() {
|
|
110112
|
+
await noop();
|
|
110113
|
+
return "done";
|
|
110114
|
+
}
|
|
110115
|
+
__name(chainLeaf, "chainLeaf");
|
|
110116
|
+
chainLeaf.workflowId = "workflow//./workflows/lineage//chainLeaf";
|
|
110117
|
+
globalThis.__private_workflows.set("workflow//./workflows/lineage//chainLeaf", chainLeaf);
|
|
110118
|
+
|
|
109676
110119
|
// workflows/noop.ts
|
|
109677
|
-
var
|
|
110120
|
+
var noop2 = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//./workflows/noop//noop");
|
|
109678
110121
|
async function brokenWf() {
|
|
109679
110122
|
const numbers = [];
|
|
109680
110123
|
{
|
|
109681
110124
|
const promises = [];
|
|
109682
110125
|
for (let i = 0; i < 5; i++) {
|
|
109683
|
-
promises.push(
|
|
110126
|
+
promises.push(noop2(i));
|
|
109684
110127
|
}
|
|
109685
110128
|
console.log("await 5");
|
|
109686
110129
|
numbers.push(...await Promise.all(promises));
|
|
@@ -109688,7 +110131,7 @@ async function brokenWf() {
|
|
|
109688
110131
|
{
|
|
109689
110132
|
const promises = [];
|
|
109690
110133
|
for (let i = 0; i < 15; i++) {
|
|
109691
|
-
promises.push(
|
|
110134
|
+
promises.push(noop2(100 + i));
|
|
109692
110135
|
}
|
|
109693
110136
|
console.log("await 15");
|
|
109694
110137
|
numbers.push(...await Promise.all(promises));
|