@workflow/web 5.0.0-beta.44 → 5.0.0-beta.47
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/build/client/assets/{arrow-up-right-AtCpRI70.js → arrow-up-right-C52N96YH.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-BPRwlr7r.js → highlighted-body-B3W2YXNL-BzCKp954.js} +1 -1
- package/build/client/assets/{home-BMHSjdeg.js → home-CXFjRmpa.js} +3 -3
- package/build/client/assets/{loader-circle-abAcDEYl.js → loader-circle-BQzzSKVU.js} +1 -1
- package/build/client/assets/{manifest-a9a8ec99.js → manifest-9ff1658d.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-CrfHaTou.js → mermaid-3ZIDBTTL-BrUzeGHN.js} +305 -158
- package/build/client/assets/{root-e8qlLJiK.js → root-DBp4o4Ap.js} +3 -3
- package/build/client/assets/{run-detail-CrWq-9Tk.js → run-detail-7tPGLWpY.js} +58 -37
- package/build/client/assets/{workflow-graph-viewer-CFAXloBw.js → workflow-graph-viewer-BI72rVK-.js} +1 -1
- package/build/client/assets/{zstd-browser-decoder-B9DmHkyE.js → zstd-browser-decoder-C5OUdy0l.js} +1 -1
- package/build/server/assets/{app-wed_Qw3X.js → app-z0qVD1ZU.js} +811 -505
- package/build/server/assets/{highlighted-body-B3W2YXNL-imLU-Cvz.js → highlighted-body-B3W2YXNL-BRzynHFv.js} +1 -1
- package/build/server/assets/index-DDMGTwh_.js +166 -0
- package/build/server/assets/{index-Dsr6TVhD.js → index-jQkBA81b.js} +1 -1
- package/build/server/assets/{mermaid-3ZIDBTTL-CgaDjNgb.js → mermaid-3ZIDBTTL-CNWRBcN0.js} +1 -1
- package/build/server/assets/{token-CA6-cBL4.js → token-BSEhy2T4.js} +1 -1
- package/build/server/assets/{token-util-BNjC27Tj.js → token-util-D_gzpVW2.js} +1 -1
- package/build/server/assets/{websocket-server-S8DMC969.js → websocket-server-CDTVQU5X.js} +1 -1
- package/build/server/assets/{wrapper-DeK0m2tW.js → wrapper-BxieYZVg.js} +3 -3
- package/build/server/assets/{ws-transport-DdxSF5J6.js → ws-transport-DbDOLT7f.js} +5 -5
- package/build/server/assets/{zstd-browser-decoder-Cd_DTxZV.js → zstd-browser-decoder-CtzWlfs5.js} +1 -1
- package/build/server/index.js +3 -3
- package/package.json +8 -8
- package/build/server/assets/index-DxLR22JW.js +0 -165
|
@@ -56876,77 +56876,65 @@ const PARENT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId`;
|
|
|
56876
56876
|
const ATTRIBUTE_KEY_MAX_LENGTH = 256;
|
|
56877
56877
|
const ATTRIBUTE_VALUE_MAX_BYTES = 256;
|
|
56878
56878
|
const ATTRIBUTE_MAX_PER_RUN = 64;
|
|
56879
|
-
const
|
|
56880
|
-
key: string$3(),
|
|
56881
|
-
value: union([string$3(), _null()])
|
|
56882
|
-
});
|
|
56883
|
-
const AttributeChangesSchema = array$1(AttributeChangeSchema);
|
|
56879
|
+
const textEncoder$2 = new TextEncoder();
|
|
56884
56880
|
class AttributeValidationError extends Error {
|
|
56885
56881
|
constructor(message2) {
|
|
56886
56882
|
super(message2);
|
|
56887
56883
|
this.name = "AttributeValidationError";
|
|
56888
56884
|
}
|
|
56889
56885
|
}
|
|
56890
|
-
|
|
56891
|
-
function validateAttributeKey(key, options = {}) {
|
|
56886
|
+
function assertValidAttributeKey(key, allowReservedAttributes) {
|
|
56892
56887
|
if (typeof key !== "string") {
|
|
56893
|
-
|
|
56888
|
+
throw new AttributeValidationError(`Attribute key must be a string, got ${typeof key}`);
|
|
56894
56889
|
}
|
|
56895
56890
|
if (key.length === 0) {
|
|
56896
|
-
|
|
56891
|
+
throw new AttributeValidationError("Attribute key must not be empty");
|
|
56897
56892
|
}
|
|
56898
56893
|
if (key.length > ATTRIBUTE_KEY_MAX_LENGTH) {
|
|
56899
|
-
|
|
56894
|
+
throw new AttributeValidationError(`Attribute key length ${key.length} exceeds limit ${ATTRIBUTE_KEY_MAX_LENGTH}: ${JSON.stringify(key.slice(0, 32))}…`);
|
|
56900
56895
|
}
|
|
56901
|
-
if (!
|
|
56902
|
-
|
|
56896
|
+
if (!allowReservedAttributes && key.startsWith(RESERVED_ATTRIBUTE_KEY_PREFIX)) {
|
|
56897
|
+
throw new AttributeValidationError(`Attribute key ${JSON.stringify(key)} starts with reserved prefix "${RESERVED_ATTRIBUTE_KEY_PREFIX}" — that namespace is reserved for framework/library code. Set { allowReservedAttributes: true } only if your caller is framework-level.`);
|
|
56903
56898
|
}
|
|
56904
|
-
return null;
|
|
56905
56899
|
}
|
|
56906
|
-
function
|
|
56907
|
-
if (value
|
|
56908
|
-
|
|
56909
|
-
if (typeof value !== "string") {
|
|
56910
|
-
return new AttributeValidationError(`Attribute value must be a string or null, got ${typeof value}`);
|
|
56900
|
+
function assertValidAttributeValue(value) {
|
|
56901
|
+
if (value !== null && typeof value !== "string") {
|
|
56902
|
+
throw new AttributeValidationError(`Attribute value must be a string or null, got ${typeof value}`);
|
|
56911
56903
|
}
|
|
56912
|
-
|
|
56904
|
+
if (value === null)
|
|
56905
|
+
return;
|
|
56906
|
+
const bytes = textEncoder$2.encode(value).length;
|
|
56913
56907
|
if (bytes > ATTRIBUTE_VALUE_MAX_BYTES) {
|
|
56914
|
-
|
|
56908
|
+
throw new AttributeValidationError(`Attribute value byte length ${bytes} exceeds limit ${ATTRIBUTE_VALUE_MAX_BYTES}`);
|
|
56915
56909
|
}
|
|
56916
|
-
return null;
|
|
56917
56910
|
}
|
|
56918
|
-
function
|
|
56911
|
+
function attributeCountDelta(key, value, existingKeys) {
|
|
56912
|
+
if (value === null)
|
|
56913
|
+
return (existingKeys == null ? void 0 : existingKeys.has(key)) ? -1 : 0;
|
|
56914
|
+
return existingKeys === void 0 || !existingKeys.has(key) ? 1 : 0;
|
|
56915
|
+
}
|
|
56916
|
+
function validateAttributeBatchConstraints(changes, context = {}) {
|
|
56919
56917
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
56920
56918
|
const existingKeys = context.existingKeys === void 0 ? void 0 : context.existingKeys instanceof Set ? context.existingKeys : new Set(context.existingKeys);
|
|
56921
|
-
let
|
|
56922
|
-
|
|
56923
|
-
|
|
56924
|
-
|
|
56925
|
-
allowReservedAttributes: context.allowReservedAttributes
|
|
56926
|
-
});
|
|
56927
|
-
if (keyError)
|
|
56928
|
-
throw keyError;
|
|
56929
|
-
const valueError = validateAttributeValue(change.value);
|
|
56930
|
-
if (valueError)
|
|
56931
|
-
throw valueError;
|
|
56932
|
-
if (seenKeys.has(change.key)) {
|
|
56933
|
-
throw new AttributeValidationError(`Attribute key ${JSON.stringify(change.key)} appears more than once in the same batch`);
|
|
56934
|
-
}
|
|
56935
|
-
seenKeys.add(change.key);
|
|
56936
|
-
if (change.value !== null) {
|
|
56937
|
-
if (existingKeys === void 0 || !existingKeys.has(change.key)) {
|
|
56938
|
-
netAdds += 1;
|
|
56939
|
-
}
|
|
56940
|
-
} else if (existingKeys === void 0 || existingKeys.has(change.key)) {
|
|
56941
|
-
netDeletes += 1;
|
|
56919
|
+
let postMergeCount = (existingKeys == null ? void 0 : existingKeys.size) ?? 0;
|
|
56920
|
+
for (const { key, value } of changes) {
|
|
56921
|
+
if (seenKeys.has(key)) {
|
|
56922
|
+
throw new AttributeValidationError(`Attribute key ${JSON.stringify(key)} appears more than once in the same batch`);
|
|
56942
56923
|
}
|
|
56924
|
+
seenKeys.add(key);
|
|
56925
|
+
postMergeCount += attributeCountDelta(key, value, existingKeys);
|
|
56943
56926
|
}
|
|
56944
|
-
|
|
56945
|
-
|
|
56946
|
-
if (postMerge > ATTRIBUTE_MAX_PER_RUN) {
|
|
56947
|
-
throw new AttributeValidationError(`Run attribute count would exceed limit ${ATTRIBUTE_MAX_PER_RUN} (post-merge ${postMerge})`);
|
|
56927
|
+
if (postMergeCount > ATTRIBUTE_MAX_PER_RUN) {
|
|
56928
|
+
throw new AttributeValidationError(`Run attribute count would exceed limit ${ATTRIBUTE_MAX_PER_RUN} (post-merge ${postMergeCount})`);
|
|
56948
56929
|
}
|
|
56949
56930
|
}
|
|
56931
|
+
function validateAttributeChanges(changes, context = {}) {
|
|
56932
|
+
for (const { key, value } of changes) {
|
|
56933
|
+
assertValidAttributeKey(key, context.allowReservedAttributes === true);
|
|
56934
|
+
assertValidAttributeValue(value);
|
|
56935
|
+
}
|
|
56936
|
+
validateAttributeBatchConstraints(changes, context);
|
|
56937
|
+
}
|
|
56950
56938
|
function applyAttributeChanges(existing, changes) {
|
|
56951
56939
|
const next2 = { ...existing ?? {} };
|
|
56952
56940
|
for (const { key, value } of changes) {
|
|
@@ -56958,6 +56946,89 @@ function applyAttributeChanges(existing, changes) {
|
|
|
56958
56946
|
}
|
|
56959
56947
|
return next2;
|
|
56960
56948
|
}
|
|
56949
|
+
const textEncoder$1 = new TextEncoder();
|
|
56950
|
+
const AttributeKeySchema = string$3().min(1, { error: "Attribute key must not be empty" }).max(ATTRIBUTE_KEY_MAX_LENGTH, {
|
|
56951
|
+
error: `Attribute key exceeds limit ${ATTRIBUTE_KEY_MAX_LENGTH}`
|
|
56952
|
+
});
|
|
56953
|
+
const AttributeValueSchema = string$3().refine((value) => textEncoder$1.encode(value).length <= ATTRIBUTE_VALUE_MAX_BYTES, {
|
|
56954
|
+
error: `Attribute value exceeds limit ${ATTRIBUTE_VALUE_MAX_BYTES} UTF-8 bytes`
|
|
56955
|
+
}).nullable();
|
|
56956
|
+
const AttributeChangeSchema = object$1({
|
|
56957
|
+
key: AttributeKeySchema,
|
|
56958
|
+
value: AttributeValueSchema
|
|
56959
|
+
});
|
|
56960
|
+
const AttributeChangesSchema = array$1(AttributeChangeSchema).superRefine((changes, context) => {
|
|
56961
|
+
try {
|
|
56962
|
+
validateAttributeBatchConstraints(changes);
|
|
56963
|
+
} catch (error2) {
|
|
56964
|
+
if (!(error2 instanceof AttributeValidationError))
|
|
56965
|
+
throw error2;
|
|
56966
|
+
context.addIssue({
|
|
56967
|
+
code: "custom",
|
|
56968
|
+
message: error2.message,
|
|
56969
|
+
input: changes
|
|
56970
|
+
});
|
|
56971
|
+
}
|
|
56972
|
+
});
|
|
56973
|
+
function getOwnProperty$1(object2, key) {
|
|
56974
|
+
return Object.hasOwn(object2, key) ? object2[key] : void 0;
|
|
56975
|
+
}
|
|
56976
|
+
function isSealedNoopEvent$1(event) {
|
|
56977
|
+
return event.eventType === "noop";
|
|
56978
|
+
}
|
|
56979
|
+
const ENTITY_EVENT_CLASS_BY_TYPE = {
|
|
56980
|
+
attr_set: "attr_set",
|
|
56981
|
+
step_created: "step_created",
|
|
56982
|
+
step_started: "step_started",
|
|
56983
|
+
step_retrying: "step_retrying",
|
|
56984
|
+
step_completed: "step_terminal",
|
|
56985
|
+
step_failed: "step_terminal",
|
|
56986
|
+
wait_created: "wait_created",
|
|
56987
|
+
wait_completed: "wait_completed",
|
|
56988
|
+
hook_created: "hook_created",
|
|
56989
|
+
hook_disposed: "hook_disposed",
|
|
56990
|
+
run_started: "run_started"
|
|
56991
|
+
};
|
|
56992
|
+
function entityEventClass(eventType) {
|
|
56993
|
+
return getOwnProperty$1(ENTITY_EVENT_CLASS_BY_TYPE, eventType);
|
|
56994
|
+
}
|
|
56995
|
+
const RUN_ENTITY_KEY = "";
|
|
56996
|
+
const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
56997
|
+
"attr_set",
|
|
56998
|
+
"step_terminal",
|
|
56999
|
+
"wait_completed",
|
|
57000
|
+
"hook_disposed"
|
|
57001
|
+
]);
|
|
57002
|
+
function classifyEntityEvent(event) {
|
|
57003
|
+
const eventClass = entityEventClass(event.eventType);
|
|
57004
|
+
if (eventClass === void 0) {
|
|
57005
|
+
return void 0;
|
|
57006
|
+
}
|
|
57007
|
+
if (eventClass === "run_started") {
|
|
57008
|
+
return { eventClass, entity: RUN_ENTITY_KEY };
|
|
57009
|
+
}
|
|
57010
|
+
return event.correlationId ? { eventClass, entity: event.correlationId } : void 0;
|
|
57011
|
+
}
|
|
57012
|
+
const EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE = {
|
|
57013
|
+
run_created: ["input"],
|
|
57014
|
+
run_started: ["input"],
|
|
57015
|
+
run_completed: ["output"],
|
|
57016
|
+
run_failed: ["error"],
|
|
57017
|
+
step_created: ["input"],
|
|
57018
|
+
step_started: ["input"],
|
|
57019
|
+
step_completed: ["result"],
|
|
57020
|
+
step_failed: ["error"],
|
|
57021
|
+
step_retrying: ["error"],
|
|
57022
|
+
hook_created: ["metadata"],
|
|
57023
|
+
hook_received: ["payload"]
|
|
57024
|
+
};
|
|
57025
|
+
const NO_EVENT_DATA_REF_FIELDS = [];
|
|
57026
|
+
function getEventDataRefFields(eventType) {
|
|
57027
|
+
return getOwnProperty$1(EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE, eventType) ?? NO_EVENT_DATA_REF_FIELDS;
|
|
57028
|
+
}
|
|
57029
|
+
function getEventDataPayloadField(eventType) {
|
|
57030
|
+
return getEventDataRefFields(eventType)[0];
|
|
57031
|
+
}
|
|
56961
57032
|
const BinarySerializedDataSchema = _instanceof(Uint8Array);
|
|
56962
57033
|
const LegacySerializedDataSchemaV1 = any();
|
|
56963
57034
|
const SerializedDataSchema = union([
|
|
@@ -57029,21 +57100,6 @@ const TERMINAL_STEP_EVENT_TYPES = TerminalStepEventTypeSchema.options;
|
|
|
57029
57100
|
function isTerminalStepEventType(eventType) {
|
|
57030
57101
|
return TERMINAL_STEP_EVENT_TYPES.includes(eventType);
|
|
57031
57102
|
}
|
|
57032
|
-
const ENTITY_EVENT_CLASS_BY_TYPE = {
|
|
57033
|
-
step_created: "step_created",
|
|
57034
|
-
step_started: "step_started",
|
|
57035
|
-
step_retrying: "step_retrying",
|
|
57036
|
-
step_completed: "step_terminal",
|
|
57037
|
-
step_failed: "step_terminal",
|
|
57038
|
-
wait_created: "wait_created",
|
|
57039
|
-
wait_completed: "wait_completed",
|
|
57040
|
-
hook_created: "hook_created",
|
|
57041
|
-
hook_disposed: "hook_disposed",
|
|
57042
|
-
run_started: "run_started"
|
|
57043
|
-
};
|
|
57044
|
-
function entityEventClass(eventType) {
|
|
57045
|
-
return ENTITY_EVENT_CLASS_BY_TYPE[eventType];
|
|
57046
|
-
}
|
|
57047
57103
|
const HookLifecycleEventTypeSchema = EventTypeSchema.extract([
|
|
57048
57104
|
"hook_created",
|
|
57049
57105
|
"hook_received",
|
|
@@ -57069,9 +57125,6 @@ const WAIT_EVENT_TYPES = WaitEventTypeSchema.options;
|
|
|
57069
57125
|
function isWaitEventType(eventType) {
|
|
57070
57126
|
return WAIT_EVENT_TYPES.includes(eventType);
|
|
57071
57127
|
}
|
|
57072
|
-
function isSealedNoopEvent$1(event) {
|
|
57073
|
-
return event.eventType === "noop";
|
|
57074
|
-
}
|
|
57075
57128
|
const ChildEntityCreationEventTypeSchema = EventTypeSchema.extract([
|
|
57076
57129
|
"step_created",
|
|
57077
57130
|
"hook_created",
|
|
@@ -57081,26 +57134,6 @@ const CHILD_ENTITY_CREATION_EVENT_TYPES = ChildEntityCreationEventTypeSchema.opt
|
|
|
57081
57134
|
function isChildEntityCreationEventType(eventType) {
|
|
57082
57135
|
return CHILD_ENTITY_CREATION_EVENT_TYPES.includes(eventType);
|
|
57083
57136
|
}
|
|
57084
|
-
const EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE = {
|
|
57085
|
-
run_created: "input",
|
|
57086
|
-
run_started: "input",
|
|
57087
|
-
run_completed: "output",
|
|
57088
|
-
run_failed: "error",
|
|
57089
|
-
step_created: "input",
|
|
57090
|
-
step_started: "input",
|
|
57091
|
-
step_completed: "result",
|
|
57092
|
-
step_failed: "error",
|
|
57093
|
-
step_retrying: "error",
|
|
57094
|
-
hook_created: "metadata",
|
|
57095
|
-
hook_received: "payload"
|
|
57096
|
-
};
|
|
57097
|
-
const EVENT_DATA_REF_FIELDS = Object.fromEntries(Object.entries(EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE).map(([eventType, field]) => [eventType, [field]]));
|
|
57098
|
-
function getEventDataRefFields(eventType) {
|
|
57099
|
-
return EVENT_DATA_REF_FIELDS[eventType] ?? [];
|
|
57100
|
-
}
|
|
57101
|
-
function getEventDataPayloadField(eventType) {
|
|
57102
|
-
return EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE[eventType];
|
|
57103
|
-
}
|
|
57104
57137
|
function stripEventDataRefs(event, resolveData) {
|
|
57105
57138
|
if (resolveData !== "none")
|
|
57106
57139
|
return event;
|
|
@@ -57940,7 +57973,11 @@ const HookResumeTimingSchema = object$1({
|
|
|
57940
57973
|
resumeRequestedAtMs: number$3(),
|
|
57941
57974
|
/** Epoch ms immediately before the queue publish was requested. */
|
|
57942
57975
|
queuePublishRequestedAtMs: number$3(),
|
|
57943
|
-
/**
|
|
57976
|
+
/**
|
|
57977
|
+
* Which `resumeHook()` dispatch path ran. Current producers always report
|
|
57978
|
+
* `sequential` (durable write, then wake); older producers may report
|
|
57979
|
+
* `lazy` or `parallel`.
|
|
57980
|
+
*/
|
|
57944
57981
|
strategy: string$3().optional(),
|
|
57945
57982
|
/** Epoch ms the final consumer's queue handler was entered. */
|
|
57946
57983
|
consumerStartedAtMs: number$3().optional(),
|
|
@@ -58011,9 +58048,9 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
58011
58048
|
/** Run creation data, only present on the first queue delivery from start() */
|
|
58012
58049
|
runInput: RunInputSchema.optional(),
|
|
58013
58050
|
/**
|
|
58014
|
-
*
|
|
58015
|
-
*
|
|
58016
|
-
*
|
|
58051
|
+
* Legacy lazy hook resume data. A consumer that understands this field
|
|
58052
|
+
* idempotently ensures the `hook_received` event exists (keyed by `resumeId`)
|
|
58053
|
+
* before replaying.
|
|
58017
58054
|
*/
|
|
58018
58055
|
hookInput: HookResumeInputSchema.optional(),
|
|
58019
58056
|
/**
|
|
@@ -58025,7 +58062,7 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
58025
58062
|
stepInput: StepDispatchInputSchema.optional(),
|
|
58026
58063
|
/**
|
|
58027
58064
|
* Hook-resume TTR timing. Present on both `resumeHook()` dispatch paths
|
|
58028
|
-
* (unlike `hookInput
|
|
58065
|
+
* (unlike legacy `hookInput`), and
|
|
58029
58066
|
* forwarded onto a dispatched step message when the resuming invocation
|
|
58030
58067
|
* hands the next durable step to another invocation. Purely observational.
|
|
58031
58068
|
* See {@link HookResumeTimingSchema}.
|
|
@@ -58072,12 +58109,14 @@ const HookResumeContextSchema = object$1({
|
|
|
58072
58109
|
encryptionPublicKey: string$3().optional(),
|
|
58073
58110
|
// Feature marker: the version of the lazy-hook-resume consumer protocol the
|
|
58074
58111
|
// run's creating deployment supports. Present (>= 1) means that deployment's
|
|
58075
|
-
// `@workflow/core` re-ensures the `hook_received` event from
|
|
58076
|
-
// message's `hookInput` on replay
|
|
58077
|
-
//
|
|
58078
|
-
//
|
|
58079
|
-
//
|
|
58080
|
-
//
|
|
58112
|
+
// `@workflow/core` re-ensures the `hook_received` event from a queue
|
|
58113
|
+
// message's `hookInput` on replay. Current producers no longer send
|
|
58114
|
+
// `hookInput` (the durable write happens before the wake is published), so
|
|
58115
|
+
// they never read this marker; it remains stamped so OLDER producers, which
|
|
58116
|
+
// still gate their lazy path on it, keep working against new runs. Because a
|
|
58117
|
+
// run is pinned to its creating deployment, this marker is a reliable
|
|
58118
|
+
// per-run attestation, unlike inferring support from a version compare
|
|
58119
|
+
// against a predicted release cutoff.
|
|
58081
58120
|
hookResumeInputVersion: number$3().optional()
|
|
58082
58121
|
});
|
|
58083
58122
|
const HOOK_RESUME_INPUT_VERSION = 1;
|
|
@@ -58113,7 +58152,7 @@ const HookSchema = object$1({
|
|
|
58113
58152
|
// lookup: RESPONSE-ONLY and TRANSIENT. Never persisted on the hook entity
|
|
58114
58153
|
// and never part of `resumeContext`, so a server rollback or kill switch
|
|
58115
58154
|
// takes effect on the next lookup (the field stops appearing).
|
|
58116
|
-
// `resumeHook()` gates its
|
|
58155
|
+
// `resumeHook()` gates its lazy path on this being present and
|
|
58117
58156
|
// current. Absent against an older/rolled-back server or when the kill switch
|
|
58118
58157
|
// is active.
|
|
58119
58158
|
resumeCapabilities: HookResumeCapabilitiesSchema.optional()
|
|
@@ -58148,10 +58187,16 @@ async function reenqueueActiveRuns(runs, enqueue, label, namespace2) {
|
|
|
58148
58187
|
cursor = page.cursor ?? void 0;
|
|
58149
58188
|
}
|
|
58150
58189
|
}
|
|
58151
|
-
if (reenqueued > 0) {
|
|
58152
|
-
console.
|
|
58190
|
+
if (reenqueued > 0 && isDebugEnabled$1()) {
|
|
58191
|
+
console.debug(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
|
|
58153
58192
|
}
|
|
58154
58193
|
}
|
|
58194
|
+
function isDebugEnabled$1() {
|
|
58195
|
+
const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
|
|
58196
|
+
if (typeof debug !== "string")
|
|
58197
|
+
return false;
|
|
58198
|
+
return debug.includes("workflow:") || debug === "*";
|
|
58199
|
+
}
|
|
58155
58200
|
const zodJsonSchema = lazy(() => {
|
|
58156
58201
|
return union([
|
|
58157
58202
|
string$3(),
|
|
@@ -58423,15 +58468,9 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
|
|
|
58423
58468
|
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
58424
58469
|
return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
|
|
58425
58470
|
}
|
|
58426
|
-
const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58427
|
-
"step_terminal",
|
|
58428
|
-
"wait_completed",
|
|
58429
|
-
"hook_disposed"
|
|
58430
|
-
]);
|
|
58431
58471
|
const SINGLETON_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58432
58472
|
"run_started"
|
|
58433
58473
|
]);
|
|
58434
|
-
const RUN_ENTITY_KEY = "";
|
|
58435
58474
|
const DUPLICATE_EVENT_MESSAGE = "Written by a concurrent replay after an event of the same kind was already recorded and acted on. The run follows the earlier one.";
|
|
58436
58475
|
function compareEventId(a2, b2) {
|
|
58437
58476
|
if (a2.eventId.length !== b2.eventId.length) {
|
|
@@ -58461,10 +58500,10 @@ function foldDuplicates(ordered) {
|
|
|
58461
58500
|
const seenClasses = /* @__PURE__ */ new Set();
|
|
58462
58501
|
const closedEntities = /* @__PURE__ */ new Set();
|
|
58463
58502
|
for (const event of ordered) {
|
|
58464
|
-
const
|
|
58465
|
-
if (
|
|
58503
|
+
const classification = classifyEntityEvent(event);
|
|
58504
|
+
if (classification === void 0)
|
|
58466
58505
|
continue;
|
|
58467
|
-
const entity =
|
|
58506
|
+
const { eventClass, entity } = classification;
|
|
58468
58507
|
const classKey = `${eventClass}:${entity}`;
|
|
58469
58508
|
const repeatsClass = seenClasses.has(classKey);
|
|
58470
58509
|
const entityWasClosed = closedEntities.has(entity);
|
|
@@ -58518,6 +58557,17 @@ function looksLikeWorkflowIdSearchInput(query) {
|
|
|
58518
58557
|
}
|
|
58519
58558
|
return /\d/.test(trimmed);
|
|
58520
58559
|
}
|
|
58560
|
+
function isWorkflowDebugEnabled() {
|
|
58561
|
+
const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
|
|
58562
|
+
if (typeof debug !== "string")
|
|
58563
|
+
return false;
|
|
58564
|
+
return debug.includes("workflow:") || debug === "*";
|
|
58565
|
+
}
|
|
58566
|
+
function debugLog(...args) {
|
|
58567
|
+
if (!isWorkflowDebugEnabled())
|
|
58568
|
+
return;
|
|
58569
|
+
console.debug(...args);
|
|
58570
|
+
}
|
|
58521
58571
|
function globalSingleton(name2, shapeVersion, create2) {
|
|
58522
58572
|
const key = Symbol.for(`${name2}/v${shapeVersion}`);
|
|
58523
58573
|
const store = globalThis;
|
|
@@ -59419,6 +59469,7 @@ const ERROR_SLUGS = {
|
|
|
59419
59469
|
WEBHOOK_INVALID_RESPOND_WITH_VALUE: "webhook-invalid-respond-with-value",
|
|
59420
59470
|
WEBHOOK_RESPONSE_NOT_SENT: "webhook-response-not-sent",
|
|
59421
59471
|
HOOK_CONFLICT: "hook-conflict",
|
|
59472
|
+
CORRUPTED_EVENT_LOG: "corrupted-event-log",
|
|
59422
59473
|
RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
|
|
59423
59474
|
};
|
|
59424
59475
|
class WorkflowError extends Error {
|
|
@@ -59504,6 +59555,18 @@ class WorkflowRuntimeError extends WorkflowError {
|
|
|
59504
59555
|
return isError(value) && value.name === "WorkflowRuntimeError";
|
|
59505
59556
|
}
|
|
59506
59557
|
}
|
|
59558
|
+
class CorruptedEventLogError extends WorkflowRuntimeError {
|
|
59559
|
+
constructor(message2, options) {
|
|
59560
|
+
super(message2, {
|
|
59561
|
+
...options,
|
|
59562
|
+
slug: ERROR_SLUGS.CORRUPTED_EVENT_LOG
|
|
59563
|
+
});
|
|
59564
|
+
this.name = "CorruptedEventLogError";
|
|
59565
|
+
}
|
|
59566
|
+
static is(value) {
|
|
59567
|
+
return isError(value) && value.name === "CorruptedEventLogError";
|
|
59568
|
+
}
|
|
59569
|
+
}
|
|
59507
59570
|
class RuntimeDecryptionError extends WorkflowRuntimeError {
|
|
59508
59571
|
constructor(message2, options) {
|
|
59509
59572
|
super(message2, {
|
|
@@ -60970,7 +61033,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
60970
61033
|
}
|
|
60971
61034
|
async function hydrateResourceIOAsync(resource, key) {
|
|
60972
61035
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
60973
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
61036
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-CtzWlfs5.js");
|
|
60974
61037
|
ensureZstdDecoderRegistered();
|
|
60975
61038
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
60976
61039
|
const revivers = getRevivers();
|
|
@@ -62971,8 +63034,28 @@ function BytesDisplayValue({ display }) {
|
|
|
62971
63034
|
function formatField(field) {
|
|
62972
63035
|
return field === "" ? '""' : field;
|
|
62973
63036
|
}
|
|
63037
|
+
function isGenericIterable(value) {
|
|
63038
|
+
if (value === null || typeof value !== "object" && typeof value !== "function" || Array.isArray(value) || value instanceof Map || value instanceof Set) {
|
|
63039
|
+
return false;
|
|
63040
|
+
}
|
|
63041
|
+
return typeof value[Symbol.iterator] === "function";
|
|
63042
|
+
}
|
|
63043
|
+
function isEntryIterable(value) {
|
|
63044
|
+
return typeof value.entries === "function";
|
|
63045
|
+
}
|
|
63046
|
+
function collectEntries(iterable, asPairs) {
|
|
63047
|
+
return Array.from(iterable, (item, index2) => {
|
|
63048
|
+
if (asPairs && Array.isArray(item) && item.length >= 2) {
|
|
63049
|
+
return [String(item[0]), collapseRefs(item[1]), index2];
|
|
63050
|
+
}
|
|
63051
|
+
return [void 0, collapseRefs(item), index2];
|
|
63052
|
+
});
|
|
63053
|
+
}
|
|
63054
|
+
function isSelfIterableIterator(value) {
|
|
63055
|
+
return Object.is(value[Symbol.iterator](), value);
|
|
63056
|
+
}
|
|
62974
63057
|
function describeContainer(value) {
|
|
62975
|
-
var _a3;
|
|
63058
|
+
var _a3, _b2;
|
|
62976
63059
|
if (Array.isArray(value)) {
|
|
62977
63060
|
return {
|
|
62978
63061
|
entries: value.map((item) => [void 0, item]),
|
|
@@ -62999,8 +63082,26 @@ function describeContainer(value) {
|
|
|
62999
63082
|
prefix: "Set"
|
|
63000
63083
|
};
|
|
63001
63084
|
}
|
|
63002
|
-
if (value
|
|
63085
|
+
if (isGenericIterable(value)) {
|
|
63003
63086
|
const name2 = (_a3 = value.constructor) == null ? void 0 : _a3.name;
|
|
63087
|
+
const prefix = name2 && name2 !== "Object" ? name2 : void 0;
|
|
63088
|
+
if (isEntryIterable(value)) {
|
|
63089
|
+
return {
|
|
63090
|
+
entries: collectEntries(value.entries(), true),
|
|
63091
|
+
open: "{",
|
|
63092
|
+
close: "}",
|
|
63093
|
+
prefix
|
|
63094
|
+
};
|
|
63095
|
+
}
|
|
63096
|
+
return {
|
|
63097
|
+
entries: collectEntries(value, false),
|
|
63098
|
+
open: "[",
|
|
63099
|
+
close: "]",
|
|
63100
|
+
prefix
|
|
63101
|
+
};
|
|
63102
|
+
}
|
|
63103
|
+
if (value !== null && typeof value === "object") {
|
|
63104
|
+
const name2 = (_b2 = value.constructor) == null ? void 0 : _b2.name;
|
|
63004
63105
|
return {
|
|
63005
63106
|
entries: Object.entries(value),
|
|
63006
63107
|
open: "{",
|
|
@@ -63111,7 +63212,7 @@ function ExpandableContainer({ field, entries, open: open2, close, prefix, ctx,
|
|
|
63111
63212
|
}
|
|
63112
63213
|
};
|
|
63113
63214
|
const lastIndex = entries.length - 1;
|
|
63114
|
-
return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded, "aria-controls": expanded ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), expanded ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
|
|
63215
|
+
return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded, "aria-controls": expanded ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), expanded ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue, entryKey], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, entryKey ?? childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
|
|
63115
63216
|
}
|
|
63116
63217
|
function DataRender({ field, value, isLast, ctx }) {
|
|
63117
63218
|
if (isBytesDisplay(value)) {
|
|
@@ -63239,6 +63340,19 @@ function isSameBytesDisplay(a2, b2) {
|
|
|
63239
63340
|
var _a3, _b2, _c2, _d2, _e2, _f;
|
|
63240
63341
|
return a2.text === b2.text && ((_a3 = a2.decodedFrom) == null ? void 0 : _a3.type) === ((_b2 = b2.decodedFrom) == null ? void 0 : _b2.type) && ((_c2 = a2.decodedFrom) == null ? void 0 : _c2.encoding) === ((_d2 = b2.decodedFrom) == null ? void 0 : _d2.encoding) && ((_e2 = a2.decodedFrom) == null ? void 0 : _e2.rawSummary) === ((_f = b2.decodedFrom) == null ? void 0 : _f.rawSummary);
|
|
63241
63342
|
}
|
|
63343
|
+
function haveSameIterableValues(a2, b2, seen) {
|
|
63344
|
+
const aIterator = a2[Symbol.iterator]();
|
|
63345
|
+
const bIterator = b2[Symbol.iterator]();
|
|
63346
|
+
while (true) {
|
|
63347
|
+
const aResult = aIterator.next();
|
|
63348
|
+
const bResult = bIterator.next();
|
|
63349
|
+
if (aResult.done || bResult.done) {
|
|
63350
|
+
return aResult.done === bResult.done;
|
|
63351
|
+
}
|
|
63352
|
+
if (!isDeepEqual(aResult.value, bResult.value, seen))
|
|
63353
|
+
return false;
|
|
63354
|
+
}
|
|
63355
|
+
}
|
|
63242
63356
|
function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
|
|
63243
63357
|
if (Object.is(a2, b2))
|
|
63244
63358
|
return true;
|
|
@@ -63251,6 +63365,25 @@ function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
63251
63365
|
if (a2 instanceof RegExp && b2 instanceof RegExp) {
|
|
63252
63366
|
return a2.source === b2.source && a2.flags === b2.flags;
|
|
63253
63367
|
}
|
|
63368
|
+
if (isGenericIterable(a2) || isGenericIterable(b2)) {
|
|
63369
|
+
if (!isGenericIterable(a2) || !isGenericIterable(b2))
|
|
63370
|
+
return false;
|
|
63371
|
+
if (Object.getPrototypeOf(a2) !== Object.getPrototypeOf(b2))
|
|
63372
|
+
return false;
|
|
63373
|
+
if (isSelfIterableIterator(a2) || isSelfIterableIterator(b2))
|
|
63374
|
+
return false;
|
|
63375
|
+
if (seen.get(a2) === b2)
|
|
63376
|
+
return true;
|
|
63377
|
+
seen.set(a2, b2);
|
|
63378
|
+
const aHasEntries = isEntryIterable(a2);
|
|
63379
|
+
const bHasEntries = isEntryIterable(b2);
|
|
63380
|
+
if (aHasEntries !== bHasEntries)
|
|
63381
|
+
return false;
|
|
63382
|
+
if (aHasEntries && bHasEntries) {
|
|
63383
|
+
return haveSameIterableValues(a2.entries(), b2.entries(), seen);
|
|
63384
|
+
}
|
|
63385
|
+
return haveSameIterableValues(a2, b2, seen);
|
|
63386
|
+
}
|
|
63254
63387
|
if (a2 instanceof Map && b2 instanceof Map) {
|
|
63255
63388
|
if (a2.size !== b2.size)
|
|
63256
63389
|
return false;
|
|
@@ -64735,7 +64868,6 @@ function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggl
|
|
|
64735
64868
|
}, []);
|
|
64736
64869
|
reactExports.useEffect(() => {
|
|
64737
64870
|
if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
|
|
64738
|
-
setLoadedEventData(null);
|
|
64739
64871
|
setHasAttemptedLoad(false);
|
|
64740
64872
|
onLoadEventData(event).then((data) => {
|
|
64741
64873
|
if (data !== null && data !== void 0) {
|
|
@@ -91840,7 +91972,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
91840
91972
|
var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
|
|
91841
91973
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
91842
91974
|
var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
|
|
91843
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
91975
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-BRzynHFv.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
91844
91976
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
91845
91977
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
91846
91978
|
return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
|
|
@@ -92162,7 +92294,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
92162
92294
|
}, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
|
|
92163
92295
|
};
|
|
92164
92296
|
var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
|
|
92165
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
92297
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CNWRBcN0.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
92166
92298
|
function ke(e, t) {
|
|
92167
92299
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
92168
92300
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -92915,7 +93047,7 @@ const stepEventsToStepEntity = (events2) => {
|
|
|
92915
93047
|
specVersion: anchorEvent.specVersion
|
|
92916
93048
|
};
|
|
92917
93049
|
};
|
|
92918
|
-
function stepToSpan(stepEvents, maxEndTime) {
|
|
93050
|
+
function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
92919
93051
|
const step = stepEventsToStepEntity(stepEvents);
|
|
92920
93052
|
if (!step) {
|
|
92921
93053
|
return null;
|
|
@@ -92923,7 +93055,11 @@ function stepToSpan(stepEvents, maxEndTime) {
|
|
|
92923
93055
|
const parsedName = parseStepName(String(step.stepName)) ?? parseWorkflowName(String(step.stepName));
|
|
92924
93056
|
const attributes = {
|
|
92925
93057
|
resource: "step",
|
|
92926
|
-
data:
|
|
93058
|
+
data: {
|
|
93059
|
+
...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
|
|
93060
|
+
// Canonical event-derived fields cannot be overridden by extensions.
|
|
93061
|
+
...step
|
|
93062
|
+
}
|
|
92927
93063
|
};
|
|
92928
93064
|
const resource = "step";
|
|
92929
93065
|
const events2 = convertEventsToSpanEvents(stepEvents, false, {
|
|
@@ -93101,10 +93237,10 @@ function computeLatestKnownTime(events2, run2) {
|
|
|
93101
93237
|
}
|
|
93102
93238
|
return new Date(latest);
|
|
93103
93239
|
}
|
|
93104
|
-
function buildSpans(run2, groupedEvents, now2, latestKnownTime) {
|
|
93240
|
+
function buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes) {
|
|
93105
93241
|
const childMaxEnd = latestKnownTime;
|
|
93106
93242
|
const runMaxEnd = run2.completedAt ?? now2;
|
|
93107
|
-
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
93243
|
+
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd, getStepAttributes)).filter((span) => span !== null);
|
|
93108
93244
|
const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
93109
93245
|
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
|
|
93110
93246
|
return {
|
|
@@ -93129,14 +93265,14 @@ function cascadeSpans(runSpan, spans) {
|
|
|
93129
93265
|
};
|
|
93130
93266
|
});
|
|
93131
93267
|
}
|
|
93132
|
-
function buildTrace(run2, events2, now2, { isCompleteHistory = false } = {}) {
|
|
93268
|
+
function buildTrace(run2, events2, now2, { isCompleteHistory = false, getStepAttributes } = {}) {
|
|
93133
93269
|
const duplicateEventIds = findDuplicateEventIds(events2, {
|
|
93134
93270
|
isCompleteHistory
|
|
93135
93271
|
});
|
|
93136
93272
|
const actedOnEvents = events2.filter((event) => !duplicateEventIds.has(event.eventId) && !isSealedNoopEvent(event));
|
|
93137
93273
|
const groupedEvents = groupEventsByCorrelation(actedOnEvents);
|
|
93138
93274
|
const latestKnownTime = computeLatestKnownTime(actedOnEvents, run2);
|
|
93139
|
-
const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime);
|
|
93275
|
+
const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes);
|
|
93140
93276
|
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
93141
93277
|
const traceStartMs = otelTimeToMs(runSpan.startTime);
|
|
93142
93278
|
const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
|
|
@@ -97375,6 +97511,42 @@ function TraceShortcutHelper({ hasMultipleSpans, reducedMotion }) {
|
|
|
97375
97511
|
};
|
|
97376
97512
|
return jsxRuntimeExports.jsxs("div", { className: "group pointer-events-auto hidden h-8 w-fit items-center gap-1 text-label-12 leading-none text-gray-900 @min-[480px]:flex", children: [jsxRuntimeExports.jsx("span", { "aria-live": "polite", "aria-atomic": "true", className: "inline-flex items-center whitespace-nowrap", children: reducedMotion ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx("span", { className: `inline-flex items-center ${styles$1.hint}`, children: index2 === 0 ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx(NavHint, {}) }, index2) }), jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none", onClick: dismiss, "aria-label": "Dismiss trace shortcuts helper", children: jsxRuntimeExports.jsx(X$3, { className: "h-3 w-3" }) })] });
|
|
97377
97513
|
}
|
|
97514
|
+
function isAltModifierKey(key) {
|
|
97515
|
+
return key === "Alt" || key === "AltGraph";
|
|
97516
|
+
}
|
|
97517
|
+
function isTypingTarget(target2) {
|
|
97518
|
+
return target2 instanceof HTMLInputElement || target2 instanceof HTMLTextAreaElement || target2 instanceof HTMLElement && target2.isContentEditable;
|
|
97519
|
+
}
|
|
97520
|
+
function useAltHeld() {
|
|
97521
|
+
const [altHeld, setAltHeld] = reactExports.useState(false);
|
|
97522
|
+
reactExports.useEffect(() => {
|
|
97523
|
+
const onKeyDown = (e) => {
|
|
97524
|
+
if (!isAltModifierKey(e.key))
|
|
97525
|
+
return;
|
|
97526
|
+
if (!isTypingTarget(e.target)) {
|
|
97527
|
+
e.preventDefault();
|
|
97528
|
+
}
|
|
97529
|
+
setAltHeld(true);
|
|
97530
|
+
};
|
|
97531
|
+
const onKeyUp = (e) => {
|
|
97532
|
+
if (isAltModifierKey(e.key))
|
|
97533
|
+
setAltHeld(false);
|
|
97534
|
+
};
|
|
97535
|
+
const onBlur = () => setAltHeld(false);
|
|
97536
|
+
const onPointerMove = (e) => setAltHeld(e.altKey);
|
|
97537
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
97538
|
+
window.addEventListener("keyup", onKeyUp, true);
|
|
97539
|
+
window.addEventListener("blur", onBlur);
|
|
97540
|
+
window.addEventListener("pointermove", onPointerMove, true);
|
|
97541
|
+
return () => {
|
|
97542
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
97543
|
+
window.removeEventListener("keyup", onKeyUp, true);
|
|
97544
|
+
window.removeEventListener("blur", onBlur);
|
|
97545
|
+
window.removeEventListener("pointermove", onPointerMove, true);
|
|
97546
|
+
};
|
|
97547
|
+
}, []);
|
|
97548
|
+
return { altHeld };
|
|
97549
|
+
}
|
|
97378
97550
|
const MIN_VIEWPORT_MS = 1e-3;
|
|
97379
97551
|
const ZOOM_DEBOUNCE_MS = 150;
|
|
97380
97552
|
function useAnimatedViewport(initial) {
|
|
@@ -97574,28 +97746,15 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
|
|
|
97574
97746
|
focusViewportOnSpan(spanId);
|
|
97575
97747
|
}, ZOOM_DEBOUNCE_MS);
|
|
97576
97748
|
}, [setActiveSpan, scrollSpanIntoView, cancelPendingZoom, focusViewportOnSpan]);
|
|
97577
|
-
const
|
|
97749
|
+
const { altHeld } = useAltHeld();
|
|
97578
97750
|
reactExports.useEffect(() => {
|
|
97579
97751
|
const onKeyDown = (e) => {
|
|
97580
97752
|
if (e.key === "Escape") {
|
|
97581
97753
|
handleClearActiveSpan();
|
|
97582
|
-
} else if (e.key === "Alt") {
|
|
97583
|
-
setAltHeld(true);
|
|
97584
97754
|
}
|
|
97585
97755
|
};
|
|
97586
|
-
const onKeyUp = (e) => {
|
|
97587
|
-
if (e.key === "Alt")
|
|
97588
|
-
setAltHeld(false);
|
|
97589
|
-
};
|
|
97590
|
-
const onBlur = () => setAltHeld(false);
|
|
97591
97756
|
window.addEventListener("keydown", onKeyDown);
|
|
97592
|
-
window.
|
|
97593
|
-
window.addEventListener("blur", onBlur);
|
|
97594
|
-
return () => {
|
|
97595
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
97596
|
-
window.removeEventListener("keyup", onKeyUp);
|
|
97597
|
-
window.removeEventListener("blur", onBlur);
|
|
97598
|
-
};
|
|
97757
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
97599
97758
|
}, [handleClearActiveSpan]);
|
|
97600
97759
|
const timelineRef = reactExports.useRef(null);
|
|
97601
97760
|
const [hover, setHover] = reactExports.useState(null);
|
|
@@ -97671,15 +97830,16 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
|
|
|
97671
97830
|
}
|
|
97672
97831
|
}, placeholder: "Search spans...", "aria-label": "Search spans", className: "flex-1 min-w-0 bg-transparent text-label-14 text-gray-1000 placeholder:text-gray-800 outline-none" }), searchQuery && jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => setSearchQuery(""), className: "-mr-2 hidden h-full max-w-full shrink-0 cursor-pointer items-center rounded-r-md border-0 bg-transparent px-2.5 font-inherit text-label-16 text-gray-900 no-underline transition-colors duration-150 ease-in hover:text-gray-1000 focus-visible:-outline-offset-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ds-focus-color)] min-[961px]:flex", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) })] }), endHeader: jsxRuntimeExports.jsx(TimelineHeader, { markers: timeMarkers, hoverInfo }), children: [jsxRuntimeExports.jsxs("div", { className: "block overflow-visible", children: [jsxRuntimeExports.jsx(EventList, { spans: trace2.spans, activeSpanId, searchResult, onSelectSpan: handleSelectSpan }), jsxRuntimeExports.jsx("div", { ref: loadMoreSentinelRef, className: "flex justify-center", children: isLoadingMore ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-label-14 text-gray-800", children: [jsxRuntimeExports.jsx(Spinner, { size: 14 }), jsxRuntimeExports.jsx("span", { children: "Loading spans…" })] }) : null })] }), jsxRuntimeExports.jsx("div", { ref: timelineRef, id: "trace-timeline", className: "@container block min-h-0 overflow-visible relative", onDoubleClick: resetZoom, onMouseMove: handleTimelineMouseMove, onMouseLeave: handleTimelineMouseLeave, children: jsxRuntimeExports.jsx(Timeline, { spans: trace2.spans, viewStart: viewport.start, viewEnd: viewport.end, markers: timeMarkers, selectedId: activeSpanId, searchResult, onSelect: handleSelectSpan, onRevealTime: handleRevealTime, hover, altHeld }) }), jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TraceShortcutHelper, { hasMultipleSpans: trace2.spans.length > 1, reducedMotion }), jsxRuntimeExports.jsxs("div", { className: "pointer-events-auto flex items-center border border-gray-alpha-400 rounded-md bg-background-100 shadow-sm overflow-hidden divide-x divide-gray-alpha-400", children: [jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomOut, disabled: isAtMinZoom, "aria-label": "Zoom out", children: jsxRuntimeExports.jsx(ZoomOut, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: resetZoom, "aria-label": "Reset zoom", children: jsxRuntimeExports.jsx(RotateCcw, { className: "w-3.5 h-3.5" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomIn, disabled: isAtMaxZoom, "aria-label": "Zoom in", children: jsxRuntimeExports.jsx(ZoomIn, { className: "w-4 h-4" }) })] })] })] })] }), jsxRuntimeExports.jsx(TraceDetailPanel, { containerRef: paneRootRef, onNavigateToSpan: navigateToSpan, onClose: handleClearActiveSpan })] });
|
|
97673
97832
|
}
|
|
97674
|
-
const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false }) => {
|
|
97833
|
+
const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes }) => {
|
|
97675
97834
|
const trace2 = reactExports.useMemo(() => {
|
|
97676
97835
|
if (!(run2 == null ? void 0 : run2.runId)) {
|
|
97677
97836
|
return void 0;
|
|
97678
97837
|
}
|
|
97679
97838
|
return buildTrace(run2, events2, /* @__PURE__ */ new Date(), {
|
|
97680
|
-
isCompleteHistory: !hasMore
|
|
97839
|
+
isCompleteHistory: !hasMore,
|
|
97840
|
+
getStepAttributes
|
|
97681
97841
|
});
|
|
97682
|
-
}, [run2, events2, hasMore]);
|
|
97842
|
+
}, [run2, events2, hasMore, getStepAttributes]);
|
|
97683
97843
|
const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace2 == null ? void 0 : trace2.duplicateEventIds }), [sidebarData, trace2]);
|
|
97684
97844
|
if (!trace2 || loading && events2.length === 0) {
|
|
97685
97845
|
return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
|
|
@@ -100599,15 +100759,15 @@ function magenta(str) {
|
|
|
100599
100759
|
return chalk.magenta(str);
|
|
100600
100760
|
}
|
|
100601
100761
|
class WorkflowSuspension extends Error {
|
|
100602
|
-
constructor(
|
|
100603
|
-
const
|
|
100762
|
+
constructor(itemsInput, global2) {
|
|
100763
|
+
const items = [...itemsInput.values()];
|
|
100604
100764
|
let stepCount = 0;
|
|
100605
100765
|
let hookCount = 0;
|
|
100606
100766
|
let waitCount = 0;
|
|
100607
100767
|
let attributeCount = 0;
|
|
100608
100768
|
let hookDisposedCount = 0;
|
|
100609
100769
|
let abortCount = 0;
|
|
100610
|
-
for (const item of
|
|
100770
|
+
for (const item of items) {
|
|
100611
100771
|
if (item.type === "step")
|
|
100612
100772
|
stepCount++;
|
|
100613
100773
|
else if (item.type === "hook") {
|
|
@@ -100659,6 +100819,8 @@ class WorkflowSuspension extends Error {
|
|
|
100659
100819
|
}
|
|
100660
100820
|
const description = parts.length > 0 ? `${parts.join(" and ")} ${hasOrHave} not been ${action2} yet` : "0 steps have not been run yet";
|
|
100661
100821
|
super(description);
|
|
100822
|
+
__publicField(this, "items");
|
|
100823
|
+
/** @deprecated Use `items` instead. */
|
|
100662
100824
|
__publicField(this, "steps");
|
|
100663
100825
|
__publicField(this, "globalThis");
|
|
100664
100826
|
__publicField(this, "stepCount");
|
|
@@ -100668,7 +100830,8 @@ class WorkflowSuspension extends Error {
|
|
|
100668
100830
|
__publicField(this, "hookDisposedCount");
|
|
100669
100831
|
__publicField(this, "abortCount");
|
|
100670
100832
|
this.name = "WorkflowSuspension";
|
|
100671
|
-
this.
|
|
100833
|
+
this.items = items;
|
|
100834
|
+
this.steps = items;
|
|
100672
100835
|
this.globalThis = global2;
|
|
100673
100836
|
this.stepCount = stepCount;
|
|
100674
100837
|
this.hookCount = hookCount;
|
|
@@ -100852,7 +101015,8 @@ const DeploymentId = SemanticConvention$2("deployment.id");
|
|
|
100852
101015
|
const HookToken = SemanticConvention$2("workflow.hook.token");
|
|
100853
101016
|
const HookId = SemanticConvention$2("workflow.hook.id");
|
|
100854
101017
|
const HookFound = SemanticConvention$2("workflow.hook.found");
|
|
100855
|
-
const
|
|
101018
|
+
const HookResumeCommitted = SemanticConvention$2("workflow.hook.resume_committed");
|
|
101019
|
+
const HookWakePublished = SemanticConvention$2("workflow.hook.wake_published");
|
|
100856
101020
|
const WorkflowSuspensionState = SemanticConvention$2("workflow.suspension.state");
|
|
100857
101021
|
const WorkflowSuspensionHookCount = SemanticConvention$2("workflow.suspension.hook_count");
|
|
100858
101022
|
const WorkflowSuspensionStepCount = SemanticConvention$2("workflow.suspension.step_count");
|
|
@@ -100897,6 +101061,16 @@ const Tracer = once$1(async () => {
|
|
|
100897
101061
|
return tracer;
|
|
100898
101062
|
});
|
|
100899
101063
|
let otelDiagLogged$1 = false;
|
|
101064
|
+
function describeThrownValue(value) {
|
|
101065
|
+
try {
|
|
101066
|
+
if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string") {
|
|
101067
|
+
return value.message;
|
|
101068
|
+
}
|
|
101069
|
+
return String(value);
|
|
101070
|
+
} catch {
|
|
101071
|
+
return "Unknown error";
|
|
101072
|
+
}
|
|
101073
|
+
}
|
|
100900
101074
|
function logOtelDiagnosticOnce$1(otel2, tracer) {
|
|
100901
101075
|
var _a3, _b2, _c2, _d2, _e2;
|
|
100902
101076
|
const debugEnabled = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
@@ -100941,7 +101115,7 @@ async function trace$2(spanName, ...args) {
|
|
|
100941
101115
|
} else {
|
|
100942
101116
|
span.setStatus({
|
|
100943
101117
|
code: otel2.SpanStatusCode.ERROR,
|
|
100944
|
-
message: e
|
|
101118
|
+
message: describeThrownValue(e)
|
|
100945
101119
|
});
|
|
100946
101120
|
}
|
|
100947
101121
|
throw e;
|
|
@@ -101347,6 +101521,7 @@ async function getWorldLazy() {
|
|
|
101347
101521
|
}
|
|
101348
101522
|
throw new Error("Workflow world runtime was not initialized. Import from the host workflow entrypoints (`workflow`, `workflow/api`, or `workflow/runtime`) so @workflow/core/runtime/world-init can register getWorld before getWorldLazy() is used.");
|
|
101349
101523
|
}
|
|
101524
|
+
const GUEST_CODE_EXECUTION_SAMPLE_LIMIT = 5;
|
|
101350
101525
|
let activeStats = null;
|
|
101351
101526
|
let reportedProxies = null;
|
|
101352
101527
|
function withGuestCodeStats(stats2, fn2) {
|
|
@@ -101368,6 +101543,10 @@ function isUseStepClosureFn(fn2) {
|
|
|
101368
101543
|
function recordGuestCode(kind, detail) {
|
|
101369
101544
|
if (!activeStats)
|
|
101370
101545
|
return;
|
|
101546
|
+
activeStats.totalExecutions = (activeStats.totalExecutions ?? activeStats.executions.length) + 1;
|
|
101547
|
+
if (activeStats.executions.length >= GUEST_CODE_EXECUTION_SAMPLE_LIMIT) {
|
|
101548
|
+
return;
|
|
101549
|
+
}
|
|
101371
101550
|
const execution = { kind };
|
|
101372
101551
|
if (detail !== void 0)
|
|
101373
101552
|
execution.detail = detail;
|
|
@@ -102592,7 +102771,8 @@ async function recordCompression(stats2, operation) {
|
|
|
102592
102771
|
}
|
|
102593
102772
|
}
|
|
102594
102773
|
async function recordGuestCodeExecutions(stats2) {
|
|
102595
|
-
|
|
102774
|
+
const totalExecutions = stats2.totalExecutions ?? stats2.executions.length;
|
|
102775
|
+
if (totalExecutions === 0)
|
|
102596
102776
|
return;
|
|
102597
102777
|
try {
|
|
102598
102778
|
const span = await getActiveSpan();
|
|
@@ -102602,7 +102782,7 @@ async function recordGuestCodeExecutions(stats2) {
|
|
|
102602
102782
|
...new Set(stats2.executions.map((e) => e.detail ? `${e.kind} (${e.detail})` : e.kind))
|
|
102603
102783
|
];
|
|
102604
102784
|
span.setAttributes({
|
|
102605
|
-
...SerializationGuestCodeExecutions(
|
|
102785
|
+
...SerializationGuestCodeExecutions(totalExecutions),
|
|
102606
102786
|
...SerializationGuestCodeDetails(details)
|
|
102607
102787
|
});
|
|
102608
102788
|
} catch {
|
|
@@ -103386,7 +103566,7 @@ function attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops) {
|
|
|
103386
103566
|
})());
|
|
103387
103567
|
}, { once: true });
|
|
103388
103568
|
}
|
|
103389
|
-
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
103569
|
+
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
|
|
103390
103570
|
return {
|
|
103391
103571
|
...getAllBaseReducers(global2),
|
|
103392
103572
|
ReadableStream: (value) => {
|
|
@@ -103408,7 +103588,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
103408
103588
|
ops.push(value.pipeTo(writable));
|
|
103409
103589
|
}
|
|
103410
103590
|
} else {
|
|
103411
|
-
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
103591
|
+
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
|
|
103412
103592
|
}
|
|
103413
103593
|
const s2 = { name: name2 };
|
|
103414
103594
|
if (type)
|
|
@@ -103440,7 +103620,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
103440
103620
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
103441
103621
|
const name2 = `strm_${streamId}`;
|
|
103442
103622
|
const readable2 = new WorkflowServerReadableStream(runId, name2);
|
|
103443
|
-
|
|
103623
|
+
readbackOps.push(readable2.pipeTo(value));
|
|
103444
103624
|
return { name: name2 };
|
|
103445
103625
|
},
|
|
103446
103626
|
AbortController: (value) => {
|
|
@@ -103543,7 +103723,7 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
103543
103723
|
}
|
|
103544
103724
|
};
|
|
103545
103725
|
}
|
|
103546
|
-
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
103726
|
+
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
|
|
103547
103727
|
return {
|
|
103548
103728
|
...getAllBaseReducers(global2),
|
|
103549
103729
|
ReadableStream: (value) => {
|
|
@@ -103570,7 +103750,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
103570
103750
|
ops.push(value.pipeTo(writable));
|
|
103571
103751
|
}
|
|
103572
103752
|
} else {
|
|
103573
|
-
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
103753
|
+
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
|
|
103574
103754
|
}
|
|
103575
103755
|
}
|
|
103576
103756
|
const s2 = { name: name2 };
|
|
@@ -103588,7 +103768,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
103588
103768
|
if (!name2) {
|
|
103589
103769
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
103590
103770
|
name2 = `strm_${streamId}`;
|
|
103591
|
-
|
|
103771
|
+
readbackOps.push(new WorkflowServerReadableStream(runId, name2).pipeThrough(getDeserializeStream(getStepRevivers(global2, readbackOps, runId, cryptoKey), cryptoKey)).pipeTo(value));
|
|
103592
103772
|
}
|
|
103593
103773
|
const s2 = { name: name2 };
|
|
103594
103774
|
if (typeof foreignRunId === "string")
|
|
@@ -103708,8 +103888,8 @@ function reviveAbortController(value, ops, runId) {
|
|
|
103708
103888
|
if (value.hookToken) {
|
|
103709
103889
|
const hookResume = (async () => {
|
|
103710
103890
|
try {
|
|
103711
|
-
const { resumeHook:
|
|
103712
|
-
await
|
|
103891
|
+
const { resumeHook: resumeHook2 } = await Promise.resolve().then(() => resumeHook$3);
|
|
103892
|
+
await resumeHook2(value.hookToken, {
|
|
103713
103893
|
aborted: true,
|
|
103714
103894
|
reason
|
|
103715
103895
|
});
|
|
@@ -104145,16 +104325,16 @@ function deserializePreparedReplayPayload(prepared, global2 = globalThis, extraR
|
|
|
104145
104325
|
}
|
|
104146
104326
|
});
|
|
104147
104327
|
}
|
|
104148
|
-
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
104328
|
+
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, readbackOps = ops) {
|
|
104149
104329
|
if (v1Compat) {
|
|
104150
|
-
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
|
|
104330
|
+
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps));
|
|
104151
104331
|
return revive(str);
|
|
104152
104332
|
}
|
|
104153
104333
|
try {
|
|
104154
104334
|
const compressionStats = {};
|
|
104155
104335
|
const result = await serialize$3(value, key, {
|
|
104156
104336
|
global: global2,
|
|
104157
|
-
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams)),
|
|
104337
|
+
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps)),
|
|
104158
104338
|
compression,
|
|
104159
104339
|
compressionStats
|
|
104160
104340
|
});
|
|
@@ -104221,16 +104401,16 @@ async function hydrateStepArguments(value, runId, key, ops = [], global2 = globa
|
|
|
104221
104401
|
await recordCompression(compressionStats, "deserialize");
|
|
104222
104402
|
return result;
|
|
104223
104403
|
}
|
|
104224
|
-
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier) {
|
|
104404
|
+
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier, readbackOps = ops) {
|
|
104225
104405
|
if (v1Compat) {
|
|
104226
|
-
const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier));
|
|
104406
|
+
const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps));
|
|
104227
104407
|
return revive(str);
|
|
104228
104408
|
}
|
|
104229
104409
|
try {
|
|
104230
104410
|
const compressionStats = {};
|
|
104231
104411
|
const result = await serialize$2(value, key, {
|
|
104232
104412
|
global: global2,
|
|
104233
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier)),
|
|
104413
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps)),
|
|
104234
104414
|
compression,
|
|
104235
104415
|
compressionStats
|
|
104236
104416
|
});
|
|
@@ -104299,7 +104479,7 @@ globalSingleton("@workflow/core//envWarnings", 1, () => ({
|
|
|
104299
104479
|
maxInlineStepsValues: /* @__PURE__ */ new Set(),
|
|
104300
104480
|
maxEventsValues: /* @__PURE__ */ new Set()
|
|
104301
104481
|
}));
|
|
104302
|
-
const version$1 = "5.0.0-beta.
|
|
104482
|
+
const version$1 = "5.0.0-beta.47";
|
|
104303
104483
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
104304
104484
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
104305
104485
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
@@ -104638,9 +104818,7 @@ async function getAllPorts() {
|
|
|
104638
104818
|
return [];
|
|
104639
104819
|
}
|
|
104640
104820
|
} catch (error2) {
|
|
104641
|
-
|
|
104642
|
-
console.debug("[getAllPorts] Detection failed:", error2);
|
|
104643
|
-
}
|
|
104821
|
+
debugLog("[getAllPorts] Detection failed:", error2);
|
|
104644
104822
|
return [];
|
|
104645
104823
|
}
|
|
104646
104824
|
}
|
|
@@ -104678,9 +104856,7 @@ async function getWorkflowPort(options) {
|
|
|
104678
104856
|
if (workflowPort) {
|
|
104679
104857
|
return workflowPort.port;
|
|
104680
104858
|
}
|
|
104681
|
-
|
|
104682
|
-
console.debug("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
|
|
104683
|
-
}
|
|
104859
|
+
debugLog("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
|
|
104684
104860
|
return ports[0];
|
|
104685
104861
|
}
|
|
104686
104862
|
function once(fn2) {
|
|
@@ -107796,7 +107972,7 @@ function requireDiagnostics() {
|
|
|
107796
107972
|
proxyConnected: diagnosticsChannel.channel("undici:proxy:connected")
|
|
107797
107973
|
};
|
|
107798
107974
|
let isTrackingClientEvents = false;
|
|
107799
|
-
function trackClientEvents(
|
|
107975
|
+
function trackClientEvents(debugLog2 = undiciDebugLog) {
|
|
107800
107976
|
if (isTrackingClientEvents) {
|
|
107801
107977
|
return;
|
|
107802
107978
|
}
|
|
@@ -107811,7 +107987,7 @@ function requireDiagnostics() {
|
|
|
107811
107987
|
const {
|
|
107812
107988
|
connectParams: { version: version2, protocol, port, host }
|
|
107813
107989
|
} = evt;
|
|
107814
|
-
|
|
107990
|
+
debugLog2(
|
|
107815
107991
|
"connecting to %s%s using %s%s",
|
|
107816
107992
|
host,
|
|
107817
107993
|
port ? `:${port}` : "",
|
|
@@ -107826,7 +108002,7 @@ function requireDiagnostics() {
|
|
|
107826
108002
|
const {
|
|
107827
108003
|
connectParams: { version: version2, protocol, port, host }
|
|
107828
108004
|
} = evt;
|
|
107829
|
-
|
|
108005
|
+
debugLog2(
|
|
107830
108006
|
"connected to %s%s using %s%s",
|
|
107831
108007
|
host,
|
|
107832
108008
|
port ? `:${port}` : "",
|
|
@@ -107842,7 +108018,7 @@ function requireDiagnostics() {
|
|
|
107842
108018
|
connectParams: { version: version2, protocol, port, host },
|
|
107843
108019
|
error: error2
|
|
107844
108020
|
} = evt;
|
|
107845
|
-
|
|
108021
|
+
debugLog2(
|
|
107846
108022
|
"connection to %s%s using %s%s errored - %s",
|
|
107847
108023
|
host,
|
|
107848
108024
|
port ? `:${port}` : "",
|
|
@@ -107858,12 +108034,12 @@ function requireDiagnostics() {
|
|
|
107858
108034
|
const {
|
|
107859
108035
|
request: { method, path: path2, origin }
|
|
107860
108036
|
} = evt;
|
|
107861
|
-
|
|
108037
|
+
debugLog2("sending request to %s %s%s", method, origin, path2);
|
|
107862
108038
|
}
|
|
107863
108039
|
);
|
|
107864
108040
|
}
|
|
107865
108041
|
let isTrackingRequestEvents = false;
|
|
107866
|
-
function trackRequestEvents(
|
|
108042
|
+
function trackRequestEvents(debugLog2 = undiciDebugLog) {
|
|
107867
108043
|
if (isTrackingRequestEvents) {
|
|
107868
108044
|
return;
|
|
107869
108045
|
}
|
|
@@ -107879,7 +108055,7 @@ function requireDiagnostics() {
|
|
|
107879
108055
|
request: { method, path: path2, origin },
|
|
107880
108056
|
response: { statusCode }
|
|
107881
108057
|
} = evt;
|
|
107882
|
-
|
|
108058
|
+
debugLog2(
|
|
107883
108059
|
"received response to %s %s%s - HTTP %d",
|
|
107884
108060
|
method,
|
|
107885
108061
|
origin,
|
|
@@ -107894,7 +108070,7 @@ function requireDiagnostics() {
|
|
|
107894
108070
|
const {
|
|
107895
108071
|
request: { method, path: path2, origin }
|
|
107896
108072
|
} = evt;
|
|
107897
|
-
|
|
108073
|
+
debugLog2("trailers received from %s %s%s", method, origin, path2);
|
|
107898
108074
|
}
|
|
107899
108075
|
);
|
|
107900
108076
|
diagnosticsChannel.subscribe(
|
|
@@ -107904,7 +108080,7 @@ function requireDiagnostics() {
|
|
|
107904
108080
|
request: { method, path: path2, origin },
|
|
107905
108081
|
error: error2
|
|
107906
108082
|
} = evt;
|
|
107907
|
-
|
|
108083
|
+
debugLog2(
|
|
107908
108084
|
"request to %s %s%s errored - %s",
|
|
107909
108085
|
method,
|
|
107910
108086
|
origin,
|
|
@@ -107915,7 +108091,7 @@ function requireDiagnostics() {
|
|
|
107915
108091
|
);
|
|
107916
108092
|
}
|
|
107917
108093
|
let isTrackingWebSocketEvents = false;
|
|
107918
|
-
function trackWebSocketEvents(
|
|
108094
|
+
function trackWebSocketEvents(debugLog2 = websocketDebuglog) {
|
|
107919
108095
|
if (isTrackingWebSocketEvents) {
|
|
107920
108096
|
return;
|
|
107921
108097
|
}
|
|
@@ -107929,9 +108105,9 @@ function requireDiagnostics() {
|
|
|
107929
108105
|
(evt) => {
|
|
107930
108106
|
if (evt.address != null) {
|
|
107931
108107
|
const { address, port } = evt.address;
|
|
107932
|
-
|
|
108108
|
+
debugLog2("connection opened %s%s", address, port ? `:${port}` : "");
|
|
107933
108109
|
} else {
|
|
107934
|
-
|
|
108110
|
+
debugLog2("connection opened");
|
|
107935
108111
|
}
|
|
107936
108112
|
}
|
|
107937
108113
|
);
|
|
@@ -107939,7 +108115,7 @@ function requireDiagnostics() {
|
|
|
107939
108115
|
"undici:websocket:close",
|
|
107940
108116
|
(evt) => {
|
|
107941
108117
|
const { websocket: websocket2, code: code2, reason } = evt;
|
|
107942
|
-
|
|
108118
|
+
debugLog2(
|
|
107943
108119
|
"closed connection to %s - %s %s",
|
|
107944
108120
|
websocket2.url,
|
|
107945
108121
|
code2,
|
|
@@ -107950,19 +108126,19 @@ function requireDiagnostics() {
|
|
|
107950
108126
|
diagnosticsChannel.subscribe(
|
|
107951
108127
|
"undici:websocket:socket_error",
|
|
107952
108128
|
(err) => {
|
|
107953
|
-
|
|
108129
|
+
debugLog2("connection errored - %s", err.message);
|
|
107954
108130
|
}
|
|
107955
108131
|
);
|
|
107956
108132
|
diagnosticsChannel.subscribe(
|
|
107957
108133
|
"undici:websocket:ping",
|
|
107958
108134
|
(evt) => {
|
|
107959
|
-
|
|
108135
|
+
debugLog2("ping received");
|
|
107960
108136
|
}
|
|
107961
108137
|
);
|
|
107962
108138
|
diagnosticsChannel.subscribe(
|
|
107963
108139
|
"undici:websocket:pong",
|
|
107964
108140
|
(evt) => {
|
|
107965
|
-
|
|
108141
|
+
debugLog2("pong received");
|
|
107966
108142
|
}
|
|
107967
108143
|
);
|
|
107968
108144
|
}
|
|
@@ -131944,7 +132120,7 @@ function createQueue$2(config2) {
|
|
|
131944
132120
|
}
|
|
131945
132121
|
const token = semaphore.tryAcquire();
|
|
131946
132122
|
if (!token) {
|
|
131947
|
-
|
|
132123
|
+
debugLog(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
|
|
131948
132124
|
await semaphore.acquire();
|
|
131949
132125
|
}
|
|
131950
132126
|
const MAX_LOCAL_SAFETY_LIMIT = 256;
|
|
@@ -131975,6 +132151,7 @@ function createQueue$2(config2) {
|
|
|
131975
132151
|
headers: new Headers(headers2),
|
|
131976
132152
|
body: body2,
|
|
131977
132153
|
agents: nodeHttpAgents,
|
|
132154
|
+
signal: closeSignal,
|
|
131978
132155
|
headersTimeoutMs: agentOptions.headersTimeout,
|
|
131979
132156
|
bodyTimeoutMs: agentOptions.bodyTimeout
|
|
131980
132157
|
}) : (
|
|
@@ -131984,7 +132161,8 @@ function createQueue$2(config2) {
|
|
|
131984
132161
|
duplex: "half",
|
|
131985
132162
|
dispatcher: httpAgent,
|
|
131986
132163
|
headers: headers2,
|
|
131987
|
-
body: body2
|
|
132164
|
+
body: body2,
|
|
132165
|
+
signal: closeSignal
|
|
131988
132166
|
})
|
|
131989
132167
|
);
|
|
131990
132168
|
}
|
|
@@ -136368,7 +136546,7 @@ function createWorld$2(args) {
|
|
|
136368
136546
|
const basedir = mergedConfig.dataDir;
|
|
136369
136547
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
136370
136548
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
136371
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
136549
|
+
const { HookSchema: HookSchema2 } = await import("./index-DDMGTwh_.js");
|
|
136372
136550
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
136373
136551
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
136374
136552
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -136551,8 +136729,8 @@ function requireGetVercelOidcToken() {
|
|
|
136551
136729
|
}
|
|
136552
136730
|
try {
|
|
136553
136731
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
136554
|
-
await import("./token-util-
|
|
136555
|
-
await import("./token-
|
|
136732
|
+
await import("./token-util-D_gzpVW2.js").then((n) => n.t),
|
|
136733
|
+
await import("./token-BSEhy2T4.js").then((n) => n.t)
|
|
136556
136734
|
]);
|
|
136557
136735
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
136558
136736
|
await refreshToken(options);
|
|
@@ -137115,7 +137293,7 @@ function requireDist() {
|
|
|
137115
137293
|
return dist;
|
|
137116
137294
|
}
|
|
137117
137295
|
var distExports = requireDist();
|
|
137118
|
-
const version = "5.0.0-beta.
|
|
137296
|
+
const version = "5.0.0-beta.43";
|
|
137119
137297
|
const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
|
|
137120
137298
|
dispatcher: void 0,
|
|
137121
137299
|
streamDispatcher: void 0,
|
|
@@ -138476,7 +138654,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
|
|
|
138476
138654
|
};
|
|
138477
138655
|
}
|
|
138478
138656
|
async function getDeadline() {
|
|
138479
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
138657
|
+
const { getDeadline: getDeadline2 } = await import("./index-jQkBA81b.js").then((n) => n.i);
|
|
138480
138658
|
return getDeadline2();
|
|
138481
138659
|
}
|
|
138482
138660
|
const WORKFLOW_SERVER_SERVICE = {
|
|
@@ -143429,7 +143607,7 @@ const wsEventsChannelForInvocation = (runId, config2) => {
|
|
|
143429
143607
|
open() {
|
|
143430
143608
|
if (!runId || !isWsEventsTransportEnabled())
|
|
143431
143609
|
return;
|
|
143432
|
-
claim = import("./ws-transport-
|
|
143610
|
+
claim = import("./ws-transport-DbDOLT7f.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
|
|
143433
143611
|
},
|
|
143434
143612
|
/**
|
|
143435
143613
|
* Awaited, unlike the open: work scheduled after the handler returns is not
|
|
@@ -143635,17 +143813,30 @@ function createQueue$1(config2) {
|
|
|
143635
143813
|
const ResolveLatestDeploymentResponseSchema = object$1({
|
|
143636
143814
|
id: string$3()
|
|
143637
143815
|
});
|
|
143816
|
+
async function resolveDeploymentIdentityToken(config2) {
|
|
143817
|
+
if (config2 == null ? void 0 : config2.token)
|
|
143818
|
+
return config2.token;
|
|
143819
|
+
if (process.env.VERCEL === "1") {
|
|
143820
|
+
const oidcToken = await distExports.getVercelOidcToken().catch(() => null);
|
|
143821
|
+
if (oidcToken)
|
|
143822
|
+
return oidcToken;
|
|
143823
|
+
}
|
|
143824
|
+
return resolveVercelApiToken(config2);
|
|
143825
|
+
}
|
|
143638
143826
|
function createResolveLatestDeploymentId(config2) {
|
|
143639
143827
|
return async function resolveLatestDeploymentId() {
|
|
143828
|
+
var _a3;
|
|
143640
143829
|
const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
143641
143830
|
if (!currentDeploymentId) {
|
|
143642
143831
|
throw new Error(missingDeploymentIdMessage("Resolving the latest deployment for deploymentId: 'latest'"));
|
|
143643
143832
|
}
|
|
143644
|
-
const token = await
|
|
143833
|
+
const token = await resolveDeploymentIdentityToken(config2);
|
|
143645
143834
|
if (!token) {
|
|
143646
143835
|
throw new Error("Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available");
|
|
143647
143836
|
}
|
|
143648
|
-
const
|
|
143837
|
+
const teamId = (_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.teamId;
|
|
143838
|
+
const query = teamId ? `?${new URLSearchParams({ teamId })}` : "";
|
|
143839
|
+
const url2 = `https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(currentDeploymentId)}${query}`;
|
|
143649
143840
|
const response2 = await instrumentedFetch({
|
|
143650
143841
|
method: "GET",
|
|
143651
143842
|
url: url2,
|
|
@@ -143662,7 +143853,8 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
143662
143853
|
} catch {
|
|
143663
143854
|
body2 = "<unable to read response body>";
|
|
143664
143855
|
}
|
|
143665
|
-
|
|
143856
|
+
const hint2 = res.status === 404 ? ". The deployment exists but was not visible to the identity this request authenticated as, which means the request resolved to a different team. Set the World's `projectConfig.teamId` to scope it explicitly." : "";
|
|
143857
|
+
return new Error(`Failed to resolve latest deployment for ${currentDeploymentId}: HTTP ${res.status} ${res.statusText}${body2 ? ` — ${body2}` : ""}${hint2}`);
|
|
143666
143858
|
}
|
|
143667
143859
|
});
|
|
143668
143860
|
const data = await response2.json();
|
|
@@ -143673,6 +143865,14 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
143673
143865
|
return result.data.id;
|
|
143674
143866
|
};
|
|
143675
143867
|
}
|
|
143868
|
+
class ReplayEventObserverError extends Error {
|
|
143869
|
+
constructor(error2) {
|
|
143870
|
+
super("Replay event observer failed", { cause: error2 });
|
|
143871
|
+
__publicField(this, "error");
|
|
143872
|
+
this.error = error2;
|
|
143873
|
+
this.name = "ReplayEventObserverError";
|
|
143874
|
+
}
|
|
143875
|
+
}
|
|
143676
143876
|
const EVENT_RETRY_ELIGIBILITY = {
|
|
143677
143877
|
// Creates: conditional create → 409 EntityConflictError if it already exists.
|
|
143678
143878
|
run_created: {
|
|
@@ -143800,6 +144000,8 @@ function collectErrorMarkers(err, depth = 0) {
|
|
|
143800
144000
|
return markers;
|
|
143801
144001
|
}
|
|
143802
144002
|
function isRetryableEventPostError(err) {
|
|
144003
|
+
if (err instanceof ReplayEventObserverError)
|
|
144004
|
+
return false;
|
|
143803
144005
|
if (EntityConflictError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
|
|
143804
144006
|
return false;
|
|
143805
144007
|
}
|
|
@@ -143887,6 +144089,8 @@ async function withEventPostRetry(fn2, eventType, options) {
|
|
|
143887
144089
|
}
|
|
143888
144090
|
}
|
|
143889
144091
|
const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
|
|
144092
|
+
class IncompleteFrameError extends Error {
|
|
144093
|
+
}
|
|
143890
144094
|
const CborObjectSchema = record(string$3(), unknown$1());
|
|
143891
144095
|
function encodeFrame(meta2, body2) {
|
|
143892
144096
|
const metaBytes = new Uint8Array(encode$1(meta2));
|
|
@@ -143907,7 +144111,14 @@ async function* decodeFrames(source) {
|
|
|
143907
144111
|
const parts = [buffer2];
|
|
143908
144112
|
let byteLength = buffer2.byteLength;
|
|
143909
144113
|
while (byteLength < needed) {
|
|
143910
|
-
|
|
144114
|
+
let chunk;
|
|
144115
|
+
try {
|
|
144116
|
+
chunk = await chunks.next();
|
|
144117
|
+
} catch (cause) {
|
|
144118
|
+
throw new IncompleteFrameError("decodeFrames: source stream failed", {
|
|
144119
|
+
cause
|
|
144120
|
+
});
|
|
144121
|
+
}
|
|
143911
144122
|
if (chunk.done)
|
|
143912
144123
|
return false;
|
|
143913
144124
|
if (chunk.value.byteLength === 0)
|
|
@@ -143935,16 +144146,16 @@ async function* decodeFrames(source) {
|
|
|
143935
144146
|
const metaLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
|
|
143936
144147
|
take(4);
|
|
143937
144148
|
if (!await refill(metaLen)) {
|
|
143938
|
-
throw new
|
|
144149
|
+
throw new IncompleteFrameError("decodeFrames: truncated meta block");
|
|
143939
144150
|
}
|
|
143940
144151
|
const meta2 = CborObjectSchema.parse(decode$1(take(metaLen)));
|
|
143941
144152
|
if (!await refill(4)) {
|
|
143942
|
-
throw new
|
|
144153
|
+
throw new IncompleteFrameError("decodeFrames: truncated body length");
|
|
143943
144154
|
}
|
|
143944
144155
|
const bodyLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
|
|
143945
144156
|
take(4);
|
|
143946
144157
|
if (bodyLen > 0 && !await refill(bodyLen)) {
|
|
143947
|
-
throw new
|
|
144158
|
+
throw new IncompleteFrameError("decodeFrames: truncated body bytes");
|
|
143948
144159
|
}
|
|
143949
144160
|
yield { meta: meta2, body: buffer2.slice(0, bodyLen) };
|
|
143950
144161
|
take(bodyLen);
|
|
@@ -144209,6 +144420,12 @@ const EventStreamEndSchema = object$1({
|
|
|
144209
144420
|
next: string$3().optional(),
|
|
144210
144421
|
hasMore: boolean$3()
|
|
144211
144422
|
});
|
|
144423
|
+
const EventStreamErrorSchema = object$1({
|
|
144424
|
+
_error: literal(1),
|
|
144425
|
+
code: string$3(),
|
|
144426
|
+
message: string$3().optional()
|
|
144427
|
+
});
|
|
144428
|
+
const PAYLOAD_MISSING_ERROR_CODE = "payload-missing";
|
|
144212
144429
|
const legacyStructuredErrorEventTypes = /* @__PURE__ */ new Set([
|
|
144213
144430
|
"run_failed",
|
|
144214
144431
|
"step_failed",
|
|
@@ -144450,17 +144667,35 @@ async function createWorkflowRunEventV4(input, config2) {
|
|
|
144450
144667
|
const response2 = await postWorkflowRunEventV4(input, "materialized", config2);
|
|
144451
144668
|
const contentType = response2.headers.get("content-type");
|
|
144452
144669
|
if (contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE)) {
|
|
144453
|
-
throw new
|
|
144670
|
+
throw new WorkflowWorldError("v4 createEvent: unexpected event page", {
|
|
144671
|
+
code: "SCHEMA_VALIDATION"
|
|
144672
|
+
});
|
|
144454
144673
|
}
|
|
144455
144674
|
return decodeCreateEventResponse(response2, input.eventType);
|
|
144456
144675
|
}
|
|
144457
144676
|
async function decodeCreateEventResponse(response2, eventType) {
|
|
144458
|
-
|
|
144677
|
+
let bodyBytes;
|
|
144678
|
+
try {
|
|
144679
|
+
bodyBytes = new Uint8Array(await response2.arrayBuffer());
|
|
144680
|
+
} catch (cause) {
|
|
144681
|
+
throw new WorkflowWorldError("v4 createEvent: failed to read response body", { code: "TRANSPORT", cause });
|
|
144682
|
+
}
|
|
144459
144683
|
if (bodyBytes.byteLength === 0) {
|
|
144460
|
-
throw new
|
|
144684
|
+
throw new WorkflowWorldError("v4 createEvent: empty response body", {
|
|
144685
|
+
code: "PARSE_ERROR"
|
|
144686
|
+
});
|
|
144461
144687
|
}
|
|
144462
144688
|
const schema = CreateEventV4BodySchemas[eventType].refine(({ event }) => event.eventType === eventType || eventType === "hook_created" && event.eventType === "hook_conflict", { path: ["event", "eventType"] });
|
|
144463
|
-
|
|
144689
|
+
let decoded;
|
|
144690
|
+
try {
|
|
144691
|
+
decoded = decode$1(bodyBytes);
|
|
144692
|
+
} catch (cause) {
|
|
144693
|
+
throw new WorkflowWorldError("v4 createEvent: invalid CBOR response body", {
|
|
144694
|
+
code: "PARSE_ERROR",
|
|
144695
|
+
cause
|
|
144696
|
+
});
|
|
144697
|
+
}
|
|
144698
|
+
const parsedBody = schema.safeParse(decoded);
|
|
144464
144699
|
if (!parsedBody.success) {
|
|
144465
144700
|
throw new WorkflowWorldError("v4 createEvent: invalid response body", {
|
|
144466
144701
|
code: "SCHEMA_VALIDATION",
|
|
@@ -144469,11 +144704,12 @@ async function decodeCreateEventResponse(response2, eventType) {
|
|
|
144469
144704
|
}
|
|
144470
144705
|
return parsedBody.data;
|
|
144471
144706
|
}
|
|
144472
|
-
async function createWorkflowRunStartedEventV4(input, config2) {
|
|
144707
|
+
async function createWorkflowRunStartedEventV4(input, config2, replayEventObserver) {
|
|
144473
144708
|
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "run_started" }, "event-stream", config2);
|
|
144474
|
-
const
|
|
144475
|
-
|
|
144476
|
-
|
|
144709
|
+
const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
|
|
144710
|
+
if (!page.cursor) {
|
|
144711
|
+
throw new WorkflowWorldError("v4 createEvent: event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
144712
|
+
}
|
|
144477
144713
|
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
144478
144714
|
if (!maxEvents.success) {
|
|
144479
144715
|
throw new WorkflowWorldError("v4 createEvent: invalid max-events header", {
|
|
@@ -144481,7 +144717,7 @@ async function createWorkflowRunStartedEventV4(input, config2) {
|
|
|
144481
144717
|
cause: maxEvents.error
|
|
144482
144718
|
});
|
|
144483
144719
|
}
|
|
144484
|
-
return {
|
|
144720
|
+
return { ...page, maxEvents: maxEvents.data };
|
|
144485
144721
|
}
|
|
144486
144722
|
const BatchItemFailureSchema = object$1({
|
|
144487
144723
|
status: number$3().int(),
|
|
@@ -144551,7 +144787,7 @@ function wsReplyStatus(reply, endpoint) {
|
|
|
144551
144787
|
return status;
|
|
144552
144788
|
}
|
|
144553
144789
|
async function postEventFrameOverWs(input, config2) {
|
|
144554
|
-
const { resolveWsTransport } = await import("./ws-transport-
|
|
144790
|
+
const { resolveWsTransport } = await import("./ws-transport-DbDOLT7f.js");
|
|
144555
144791
|
const { runId } = input;
|
|
144556
144792
|
const resolved = resolveWsTransport(runId, config2);
|
|
144557
144793
|
if (!resolved)
|
|
@@ -144605,7 +144841,7 @@ async function postEventFrameOverWs(input, config2) {
|
|
|
144605
144841
|
};
|
|
144606
144842
|
});
|
|
144607
144843
|
}
|
|
144608
|
-
async function createHookReceivedPreloadEventV4(input, config2) {
|
|
144844
|
+
async function createHookReceivedPreloadEventV4(input, config2, replayEventObserver) {
|
|
144609
144845
|
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "hook_received" }, "event-stream", config2);
|
|
144610
144846
|
const contentType = response2.headers.get("content-type");
|
|
144611
144847
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
@@ -144614,12 +144850,10 @@ async function createHookReceivedPreloadEventV4(input, config2) {
|
|
|
144614
144850
|
result: await decodeCreateEventResponse(response2, "hook_received")
|
|
144615
144851
|
};
|
|
144616
144852
|
}
|
|
144617
|
-
const
|
|
144618
|
-
const page = await consumeEventFrameStream(response2, "createEvent", events2);
|
|
144853
|
+
const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
|
|
144619
144854
|
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
144620
144855
|
return {
|
|
144621
144856
|
kind: "stream",
|
|
144622
|
-
events: events2,
|
|
144623
144857
|
...page,
|
|
144624
144858
|
canonicalEventId: response2.headers.get(EVENT_ID_HEADER) ?? void 0,
|
|
144625
144859
|
maxEvents: maxEvents.success ? maxEvents.data : void 0
|
|
@@ -144643,31 +144877,117 @@ async function getEventV4(runId, eventId, remoteRefBehavior, config2) {
|
|
|
144643
144877
|
}
|
|
144644
144878
|
const chunks = response2.body;
|
|
144645
144879
|
for await (const frame2 of decodeFrames(chunks)) {
|
|
144880
|
+
if (frame2.meta._error === 1) {
|
|
144881
|
+
throw streamErrorFrameToError(frame2.meta, "getEvent");
|
|
144882
|
+
}
|
|
144883
|
+
if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
|
|
144884
|
+
throw new Error("v4 getEvent: unexpected control frame");
|
|
144885
|
+
}
|
|
144646
144886
|
return decodeEventFrame(frame2);
|
|
144647
144887
|
}
|
|
144648
144888
|
throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
|
|
144649
144889
|
}
|
|
144650
|
-
|
|
144890
|
+
function streamErrorFrameToError(meta2, opName) {
|
|
144891
|
+
const parsed = EventStreamErrorSchema.safeParse(meta2);
|
|
144892
|
+
if (!parsed.success) {
|
|
144893
|
+
return new WorkflowWorldError(`v4 ${opName}: malformed terminal error frame`, { code: "SCHEMA_VALIDATION", cause: parsed.error });
|
|
144894
|
+
}
|
|
144895
|
+
const { code: code2, message: message2 } = parsed.data;
|
|
144896
|
+
const detail = message2 ?? "(no detail)";
|
|
144897
|
+
if (code2 === PAYLOAD_MISSING_ERROR_CODE) {
|
|
144898
|
+
return new CorruptedEventLogError(`the event log references a payload that no longer exists in storage: ${detail}`);
|
|
144899
|
+
}
|
|
144900
|
+
return new WorkflowWorldError(`v4 ${opName}: stream ended with terminal error "${code2}": ${detail}`, { code: "WORLD_CONTRACT_ERROR" });
|
|
144901
|
+
}
|
|
144902
|
+
const MAX_PARTIAL_STREAM_RETRIES = 2;
|
|
144903
|
+
function partialEventFrameStream(events2, error2) {
|
|
144904
|
+
var _a3;
|
|
144905
|
+
const eventId = (_a3 = events2.at(-1)) == null ? void 0 : _a3.eventId;
|
|
144906
|
+
if (!eventId)
|
|
144907
|
+
throw error2;
|
|
144908
|
+
return {
|
|
144909
|
+
kind: "partial",
|
|
144910
|
+
events: events2,
|
|
144911
|
+
cursor: `eid:${eventId}`,
|
|
144912
|
+
hasMore: true,
|
|
144913
|
+
error: error2
|
|
144914
|
+
};
|
|
144915
|
+
}
|
|
144916
|
+
async function consumeEventFrameStream(response2, opName, replayEventObserver) {
|
|
144651
144917
|
const contentType = response2.headers.get("content-type");
|
|
144652
144918
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
144653
|
-
throw new
|
|
144919
|
+
throw new WorkflowWorldError(`v4 ${opName}: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`, { code: "SCHEMA_VALIDATION" });
|
|
144654
144920
|
}
|
|
144655
|
-
|
|
144656
|
-
|
|
144657
|
-
|
|
144658
|
-
|
|
144659
|
-
|
|
144921
|
+
if (!response2.body) {
|
|
144922
|
+
throw new WorkflowWorldError(`v4 ${opName}: response body is missing`, {
|
|
144923
|
+
code: "TRANSPORT"
|
|
144924
|
+
});
|
|
144925
|
+
}
|
|
144926
|
+
const events2 = [];
|
|
144927
|
+
try {
|
|
144928
|
+
for await (const frame2 of decodeFrames(response2.body)) {
|
|
144929
|
+
if (frame2.meta._end === 1) {
|
|
144930
|
+
const end = EventStreamEndSchema.parse(frame2.meta);
|
|
144931
|
+
return {
|
|
144932
|
+
kind: "complete",
|
|
144933
|
+
events: events2,
|
|
144934
|
+
cursor: end.next ?? null,
|
|
144935
|
+
hasMore: end.hasMore
|
|
144936
|
+
};
|
|
144937
|
+
}
|
|
144938
|
+
if (frame2.meta._error === 1) {
|
|
144939
|
+
throw streamErrorFrameToError(frame2.meta, opName);
|
|
144940
|
+
}
|
|
144941
|
+
if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
|
|
144942
|
+
throw new Error(`v4 ${opName}: unexpected control frame`);
|
|
144943
|
+
}
|
|
144944
|
+
const event = decodeEventFrame(frame2);
|
|
144945
|
+
events2.push(event);
|
|
144946
|
+
try {
|
|
144947
|
+
replayEventObserver == null ? void 0 : replayEventObserver(event);
|
|
144948
|
+
} catch (error2) {
|
|
144949
|
+
throw new ReplayEventObserverError(error2);
|
|
144950
|
+
}
|
|
144660
144951
|
}
|
|
144661
|
-
|
|
144662
|
-
|
|
144952
|
+
} catch (cause) {
|
|
144953
|
+
if (cause instanceof ReplayEventObserverError || CorruptedEventLogError.is(cause) || WorkflowWorldError.is(cause)) {
|
|
144954
|
+
throw cause;
|
|
144663
144955
|
}
|
|
144664
|
-
|
|
144956
|
+
if (!(cause instanceof IncompleteFrameError)) {
|
|
144957
|
+
throw new WorkflowWorldError(`v4 ${opName}: invalid event frame stream`, {
|
|
144958
|
+
code: "SCHEMA_VALIDATION",
|
|
144959
|
+
cause
|
|
144960
|
+
});
|
|
144961
|
+
}
|
|
144962
|
+
return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: incomplete event frame stream`, {
|
|
144963
|
+
code: "TRANSPORT",
|
|
144964
|
+
cause
|
|
144965
|
+
}));
|
|
144966
|
+
}
|
|
144967
|
+
return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read)`, { code: "TRANSPORT" }));
|
|
144968
|
+
}
|
|
144969
|
+
async function consumeReplayLogResponse(response2, runId, config2, replayEventObserver) {
|
|
144970
|
+
const page = await consumeEventFrameStream(response2, "createEvent", replayEventObserver);
|
|
144971
|
+
if (!page.hasMore) {
|
|
144972
|
+
return {
|
|
144973
|
+
events: page.events,
|
|
144974
|
+
cursor: page.cursor,
|
|
144975
|
+
hasMore: false
|
|
144976
|
+
};
|
|
144977
|
+
}
|
|
144978
|
+
if (!page.cursor) {
|
|
144979
|
+
throw new WorkflowWorldError("v4 createEvent: partial event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
144665
144980
|
}
|
|
144666
|
-
|
|
144981
|
+
const suffix = await getWorkflowRunEventsV4(runId, { cursor: page.cursor, remoteRefBehavior: "resolve" }, config2, replayEventObserver);
|
|
144982
|
+
return {
|
|
144983
|
+
events: [...page.events, ...suffix.events],
|
|
144984
|
+
cursor: suffix.cursor ?? page.cursor,
|
|
144985
|
+
hasMore: suffix.hasMore
|
|
144986
|
+
};
|
|
144667
144987
|
}
|
|
144668
|
-
async function consumeListFrameStream(url2, headers2, config2, opName,
|
|
144988
|
+
async function consumeListFrameStream(url2, headers2, config2, opName, replayEventObserver) {
|
|
144669
144989
|
const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, opName);
|
|
144670
|
-
return consumeEventFrameStream(response2, opName,
|
|
144990
|
+
return consumeEventFrameStream(response2, opName, replayEventObserver);
|
|
144671
144991
|
}
|
|
144672
144992
|
function appendListParams(sp, params) {
|
|
144673
144993
|
if (params.cursor)
|
|
@@ -144687,23 +145007,34 @@ function paginationToQuery(params) {
|
|
|
144687
145007
|
appendListParams(sp, params);
|
|
144688
145008
|
return `?${sp.toString()}`;
|
|
144689
145009
|
}
|
|
144690
|
-
async function getWorkflowRunEventsV4(runId, params = {}, config2) {
|
|
145010
|
+
async function getWorkflowRunEventsV4(runId, params = {}, config2, replayEventObserver) {
|
|
144691
145011
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
144692
145012
|
const events2 = [];
|
|
144693
|
-
let cursor = params.cursor;
|
|
144694
|
-
|
|
144695
|
-
|
|
144696
|
-
|
|
144697
|
-
|
|
144698
|
-
|
|
144699
|
-
|
|
144700
|
-
|
|
144701
|
-
if (params.limit !== void 0 || !
|
|
144702
|
-
throw
|
|
144703
|
-
}
|
|
144704
|
-
|
|
144705
|
-
|
|
144706
|
-
|
|
145013
|
+
let cursor = params.cursor ?? null;
|
|
145014
|
+
let partialStreamRetries = 0;
|
|
145015
|
+
let consumed;
|
|
145016
|
+
do {
|
|
145017
|
+
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({ ...params, cursor: cursor ?? void 0 });
|
|
145018
|
+
consumed = await consumeListFrameStream(url2, headers2, config2, "listEvents", replayEventObserver);
|
|
145019
|
+
const cursorAdvanced = !!consumed.cursor && consumed.cursor !== cursor;
|
|
145020
|
+
if (consumed.kind === "partial") {
|
|
145021
|
+
if (params.limit !== void 0 || !cursorAdvanced || partialStreamRetries === MAX_PARTIAL_STREAM_RETRIES) {
|
|
145022
|
+
throw consumed.error;
|
|
145023
|
+
}
|
|
145024
|
+
partialStreamRetries++;
|
|
145025
|
+
cursor = consumed.cursor;
|
|
145026
|
+
} else if (!cursorAdvanced && (consumed.events.length > 0 || consumed.hasMore)) {
|
|
145027
|
+
throw new WorkflowWorldError("v4 listEvents: response did not advance cursor", { code: "SCHEMA_VALIDATION" });
|
|
145028
|
+
}
|
|
145029
|
+
for (const event of consumed.events) {
|
|
145030
|
+
events2.push(event);
|
|
145031
|
+
}
|
|
145032
|
+
} while (consumed.kind === "partial");
|
|
145033
|
+
return {
|
|
145034
|
+
events: events2,
|
|
145035
|
+
cursor: consumed.cursor || (partialStreamRetries > 0 ? cursor : null),
|
|
145036
|
+
hasMore: consumed.hasMore
|
|
145037
|
+
};
|
|
144707
145038
|
}
|
|
144708
145039
|
async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, config2) {
|
|
144709
145040
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
@@ -144712,9 +145043,14 @@ async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, con
|
|
|
144712
145043
|
sp.set("runId", runId);
|
|
144713
145044
|
appendListParams(sp, params);
|
|
144714
145045
|
const url2 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
144715
|
-
const
|
|
144716
|
-
|
|
144717
|
-
|
|
145046
|
+
const consumed = await consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId");
|
|
145047
|
+
if (consumed.kind === "partial")
|
|
145048
|
+
throw consumed.error;
|
|
145049
|
+
return {
|
|
145050
|
+
events: consumed.events,
|
|
145051
|
+
cursor: consumed.cursor,
|
|
145052
|
+
hasMore: consumed.hasMore
|
|
145053
|
+
};
|
|
144718
145054
|
}
|
|
144719
145055
|
const WorkflowRunWireBaseSchema = WorkflowRunBaseSchema.omit({
|
|
144720
145056
|
error: true,
|
|
@@ -145140,6 +145476,8 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
|
|
|
145140
145476
|
}
|
|
145141
145477
|
return result;
|
|
145142
145478
|
} catch (err) {
|
|
145479
|
+
if (err instanceof ReplayEventObserverError)
|
|
145480
|
+
throw err.error;
|
|
145143
145481
|
if (isHookEventRequiringExistence(data.eventType) && WorkflowWorldError.is(err) && err.status === 404 && data.correlationId) {
|
|
145144
145482
|
throw new HookNotFoundError(data.correlationId);
|
|
145145
145483
|
}
|
|
@@ -145211,39 +145549,14 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145211
145549
|
...meta2
|
|
145212
145550
|
};
|
|
145213
145551
|
if (data.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload)) {
|
|
145214
|
-
const result = await createWorkflowRunStartedEventV4(input, config2);
|
|
145215
|
-
const
|
|
145216
|
-
|
|
145217
|
-
|
|
145218
|
-
throw new Error("v4 createEvent: run_started stream is missing run_created");
|
|
145219
|
-
}
|
|
145220
|
-
if (!runStarted) {
|
|
145221
|
-
throw new Error("v4 createEvent: run_started stream is missing run_started");
|
|
145222
|
-
}
|
|
145223
|
-
let attributes = runCreated.eventData.attributes ?? {};
|
|
145224
|
-
let updatedAt = runStarted.createdAt;
|
|
145225
|
-
for (const event of result.events) {
|
|
145226
|
-
if (event.eventType === "attr_set") {
|
|
145227
|
-
attributes = applyAttributeChanges(attributes, event.eventData.changes);
|
|
145228
|
-
updatedAt = event.createdAt;
|
|
145229
|
-
}
|
|
145552
|
+
const result = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
|
|
145553
|
+
const replayRun = reconstructRunFromReplayEvents(result.events);
|
|
145554
|
+
if (!replayRun) {
|
|
145555
|
+
throw new WorkflowWorldError("v4 createEvent: run_started stream is missing lifecycle events", { code: "SCHEMA_VALIDATION" });
|
|
145230
145556
|
}
|
|
145231
145557
|
return {
|
|
145232
|
-
event:
|
|
145233
|
-
run:
|
|
145234
|
-
runId: runCreated.runId,
|
|
145235
|
-
status: "running",
|
|
145236
|
-
deploymentId: runCreated.eventData.deploymentId,
|
|
145237
|
-
workflowName: runCreated.eventData.workflowName,
|
|
145238
|
-
specVersion: runCreated.specVersion,
|
|
145239
|
-
executionContext: runCreated.eventData.executionContext,
|
|
145240
|
-
input: runCreated.eventData.input,
|
|
145241
|
-
attributes,
|
|
145242
|
-
encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
|
|
145243
|
-
startedAt: runStarted.createdAt,
|
|
145244
|
-
createdAt: runCreated.createdAt,
|
|
145245
|
-
updatedAt
|
|
145246
|
-
},
|
|
145558
|
+
event: replayRun.event,
|
|
145559
|
+
run: replayRun.run,
|
|
145247
145560
|
events: result.events,
|
|
145248
145561
|
cursor: result.cursor,
|
|
145249
145562
|
hasMore: result.hasMore,
|
|
@@ -145251,16 +145564,16 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145251
145564
|
};
|
|
145252
145565
|
}
|
|
145253
145566
|
if (data.eventType === "hook_received" && (params == null ? void 0 : params.preloadEvents) === true && params.resumeId !== void 0 && params.resumePayloadDigest !== void 0) {
|
|
145254
|
-
const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2);
|
|
145567
|
+
const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2, params.replayEventObserver);
|
|
145255
145568
|
if (outcome.kind === "materialized") {
|
|
145256
145569
|
return outcome.result;
|
|
145257
145570
|
}
|
|
145258
145571
|
const { canonicalEventId, maxEvents, events: events2, cursor, hasMore } = outcome;
|
|
145259
145572
|
const canonicalEvent = events2.find((event) => event.eventId === canonicalEventId);
|
|
145260
|
-
const
|
|
145573
|
+
const replayRun = reconstructRunFromReplayEvents(events2);
|
|
145261
145574
|
return {
|
|
145262
145575
|
...canonicalEvent ? { event: canonicalEvent } : {},
|
|
145263
|
-
...
|
|
145576
|
+
...replayRun ? { run: replayRun.run } : {},
|
|
145264
145577
|
events: events2,
|
|
145265
145578
|
cursor,
|
|
145266
145579
|
hasMore,
|
|
@@ -145272,9 +145585,8 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145272
145585
|
function reconstructRunFromReplayEvents(events2) {
|
|
145273
145586
|
const runCreated = events2.find((event) => event.eventType === "run_created");
|
|
145274
145587
|
const runStarted = events2.find((event) => event.eventType === "run_started");
|
|
145275
|
-
if (!runCreated || !runStarted)
|
|
145276
|
-
return
|
|
145277
|
-
}
|
|
145588
|
+
if (!runCreated || !runStarted)
|
|
145589
|
+
return;
|
|
145278
145590
|
let attributes = runCreated.eventData.attributes ?? {};
|
|
145279
145591
|
let updatedAt = runStarted.createdAt;
|
|
145280
145592
|
for (const event of events2) {
|
|
@@ -145284,18 +145596,21 @@ function reconstructRunFromReplayEvents(events2) {
|
|
|
145284
145596
|
}
|
|
145285
145597
|
}
|
|
145286
145598
|
return {
|
|
145287
|
-
|
|
145288
|
-
|
|
145289
|
-
|
|
145290
|
-
|
|
145291
|
-
|
|
145292
|
-
|
|
145293
|
-
|
|
145294
|
-
|
|
145295
|
-
|
|
145296
|
-
|
|
145297
|
-
|
|
145298
|
-
|
|
145599
|
+
event: runStarted,
|
|
145600
|
+
run: {
|
|
145601
|
+
runId: runCreated.runId,
|
|
145602
|
+
status: "running",
|
|
145603
|
+
deploymentId: runCreated.eventData.deploymentId,
|
|
145604
|
+
workflowName: runCreated.eventData.workflowName,
|
|
145605
|
+
specVersion: runCreated.specVersion,
|
|
145606
|
+
executionContext: runCreated.eventData.executionContext,
|
|
145607
|
+
input: runCreated.eventData.input,
|
|
145608
|
+
attributes,
|
|
145609
|
+
encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
|
|
145610
|
+
startedAt: runStarted.createdAt,
|
|
145611
|
+
createdAt: runCreated.createdAt,
|
|
145612
|
+
updatedAt
|
|
145613
|
+
}
|
|
145299
145614
|
};
|
|
145300
145615
|
}
|
|
145301
145616
|
function filterHookData(hook, resolveData) {
|
|
@@ -145645,7 +145960,7 @@ function createWorld$1(config2) {
|
|
|
145645
145960
|
// Vercel deployments are atomic and immutable, so a deployment id names
|
|
145646
145961
|
// one fixed build for its whole lifetime.
|
|
145647
145962
|
deploymentAffinity: true
|
|
145648
|
-
// NOTE: the backend half of resumeHook()'s
|
|
145963
|
+
// NOTE: the backend half of resumeHook()'s lazy path (that
|
|
145649
145964
|
// the server enforces the `(runId, resumeId)` dedup constraint) is
|
|
145650
145965
|
// NO LONGER a static world capability here. It is attested per-lookup by
|
|
145651
145966
|
// the server via `Hook.resumeCapabilities.hookResumeDedupVersion`
|
|
@@ -145800,7 +146115,7 @@ globalSingleton("@workflow/core//devServerPort", 1, () => ({
|
|
|
145800
146115
|
inFlight: void 0
|
|
145801
146116
|
}));
|
|
145802
146117
|
function waitUntil(promise2) {
|
|
145803
|
-
void import("./index-
|
|
146118
|
+
void import("./index-jQkBA81b.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
145804
146119
|
waitUntil2(promise2);
|
|
145805
146120
|
});
|
|
145806
146121
|
}
|
|
@@ -148484,12 +148799,13 @@ const CAPABILITY_VERSION_TABLE = [
|
|
|
148484
148799
|
// consumers that cannot unframe them (silent corruption); too-high merely
|
|
148485
148800
|
// delays the optimization (safe).
|
|
148486
148801
|
{ capability: "framedByteStreams", minVersion: "5.0.0-beta.15" }
|
|
148487
|
-
// NOTE:
|
|
148488
|
-
// the queue message's `hookInput`?") is intentionally
|
|
148489
|
-
// version-compare against a predicted release cutoff is a
|
|
148490
|
-
// run's creating deployment stamps an explicit
|
|
148491
|
-
// marker into its execution context, which the
|
|
148492
|
-
//
|
|
148802
|
+
// NOTE: the hook-resume consumer protocol ("does the consumer re-ensure
|
|
148803
|
+
// `hook_received` from the queue message's `hookInput`?") is intentionally
|
|
148804
|
+
// NOT gated here. A version-compare against a predicted release cutoff is a
|
|
148805
|
+
// guess; instead the run's creating deployment stamps an explicit
|
|
148806
|
+
// `hookResumeInputVersion` marker into its execution context, which the
|
|
148807
|
+
// server mirrors onto the hook's resumeContext. Older producers gate their
|
|
148808
|
+
// lazy path on that marker.
|
|
148493
148809
|
];
|
|
148494
148810
|
const BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
148495
148811
|
SerializationFormat$1.DEVALUE_V1
|
|
@@ -148519,7 +148835,6 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
148519
148835
|
return result;
|
|
148520
148836
|
}
|
|
148521
148837
|
const generateResumeId = monotonicFactory();
|
|
148522
|
-
const MAX_INLINE_RESUME_PAYLOAD_BYTES = 128 * 1024;
|
|
148523
148838
|
async function computeResumePayloadDigest(bytes) {
|
|
148524
148839
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
148525
148840
|
const view = new Uint8Array(digest);
|
|
@@ -148529,6 +148844,39 @@ async function computeResumePayloadDigest(bytes) {
|
|
|
148529
148844
|
}
|
|
148530
148845
|
return hex2;
|
|
148531
148846
|
}
|
|
148847
|
+
const HOOK_WAKE_RETRY_DELAYS_MS = [25, 100];
|
|
148848
|
+
function isRetryableWakeError(error2, isDeploymentUnavailableError) {
|
|
148849
|
+
if (isDeploymentUnavailableError == null ? void 0 : isDeploymentUnavailableError(error2))
|
|
148850
|
+
return false;
|
|
148851
|
+
const status = error2 ?? {};
|
|
148852
|
+
const code2 = status.status ?? status.statusCode;
|
|
148853
|
+
if (typeof code2 === "number") {
|
|
148854
|
+
return code2 >= 500 || code2 === 408 || code2 === 429;
|
|
148855
|
+
}
|
|
148856
|
+
const name2 = error2 == null ? void 0 : error2.name;
|
|
148857
|
+
return name2 !== "BadRequestError" && name2 !== "UnauthorizedError" && name2 !== "ForbiddenError";
|
|
148858
|
+
}
|
|
148859
|
+
async function publishHookWakeWithRetry(publish, isDeploymentUnavailableError) {
|
|
148860
|
+
let lastError;
|
|
148861
|
+
for (let attempt = 0; attempt <= HOOK_WAKE_RETRY_DELAYS_MS.length; attempt++) {
|
|
148862
|
+
try {
|
|
148863
|
+
await publish();
|
|
148864
|
+
return;
|
|
148865
|
+
} catch (error2) {
|
|
148866
|
+
lastError = error2;
|
|
148867
|
+
if (!isRetryableWakeError(error2, isDeploymentUnavailableError))
|
|
148868
|
+
break;
|
|
148869
|
+
const delayMs = HOOK_WAKE_RETRY_DELAYS_MS[attempt];
|
|
148870
|
+
if (delayMs !== void 0) {
|
|
148871
|
+
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
148872
|
+
}
|
|
148873
|
+
}
|
|
148874
|
+
}
|
|
148875
|
+
if (HookNotFoundError.is(lastError)) {
|
|
148876
|
+
throw new WorkflowRuntimeError("The hook resume was committed, but its workflow wake could not be published", { cause: lastError });
|
|
148877
|
+
}
|
|
148878
|
+
throw lastError;
|
|
148879
|
+
}
|
|
148532
148880
|
function resumeContextFromRun(run2) {
|
|
148533
148881
|
var _a3, _b2, _c2;
|
|
148534
148882
|
const coreVersion = (_a3 = run2.executionContext) == null ? void 0 : _a3.workflowCoreVersion;
|
|
@@ -148588,7 +148936,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
148588
148936
|
async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs) {
|
|
148589
148937
|
return await waitedUntil(() => {
|
|
148590
148938
|
return trace$2("hook.resume", async (span) => {
|
|
148591
|
-
var _a3, _b2, _c2;
|
|
148939
|
+
var _a3, _b2, _c2, _d2;
|
|
148592
148940
|
const world = await getWorldLazy();
|
|
148593
148941
|
try {
|
|
148594
148942
|
const suppliedToken = typeof tokenOrHook === "string";
|
|
@@ -148624,12 +148972,17 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
148624
148972
|
}
|
|
148625
148973
|
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat$1.GZIP);
|
|
148626
148974
|
const ops = [];
|
|
148975
|
+
const readbackOps = [];
|
|
148627
148976
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
148628
|
-
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
|
|
148629
|
-
|
|
148977
|
+
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression, void 0, readbackOps);
|
|
148978
|
+
await Promise.all(ops.map((op) => op.catch((error2) => {
|
|
148979
|
+
if (error2 !== void 0)
|
|
148980
|
+
throw error2;
|
|
148981
|
+
})));
|
|
148982
|
+
safeWaitUntil(Promise.all(readbackOps), (err) => {
|
|
148630
148983
|
if (err === void 0)
|
|
148631
148984
|
return;
|
|
148632
|
-
runtimeLogger.warn("Background
|
|
148985
|
+
runtimeLogger.warn("Background readback of hook payload failed", {
|
|
148633
148986
|
workflowRunId: hook.runId,
|
|
148634
148987
|
hookId: hook.hookId,
|
|
148635
148988
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -148642,112 +148995,63 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
148642
148995
|
if (originLink) {
|
|
148643
148996
|
(_a3 = span == null ? void 0 : span.addLink) == null ? void 0 : _a3.call(span, originLink);
|
|
148644
148997
|
}
|
|
148645
|
-
const eventData = {
|
|
148646
|
-
...v1Compat ? {} : { token: hook.token },
|
|
148647
|
-
payload: dehydratedPayload
|
|
148648
|
-
};
|
|
148649
148998
|
const queueName = getWorkflowQueueName(resumeContext.workflowName);
|
|
148650
148999
|
const queueOptions = {
|
|
148651
149000
|
deploymentId: resumeContext.deploymentId,
|
|
148652
149001
|
specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
|
|
148653
149002
|
};
|
|
148654
|
-
const parallelResumeDisabled = process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME === "1";
|
|
148655
149003
|
const backendDedupSupported = (hookResumeCapabilitiesAreFresh ? ((_b2 = hook.resumeCapabilities) == null ? void 0 : _b2.hookResumeDedupVersion) ?? 0 : 0) >= HOOK_RESUME_DEDUP_VERSION || ((_c2 = world.capabilities) == null ? void 0 : _c2.hookResumeDedup) === true;
|
|
148656
|
-
const
|
|
148657
|
-
const useParallelResume = fallbackReason === null;
|
|
149004
|
+
const canClaimResume = backendDedupSupported && !v1Compat && dehydratedPayload instanceof Uint8Array;
|
|
148658
149005
|
span == null ? void 0 : span.setAttributes({
|
|
148659
|
-
"workflow.hook.resume_strategy":
|
|
148660
|
-
...fallbackReason ? { "workflow.hook.resume_fallback_reason": fallbackReason } : {}
|
|
149006
|
+
"workflow.hook.resume_strategy": "sequential"
|
|
148661
149007
|
});
|
|
148662
|
-
const
|
|
148663
|
-
|
|
148664
|
-
|
|
148665
|
-
|
|
148666
|
-
|
|
148667
|
-
|
|
148668
|
-
|
|
148669
|
-
|
|
148670
|
-
}, { v1Compat });
|
|
148671
|
-
} catch (err) {
|
|
148672
|
-
if (isHookGoneError(err)) {
|
|
148673
|
-
throw new HookNotFoundError(hook.token);
|
|
148674
|
-
}
|
|
148675
|
-
throw err;
|
|
148676
|
-
}
|
|
148677
|
-
const queuePublishRequestedAtMs = Date.now();
|
|
148678
|
-
await world.queue(queueName, {
|
|
148679
|
-
runId: hook.runId,
|
|
148680
|
-
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
148681
|
-
hookResumeTiming: {
|
|
148682
|
-
resumeRequestedAtMs,
|
|
148683
|
-
queuePublishRequestedAtMs,
|
|
148684
|
-
strategy: "sequential"
|
|
148685
|
-
}
|
|
148686
|
-
}, queueOptions);
|
|
148687
|
-
return hook;
|
|
148688
|
-
}
|
|
148689
|
-
const resumeId = generateResumeId();
|
|
148690
|
-
const payloadDigest = await computeResumePayloadDigest(dehydratedPayload);
|
|
148691
|
-
span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
|
|
148692
|
-
const publishInvocation = () => {
|
|
148693
|
-
const queuePublishRequestedAtMs = Date.now();
|
|
148694
|
-
return world.queue(queueName, {
|
|
148695
|
-
runId: hook.runId,
|
|
148696
|
-
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
148697
|
-
hookInput: {
|
|
148698
|
-
resumeId,
|
|
148699
|
-
hookId: hook.hookId,
|
|
148700
|
-
token: hook.token,
|
|
148701
|
-
payload: dehydratedPayload,
|
|
148702
|
-
payloadDigest,
|
|
148703
|
-
// Deployment affinity for the consumer's cheap pre-write
|
|
148704
|
-
// check: lets a misrouted delivery re-route before its
|
|
148705
|
-
// hoisted hook_received write instead of after.
|
|
148706
|
-
deploymentId: resumeContext.deploymentId
|
|
148707
|
-
},
|
|
148708
|
-
hookResumeTiming: {
|
|
148709
|
-
resumeRequestedAtMs,
|
|
148710
|
-
queuePublishRequestedAtMs,
|
|
148711
|
-
strategy: "parallel"
|
|
148712
|
-
}
|
|
148713
|
-
}, queueOptions);
|
|
148714
|
-
};
|
|
148715
|
-
const [eventResult, queueResult] = await Promise.allSettled([
|
|
148716
|
-
world.events.create(hook.runId, {
|
|
149008
|
+
const resumeId = canClaimResume ? generateResumeId() : void 0;
|
|
149009
|
+
const payloadDigest = canClaimResume ? await computeResumePayloadDigest(dehydratedPayload) : void 0;
|
|
149010
|
+
if (resumeId) {
|
|
149011
|
+
span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
|
|
149012
|
+
}
|
|
149013
|
+
const isHookGoneError = (err) => HookNotFoundError.is(err) || RunExpiredError.is(err);
|
|
149014
|
+
try {
|
|
149015
|
+
await world.events.create(hook.runId, {
|
|
148717
149016
|
eventType: "hook_received",
|
|
148718
149017
|
specVersion: SPEC_VERSION_CURRENT,
|
|
148719
149018
|
correlationId: hook.hookId,
|
|
148720
|
-
eventData
|
|
148721
|
-
|
|
148722
|
-
|
|
148723
|
-
|
|
148724
|
-
|
|
148725
|
-
|
|
148726
|
-
|
|
148727
|
-
|
|
148728
|
-
|
|
148729
|
-
|
|
148730
|
-
if (HookNotFoundError.is(err) || RunExpiredError.is(err)) {
|
|
149019
|
+
eventData: {
|
|
149020
|
+
...v1Compat ? {} : { token: hook.token },
|
|
149021
|
+
payload: dehydratedPayload
|
|
149022
|
+
}
|
|
149023
|
+
}, {
|
|
149024
|
+
v1Compat,
|
|
149025
|
+
...resumeId && payloadDigest ? { resumeId, resumePayloadDigest: payloadDigest } : {}
|
|
149026
|
+
});
|
|
149027
|
+
} catch (err) {
|
|
149028
|
+
if (isHookGoneError(err)) {
|
|
148731
149029
|
throw new HookNotFoundError(hook.token);
|
|
148732
149030
|
}
|
|
148733
|
-
|
|
148734
|
-
resilientResume = true;
|
|
148735
|
-
span == null ? void 0 : span.setAttributes({
|
|
148736
|
-
...HookResilientResume(true),
|
|
148737
|
-
"workflow.hook.resume_event_write_recovered": true,
|
|
148738
|
-
"workflow.hook.resume_event_write_error": err instanceof Error ? err.name : "unknown"
|
|
148739
|
-
});
|
|
148740
|
-
runtimeLogger.warn("Hook resume event write failed, but the run was re-triggered via the queue. The hook_received event will be ensured by the queue consumer.", {
|
|
148741
|
-
workflowRunId: hook.runId,
|
|
148742
|
-
hookId: hook.hookId,
|
|
148743
|
-
resumeId,
|
|
148744
|
-
error: err instanceof Error ? err.message : String(err)
|
|
148745
|
-
});
|
|
148746
|
-
} else {
|
|
148747
|
-
throw err;
|
|
148748
|
-
}
|
|
149031
|
+
throw err;
|
|
148749
149032
|
}
|
|
148750
|
-
|
|
149033
|
+
span == null ? void 0 : span.setAttributes(HookResumeCommitted(true));
|
|
149034
|
+
const queuePublishRequestedAtMs = Date.now();
|
|
149035
|
+
await publishHookWakeWithRetry(() => world.queue(queueName, {
|
|
149036
|
+
runId: hook.runId,
|
|
149037
|
+
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
149038
|
+
hookResumeTiming: {
|
|
149039
|
+
resumeRequestedAtMs,
|
|
149040
|
+
queuePublishRequestedAtMs,
|
|
149041
|
+
strategy: "sequential"
|
|
149042
|
+
}
|
|
149043
|
+
}, {
|
|
149044
|
+
...queueOptions,
|
|
149045
|
+
// Dedup retried publishes whose response was lost: a
|
|
149046
|
+
// duplicate wake is harmless for correctness (deterministic
|
|
149047
|
+
// replay) but costs a full replay of the run, and the queue
|
|
149048
|
+
// accepts a repeated idempotency key by delivering only one
|
|
149049
|
+
// of the messages. Claim-less writes have no resumeId and
|
|
149050
|
+
// keep the previous behavior.
|
|
149051
|
+
...resumeId ? { idempotencyKey: `hook-${resumeId}` } : {}
|
|
149052
|
+
}), (_d2 = world.isDeploymentUnavailableError) == null ? void 0 : _d2.bind(world));
|
|
149053
|
+
span == null ? void 0 : span.setAttributes(HookWakePublished(true));
|
|
149054
|
+
return hook;
|
|
148751
149055
|
} catch (err) {
|
|
148752
149056
|
span == null ? void 0 : span.setAttributes({
|
|
148753
149057
|
...HookToken(typeof tokenOrHook === "string" ? tokenOrHook : tokenOrHook.token),
|
|
@@ -148954,9 +149258,9 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
148954
149258
|
features: { encryption: !!encryptionKey },
|
|
148955
149259
|
// Attest that the *consumer* deployment's runtime re-ensures a
|
|
148956
149260
|
// `hook_received` event from a queue message's `hookInput` on replay.
|
|
148957
|
-
//
|
|
148958
|
-
// resumeContext by the server) to decide whether
|
|
148959
|
-
// path is safe. For a cross-deployment start the consumer is the
|
|
149261
|
+
// An OLDER producer resuming this run reads the marker (mirrored onto
|
|
149262
|
+
// the hook's resumeContext by the server) to decide whether its lazy
|
|
149263
|
+
// fast path is safe. For a cross-deployment start the consumer is the
|
|
148960
149264
|
// target deployment, so we stamp the *target's* value carried back on
|
|
148961
149265
|
// the health-check probe, never the caller's. Omitted when we could
|
|
148962
149266
|
// not attest the target (older target, timeout, or no probe channel),
|
|
@@ -172724,7 +173028,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
172724
173028
|
__proto__: null,
|
|
172725
173029
|
loader
|
|
172726
173030
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
172727
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-LwI3HNYl.js", "imports": ["/assets/index-PFjW8YjQ.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-
|
|
173031
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-LwI3HNYl.js", "imports": ["/assets/index-PFjW8YjQ.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-DBp4o4Ap.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/loader-circle-BQzzSKVU.js", "/assets/arrow-up-right-C52N96YH.js"], "css": ["/assets/root-Bl5xphvU.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-CXFjRmpa.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-BI72rVK-.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/loader-circle-BQzzSKVU.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-7tPGLWpY.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-BI72rVK-.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/arrow-up-right-C52N96YH.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-9ff1658d.js", "version": "9ff1658d", "sri": void 0 };
|
|
172728
173032
|
const assetsBuildDirectory = "build/client";
|
|
172729
173033
|
const basename = "/";
|
|
172730
173034
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -172933,12 +173237,12 @@ function createFetchHandler(basename2 = "/") {
|
|
|
172933
173237
|
return (request2) => handler(request2, loadContext);
|
|
172934
173238
|
}
|
|
172935
173239
|
export {
|
|
172936
|
-
|
|
173240
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as $,
|
|
172937
173241
|
ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
|
|
172938
173242
|
BULK_CANCEL_MAX_RUN_IDS as B,
|
|
172939
173243
|
CHILD_ENTITY_CREATION_EVENT_TYPES as C,
|
|
172940
173244
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
|
|
172941
|
-
|
|
173245
|
+
EVENT_ID_BODY_LENGTH as E,
|
|
172942
173246
|
FIRST_EVENT_SLOT as F,
|
|
172943
173247
|
HealthCheckPayloadSchema as G,
|
|
172944
173248
|
HookSchema as H,
|
|
@@ -172955,101 +173259,103 @@ export {
|
|
|
172955
173259
|
QueuePrefix as S,
|
|
172956
173260
|
RESERVED_ATTRIBUTE_KEY_PREFIX as T,
|
|
172957
173261
|
ROOT_RUN_ID_ATTRIBUTE as U,
|
|
172958
|
-
|
|
172959
|
-
|
|
172960
|
-
|
|
172961
|
-
|
|
172962
|
-
|
|
172963
|
-
|
|
173262
|
+
RUN_ENTITY_KEY as V,
|
|
173263
|
+
RunInputSchema as W,
|
|
173264
|
+
SEALED_LOG_ENV_VAR as X,
|
|
173265
|
+
SPEC_VERSION_CURRENT as Y,
|
|
173266
|
+
SPEC_VERSION_LEGACY as Z,
|
|
173267
|
+
SPEC_VERSION_MAX_SUPPORTED as _,
|
|
172964
173268
|
ATTRIBUTE_KEY_MAX_LENGTH as a,
|
|
172965
|
-
|
|
172966
|
-
|
|
172967
|
-
|
|
172968
|
-
|
|
172969
|
-
|
|
172970
|
-
|
|
172971
|
-
|
|
172972
|
-
|
|
172973
|
-
|
|
172974
|
-
|
|
172975
|
-
|
|
172976
|
-
|
|
172977
|
-
|
|
172978
|
-
|
|
172979
|
-
|
|
172980
|
-
|
|
172981
|
-
|
|
172982
|
-
|
|
172983
|
-
|
|
172984
|
-
|
|
172985
|
-
|
|
172986
|
-
|
|
172987
|
-
|
|
172988
|
-
|
|
172989
|
-
|
|
172990
|
-
|
|
172991
|
-
|
|
172992
|
-
|
|
172993
|
-
|
|
172994
|
-
|
|
172995
|
-
|
|
172996
|
-
|
|
172997
|
-
|
|
172998
|
-
|
|
172999
|
-
|
|
173000
|
-
|
|
173001
|
-
|
|
173002
|
-
|
|
173003
|
-
|
|
173004
|
-
|
|
173005
|
-
|
|
173006
|
-
|
|
173007
|
-
|
|
173008
|
-
|
|
173009
|
-
|
|
173010
|
-
|
|
173011
|
-
|
|
173012
|
-
|
|
173013
|
-
|
|
173014
|
-
|
|
173015
|
-
|
|
173016
|
-
|
|
173017
|
-
|
|
173018
|
-
|
|
173019
|
-
|
|
173020
|
-
|
|
173021
|
-
|
|
173022
|
-
|
|
173023
|
-
|
|
173024
|
-
|
|
173025
|
-
|
|
173026
|
-
|
|
173027
|
-
|
|
173028
|
-
|
|
173269
|
+
Ks as a$,
|
|
173270
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a0,
|
|
173271
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION as a1,
|
|
173272
|
+
SPEC_VERSION_SUPPORTS_SEALED_LOG as a2,
|
|
173273
|
+
SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a3,
|
|
173274
|
+
STEP_EVENT_TYPES as a4,
|
|
173275
|
+
SerializedDataSchema as a5,
|
|
173276
|
+
StepSchema as a6,
|
|
173277
|
+
StepStatusSchema as a7,
|
|
173278
|
+
StructuredErrorSchema as a8,
|
|
173279
|
+
TERMINAL_EVENT_CLASSES as a9,
|
|
173280
|
+
isChildEntityCreationEventType as aA,
|
|
173281
|
+
isHookEventRequiringExistence as aB,
|
|
173282
|
+
isHookLifecycleEventType as aC,
|
|
173283
|
+
isLegacySpecVersion as aD,
|
|
173284
|
+
isNodeHttpEnabled as aE,
|
|
173285
|
+
isSealedNoopEvent$1 as aF,
|
|
173286
|
+
isSlotBody as aG,
|
|
173287
|
+
isSlotEventId as aH,
|
|
173288
|
+
isStepEventType as aI,
|
|
173289
|
+
isTerminalRunEventType as aJ,
|
|
173290
|
+
isTerminalStepEventType as aK,
|
|
173291
|
+
isTerminalStepStatus as aL,
|
|
173292
|
+
isTerminalWorkflowRunStatus as aM,
|
|
173293
|
+
isWaitEventType as aN,
|
|
173294
|
+
mintedSpecVersion as aO,
|
|
173295
|
+
parseQueueName as aP,
|
|
173296
|
+
reenqueueActiveRuns as aQ,
|
|
173297
|
+
requiresNewerWorld as aR,
|
|
173298
|
+
resolveQueueNamespace as aS,
|
|
173299
|
+
slotToEventId as aT,
|
|
173300
|
+
stripEventDataRefs as aU,
|
|
173301
|
+
ulidToDate as aV,
|
|
173302
|
+
validateAttributeChanges as aW,
|
|
173303
|
+
validateUlidTimestamp as aX,
|
|
173304
|
+
workflowRunIdSchema as aY,
|
|
173305
|
+
reactExports as aZ,
|
|
173306
|
+
R as a_,
|
|
173307
|
+
TERMINAL_RUN_EVENT_TYPES as aa,
|
|
173308
|
+
TERMINAL_STEP_EVENT_TYPES as ab,
|
|
173309
|
+
TERMINAL_STEP_STATUSES as ac,
|
|
173310
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as ad,
|
|
173311
|
+
TerminalRunEventTypeSchema as ae,
|
|
173312
|
+
TerminalStepStatusSchema as af,
|
|
173313
|
+
TerminalWorkflowRunStatusSchema as ag,
|
|
173314
|
+
ValidQueueName as ah,
|
|
173315
|
+
WAIT_EVENT_TYPES as ai,
|
|
173316
|
+
WaitSchema as aj,
|
|
173317
|
+
WaitStatusSchema as ak,
|
|
173318
|
+
WorkflowInvokePayloadSchema as al,
|
|
173319
|
+
WorkflowRunBaseSchema as am,
|
|
173320
|
+
WorkflowRunSchema as an,
|
|
173321
|
+
WorkflowRunStatusSchema as ao,
|
|
173322
|
+
applyAttributeChanges as ap,
|
|
173323
|
+
classifyEntityEvent as aq,
|
|
173324
|
+
entityEventClass as ar,
|
|
173325
|
+
envFlag as as,
|
|
173326
|
+
envNumber as at,
|
|
173327
|
+
eventIdToSlot as au,
|
|
173328
|
+
getEventDataPayloadField as av,
|
|
173329
|
+
getEventDataRefFields as aw,
|
|
173330
|
+
getMaxEventsPerRun as ax,
|
|
173331
|
+
getQueueTopicPrefix as ay,
|
|
173332
|
+
isChildEntityCreationEvent as az,
|
|
173029
173333
|
ATTRIBUTE_MAX_PER_RUN as b,
|
|
173030
|
-
|
|
173031
|
-
|
|
173032
|
-
|
|
173033
|
-
|
|
173034
|
-
|
|
173035
|
-
|
|
173036
|
-
|
|
173037
|
-
|
|
173038
|
-
|
|
173039
|
-
|
|
173040
|
-
|
|
173041
|
-
|
|
173042
|
-
|
|
173043
|
-
|
|
173044
|
-
|
|
173045
|
-
|
|
173046
|
-
|
|
173047
|
-
|
|
173048
|
-
|
|
173049
|
-
|
|
173050
|
-
|
|
173051
|
-
|
|
173052
|
-
|
|
173334
|
+
jsxRuntimeExports as b0,
|
|
173335
|
+
Qe as b1,
|
|
173336
|
+
registerZstdDecoder as b2,
|
|
173337
|
+
isWsEventsTransportEnabled as b3,
|
|
173338
|
+
debugLog as b4,
|
|
173339
|
+
getHttpUrl as b5,
|
|
173340
|
+
globalSingleton as b6,
|
|
173341
|
+
version as b7,
|
|
173342
|
+
getHttpConfig as b8,
|
|
173343
|
+
headersToRecord as b9,
|
|
173344
|
+
getRequestTimeoutMs as ba,
|
|
173345
|
+
injectTraceContextIntoHeaders as bb,
|
|
173346
|
+
withHttpClientSpan as bc,
|
|
173347
|
+
ErrorType as bd,
|
|
173348
|
+
WorkflowWsReconnectAttempt as be,
|
|
173349
|
+
NetworkProtocolName as bf,
|
|
173350
|
+
WorkflowEventsTransport as bg,
|
|
173351
|
+
distExports as bh,
|
|
173352
|
+
decodeFrames as bi,
|
|
173353
|
+
getDefaultExportFromCjs as bj,
|
|
173354
|
+
requireTokenUtil as bk,
|
|
173355
|
+
requireTokenError as bl,
|
|
173356
|
+
getAugmentedNamespace as bm,
|
|
173357
|
+
app as bn,
|
|
173358
|
+
createFetchHandler as bo,
|
|
173053
173359
|
ATTRIBUTE_VALUE_MAX_BYTES as c,
|
|
173054
173360
|
AnalyticsAttributeKeySchema as d,
|
|
173055
173361
|
AnalyticsEventSchema as e,
|
|
@@ -173059,14 +173365,14 @@ export {
|
|
|
173059
173365
|
AnalyticsWaitSchema as i,
|
|
173060
173366
|
AttributeChangeSchema as j,
|
|
173061
173367
|
AttributeChangesSchema as k,
|
|
173062
|
-
|
|
173063
|
-
|
|
173064
|
-
|
|
173065
|
-
|
|
173066
|
-
|
|
173067
|
-
|
|
173068
|
-
|
|
173069
|
-
|
|
173368
|
+
AttributeKeySchema as l,
|
|
173369
|
+
AttributeValidationError as m,
|
|
173370
|
+
AttributeValueSchema as n,
|
|
173371
|
+
BaseEventSchema as o,
|
|
173372
|
+
BulkCancelWorkflowRunResultSchema as p,
|
|
173373
|
+
BulkCancelWorkflowRunsRequestSchema as q,
|
|
173374
|
+
BulkCancelWorkflowRunsResultSchema as r,
|
|
173375
|
+
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as s,
|
|
173070
173376
|
EVENT_ID_PREFIX as t,
|
|
173071
173377
|
EventSchema as u,
|
|
173072
173378
|
EventTypeSchema as v,
|