@workflow/web 5.0.0-beta.46 → 5.0.0-beta.48
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-UOc2WcaC.js → arrow-up-right-CSovqivK.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-D78gcP7S.js → highlighted-body-B3W2YXNL-BO5_Ufo-.js} +1 -1
- package/build/client/assets/{home-DYB1uz9w.js → home-BbyW_T74.js} +3 -3
- package/build/client/assets/{loader-circle-oscnpy3L.js → loader-circle-BX6ycuOI.js} +1 -1
- package/build/client/assets/{manifest-a701502a.js → manifest-34c486ef.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-BKGEyEYb.js → mermaid-3ZIDBTTL-BKwl_LgA.js} +282 -124
- package/build/client/assets/{root-Zvnb602n.js → root-qx_45_fH.js} +3 -3
- package/build/client/assets/{run-detail-CedyZW9h.js → run-detail-BoGFG1Fe.js} +59 -38
- package/build/client/assets/{workflow-graph-viewer-Du0ztkb8.js → workflow-graph-viewer-C-1D0sAn.js} +1 -1
- package/build/client/assets/{zstd-browser-decoder-DafWVuEG.js → zstd-browser-decoder-By3hr1F0.js} +1 -1
- package/build/server/assets/{app-BpmEMaiu.js → app-CeZRs20L.js} +1276 -599
- package/build/server/assets/{highlighted-body-B3W2YXNL-C6ES2Pzm.js → highlighted-body-B3W2YXNL-jO_hupW2.js} +1 -1
- package/build/server/assets/index-DshIaniU.js +169 -0
- package/build/server/assets/{index-QOlZC9D-.js → index-dJuvq1GP.js} +1 -1
- package/build/server/assets/{mermaid-3ZIDBTTL-X6IEJ8gj.js → mermaid-3ZIDBTTL-2Pe4e_TP.js} +1 -1
- package/build/server/assets/{token-CrxXUTBD.js → token-DAVWictz.js} +1 -1
- package/build/server/assets/{token-util-DuToe55u.js → token-util-BMRcW3Qd.js} +1 -1
- package/build/server/assets/{websocket-server-CTnzV_B7.js → websocket-server-DXnHomzQ.js} +1 -1
- package/build/server/assets/{wrapper-Bjff6YRz.js → wrapper-Bw3PP1up.js} +3 -3
- package/build/server/assets/{ws-transport-ByYax88V.js → ws-transport-Dv7yY5un.js} +5 -5
- package/build/server/assets/{zstd-browser-decoder-Bfk1d5vU.js → zstd-browser-decoder-DJTnP4ZA.js} +1 -1
- package/build/server/index.js +3 -3
- package/package.json +10 -10
- package/build/server/assets/index-BtQfiVUN.js +0 -163
|
@@ -56977,6 +56977,7 @@ function isSealedNoopEvent$1(event) {
|
|
|
56977
56977
|
return event.eventType === "noop";
|
|
56978
56978
|
}
|
|
56979
56979
|
const ENTITY_EVENT_CLASS_BY_TYPE = {
|
|
56980
|
+
attr_set: "attr_set",
|
|
56980
56981
|
step_created: "step_created",
|
|
56981
56982
|
step_started: "step_started",
|
|
56982
56983
|
step_retrying: "step_retrying",
|
|
@@ -56991,6 +56992,23 @@ const ENTITY_EVENT_CLASS_BY_TYPE = {
|
|
|
56991
56992
|
function entityEventClass(eventType) {
|
|
56992
56993
|
return getOwnProperty$1(ENTITY_EVENT_CLASS_BY_TYPE, eventType);
|
|
56993
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
|
+
}
|
|
56994
57012
|
const EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE = {
|
|
56995
57013
|
run_created: ["input"],
|
|
56996
57014
|
run_started: ["input"],
|
|
@@ -57576,7 +57594,7 @@ const WorkflowRunSchema = discriminatedUnion("status", [
|
|
|
57576
57594
|
// Completed state - output can be v1 or v2 format
|
|
57577
57595
|
WorkflowRunBaseSchema.extend({
|
|
57578
57596
|
status: literal("completed"),
|
|
57579
|
-
output: SerializedDataSchema,
|
|
57597
|
+
output: SerializedDataSchema.optional(),
|
|
57580
57598
|
error: _undefined().optional(),
|
|
57581
57599
|
completedAt: date$2()
|
|
57582
57600
|
}),
|
|
@@ -57584,7 +57602,7 @@ const WorkflowRunSchema = discriminatedUnion("status", [
|
|
|
57584
57602
|
WorkflowRunBaseSchema.extend({
|
|
57585
57603
|
status: literal("failed"),
|
|
57586
57604
|
output: _undefined().optional(),
|
|
57587
|
-
error: SerializedDataSchema,
|
|
57605
|
+
error: SerializedDataSchema.optional(),
|
|
57588
57606
|
completedAt: date$2()
|
|
57589
57607
|
})
|
|
57590
57608
|
]);
|
|
@@ -57794,10 +57812,13 @@ const AnalyticsWaitSchema = object$1({
|
|
|
57794
57812
|
const AnalyticsAttributeKeySchema = object$1({
|
|
57795
57813
|
key: string$3(),
|
|
57796
57814
|
runCount: number$2(),
|
|
57797
|
-
firstSeenAt:
|
|
57798
|
-
lastSeenAt:
|
|
57815
|
+
firstSeenAt: UTCDateSchema,
|
|
57816
|
+
lastSeenAt: UTCDateSchema
|
|
57799
57817
|
});
|
|
57800
57818
|
const ANALYTICS_EVENTS_GET_MANY_LIMIT = 100;
|
|
57819
|
+
const ANALYTICS_RUN_SCOPED_PAGE_LIMIT = 1e3;
|
|
57820
|
+
const ANALYTICS_PAGE_LIMIT = 100;
|
|
57821
|
+
const ANALYTICS_MAX_ATTRIBUTE_FILTERS = 8;
|
|
57801
57822
|
const WarnedEnvValuesKey = Symbol.for("@workflow/world//warnedEnvValues/v1");
|
|
57802
57823
|
const globalStore = globalThis;
|
|
57803
57824
|
const warnedEnvValues = globalStore[WarnedEnvValuesKey] ?? (globalStore[WarnedEnvValuesKey] = /* @__PURE__ */ new Set());
|
|
@@ -57956,8 +57977,9 @@ const HookResumeTimingSchema = object$1({
|
|
|
57956
57977
|
/** Epoch ms immediately before the queue publish was requested. */
|
|
57957
57978
|
queuePublishRequestedAtMs: number$3(),
|
|
57958
57979
|
/**
|
|
57959
|
-
* Which `resumeHook()` dispatch path ran
|
|
57960
|
-
*
|
|
57980
|
+
* Which `resumeHook()` dispatch path ran. Current producers always report
|
|
57981
|
+
* `sequential` (durable write, then wake); older producers may report
|
|
57982
|
+
* `lazy` or `parallel`.
|
|
57961
57983
|
*/
|
|
57962
57984
|
strategy: string$3().optional(),
|
|
57963
57985
|
/** Epoch ms the final consumer's queue handler was entered. */
|
|
@@ -58029,9 +58051,9 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
58029
58051
|
/** Run creation data, only present on the first queue delivery from start() */
|
|
58030
58052
|
runInput: RunInputSchema.optional(),
|
|
58031
58053
|
/**
|
|
58032
|
-
*
|
|
58033
|
-
*
|
|
58034
|
-
*
|
|
58054
|
+
* Legacy lazy hook resume data. A consumer that understands this field
|
|
58055
|
+
* idempotently ensures the `hook_received` event exists (keyed by `resumeId`)
|
|
58056
|
+
* before replaying.
|
|
58035
58057
|
*/
|
|
58036
58058
|
hookInput: HookResumeInputSchema.optional(),
|
|
58037
58059
|
/**
|
|
@@ -58043,7 +58065,7 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
58043
58065
|
stepInput: StepDispatchInputSchema.optional(),
|
|
58044
58066
|
/**
|
|
58045
58067
|
* Hook-resume TTR timing. Present on both `resumeHook()` dispatch paths
|
|
58046
|
-
* (unlike `hookInput
|
|
58068
|
+
* (unlike legacy `hookInput`), and
|
|
58047
58069
|
* forwarded onto a dispatched step message when the resuming invocation
|
|
58048
58070
|
* hands the next durable step to another invocation. Purely observational.
|
|
58049
58071
|
* See {@link HookResumeTimingSchema}.
|
|
@@ -58090,12 +58112,14 @@ const HookResumeContextSchema = object$1({
|
|
|
58090
58112
|
encryptionPublicKey: string$3().optional(),
|
|
58091
58113
|
// Feature marker: the version of the lazy-hook-resume consumer protocol the
|
|
58092
58114
|
// run's creating deployment supports. Present (>= 1) means that deployment's
|
|
58093
|
-
// `@workflow/core` re-ensures the `hook_received` event from
|
|
58094
|
-
// message's `hookInput` on replay
|
|
58095
|
-
//
|
|
58096
|
-
//
|
|
58097
|
-
//
|
|
58098
|
-
//
|
|
58115
|
+
// `@workflow/core` re-ensures the `hook_received` event from a queue
|
|
58116
|
+
// message's `hookInput` on replay. Current producers no longer send
|
|
58117
|
+
// `hookInput` (the durable write happens before the wake is published), so
|
|
58118
|
+
// they never read this marker; it remains stamped so OLDER producers, which
|
|
58119
|
+
// still gate their lazy path on it, keep working against new runs. Because a
|
|
58120
|
+
// run is pinned to its creating deployment, this marker is a reliable
|
|
58121
|
+
// per-run attestation, unlike inferring support from a version compare
|
|
58122
|
+
// against a predicted release cutoff.
|
|
58099
58123
|
hookResumeInputVersion: number$3().optional()
|
|
58100
58124
|
});
|
|
58101
58125
|
const HOOK_RESUME_INPUT_VERSION = 1;
|
|
@@ -58166,10 +58190,16 @@ async function reenqueueActiveRuns(runs, enqueue, label, namespace2) {
|
|
|
58166
58190
|
cursor = page.cursor ?? void 0;
|
|
58167
58191
|
}
|
|
58168
58192
|
}
|
|
58169
|
-
if (reenqueued > 0) {
|
|
58170
|
-
console.
|
|
58193
|
+
if (reenqueued > 0 && isDebugEnabled$1()) {
|
|
58194
|
+
console.debug(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
|
|
58171
58195
|
}
|
|
58172
58196
|
}
|
|
58197
|
+
function isDebugEnabled$1() {
|
|
58198
|
+
const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
|
|
58199
|
+
if (typeof debug !== "string")
|
|
58200
|
+
return false;
|
|
58201
|
+
return debug.includes("workflow:") || debug === "*";
|
|
58202
|
+
}
|
|
58173
58203
|
const zodJsonSchema = lazy(() => {
|
|
58174
58204
|
return union([
|
|
58175
58205
|
string$3(),
|
|
@@ -58441,15 +58471,9 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
|
|
|
58441
58471
|
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
58442
58472
|
return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
|
|
58443
58473
|
}
|
|
58444
|
-
const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58445
|
-
"step_terminal",
|
|
58446
|
-
"wait_completed",
|
|
58447
|
-
"hook_disposed"
|
|
58448
|
-
]);
|
|
58449
58474
|
const SINGLETON_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58450
58475
|
"run_started"
|
|
58451
58476
|
]);
|
|
58452
|
-
const RUN_ENTITY_KEY = "";
|
|
58453
58477
|
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.";
|
|
58454
58478
|
function compareEventId(a2, b2) {
|
|
58455
58479
|
if (a2.eventId.length !== b2.eventId.length) {
|
|
@@ -58479,10 +58503,10 @@ function foldDuplicates(ordered) {
|
|
|
58479
58503
|
const seenClasses = /* @__PURE__ */ new Set();
|
|
58480
58504
|
const closedEntities = /* @__PURE__ */ new Set();
|
|
58481
58505
|
for (const event of ordered) {
|
|
58482
|
-
const
|
|
58483
|
-
if (
|
|
58506
|
+
const classification = classifyEntityEvent(event);
|
|
58507
|
+
if (classification === void 0)
|
|
58484
58508
|
continue;
|
|
58485
|
-
const entity =
|
|
58509
|
+
const { eventClass, entity } = classification;
|
|
58486
58510
|
const classKey = `${eventClass}:${entity}`;
|
|
58487
58511
|
const repeatsClass = seenClasses.has(classKey);
|
|
58488
58512
|
const entityWasClosed = closedEntities.has(entity);
|
|
@@ -58510,10 +58534,10 @@ function findDuplicateEventIds(events2, { isCompleteHistory }) {
|
|
|
58510
58534
|
return foldDuplicates(ordered);
|
|
58511
58535
|
}
|
|
58512
58536
|
const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
|
|
58513
|
-
const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58514
|
-
const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58515
|
-
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58516
|
-
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58537
|
+
const STEP_ID_PATTERN$1 = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58538
|
+
const WAIT_ID_PATTERN$1 = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58539
|
+
const HOOK_ID_PATTERN$1 = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58540
|
+
const EVENT_ID_PATTERN$1 = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58517
58541
|
const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
|
|
58518
58542
|
function matchPrefixedId(pattern2, prefix, kind, query) {
|
|
58519
58543
|
const match2 = query.match(pattern2);
|
|
@@ -58527,7 +58551,7 @@ function parseExactWorkflowSearchId(query) {
|
|
|
58527
58551
|
if (!trimmed) {
|
|
58528
58552
|
return null;
|
|
58529
58553
|
}
|
|
58530
|
-
return matchPrefixedId(STEP_ID_PATTERN, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN, "evnt", "event", trimmed);
|
|
58554
|
+
return matchPrefixedId(STEP_ID_PATTERN$1, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN$1, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN$1, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN$1, "evnt", "event", trimmed);
|
|
58531
58555
|
}
|
|
58532
58556
|
function looksLikeWorkflowIdSearchInput(query) {
|
|
58533
58557
|
const trimmed = query.trim();
|
|
@@ -58536,6 +58560,17 @@ function looksLikeWorkflowIdSearchInput(query) {
|
|
|
58536
58560
|
}
|
|
58537
58561
|
return /\d/.test(trimmed);
|
|
58538
58562
|
}
|
|
58563
|
+
function isWorkflowDebugEnabled() {
|
|
58564
|
+
const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
|
|
58565
|
+
if (typeof debug !== "string")
|
|
58566
|
+
return false;
|
|
58567
|
+
return debug.includes("workflow:") || debug === "*";
|
|
58568
|
+
}
|
|
58569
|
+
function debugLog(...args) {
|
|
58570
|
+
if (!isWorkflowDebugEnabled())
|
|
58571
|
+
return;
|
|
58572
|
+
console.debug(...args);
|
|
58573
|
+
}
|
|
58539
58574
|
function globalSingleton(name2, shapeVersion, create2) {
|
|
58540
58575
|
const key = Symbol.for(`${name2}/v${shapeVersion}`);
|
|
58541
58576
|
const store = globalThis;
|
|
@@ -59406,6 +59441,10 @@ function stringify_primitive(thing) {
|
|
|
59406
59441
|
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
59407
59442
|
return String(thing);
|
|
59408
59443
|
}
|
|
59444
|
+
const RUN_ERROR_CODES = {
|
|
59445
|
+
/** Workflow stream infrastructure failed while reading or writing data */
|
|
59446
|
+
STREAM_ERROR: "STREAM_ERROR"
|
|
59447
|
+
};
|
|
59409
59448
|
const BASE_URL = "https://workflow-sdk.dev/err";
|
|
59410
59449
|
function isError(value) {
|
|
59411
59450
|
return typeof value === "object" && value !== null && "name" in value && "message" in value;
|
|
@@ -59437,6 +59476,7 @@ const ERROR_SLUGS = {
|
|
|
59437
59476
|
WEBHOOK_INVALID_RESPOND_WITH_VALUE: "webhook-invalid-respond-with-value",
|
|
59438
59477
|
WEBHOOK_RESPONSE_NOT_SENT: "webhook-response-not-sent",
|
|
59439
59478
|
HOOK_CONFLICT: "hook-conflict",
|
|
59479
|
+
CORRUPTED_EVENT_LOG: "corrupted-event-log",
|
|
59440
59480
|
RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
|
|
59441
59481
|
};
|
|
59442
59482
|
class WorkflowError extends Error {
|
|
@@ -59466,11 +59506,18 @@ class WorkflowWorldError extends WorkflowError {
|
|
|
59466
59506
|
__publicField(this, "url");
|
|
59467
59507
|
/** Retry-After value in seconds, present on 429 and 425 responses */
|
|
59468
59508
|
__publicField(this, "retryAfter");
|
|
59509
|
+
/**
|
|
59510
|
+
* The offending argument, present on client-side validation failures
|
|
59511
|
+
* (`code: 'INVALID_ARGUMENT'`). Lets a caller correct the specific
|
|
59512
|
+
* parameter without parsing the message.
|
|
59513
|
+
*/
|
|
59514
|
+
__publicField(this, "field");
|
|
59469
59515
|
this.name = "WorkflowWorldError";
|
|
59470
59516
|
this.status = options == null ? void 0 : options.status;
|
|
59471
59517
|
this.code = options == null ? void 0 : options.code;
|
|
59472
59518
|
this.url = options == null ? void 0 : options.url;
|
|
59473
59519
|
this.retryAfter = options == null ? void 0 : options.retryAfter;
|
|
59520
|
+
this.field = options == null ? void 0 : options.field;
|
|
59474
59521
|
}
|
|
59475
59522
|
static is(value) {
|
|
59476
59523
|
return isError(value) && value.name === "WorkflowWorldError";
|
|
@@ -59522,6 +59569,18 @@ class WorkflowRuntimeError extends WorkflowError {
|
|
|
59522
59569
|
return isError(value) && value.name === "WorkflowRuntimeError";
|
|
59523
59570
|
}
|
|
59524
59571
|
}
|
|
59572
|
+
class CorruptedEventLogError extends WorkflowRuntimeError {
|
|
59573
|
+
constructor(message2, options) {
|
|
59574
|
+
super(message2, {
|
|
59575
|
+
...options,
|
|
59576
|
+
slug: ERROR_SLUGS.CORRUPTED_EVENT_LOG
|
|
59577
|
+
});
|
|
59578
|
+
this.name = "CorruptedEventLogError";
|
|
59579
|
+
}
|
|
59580
|
+
static is(value) {
|
|
59581
|
+
return isError(value) && value.name === "CorruptedEventLogError";
|
|
59582
|
+
}
|
|
59583
|
+
}
|
|
59525
59584
|
class RuntimeDecryptionError extends WorkflowRuntimeError {
|
|
59526
59585
|
constructor(message2, options) {
|
|
59527
59586
|
super(message2, {
|
|
@@ -59617,6 +59676,20 @@ class RunExpiredError extends WorkflowWorldError {
|
|
|
59617
59676
|
return isError(value) && value.name === "RunExpiredError";
|
|
59618
59677
|
}
|
|
59619
59678
|
}
|
|
59679
|
+
class StreamError extends WorkflowWorldError {
|
|
59680
|
+
constructor(message2, options) {
|
|
59681
|
+
super(message2, {
|
|
59682
|
+
code: RUN_ERROR_CODES.STREAM_ERROR,
|
|
59683
|
+
cause: options == null ? void 0 : options.cause,
|
|
59684
|
+
url: options == null ? void 0 : options.url,
|
|
59685
|
+
status: options == null ? void 0 : options.status
|
|
59686
|
+
});
|
|
59687
|
+
this.name = "StreamError";
|
|
59688
|
+
}
|
|
59689
|
+
static is(value) {
|
|
59690
|
+
return isError(value) && value.name === "StreamError";
|
|
59691
|
+
}
|
|
59692
|
+
}
|
|
59620
59693
|
class StreamExpiredError extends WorkflowWorldError {
|
|
59621
59694
|
constructor(message2, runId, streamId, expiredAt) {
|
|
59622
59695
|
super(message2, { status: 410, code: "stream-expired" });
|
|
@@ -59724,6 +59797,7 @@ const FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
|
|
|
59724
59797
|
const RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
|
|
59725
59798
|
const HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
|
|
59726
59799
|
const RUNTIME_DECRYPTION_ERROR_KEY = Symbol.for("@workflow/errors//RuntimeDecryptionError");
|
|
59800
|
+
const STREAM_ERROR_KEY = Symbol.for("@workflow/errors//StreamError");
|
|
59727
59801
|
if (typeof globalThis !== "undefined") {
|
|
59728
59802
|
if (!Object.hasOwn(globalThis, FATAL_ERROR_KEY)) {
|
|
59729
59803
|
Object.defineProperty(globalThis, FATAL_ERROR_KEY, {
|
|
@@ -59757,6 +59831,14 @@ if (typeof globalThis !== "undefined") {
|
|
|
59757
59831
|
configurable: false
|
|
59758
59832
|
});
|
|
59759
59833
|
}
|
|
59834
|
+
if (!Object.hasOwn(globalThis, STREAM_ERROR_KEY)) {
|
|
59835
|
+
Object.defineProperty(globalThis, STREAM_ERROR_KEY, {
|
|
59836
|
+
value: StreamError,
|
|
59837
|
+
writable: false,
|
|
59838
|
+
enumerable: false,
|
|
59839
|
+
configurable: false
|
|
59840
|
+
});
|
|
59841
|
+
}
|
|
59760
59842
|
}
|
|
59761
59843
|
const NONCE_LENGTH = 12;
|
|
59762
59844
|
const TAG_LENGTH = 128;
|
|
@@ -60838,6 +60920,18 @@ function getWebRevivers() {
|
|
|
60838
60920
|
error2.stack = value.stack;
|
|
60839
60921
|
return error2;
|
|
60840
60922
|
},
|
|
60923
|
+
StreamError: (value) => {
|
|
60924
|
+
const opts = "cause" in value ? { cause: value.cause } : void 0;
|
|
60925
|
+
const error2 = new Error(value.message, opts);
|
|
60926
|
+
error2.name = "StreamError";
|
|
60927
|
+
if (value.status !== void 0)
|
|
60928
|
+
error2.status = value.status;
|
|
60929
|
+
if (value.url !== void 0)
|
|
60930
|
+
error2.url = value.url;
|
|
60931
|
+
if (value.stack !== void 0)
|
|
60932
|
+
error2.stack = value.stack;
|
|
60933
|
+
return error2;
|
|
60934
|
+
},
|
|
60841
60935
|
DOMException: (value) => {
|
|
60842
60936
|
const G2 = globalThis;
|
|
60843
60937
|
if (typeof G2.DOMException === "function") {
|
|
@@ -60988,7 +61082,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
60988
61082
|
}
|
|
60989
61083
|
async function hydrateResourceIOAsync(resource, key) {
|
|
60990
61084
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
60991
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
61085
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-DJTnP4ZA.js");
|
|
60992
61086
|
ensureZstdDecoderRegistered();
|
|
60993
61087
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
60994
61088
|
const revivers = getRevivers();
|
|
@@ -62989,8 +63083,28 @@ function BytesDisplayValue({ display }) {
|
|
|
62989
63083
|
function formatField(field) {
|
|
62990
63084
|
return field === "" ? '""' : field;
|
|
62991
63085
|
}
|
|
63086
|
+
function isGenericIterable(value) {
|
|
63087
|
+
if (value === null || typeof value !== "object" && typeof value !== "function" || Array.isArray(value) || value instanceof Map || value instanceof Set) {
|
|
63088
|
+
return false;
|
|
63089
|
+
}
|
|
63090
|
+
return typeof value[Symbol.iterator] === "function";
|
|
63091
|
+
}
|
|
63092
|
+
function isEntryIterable(value) {
|
|
63093
|
+
return typeof value.entries === "function";
|
|
63094
|
+
}
|
|
63095
|
+
function collectEntries(iterable, asPairs) {
|
|
63096
|
+
return Array.from(iterable, (item, index2) => {
|
|
63097
|
+
if (asPairs && Array.isArray(item) && item.length >= 2) {
|
|
63098
|
+
return [String(item[0]), collapseRefs(item[1]), index2];
|
|
63099
|
+
}
|
|
63100
|
+
return [void 0, collapseRefs(item), index2];
|
|
63101
|
+
});
|
|
63102
|
+
}
|
|
63103
|
+
function isSelfIterableIterator(value) {
|
|
63104
|
+
return Object.is(value[Symbol.iterator](), value);
|
|
63105
|
+
}
|
|
62992
63106
|
function describeContainer(value) {
|
|
62993
|
-
var _a3;
|
|
63107
|
+
var _a3, _b2;
|
|
62994
63108
|
if (Array.isArray(value)) {
|
|
62995
63109
|
return {
|
|
62996
63110
|
entries: value.map((item) => [void 0, item]),
|
|
@@ -63017,8 +63131,26 @@ function describeContainer(value) {
|
|
|
63017
63131
|
prefix: "Set"
|
|
63018
63132
|
};
|
|
63019
63133
|
}
|
|
63020
|
-
if (value
|
|
63134
|
+
if (isGenericIterable(value)) {
|
|
63021
63135
|
const name2 = (_a3 = value.constructor) == null ? void 0 : _a3.name;
|
|
63136
|
+
const prefix = name2 && name2 !== "Object" ? name2 : void 0;
|
|
63137
|
+
if (isEntryIterable(value)) {
|
|
63138
|
+
return {
|
|
63139
|
+
entries: collectEntries(value.entries(), true),
|
|
63140
|
+
open: "{",
|
|
63141
|
+
close: "}",
|
|
63142
|
+
prefix
|
|
63143
|
+
};
|
|
63144
|
+
}
|
|
63145
|
+
return {
|
|
63146
|
+
entries: collectEntries(value, false),
|
|
63147
|
+
open: "[",
|
|
63148
|
+
close: "]",
|
|
63149
|
+
prefix
|
|
63150
|
+
};
|
|
63151
|
+
}
|
|
63152
|
+
if (value !== null && typeof value === "object") {
|
|
63153
|
+
const name2 = (_b2 = value.constructor) == null ? void 0 : _b2.name;
|
|
63022
63154
|
return {
|
|
63023
63155
|
entries: Object.entries(value),
|
|
63024
63156
|
open: "{",
|
|
@@ -63129,7 +63261,7 @@ function ExpandableContainer({ field, entries, open: open2, close, prefix, ctx,
|
|
|
63129
63261
|
}
|
|
63130
63262
|
};
|
|
63131
63263
|
const lastIndex = entries.length - 1;
|
|
63132
|
-
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 })] });
|
|
63264
|
+
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 })] });
|
|
63133
63265
|
}
|
|
63134
63266
|
function DataRender({ field, value, isLast, ctx }) {
|
|
63135
63267
|
if (isBytesDisplay(value)) {
|
|
@@ -63257,6 +63389,19 @@ function isSameBytesDisplay(a2, b2) {
|
|
|
63257
63389
|
var _a3, _b2, _c2, _d2, _e2, _f;
|
|
63258
63390
|
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);
|
|
63259
63391
|
}
|
|
63392
|
+
function haveSameIterableValues(a2, b2, seen) {
|
|
63393
|
+
const aIterator = a2[Symbol.iterator]();
|
|
63394
|
+
const bIterator = b2[Symbol.iterator]();
|
|
63395
|
+
while (true) {
|
|
63396
|
+
const aResult = aIterator.next();
|
|
63397
|
+
const bResult = bIterator.next();
|
|
63398
|
+
if (aResult.done || bResult.done) {
|
|
63399
|
+
return aResult.done === bResult.done;
|
|
63400
|
+
}
|
|
63401
|
+
if (!isDeepEqual(aResult.value, bResult.value, seen))
|
|
63402
|
+
return false;
|
|
63403
|
+
}
|
|
63404
|
+
}
|
|
63260
63405
|
function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
|
|
63261
63406
|
if (Object.is(a2, b2))
|
|
63262
63407
|
return true;
|
|
@@ -63269,6 +63414,25 @@ function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
63269
63414
|
if (a2 instanceof RegExp && b2 instanceof RegExp) {
|
|
63270
63415
|
return a2.source === b2.source && a2.flags === b2.flags;
|
|
63271
63416
|
}
|
|
63417
|
+
if (isGenericIterable(a2) || isGenericIterable(b2)) {
|
|
63418
|
+
if (!isGenericIterable(a2) || !isGenericIterable(b2))
|
|
63419
|
+
return false;
|
|
63420
|
+
if (Object.getPrototypeOf(a2) !== Object.getPrototypeOf(b2))
|
|
63421
|
+
return false;
|
|
63422
|
+
if (isSelfIterableIterator(a2) || isSelfIterableIterator(b2))
|
|
63423
|
+
return false;
|
|
63424
|
+
if (seen.get(a2) === b2)
|
|
63425
|
+
return true;
|
|
63426
|
+
seen.set(a2, b2);
|
|
63427
|
+
const aHasEntries = isEntryIterable(a2);
|
|
63428
|
+
const bHasEntries = isEntryIterable(b2);
|
|
63429
|
+
if (aHasEntries !== bHasEntries)
|
|
63430
|
+
return false;
|
|
63431
|
+
if (aHasEntries && bHasEntries) {
|
|
63432
|
+
return haveSameIterableValues(a2.entries(), b2.entries(), seen);
|
|
63433
|
+
}
|
|
63434
|
+
return haveSameIterableValues(a2, b2, seen);
|
|
63435
|
+
}
|
|
63272
63436
|
if (a2 instanceof Map && b2 instanceof Map) {
|
|
63273
63437
|
if (a2.size !== b2.size)
|
|
63274
63438
|
return false;
|
|
@@ -64753,7 +64917,6 @@ function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggl
|
|
|
64753
64917
|
}, []);
|
|
64754
64918
|
reactExports.useEffect(() => {
|
|
64755
64919
|
if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
|
|
64756
|
-
setLoadedEventData(null);
|
|
64757
64920
|
setHasAttemptedLoad(false);
|
|
64758
64921
|
onLoadEventData(event).then((data) => {
|
|
64759
64922
|
if (data !== null && data !== void 0) {
|
|
@@ -91858,7 +92021,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
91858
92021
|
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 });
|
|
91859
92022
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
91860
92023
|
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 }) });
|
|
91861
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
92024
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-jO_hupW2.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
91862
92025
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
91863
92026
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
91864
92027
|
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 }) })] }) });
|
|
@@ -92180,7 +92343,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
92180
92343
|
}, []), 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] });
|
|
92181
92344
|
};
|
|
92182
92345
|
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 }) })] });
|
|
92183
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
92346
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-2Pe4e_TP.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
92184
92347
|
function ke(e, t) {
|
|
92185
92348
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
92186
92349
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -92933,7 +93096,7 @@ const stepEventsToStepEntity = (events2) => {
|
|
|
92933
93096
|
specVersion: anchorEvent.specVersion
|
|
92934
93097
|
};
|
|
92935
93098
|
};
|
|
92936
|
-
function stepToSpan(stepEvents, maxEndTime) {
|
|
93099
|
+
function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
92937
93100
|
const step = stepEventsToStepEntity(stepEvents);
|
|
92938
93101
|
if (!step) {
|
|
92939
93102
|
return null;
|
|
@@ -92941,7 +93104,11 @@ function stepToSpan(stepEvents, maxEndTime) {
|
|
|
92941
93104
|
const parsedName = parseStepName(String(step.stepName)) ?? parseWorkflowName(String(step.stepName));
|
|
92942
93105
|
const attributes = {
|
|
92943
93106
|
resource: "step",
|
|
92944
|
-
data:
|
|
93107
|
+
data: {
|
|
93108
|
+
...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
|
|
93109
|
+
// Canonical event-derived fields cannot be overridden by extensions.
|
|
93110
|
+
...step
|
|
93111
|
+
}
|
|
92945
93112
|
};
|
|
92946
93113
|
const resource = "step";
|
|
92947
93114
|
const events2 = convertEventsToSpanEvents(stepEvents, false, {
|
|
@@ -93119,10 +93286,10 @@ function computeLatestKnownTime(events2, run2) {
|
|
|
93119
93286
|
}
|
|
93120
93287
|
return new Date(latest);
|
|
93121
93288
|
}
|
|
93122
|
-
function buildSpans(run2, groupedEvents, now2, latestKnownTime) {
|
|
93289
|
+
function buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes) {
|
|
93123
93290
|
const childMaxEnd = latestKnownTime;
|
|
93124
93291
|
const runMaxEnd = run2.completedAt ?? now2;
|
|
93125
|
-
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
93292
|
+
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd, getStepAttributes)).filter((span) => span !== null);
|
|
93126
93293
|
const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
93127
93294
|
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
|
|
93128
93295
|
return {
|
|
@@ -93147,14 +93314,14 @@ function cascadeSpans(runSpan, spans) {
|
|
|
93147
93314
|
};
|
|
93148
93315
|
});
|
|
93149
93316
|
}
|
|
93150
|
-
function buildTrace(run2, events2, now2, { isCompleteHistory = false } = {}) {
|
|
93317
|
+
function buildTrace(run2, events2, now2, { isCompleteHistory = false, getStepAttributes } = {}) {
|
|
93151
93318
|
const duplicateEventIds = findDuplicateEventIds(events2, {
|
|
93152
93319
|
isCompleteHistory
|
|
93153
93320
|
});
|
|
93154
93321
|
const actedOnEvents = events2.filter((event) => !duplicateEventIds.has(event.eventId) && !isSealedNoopEvent(event));
|
|
93155
93322
|
const groupedEvents = groupEventsByCorrelation(actedOnEvents);
|
|
93156
93323
|
const latestKnownTime = computeLatestKnownTime(actedOnEvents, run2);
|
|
93157
|
-
const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime);
|
|
93324
|
+
const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes);
|
|
93158
93325
|
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
93159
93326
|
const traceStartMs = otelTimeToMs(runSpan.startTime);
|
|
93160
93327
|
const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
|
|
@@ -97393,6 +97560,42 @@ function TraceShortcutHelper({ hasMultipleSpans, reducedMotion }) {
|
|
|
97393
97560
|
};
|
|
97394
97561
|
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" }) })] });
|
|
97395
97562
|
}
|
|
97563
|
+
function isAltModifierKey(key) {
|
|
97564
|
+
return key === "Alt" || key === "AltGraph";
|
|
97565
|
+
}
|
|
97566
|
+
function isTypingTarget(target2) {
|
|
97567
|
+
return target2 instanceof HTMLInputElement || target2 instanceof HTMLTextAreaElement || target2 instanceof HTMLElement && target2.isContentEditable;
|
|
97568
|
+
}
|
|
97569
|
+
function useAltHeld() {
|
|
97570
|
+
const [altHeld, setAltHeld] = reactExports.useState(false);
|
|
97571
|
+
reactExports.useEffect(() => {
|
|
97572
|
+
const onKeyDown = (e) => {
|
|
97573
|
+
if (!isAltModifierKey(e.key))
|
|
97574
|
+
return;
|
|
97575
|
+
if (!isTypingTarget(e.target)) {
|
|
97576
|
+
e.preventDefault();
|
|
97577
|
+
}
|
|
97578
|
+
setAltHeld(true);
|
|
97579
|
+
};
|
|
97580
|
+
const onKeyUp = (e) => {
|
|
97581
|
+
if (isAltModifierKey(e.key))
|
|
97582
|
+
setAltHeld(false);
|
|
97583
|
+
};
|
|
97584
|
+
const onBlur = () => setAltHeld(false);
|
|
97585
|
+
const onPointerMove = (e) => setAltHeld(e.altKey);
|
|
97586
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
97587
|
+
window.addEventListener("keyup", onKeyUp, true);
|
|
97588
|
+
window.addEventListener("blur", onBlur);
|
|
97589
|
+
window.addEventListener("pointermove", onPointerMove, true);
|
|
97590
|
+
return () => {
|
|
97591
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
97592
|
+
window.removeEventListener("keyup", onKeyUp, true);
|
|
97593
|
+
window.removeEventListener("blur", onBlur);
|
|
97594
|
+
window.removeEventListener("pointermove", onPointerMove, true);
|
|
97595
|
+
};
|
|
97596
|
+
}, []);
|
|
97597
|
+
return { altHeld };
|
|
97598
|
+
}
|
|
97396
97599
|
const MIN_VIEWPORT_MS = 1e-3;
|
|
97397
97600
|
const ZOOM_DEBOUNCE_MS = 150;
|
|
97398
97601
|
function useAnimatedViewport(initial) {
|
|
@@ -97592,28 +97795,15 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
|
|
|
97592
97795
|
focusViewportOnSpan(spanId);
|
|
97593
97796
|
}, ZOOM_DEBOUNCE_MS);
|
|
97594
97797
|
}, [setActiveSpan, scrollSpanIntoView, cancelPendingZoom, focusViewportOnSpan]);
|
|
97595
|
-
const
|
|
97798
|
+
const { altHeld } = useAltHeld();
|
|
97596
97799
|
reactExports.useEffect(() => {
|
|
97597
97800
|
const onKeyDown = (e) => {
|
|
97598
97801
|
if (e.key === "Escape") {
|
|
97599
97802
|
handleClearActiveSpan();
|
|
97600
|
-
} else if (e.key === "Alt") {
|
|
97601
|
-
setAltHeld(true);
|
|
97602
97803
|
}
|
|
97603
97804
|
};
|
|
97604
|
-
const onKeyUp = (e) => {
|
|
97605
|
-
if (e.key === "Alt")
|
|
97606
|
-
setAltHeld(false);
|
|
97607
|
-
};
|
|
97608
|
-
const onBlur = () => setAltHeld(false);
|
|
97609
97805
|
window.addEventListener("keydown", onKeyDown);
|
|
97610
|
-
window.
|
|
97611
|
-
window.addEventListener("blur", onBlur);
|
|
97612
|
-
return () => {
|
|
97613
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
97614
|
-
window.removeEventListener("keyup", onKeyUp);
|
|
97615
|
-
window.removeEventListener("blur", onBlur);
|
|
97616
|
-
};
|
|
97806
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
97617
97807
|
}, [handleClearActiveSpan]);
|
|
97618
97808
|
const timelineRef = reactExports.useRef(null);
|
|
97619
97809
|
const [hover, setHover] = reactExports.useState(null);
|
|
@@ -97689,15 +97879,16 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
|
|
|
97689
97879
|
}
|
|
97690
97880
|
}, 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 })] });
|
|
97691
97881
|
}
|
|
97692
|
-
const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false }) => {
|
|
97882
|
+
const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes }) => {
|
|
97693
97883
|
const trace2 = reactExports.useMemo(() => {
|
|
97694
97884
|
if (!(run2 == null ? void 0 : run2.runId)) {
|
|
97695
97885
|
return void 0;
|
|
97696
97886
|
}
|
|
97697
97887
|
return buildTrace(run2, events2, /* @__PURE__ */ new Date(), {
|
|
97698
|
-
isCompleteHistory: !hasMore
|
|
97888
|
+
isCompleteHistory: !hasMore,
|
|
97889
|
+
getStepAttributes
|
|
97699
97890
|
});
|
|
97700
|
-
}, [run2, events2, hasMore]);
|
|
97891
|
+
}, [run2, events2, hasMore, getStepAttributes]);
|
|
97701
97892
|
const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace2 == null ? void 0 : trace2.duplicateEventIds }), [sidebarData, trace2]);
|
|
97702
97893
|
if (!trace2 || loading && events2.length === 0) {
|
|
97703
97894
|
return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
|
|
@@ -100559,11 +100750,18 @@ function Logo({ className } = {}) {
|
|
|
100559
100750
|
}
|
|
100560
100751
|
);
|
|
100561
100752
|
}
|
|
100562
|
-
const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
100753
|
+
const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
100754
|
+
"TRANSPORT",
|
|
100755
|
+
"TIMEOUT",
|
|
100756
|
+
RUN_ERROR_CODES.STREAM_ERROR
|
|
100757
|
+
]);
|
|
100563
100758
|
function isRetryableWorldError(err) {
|
|
100564
100759
|
if (ThrottleError.is(err)) {
|
|
100565
100760
|
return true;
|
|
100566
100761
|
}
|
|
100762
|
+
if (StreamError.is(err)) {
|
|
100763
|
+
return err.status === void 0 || err.status >= 500;
|
|
100764
|
+
}
|
|
100567
100765
|
if (!WorkflowWorldError.is(err)) {
|
|
100568
100766
|
return false;
|
|
100569
100767
|
}
|
|
@@ -100873,6 +101071,8 @@ const DeploymentId = SemanticConvention$2("deployment.id");
|
|
|
100873
101071
|
const HookToken = SemanticConvention$2("workflow.hook.token");
|
|
100874
101072
|
const HookId = SemanticConvention$2("workflow.hook.id");
|
|
100875
101073
|
const HookFound = SemanticConvention$2("workflow.hook.found");
|
|
101074
|
+
const HookResumeCommitted = SemanticConvention$2("workflow.hook.resume_committed");
|
|
101075
|
+
const HookWakePublished = SemanticConvention$2("workflow.hook.wake_published");
|
|
100876
101076
|
const WorkflowSuspensionState = SemanticConvention$2("workflow.suspension.state");
|
|
100877
101077
|
const WorkflowSuspensionHookCount = SemanticConvention$2("workflow.suspension.hook_count");
|
|
100878
101078
|
const WorkflowSuspensionStepCount = SemanticConvention$2("workflow.suspension.step_count");
|
|
@@ -100917,6 +101117,16 @@ const Tracer = once$1(async () => {
|
|
|
100917
101117
|
return tracer;
|
|
100918
101118
|
});
|
|
100919
101119
|
let otelDiagLogged$1 = false;
|
|
101120
|
+
function describeThrownValue(value) {
|
|
101121
|
+
try {
|
|
101122
|
+
if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string") {
|
|
101123
|
+
return value.message;
|
|
101124
|
+
}
|
|
101125
|
+
return String(value);
|
|
101126
|
+
} catch {
|
|
101127
|
+
return "Unknown error";
|
|
101128
|
+
}
|
|
101129
|
+
}
|
|
100920
101130
|
function logOtelDiagnosticOnce$1(otel2, tracer) {
|
|
100921
101131
|
var _a3, _b2, _c2, _d2, _e2;
|
|
100922
101132
|
const debugEnabled = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
@@ -100961,7 +101171,7 @@ async function trace$2(spanName, ...args) {
|
|
|
100961
101171
|
} else {
|
|
100962
101172
|
span.setStatus({
|
|
100963
101173
|
code: otel2.SpanStatusCode.ERROR,
|
|
100964
|
-
message: e
|
|
101174
|
+
message: describeThrownValue(e)
|
|
100965
101175
|
});
|
|
100966
101176
|
}
|
|
100967
101177
|
throw e;
|
|
@@ -101942,6 +102152,19 @@ function getCommonReducers(_global = globalThis) {
|
|
|
101942
102152
|
}
|
|
101943
102153
|
return reduced;
|
|
101944
102154
|
},
|
|
102155
|
+
StreamError: (value) => {
|
|
102156
|
+
const base = reduceNamedErrorSubclassBase("StreamError", value);
|
|
102157
|
+
if (!base)
|
|
102158
|
+
return false;
|
|
102159
|
+
const reduced = { ...base };
|
|
102160
|
+
const status = readProperty(value, "status");
|
|
102161
|
+
const url2 = readProperty(value, "url");
|
|
102162
|
+
if (typeof status === "number")
|
|
102163
|
+
reduced.status = status;
|
|
102164
|
+
if (typeof url2 === "string")
|
|
102165
|
+
reduced.url = url2;
|
|
102166
|
+
return reduced;
|
|
102167
|
+
},
|
|
101945
102168
|
SyntaxError: makeErrorSubclassReducer("SyntaxError"),
|
|
101946
102169
|
TypeError: makeErrorSubclassReducer("TypeError"),
|
|
101947
102170
|
URIError: makeErrorSubclassReducer("URIError"),
|
|
@@ -102087,6 +102310,17 @@ function getCommonRevivers$1(global2 = globalThis) {
|
|
|
102087
102310
|
error2.stack = value.stack;
|
|
102088
102311
|
return error2;
|
|
102089
102312
|
},
|
|
102313
|
+
StreamError: (value) => {
|
|
102314
|
+
const Ctor = global2[Symbol.for("@workflow/errors//StreamError")] ?? StreamError;
|
|
102315
|
+
const error2 = new Ctor(value.message, {
|
|
102316
|
+
..."cause" in value ? { cause: value.cause } : {},
|
|
102317
|
+
status: value.status,
|
|
102318
|
+
url: value.url
|
|
102319
|
+
});
|
|
102320
|
+
if (value.stack !== void 0)
|
|
102321
|
+
error2.stack = value.stack;
|
|
102322
|
+
return error2;
|
|
102323
|
+
},
|
|
102090
102324
|
SyntaxError: makeErrorSubclassReviver(global2, "SyntaxError"),
|
|
102091
102325
|
TypeError: makeErrorSubclassReviver(global2, "TypeError"),
|
|
102092
102326
|
URIError: makeErrorSubclassReviver(global2, "URIError"),
|
|
@@ -102829,6 +103063,18 @@ function recordReadTimeToFirstChunk(startEpochMs, runId, name2, startIndex, conn
|
|
|
102829
103063
|
});
|
|
102830
103064
|
})();
|
|
102831
103065
|
}
|
|
103066
|
+
function recordStreamReadKeyResolution(startEpochMs, runId, name2, succeeded) {
|
|
103067
|
+
void (async () => {
|
|
103068
|
+
await recordElapsedSpan("workflow.stream.read.resolve_key", startEpochMs, {
|
|
103069
|
+
kind: await getSpanKind$2("CLIENT"),
|
|
103070
|
+
attributes: {
|
|
103071
|
+
"workflow.run.id": runId,
|
|
103072
|
+
"workflow.stream.name": name2,
|
|
103073
|
+
"workflow.stream.read.key_succeeded": succeeded
|
|
103074
|
+
}
|
|
103075
|
+
});
|
|
103076
|
+
})();
|
|
103077
|
+
}
|
|
102832
103078
|
function recordStreamReadComplete(startEpochMs, runId, name2, chunkCount, byteCount, reconnects) {
|
|
102833
103079
|
void (async () => {
|
|
102834
103080
|
await recordElapsedSpan("workflow.stream.read.complete", startEpochMs, {
|
|
@@ -102909,27 +103155,50 @@ const getFramedStreamMaxReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX
|
|
|
102909
103155
|
});
|
|
102910
103156
|
const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1e3;
|
|
102911
103157
|
const getFramedStreamMaxTotalReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS", FRAMED_STREAM_MAX_TOTAL_RECONNECTS, { integer: true, min: 1 });
|
|
102912
|
-
function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
103158
|
+
function createReconnectingFramedStream(runId, name2, startIndex, prefetchEncryptionKey = async () => void 0) {
|
|
102913
103159
|
const reconnectSupported = startIndex === void 0 || startIndex >= 0;
|
|
102914
103160
|
let currentStartIndex = startIndex ?? 0;
|
|
102915
103161
|
let consumedFrames = 0;
|
|
102916
103162
|
let reconnectCount = 0;
|
|
102917
103163
|
let totalReconnectCount = 0;
|
|
102918
103164
|
let reader;
|
|
103165
|
+
let canceled = false;
|
|
103166
|
+
let cancelReason;
|
|
102919
103167
|
let buffer2 = new Uint8Array(0);
|
|
102920
103168
|
let readStart;
|
|
102921
103169
|
let connectMs;
|
|
102922
103170
|
let firstChunkReported = false;
|
|
102923
103171
|
let chunksDelivered = 0;
|
|
102924
103172
|
let bytesDelivered = 0;
|
|
103173
|
+
let keyPrefetched = false;
|
|
103174
|
+
function prefetchKey() {
|
|
103175
|
+
if (keyPrefetched)
|
|
103176
|
+
return;
|
|
103177
|
+
keyPrefetched = true;
|
|
103178
|
+
const keyStart = Date.now();
|
|
103179
|
+
void prefetchEncryptionKey().then((key) => {
|
|
103180
|
+
if (key)
|
|
103181
|
+
recordStreamReadKeyResolution(keyStart, runId, name2, true);
|
|
103182
|
+
}, () => recordStreamReadKeyResolution(keyStart, runId, name2, false));
|
|
103183
|
+
}
|
|
102925
103184
|
async function connect2() {
|
|
103185
|
+
if (canceled)
|
|
103186
|
+
return false;
|
|
102926
103187
|
const world = await getWorldLazy();
|
|
103188
|
+
if (canceled)
|
|
103189
|
+
return false;
|
|
102927
103190
|
const effectiveStartIndex = reconnectSupported ? currentStartIndex + consumedFrames : startIndex;
|
|
102928
103191
|
const connectStart = Date.now();
|
|
102929
103192
|
const stream = await world.streams.get(runId, name2, effectiveStartIndex);
|
|
103193
|
+
if (canceled) {
|
|
103194
|
+
await stream.cancel(cancelReason).catch(() => {
|
|
103195
|
+
});
|
|
103196
|
+
return false;
|
|
103197
|
+
}
|
|
102930
103198
|
if (connectMs === void 0)
|
|
102931
103199
|
connectMs = Date.now() - connectStart;
|
|
102932
103200
|
reader = stream.getReader();
|
|
103201
|
+
return true;
|
|
102933
103202
|
}
|
|
102934
103203
|
async function isVerifiedComplete() {
|
|
102935
103204
|
try {
|
|
@@ -102941,11 +103210,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
102941
103210
|
}
|
|
102942
103211
|
}
|
|
102943
103212
|
async function reconnect() {
|
|
103213
|
+
if (canceled)
|
|
103214
|
+
return false;
|
|
102944
103215
|
if (reader) {
|
|
102945
103216
|
await reader.cancel().catch(() => {
|
|
102946
103217
|
});
|
|
102947
103218
|
reader = void 0;
|
|
102948
103219
|
}
|
|
103220
|
+
if (canceled)
|
|
103221
|
+
return false;
|
|
102949
103222
|
currentStartIndex += consumedFrames;
|
|
102950
103223
|
consumedFrames = 0;
|
|
102951
103224
|
buffer2 = new Uint8Array(0);
|
|
@@ -102955,15 +103228,18 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
102955
103228
|
reconnectCount++;
|
|
102956
103229
|
totalReconnectCount++;
|
|
102957
103230
|
if (reconnectCount > maxReconnects) {
|
|
102958
|
-
throw new
|
|
103231
|
+
throw new StreamError(`Stream "${name2}" exceeded maximum reconnection attempts (${maxReconnects})`);
|
|
102959
103232
|
}
|
|
102960
103233
|
if (totalReconnectCount > maxTotalReconnects) {
|
|
102961
|
-
throw new
|
|
103234
|
+
throw new StreamError(`Stream "${name2}" exceeded maximum total reconnection attempts (${maxTotalReconnects})`);
|
|
102962
103235
|
}
|
|
102963
103236
|
try {
|
|
102964
|
-
await connect2()
|
|
102965
|
-
|
|
103237
|
+
if (!await connect2())
|
|
103238
|
+
return false;
|
|
103239
|
+
return true;
|
|
102966
103240
|
} catch (error2) {
|
|
103241
|
+
if (canceled)
|
|
103242
|
+
return false;
|
|
102967
103243
|
if (StreamExpiredError.is(error2))
|
|
102968
103244
|
throw error2;
|
|
102969
103245
|
}
|
|
@@ -102971,13 +103247,19 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
102971
103247
|
}
|
|
102972
103248
|
return new ReadableStream({
|
|
102973
103249
|
pull: async (controller) => {
|
|
103250
|
+
if (canceled)
|
|
103251
|
+
return;
|
|
102974
103252
|
if (readStart === void 0)
|
|
102975
103253
|
readStart = Date.now();
|
|
103254
|
+
prefetchKey();
|
|
102976
103255
|
for (; ; ) {
|
|
102977
103256
|
if (!reader) {
|
|
102978
103257
|
try {
|
|
102979
|
-
await connect2()
|
|
103258
|
+
if (!await connect2())
|
|
103259
|
+
return;
|
|
102980
103260
|
} catch (err) {
|
|
103261
|
+
if (canceled)
|
|
103262
|
+
return;
|
|
102981
103263
|
controller.error(err);
|
|
102982
103264
|
return;
|
|
102983
103265
|
}
|
|
@@ -102986,23 +103268,32 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
102986
103268
|
try {
|
|
102987
103269
|
result = await reader.read();
|
|
102988
103270
|
} catch (err) {
|
|
103271
|
+
if (canceled)
|
|
103272
|
+
return;
|
|
102989
103273
|
if (!reconnectSupported) {
|
|
102990
103274
|
controller.error(err);
|
|
102991
103275
|
return;
|
|
102992
103276
|
}
|
|
102993
103277
|
try {
|
|
102994
|
-
await reconnect()
|
|
103278
|
+
if (!await reconnect())
|
|
103279
|
+
return;
|
|
102995
103280
|
} catch (reconnectErr) {
|
|
102996
103281
|
controller.error(reconnectErr);
|
|
102997
103282
|
return;
|
|
102998
103283
|
}
|
|
102999
103284
|
continue;
|
|
103000
103285
|
}
|
|
103286
|
+
if (canceled)
|
|
103287
|
+
return;
|
|
103001
103288
|
if (result.done || !result.value) {
|
|
103002
103289
|
reader = void 0;
|
|
103003
|
-
|
|
103290
|
+
const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
|
|
103291
|
+
if (canceled)
|
|
103292
|
+
return;
|
|
103293
|
+
if (!verifiedComplete) {
|
|
103004
103294
|
try {
|
|
103005
|
-
await reconnect()
|
|
103295
|
+
if (!await reconnect())
|
|
103296
|
+
return;
|
|
103006
103297
|
} catch (reconnectErr) {
|
|
103007
103298
|
controller.error(reconnectErr);
|
|
103008
103299
|
return;
|
|
@@ -103045,12 +103336,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
103045
103336
|
}
|
|
103046
103337
|
}
|
|
103047
103338
|
},
|
|
103048
|
-
cancel: async () => {
|
|
103049
|
-
|
|
103050
|
-
|
|
103339
|
+
cancel: async (reason) => {
|
|
103340
|
+
canceled = true;
|
|
103341
|
+
cancelReason = reason;
|
|
103342
|
+
const currentReader = reader;
|
|
103343
|
+
reader = void 0;
|
|
103344
|
+
if (currentReader) {
|
|
103345
|
+
await currentReader.cancel(reason).catch((err) => {
|
|
103051
103346
|
console.warn("Error closing ReadableStream reader:", err);
|
|
103052
103347
|
});
|
|
103053
|
-
reader = void 0;
|
|
103054
103348
|
}
|
|
103055
103349
|
}
|
|
103056
103350
|
});
|
|
@@ -103412,7 +103706,7 @@ function attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops) {
|
|
|
103412
103706
|
})());
|
|
103413
103707
|
}, { once: true });
|
|
103414
103708
|
}
|
|
103415
|
-
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
103709
|
+
function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
|
|
103416
103710
|
return {
|
|
103417
103711
|
...getAllBaseReducers(global2),
|
|
103418
103712
|
ReadableStream: (value) => {
|
|
@@ -103434,7 +103728,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
103434
103728
|
ops.push(value.pipeTo(writable));
|
|
103435
103729
|
}
|
|
103436
103730
|
} else {
|
|
103437
|
-
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
103731
|
+
ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
|
|
103438
103732
|
}
|
|
103439
103733
|
const s2 = { name: name2 };
|
|
103440
103734
|
if (type)
|
|
@@ -103466,7 +103760,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
103466
103760
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
103467
103761
|
const name2 = `strm_${streamId}`;
|
|
103468
103762
|
const readable2 = new WorkflowServerReadableStream(runId, name2);
|
|
103469
|
-
|
|
103763
|
+
readbackOps.push(readable2.pipeTo(value));
|
|
103470
103764
|
return { name: name2 };
|
|
103471
103765
|
},
|
|
103472
103766
|
AbortController: (value) => {
|
|
@@ -103569,7 +103863,7 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
103569
103863
|
}
|
|
103570
103864
|
};
|
|
103571
103865
|
}
|
|
103572
|
-
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
|
|
103866
|
+
function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
|
|
103573
103867
|
return {
|
|
103574
103868
|
...getAllBaseReducers(global2),
|
|
103575
103869
|
ReadableStream: (value) => {
|
|
@@ -103596,7 +103890,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
103596
103890
|
ops.push(value.pipeTo(writable));
|
|
103597
103891
|
}
|
|
103598
103892
|
} else {
|
|
103599
|
-
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
|
|
103893
|
+
ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
|
|
103600
103894
|
}
|
|
103601
103895
|
}
|
|
103602
103896
|
const s2 = { name: name2 };
|
|
@@ -103614,7 +103908,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
103614
103908
|
if (!name2) {
|
|
103615
103909
|
const streamId = (global2[STABLE_ULID] || defaultUlid)();
|
|
103616
103910
|
name2 = `strm_${streamId}`;
|
|
103617
|
-
|
|
103911
|
+
readbackOps.push(new WorkflowServerReadableStream(runId, name2).pipeThrough(getDeserializeStream(getStepRevivers(global2, readbackOps, runId, cryptoKey), cryptoKey)).pipeTo(value));
|
|
103618
103912
|
}
|
|
103619
103913
|
const s2 = { name: name2 };
|
|
103620
103914
|
if (typeof foreignRunId === "string")
|
|
@@ -103734,8 +104028,8 @@ function reviveAbortController(value, ops, runId) {
|
|
|
103734
104028
|
if (value.hookToken) {
|
|
103735
104029
|
const hookResume = (async () => {
|
|
103736
104030
|
try {
|
|
103737
|
-
const {
|
|
103738
|
-
await
|
|
104031
|
+
const { resumeHook: resumeHook2 } = await Promise.resolve().then(() => resumeHook$3);
|
|
104032
|
+
await resumeHook2(value.hookToken, {
|
|
103739
104033
|
aborted: true,
|
|
103740
104034
|
reason
|
|
103741
104035
|
});
|
|
@@ -103777,7 +104071,48 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId, encryption
|
|
|
103777
104071
|
const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
|
|
103778
104072
|
return rawKey ? await importKey(rawKey, ["encrypt"]) : void 0;
|
|
103779
104073
|
}
|
|
103780
|
-
function
|
|
104074
|
+
function getRunReadableStream(global2, ops, runId, name2, startIndex, cryptoKey) {
|
|
104075
|
+
let reader;
|
|
104076
|
+
let lockState;
|
|
104077
|
+
let lockPollingStarted = false;
|
|
104078
|
+
let userReadable;
|
|
104079
|
+
userReadable = new ReadableStream(
|
|
104080
|
+
{
|
|
104081
|
+
async pull(controller) {
|
|
104082
|
+
try {
|
|
104083
|
+
if (!reader) {
|
|
104084
|
+
const stream = getExternalRevivers(global2, ops, runId, cryptoKey, {
|
|
104085
|
+
onReadableState: (state) => {
|
|
104086
|
+
lockState = state;
|
|
104087
|
+
}
|
|
104088
|
+
}).ReadableStream({ name: name2, startIndex });
|
|
104089
|
+
reader = stream.getReader();
|
|
104090
|
+
if (lockState && !lockPollingStarted) {
|
|
104091
|
+
lockPollingStarted = true;
|
|
104092
|
+
pollReadableLock(userReadable, lockState);
|
|
104093
|
+
}
|
|
104094
|
+
}
|
|
104095
|
+
const result = await reader.read();
|
|
104096
|
+
if (result.done)
|
|
104097
|
+
controller.close();
|
|
104098
|
+
else
|
|
104099
|
+
controller.enqueue(result.value);
|
|
104100
|
+
} catch (error2) {
|
|
104101
|
+
controller.error(error2);
|
|
104102
|
+
}
|
|
104103
|
+
},
|
|
104104
|
+
async cancel(reason) {
|
|
104105
|
+
await (reader == null ? void 0 : reader.cancel(reason).catch(() => {
|
|
104106
|
+
}));
|
|
104107
|
+
}
|
|
104108
|
+
},
|
|
104109
|
+
// A positive default high-water mark would run pull at construction to
|
|
104110
|
+
// fill the queue, turning an unread Run.getReadable() into I/O.
|
|
104111
|
+
{ highWaterMark: 0 }
|
|
104112
|
+
);
|
|
104113
|
+
return userReadable;
|
|
104114
|
+
}
|
|
104115
|
+
function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey, options) {
|
|
103781
104116
|
return {
|
|
103782
104117
|
...getCommonRevivers(global2),
|
|
103783
104118
|
// StepFunction should not be returned from workflows to clients
|
|
@@ -103825,16 +104160,27 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
103825
104160
|
const { readable: userReadable, writable } = value.framing === "framed-v1" ? getByteUnframingStream() : new global2.TransformStream();
|
|
103826
104161
|
flushablePipe(readable2, writable, state).catch(() => {
|
|
103827
104162
|
});
|
|
103828
|
-
|
|
104163
|
+
if (options == null ? void 0 : options.onReadableState)
|
|
104164
|
+
options.onReadableState(state);
|
|
104165
|
+
else
|
|
104166
|
+
pollReadableLock(userReadable, state);
|
|
103829
104167
|
return userReadable;
|
|
103830
104168
|
} else {
|
|
103831
|
-
|
|
103832
|
-
const
|
|
104169
|
+
let keyPromise;
|
|
104170
|
+
const resolveKey = () => {
|
|
104171
|
+
keyPromise ?? (keyPromise = resolveEncryptionKey(cryptoKey));
|
|
104172
|
+
return keyPromise;
|
|
104173
|
+
};
|
|
104174
|
+
const readable2 = createReconnectingFramedStream(runId, value.name, value.startIndex, resolveKey);
|
|
104175
|
+
const transform2 = getDeserializeStream(getExternalRevivers(global2, ops, runId, resolveKey), resolveKey);
|
|
103833
104176
|
const state = createFlushableState();
|
|
103834
104177
|
ops.push(state.promise);
|
|
103835
104178
|
flushablePipe(readable2, transform2.writable, state).catch(() => {
|
|
103836
104179
|
});
|
|
103837
|
-
|
|
104180
|
+
if (options == null ? void 0 : options.onReadableState)
|
|
104181
|
+
options.onReadableState(state);
|
|
104182
|
+
else
|
|
104183
|
+
pollReadableLock(transform2.readable, state);
|
|
103838
104184
|
return transform2.readable;
|
|
103839
104185
|
}
|
|
103840
104186
|
},
|
|
@@ -104171,16 +104517,16 @@ function deserializePreparedReplayPayload(prepared, global2 = globalThis, extraR
|
|
|
104171
104517
|
}
|
|
104172
104518
|
});
|
|
104173
104519
|
}
|
|
104174
|
-
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
104520
|
+
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, readbackOps = ops) {
|
|
104175
104521
|
if (v1Compat) {
|
|
104176
|
-
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
|
|
104522
|
+
const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps));
|
|
104177
104523
|
return revive(str);
|
|
104178
104524
|
}
|
|
104179
104525
|
try {
|
|
104180
104526
|
const compressionStats = {};
|
|
104181
104527
|
const result = await serialize$3(value, key, {
|
|
104182
104528
|
global: global2,
|
|
104183
|
-
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams)),
|
|
104529
|
+
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps)),
|
|
104184
104530
|
compression,
|
|
104185
104531
|
compressionStats
|
|
104186
104532
|
});
|
|
@@ -104247,16 +104593,16 @@ async function hydrateStepArguments(value, runId, key, ops = [], global2 = globa
|
|
|
104247
104593
|
await recordCompression(compressionStats, "deserialize");
|
|
104248
104594
|
return result;
|
|
104249
104595
|
}
|
|
104250
|
-
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier) {
|
|
104596
|
+
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier, readbackOps = ops) {
|
|
104251
104597
|
if (v1Compat) {
|
|
104252
|
-
const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier));
|
|
104598
|
+
const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps));
|
|
104253
104599
|
return revive(str);
|
|
104254
104600
|
}
|
|
104255
104601
|
try {
|
|
104256
104602
|
const compressionStats = {};
|
|
104257
104603
|
const result = await serialize$2(value, key, {
|
|
104258
104604
|
global: global2,
|
|
104259
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier)),
|
|
104605
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps)),
|
|
104260
104606
|
compression,
|
|
104261
104607
|
compressionStats
|
|
104262
104608
|
});
|
|
@@ -104325,7 +104671,7 @@ globalSingleton("@workflow/core//envWarnings", 1, () => ({
|
|
|
104325
104671
|
maxInlineStepsValues: /* @__PURE__ */ new Set(),
|
|
104326
104672
|
maxEventsValues: /* @__PURE__ */ new Set()
|
|
104327
104673
|
}));
|
|
104328
|
-
const version$1 = "5.0.0-beta.
|
|
104674
|
+
const version$1 = "5.0.0-beta.48";
|
|
104329
104675
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
104330
104676
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
104331
104677
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
@@ -104664,9 +105010,7 @@ async function getAllPorts() {
|
|
|
104664
105010
|
return [];
|
|
104665
105011
|
}
|
|
104666
105012
|
} catch (error2) {
|
|
104667
|
-
|
|
104668
|
-
console.debug("[getAllPorts] Detection failed:", error2);
|
|
104669
|
-
}
|
|
105013
|
+
debugLog("[getAllPorts] Detection failed:", error2);
|
|
104670
105014
|
return [];
|
|
104671
105015
|
}
|
|
104672
105016
|
}
|
|
@@ -104704,9 +105048,7 @@ async function getWorkflowPort(options) {
|
|
|
104704
105048
|
if (workflowPort) {
|
|
104705
105049
|
return workflowPort.port;
|
|
104706
105050
|
}
|
|
104707
|
-
|
|
104708
|
-
console.debug("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
|
|
104709
|
-
}
|
|
105051
|
+
debugLog("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
|
|
104710
105052
|
return ports[0];
|
|
104711
105053
|
}
|
|
104712
105054
|
function once(fn2) {
|
|
@@ -107822,7 +108164,7 @@ function requireDiagnostics() {
|
|
|
107822
108164
|
proxyConnected: diagnosticsChannel.channel("undici:proxy:connected")
|
|
107823
108165
|
};
|
|
107824
108166
|
let isTrackingClientEvents = false;
|
|
107825
|
-
function trackClientEvents(
|
|
108167
|
+
function trackClientEvents(debugLog2 = undiciDebugLog) {
|
|
107826
108168
|
if (isTrackingClientEvents) {
|
|
107827
108169
|
return;
|
|
107828
108170
|
}
|
|
@@ -107837,7 +108179,7 @@ function requireDiagnostics() {
|
|
|
107837
108179
|
const {
|
|
107838
108180
|
connectParams: { version: version2, protocol, port, host }
|
|
107839
108181
|
} = evt;
|
|
107840
|
-
|
|
108182
|
+
debugLog2(
|
|
107841
108183
|
"connecting to %s%s using %s%s",
|
|
107842
108184
|
host,
|
|
107843
108185
|
port ? `:${port}` : "",
|
|
@@ -107852,7 +108194,7 @@ function requireDiagnostics() {
|
|
|
107852
108194
|
const {
|
|
107853
108195
|
connectParams: { version: version2, protocol, port, host }
|
|
107854
108196
|
} = evt;
|
|
107855
|
-
|
|
108197
|
+
debugLog2(
|
|
107856
108198
|
"connected to %s%s using %s%s",
|
|
107857
108199
|
host,
|
|
107858
108200
|
port ? `:${port}` : "",
|
|
@@ -107868,7 +108210,7 @@ function requireDiagnostics() {
|
|
|
107868
108210
|
connectParams: { version: version2, protocol, port, host },
|
|
107869
108211
|
error: error2
|
|
107870
108212
|
} = evt;
|
|
107871
|
-
|
|
108213
|
+
debugLog2(
|
|
107872
108214
|
"connection to %s%s using %s%s errored - %s",
|
|
107873
108215
|
host,
|
|
107874
108216
|
port ? `:${port}` : "",
|
|
@@ -107884,12 +108226,12 @@ function requireDiagnostics() {
|
|
|
107884
108226
|
const {
|
|
107885
108227
|
request: { method, path: path2, origin }
|
|
107886
108228
|
} = evt;
|
|
107887
|
-
|
|
108229
|
+
debugLog2("sending request to %s %s%s", method, origin, path2);
|
|
107888
108230
|
}
|
|
107889
108231
|
);
|
|
107890
108232
|
}
|
|
107891
108233
|
let isTrackingRequestEvents = false;
|
|
107892
|
-
function trackRequestEvents(
|
|
108234
|
+
function trackRequestEvents(debugLog2 = undiciDebugLog) {
|
|
107893
108235
|
if (isTrackingRequestEvents) {
|
|
107894
108236
|
return;
|
|
107895
108237
|
}
|
|
@@ -107905,7 +108247,7 @@ function requireDiagnostics() {
|
|
|
107905
108247
|
request: { method, path: path2, origin },
|
|
107906
108248
|
response: { statusCode }
|
|
107907
108249
|
} = evt;
|
|
107908
|
-
|
|
108250
|
+
debugLog2(
|
|
107909
108251
|
"received response to %s %s%s - HTTP %d",
|
|
107910
108252
|
method,
|
|
107911
108253
|
origin,
|
|
@@ -107920,7 +108262,7 @@ function requireDiagnostics() {
|
|
|
107920
108262
|
const {
|
|
107921
108263
|
request: { method, path: path2, origin }
|
|
107922
108264
|
} = evt;
|
|
107923
|
-
|
|
108265
|
+
debugLog2("trailers received from %s %s%s", method, origin, path2);
|
|
107924
108266
|
}
|
|
107925
108267
|
);
|
|
107926
108268
|
diagnosticsChannel.subscribe(
|
|
@@ -107930,7 +108272,7 @@ function requireDiagnostics() {
|
|
|
107930
108272
|
request: { method, path: path2, origin },
|
|
107931
108273
|
error: error2
|
|
107932
108274
|
} = evt;
|
|
107933
|
-
|
|
108275
|
+
debugLog2(
|
|
107934
108276
|
"request to %s %s%s errored - %s",
|
|
107935
108277
|
method,
|
|
107936
108278
|
origin,
|
|
@@ -107941,7 +108283,7 @@ function requireDiagnostics() {
|
|
|
107941
108283
|
);
|
|
107942
108284
|
}
|
|
107943
108285
|
let isTrackingWebSocketEvents = false;
|
|
107944
|
-
function trackWebSocketEvents(
|
|
108286
|
+
function trackWebSocketEvents(debugLog2 = websocketDebuglog) {
|
|
107945
108287
|
if (isTrackingWebSocketEvents) {
|
|
107946
108288
|
return;
|
|
107947
108289
|
}
|
|
@@ -107955,9 +108297,9 @@ function requireDiagnostics() {
|
|
|
107955
108297
|
(evt) => {
|
|
107956
108298
|
if (evt.address != null) {
|
|
107957
108299
|
const { address, port } = evt.address;
|
|
107958
|
-
|
|
108300
|
+
debugLog2("connection opened %s%s", address, port ? `:${port}` : "");
|
|
107959
108301
|
} else {
|
|
107960
|
-
|
|
108302
|
+
debugLog2("connection opened");
|
|
107961
108303
|
}
|
|
107962
108304
|
}
|
|
107963
108305
|
);
|
|
@@ -107965,7 +108307,7 @@ function requireDiagnostics() {
|
|
|
107965
108307
|
"undici:websocket:close",
|
|
107966
108308
|
(evt) => {
|
|
107967
108309
|
const { websocket: websocket2, code: code2, reason } = evt;
|
|
107968
|
-
|
|
108310
|
+
debugLog2(
|
|
107969
108311
|
"closed connection to %s - %s %s",
|
|
107970
108312
|
websocket2.url,
|
|
107971
108313
|
code2,
|
|
@@ -107976,19 +108318,19 @@ function requireDiagnostics() {
|
|
|
107976
108318
|
diagnosticsChannel.subscribe(
|
|
107977
108319
|
"undici:websocket:socket_error",
|
|
107978
108320
|
(err) => {
|
|
107979
|
-
|
|
108321
|
+
debugLog2("connection errored - %s", err.message);
|
|
107980
108322
|
}
|
|
107981
108323
|
);
|
|
107982
108324
|
diagnosticsChannel.subscribe(
|
|
107983
108325
|
"undici:websocket:ping",
|
|
107984
108326
|
(evt) => {
|
|
107985
|
-
|
|
108327
|
+
debugLog2("ping received");
|
|
107986
108328
|
}
|
|
107987
108329
|
);
|
|
107988
108330
|
diagnosticsChannel.subscribe(
|
|
107989
108331
|
"undici:websocket:pong",
|
|
107990
108332
|
(evt) => {
|
|
107991
|
-
|
|
108333
|
+
debugLog2("pong received");
|
|
107992
108334
|
}
|
|
107993
108335
|
);
|
|
107994
108336
|
}
|
|
@@ -131970,7 +132312,7 @@ function createQueue$2(config2) {
|
|
|
131970
132312
|
}
|
|
131971
132313
|
const token = semaphore.tryAcquire();
|
|
131972
132314
|
if (!token) {
|
|
131973
|
-
|
|
132315
|
+
debugLog(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
|
|
131974
132316
|
await semaphore.acquire();
|
|
131975
132317
|
}
|
|
131976
132318
|
const MAX_LOCAL_SAFETY_LIMIT = 256;
|
|
@@ -132001,6 +132343,7 @@ function createQueue$2(config2) {
|
|
|
132001
132343
|
headers: new Headers(headers2),
|
|
132002
132344
|
body: body2,
|
|
132003
132345
|
agents: nodeHttpAgents,
|
|
132346
|
+
signal: closeSignal,
|
|
132004
132347
|
headersTimeoutMs: agentOptions.headersTimeout,
|
|
132005
132348
|
bodyTimeoutMs: agentOptions.bodyTimeout
|
|
132006
132349
|
}) : (
|
|
@@ -132010,7 +132353,8 @@ function createQueue$2(config2) {
|
|
|
132010
132353
|
duplex: "half",
|
|
132011
132354
|
dispatcher: httpAgent,
|
|
132012
132355
|
headers: headers2,
|
|
132013
|
-
body: body2
|
|
132356
|
+
body: body2,
|
|
132357
|
+
signal: closeSignal
|
|
132014
132358
|
})
|
|
132015
132359
|
);
|
|
132016
132360
|
}
|
|
@@ -135602,12 +135946,24 @@ function createEventsStorage(basedir, tag) {
|
|
|
135602
135946
|
};
|
|
135603
135947
|
const storedConflict = await storeEvent(conflictEvent);
|
|
135604
135948
|
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
135605
|
-
|
|
135949
|
+
const conflictDelta = typeof (params == null ? void 0 : params.sinceCursor) === "string" ? await queryRunEvents(effectiveRunId, {
|
|
135950
|
+
sortOrder: "asc",
|
|
135951
|
+
cursor: params.sinceCursor
|
|
135952
|
+
}) : void 0;
|
|
135953
|
+
const conflictResult = {
|
|
135606
135954
|
event: stripEventDataRefs(storedConflict, resolveData2),
|
|
135607
135955
|
run: run2,
|
|
135608
135956
|
step,
|
|
135609
135957
|
hook: void 0
|
|
135610
135958
|
};
|
|
135959
|
+
if (!conflictDelta)
|
|
135960
|
+
return conflictResult;
|
|
135961
|
+
return {
|
|
135962
|
+
...conflictResult,
|
|
135963
|
+
events: resolveData2 === "none" ? conflictDelta.data.map((delta) => stripEventDataRefs(delta, resolveData2)) : conflictDelta.data,
|
|
135964
|
+
cursor: conflictDelta.cursor,
|
|
135965
|
+
hasMore: conflictDelta.hasMore
|
|
135966
|
+
};
|
|
135611
135967
|
}
|
|
135612
135968
|
const persistedHookData = event.eventData;
|
|
135613
135969
|
hook = {
|
|
@@ -136394,7 +136750,7 @@ function createWorld$2(args) {
|
|
|
136394
136750
|
const basedir = mergedConfig.dataDir;
|
|
136395
136751
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
136396
136752
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
136397
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
136753
|
+
const { HookSchema: HookSchema2 } = await import("./index-DshIaniU.js");
|
|
136398
136754
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
136399
136755
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
136400
136756
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -136577,8 +136933,8 @@ function requireGetVercelOidcToken() {
|
|
|
136577
136933
|
}
|
|
136578
136934
|
try {
|
|
136579
136935
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
136580
|
-
await import("./token-util-
|
|
136581
|
-
await import("./token-
|
|
136936
|
+
await import("./token-util-BMRcW3Qd.js").then((n) => n.t),
|
|
136937
|
+
await import("./token-DAVWictz.js").then((n) => n.t)
|
|
136582
136938
|
]);
|
|
136583
136939
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
136584
136940
|
await refreshToken(options);
|
|
@@ -137141,7 +137497,7 @@ function requireDist() {
|
|
|
137141
137497
|
return dist;
|
|
137142
137498
|
}
|
|
137143
137499
|
var distExports = requireDist();
|
|
137144
|
-
const version = "5.0.0-beta.
|
|
137500
|
+
const version = "5.0.0-beta.44";
|
|
137145
137501
|
const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
|
|
137146
137502
|
dispatcher: void 0,
|
|
137147
137503
|
streamDispatcher: void 0,
|
|
@@ -137513,6 +137869,33 @@ const WorkflowWsUrl = SemanticConvention("workflow.events.ws.url");
|
|
|
137513
137869
|
const WorkflowWsRequestId = SemanticConvention("workflow.events.ws.req_id");
|
|
137514
137870
|
const WorkflowWsReconnectAttempt = SemanticConvention("workflow.events.ws.reconnect_attempt");
|
|
137515
137871
|
const REQUEST_TIMEOUT_MS = 6e4;
|
|
137872
|
+
const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
137873
|
+
"UND_ERR_INFO",
|
|
137874
|
+
"UND_ERR_REQ_RETRY",
|
|
137875
|
+
"UND_ERR_SOCKET",
|
|
137876
|
+
"UND_ERR_CONNECT",
|
|
137877
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
137878
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
137879
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
137880
|
+
"UND_ERR_CLOSED",
|
|
137881
|
+
"ECONNRESET",
|
|
137882
|
+
"ECONNREFUSED",
|
|
137883
|
+
"ENOTFOUND",
|
|
137884
|
+
"EAI_AGAIN",
|
|
137885
|
+
"EPIPE",
|
|
137886
|
+
"ETIMEDOUT"
|
|
137887
|
+
]);
|
|
137888
|
+
function getTransientTransportCode(error2) {
|
|
137889
|
+
let current = error2;
|
|
137890
|
+
for (let depth = 0; current && depth < 8; depth++) {
|
|
137891
|
+
const code2 = current.code;
|
|
137892
|
+
if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
|
|
137893
|
+
return code2;
|
|
137894
|
+
}
|
|
137895
|
+
current = current.cause;
|
|
137896
|
+
}
|
|
137897
|
+
return void 0;
|
|
137898
|
+
}
|
|
137516
137899
|
const getRequestTimeoutMs = () => envNumber("WORKFLOW_REQUEST_TIMEOUT_MS", REQUEST_TIMEOUT_MS, {
|
|
137517
137900
|
integer: true,
|
|
137518
137901
|
min: 1e4,
|
|
@@ -137646,10 +138029,10 @@ function recordClientSpanStatus(span, status) {
|
|
|
137646
138029
|
}
|
|
137647
138030
|
}
|
|
137648
138031
|
async function instrumentedFetch(opts) {
|
|
137649
|
-
const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome } = opts;
|
|
138032
|
+
const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome, deferTransportSuccessUntilBody = false, transportErrorCode = "TRANSPORT" } = opts;
|
|
137650
138033
|
const label = logLabel ?? url2;
|
|
137651
138034
|
return withHttpClientSpan({ method, url: url2, peerService, spanName, attributes }, async (span) => {
|
|
137652
|
-
var _a3, _b2, _c2;
|
|
138035
|
+
var _a3, _b2, _c2, _d2, _e2;
|
|
137653
138036
|
if (injectTraceContext2)
|
|
137654
138037
|
await injectTraceContextIntoHeaders(headers2);
|
|
137655
138038
|
if (cacheBust)
|
|
@@ -137687,15 +138070,36 @@ async function instrumentedFetch(opts) {
|
|
|
137687
138070
|
const elapsed = Date.now() - start2;
|
|
137688
138071
|
onTransportOutcome == null ? void 0 : onTransportOutcome(error2);
|
|
137689
138072
|
if (error2 instanceof Error && (error2.name === "TimeoutError" || error2.name === "AbortError")) {
|
|
137690
|
-
const
|
|
137691
|
-
|
|
138073
|
+
const message2 = `${method} ${label} timed out after ${elapsed}ms`;
|
|
138074
|
+
const errorCode = transportErrorCode === "STREAM_ERROR" ? "STREAM_ERROR" : "TIMEOUT";
|
|
138075
|
+
const timeoutError = errorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause: error2 }) : new WorkflowWorldError(message2, {
|
|
138076
|
+
url: url2,
|
|
138077
|
+
code: errorCode,
|
|
138078
|
+
cause: error2
|
|
138079
|
+
});
|
|
138080
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType(errorCode) });
|
|
137692
138081
|
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
|
|
137693
138082
|
throw timeoutError;
|
|
137694
138083
|
}
|
|
138084
|
+
const transportCode = getTransientTransportCode(error2);
|
|
138085
|
+
if (transportCode) {
|
|
138086
|
+
const message2 = `${method} ${label} transport failure after ${elapsed}ms (${transportCode})`;
|
|
138087
|
+
const errorCode = transportErrorCode === "STREAM_ERROR" ? "STREAM_ERROR" : "TRANSPORT";
|
|
138088
|
+
const transportError2 = errorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause: error2 }) : new WorkflowWorldError(message2, {
|
|
138089
|
+
url: url2,
|
|
138090
|
+
code: errorCode,
|
|
138091
|
+
cause: error2
|
|
138092
|
+
});
|
|
138093
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType(errorCode) });
|
|
138094
|
+
(_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, transportError2);
|
|
138095
|
+
throw transportError2;
|
|
138096
|
+
}
|
|
137695
138097
|
throw error2;
|
|
137696
138098
|
}
|
|
137697
138099
|
const ms2 = Date.now() - start2;
|
|
137698
|
-
|
|
138100
|
+
if (response2.ok && !deferTransportSuccessUntilBody) {
|
|
138101
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
|
|
138102
|
+
}
|
|
137699
138103
|
httpLog(method, label, response2, ms2);
|
|
137700
138104
|
recordClientSpanStatus(span, response2.status);
|
|
137701
138105
|
if (durationAttribute)
|
|
@@ -137703,16 +138107,42 @@ async function instrumentedFetch(opts) {
|
|
|
137703
138107
|
if (!response2.ok) {
|
|
137704
138108
|
logCurlRepro(method, url2, headers2);
|
|
137705
138109
|
if (buildError) {
|
|
137706
|
-
|
|
137707
|
-
|
|
138110
|
+
let error3;
|
|
138111
|
+
try {
|
|
138112
|
+
error3 = await buildError(response2);
|
|
138113
|
+
} catch (cause) {
|
|
138114
|
+
const transportCode = getTransientTransportCode(cause);
|
|
138115
|
+
if (transportCode) {
|
|
138116
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(cause, response2);
|
|
138117
|
+
const message2 = `${method} ${label} response body transport failure (${transportCode})`;
|
|
138118
|
+
const mappedError = transportErrorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause }) : new WorkflowWorldError(message2, {
|
|
138119
|
+
url: url2,
|
|
138120
|
+
code: "TRANSPORT",
|
|
138121
|
+
cause
|
|
138122
|
+
});
|
|
138123
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType(transportErrorCode) });
|
|
138124
|
+
(_c2 = span == null ? void 0 : span.recordException) == null ? void 0 : _c2.call(span, mappedError);
|
|
138125
|
+
throw mappedError;
|
|
138126
|
+
}
|
|
138127
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
|
|
138128
|
+
throw cause;
|
|
138129
|
+
}
|
|
138130
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
|
|
138131
|
+
(_d2 = span == null ? void 0 : span.recordException) == null ? void 0 : _d2.call(span, error3);
|
|
137708
138132
|
throw error3;
|
|
137709
138133
|
}
|
|
137710
|
-
|
|
138134
|
+
let text2 = "";
|
|
138135
|
+
try {
|
|
138136
|
+
text2 = await response2.text();
|
|
138137
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
|
|
138138
|
+
} catch (cause) {
|
|
138139
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(cause, response2);
|
|
138140
|
+
}
|
|
137711
138141
|
const error2 = errorForResponse(response2.status, `${method} ${label} -> HTTP ${response2.status}: ${response2.statusText}${text2 ? ` ${text2}` : ""}${formatVercelDiagnostics(response2.headers)}`, {
|
|
137712
138142
|
url: url2,
|
|
137713
138143
|
retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
|
|
137714
138144
|
});
|
|
137715
|
-
(
|
|
138145
|
+
(_e2 = span == null ? void 0 : span.recordException) == null ? void 0 : _e2.call(span, error2);
|
|
137716
138146
|
throw error2;
|
|
137717
138147
|
}
|
|
137718
138148
|
return response2;
|
|
@@ -137721,34 +138151,6 @@ async function instrumentedFetch(opts) {
|
|
|
137721
138151
|
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
137722
138152
|
const MAX_BODY_PARSE_RETRIES = 2;
|
|
137723
138153
|
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
137724
|
-
const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
137725
|
-
"UND_ERR_REQ_RETRY",
|
|
137726
|
-
"UND_ERR_SOCKET",
|
|
137727
|
-
"UND_ERR_CONNECT",
|
|
137728
|
-
"UND_ERR_CONNECT_TIMEOUT",
|
|
137729
|
-
"UND_ERR_HEADERS_TIMEOUT",
|
|
137730
|
-
"UND_ERR_BODY_TIMEOUT",
|
|
137731
|
-
"UND_ERR_CLOSED",
|
|
137732
|
-
"ECONNRESET",
|
|
137733
|
-
"ECONNREFUSED",
|
|
137734
|
-
"ENOTFOUND",
|
|
137735
|
-
"EAI_AGAIN",
|
|
137736
|
-
"EPIPE",
|
|
137737
|
-
"ETIMEDOUT"
|
|
137738
|
-
]);
|
|
137739
|
-
function getTransientTransportCode(error2) {
|
|
137740
|
-
let current = error2;
|
|
137741
|
-
for (let depth = 0; current != null && depth < 5; depth++) {
|
|
137742
|
-
if (typeof current === "object" && "code" in current) {
|
|
137743
|
-
const code2 = current.code;
|
|
137744
|
-
if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
|
|
137745
|
-
return code2;
|
|
137746
|
-
}
|
|
137747
|
-
}
|
|
137748
|
-
current = current == null ? void 0 : current.cause;
|
|
137749
|
-
}
|
|
137750
|
-
return void 0;
|
|
137751
|
-
}
|
|
137752
138154
|
const getWorkflowServerUrlOverride = () => process.env.VERCEL_WORKFLOW_SERVER_URL || "";
|
|
137753
138155
|
const TEST_LIMIT_OVERRIDES_HEADER = "x-workflow-test-limit-overrides";
|
|
137754
138156
|
const getTestLimitOverridesHeader = () => {
|
|
@@ -137994,9 +138396,94 @@ async function parseResponseBody(response2) {
|
|
|
137994
138396
|
getDebugContext: () => `Content-Type: ${contentType}, ${text2.length} bytes, preview: ${createPreview(data)}`
|
|
137995
138397
|
};
|
|
137996
138398
|
}
|
|
137997
|
-
|
|
137998
|
-
|
|
138399
|
+
const INVALID_ARGUMENT = "INVALID_ARGUMENT";
|
|
138400
|
+
function invalidArgument(method, field, detail) {
|
|
138401
|
+
return new WorkflowWorldError(`${method}: ${field} ${detail}`, {
|
|
138402
|
+
code: INVALID_ARGUMENT,
|
|
138403
|
+
field
|
|
138404
|
+
});
|
|
138405
|
+
}
|
|
138406
|
+
const ULID_BODY = "[01234567][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}";
|
|
138407
|
+
const RUN_ID_PATTERN = new RegExp(`^wrun_${ULID_BODY}$`);
|
|
138408
|
+
const CORRELATION_ID_PATTERN = new RegExp(`^(?:step|hook|wait|attr)_${ULID_BODY}$`);
|
|
138409
|
+
const EVENT_ID_PATTERN = new RegExp(`^evnt_${ULID_BODY}$`);
|
|
138410
|
+
const STEP_ID_PATTERN = new RegExp(`^step_${ULID_BODY}$`);
|
|
138411
|
+
const HOOK_ID_PATTERN = new RegExp(`^hook_${ULID_BODY}$`);
|
|
138412
|
+
const WAIT_ID_PATTERN = new RegExp(`^wait_${ULID_BODY}$`);
|
|
138413
|
+
function assertPageLimit(method, limit, maxLimit) {
|
|
138414
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > maxLimit) {
|
|
138415
|
+
throw invalidArgument(method, "pagination.limit", `must be an integer between 1 and ${maxLimit} (received ${limit})`);
|
|
138416
|
+
}
|
|
138417
|
+
}
|
|
138418
|
+
function assertRunId(method, runId) {
|
|
138419
|
+
if (!RUN_ID_PATTERN.test(runId)) {
|
|
138420
|
+
throw invalidArgument(method, "runId", `must be a workflow run id ('wrun_' followed by a ULID), received ${JSON.stringify(runId)}`);
|
|
138421
|
+
}
|
|
138422
|
+
}
|
|
138423
|
+
function assertCorrelationId(method, correlationId) {
|
|
138424
|
+
if (!CORRELATION_ID_PATTERN.test(correlationId)) {
|
|
138425
|
+
throw invalidArgument(method, "correlationId", `must be a step, hook, wait, or attribute id, received ${JSON.stringify(correlationId)}`);
|
|
138426
|
+
}
|
|
138427
|
+
}
|
|
138428
|
+
function assertEventId(method, eventId) {
|
|
138429
|
+
if (!EVENT_ID_PATTERN.test(eventId)) {
|
|
138430
|
+
throw invalidArgument(method, "eventId", `must be an event id ('evnt_' followed by a ULID), received ${JSON.stringify(eventId)}`);
|
|
138431
|
+
}
|
|
138432
|
+
}
|
|
138433
|
+
function assertStepId(method, stepId) {
|
|
138434
|
+
if (!STEP_ID_PATTERN.test(stepId)) {
|
|
138435
|
+
throw invalidArgument(method, "stepId", `must be a step id ('step_' followed by a ULID), received ${JSON.stringify(stepId)}`);
|
|
138436
|
+
}
|
|
138437
|
+
}
|
|
138438
|
+
function assertHookId(method, hookId) {
|
|
138439
|
+
if (!HOOK_ID_PATTERN.test(hookId)) {
|
|
138440
|
+
throw invalidArgument(method, "hookId", `must be a hook id ('hook_' followed by a ULID), received ${JSON.stringify(hookId)}`);
|
|
138441
|
+
}
|
|
138442
|
+
}
|
|
138443
|
+
function assertWaitId(method, waitId) {
|
|
138444
|
+
if (!WAIT_ID_PATTERN.test(waitId)) {
|
|
138445
|
+
throw invalidArgument(method, "waitId", `must be a wait id ('wait_' followed by a ULID), received ${JSON.stringify(waitId)}`);
|
|
138446
|
+
}
|
|
138447
|
+
}
|
|
138448
|
+
function assertAttributeFilters(method, attributes) {
|
|
138449
|
+
const entries = Object.entries(attributes);
|
|
138450
|
+
if (entries.length > ANALYTICS_MAX_ATTRIBUTE_FILTERS) {
|
|
138451
|
+
throw invalidArgument(method, "attributes", `may filter by at most ${ANALYTICS_MAX_ATTRIBUTE_FILTERS} pairs (received ${entries.length})`);
|
|
138452
|
+
}
|
|
138453
|
+
for (const [key, value] of entries) {
|
|
138454
|
+
if (!AttributeKeySchema.safeParse(key).success) {
|
|
138455
|
+
throw invalidArgument(method, "attributes", `key must be 1 to ${ATTRIBUTE_KEY_MAX_LENGTH} characters, received ${key.length} in ${JSON.stringify(key)}`);
|
|
138456
|
+
}
|
|
138457
|
+
if (!AttributeValueSchema.safeParse(value).success) {
|
|
138458
|
+
throw invalidArgument(method, "attributes", `value for ${JSON.stringify(key)} must be at most ${ATTRIBUTE_VALUE_MAX_BYTES} UTF-8 bytes (received ${new TextEncoder().encode(value).length})`);
|
|
138459
|
+
}
|
|
138460
|
+
}
|
|
138461
|
+
}
|
|
138462
|
+
function assertDateWindow(method, startTime, endTime) {
|
|
138463
|
+
if (startTime === void 0 && endTime === void 0)
|
|
138464
|
+
return;
|
|
138465
|
+
if (startTime === void 0 || endTime === void 0) {
|
|
138466
|
+
const given = startTime === void 0 ? "endTime" : "startTime";
|
|
138467
|
+
const missing = startTime === void 0 ? "startTime" : "endTime";
|
|
138468
|
+
throw invalidArgument(method, missing, `is required when ${given} is provided; supply both or neither`);
|
|
138469
|
+
}
|
|
138470
|
+
const start2 = new Date(startTime).getTime();
|
|
138471
|
+
const end = new Date(endTime).getTime();
|
|
138472
|
+
if (!Number.isFinite(start2)) {
|
|
138473
|
+
throw invalidArgument(method, "startTime", `must be a parseable datetime, received ${JSON.stringify(startTime)}`);
|
|
138474
|
+
}
|
|
138475
|
+
if (!Number.isFinite(end)) {
|
|
138476
|
+
throw invalidArgument(method, "endTime", `must be a parseable datetime, received ${JSON.stringify(endTime)}`);
|
|
138477
|
+
}
|
|
138478
|
+
if (start2 > end) {
|
|
138479
|
+
throw invalidArgument(method, "startTime", `must be before or equal to endTime (received startTime=${JSON.stringify(startTime)}, endTime=${JSON.stringify(endTime)})`);
|
|
138480
|
+
}
|
|
138481
|
+
}
|
|
138482
|
+
function appendPagination(method, params, pagination, maxLimit) {
|
|
138483
|
+
if ((pagination == null ? void 0 : pagination.limit) !== void 0) {
|
|
138484
|
+
assertPageLimit(method, pagination.limit, maxLimit);
|
|
137999
138485
|
params.set("limit", pagination.limit.toString());
|
|
138486
|
+
}
|
|
138000
138487
|
if (pagination == null ? void 0 : pagination.cursor)
|
|
138001
138488
|
params.set("cursor", pagination.cursor);
|
|
138002
138489
|
if (pagination == null ? void 0 : pagination.sortOrder)
|
|
@@ -138006,30 +138493,34 @@ function createQueryString(params) {
|
|
|
138006
138493
|
const query = params.toString();
|
|
138007
138494
|
return query ? `?${query}` : "";
|
|
138008
138495
|
}
|
|
138009
|
-
function normalizeEventIds(eventIds) {
|
|
138496
|
+
function normalizeEventIds(method, eventIds) {
|
|
138010
138497
|
const uniqueEventIds = [...new Set(eventIds)];
|
|
138011
138498
|
if (uniqueEventIds.length === 0) {
|
|
138012
|
-
throw
|
|
138499
|
+
throw invalidArgument(method, "eventIds", "must contain at least one id");
|
|
138013
138500
|
}
|
|
138014
138501
|
if (uniqueEventIds.length > ANALYTICS_EVENTS_GET_MANY_LIMIT) {
|
|
138015
|
-
throw
|
|
138502
|
+
throw invalidArgument(method, "eventIds", `must contain at most ${ANALYTICS_EVENTS_GET_MANY_LIMIT} unique ids (received ${uniqueEventIds.length})`);
|
|
138016
138503
|
}
|
|
138504
|
+
for (const eventId of uniqueEventIds)
|
|
138505
|
+
assertEventId(method, eventId);
|
|
138017
138506
|
return uniqueEventIds;
|
|
138018
138507
|
}
|
|
138019
|
-
function appendAttributeListParams(searchParams, params) {
|
|
138020
|
-
|
|
138508
|
+
function appendAttributeListParams(method, searchParams, params) {
|
|
138509
|
+
assertDateWindow(method, params.startTime, params.endTime);
|
|
138510
|
+
if (params.workflowName !== void 0) {
|
|
138021
138511
|
searchParams.set("workflowName", params.workflowName);
|
|
138022
138512
|
}
|
|
138023
|
-
if (params.startTime && params.endTime) {
|
|
138513
|
+
if (params.startTime !== void 0 && params.endTime !== void 0) {
|
|
138024
138514
|
searchParams.set("startTime", params.startTime);
|
|
138025
138515
|
searchParams.set("endTime", params.endTime);
|
|
138026
138516
|
}
|
|
138027
|
-
appendPagination(searchParams, params.pagination);
|
|
138517
|
+
appendPagination(method, searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
|
|
138028
138518
|
}
|
|
138029
138519
|
function createAnalytics(config2) {
|
|
138030
138520
|
return {
|
|
138031
138521
|
runs: {
|
|
138032
138522
|
get(runId) {
|
|
138523
|
+
assertRunId("analytics.runs.get", runId);
|
|
138033
138524
|
return makeRequest({
|
|
138034
138525
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}`,
|
|
138035
138526
|
config: config2,
|
|
@@ -138037,21 +138528,23 @@ function createAnalytics(config2) {
|
|
|
138037
138528
|
});
|
|
138038
138529
|
},
|
|
138039
138530
|
list(params = {}) {
|
|
138531
|
+
assertDateWindow("analytics.runs.list", params.startTime, params.endTime);
|
|
138040
138532
|
const searchParams = new URLSearchParams();
|
|
138041
|
-
if (params.workflowName) {
|
|
138533
|
+
if (params.workflowName !== void 0) {
|
|
138042
138534
|
searchParams.set("workflowName", params.workflowName);
|
|
138043
138535
|
}
|
|
138044
138536
|
if (params.status) {
|
|
138045
138537
|
searchParams.set("status", params.status);
|
|
138046
138538
|
}
|
|
138047
|
-
if (params.startTime && params.endTime) {
|
|
138539
|
+
if (params.startTime !== void 0 && params.endTime !== void 0) {
|
|
138048
138540
|
searchParams.set("startTime", params.startTime);
|
|
138049
138541
|
searchParams.set("endTime", params.endTime);
|
|
138050
138542
|
}
|
|
138051
138543
|
if (params.attributes && Object.keys(params.attributes).length > 0) {
|
|
138544
|
+
assertAttributeFilters("analytics.runs.list", params.attributes);
|
|
138052
138545
|
searchParams.set("attributes", JSON.stringify(params.attributes));
|
|
138053
138546
|
}
|
|
138054
|
-
appendPagination(searchParams, params.pagination);
|
|
138547
|
+
appendPagination("analytics.runs.list", searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
|
|
138055
138548
|
return makeRequest({
|
|
138056
138549
|
endpoint: `/v2/analytics/runs${createQueryString(searchParams)}`,
|
|
138057
138550
|
config: config2,
|
|
@@ -138062,7 +138555,7 @@ function createAnalytics(config2) {
|
|
|
138062
138555
|
attributes: {
|
|
138063
138556
|
list(params = {}) {
|
|
138064
138557
|
const searchParams = new URLSearchParams();
|
|
138065
|
-
appendAttributeListParams(searchParams, params);
|
|
138558
|
+
appendAttributeListParams("analytics.attributes.list", searchParams, params);
|
|
138066
138559
|
return makeRequest({
|
|
138067
138560
|
endpoint: `/v2/analytics/attributes${createQueryString(searchParams)}`,
|
|
138068
138561
|
config: config2,
|
|
@@ -138072,6 +138565,8 @@ function createAnalytics(config2) {
|
|
|
138072
138565
|
},
|
|
138073
138566
|
steps: {
|
|
138074
138567
|
get(runId, stepId) {
|
|
138568
|
+
assertRunId("analytics.steps.get", runId);
|
|
138569
|
+
assertStepId("analytics.steps.get", stepId);
|
|
138075
138570
|
return makeRequest({
|
|
138076
138571
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}`,
|
|
138077
138572
|
config: config2,
|
|
@@ -138079,8 +138574,9 @@ function createAnalytics(config2) {
|
|
|
138079
138574
|
});
|
|
138080
138575
|
},
|
|
138081
138576
|
list(params) {
|
|
138577
|
+
assertRunId("analytics.steps.list", params.runId);
|
|
138082
138578
|
const searchParams = new URLSearchParams();
|
|
138083
|
-
appendPagination(searchParams, params.pagination);
|
|
138579
|
+
appendPagination("analytics.steps.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
|
|
138084
138580
|
return makeRequest({
|
|
138085
138581
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/steps${createQueryString(searchParams)}`,
|
|
138086
138582
|
config: config2,
|
|
@@ -138090,6 +138586,8 @@ function createAnalytics(config2) {
|
|
|
138090
138586
|
},
|
|
138091
138587
|
events: {
|
|
138092
138588
|
get(runId, eventId) {
|
|
138589
|
+
assertRunId("analytics.events.get", runId);
|
|
138590
|
+
assertEventId("analytics.events.get", eventId);
|
|
138093
138591
|
return makeRequest({
|
|
138094
138592
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}`,
|
|
138095
138593
|
config: config2,
|
|
@@ -138097,33 +138595,47 @@ function createAnalytics(config2) {
|
|
|
138097
138595
|
});
|
|
138098
138596
|
},
|
|
138099
138597
|
getMany(runId, eventIds) {
|
|
138598
|
+
assertRunId("analytics.events.getMany", runId);
|
|
138100
138599
|
return makeRequest({
|
|
138101
138600
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/get-many`,
|
|
138102
138601
|
options: { method: "POST" },
|
|
138103
|
-
data: {
|
|
138602
|
+
data: {
|
|
138603
|
+
eventIds: normalizeEventIds("analytics.events.getMany", eventIds)
|
|
138604
|
+
},
|
|
138104
138605
|
config: config2,
|
|
138105
138606
|
schema: AnalyticsEventSchema.array()
|
|
138106
138607
|
});
|
|
138107
138608
|
},
|
|
138108
138609
|
list(params) {
|
|
138610
|
+
assertRunId("analytics.events.list", params.runId);
|
|
138109
138611
|
const searchParams = new URLSearchParams();
|
|
138110
138612
|
if (params.eventType) {
|
|
138111
138613
|
searchParams.set("eventType", params.eventType);
|
|
138112
138614
|
}
|
|
138113
|
-
if (params.correlationId) {
|
|
138615
|
+
if (params.correlationId !== void 0) {
|
|
138616
|
+
assertCorrelationId("analytics.events.list", params.correlationId);
|
|
138114
138617
|
searchParams.set("correlationId", params.correlationId);
|
|
138115
138618
|
}
|
|
138116
|
-
appendPagination(searchParams, params.pagination);
|
|
138619
|
+
appendPagination("analytics.events.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
|
|
138117
138620
|
return makeRequest({
|
|
138118
138621
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/events${createQueryString(searchParams)}`,
|
|
138119
138622
|
config: config2,
|
|
138120
138623
|
schema: PaginatedResponseSchema(AnalyticsEventSchema)
|
|
138121
138624
|
});
|
|
138122
138625
|
},
|
|
138626
|
+
/**
|
|
138627
|
+
* @deprecated Use `list({ runId, correlationId })`. Kept as its own
|
|
138628
|
+
* implementation rather than delegating: `list` treats
|
|
138629
|
+
* `correlationId` as optional and skips an empty one, where this
|
|
138630
|
+
* method requires it, so a delegation would turn an empty id into an
|
|
138631
|
+
* unfiltered listing of the run.
|
|
138632
|
+
*/
|
|
138123
138633
|
listByCorrelationId(params) {
|
|
138634
|
+
assertRunId("analytics.events.listByCorrelationId", params.runId);
|
|
138635
|
+
assertCorrelationId("analytics.events.listByCorrelationId", params.correlationId);
|
|
138124
138636
|
const searchParams = new URLSearchParams();
|
|
138125
138637
|
searchParams.set("correlationId", params.correlationId);
|
|
138126
|
-
appendPagination(searchParams, params.pagination);
|
|
138638
|
+
appendPagination("analytics.events.listByCorrelationId", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
|
|
138127
138639
|
return makeRequest({
|
|
138128
138640
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/events${createQueryString(searchParams)}`,
|
|
138129
138641
|
config: config2,
|
|
@@ -138133,8 +138645,10 @@ function createAnalytics(config2) {
|
|
|
138133
138645
|
},
|
|
138134
138646
|
hooks: {
|
|
138135
138647
|
get(hookId, params) {
|
|
138648
|
+
assertHookId("analytics.hooks.get", hookId);
|
|
138136
138649
|
const searchParams = new URLSearchParams();
|
|
138137
|
-
if (params == null ? void 0 : params.runId) {
|
|
138650
|
+
if ((params == null ? void 0 : params.runId) !== void 0) {
|
|
138651
|
+
assertRunId("analytics.hooks.get", params.runId);
|
|
138138
138652
|
searchParams.set("runId", params.runId);
|
|
138139
138653
|
}
|
|
138140
138654
|
return makeRequest({
|
|
@@ -138144,9 +138658,10 @@ function createAnalytics(config2) {
|
|
|
138144
138658
|
});
|
|
138145
138659
|
},
|
|
138146
138660
|
list(params) {
|
|
138661
|
+
assertRunId("analytics.hooks.list", params.runId);
|
|
138147
138662
|
const searchParams = new URLSearchParams();
|
|
138148
138663
|
searchParams.set("runId", params.runId);
|
|
138149
|
-
appendPagination(searchParams, params.pagination);
|
|
138664
|
+
appendPagination("analytics.hooks.list", searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
|
|
138150
138665
|
return makeRequest({
|
|
138151
138666
|
endpoint: `/v2/analytics/hooks${createQueryString(searchParams)}`,
|
|
138152
138667
|
config: config2,
|
|
@@ -138156,6 +138671,8 @@ function createAnalytics(config2) {
|
|
|
138156
138671
|
},
|
|
138157
138672
|
waits: {
|
|
138158
138673
|
get(runId, waitId) {
|
|
138674
|
+
assertRunId("analytics.waits.get", runId);
|
|
138675
|
+
assertWaitId("analytics.waits.get", waitId);
|
|
138159
138676
|
return makeRequest({
|
|
138160
138677
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/waits/${encodeURIComponent(waitId)}`,
|
|
138161
138678
|
config: config2,
|
|
@@ -138163,11 +138680,12 @@ function createAnalytics(config2) {
|
|
|
138163
138680
|
});
|
|
138164
138681
|
},
|
|
138165
138682
|
list(params) {
|
|
138683
|
+
assertRunId("analytics.waits.list", params.runId);
|
|
138166
138684
|
const searchParams = new URLSearchParams();
|
|
138167
138685
|
if (params.status) {
|
|
138168
138686
|
searchParams.set("status", params.status);
|
|
138169
138687
|
}
|
|
138170
|
-
appendPagination(searchParams, params.pagination);
|
|
138688
|
+
appendPagination("analytics.waits.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
|
|
138171
138689
|
return makeRequest({
|
|
138172
138690
|
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/waits${createQueryString(searchParams)}`,
|
|
138173
138691
|
config: config2,
|
|
@@ -138502,7 +139020,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
|
|
|
138502
139020
|
};
|
|
138503
139021
|
}
|
|
138504
139022
|
async function getDeadline() {
|
|
138505
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
139023
|
+
const { getDeadline: getDeadline2 } = await import("./index-dJuvq1GP.js").then((n) => n.i);
|
|
138506
139024
|
return getDeadline2();
|
|
138507
139025
|
}
|
|
138508
139026
|
const WORKFLOW_SERVER_SERVICE = {
|
|
@@ -143455,7 +143973,7 @@ const wsEventsChannelForInvocation = (runId, config2) => {
|
|
|
143455
143973
|
open() {
|
|
143456
143974
|
if (!runId || !isWsEventsTransportEnabled())
|
|
143457
143975
|
return;
|
|
143458
|
-
claim = import("./ws-transport-
|
|
143976
|
+
claim = import("./ws-transport-Dv7yY5un.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
|
|
143459
143977
|
},
|
|
143460
143978
|
/**
|
|
143461
143979
|
* Awaited, unlike the open: work scheduled after the handler returns is not
|
|
@@ -143661,17 +144179,30 @@ function createQueue$1(config2) {
|
|
|
143661
144179
|
const ResolveLatestDeploymentResponseSchema = object$1({
|
|
143662
144180
|
id: string$3()
|
|
143663
144181
|
});
|
|
144182
|
+
async function resolveDeploymentIdentityToken(config2) {
|
|
144183
|
+
if (config2 == null ? void 0 : config2.token)
|
|
144184
|
+
return config2.token;
|
|
144185
|
+
if (process.env.VERCEL === "1") {
|
|
144186
|
+
const oidcToken = await distExports.getVercelOidcToken().catch(() => null);
|
|
144187
|
+
if (oidcToken)
|
|
144188
|
+
return oidcToken;
|
|
144189
|
+
}
|
|
144190
|
+
return resolveVercelApiToken(config2);
|
|
144191
|
+
}
|
|
143664
144192
|
function createResolveLatestDeploymentId(config2) {
|
|
143665
144193
|
return async function resolveLatestDeploymentId() {
|
|
144194
|
+
var _a3;
|
|
143666
144195
|
const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
143667
144196
|
if (!currentDeploymentId) {
|
|
143668
144197
|
throw new Error(missingDeploymentIdMessage("Resolving the latest deployment for deploymentId: 'latest'"));
|
|
143669
144198
|
}
|
|
143670
|
-
const token = await
|
|
144199
|
+
const token = await resolveDeploymentIdentityToken(config2);
|
|
143671
144200
|
if (!token) {
|
|
143672
144201
|
throw new Error("Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available");
|
|
143673
144202
|
}
|
|
143674
|
-
const
|
|
144203
|
+
const teamId = (_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.teamId;
|
|
144204
|
+
const query = teamId ? `?${new URLSearchParams({ teamId })}` : "";
|
|
144205
|
+
const url2 = `https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(currentDeploymentId)}${query}`;
|
|
143675
144206
|
const response2 = await instrumentedFetch({
|
|
143676
144207
|
method: "GET",
|
|
143677
144208
|
url: url2,
|
|
@@ -143688,7 +144219,8 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
143688
144219
|
} catch {
|
|
143689
144220
|
body2 = "<unable to read response body>";
|
|
143690
144221
|
}
|
|
143691
|
-
|
|
144222
|
+
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." : "";
|
|
144223
|
+
return new Error(`Failed to resolve latest deployment for ${currentDeploymentId}: HTTP ${res.status} ${res.statusText}${body2 ? ` — ${body2}` : ""}${hint2}`);
|
|
143692
144224
|
}
|
|
143693
144225
|
});
|
|
143694
144226
|
const data = await response2.json();
|
|
@@ -143699,6 +144231,14 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
143699
144231
|
return result.data.id;
|
|
143700
144232
|
};
|
|
143701
144233
|
}
|
|
144234
|
+
class ReplayEventObserverError extends Error {
|
|
144235
|
+
constructor(error2) {
|
|
144236
|
+
super("Replay event observer failed", { cause: error2 });
|
|
144237
|
+
__publicField(this, "error");
|
|
144238
|
+
this.error = error2;
|
|
144239
|
+
this.name = "ReplayEventObserverError";
|
|
144240
|
+
}
|
|
144241
|
+
}
|
|
143702
144242
|
const EVENT_RETRY_ELIGIBILITY = {
|
|
143703
144243
|
// Creates: conditional create → 409 EntityConflictError if it already exists.
|
|
143704
144244
|
run_created: {
|
|
@@ -143826,6 +144366,8 @@ function collectErrorMarkers(err, depth = 0) {
|
|
|
143826
144366
|
return markers;
|
|
143827
144367
|
}
|
|
143828
144368
|
function isRetryableEventPostError(err) {
|
|
144369
|
+
if (err instanceof ReplayEventObserverError)
|
|
144370
|
+
return false;
|
|
143829
144371
|
if (EntityConflictError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
|
|
143830
144372
|
return false;
|
|
143831
144373
|
}
|
|
@@ -143913,6 +144455,8 @@ async function withEventPostRetry(fn2, eventType, options) {
|
|
|
143913
144455
|
}
|
|
143914
144456
|
}
|
|
143915
144457
|
const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
|
|
144458
|
+
class IncompleteFrameError extends Error {
|
|
144459
|
+
}
|
|
143916
144460
|
const CborObjectSchema = record(string$3(), unknown$1());
|
|
143917
144461
|
function encodeFrame(meta2, body2) {
|
|
143918
144462
|
const metaBytes = new Uint8Array(encode$1(meta2));
|
|
@@ -143933,7 +144477,14 @@ async function* decodeFrames(source) {
|
|
|
143933
144477
|
const parts = [buffer2];
|
|
143934
144478
|
let byteLength = buffer2.byteLength;
|
|
143935
144479
|
while (byteLength < needed) {
|
|
143936
|
-
|
|
144480
|
+
let chunk;
|
|
144481
|
+
try {
|
|
144482
|
+
chunk = await chunks.next();
|
|
144483
|
+
} catch (cause) {
|
|
144484
|
+
throw new IncompleteFrameError("decodeFrames: source stream failed", {
|
|
144485
|
+
cause
|
|
144486
|
+
});
|
|
144487
|
+
}
|
|
143937
144488
|
if (chunk.done)
|
|
143938
144489
|
return false;
|
|
143939
144490
|
if (chunk.value.byteLength === 0)
|
|
@@ -143961,16 +144512,16 @@ async function* decodeFrames(source) {
|
|
|
143961
144512
|
const metaLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
|
|
143962
144513
|
take(4);
|
|
143963
144514
|
if (!await refill(metaLen)) {
|
|
143964
|
-
throw new
|
|
144515
|
+
throw new IncompleteFrameError("decodeFrames: truncated meta block");
|
|
143965
144516
|
}
|
|
143966
144517
|
const meta2 = CborObjectSchema.parse(decode$1(take(metaLen)));
|
|
143967
144518
|
if (!await refill(4)) {
|
|
143968
|
-
throw new
|
|
144519
|
+
throw new IncompleteFrameError("decodeFrames: truncated body length");
|
|
143969
144520
|
}
|
|
143970
144521
|
const bodyLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
|
|
143971
144522
|
take(4);
|
|
143972
144523
|
if (bodyLen > 0 && !await refill(bodyLen)) {
|
|
143973
|
-
throw new
|
|
144524
|
+
throw new IncompleteFrameError("decodeFrames: truncated body bytes");
|
|
143974
144525
|
}
|
|
143975
144526
|
yield { meta: meta2, body: buffer2.slice(0, bodyLen) };
|
|
143976
144527
|
take(bodyLen);
|
|
@@ -144150,7 +144701,7 @@ async function getStep(runId, stepId, params, config2) {
|
|
|
144150
144701
|
}
|
|
144151
144702
|
async function fetchV4(url2, init2, config2, opName, attributes) {
|
|
144152
144703
|
const dispatcher2 = getEventsDispatcher(config2);
|
|
144153
|
-
|
|
144704
|
+
const response2 = await instrumentedFetch({
|
|
144154
144705
|
method: init2.method,
|
|
144155
144706
|
url: url2,
|
|
144156
144707
|
headers: init2.headers,
|
|
@@ -144162,11 +144713,44 @@ async function fetchV4(url2, init2, config2, opName, attributes) {
|
|
|
144162
144713
|
// service indefinitely, so without this every request routed onto it fails
|
|
144163
144714
|
// until the compute instance is recycled. See noteEventsTransportOutcome.
|
|
144164
144715
|
onTransportOutcome: (error2) => noteEventsTransportOutcome(dispatcher2, error2),
|
|
144716
|
+
deferTransportSuccessUntilBody: true,
|
|
144165
144717
|
timeoutMs: null,
|
|
144718
|
+
transportErrorCode: "STREAM_ERROR",
|
|
144166
144719
|
logLabel: opName,
|
|
144167
144720
|
// Read the body as bytes, not text: a CBOR error body (the fence 412
|
|
144168
144721
|
// carries event payloads back) does not survive a UTF-8 decode.
|
|
144169
|
-
buildError: async (
|
|
144722
|
+
buildError: async (response3) => errorFromV4Response(response3.status, headersToRecord(response3.headers), new Uint8Array(await response3.arrayBuffer()), opName, url2)
|
|
144723
|
+
});
|
|
144724
|
+
if (!response2.body) {
|
|
144725
|
+
noteEventsTransportOutcome(dispatcher2);
|
|
144726
|
+
return response2;
|
|
144727
|
+
}
|
|
144728
|
+
const reader = response2.body.getReader();
|
|
144729
|
+
const body2 = new ReadableStream({
|
|
144730
|
+
async pull(controller) {
|
|
144731
|
+
try {
|
|
144732
|
+
const chunk = await reader.read();
|
|
144733
|
+
if (chunk.done) {
|
|
144734
|
+
noteEventsTransportOutcome(dispatcher2);
|
|
144735
|
+
controller.close();
|
|
144736
|
+
} else {
|
|
144737
|
+
controller.enqueue(chunk.value);
|
|
144738
|
+
}
|
|
144739
|
+
} catch (cause) {
|
|
144740
|
+
noteEventsTransportOutcome(dispatcher2, cause);
|
|
144741
|
+
const transportCode = getTransientTransportCode(cause);
|
|
144742
|
+
controller.error(transportCode ? new StreamError(`v4 ${opName}: response stream transport failure (${transportCode})`, { cause, url: url2 }) : cause);
|
|
144743
|
+
}
|
|
144744
|
+
},
|
|
144745
|
+
cancel(reason) {
|
|
144746
|
+
noteEventsTransportOutcome(dispatcher2);
|
|
144747
|
+
return reader.cancel(reason);
|
|
144748
|
+
}
|
|
144749
|
+
});
|
|
144750
|
+
return new Response(body2, {
|
|
144751
|
+
status: response2.status,
|
|
144752
|
+
statusText: response2.statusText,
|
|
144753
|
+
headers: response2.headers
|
|
144170
144754
|
});
|
|
144171
144755
|
}
|
|
144172
144756
|
const EVENT_ID_HEADER = "x-wf-event-id";
|
|
@@ -144235,6 +144819,12 @@ const EventStreamEndSchema = object$1({
|
|
|
144235
144819
|
next: string$3().optional(),
|
|
144236
144820
|
hasMore: boolean$3()
|
|
144237
144821
|
});
|
|
144822
|
+
const EventStreamErrorSchema = object$1({
|
|
144823
|
+
_error: literal(1),
|
|
144824
|
+
code: string$3(),
|
|
144825
|
+
message: string$3().optional()
|
|
144826
|
+
});
|
|
144827
|
+
const PAYLOAD_MISSING_ERROR_CODE = "payload-missing";
|
|
144238
144828
|
const legacyStructuredErrorEventTypes = /* @__PURE__ */ new Set([
|
|
144239
144829
|
"run_failed",
|
|
144240
144830
|
"step_failed",
|
|
@@ -144476,17 +145066,37 @@ async function createWorkflowRunEventV4(input, config2) {
|
|
|
144476
145066
|
const response2 = await postWorkflowRunEventV4(input, "materialized", config2);
|
|
144477
145067
|
const contentType = response2.headers.get("content-type");
|
|
144478
145068
|
if (contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE)) {
|
|
144479
|
-
throw new
|
|
145069
|
+
throw new WorkflowWorldError("v4 createEvent: unexpected event page", {
|
|
145070
|
+
code: "SCHEMA_VALIDATION"
|
|
145071
|
+
});
|
|
144480
145072
|
}
|
|
144481
145073
|
return decodeCreateEventResponse(response2, input.eventType);
|
|
144482
145074
|
}
|
|
144483
145075
|
async function decodeCreateEventResponse(response2, eventType) {
|
|
144484
|
-
|
|
145076
|
+
let bodyBytes;
|
|
145077
|
+
try {
|
|
145078
|
+
bodyBytes = new Uint8Array(await response2.arrayBuffer());
|
|
145079
|
+
} catch (cause) {
|
|
145080
|
+
if (StreamError.is(cause))
|
|
145081
|
+
throw cause;
|
|
145082
|
+
throw new WorkflowWorldError("v4 createEvent: failed to read response body", { code: "TRANSPORT", cause });
|
|
145083
|
+
}
|
|
144485
145084
|
if (bodyBytes.byteLength === 0) {
|
|
144486
|
-
throw new
|
|
145085
|
+
throw new WorkflowWorldError("v4 createEvent: empty response body", {
|
|
145086
|
+
code: "PARSE_ERROR"
|
|
145087
|
+
});
|
|
144487
145088
|
}
|
|
144488
145089
|
const schema = CreateEventV4BodySchemas[eventType].refine(({ event }) => event.eventType === eventType || eventType === "hook_created" && event.eventType === "hook_conflict", { path: ["event", "eventType"] });
|
|
144489
|
-
|
|
145090
|
+
let decoded;
|
|
145091
|
+
try {
|
|
145092
|
+
decoded = decode$1(bodyBytes);
|
|
145093
|
+
} catch (cause) {
|
|
145094
|
+
throw new WorkflowWorldError("v4 createEvent: invalid CBOR response body", {
|
|
145095
|
+
code: "PARSE_ERROR",
|
|
145096
|
+
cause
|
|
145097
|
+
});
|
|
145098
|
+
}
|
|
145099
|
+
const parsedBody = schema.safeParse(decoded);
|
|
144490
145100
|
if (!parsedBody.success) {
|
|
144491
145101
|
throw new WorkflowWorldError("v4 createEvent: invalid response body", {
|
|
144492
145102
|
code: "SCHEMA_VALIDATION",
|
|
@@ -144495,11 +145105,12 @@ async function decodeCreateEventResponse(response2, eventType) {
|
|
|
144495
145105
|
}
|
|
144496
145106
|
return parsedBody.data;
|
|
144497
145107
|
}
|
|
144498
|
-
async function createWorkflowRunStartedEventV4(input, config2) {
|
|
145108
|
+
async function createWorkflowRunStartedEventV4(input, config2, replayEventObserver) {
|
|
144499
145109
|
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "run_started" }, "event-stream", config2);
|
|
144500
|
-
const
|
|
144501
|
-
|
|
144502
|
-
|
|
145110
|
+
const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
|
|
145111
|
+
if (!page.cursor) {
|
|
145112
|
+
throw new WorkflowWorldError("v4 createEvent: event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
145113
|
+
}
|
|
144503
145114
|
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
144504
145115
|
if (!maxEvents.success) {
|
|
144505
145116
|
throw new WorkflowWorldError("v4 createEvent: invalid max-events header", {
|
|
@@ -144507,7 +145118,7 @@ async function createWorkflowRunStartedEventV4(input, config2) {
|
|
|
144507
145118
|
cause: maxEvents.error
|
|
144508
145119
|
});
|
|
144509
145120
|
}
|
|
144510
|
-
return {
|
|
145121
|
+
return { ...page, maxEvents: maxEvents.data };
|
|
144511
145122
|
}
|
|
144512
145123
|
const BatchItemFailureSchema = object$1({
|
|
144513
145124
|
status: number$3().int(),
|
|
@@ -144577,7 +145188,7 @@ function wsReplyStatus(reply, endpoint) {
|
|
|
144577
145188
|
return status;
|
|
144578
145189
|
}
|
|
144579
145190
|
async function postEventFrameOverWs(input, config2) {
|
|
144580
|
-
const { resolveWsTransport } = await import("./ws-transport-
|
|
145191
|
+
const { resolveWsTransport } = await import("./ws-transport-Dv7yY5un.js");
|
|
144581
145192
|
const { runId } = input;
|
|
144582
145193
|
const resolved = resolveWsTransport(runId, config2);
|
|
144583
145194
|
if (!resolved)
|
|
@@ -144631,7 +145242,7 @@ async function postEventFrameOverWs(input, config2) {
|
|
|
144631
145242
|
};
|
|
144632
145243
|
});
|
|
144633
145244
|
}
|
|
144634
|
-
async function createHookReceivedPreloadEventV4(input, config2) {
|
|
145245
|
+
async function createHookReceivedPreloadEventV4(input, config2, replayEventObserver) {
|
|
144635
145246
|
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "hook_received" }, "event-stream", config2);
|
|
144636
145247
|
const contentType = response2.headers.get("content-type");
|
|
144637
145248
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
@@ -144640,12 +145251,10 @@ async function createHookReceivedPreloadEventV4(input, config2) {
|
|
|
144640
145251
|
result: await decodeCreateEventResponse(response2, "hook_received")
|
|
144641
145252
|
};
|
|
144642
145253
|
}
|
|
144643
|
-
const
|
|
144644
|
-
const page = await consumeEventFrameStream(response2, "createEvent", events2);
|
|
145254
|
+
const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
|
|
144645
145255
|
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
144646
145256
|
return {
|
|
144647
145257
|
kind: "stream",
|
|
144648
|
-
events: events2,
|
|
144649
145258
|
...page,
|
|
144650
145259
|
canonicalEventId: response2.headers.get(EVENT_ID_HEADER) ?? void 0,
|
|
144651
145260
|
maxEvents: maxEvents.success ? maxEvents.data : void 0
|
|
@@ -144668,32 +145277,128 @@ async function getEventV4(runId, eventId, remoteRefBehavior, config2) {
|
|
|
144668
145277
|
throw new Error(`v4 getEvent: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`);
|
|
144669
145278
|
}
|
|
144670
145279
|
const chunks = response2.body;
|
|
144671
|
-
|
|
144672
|
-
|
|
145280
|
+
try {
|
|
145281
|
+
for await (const frame2 of decodeFrames(chunks)) {
|
|
145282
|
+
if (frame2.meta._error === 1) {
|
|
145283
|
+
throw streamErrorFrameToError(frame2.meta, "getEvent");
|
|
145284
|
+
}
|
|
145285
|
+
if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
|
|
145286
|
+
throw new Error("v4 getEvent: unexpected control frame");
|
|
145287
|
+
}
|
|
145288
|
+
return decodeEventFrame(frame2);
|
|
145289
|
+
}
|
|
145290
|
+
} catch (cause) {
|
|
145291
|
+
if (cause instanceof IncompleteFrameError && StreamError.is(cause.cause)) {
|
|
145292
|
+
throw cause.cause;
|
|
145293
|
+
}
|
|
145294
|
+
throw cause;
|
|
144673
145295
|
}
|
|
144674
145296
|
throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
|
|
144675
145297
|
}
|
|
144676
|
-
|
|
145298
|
+
function streamErrorFrameToError(meta2, opName) {
|
|
145299
|
+
const parsed = EventStreamErrorSchema.safeParse(meta2);
|
|
145300
|
+
if (!parsed.success) {
|
|
145301
|
+
return new WorkflowWorldError(`v4 ${opName}: malformed terminal error frame`, { code: "SCHEMA_VALIDATION", cause: parsed.error });
|
|
145302
|
+
}
|
|
145303
|
+
const { code: code2, message: message2 } = parsed.data;
|
|
145304
|
+
const detail = message2 ?? "(no detail)";
|
|
145305
|
+
if (code2 === PAYLOAD_MISSING_ERROR_CODE) {
|
|
145306
|
+
return new CorruptedEventLogError(`the event log references a payload that no longer exists in storage: ${detail}`);
|
|
145307
|
+
}
|
|
145308
|
+
return new WorkflowWorldError(`v4 ${opName}: stream ended with terminal error "${code2}": ${detail}`, { code: "WORLD_CONTRACT_ERROR" });
|
|
145309
|
+
}
|
|
145310
|
+
const MAX_PARTIAL_STREAM_RETRIES = 2;
|
|
145311
|
+
function partialEventFrameStream(events2, error2) {
|
|
145312
|
+
var _a3;
|
|
145313
|
+
const eventId = (_a3 = events2.at(-1)) == null ? void 0 : _a3.eventId;
|
|
145314
|
+
if (!eventId)
|
|
145315
|
+
throw error2;
|
|
145316
|
+
return {
|
|
145317
|
+
kind: "partial",
|
|
145318
|
+
events: events2,
|
|
145319
|
+
cursor: `eid:${eventId}`,
|
|
145320
|
+
hasMore: true,
|
|
145321
|
+
error: error2
|
|
145322
|
+
};
|
|
145323
|
+
}
|
|
145324
|
+
async function consumeEventFrameStream(response2, opName, replayEventObserver) {
|
|
144677
145325
|
const contentType = response2.headers.get("content-type");
|
|
144678
145326
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
144679
|
-
throw new
|
|
145327
|
+
throw new WorkflowWorldError(`v4 ${opName}: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`, { code: "SCHEMA_VALIDATION" });
|
|
144680
145328
|
}
|
|
144681
|
-
|
|
144682
|
-
|
|
144683
|
-
|
|
144684
|
-
|
|
144685
|
-
|
|
145329
|
+
if (!response2.body) {
|
|
145330
|
+
throw new WorkflowWorldError(`v4 ${opName}: response body is missing`, {
|
|
145331
|
+
code: "TRANSPORT"
|
|
145332
|
+
});
|
|
145333
|
+
}
|
|
145334
|
+
const events2 = [];
|
|
145335
|
+
try {
|
|
145336
|
+
for await (const frame2 of decodeFrames(response2.body)) {
|
|
145337
|
+
if (frame2.meta._end === 1) {
|
|
145338
|
+
const end = EventStreamEndSchema.parse(frame2.meta);
|
|
145339
|
+
return {
|
|
145340
|
+
kind: "complete",
|
|
145341
|
+
events: events2,
|
|
145342
|
+
cursor: end.next ?? null,
|
|
145343
|
+
hasMore: end.hasMore
|
|
145344
|
+
};
|
|
145345
|
+
}
|
|
145346
|
+
if (frame2.meta._error === 1) {
|
|
145347
|
+
throw streamErrorFrameToError(frame2.meta, opName);
|
|
145348
|
+
}
|
|
145349
|
+
if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
|
|
145350
|
+
throw new Error(`v4 ${opName}: unexpected control frame`);
|
|
145351
|
+
}
|
|
145352
|
+
const event = decodeEventFrame(frame2);
|
|
145353
|
+
events2.push(event);
|
|
145354
|
+
try {
|
|
145355
|
+
replayEventObserver == null ? void 0 : replayEventObserver(event);
|
|
145356
|
+
} catch (error2) {
|
|
145357
|
+
throw new ReplayEventObserverError(error2);
|
|
145358
|
+
}
|
|
144686
145359
|
}
|
|
144687
|
-
|
|
144688
|
-
|
|
145360
|
+
} catch (cause) {
|
|
145361
|
+
if (cause instanceof ReplayEventObserverError || CorruptedEventLogError.is(cause) || WorkflowWorldError.is(cause)) {
|
|
145362
|
+
throw cause;
|
|
145363
|
+
}
|
|
145364
|
+
if (cause instanceof IncompleteFrameError && StreamError.is(cause.cause)) {
|
|
145365
|
+
return partialEventFrameStream(events2, cause.cause);
|
|
145366
|
+
}
|
|
145367
|
+
if (!(cause instanceof IncompleteFrameError)) {
|
|
145368
|
+
throw new WorkflowWorldError(`v4 ${opName}: invalid event frame stream`, {
|
|
145369
|
+
code: "SCHEMA_VALIDATION",
|
|
145370
|
+
cause
|
|
145371
|
+
});
|
|
144689
145372
|
}
|
|
144690
|
-
events2
|
|
145373
|
+
return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: incomplete event frame stream`, {
|
|
145374
|
+
code: "TRANSPORT",
|
|
145375
|
+
cause
|
|
145376
|
+
}));
|
|
144691
145377
|
}
|
|
144692
|
-
|
|
145378
|
+
return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read)`, { code: "TRANSPORT" }));
|
|
144693
145379
|
}
|
|
144694
|
-
async function
|
|
145380
|
+
async function consumeReplayLogResponse(response2, runId, config2, replayEventObserver) {
|
|
145381
|
+
const page = await consumeEventFrameStream(response2, "createEvent", replayEventObserver);
|
|
145382
|
+
if (!page.hasMore) {
|
|
145383
|
+
return {
|
|
145384
|
+
events: page.events,
|
|
145385
|
+
cursor: page.cursor,
|
|
145386
|
+
hasMore: false
|
|
145387
|
+
};
|
|
145388
|
+
}
|
|
145389
|
+
if (!page.cursor) {
|
|
145390
|
+
throw new WorkflowWorldError("v4 createEvent: partial event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
145391
|
+
}
|
|
145392
|
+
const suffix = await getWorkflowRunEventsV4(runId, { cursor: page.cursor, remoteRefBehavior: "resolve" }, config2, replayEventObserver);
|
|
145393
|
+
return {
|
|
145394
|
+
events: [...page.events, ...suffix.events],
|
|
145395
|
+
cursor: suffix.cursor ?? page.cursor,
|
|
145396
|
+
hasMore: suffix.hasMore
|
|
145397
|
+
};
|
|
145398
|
+
}
|
|
145399
|
+
async function consumeListFrameStream(url2, headers2, config2, opName, replayEventObserver) {
|
|
144695
145400
|
const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, opName);
|
|
144696
|
-
return consumeEventFrameStream(response2, opName,
|
|
145401
|
+
return consumeEventFrameStream(response2, opName, replayEventObserver);
|
|
144697
145402
|
}
|
|
144698
145403
|
function appendListParams(sp, params) {
|
|
144699
145404
|
if (params.cursor)
|
|
@@ -144713,23 +145418,34 @@ function paginationToQuery(params) {
|
|
|
144713
145418
|
appendListParams(sp, params);
|
|
144714
145419
|
return `?${sp.toString()}`;
|
|
144715
145420
|
}
|
|
144716
|
-
async function getWorkflowRunEventsV4(runId, params = {}, config2) {
|
|
145421
|
+
async function getWorkflowRunEventsV4(runId, params = {}, config2, replayEventObserver) {
|
|
144717
145422
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
144718
145423
|
const events2 = [];
|
|
144719
|
-
let cursor = params.cursor;
|
|
144720
|
-
|
|
144721
|
-
|
|
144722
|
-
|
|
144723
|
-
|
|
144724
|
-
|
|
144725
|
-
|
|
144726
|
-
|
|
144727
|
-
if (params.limit !== void 0 || !
|
|
144728
|
-
throw
|
|
144729
|
-
}
|
|
144730
|
-
|
|
144731
|
-
|
|
144732
|
-
|
|
145424
|
+
let cursor = params.cursor ?? null;
|
|
145425
|
+
let partialStreamRetries = 0;
|
|
145426
|
+
let consumed;
|
|
145427
|
+
do {
|
|
145428
|
+
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({ ...params, cursor: cursor ?? void 0 });
|
|
145429
|
+
consumed = await consumeListFrameStream(url2, headers2, config2, "listEvents", replayEventObserver);
|
|
145430
|
+
const cursorAdvanced = !!consumed.cursor && consumed.cursor !== cursor;
|
|
145431
|
+
if (consumed.kind === "partial") {
|
|
145432
|
+
if (params.limit !== void 0 || !cursorAdvanced || partialStreamRetries === MAX_PARTIAL_STREAM_RETRIES) {
|
|
145433
|
+
throw consumed.error;
|
|
145434
|
+
}
|
|
145435
|
+
partialStreamRetries++;
|
|
145436
|
+
cursor = consumed.cursor;
|
|
145437
|
+
} else if (!cursorAdvanced && (consumed.events.length > 0 || consumed.hasMore)) {
|
|
145438
|
+
throw new WorkflowWorldError("v4 listEvents: response did not advance cursor", { code: "SCHEMA_VALIDATION" });
|
|
145439
|
+
}
|
|
145440
|
+
for (const event of consumed.events) {
|
|
145441
|
+
events2.push(event);
|
|
145442
|
+
}
|
|
145443
|
+
} while (consumed.kind === "partial");
|
|
145444
|
+
return {
|
|
145445
|
+
events: events2,
|
|
145446
|
+
cursor: consumed.cursor || (partialStreamRetries > 0 ? cursor : null),
|
|
145447
|
+
hasMore: consumed.hasMore
|
|
145448
|
+
};
|
|
144733
145449
|
}
|
|
144734
145450
|
async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, config2) {
|
|
144735
145451
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
@@ -144738,9 +145454,14 @@ async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, con
|
|
|
144738
145454
|
sp.set("runId", runId);
|
|
144739
145455
|
appendListParams(sp, params);
|
|
144740
145456
|
const url2 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
144741
|
-
const
|
|
144742
|
-
|
|
144743
|
-
|
|
145457
|
+
const consumed = await consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId");
|
|
145458
|
+
if (consumed.kind === "partial")
|
|
145459
|
+
throw consumed.error;
|
|
145460
|
+
return {
|
|
145461
|
+
events: consumed.events,
|
|
145462
|
+
cursor: consumed.cursor,
|
|
145463
|
+
hasMore: consumed.hasMore
|
|
145464
|
+
};
|
|
144744
145465
|
}
|
|
144745
145466
|
const WorkflowRunWireBaseSchema = WorkflowRunBaseSchema.omit({
|
|
144746
145467
|
error: true,
|
|
@@ -145166,6 +145887,8 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
|
|
|
145166
145887
|
}
|
|
145167
145888
|
return result;
|
|
145168
145889
|
} catch (err) {
|
|
145890
|
+
if (err instanceof ReplayEventObserverError)
|
|
145891
|
+
throw err.error;
|
|
145169
145892
|
if (isHookEventRequiringExistence(data.eventType) && WorkflowWorldError.is(err) && err.status === 404 && data.correlationId) {
|
|
145170
145893
|
throw new HookNotFoundError(data.correlationId);
|
|
145171
145894
|
}
|
|
@@ -145237,39 +145960,14 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145237
145960
|
...meta2
|
|
145238
145961
|
};
|
|
145239
145962
|
if (data.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload)) {
|
|
145240
|
-
const result = await createWorkflowRunStartedEventV4(input, config2);
|
|
145241
|
-
const
|
|
145242
|
-
|
|
145243
|
-
|
|
145244
|
-
throw new Error("v4 createEvent: run_started stream is missing run_created");
|
|
145245
|
-
}
|
|
145246
|
-
if (!runStarted) {
|
|
145247
|
-
throw new Error("v4 createEvent: run_started stream is missing run_started");
|
|
145248
|
-
}
|
|
145249
|
-
let attributes = runCreated.eventData.attributes ?? {};
|
|
145250
|
-
let updatedAt = runStarted.createdAt;
|
|
145251
|
-
for (const event of result.events) {
|
|
145252
|
-
if (event.eventType === "attr_set") {
|
|
145253
|
-
attributes = applyAttributeChanges(attributes, event.eventData.changes);
|
|
145254
|
-
updatedAt = event.createdAt;
|
|
145255
|
-
}
|
|
145963
|
+
const result = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
|
|
145964
|
+
const replayRun = reconstructRunFromReplayEvents(result.events);
|
|
145965
|
+
if (!replayRun) {
|
|
145966
|
+
throw new WorkflowWorldError("v4 createEvent: run_started stream is missing lifecycle events", { code: "SCHEMA_VALIDATION" });
|
|
145256
145967
|
}
|
|
145257
145968
|
return {
|
|
145258
|
-
event:
|
|
145259
|
-
run:
|
|
145260
|
-
runId: runCreated.runId,
|
|
145261
|
-
status: "running",
|
|
145262
|
-
deploymentId: runCreated.eventData.deploymentId,
|
|
145263
|
-
workflowName: runCreated.eventData.workflowName,
|
|
145264
|
-
specVersion: runCreated.specVersion,
|
|
145265
|
-
executionContext: runCreated.eventData.executionContext,
|
|
145266
|
-
input: runCreated.eventData.input,
|
|
145267
|
-
attributes,
|
|
145268
|
-
encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
|
|
145269
|
-
startedAt: runStarted.createdAt,
|
|
145270
|
-
createdAt: runCreated.createdAt,
|
|
145271
|
-
updatedAt
|
|
145272
|
-
},
|
|
145969
|
+
event: replayRun.event,
|
|
145970
|
+
run: replayRun.run,
|
|
145273
145971
|
events: result.events,
|
|
145274
145972
|
cursor: result.cursor,
|
|
145275
145973
|
hasMore: result.hasMore,
|
|
@@ -145277,16 +145975,16 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145277
145975
|
};
|
|
145278
145976
|
}
|
|
145279
145977
|
if (data.eventType === "hook_received" && (params == null ? void 0 : params.preloadEvents) === true && params.resumeId !== void 0 && params.resumePayloadDigest !== void 0) {
|
|
145280
|
-
const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2);
|
|
145978
|
+
const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2, params.replayEventObserver);
|
|
145281
145979
|
if (outcome.kind === "materialized") {
|
|
145282
145980
|
return outcome.result;
|
|
145283
145981
|
}
|
|
145284
145982
|
const { canonicalEventId, maxEvents, events: events2, cursor, hasMore } = outcome;
|
|
145285
145983
|
const canonicalEvent = events2.find((event) => event.eventId === canonicalEventId);
|
|
145286
|
-
const
|
|
145984
|
+
const replayRun = reconstructRunFromReplayEvents(events2);
|
|
145287
145985
|
return {
|
|
145288
145986
|
...canonicalEvent ? { event: canonicalEvent } : {},
|
|
145289
|
-
...
|
|
145987
|
+
...replayRun ? { run: replayRun.run } : {},
|
|
145290
145988
|
events: events2,
|
|
145291
145989
|
cursor,
|
|
145292
145990
|
hasMore,
|
|
@@ -145298,9 +145996,8 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
145298
145996
|
function reconstructRunFromReplayEvents(events2) {
|
|
145299
145997
|
const runCreated = events2.find((event) => event.eventType === "run_created");
|
|
145300
145998
|
const runStarted = events2.find((event) => event.eventType === "run_started");
|
|
145301
|
-
if (!runCreated || !runStarted)
|
|
145302
|
-
return
|
|
145303
|
-
}
|
|
145999
|
+
if (!runCreated || !runStarted)
|
|
146000
|
+
return;
|
|
145304
146001
|
let attributes = runCreated.eventData.attributes ?? {};
|
|
145305
146002
|
let updatedAt = runStarted.createdAt;
|
|
145306
146003
|
for (const event of events2) {
|
|
@@ -145310,18 +146007,21 @@ function reconstructRunFromReplayEvents(events2) {
|
|
|
145310
146007
|
}
|
|
145311
146008
|
}
|
|
145312
146009
|
return {
|
|
145313
|
-
|
|
145314
|
-
|
|
145315
|
-
|
|
145316
|
-
|
|
145317
|
-
|
|
145318
|
-
|
|
145319
|
-
|
|
145320
|
-
|
|
145321
|
-
|
|
145322
|
-
|
|
145323
|
-
|
|
145324
|
-
|
|
146010
|
+
event: runStarted,
|
|
146011
|
+
run: {
|
|
146012
|
+
runId: runCreated.runId,
|
|
146013
|
+
status: "running",
|
|
146014
|
+
deploymentId: runCreated.eventData.deploymentId,
|
|
146015
|
+
workflowName: runCreated.eventData.workflowName,
|
|
146016
|
+
specVersion: runCreated.specVersion,
|
|
146017
|
+
executionContext: runCreated.eventData.executionContext,
|
|
146018
|
+
input: runCreated.eventData.input,
|
|
146019
|
+
attributes,
|
|
146020
|
+
encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
|
|
146021
|
+
startedAt: runStarted.createdAt,
|
|
146022
|
+
createdAt: runCreated.createdAt,
|
|
146023
|
+
updatedAt
|
|
146024
|
+
}
|
|
145325
146025
|
};
|
|
145326
146026
|
}
|
|
145327
146027
|
function filterHookData(hook, resolveData) {
|
|
@@ -145446,21 +146146,28 @@ function streamSpanAttributes(args) {
|
|
|
145446
146146
|
}
|
|
145447
146147
|
async function createStreamReadError(response2) {
|
|
145448
146148
|
const fallback = `Failed to fetch stream: ${response2.status}`;
|
|
145449
|
-
if (response2.status !== 410)
|
|
145450
|
-
return new
|
|
146149
|
+
if (response2.status !== 410) {
|
|
146150
|
+
return new StreamError(fallback, { status: response2.status });
|
|
146151
|
+
}
|
|
145451
146152
|
try {
|
|
145452
146153
|
const body2 = await response2.json();
|
|
145453
146154
|
return errorForResponse(response2.status, typeof body2.message === "string" ? body2.message : fallback, { code: body2.error, details: body2.details });
|
|
145454
146155
|
} catch {
|
|
145455
|
-
return new
|
|
146156
|
+
return new StreamError(fallback, { status: response2.status });
|
|
146157
|
+
}
|
|
146158
|
+
}
|
|
146159
|
+
function toStreamError(message2, cause) {
|
|
146160
|
+
if (WorkflowWorldError.is(cause) || EntityConflictError.is(cause) || RunExpiredError.is(cause) || StreamError.is(cause) || StreamExpiredError.is(cause) || TooEarlyError.is(cause) || ThrottleError.is(cause) || PreconditionFailedError.is(cause)) {
|
|
146161
|
+
return cause;
|
|
145456
146162
|
}
|
|
146163
|
+
return new StreamError(message2, { cause });
|
|
145457
146164
|
}
|
|
145458
146165
|
function createStreamRequestError(operation, url2, response2, text2) {
|
|
145459
146166
|
const context = [
|
|
145460
146167
|
`PUT ${url2.origin}${url2.pathname}`,
|
|
145461
146168
|
...getVercelDiagnostics(response2.headers)
|
|
145462
146169
|
];
|
|
145463
|
-
return new
|
|
146170
|
+
return new StreamError(`Stream ${operation} failed: HTTP ${response2.status} (${context.join("; ")}): ${text2}`, { url: url2.toString(), status: response2.status });
|
|
145464
146171
|
}
|
|
145465
146172
|
function encodeMultiChunks(chunks) {
|
|
145466
146173
|
const encoder2 = new TextEncoder();
|
|
@@ -145509,6 +146216,7 @@ function createStreamer(config2) {
|
|
|
145509
146216
|
headers: httpConfig.headers,
|
|
145510
146217
|
dispatcher: getStreamDispatcher(config2),
|
|
145511
146218
|
timeoutMs: null,
|
|
146219
|
+
transportErrorCode: "STREAM_ERROR",
|
|
145512
146220
|
logLabel: url2.pathname,
|
|
145513
146221
|
spanName: "workflow.stream.write",
|
|
145514
146222
|
durationAttribute: "workflow.stream.write.chunk_rtt",
|
|
@@ -145539,6 +146247,7 @@ function createStreamer(config2) {
|
|
|
145539
146247
|
headers: httpConfig.headers,
|
|
145540
146248
|
dispatcher: getStreamDispatcher(config2),
|
|
145541
146249
|
timeoutMs: null,
|
|
146250
|
+
transportErrorCode: "STREAM_ERROR",
|
|
145542
146251
|
logLabel: url2.pathname,
|
|
145543
146252
|
spanName: "workflow.stream.write",
|
|
145544
146253
|
durationAttribute: "workflow.stream.write.chunk_rtt",
|
|
@@ -145567,6 +146276,7 @@ function createStreamer(config2) {
|
|
|
145567
146276
|
// 503s with the stream left durably closing.
|
|
145568
146277
|
dispatcher: getStreamCloseDispatcher(config2),
|
|
145569
146278
|
timeoutMs: null,
|
|
146279
|
+
transportErrorCode: "STREAM_ERROR",
|
|
145570
146280
|
logLabel: url2.pathname,
|
|
145571
146281
|
spanName: "workflow.stream.write",
|
|
145572
146282
|
durationAttribute: "workflow.stream.write.chunk_rtt",
|
|
@@ -145592,6 +146302,7 @@ function createStreamer(config2) {
|
|
|
145592
146302
|
headers: httpConfig.headers,
|
|
145593
146303
|
dispatcher: void 0,
|
|
145594
146304
|
timeoutMs: null,
|
|
146305
|
+
transportErrorCode: "STREAM_ERROR",
|
|
145595
146306
|
logLabel: url2.pathname,
|
|
145596
146307
|
spanName: "workflow.stream.read.connect",
|
|
145597
146308
|
attributes: streamSpanAttributes({
|
|
@@ -145603,7 +146314,9 @@ function createStreamer(config2) {
|
|
|
145603
146314
|
buildError: createStreamReadError
|
|
145604
146315
|
});
|
|
145605
146316
|
if (!response2.body) {
|
|
145606
|
-
throw new
|
|
146317
|
+
throw new StreamError("No response body for stream", {
|
|
146318
|
+
url: url2.toString()
|
|
146319
|
+
});
|
|
145607
146320
|
}
|
|
145608
146321
|
return response2.body;
|
|
145609
146322
|
},
|
|
@@ -145617,19 +146330,27 @@ function createStreamer(config2) {
|
|
|
145617
146330
|
}
|
|
145618
146331
|
const qs = params.toString();
|
|
145619
146332
|
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/streams/${encodeURIComponent(name2)}/chunks${qs ? `?${qs}` : ""}`;
|
|
145620
|
-
|
|
145621
|
-
|
|
145622
|
-
|
|
145623
|
-
|
|
145624
|
-
|
|
146333
|
+
try {
|
|
146334
|
+
return await makeRequest({
|
|
146335
|
+
endpoint,
|
|
146336
|
+
config: config2,
|
|
146337
|
+
schema: StreamChunksResponseSchema
|
|
146338
|
+
});
|
|
146339
|
+
} catch (cause) {
|
|
146340
|
+
throw toStreamError(`Failed to read stream chunks for ${name2}`, cause);
|
|
146341
|
+
}
|
|
145625
146342
|
},
|
|
145626
146343
|
async getInfo(runId, name2) {
|
|
145627
146344
|
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/streams/${encodeURIComponent(name2)}/info`;
|
|
145628
|
-
|
|
145629
|
-
|
|
145630
|
-
|
|
145631
|
-
|
|
145632
|
-
|
|
146345
|
+
try {
|
|
146346
|
+
return await makeRequest({
|
|
146347
|
+
endpoint,
|
|
146348
|
+
config: config2,
|
|
146349
|
+
schema: StreamInfoResponseSchema
|
|
146350
|
+
});
|
|
146351
|
+
} catch (cause) {
|
|
146352
|
+
throw toStreamError(`Failed to read stream info for ${name2}`, cause);
|
|
146353
|
+
}
|
|
145633
146354
|
},
|
|
145634
146355
|
async list(runId) {
|
|
145635
146356
|
const httpConfig = await getHttpConfig(config2);
|
|
@@ -145640,10 +146361,18 @@ function createStreamer(config2) {
|
|
|
145640
146361
|
headers: httpConfig.headers,
|
|
145641
146362
|
dispatcher: void 0,
|
|
145642
146363
|
timeoutMs: null,
|
|
146364
|
+
transportErrorCode: "STREAM_ERROR",
|
|
145643
146365
|
logLabel: url2.pathname,
|
|
145644
|
-
buildError: (res) => new
|
|
146366
|
+
buildError: (res) => new StreamError(`Failed to list streams: ${res.status}`, {
|
|
146367
|
+
url: url2.toString(),
|
|
146368
|
+
status: res.status
|
|
146369
|
+
})
|
|
145645
146370
|
});
|
|
145646
|
-
|
|
146371
|
+
try {
|
|
146372
|
+
return await response2.json();
|
|
146373
|
+
} catch (cause) {
|
|
146374
|
+
throw toStreamError("Failed to parse stream list response", cause);
|
|
146375
|
+
}
|
|
145647
146376
|
}
|
|
145648
146377
|
}
|
|
145649
146378
|
};
|
|
@@ -145826,7 +146555,7 @@ globalSingleton("@workflow/core//devServerPort", 1, () => ({
|
|
|
145826
146555
|
inFlight: void 0
|
|
145827
146556
|
}));
|
|
145828
146557
|
function waitUntil(promise2) {
|
|
145829
|
-
void import("./index-
|
|
146558
|
+
void import("./index-dJuvq1GP.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
145830
146559
|
waitUntil2(promise2);
|
|
145831
146560
|
});
|
|
145832
146561
|
}
|
|
@@ -148510,12 +149239,13 @@ const CAPABILITY_VERSION_TABLE = [
|
|
|
148510
149239
|
// consumers that cannot unframe them (silent corruption); too-high merely
|
|
148511
149240
|
// delays the optimization (safe).
|
|
148512
149241
|
{ capability: "framedByteStreams", minVersion: "5.0.0-beta.15" }
|
|
148513
|
-
// NOTE:
|
|
148514
|
-
// the queue message's `hookInput`?") is intentionally
|
|
148515
|
-
// version-compare against a predicted release cutoff is a
|
|
148516
|
-
// run's creating deployment stamps an explicit
|
|
148517
|
-
// marker into its execution context, which the
|
|
148518
|
-
//
|
|
149242
|
+
// NOTE: the hook-resume consumer protocol ("does the consumer re-ensure
|
|
149243
|
+
// `hook_received` from the queue message's `hookInput`?") is intentionally
|
|
149244
|
+
// NOT gated here. A version-compare against a predicted release cutoff is a
|
|
149245
|
+
// guess; instead the run's creating deployment stamps an explicit
|
|
149246
|
+
// `hookResumeInputVersion` marker into its execution context, which the
|
|
149247
|
+
// server mirrors onto the hook's resumeContext. Older producers gate their
|
|
149248
|
+
// lazy path on that marker.
|
|
148519
149249
|
];
|
|
148520
149250
|
const BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
148521
149251
|
SerializationFormat$1.DEVALUE_V1
|
|
@@ -148545,7 +149275,6 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
148545
149275
|
return result;
|
|
148546
149276
|
}
|
|
148547
149277
|
const generateResumeId = monotonicFactory();
|
|
148548
|
-
const MAX_INLINE_RESUME_PAYLOAD_BYTES = 128 * 1024;
|
|
148549
149278
|
async function computeResumePayloadDigest(bytes) {
|
|
148550
149279
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
148551
149280
|
const view = new Uint8Array(digest);
|
|
@@ -148555,6 +149284,39 @@ async function computeResumePayloadDigest(bytes) {
|
|
|
148555
149284
|
}
|
|
148556
149285
|
return hex2;
|
|
148557
149286
|
}
|
|
149287
|
+
const HOOK_WAKE_RETRY_DELAYS_MS = [25, 100];
|
|
149288
|
+
function isRetryableWakeError(error2, isDeploymentUnavailableError) {
|
|
149289
|
+
if (isDeploymentUnavailableError == null ? void 0 : isDeploymentUnavailableError(error2))
|
|
149290
|
+
return false;
|
|
149291
|
+
const status = error2 ?? {};
|
|
149292
|
+
const code2 = status.status ?? status.statusCode;
|
|
149293
|
+
if (typeof code2 === "number") {
|
|
149294
|
+
return code2 >= 500 || code2 === 408 || code2 === 429;
|
|
149295
|
+
}
|
|
149296
|
+
const name2 = error2 == null ? void 0 : error2.name;
|
|
149297
|
+
return name2 !== "BadRequestError" && name2 !== "UnauthorizedError" && name2 !== "ForbiddenError";
|
|
149298
|
+
}
|
|
149299
|
+
async function publishHookWakeWithRetry(publish, isDeploymentUnavailableError) {
|
|
149300
|
+
let lastError;
|
|
149301
|
+
for (let attempt = 0; attempt <= HOOK_WAKE_RETRY_DELAYS_MS.length; attempt++) {
|
|
149302
|
+
try {
|
|
149303
|
+
await publish();
|
|
149304
|
+
return;
|
|
149305
|
+
} catch (error2) {
|
|
149306
|
+
lastError = error2;
|
|
149307
|
+
if (!isRetryableWakeError(error2, isDeploymentUnavailableError))
|
|
149308
|
+
break;
|
|
149309
|
+
const delayMs = HOOK_WAKE_RETRY_DELAYS_MS[attempt];
|
|
149310
|
+
if (delayMs !== void 0) {
|
|
149311
|
+
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
149312
|
+
}
|
|
149313
|
+
}
|
|
149314
|
+
}
|
|
149315
|
+
if (HookNotFoundError.is(lastError)) {
|
|
149316
|
+
throw new WorkflowRuntimeError("The hook resume was committed, but its workflow wake could not be published", { cause: lastError });
|
|
149317
|
+
}
|
|
149318
|
+
throw lastError;
|
|
149319
|
+
}
|
|
148558
149320
|
function resumeContextFromRun(run2) {
|
|
148559
149321
|
var _a3, _b2, _c2;
|
|
148560
149322
|
const coreVersion = (_a3 = run2.executionContext) == null ? void 0 : _a3.workflowCoreVersion;
|
|
@@ -148609,15 +149371,12 @@ async function getHookByToken(token) {
|
|
|
148609
149371
|
return hook;
|
|
148610
149372
|
}
|
|
148611
149373
|
async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
148612
|
-
return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now()
|
|
149374
|
+
return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now());
|
|
148613
149375
|
}
|
|
148614
|
-
async function
|
|
148615
|
-
return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now(), true);
|
|
148616
|
-
}
|
|
148617
|
-
async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, requireDurableWrite) {
|
|
149376
|
+
async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs) {
|
|
148618
149377
|
return await waitedUntil(() => {
|
|
148619
149378
|
return trace$2("hook.resume", async (span) => {
|
|
148620
|
-
var _a3, _b2, _c2;
|
|
149379
|
+
var _a3, _b2, _c2, _d2;
|
|
148621
149380
|
const world = await getWorldLazy();
|
|
148622
149381
|
try {
|
|
148623
149382
|
const suppliedToken = typeof tokenOrHook === "string";
|
|
@@ -148653,12 +149412,17 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
148653
149412
|
}
|
|
148654
149413
|
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat$1.GZIP);
|
|
148655
149414
|
const ops = [];
|
|
149415
|
+
const readbackOps = [];
|
|
148656
149416
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
148657
|
-
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
|
|
148658
|
-
|
|
149417
|
+
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression, void 0, readbackOps);
|
|
149418
|
+
await Promise.all(ops.map((op) => op.catch((error2) => {
|
|
149419
|
+
if (error2 !== void 0)
|
|
149420
|
+
throw error2;
|
|
149421
|
+
})));
|
|
149422
|
+
safeWaitUntil(Promise.all(readbackOps), (err) => {
|
|
148659
149423
|
if (err === void 0)
|
|
148660
149424
|
return;
|
|
148661
|
-
runtimeLogger.warn("Background
|
|
149425
|
+
runtimeLogger.warn("Background readback of hook payload failed", {
|
|
148662
149426
|
workflowRunId: hook.runId,
|
|
148663
149427
|
hookId: hook.hookId,
|
|
148664
149428
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -148676,74 +149440,57 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
148676
149440
|
deploymentId: resumeContext.deploymentId,
|
|
148677
149441
|
specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
|
|
148678
149442
|
};
|
|
148679
|
-
const lazyResumeDisabled = process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME === "1";
|
|
148680
149443
|
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;
|
|
148681
|
-
const
|
|
148682
|
-
// An internal caller needs the event committed before this
|
|
148683
|
-
// resolves (an ordering barrier), which only the eager write
|
|
148684
|
-
// provides. Checked first so the span names the real reason
|
|
148685
|
-
// rather than whichever gate happens to fail alongside it.
|
|
148686
|
-
"durable_required"
|
|
148687
|
-
) : lazyResumeDisabled ? "disabled" : !backendDedupSupported ? "backend_unsupported" : (resumeContext.hookResumeInputVersion ?? 0) < HOOK_RESUME_INPUT_VERSION ? "consumer_unsupported" : v1Compat ? "legacy" : (resumeContext.runSpecVersion ?? 0) < SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT ? "non_cbor_transport" : !(dehydratedPayload instanceof Uint8Array) ? "non_bytes" : dehydratedPayload.byteLength > MAX_INLINE_RESUME_PAYLOAD_BYTES ? "oversized" : null;
|
|
148688
|
-
const useLazyResume = fallbackReason === null;
|
|
149444
|
+
const canClaimResume = backendDedupSupported && !v1Compat && dehydratedPayload instanceof Uint8Array;
|
|
148689
149445
|
span == null ? void 0 : span.setAttributes({
|
|
148690
|
-
"workflow.hook.resume_strategy":
|
|
148691
|
-
...fallbackReason ? { "workflow.hook.resume_fallback_reason": fallbackReason } : {}
|
|
149446
|
+
"workflow.hook.resume_strategy": "sequential"
|
|
148692
149447
|
});
|
|
148693
|
-
|
|
148694
|
-
|
|
148695
|
-
|
|
148696
|
-
|
|
148697
|
-
|
|
148698
|
-
|
|
148699
|
-
|
|
148700
|
-
|
|
148701
|
-
|
|
148702
|
-
|
|
148703
|
-
|
|
148704
|
-
|
|
148705
|
-
|
|
148706
|
-
|
|
148707
|
-
throw new HookNotFoundError(hook.token);
|
|
149448
|
+
const resumeId = canClaimResume ? generateResumeId() : void 0;
|
|
149449
|
+
const payloadDigest = canClaimResume ? await computeResumePayloadDigest(dehydratedPayload) : void 0;
|
|
149450
|
+
if (resumeId) {
|
|
149451
|
+
span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
|
|
149452
|
+
}
|
|
149453
|
+
const isHookGoneError = (err) => HookNotFoundError.is(err) || RunExpiredError.is(err);
|
|
149454
|
+
try {
|
|
149455
|
+
await world.events.create(hook.runId, {
|
|
149456
|
+
eventType: "hook_received",
|
|
149457
|
+
specVersion: SPEC_VERSION_CURRENT,
|
|
149458
|
+
correlationId: hook.hookId,
|
|
149459
|
+
eventData: {
|
|
149460
|
+
...v1Compat ? {} : { token: hook.token },
|
|
149461
|
+
payload: dehydratedPayload
|
|
148708
149462
|
}
|
|
148709
|
-
|
|
149463
|
+
}, {
|
|
149464
|
+
v1Compat,
|
|
149465
|
+
...resumeId && payloadDigest ? { resumeId, resumePayloadDigest: payloadDigest } : {}
|
|
149466
|
+
});
|
|
149467
|
+
} catch (err) {
|
|
149468
|
+
if (isHookGoneError(err)) {
|
|
149469
|
+
throw new HookNotFoundError(hook.token);
|
|
148710
149470
|
}
|
|
148711
|
-
|
|
148712
|
-
await world.queue(queueName, {
|
|
148713
|
-
runId: hook.runId,
|
|
148714
|
-
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
148715
|
-
hookResumeTiming: {
|
|
148716
|
-
resumeRequestedAtMs,
|
|
148717
|
-
queuePublishRequestedAtMs: queuePublishRequestedAtMs2,
|
|
148718
|
-
strategy: "sequential"
|
|
148719
|
-
}
|
|
148720
|
-
}, queueOptions);
|
|
148721
|
-
return hook;
|
|
149471
|
+
throw err;
|
|
148722
149472
|
}
|
|
148723
|
-
|
|
148724
|
-
const payloadDigest = await computeResumePayloadDigest(dehydratedPayload);
|
|
148725
|
-
span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
|
|
149473
|
+
span == null ? void 0 : span.setAttributes(HookResumeCommitted(true));
|
|
148726
149474
|
const queuePublishRequestedAtMs = Date.now();
|
|
148727
|
-
await world.queue(queueName, {
|
|
149475
|
+
await publishHookWakeWithRetry(() => world.queue(queueName, {
|
|
148728
149476
|
runId: hook.runId,
|
|
148729
149477
|
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
148730
|
-
hookInput: {
|
|
148731
|
-
resumeId,
|
|
148732
|
-
hookId: hook.hookId,
|
|
148733
|
-
token: hook.token,
|
|
148734
|
-
payload: dehydratedPayload,
|
|
148735
|
-
payloadDigest,
|
|
148736
|
-
// Deployment affinity for the consumer's cheap pre-write
|
|
148737
|
-
// check: lets a misrouted delivery re-route before its
|
|
148738
|
-
// hoisted hook_received write instead of after.
|
|
148739
|
-
deploymentId: resumeContext.deploymentId
|
|
148740
|
-
},
|
|
148741
149478
|
hookResumeTiming: {
|
|
148742
149479
|
resumeRequestedAtMs,
|
|
148743
149480
|
queuePublishRequestedAtMs,
|
|
148744
|
-
strategy: "
|
|
149481
|
+
strategy: "sequential"
|
|
148745
149482
|
}
|
|
148746
|
-
},
|
|
149483
|
+
}, {
|
|
149484
|
+
...queueOptions,
|
|
149485
|
+
// Dedup retried publishes whose response was lost: a
|
|
149486
|
+
// duplicate wake is harmless for correctness (deterministic
|
|
149487
|
+
// replay) but costs a full replay of the run, and the queue
|
|
149488
|
+
// accepts a repeated idempotency key by delivering only one
|
|
149489
|
+
// of the messages. Claim-less writes have no resumeId and
|
|
149490
|
+
// keep the previous behavior.
|
|
149491
|
+
...resumeId ? { idempotencyKey: `hook-${resumeId}` } : {}
|
|
149492
|
+
}), (_d2 = world.isDeploymentUnavailableError) == null ? void 0 : _d2.bind(world));
|
|
149493
|
+
span == null ? void 0 : span.setAttributes(HookWakePublished(true));
|
|
148747
149494
|
return hook;
|
|
148748
149495
|
} catch (err) {
|
|
148749
149496
|
span == null ? void 0 : span.setAttributes({
|
|
@@ -148776,7 +149523,7 @@ async function resumeWebhook(token, request2) {
|
|
|
148776
149523
|
} else {
|
|
148777
149524
|
response2 = new Response(null, { status: 202 });
|
|
148778
149525
|
}
|
|
148779
|
-
await resumeHookImpl(hook, request2, encryptionKey, true, resumeRequestedAtMs
|
|
149526
|
+
await resumeHookImpl(hook, request2, encryptionKey, true, resumeRequestedAtMs);
|
|
148780
149527
|
if (responseReadable) {
|
|
148781
149528
|
const reader = responseReadable.getReader();
|
|
148782
149529
|
const chunk = await reader.read();
|
|
@@ -148796,7 +149543,6 @@ const resumeHook$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
148796
149543
|
__proto__: null,
|
|
148797
149544
|
getHookByToken,
|
|
148798
149545
|
resumeHook: resumeHook$2,
|
|
148799
|
-
resumeHookDurable,
|
|
148800
149546
|
resumeWebhook
|
|
148801
149547
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
148802
149548
|
function normalizeAttributeChanges(attrs, options = {}) {
|
|
@@ -148952,9 +149698,9 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
148952
149698
|
features: { encryption: !!encryptionKey },
|
|
148953
149699
|
// Attest that the *consumer* deployment's runtime re-ensures a
|
|
148954
149700
|
// `hook_received` event from a queue message's `hookInput` on replay.
|
|
148955
|
-
//
|
|
148956
|
-
// resumeContext by the server) to decide whether
|
|
148957
|
-
// path is safe. For a cross-deployment start the consumer is the
|
|
149701
|
+
// An OLDER producer resuming this run reads the marker (mirrored onto
|
|
149702
|
+
// the hook's resumeContext by the server) to decide whether its lazy
|
|
149703
|
+
// fast path is safe. For a cross-deployment start the consumer is the
|
|
148958
149704
|
// target deployment, so we stamp the *target's* value carried back on
|
|
148959
149705
|
// the health-check probe, never the caller's. Omitted when we could
|
|
148960
149706
|
// not attest the target (older target, timeout, or no probe channel),
|
|
@@ -149388,10 +150134,7 @@ const _Run = class _Run {
|
|
|
149388
150134
|
const { ops = [], global: global2 = globalThis, startIndex, namespace: namespace2 } = options;
|
|
149389
150135
|
const name2 = getWorkflowRunStreamId(this.runId, namespace2);
|
|
149390
150136
|
const encryptionKey = __privateMethod(this, _Run_instances, getEncryptionKeyLazily_fn).call(this);
|
|
149391
|
-
const stream =
|
|
149392
|
-
name: name2,
|
|
149393
|
-
startIndex
|
|
149394
|
-
});
|
|
150137
|
+
const stream = getRunReadableStream(global2, ops, this.runId, name2, startIndex, encryptionKey);
|
|
149395
150138
|
const worldPromise = __privateGet(this, _Run_instances, lazyWorldPromise_get);
|
|
149396
150139
|
const runId = this.runId;
|
|
149397
150140
|
return Object.assign(stream, {
|
|
@@ -149431,9 +150174,9 @@ getEncryptionKey_fn = function(run2) {
|
|
|
149431
150174
|
return __privateGet(this, _encryptionKeyPromise);
|
|
149432
150175
|
};
|
|
149433
150176
|
/**
|
|
149434
|
-
*
|
|
149435
|
-
*
|
|
149436
|
-
*
|
|
150177
|
+
* Defers fetching the run and its encryption key until a readable is first
|
|
150178
|
+
* consumed. The first pull prefetches it so an encrypted first frame can join
|
|
150179
|
+
* the lookup; this also applies to an empty consumed stream.
|
|
149437
150180
|
* @internal
|
|
149438
150181
|
*/
|
|
149439
150182
|
getEncryptionKeyLazily_fn = function() {
|
|
@@ -150006,36 +150749,6 @@ async function fetchRun(worldEnv, runId, resolveData = "all") {
|
|
|
150006
150749
|
});
|
|
150007
150750
|
}
|
|
150008
150751
|
}
|
|
150009
|
-
async function fetchSteps(worldEnv, runId, params) {
|
|
150010
|
-
const { cursor, sortOrder = "asc", limit = 100 } = params;
|
|
150011
|
-
try {
|
|
150012
|
-
const world = await getWorldFromEnv(worldEnv);
|
|
150013
|
-
const result = world.analytics ? await world.analytics.steps.list({
|
|
150014
|
-
runId,
|
|
150015
|
-
pagination: { cursor, limit, sortOrder }
|
|
150016
|
-
}) : await world.steps.list({
|
|
150017
|
-
runId,
|
|
150018
|
-
pagination: { cursor, limit, sortOrder },
|
|
150019
|
-
resolveData: "none"
|
|
150020
|
-
});
|
|
150021
|
-
return createResponse({
|
|
150022
|
-
// StepWithoutData has undefined input/output, but after hydration the structure is compatible
|
|
150023
|
-
data: result.data,
|
|
150024
|
-
cursor: result.cursor ?? void 0,
|
|
150025
|
-
hasMore: result.hasMore,
|
|
150026
|
-
pageInfo: getPageInfo(result)
|
|
150027
|
-
});
|
|
150028
|
-
} catch (error2) {
|
|
150029
|
-
return createServerActionError(
|
|
150030
|
-
error2,
|
|
150031
|
-
"world.steps.list",
|
|
150032
|
-
{
|
|
150033
|
-
runId,
|
|
150034
|
-
...params
|
|
150035
|
-
}
|
|
150036
|
-
);
|
|
150037
|
-
}
|
|
150038
|
-
}
|
|
150039
150752
|
async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
|
|
150040
150753
|
try {
|
|
150041
150754
|
const world = await getWorldFromEnv(worldEnv);
|
|
@@ -150049,39 +150762,10 @@ async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
|
|
|
150049
150762
|
});
|
|
150050
150763
|
}
|
|
150051
150764
|
}
|
|
150052
|
-
function analyticsEventToEvent(event) {
|
|
150053
|
-
const eventData = {
|
|
150054
|
-
...event.stepName ? { stepName: event.stepName } : {},
|
|
150055
|
-
...event.resumeAt ? { resumeAt: event.resumeAt } : {},
|
|
150056
|
-
...event.retryAfter ? { retryAfter: event.retryAfter } : {}
|
|
150057
|
-
};
|
|
150058
|
-
const base = {
|
|
150059
|
-
runId: event.runId,
|
|
150060
|
-
eventId: event.eventId,
|
|
150061
|
-
eventType: event.eventType,
|
|
150062
|
-
createdAt: event.createdAt,
|
|
150063
|
-
...event.correlationId ? { correlationId: event.correlationId } : {},
|
|
150064
|
-
...event.specVersion !== void 0 ? { specVersion: event.specVersion } : {},
|
|
150065
|
-
...Object.keys(eventData).length > 0 ? { eventData } : {}
|
|
150066
|
-
};
|
|
150067
|
-
return base;
|
|
150068
|
-
}
|
|
150069
150765
|
async function fetchEvents(worldEnv, runId, params) {
|
|
150070
150766
|
const { cursor, sortOrder = "asc", limit = 1e3, withData = false } = params;
|
|
150071
150767
|
try {
|
|
150072
150768
|
const world = await getWorldFromEnv(worldEnv);
|
|
150073
|
-
if (world.analytics && !withData) {
|
|
150074
|
-
const result2 = await world.analytics.events.list({
|
|
150075
|
-
runId,
|
|
150076
|
-
pagination: { cursor, limit, sortOrder }
|
|
150077
|
-
});
|
|
150078
|
-
return createResponse({
|
|
150079
|
-
data: result2.data.map(analyticsEventToEvent),
|
|
150080
|
-
cursor: result2.cursor ?? void 0,
|
|
150081
|
-
hasMore: result2.hasMore,
|
|
150082
|
-
pageInfo: getPageInfo(result2)
|
|
150083
|
-
});
|
|
150084
|
-
}
|
|
150085
150769
|
const result = await world.events.list({
|
|
150086
150770
|
runId,
|
|
150087
150771
|
pagination: { cursor, limit, sortOrder },
|
|
@@ -150127,19 +150811,6 @@ async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
|
|
|
150127
150811
|
} = params;
|
|
150128
150812
|
try {
|
|
150129
150813
|
const world = await getWorldFromEnv(worldEnv);
|
|
150130
|
-
if (world.analytics && !withData) {
|
|
150131
|
-
const result2 = await world.analytics.events.listByCorrelationId({
|
|
150132
|
-
correlationId,
|
|
150133
|
-
runId,
|
|
150134
|
-
pagination: { cursor, limit, sortOrder }
|
|
150135
|
-
});
|
|
150136
|
-
return createResponse({
|
|
150137
|
-
data: result2.data.map(analyticsEventToEvent),
|
|
150138
|
-
cursor: result2.cursor ?? void 0,
|
|
150139
|
-
hasMore: result2.hasMore,
|
|
150140
|
-
pageInfo: getPageInfo(result2)
|
|
150141
|
-
});
|
|
150142
|
-
}
|
|
150143
150814
|
const result = await world.events.listByCorrelationId({
|
|
150144
150815
|
correlationId,
|
|
150145
150816
|
runId,
|
|
@@ -171630,7 +172301,7 @@ function BreadcrumbSeparator({
|
|
|
171630
172301
|
}
|
|
171631
172302
|
const INITIAL_PAGE_SIZE = 100;
|
|
171632
172303
|
const LOAD_MORE_PAGE_SIZE = 100;
|
|
171633
|
-
const MAX_CORRELATION_SEARCH_PAGES =
|
|
172304
|
+
const MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
171634
172305
|
function useEventsListData(env2, runId, options = {}) {
|
|
171635
172306
|
const { sortOrder = "asc", encryptionKey, enabled = true } = options;
|
|
171636
172307
|
const [events2, setEvents] = reactExports.useState([]);
|
|
@@ -172568,7 +173239,6 @@ const route2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
172568
173239
|
const handlers = {
|
|
172569
173240
|
fetchRuns: (p2) => fetchRuns(p2.worldEnv ?? {}, p2.params ?? {}),
|
|
172570
173241
|
fetchRun: (p2) => fetchRun(p2.worldEnv ?? {}, p2.runId, p2.resolveData),
|
|
172571
|
-
fetchSteps: (p2) => fetchSteps(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
|
|
172572
173242
|
fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
|
|
172573
173243
|
fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
|
|
172574
173244
|
fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
|
|
@@ -172722,7 +173392,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
172722
173392
|
__proto__: null,
|
|
172723
173393
|
loader
|
|
172724
173394
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
172725
|
-
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-
|
|
173395
|
+
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-qx_45_fH.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/loader-circle-BX6ycuOI.js", "/assets/arrow-up-right-CSovqivK.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-BbyW_T74.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-C-1D0sAn.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/loader-circle-BX6ycuOI.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-BoGFG1Fe.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-C-1D0sAn.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/arrow-up-right-CSovqivK.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-34c486ef.js", "version": "34c486ef", "sri": void 0 };
|
|
172726
173396
|
const assetsBuildDirectory = "build/client";
|
|
172727
173397
|
const basename = "/";
|
|
172728
173398
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -172931,143 +173601,150 @@ function createFetchHandler(basename2 = "/") {
|
|
|
172931
173601
|
return (request2) => handler(request2, loadContext);
|
|
172932
173602
|
}
|
|
172933
173603
|
export {
|
|
172934
|
-
|
|
173604
|
+
SPEC_VERSION_CURRENT as $,
|
|
172935
173605
|
ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
|
|
172936
173606
|
BULK_CANCEL_MAX_RUN_IDS as B,
|
|
172937
173607
|
CHILD_ENTITY_CREATION_EVENT_TYPES as C,
|
|
172938
173608
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
|
|
172939
173609
|
EVENT_ID_BODY_LENGTH as E,
|
|
172940
173610
|
FIRST_EVENT_SLOT as F,
|
|
172941
|
-
|
|
173611
|
+
HOOK_LIFECYCLE_EVENT_TYPES as G,
|
|
172942
173612
|
HookSchema as H,
|
|
172943
|
-
|
|
172944
|
-
|
|
172945
|
-
|
|
172946
|
-
|
|
172947
|
-
|
|
173613
|
+
HOOK_RESUME_DEDUP_VERSION as I,
|
|
173614
|
+
HOOK_RESUME_INPUT_VERSION as J,
|
|
173615
|
+
HealthCheckPayloadSchema as K,
|
|
173616
|
+
HookCreatedEventSchema as L,
|
|
173617
|
+
HookResumeCapabilitiesSchema as M,
|
|
172948
173618
|
Nt as N,
|
|
172949
|
-
|
|
172950
|
-
|
|
172951
|
-
|
|
172952
|
-
|
|
172953
|
-
|
|
172954
|
-
|
|
172955
|
-
|
|
172956
|
-
|
|
172957
|
-
|
|
172958
|
-
|
|
172959
|
-
|
|
172960
|
-
|
|
172961
|
-
|
|
172962
|
-
|
|
172963
|
-
|
|
172964
|
-
|
|
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
|
-
|
|
173029
|
-
|
|
173030
|
-
|
|
173031
|
-
|
|
173032
|
-
|
|
173033
|
-
|
|
173034
|
-
|
|
173035
|
-
|
|
173036
|
-
|
|
173037
|
-
|
|
173038
|
-
|
|
173039
|
-
|
|
173040
|
-
|
|
173041
|
-
|
|
173042
|
-
|
|
173043
|
-
|
|
173044
|
-
|
|
173045
|
-
|
|
173046
|
-
|
|
173047
|
-
|
|
173048
|
-
|
|
173049
|
-
|
|
173050
|
-
|
|
173051
|
-
|
|
173052
|
-
|
|
173053
|
-
|
|
173054
|
-
|
|
173055
|
-
|
|
173056
|
-
|
|
173057
|
-
|
|
173058
|
-
|
|
173059
|
-
|
|
173060
|
-
|
|
173061
|
-
|
|
173062
|
-
|
|
173063
|
-
|
|
173064
|
-
|
|
173065
|
-
|
|
173066
|
-
|
|
173067
|
-
|
|
173068
|
-
|
|
173069
|
-
|
|
173070
|
-
|
|
173071
|
-
|
|
173072
|
-
|
|
173619
|
+
LegacySerializedDataSchemaV1 as O,
|
|
173620
|
+
MessageId as P,
|
|
173621
|
+
NODE_HTTP_DEFAULT as Q,
|
|
173622
|
+
NODE_HTTP_ENV_VAR as R,
|
|
173623
|
+
PARENT_RUN_ID_ATTRIBUTE as S,
|
|
173624
|
+
PaginatedResponseSchema as T,
|
|
173625
|
+
QueuePayloadSchema as U,
|
|
173626
|
+
QueuePrefix as V,
|
|
173627
|
+
RESERVED_ATTRIBUTE_KEY_PREFIX as W,
|
|
173628
|
+
ROOT_RUN_ID_ATTRIBUTE as X,
|
|
173629
|
+
RUN_ENTITY_KEY as Y,
|
|
173630
|
+
RunInputSchema as Z,
|
|
173631
|
+
SEALED_LOG_ENV_VAR as _,
|
|
173632
|
+
ANALYTICS_MAX_ATTRIBUTE_FILTERS as a,
|
|
173633
|
+
workflowRunIdSchema as a$,
|
|
173634
|
+
SPEC_VERSION_LEGACY as a0,
|
|
173635
|
+
SPEC_VERSION_MAX_SUPPORTED as a1,
|
|
173636
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as a2,
|
|
173637
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a3,
|
|
173638
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION as a4,
|
|
173639
|
+
SPEC_VERSION_SUPPORTS_SEALED_LOG as a5,
|
|
173640
|
+
SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a6,
|
|
173641
|
+
STEP_EVENT_TYPES as a7,
|
|
173642
|
+
SerializedDataSchema as a8,
|
|
173643
|
+
StepSchema as a9,
|
|
173644
|
+
getMaxEventsPerRun as aA,
|
|
173645
|
+
getQueueTopicPrefix as aB,
|
|
173646
|
+
isChildEntityCreationEvent as aC,
|
|
173647
|
+
isChildEntityCreationEventType as aD,
|
|
173648
|
+
isHookEventRequiringExistence as aE,
|
|
173649
|
+
isHookLifecycleEventType as aF,
|
|
173650
|
+
isLegacySpecVersion as aG,
|
|
173651
|
+
isNodeHttpEnabled as aH,
|
|
173652
|
+
isSealedNoopEvent$1 as aI,
|
|
173653
|
+
isSlotBody as aJ,
|
|
173654
|
+
isSlotEventId as aK,
|
|
173655
|
+
isStepEventType as aL,
|
|
173656
|
+
isTerminalRunEventType as aM,
|
|
173657
|
+
isTerminalStepEventType as aN,
|
|
173658
|
+
isTerminalStepStatus as aO,
|
|
173659
|
+
isTerminalWorkflowRunStatus as aP,
|
|
173660
|
+
isWaitEventType as aQ,
|
|
173661
|
+
mintedSpecVersion as aR,
|
|
173662
|
+
parseQueueName as aS,
|
|
173663
|
+
reenqueueActiveRuns as aT,
|
|
173664
|
+
requiresNewerWorld as aU,
|
|
173665
|
+
resolveQueueNamespace as aV,
|
|
173666
|
+
slotToEventId as aW,
|
|
173667
|
+
stripEventDataRefs as aX,
|
|
173668
|
+
ulidToDate as aY,
|
|
173669
|
+
validateAttributeChanges as aZ,
|
|
173670
|
+
validateUlidTimestamp as a_,
|
|
173671
|
+
StepStatusSchema as aa,
|
|
173672
|
+
StructuredErrorSchema as ab,
|
|
173673
|
+
TERMINAL_EVENT_CLASSES as ac,
|
|
173674
|
+
TERMINAL_RUN_EVENT_TYPES as ad,
|
|
173675
|
+
TERMINAL_STEP_EVENT_TYPES as ae,
|
|
173676
|
+
TERMINAL_STEP_STATUSES as af,
|
|
173677
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as ag,
|
|
173678
|
+
TerminalRunEventTypeSchema as ah,
|
|
173679
|
+
TerminalStepStatusSchema as ai,
|
|
173680
|
+
TerminalWorkflowRunStatusSchema as aj,
|
|
173681
|
+
ValidQueueName as ak,
|
|
173682
|
+
WAIT_EVENT_TYPES as al,
|
|
173683
|
+
WaitSchema as am,
|
|
173684
|
+
WaitStatusSchema as an,
|
|
173685
|
+
WorkflowInvokePayloadSchema as ao,
|
|
173686
|
+
WorkflowRunBaseSchema as ap,
|
|
173687
|
+
WorkflowRunSchema as aq,
|
|
173688
|
+
WorkflowRunStatusSchema as ar,
|
|
173689
|
+
applyAttributeChanges as as,
|
|
173690
|
+
classifyEntityEvent as at,
|
|
173691
|
+
entityEventClass as au,
|
|
173692
|
+
envFlag as av,
|
|
173693
|
+
envNumber as aw,
|
|
173694
|
+
eventIdToSlot as ax,
|
|
173695
|
+
getEventDataPayloadField as ay,
|
|
173696
|
+
getEventDataRefFields as az,
|
|
173697
|
+
ANALYTICS_PAGE_LIMIT as b,
|
|
173698
|
+
reactExports as b0,
|
|
173699
|
+
R as b1,
|
|
173700
|
+
Ks as b2,
|
|
173701
|
+
jsxRuntimeExports as b3,
|
|
173702
|
+
Qe as b4,
|
|
173703
|
+
registerZstdDecoder as b5,
|
|
173704
|
+
isWsEventsTransportEnabled as b6,
|
|
173705
|
+
debugLog as b7,
|
|
173706
|
+
getHttpUrl as b8,
|
|
173707
|
+
globalSingleton as b9,
|
|
173708
|
+
version as ba,
|
|
173709
|
+
getHttpConfig as bb,
|
|
173710
|
+
headersToRecord as bc,
|
|
173711
|
+
getRequestTimeoutMs as bd,
|
|
173712
|
+
injectTraceContextIntoHeaders as be,
|
|
173713
|
+
withHttpClientSpan as bf,
|
|
173714
|
+
ErrorType as bg,
|
|
173715
|
+
WorkflowWsReconnectAttempt as bh,
|
|
173716
|
+
NetworkProtocolName as bi,
|
|
173717
|
+
WorkflowEventsTransport as bj,
|
|
173718
|
+
distExports as bk,
|
|
173719
|
+
decodeFrames as bl,
|
|
173720
|
+
getDefaultExportFromCjs as bm,
|
|
173721
|
+
requireTokenUtil as bn,
|
|
173722
|
+
requireTokenError as bo,
|
|
173723
|
+
getAugmentedNamespace as bp,
|
|
173724
|
+
app as bq,
|
|
173725
|
+
createFetchHandler as br,
|
|
173726
|
+
ANALYTICS_RUN_SCOPED_PAGE_LIMIT as c,
|
|
173727
|
+
ATTRIBUTE_KEY_MAX_LENGTH as d,
|
|
173728
|
+
ATTRIBUTE_MAX_PER_RUN as e,
|
|
173729
|
+
ATTRIBUTE_VALUE_MAX_BYTES as f,
|
|
173730
|
+
AnalyticsAttributeKeySchema as g,
|
|
173731
|
+
AnalyticsEventSchema as h,
|
|
173732
|
+
AnalyticsHookSchema as i,
|
|
173733
|
+
AnalyticsRunSchema as j,
|
|
173734
|
+
AnalyticsStepSchema as k,
|
|
173735
|
+
AnalyticsWaitSchema as l,
|
|
173736
|
+
AttributeChangeSchema as m,
|
|
173737
|
+
AttributeChangesSchema as n,
|
|
173738
|
+
AttributeKeySchema as o,
|
|
173739
|
+
AttributeValidationError as p,
|
|
173740
|
+
AttributeValueSchema as q,
|
|
173741
|
+
BaseEventSchema as r,
|
|
173742
|
+
BulkCancelWorkflowRunResultSchema as s,
|
|
173743
|
+
BulkCancelWorkflowRunsRequestSchema as t,
|
|
173744
|
+
BulkCancelWorkflowRunsResultSchema as u,
|
|
173745
|
+
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as v,
|
|
173746
|
+
EVENT_ID_PREFIX as w,
|
|
173747
|
+
EventSchema as x,
|
|
173748
|
+
EventTypeSchema as y,
|
|
173749
|
+
HOOK_EVENTS_REQUIRING_EXISTENCE as z
|
|
173073
173750
|
};
|