@workflow/web 5.0.0-beta.40 → 5.0.0-beta.42
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/app-9JVnf-IU.css +1 -0
- package/build/client/assets/{arrow-up-right-Br49goey.js → arrow-up-right-D39pnGsD.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-B5pbFkUr.js → highlighted-body-B3W2YXNL-Dc1dLaUr.js} +1 -1
- package/build/client/assets/{home-DrXIdsG5.js → home-C6CuMqQu.js} +3 -3
- package/build/client/assets/{loader-circle-3PJSFf84.js → loader-circle-BOxaTUjK.js} +1 -1
- package/build/client/assets/{manifest-0c933230.js → manifest-cf88886b.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-qqUSEahK.js → mermaid-3ZIDBTTL-gEw-Ch1C.js} +319 -285
- package/build/client/assets/{root-n7Zz0dTX.js → root-BfhMCbkz.js} +3 -3
- package/build/client/assets/root-Bl5xphvU.css +1 -0
- package/build/client/assets/{run-detail-DHeMEsdg.js → run-detail-DKz7lp2q.js} +221 -105
- package/build/client/assets/{workflow-graph-viewer-DWdsfF3d.js → workflow-graph-viewer-CxrWityD.js} +3 -145
- package/build/client/assets/{zstd-browser-decoder-DemK2pIP.js → zstd-browser-decoder-CAEVa0bm.js} +1 -1
- package/build/server/assets/{app-BJXoDV4n.js → app-SrggQnfh.js} +1802 -1095
- package/build/server/assets/{highlighted-body-B3W2YXNL-Kki0lKyo.js → highlighted-body-B3W2YXNL-DMhwZQgG.js} +2 -1
- package/build/server/assets/{index-7-uV1dU1.js → index-ByPjQpgH.js} +1 -1
- package/build/server/assets/index-DsnQrgwB.js +156 -0
- package/build/server/assets/{mermaid-3ZIDBTTL-Bh_zbSQ-.js → mermaid-3ZIDBTTL-CK9fLYE8.js} +2 -1
- package/build/server/assets/{token-D8pb4TJ8.js → token-sFDUVNm0.js} +1 -1
- package/build/server/assets/{token-util-DPJj3x0B.js → token-util-CighjZkT.js} +1 -1
- package/build/server/assets/{wrapper-CsxTXsPR.js → websocket-server-BADWB2u5.js} +14 -53
- package/build/server/assets/wrapper-Bwi-W3ol.js +67 -0
- package/build/server/assets/ws-transport-DaZsgQ2B.js +531 -0
- package/build/server/assets/{zstd-browser-decoder-CWJVPmcb.js → zstd-browser-decoder-dRi0VqoM.js} +2 -1
- package/build/server/index.js +4 -3
- package/package.json +7 -7
- package/build/client/assets/app-BkGXg64e.css +0 -1
- package/build/client/assets/root-ZRjqDhEN.css +0 -1
- package/build/server/assets/index-XksKPyou.js +0 -143
|
@@ -61,6 +61,7 @@ import require$$0$9 from "constants";
|
|
|
61
61
|
import require$$5$2 from "assert";
|
|
62
62
|
import require$$2$4 from "os";
|
|
63
63
|
import * as net from "net";
|
|
64
|
+
import assert$1 from "node:assert/strict";
|
|
64
65
|
import express from "express";
|
|
65
66
|
function _mergeNamespaces(n, m2) {
|
|
66
67
|
for (var i = 0; i < m2.length; i++) {
|
|
@@ -43215,33 +43216,6 @@ const Lr = /* @__PURE__ */ K$3(() => {
|
|
|
43215
43216
|
function kn$1(t, e, n) {
|
|
43216
43217
|
return e !== "normal" && !(e != null && e.endsWith("px")) && n(`${t} was not resolved to pixel value correctly`, e, Ct$1.WARN), e === "normal" ? 0 : parseInt(e != null ? e : "0", 10);
|
|
43217
43218
|
}
|
|
43218
|
-
const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
|
|
43219
|
-
const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
43220
|
-
const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
43221
|
-
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
43222
|
-
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
43223
|
-
const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
|
|
43224
|
-
function matchPrefixedId(pattern2, prefix, kind, query) {
|
|
43225
|
-
const match2 = query.match(pattern2);
|
|
43226
|
-
if (!match2) {
|
|
43227
|
-
return null;
|
|
43228
|
-
}
|
|
43229
|
-
return { kind, id: `${prefix}_${match2[1].toUpperCase()}` };
|
|
43230
|
-
}
|
|
43231
|
-
function parseExactWorkflowSearchId(query) {
|
|
43232
|
-
const trimmed = query.trim();
|
|
43233
|
-
if (!trimmed) {
|
|
43234
|
-
return null;
|
|
43235
|
-
}
|
|
43236
|
-
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);
|
|
43237
|
-
}
|
|
43238
|
-
function looksLikeWorkflowIdSearchInput(query) {
|
|
43239
|
-
const trimmed = query.trim();
|
|
43240
|
-
if (!WORKFLOW_ID_PREFIX_PATTERN.test(trimmed)) {
|
|
43241
|
-
return false;
|
|
43242
|
-
}
|
|
43243
|
-
return /\d/.test(trimmed);
|
|
43244
|
-
}
|
|
43245
43219
|
const NEVER = Object.freeze({
|
|
43246
43220
|
status: "aborted"
|
|
43247
43221
|
});
|
|
@@ -57050,6 +57024,21 @@ const TERMINAL_STEP_EVENT_TYPES = TerminalStepEventTypeSchema.options;
|
|
|
57050
57024
|
function isTerminalStepEventType(eventType) {
|
|
57051
57025
|
return TERMINAL_STEP_EVENT_TYPES.includes(eventType);
|
|
57052
57026
|
}
|
|
57027
|
+
const ENTITY_EVENT_CLASS_BY_TYPE = {
|
|
57028
|
+
step_created: "step_created",
|
|
57029
|
+
step_started: "step_started",
|
|
57030
|
+
step_retrying: "step_retrying",
|
|
57031
|
+
step_completed: "step_terminal",
|
|
57032
|
+
step_failed: "step_terminal",
|
|
57033
|
+
wait_created: "wait_created",
|
|
57034
|
+
wait_completed: "wait_completed",
|
|
57035
|
+
hook_created: "hook_created",
|
|
57036
|
+
hook_disposed: "hook_disposed",
|
|
57037
|
+
run_started: "run_started"
|
|
57038
|
+
};
|
|
57039
|
+
function entityEventClass(eventType) {
|
|
57040
|
+
return ENTITY_EVENT_CLASS_BY_TYPE[eventType];
|
|
57041
|
+
}
|
|
57053
57042
|
const HookLifecycleEventTypeSchema = EventTypeSchema.extract([
|
|
57054
57043
|
"hook_created",
|
|
57055
57044
|
"hook_received",
|
|
@@ -57777,6 +57766,7 @@ const AnalyticsAttributeKeySchema = object$1({
|
|
|
57777
57766
|
firstSeenAt: date$2(),
|
|
57778
57767
|
lastSeenAt: date$2()
|
|
57779
57768
|
});
|
|
57769
|
+
const ANALYTICS_EVENTS_GET_MANY_LIMIT = 100;
|
|
57780
57770
|
const warnedEnvValues = /* @__PURE__ */ new Set();
|
|
57781
57771
|
function warnOnce(key, message2) {
|
|
57782
57772
|
if (warnedEnvValues.has(key))
|
|
@@ -57804,6 +57794,11 @@ function envNumber(name2, fallback, options = {}) {
|
|
|
57804
57794
|
}
|
|
57805
57795
|
return parsed;
|
|
57806
57796
|
}
|
|
57797
|
+
const DEFAULT_MAX_EVENTS_PER_RUN = 25e3;
|
|
57798
|
+
function getMaxEventsPerRun() {
|
|
57799
|
+
const maxEvents = envNumber("WORKFLOW_MAX_EVENTS", DEFAULT_MAX_EVENTS_PER_RUN, { integer: true });
|
|
57800
|
+
return maxEvents > 0 ? maxEvents : DEFAULT_MAX_EVENTS_PER_RUN;
|
|
57801
|
+
}
|
|
57807
57802
|
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/, "Must match __wkf_workflow_ or __{namespace}_wkf_workflow_");
|
|
57808
57803
|
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
57809
57804
|
const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
|
|
@@ -57864,6 +57859,19 @@ const RunInputSchema = object$1({
|
|
|
57864
57859
|
*/
|
|
57865
57860
|
environment: string$3().optional()
|
|
57866
57861
|
});
|
|
57862
|
+
const StepDispatchInputSchema = object$1({
|
|
57863
|
+
/**
|
|
57864
|
+
* The serialized step input, reused verbatim from the direct write. Always
|
|
57865
|
+
* binary: producers only attach `stepInput` when the dehydrated input is a
|
|
57866
|
+
* `Uint8Array` and the run's queue transport preserves bytes (CBOR).
|
|
57867
|
+
* Validated here so a malformed or transport-mangled payload fails the
|
|
57868
|
+
* message parse instead of being silently written into a `step_created` as
|
|
57869
|
+
* non-binary data. `Buffer` is a `Uint8Array` subclass and passes.
|
|
57870
|
+
*/
|
|
57871
|
+
input: custom((value) => value instanceof Uint8Array, {
|
|
57872
|
+
message: "stepInput.input must be a Uint8Array"
|
|
57873
|
+
})
|
|
57874
|
+
});
|
|
57867
57875
|
const HookResumeInputSchema = object$1({
|
|
57868
57876
|
/** Stable idempotency key minted once per `resumeHook()` call. */
|
|
57869
57877
|
resumeId: string$3(),
|
|
@@ -57885,7 +57893,33 @@ const HookResumeInputSchema = object$1({
|
|
|
57885
57893
|
* `(runId, resumeId)` constraint — required because the v4 payload ref is not
|
|
57886
57894
|
* content-stable server-side.
|
|
57887
57895
|
*/
|
|
57888
|
-
payloadDigest: string$3()
|
|
57896
|
+
payloadDigest: string$3(),
|
|
57897
|
+
/**
|
|
57898
|
+
* The deployment the run is pinned to, from the producer's resume context.
|
|
57899
|
+
* Lets the consumer detect a misrouted delivery with a cheap ambient
|
|
57900
|
+
* deployment-id comparison BEFORE its hoisted `hook_received` replay-preload
|
|
57901
|
+
* write — only a detected mismatch pays for the authoritative run fetch and
|
|
57902
|
+
* the deployment-affinity guard. Optional for queued-message compatibility:
|
|
57903
|
+
* messages from older producers omit it and simply skip the pre-write
|
|
57904
|
+
* check (the authoritative guard before replay still protects them).
|
|
57905
|
+
*/
|
|
57906
|
+
deploymentId: string$3().optional()
|
|
57907
|
+
});
|
|
57908
|
+
const HookResumeTimingSchema = object$1({
|
|
57909
|
+
/** Epoch ms at entry into `resumeHook()` — the start of the TTR window. */
|
|
57910
|
+
resumeRequestedAtMs: number$3(),
|
|
57911
|
+
/** Epoch ms immediately before the queue publish was requested. */
|
|
57912
|
+
queuePublishRequestedAtMs: number$3(),
|
|
57913
|
+
/** Which `resumeHook()` dispatch path ran: `parallel` or `sequential`. */
|
|
57914
|
+
strategy: string$3().optional(),
|
|
57915
|
+
/** Epoch ms the final consumer's queue handler was entered. */
|
|
57916
|
+
consumerStartedAtMs: number$3().optional(),
|
|
57917
|
+
/** Epoch ms this invocation's first replay pass began. */
|
|
57918
|
+
replayStartedAtMs: number$3().optional(),
|
|
57919
|
+
/** Epoch ms replay first encountered a durable step after the resume. */
|
|
57920
|
+
nextStepEncounteredAtMs: number$3().optional(),
|
|
57921
|
+
/** How the consumer initialized replay state: see `ResumeSetupSource`. */
|
|
57922
|
+
setupSource: string$3().optional()
|
|
57889
57923
|
});
|
|
57890
57924
|
const WorkflowInvokePayloadSchema = object$1({
|
|
57891
57925
|
runId: string$3(),
|
|
@@ -57920,7 +57954,28 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
57920
57954
|
* fast path. A consumer that understands this field idempotently ensures the
|
|
57921
57955
|
* `hook_received` event exists (keyed by `resumeId`) before replaying.
|
|
57922
57956
|
*/
|
|
57923
|
-
hookInput: HookResumeInputSchema.optional()
|
|
57957
|
+
hookInput: HookResumeInputSchema.optional(),
|
|
57958
|
+
/**
|
|
57959
|
+
* Resilient step dispatch data, only present alongside `stepId` when the
|
|
57960
|
+
* producer parallelized the `step_created` write with this queue publish. A
|
|
57961
|
+
* consumer that understands this field idempotently ensures the
|
|
57962
|
+
* `step_created` event exists (keyed by `stepId`) before executing the step.
|
|
57963
|
+
*/
|
|
57964
|
+
stepInput: StepDispatchInputSchema.optional(),
|
|
57965
|
+
/**
|
|
57966
|
+
* Hook-resume TTR timing. Present on both `resumeHook()` dispatch paths
|
|
57967
|
+
* (unlike `hookInput`, which only rides the parallel fast path), and
|
|
57968
|
+
* forwarded onto a dispatched step message when the resuming invocation
|
|
57969
|
+
* hands the next durable step to another invocation. Purely observational —
|
|
57970
|
+
* see {@link HookResumeTimingSchema}.
|
|
57971
|
+
*
|
|
57972
|
+
* `.catch(undefined)` because this field must never be able to fail the
|
|
57973
|
+
* parse of the invocation payload: a malformed value (a NaN boundary, a
|
|
57974
|
+
* shape change from a future producer) would otherwise throw on every
|
|
57975
|
+
* delivery of that message and burn the run's delivery budget over a
|
|
57976
|
+
* telemetry field. Anything unparseable degrades to "no measurement".
|
|
57977
|
+
*/
|
|
57978
|
+
hookResumeTiming: HookResumeTimingSchema.optional().catch(void 0)
|
|
57924
57979
|
});
|
|
57925
57980
|
const HealthCheckPayloadSchema = object$1({
|
|
57926
57981
|
__healthCheck: literal(true),
|
|
@@ -58060,18 +58115,58 @@ const StructuredErrorSchema = object$1({
|
|
|
58060
58115
|
code: string$3().optional()
|
|
58061
58116
|
// Populated with RunErrorCode values (USER_ERROR, RUNTIME_ERROR, etc.) for run_failed events
|
|
58062
58117
|
});
|
|
58118
|
+
const EVENT_ID_BODY_LENGTH = 26;
|
|
58119
|
+
const SLOT_LEADING_ZEROS = 10;
|
|
58120
|
+
const FIRST_EVENT_SLOT = 1;
|
|
58121
|
+
const EVENT_ID_PREFIX = "evnt_";
|
|
58122
|
+
function isSlotBody(body2) {
|
|
58123
|
+
if (body2.length !== EVENT_ID_BODY_LENGTH)
|
|
58124
|
+
return false;
|
|
58125
|
+
for (let i = 0; i < SLOT_LEADING_ZEROS; i++) {
|
|
58126
|
+
if (body2[i] !== "0")
|
|
58127
|
+
return false;
|
|
58128
|
+
}
|
|
58129
|
+
for (let i = SLOT_LEADING_ZEROS; i < EVENT_ID_BODY_LENGTH; i++) {
|
|
58130
|
+
const code2 = body2.charCodeAt(i);
|
|
58131
|
+
if (code2 < 48 || code2 > 57)
|
|
58132
|
+
return false;
|
|
58133
|
+
}
|
|
58134
|
+
return true;
|
|
58135
|
+
}
|
|
58136
|
+
function stripEventIdPrefix(eventId) {
|
|
58137
|
+
const underscore = eventId.indexOf("_");
|
|
58138
|
+
return underscore === -1 ? eventId : eventId.slice(underscore + 1);
|
|
58139
|
+
}
|
|
58140
|
+
function isSlotEventId(eventId) {
|
|
58141
|
+
return isSlotBody(stripEventIdPrefix(eventId));
|
|
58142
|
+
}
|
|
58143
|
+
function slotToEventId(slot) {
|
|
58144
|
+
if (!Number.isSafeInteger(slot) || slot < FIRST_EVENT_SLOT) {
|
|
58145
|
+
throw new RangeError(`Invalid event slot: ${slot}`);
|
|
58146
|
+
}
|
|
58147
|
+
return `${EVENT_ID_PREFIX}${String(slot).padStart(EVENT_ID_BODY_LENGTH, "0")}`;
|
|
58148
|
+
}
|
|
58149
|
+
function eventIdToSlot(eventId) {
|
|
58150
|
+
const body2 = stripEventIdPrefix(eventId);
|
|
58151
|
+
if (!isSlotBody(body2))
|
|
58152
|
+
return null;
|
|
58153
|
+
const slot = Number(body2);
|
|
58154
|
+
return Number.isSafeInteger(slot) && slot >= FIRST_EVENT_SLOT ? slot : null;
|
|
58155
|
+
}
|
|
58063
58156
|
const SPEC_VERSION_LEGACY = 1;
|
|
58064
58157
|
const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
58065
58158
|
const SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
58066
58159
|
const SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
|
|
58067
|
-
const
|
|
58160
|
+
const SPEC_VERSION_SUPPORTS_SLOT_IDENTITY = 6;
|
|
58161
|
+
const SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_SLOT_IDENTITY;
|
|
58162
|
+
const SPEC_VERSION_MAX_SUPPORTED = SPEC_VERSION_SUPPORTS_SLOT_IDENTITY;
|
|
58068
58163
|
function isLegacySpecVersion(v2) {
|
|
58069
58164
|
return v2 === void 0 || v2 === null || v2 <= SPEC_VERSION_LEGACY;
|
|
58070
58165
|
}
|
|
58071
58166
|
function requiresNewerWorld(v2) {
|
|
58072
58167
|
if (v2 === void 0 || v2 === null)
|
|
58073
58168
|
return false;
|
|
58074
|
-
return v2 >
|
|
58169
|
+
return v2 > SPEC_VERSION_MAX_SUPPORTED;
|
|
58075
58170
|
}
|
|
58076
58171
|
const ENCODING$1 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
58077
58172
|
const ENCODING_LEN = 32;
|
|
@@ -58227,6 +58322,9 @@ const workflowRunIdSchema = templateLiteral(["wrun_", ulid$4()]);
|
|
|
58227
58322
|
const DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS = 24 * 60 * 60 * 1e3;
|
|
58228
58323
|
const DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS = 5 * 60 * 1e3;
|
|
58229
58324
|
function ulidToDate(maybeUlid) {
|
|
58325
|
+
if (isSlotBody(maybeUlid)) {
|
|
58326
|
+
return null;
|
|
58327
|
+
}
|
|
58230
58328
|
const ulid2 = UlidSchema.safeParse(maybeUlid);
|
|
58231
58329
|
if (!ulid2.success) {
|
|
58232
58330
|
return null;
|
|
@@ -58254,6 +58352,101 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
|
|
|
58254
58352
|
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
58255
58353
|
return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
|
|
58256
58354
|
}
|
|
58355
|
+
const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58356
|
+
"step_terminal",
|
|
58357
|
+
"wait_completed",
|
|
58358
|
+
"hook_disposed"
|
|
58359
|
+
]);
|
|
58360
|
+
const SINGLETON_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
58361
|
+
"run_started"
|
|
58362
|
+
]);
|
|
58363
|
+
const RUN_ENTITY_KEY = "";
|
|
58364
|
+
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.";
|
|
58365
|
+
function compareEventId(a2, b2) {
|
|
58366
|
+
if (a2.eventId.length !== b2.eventId.length) {
|
|
58367
|
+
return a2.eventId.length - b2.eventId.length;
|
|
58368
|
+
}
|
|
58369
|
+
return a2.eventId < b2.eventId ? -1 : a2.eventId > b2.eventId ? 1 : 0;
|
|
58370
|
+
}
|
|
58371
|
+
function createdAtMs(event) {
|
|
58372
|
+
const createdAt = event.createdAt;
|
|
58373
|
+
return createdAt instanceof Date ? createdAt.getTime() : new Date(createdAt).getTime();
|
|
58374
|
+
}
|
|
58375
|
+
function hasKnowableLogOrder(orderedById) {
|
|
58376
|
+
if (orderedById.every((event) => isSlotEventId(event.eventId)))
|
|
58377
|
+
return true;
|
|
58378
|
+
for (let index2 = 1; index2 < orderedById.length; index2++) {
|
|
58379
|
+
const previous2 = createdAtMs(orderedById[index2 - 1]);
|
|
58380
|
+
const current = createdAtMs(orderedById[index2]);
|
|
58381
|
+
if (Number.isNaN(previous2) || Number.isNaN(current))
|
|
58382
|
+
return false;
|
|
58383
|
+
if (current < previous2)
|
|
58384
|
+
return false;
|
|
58385
|
+
}
|
|
58386
|
+
return true;
|
|
58387
|
+
}
|
|
58388
|
+
function foldDuplicates(ordered) {
|
|
58389
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
58390
|
+
const seenClasses = /* @__PURE__ */ new Set();
|
|
58391
|
+
const closedEntities = /* @__PURE__ */ new Set();
|
|
58392
|
+
for (const event of ordered) {
|
|
58393
|
+
const eventClass = entityEventClass(event.eventType);
|
|
58394
|
+
if (eventClass === void 0)
|
|
58395
|
+
continue;
|
|
58396
|
+
const entity = event.correlationId ?? RUN_ENTITY_KEY;
|
|
58397
|
+
const classKey = `${eventClass}:${entity}`;
|
|
58398
|
+
const repeatsClass = seenClasses.has(classKey);
|
|
58399
|
+
const entityWasClosed = closedEntities.has(entity);
|
|
58400
|
+
if (TERMINAL_EVENT_CLASSES.has(eventClass)) {
|
|
58401
|
+
closedEntities.add(entity);
|
|
58402
|
+
}
|
|
58403
|
+
if (!repeatsClass) {
|
|
58404
|
+
if (entityWasClosed)
|
|
58405
|
+
break;
|
|
58406
|
+
seenClasses.add(classKey);
|
|
58407
|
+
continue;
|
|
58408
|
+
}
|
|
58409
|
+
if (entityWasClosed || SINGLETON_EVENT_CLASSES.has(eventClass)) {
|
|
58410
|
+
duplicates.add(event.eventId);
|
|
58411
|
+
}
|
|
58412
|
+
}
|
|
58413
|
+
return duplicates;
|
|
58414
|
+
}
|
|
58415
|
+
function findDuplicateEventIds(events2, { isCompleteHistory }) {
|
|
58416
|
+
if (!isCompleteHistory || events2.length < 2)
|
|
58417
|
+
return /* @__PURE__ */ new Set();
|
|
58418
|
+
const ordered = events2.filter((event) => Boolean(event.eventId)).sort(compareEventId);
|
|
58419
|
+
if (!hasKnowableLogOrder(ordered))
|
|
58420
|
+
return /* @__PURE__ */ new Set();
|
|
58421
|
+
return foldDuplicates(ordered);
|
|
58422
|
+
}
|
|
58423
|
+
const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
|
|
58424
|
+
const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58425
|
+
const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58426
|
+
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58427
|
+
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
58428
|
+
const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
|
|
58429
|
+
function matchPrefixedId(pattern2, prefix, kind, query) {
|
|
58430
|
+
const match2 = query.match(pattern2);
|
|
58431
|
+
if (!match2) {
|
|
58432
|
+
return null;
|
|
58433
|
+
}
|
|
58434
|
+
return { kind, id: `${prefix}_${match2[1].toUpperCase()}` };
|
|
58435
|
+
}
|
|
58436
|
+
function parseExactWorkflowSearchId(query) {
|
|
58437
|
+
const trimmed = query.trim();
|
|
58438
|
+
if (!trimmed) {
|
|
58439
|
+
return null;
|
|
58440
|
+
}
|
|
58441
|
+
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);
|
|
58442
|
+
}
|
|
58443
|
+
function looksLikeWorkflowIdSearchInput(query) {
|
|
58444
|
+
const trimmed = query.trim();
|
|
58445
|
+
if (!WORKFLOW_ID_PREFIX_PATTERN.test(trimmed)) {
|
|
58446
|
+
return false;
|
|
58447
|
+
}
|
|
58448
|
+
return /\d/.test(trimmed);
|
|
58449
|
+
}
|
|
58257
58450
|
const UNDEFINED$2 = -1;
|
|
58258
58451
|
const HOLE = -2;
|
|
58259
58452
|
const NAN = -3;
|
|
@@ -59324,6 +59517,21 @@ class RunExpiredError extends WorkflowWorldError {
|
|
|
59324
59517
|
return isError(value) && value.name === "RunExpiredError";
|
|
59325
59518
|
}
|
|
59326
59519
|
}
|
|
59520
|
+
class StreamExpiredError extends WorkflowWorldError {
|
|
59521
|
+
constructor(message2, runId, streamId, expiredAt) {
|
|
59522
|
+
super(message2, { status: 410, code: "stream-expired" });
|
|
59523
|
+
__publicField(this, "runId");
|
|
59524
|
+
__publicField(this, "streamId");
|
|
59525
|
+
__publicField(this, "expiredAt");
|
|
59526
|
+
this.runId = runId;
|
|
59527
|
+
this.streamId = streamId;
|
|
59528
|
+
this.expiredAt = expiredAt;
|
|
59529
|
+
this.name = "StreamExpiredError";
|
|
59530
|
+
}
|
|
59531
|
+
static is(value) {
|
|
59532
|
+
return isError(value) && value.name === "StreamExpiredError";
|
|
59533
|
+
}
|
|
59534
|
+
}
|
|
59327
59535
|
class TooEarlyError extends WorkflowWorldError {
|
|
59328
59536
|
constructor(message2, options) {
|
|
59329
59537
|
super(message2, { retryAfter: options == null ? void 0 : options.retryAfter });
|
|
@@ -60678,7 +60886,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
60678
60886
|
}
|
|
60679
60887
|
async function hydrateResourceIOAsync(resource, key) {
|
|
60680
60888
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
60681
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
60889
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-dRi0VqoM.js");
|
|
60682
60890
|
ensureZstdDecoderRegistered();
|
|
60683
60891
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
60684
60892
|
const revivers = getRevivers();
|
|
@@ -62476,23 +62684,17 @@ function Spinner({ size: size2 = 14, color: color2 }) {
|
|
|
62476
62684
|
lineW: size2 * 0.24,
|
|
62477
62685
|
lineH: size2 * 0.08
|
|
62478
62686
|
};
|
|
62479
|
-
return jsxRuntimeExports.jsxs("span", { style: {
|
|
62480
|
-
display: "inline-flex",
|
|
62481
|
-
position: "relative",
|
|
62687
|
+
return jsxRuntimeExports.jsxs("span", { className: "relative inline-flex", style: {
|
|
62482
62688
|
width: size2,
|
|
62483
62689
|
height: size2
|
|
62484
|
-
}, children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: KEYFRAMES } }), config2.delays.map((delay, i) => jsxRuntimeExports.jsx("span", { style: {
|
|
62485
|
-
position: "absolute",
|
|
62486
|
-
left: "50%",
|
|
62487
|
-
top: "50%",
|
|
62690
|
+
}, children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: KEYFRAMES } }), config2.delays.map((delay, i) => jsxRuntimeExports.jsx("span", { className: "absolute top-1/2 left-1/2 rounded-[1px] bg-gray-700 [animation-iteration-count:infinite] [animation-name:wf-spinner-fade] [animation-timing-function:linear]", style: {
|
|
62488
62691
|
width: config2.lineW,
|
|
62489
62692
|
height: config2.lineH,
|
|
62490
62693
|
marginLeft: -config2.lineW / 2,
|
|
62491
62694
|
marginTop: -config2.lineH / 2,
|
|
62492
|
-
|
|
62493
|
-
backgroundColor: color2 ?? "var(--ds-gray-700)",
|
|
62695
|
+
backgroundColor: color2,
|
|
62494
62696
|
transform: `rotate(${i * config2.angle}deg) translate(${size2 * 0.36}px)`,
|
|
62495
|
-
|
|
62697
|
+
animationDuration: `${config2.duration}ms`,
|
|
62496
62698
|
animationDelay: `${delay}ms`
|
|
62497
62699
|
} }, delay))] });
|
|
62498
62700
|
}
|
|
@@ -62554,33 +62756,18 @@ function EncryptedInlineLabel() {
|
|
|
62554
62756
|
ctx.onDecrypt();
|
|
62555
62757
|
}, children: [ctx.isDecrypting ? jsxRuntimeExports.jsx(Spinner, { size: 10 }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), jsxRuntimeExports.jsx("span", { children: "Decrypt" })] });
|
|
62556
62758
|
}
|
|
62557
|
-
return jsxRuntimeExports.jsxs("span", {
|
|
62558
|
-
display: "inline",
|
|
62559
|
-
verticalAlign: "middle",
|
|
62560
|
-
marginRight: "3px",
|
|
62561
|
-
marginTop: "-1px"
|
|
62562
|
-
} }), "Encrypted"] });
|
|
62759
|
+
return jsxRuntimeExports.jsxs("span", { className: "text-gray-600 italic", children: [jsxRuntimeExports.jsx(Lock, { className: "-mt-px mr-[3px] inline h-3 w-3 align-middle" }), "Encrypted"] });
|
|
62563
62760
|
}
|
|
62564
62761
|
function StreamRefInline({ streamRef }) {
|
|
62565
62762
|
const onStreamClick = reactExports.useContext(StreamClickContext);
|
|
62566
|
-
|
|
62567
|
-
return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer underline decoration-transparent transition-colors", style: {
|
|
62568
|
-
backgroundColor: hovered ? "var(--ds-blue-200)" : "var(--ds-blue-100)",
|
|
62569
|
-
color: "var(--ds-blue-900)",
|
|
62570
|
-
border: "1px solid var(--ds-blue-300)"
|
|
62571
|
-
}, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onClick: (e) => {
|
|
62763
|
+
return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex cursor-pointer items-center gap-1 rounded border border-blue-300 bg-blue-100 px-1.5 py-0.5 font-mono text-[10px] text-blue-900 underline decoration-transparent transition-colors hover:bg-blue-200", onClick: (e) => {
|
|
62572
62764
|
e.stopPropagation();
|
|
62573
62765
|
onStreamClick == null ? void 0 : onStreamClick(streamRef.streamId);
|
|
62574
62766
|
}, title: `View stream: ${streamRef.streamId}`, children: [jsxRuntimeExports.jsx("span", { children: "📡" }), jsxRuntimeExports.jsx("span", { children: streamRef.streamId })] });
|
|
62575
62767
|
}
|
|
62576
62768
|
function RunRefInline({ runRef }) {
|
|
62577
62769
|
const onRunClick = reactExports.useContext(RunClickContext);
|
|
62578
|
-
|
|
62579
|
-
return jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer underline decoration-transparent transition-colors", style: {
|
|
62580
|
-
backgroundColor: hovered ? "var(--ds-purple-200)" : "var(--ds-purple-100)",
|
|
62581
|
-
color: "var(--ds-purple-900)",
|
|
62582
|
-
border: "1px solid var(--ds-purple-300)"
|
|
62583
|
-
}, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onClick: (e) => {
|
|
62770
|
+
return jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex cursor-pointer items-center gap-1 rounded border border-purple-300 bg-purple-100 px-1.5 py-0.5 font-mono text-[10px] text-purple-900 underline decoration-transparent transition-colors hover:bg-purple-200", onClick: (e) => {
|
|
62584
62771
|
e.stopPropagation();
|
|
62585
62772
|
onRunClick == null ? void 0 : onRunClick(runRef.runId);
|
|
62586
62773
|
}, title: `View run: ${runRef.runId}`, children: jsxRuntimeExports.jsx("span", { children: runRef.runId }) });
|
|
@@ -62588,24 +62775,17 @@ function RunRefInline({ runRef }) {
|
|
|
62588
62775
|
function DecodedBytesChunk({ decodedText, source }) {
|
|
62589
62776
|
const [selectedView, setSelectedView] = reactExports.useState("decoded");
|
|
62590
62777
|
const parsed = parseChunkData(decodedText);
|
|
62591
|
-
return jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [selectedView === "decoded" ? jsxRuntimeExports.jsx("div", { className: "min-w-0", children: typeof parsed === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words
|
|
62592
|
-
backgroundColor: selectedView === "decoded" ? "var(--ds-gray-200)" : "var(--ds-gray-100)",
|
|
62593
|
-
color: "var(--ds-gray-900)"
|
|
62594
|
-
}, onClick: () => setSelectedView("decoded"), "aria-pressed": selectedView === "decoded", "aria-label": "Show decoded text", children: "Decoded" }), jsxRuntimeExports.jsx("button", { type: "button", className: "h-5 border-l px-1.5 text-[10px] font-medium", style: {
|
|
62595
|
-
borderColor: "var(--ds-gray-400)",
|
|
62596
|
-
backgroundColor: selectedView === "bytes" ? "var(--ds-gray-200)" : "var(--ds-gray-100)",
|
|
62597
|
-
color: "var(--ds-gray-900)"
|
|
62598
|
-
}, onClick: () => setSelectedView("bytes"), "aria-pressed": selectedView === "bytes", "aria-label": "Show raw bytes summary", children: "Bytes" })] }) })] });
|
|
62778
|
+
return jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [selectedView === "decoded" ? jsxRuntimeExports.jsx("div", { className: "min-w-0", children: typeof parsed === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words text-gray-1000", children: deserializeChunkText(parsed) }) : jsxRuntimeExports.jsx(DataInspector, { data: parsed, expandLevel: 1 }) }) : jsxRuntimeExports.jsx(DecodedBytesInspector, { decodedText, source }), jsxRuntimeExports.jsx("div", { className: "mt-2 flex", children: jsxRuntimeExports.jsxs("div", { className: "inline-flex overflow-hidden rounded border border-gray-400", title: `${source.type} decoded as ${source.encoding.toUpperCase()} text. Switch to Bytes to inspect the summarized raw value.`, children: [jsxRuntimeExports.jsx("button", { type: "button", className: cn$4("h-5 px-1.5 font-medium text-[10px] text-gray-900", selectedView === "decoded" ? "bg-gray-200" : "bg-gray-100"), onClick: () => setSelectedView("decoded"), "aria-pressed": selectedView === "decoded", "aria-label": "Show decoded text", children: "Decoded" }), jsxRuntimeExports.jsx("button", { type: "button", className: cn$4("h-5 border-gray-400 border-l px-1.5 font-medium text-[10px] text-gray-900", selectedView === "bytes" ? "bg-gray-200" : "bg-gray-100"), onClick: () => setSelectedView("bytes"), "aria-pressed": selectedView === "bytes", "aria-label": "Show raw bytes summary", children: "Bytes" })] }) })] });
|
|
62599
62779
|
}
|
|
62600
62780
|
function DecodedBytesInspector({ decodedText, source }) {
|
|
62601
62781
|
const [expanded, setExpanded] = reactExports.useState(false);
|
|
62602
|
-
return jsxRuntimeExports.jsxs("div", { className: "font-mono", children: [jsxRuntimeExports.jsxs("button", { type: "button", className: "flex max-w-full items-start gap-1 text-left
|
|
62782
|
+
return jsxRuntimeExports.jsxs("div", { className: "font-mono", children: [jsxRuntimeExports.jsxs("button", { type: "button", className: "flex max-w-full items-start gap-1 text-left text-gray-1000", onClick: () => setExpanded((value) => !value), title: `${source.type} decoded as ${source.encoding.toUpperCase()} text`, children: [jsxRuntimeExports.jsx("span", { className: "select-none text-gray-700", children: expanded ? "▼" : "▶" }), jsxRuntimeExports.jsx("span", { className: "min-w-0 break-words", children: source.rawSummary })] }), expanded && jsxRuntimeExports.jsxs("div", { className: "mt-1 pl-5", children: [jsxRuntimeExports.jsx("span", { className: "text-gray-700", children: "decoded: " }), jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words text-green-900", children: JSON.stringify(decodedText) })] })] });
|
|
62603
62783
|
}
|
|
62604
62784
|
function BytesDisplayValue({ display }) {
|
|
62605
62785
|
if (display.decodedFrom) {
|
|
62606
62786
|
return jsxRuntimeExports.jsx(DecodedBytesChunk, { decodedText: display.text, source: display.decodedFrom });
|
|
62607
62787
|
}
|
|
62608
|
-
return jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words
|
|
62788
|
+
return jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words text-gray-1000", children: display.text });
|
|
62609
62789
|
}
|
|
62610
62790
|
function formatField(field) {
|
|
62611
62791
|
return field === "" ? '""' : field;
|
|
@@ -62984,7 +63164,7 @@ const rowCopyValueVariants = cva("flex min-w-0 flex-1 items-center justify-end g
|
|
|
62984
63164
|
});
|
|
62985
63165
|
function DetailKeyValueRowBase({ label, value, copyText, href, removed = false, variant }) {
|
|
62986
63166
|
const stringValue = typeof value === "string" ? value : void 0;
|
|
62987
|
-
return jsxRuntimeExports.jsxs("div", { className: "px-1.5 hover:bg-gray-100 flex justify-between gap-3 -mx-1.5 py-0.5 rounded items-center", children: [jsxRuntimeExports.jsx("span", { className: "flex min-w-0 items-center gap-1.5 truncate text-label-13 text-gray-900", children: label }), removed ? jsxRuntimeExports.jsx("span", { className: "shrink-0 text-copy-13 italic text-gray-700", children: "removed" }) : copyText ? jsxRuntimeExports.jsxs("div", { className: cn$4(rowCopyValueVariants({ variant })), title: copyText, children: [href ? jsxRuntimeExports.jsxs("a", { href, target: "_blank", rel: "noreferrer", className: cn$4(rowValueVariants({ variant }), "flex min-w-0 items-center gap-0.5 hover:underline"), children: [jsxRuntimeExports.jsx(MiddleTruncate, { value: copyText, className: "min-w-0
|
|
63167
|
+
return jsxRuntimeExports.jsxs("div", { className: "px-1.5 hover:bg-gray-100 flex justify-between gap-3 -mx-1.5 py-0.5 rounded items-center", children: [jsxRuntimeExports.jsx("span", { className: "flex min-w-0 items-center gap-1.5 truncate text-label-13 text-gray-900", children: label }), removed ? jsxRuntimeExports.jsx("span", { className: "shrink-0 text-copy-13 italic text-gray-700", children: "removed" }) : copyText ? jsxRuntimeExports.jsxs("div", { className: cn$4(rowCopyValueVariants({ variant })), title: copyText, children: [href ? jsxRuntimeExports.jsxs("a", { href, target: "_blank", rel: "noreferrer", className: cn$4(rowValueVariants({ variant }), "flex min-w-0 items-center gap-0.5 hover:underline"), children: [jsxRuntimeExports.jsx(MiddleTruncate, { value: copyText, className: "min-w-0 grid-cols-[minmax(0,1fr)] text-right" }), jsxRuntimeExports.jsx(ArrowUpRight, { "aria-hidden": true, className: "h-3 w-3 shrink-0" })] }) : jsxRuntimeExports.jsx(MiddleTruncate, { value: copyText, className: cn$4(rowValueVariants({ variant, className: "text-right" }), "grid-cols-[minmax(0,1fr)]") }), jsxRuntimeExports.jsx(CopyButton, { copyText, ariaLabel: `Copy ${label}`, className: "shrink-0 -mr-1" })] }) : jsxRuntimeExports.jsx("span", { className: cn$4(rowValueVariants({ variant })), title: stringValue, children: href ? jsxRuntimeExports.jsx("a", { href, target: "_blank", rel: "noreferrer", className: "hover:underline", children: value }) : value })] });
|
|
62988
63168
|
}
|
|
62989
63169
|
function DetailKeyValueRow(props) {
|
|
62990
63170
|
return jsxRuntimeExports.jsx(DetailKeyValueRowBase, { ...props });
|
|
@@ -63059,10 +63239,7 @@ function AttrSetEventBlock({ data }) {
|
|
|
63059
63239
|
return jsxRuntimeExports.jsx(CopyableDataBlock, { data });
|
|
63060
63240
|
}
|
|
63061
63241
|
const writerLabel = describeWriter(data.writer);
|
|
63062
|
-
return jsxRuntimeExports.jsxs("div", { className: "flex flex-col px-3 py-1", children: [jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: data.changes.map((change, index2) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: change.key, removed: change.value === null, value: change.value ?? void 0 }, `${change.key}:${index2}`)) }), writerLabel && jsxRuntimeExports.jsx("div", { className: "border-t py-1.5 text-label-12",
|
|
63063
|
-
borderColor: "var(--ds-gray-alpha-400)",
|
|
63064
|
-
color: "var(--ds-gray-700)"
|
|
63065
|
-
}, children: writerLabel })] });
|
|
63242
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex flex-col px-3 py-1", children: [jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: data.changes.map((change, index2) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: change.key, removed: change.value === null, value: change.value ?? void 0 }, `${change.key}:${index2}`)) }), writerLabel && jsxRuntimeExports.jsx("div", { className: "border-gray-alpha-400 border-t py-1.5 text-gray-700 text-label-12", children: writerLabel })] });
|
|
63066
63243
|
}
|
|
63067
63244
|
function setRef(ref, value) {
|
|
63068
63245
|
if (typeof ref === "function") {
|
|
@@ -63529,9 +63706,7 @@ function ContextCardProvider({ children: children2, portalTarget }) {
|
|
|
63529
63706
|
distanceFromLast,
|
|
63530
63707
|
lastOrigin
|
|
63531
63708
|
]);
|
|
63532
|
-
return jsxRuntimeExports.jsxs(ContextCardContext.Provider, { value: contextValue, children: [children2, isMounted ? reactDomExports.createPortal(jsxRuntimeExports.jsx("div", { className: "w-full h-full inset-0 fixed pointer-events-none z-[100000]", ref, children: jsxRuntimeExports.jsx("div", { className: "min-w-max transition-all duration-150 ease-[easing-function:cubic-bezier(0.3,_0.57,_0.07,_0.95)] will-change-[transform,width,height] motion-reduce:!transition-none", style: {
|
|
63533
|
-
opacity: visible ? 1 : 0
|
|
63534
|
-
}, children: jsxRuntimeExports.jsxs("div", { className: cn$4("absolute bg-background-100 bg-clip-padding rounded-[6px] overflow-visible pointer-events-none z-[1000000] shadow-[var(--ds-shadow-tooltip),0_0_0_1px_var(--ds-background-100)] w-fit [--context-card-tip-stroke:#DBDBDB] dark-theme:[--context-card-tip-stroke:#252525]", skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-250 ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none"), "data-skip-transition": skipTransition, style: {
|
|
63709
|
+
return jsxRuntimeExports.jsxs(ContextCardContext.Provider, { value: contextValue, children: [children2, isMounted ? reactDomExports.createPortal(jsxRuntimeExports.jsx("div", { className: "w-full h-full inset-0 fixed pointer-events-none z-[100000]", ref, children: jsxRuntimeExports.jsx("div", { className: cn$4("min-w-max transition-all duration-150 ease-[easing-function:cubic-bezier(0.3,_0.57,_0.07,_0.95)] will-change-[transform,width,height] motion-reduce:!transition-none", visible ? "opacity-100" : "opacity-0"), children: jsxRuntimeExports.jsxs("div", { className: cn$4("absolute bg-background-100 bg-clip-padding rounded-[6px] overflow-visible pointer-events-none z-[1000000] shadow-[var(--ds-shadow-tooltip),0_0_0_1px_var(--ds-background-100)] w-fit [--context-card-tip-stroke:#DBDBDB] dark-theme:[--context-card-tip-stroke:#252525]", skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-[250ms] ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none"), "data-skip-transition": skipTransition, style: {
|
|
63535
63710
|
transform: `translate(${activeBounds.x}px,${activeBounds.y}px)`,
|
|
63536
63711
|
width: activeBounds.width,
|
|
63537
63712
|
height: activeBounds.height
|
|
@@ -63540,18 +63715,13 @@ function ContextCardProvider({ children: children2, portalTarget }) {
|
|
|
63540
63715
|
"right-full -translate-y-1/2 rotate-90 -mr-[3.5px]": activeBounds.side === "right",
|
|
63541
63716
|
"bottom-full -translate-x-1/2 rotate-180": activeBounds.side === "bottom",
|
|
63542
63717
|
"left-full -translate-y-1/2 rotate-[270deg] -ml-[3.5px]": activeBounds.side === "left"
|
|
63543
|
-
}, skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-
|
|
63718
|
+
}, skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-[250ms] ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none"), style: {
|
|
63544
63719
|
...activeBounds.side === "top" || activeBounds.side === "bottom" ? {
|
|
63545
63720
|
left: `calc(50% + ${activeBounds.arrowOffset.x}px)`
|
|
63546
63721
|
} : {
|
|
63547
63722
|
top: `calc(50% + ${activeBounds.arrowOffset.y}px)`
|
|
63548
63723
|
}
|
|
63549
|
-
}, "data-skip-transition": skipTransition, "data-side": activeBounds.side, children: jsxRuntimeExports.jsxs("svg", { width: "14", height: "7", viewBox: "0 0 14 7", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [jsxRuntimeExports.jsx("g", { clipPath: "url(#context-card-tip-clip)", children: jsxRuntimeExports.jsx("path", { d: "M15 -0.5V0.5H12.9834L12.8184 0.508789C12.4377 0.550822 12.0853 0.738056 11.8359 1.03418L8.53027 4.95996C7.73114 5.90893 6.26886 5.90892 5.46973 4.95996L2.16406 1.03418C1.87905 0.695733 1.45907 0.5 1.0166 0.5H-1V-0.5H15Z", fill: "var(--ds-background-100)",
|
|
63550
|
-
fill: "var(--ds-background-100)",
|
|
63551
|
-
fillOpacity: 1,
|
|
63552
|
-
stroke: "var(--context-card-tip-stroke)",
|
|
63553
|
-
strokeOpacity: 1
|
|
63554
|
-
} }) }), jsxRuntimeExports.jsx("defs", { children: jsxRuntimeExports.jsx("clipPath", { id: "context-card-tip-clip", children: jsxRuntimeExports.jsx("rect", { width: "14", height: "7", fill: "white", style: { fill: "white", fillOpacity: 1 } }) }) })] }) }), jsxRuntimeExports.jsx("div", { ref: portalRef })] }) }) }), resolvedPortalTarget ?? document.body) : null] });
|
|
63724
|
+
}, "data-skip-transition": skipTransition, "data-side": activeBounds.side, children: jsxRuntimeExports.jsxs("svg", { width: "14", height: "7", viewBox: "0 0 14 7", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [jsxRuntimeExports.jsx("g", { clipPath: "url(#context-card-tip-clip)", children: jsxRuntimeExports.jsx("path", { d: "M15 -0.5V0.5H12.9834L12.8184 0.508789C12.4377 0.550822 12.0853 0.738056 11.8359 1.03418L8.53027 4.95996C7.73114 5.90893 6.26886 5.90892 5.46973 4.95996L2.16406 1.03418C1.87905 0.695733 1.45907 0.5 1.0166 0.5H-1V-0.5H15Z", fill: "var(--ds-background-100)", className: "fill-background-100 stroke-[var(--context-card-tip-stroke)]" }) }), jsxRuntimeExports.jsx("defs", { children: jsxRuntimeExports.jsx("clipPath", { id: "context-card-tip-clip", children: jsxRuntimeExports.jsx("rect", { width: "14", height: "7", fill: "white", className: "fill-background-100" }) }) })] }) }), jsxRuntimeExports.jsx("div", { ref: portalRef })] }) }) }), resolvedPortalTarget ?? document.body) : null] });
|
|
63555
63725
|
}
|
|
63556
63726
|
function ContextCardTrigger({ content: content2, children: children2, side = "right", align = "center", sideOffset = 16, alignOffset = 0, ignoreCardPointerEvents = false, noPadding, asChild, className, hide: hide2, inactiveTimeoutMs = INACTIVE_TIMEOUT_MS }) {
|
|
63557
63727
|
const triggerRef = reactExports.useRef(null);
|
|
@@ -63786,17 +63956,22 @@ function ContextCardTrigger({ content: content2, children: children2, side = "ri
|
|
|
63786
63956
|
}
|
|
63787
63957
|
}
|
|
63788
63958
|
const Comp = asChild ? Root$6 : "div";
|
|
63789
|
-
return jsxRuntimeExports.jsxs(Comp, { className: cn$4("inline-flex cursor-pointer flex-[0_1_auto] overflow-hidden", className), onMouseEnter, onMouseLeave, onClick: handleClick, ref: triggerRef, children: [jsxRuntimeExports.jsx(Slottable$1, { children: children2 }), (portalRef == null ? void 0 : portalRef.current) && (localHover || persisting) ? reactDomExports.createPortal(jsxRuntimeExports.jsx("div", { className: cn$4("absolute top-0 p-3 left-0 max-w-max transition-[transform,width,height] duration-
|
|
63790
|
-
...noPadding ? { padding: 0 } : {},
|
|
63791
|
-
pointerEvents: rootVisible && visible && !ignoreCardPointerEvents ? "all" : "none"
|
|
63792
|
-
}, children: jsxRuntimeExports.jsx("div", { className: cn$4("min-w-max transition-all duration-150 ease-[easing-function:cubic-bezier(0.3,_0.57,_0.07,_0.95)] will-change-[transform,width,height] motion-reduce:!transition-none", skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-250 ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none"), ref: contentMeasureRef, style: {
|
|
63793
|
-
opacity: Number(visible)
|
|
63794
|
-
}, children: content2 }) }, id2), portalRef.current) : null] });
|
|
63959
|
+
return jsxRuntimeExports.jsxs(Comp, { className: cn$4("inline-flex cursor-pointer flex-[0_1_auto] overflow-hidden", className), onMouseEnter, onMouseLeave, onClick: handleClick, ref: triggerRef, children: [jsxRuntimeExports.jsx(Slottable$1, { children: children2 }), (portalRef == null ? void 0 : portalRef.current) && (localHover || persisting) ? reactDomExports.createPortal(jsxRuntimeExports.jsx("div", { className: cn$4("absolute top-0 p-3 left-0 max-w-max transition-[transform,width,height] duration-[250ms] ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none", skipTransition && "!transition-none", noPadding && "p-0", rootVisible && visible && !ignoreCardPointerEvents ? "pointer-events-auto" : "pointer-events-none"), ref: contentRef, children: jsxRuntimeExports.jsx("div", { className: cn$4("min-w-max transition-all duration-150 ease-[easing-function:cubic-bezier(0.3,_0.57,_0.07,_0.95)] will-change-[transform,width,height] motion-reduce:!transition-none", skipTransition ? "!transition-none" : "transition-[transform,width,height] duration-[250ms] ease-[easing-function:cubic-bezier(0.29,0.31,0.05,0.96)] will-change-[transform,width,height] motion-reduce:!transition-none", visible ? "opacity-100" : "opacity-0"), ref: contentMeasureRef, children: content2 }) }, id2), portalRef.current) : null] });
|
|
63795
63960
|
}
|
|
63796
63961
|
const STYLES$2 = `.wf-decrypt-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-decrypt-idle{color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400)}.wf-decrypt-idle:hover{background:var(--ds-gray-alpha-200)}.wf-decrypt-done{color:var(--ds-green-900);background:var(--ds-green-100);box-shadow:0 0 0 1px var(--ds-green-400);cursor:default}`;
|
|
63797
63962
|
function DecryptButton({ decrypted = false, loading = false, onClick }) {
|
|
63798
63963
|
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES$2 } }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: decrypted ? void 0 : onClick, disabled: decrypted || loading, className: `wf-decrypt-btn ${decrypted ? "wf-decrypt-done" : "wf-decrypt-idle"}`, children: [loading ? jsxRuntimeExports.jsx(Spinner, { size: 14 }) : decrypted ? jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })] }) : jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] }), loading ? "Decrypting…" : decrypted ? "Decrypted" : "Decrypt"] })] });
|
|
63799
63964
|
}
|
|
63965
|
+
const TooltipProvider = Provider$2;
|
|
63966
|
+
const Tooltip$1 = Root3$1;
|
|
63967
|
+
const TooltipTrigger$1 = Trigger$4;
|
|
63968
|
+
const TooltipContent$1 = reactExports.forwardRef(({ className, sideOffset = 8, showArrow = true, children: children2, ...props }, ref) => jsxRuntimeExports.jsx(Portal$6, { children: jsxRuntimeExports.jsxs(Content2$4, { ref, sideOffset, className: cn$4("z-[99999] flex items-center gap-1 rounded-[10px] bg-gray-1000 px-2 py-1.5 !text-label-13 text-background-100 shadow-md select-none", className), ...props, children: [children2, showArrow ? jsxRuntimeExports.jsx(Arrow2$1, { width: 11, height: 5, className: "fill-gray-1000" }) : null] }) }));
|
|
63969
|
+
TooltipContent$1.displayName = Content2$4.displayName;
|
|
63970
|
+
function DuplicateEventTooltip({ isDuplicate = false, children: children2 }) {
|
|
63971
|
+
if (!isDuplicate)
|
|
63972
|
+
return children2;
|
|
63973
|
+
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsxs(Tooltip$1, { children: [jsxRuntimeExports.jsx(TooltipTrigger$1, { asChild: true, children: children2 }), jsxRuntimeExports.jsx(TooltipContent$1, { className: "max-w-[264px] leading-snug", collisionPadding: 8, side: "top", children: DUPLICATE_EVENT_MESSAGE })] }) });
|
|
63974
|
+
}
|
|
63800
63975
|
function isStructuredError(value) {
|
|
63801
63976
|
return value != null && typeof value === "object" && (typeof value.message === "string" || typeof value.stack === "string");
|
|
63802
63977
|
}
|
|
@@ -63852,30 +64027,13 @@ function MenuDropdown({ options, value, onChange }) {
|
|
|
63852
64027
|
document.addEventListener("mousedown", handleClickOutside);
|
|
63853
64028
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
63854
64029
|
}, [open2]);
|
|
63855
|
-
return jsxRuntimeExports.jsxs("div", { ref,
|
|
63856
|
-
marginLeft: 16,
|
|
63857
|
-
marginRight: -4,
|
|
63858
|
-
color: "var(--ds-gray-900)"
|
|
63859
|
-
}, children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open2 && jsxRuntimeExports.jsx("div", { style: {
|
|
63860
|
-
position: "absolute",
|
|
63861
|
-
right: 0,
|
|
63862
|
-
top: "100%",
|
|
63863
|
-
marginTop: 4,
|
|
63864
|
-
minWidth: 140,
|
|
63865
|
-
padding: 4,
|
|
63866
|
-
borderRadius: 12,
|
|
63867
|
-
background: "var(--ds-background-100)",
|
|
63868
|
-
boxShadow: "var(--ds-shadow-menu, var(--ds-shadow-medium))",
|
|
63869
|
-
zIndex: 2001
|
|
63870
|
-
}, role: "menu", children: options.map((option) => jsxRuntimeExports.jsx("button", { type: "button", role: "menuitem", className: "wf-menu-item", style: {
|
|
63871
|
-
fontWeight: option.value === value ? 500 : 400
|
|
63872
|
-
}, onClick: () => {
|
|
64030
|
+
return jsxRuntimeExports.jsxs("div", { ref, className: "relative shrink-0", children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES } }), jsxRuntimeExports.jsxs("button", { type: "button", className: "wf-menu-btn", onClick: () => setOpen(!open2), children: [jsxRuntimeExports.jsx("span", { children: label }), jsxRuntimeExports.jsx("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", className: "-mr-1 ml-4 text-gray-900", children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open2 && jsxRuntimeExports.jsx("div", { className: "absolute top-full right-0 z-[2001] mt-1 min-w-[140px] bg-background-100 p-1 material-menu", role: "menu", children: options.map((option) => jsxRuntimeExports.jsx("button", { type: "button", role: "menuitem", className: cn$4("wf-menu-item", option.value === value ? "font-medium" : "font-normal"), onClick: () => {
|
|
63873
64031
|
onChange(option.value);
|
|
63874
64032
|
setOpen(false);
|
|
63875
64033
|
}, children: option.label }, option.value)) })] });
|
|
63876
64034
|
}
|
|
63877
64035
|
function Skeleton$1({ className, style: style2, ...props }) {
|
|
63878
|
-
return jsxRuntimeExports.jsx("div", { ...props, className: cn$4("rounded-md", className), style:
|
|
64036
|
+
return jsxRuntimeExports.jsx("div", { ...props, className: cn$4("rounded-md bg-gray-200", className), style: style2 });
|
|
63879
64037
|
}
|
|
63880
64038
|
const TIME_UNITS = [
|
|
63881
64039
|
{ unit: "year", ms: 31536e6 },
|
|
@@ -64057,8 +64215,8 @@ function buildNameMaps(events2, run2) {
|
|
|
64057
64215
|
const workflowName = (run2 == null ? void 0 : run2.workflowName) ? ((_b2 = parseWorkflowName(run2.workflowName)) == null ? void 0 : _b2.shortName) ?? run2.workflowName : null;
|
|
64058
64216
|
return { correlationNameMap, workflowName };
|
|
64059
64217
|
}
|
|
64060
|
-
function buildDurationMap(events2) {
|
|
64061
|
-
const chronological = [...events2].sort((a2, b2) => getEffectiveEventTime(a2) - getEffectiveEventTime(b2));
|
|
64218
|
+
function buildDurationMap(events2, duplicateEventIds = /* @__PURE__ */ new Set()) {
|
|
64219
|
+
const chronological = [...events2].filter((event) => !duplicateEventIds.has(event.eventId)).sort((a2, b2) => getEffectiveEventTime(a2) - getEffectiveEventTime(b2));
|
|
64062
64220
|
const createdTimes = /* @__PURE__ */ new Map();
|
|
64063
64221
|
const firstStartedTimes = /* @__PURE__ */ new Map();
|
|
64064
64222
|
const startedTimes = /* @__PURE__ */ new Map();
|
|
@@ -64307,7 +64465,7 @@ function RowsSkeleton({ showSeparateEventOccurrenceTimestamps = false }) {
|
|
|
64307
64465
|
marginLeft: i % 4 === 0 ? 5 : 6
|
|
64308
64466
|
} })] }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0 flex items-center justify-center", children: jsxRuntimeExports.jsx(Skeleton$1, { className: "w-5 h-5", style: { borderRadius: 4 } }) }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "70%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "70%" } }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 px-4 flex items-center gap-1.5", style: { flex: "2 1 0%" }, children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "flex-shrink-0", style: { width: 6, height: 6, borderRadius: "50%" } }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "60%" } })] }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "50%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "75%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: { width: "75%" } }) })] }, i)) });
|
|
64309
64467
|
}
|
|
64310
|
-
function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey, onEncryptedDataDetected, suppressGroupDimming = false, showSeparateEventOccurrenceTimestamps = false }) {
|
|
64468
|
+
function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey, onEncryptedDataDetected, suppressGroupDimming = false, showSeparateEventOccurrenceTimestamps = false, isDuplicate = false }) {
|
|
64311
64469
|
const [isLoading, setIsLoading] = reactExports.useState(false);
|
|
64312
64470
|
const [loadedEventData, setLoadedEventData] = reactExports.useState(cachedEventData);
|
|
64313
64471
|
const [loadError, setLoadError] = reactExports.useState(null);
|
|
@@ -64425,7 +64583,9 @@ function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggl
|
|
|
64425
64583
|
}, children: jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 transition-transform", style: {
|
|
64426
64584
|
color: "var(--ds-gray-900)",
|
|
64427
64585
|
transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
64428
|
-
} }) }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: occurredAt ? jsxRuntimeExports.jsx(TimestampTooltip, { date: occurredAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(occurredAt) }) }) : "-" }), jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(TimestampTooltip, { date: displayedCreatedAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(displayedCreatedAt) }) }) }), jsxRuntimeExports.jsx("div", { className: "font-medium min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5", style: {
|
|
64586
|
+
} }) }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: occurredAt ? jsxRuntimeExports.jsx(TimestampTooltip, { date: occurredAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(occurredAt) }) }) : "-" }), jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(TimestampTooltip, { date: displayedCreatedAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(displayedCreatedAt) }) }) }), jsxRuntimeExports.jsx("div", { className: "font-medium min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(DuplicateEventTooltip, { isDuplicate, children: jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5", style: {
|
|
64587
|
+
color: isDuplicate ? "var(--ds-gray-700)" : "var(--ds-gray-900)"
|
|
64588
|
+
}, children: [jsxRuntimeExports.jsxs("span", { style: {
|
|
64429
64589
|
position: "relative",
|
|
64430
64590
|
display: "inline-flex",
|
|
64431
64591
|
width: 6,
|
|
@@ -64444,7 +64604,7 @@ function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggl
|
|
|
64444
64604
|
height: 6,
|
|
64445
64605
|
borderRadius: "50%",
|
|
64446
64606
|
backgroundColor: statusDotColor
|
|
64447
|
-
} })] }), formatEventType(event.eventType)] }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap", style: { flex: "2 1 0%" }, title: eventName !== "-" ? eventName : void 0, children: eventName }), jsxRuntimeExports.jsx(CopyableCell, { value: event.correlationId || "", className: "font-mono", style: { flex: "3 1 0%" } }), jsxRuntimeExports.jsx(CopyableCell, { value: event.eventId, className: "font-mono", style: { flex: "3 1 0%" } })] })] }), isExpanded && jsxRuntimeExports.jsxs("div", { className: "flex", children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst: false, isLast, isRunLevel: isRun, hasSelection: hasActive, showBranch: false, showLaneLine: showLaneLine && !isLaneEnd, isLaneStart: false, isLaneEnd: false, continuationOnly: true }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsxs("div", { className: "flex-1 my-1.5 mr-3 ml-2 py-2 rounded-md border overflow-hidden", style: {
|
|
64607
|
+
} })] }), formatEventType(event.eventType)] }) }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap", style: { flex: "2 1 0%" }, title: eventName !== "-" ? eventName : void 0, children: eventName }), jsxRuntimeExports.jsx(CopyableCell, { value: event.correlationId || "", className: "font-mono", style: { flex: "3 1 0%" } }), jsxRuntimeExports.jsx(CopyableCell, { value: event.eventId, className: "font-mono", style: { flex: "3 1 0%" } })] })] }), isExpanded && jsxRuntimeExports.jsxs("div", { className: "flex", children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst: false, isLast, isRunLevel: isRun, hasSelection: hasActive, showBranch: false, showLaneLine: showLaneLine && !isLaneEnd, isLaneStart: false, isLaneEnd: false, continuationOnly: true }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsxs("div", { className: "flex-1 my-1.5 mr-3 ml-2 py-2 rounded-md border overflow-hidden", style: {
|
|
64448
64608
|
borderColor: "var(--ds-gray-alpha-200)",
|
|
64449
64609
|
opacity: contentOpacity,
|
|
64450
64610
|
transition: "opacity 150ms"
|
|
@@ -64482,6 +64642,9 @@ function EventListViewInner({ events: events2, run: run2, onLoadEventData, hasMo
|
|
|
64482
64642
|
const dir = effectiveSortOrder === "desc" ? -1 : 1;
|
|
64483
64643
|
return [...sourceEvents].sort((a2, b2) => dir * (getEffectiveEventTime(a2) - getEffectiveEventTime(b2)));
|
|
64484
64644
|
}, [events2, effectiveSortOrder, isExactSearchActive, searchResults]);
|
|
64645
|
+
const duplicateEventIds = reactExports.useMemo(() => findDuplicateEventIds(events2 ?? [], {
|
|
64646
|
+
isCompleteHistory: !hasMoreEvents && !isExactSearchActive
|
|
64647
|
+
}), [events2, hasMoreEvents, isExactSearchActive]);
|
|
64485
64648
|
const hasEncryptedInlineData = reactExports.useMemo(() => {
|
|
64486
64649
|
const sourceEvents = isExactSearchActive ? searchResults : events2;
|
|
64487
64650
|
if (!sourceEvents)
|
|
@@ -64499,7 +64662,7 @@ function EventListViewInner({ events: events2, run: run2, onLoadEventData, hasMo
|
|
|
64499
64662
|
}, []);
|
|
64500
64663
|
const hasEncryptedData = hasEncryptedDataProp || hasEncryptedInlineData || foundEncryptedInLazyData;
|
|
64501
64664
|
const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(isExactSearchActive ? searchResults : events2 ?? null, run2 ?? null), [events2, isExactSearchActive, run2, searchResults]);
|
|
64502
|
-
const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents), [sortedEvents]);
|
|
64665
|
+
const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents, duplicateEventIds), [sortedEvents, duplicateEventIds]);
|
|
64503
64666
|
const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
|
|
64504
64667
|
const [hoveredGroupKey, setHoveredGroupKey] = reactExports.useState(void 0);
|
|
64505
64668
|
const onSelectGroup = reactExports.useCallback((groupKey) => {
|
|
@@ -64715,7 +64878,7 @@ function EventListViewInner({ events: events2, run: run2, onLoadEventData, hasMo
|
|
|
64715
64878
|
void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
|
|
64716
64879
|
}, itemContent: (index2) => {
|
|
64717
64880
|
const ev = sortedEvents[index2];
|
|
64718
|
-
return jsxRuntimeExports.jsx(EventRow$1, { event: ev, index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents.length - 1, isExpanded: expandedEventIds.has(ev.eventId), onToggleExpand: toggleEventExpanded, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(ev.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, onEncryptedDataDetected: handleEncryptedDataDetected, suppressGroupDimming: isExactSearchActive, showSeparateEventOccurrenceTimestamps });
|
|
64881
|
+
return jsxRuntimeExports.jsx(EventRow$1, { event: ev, index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents.length - 1, isExpanded: expandedEventIds.has(ev.eventId), onToggleExpand: toggleEventExpanded, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(ev.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, onEncryptedDataDetected: handleEncryptedDataDetected, suppressGroupDimming: isExactSearchActive, isDuplicate: duplicateEventIds.has(ev.eventId), showSeparateEventOccurrenceTimestamps });
|
|
64719
64882
|
}, style: { flex: 1, minHeight: 0 } }), jsxRuntimeExports.jsxs("div", { className: "relative flex-shrink-0 flex items-center h-10 border-t px-4 text-label-12", style: {
|
|
64720
64883
|
borderColor: "var(--ds-gray-alpha-200)",
|
|
64721
64884
|
color: "var(--ds-gray-900)",
|
|
@@ -64779,152 +64942,10 @@ function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
|
|
|
64779
64942
|
if (!isOpen) {
|
|
64780
64943
|
return null;
|
|
64781
64944
|
}
|
|
64782
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
64783
|
-
position: "fixed",
|
|
64784
|
-
inset: 0,
|
|
64785
|
-
zIndex: 50,
|
|
64786
|
-
display: "flex",
|
|
64787
|
-
alignItems: "center",
|
|
64788
|
-
justifyContent: "center"
|
|
64789
|
-
}, role: "dialog", "aria-modal": "true", "aria-labelledby": "resolve-hook-modal-title", children: [jsxRuntimeExports.jsx("div", { style: {
|
|
64790
|
-
position: "absolute",
|
|
64791
|
-
inset: 0,
|
|
64792
|
-
background: "rgba(0, 0, 0, 0.7)"
|
|
64793
|
-
}, onClick: isSubmitting ? void 0 : onClose }), jsxRuntimeExports.jsxs("div", { style: {
|
|
64794
|
-
position: "relative",
|
|
64795
|
-
zIndex: 10,
|
|
64796
|
-
width: 480,
|
|
64797
|
-
maxWidth: "calc(100% - 32px)",
|
|
64798
|
-
borderRadius: 12,
|
|
64799
|
-
border: "none",
|
|
64800
|
-
boxShadow: "var(--ds-shadow-menu)",
|
|
64801
|
-
background: "var(--ds-background-100)",
|
|
64802
|
-
color: "var(--ds-gray-1000)",
|
|
64803
|
-
overflow: "hidden"
|
|
64804
|
-
}, children: [jsxRuntimeExports.jsxs("div", { style: {
|
|
64805
|
-
display: "flex",
|
|
64806
|
-
alignItems: "center",
|
|
64807
|
-
justifyContent: "space-between",
|
|
64808
|
-
padding: "16px 24px"
|
|
64809
|
-
}, children: [jsxRuntimeExports.jsx("h2", { id: "resolve-hook-modal-title", style: {
|
|
64810
|
-
margin: 0,
|
|
64811
|
-
fontSize: 16,
|
|
64812
|
-
fontWeight: 600,
|
|
64813
|
-
color: "var(--ds-gray-1000)"
|
|
64814
|
-
}, children: "Resolve Hook" }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, "aria-label": "Close modal", style: {
|
|
64815
|
-
display: "flex",
|
|
64816
|
-
alignItems: "center",
|
|
64817
|
-
justifyContent: "center",
|
|
64818
|
-
padding: 4,
|
|
64819
|
-
borderRadius: 6,
|
|
64820
|
-
border: "none",
|
|
64821
|
-
background: "transparent",
|
|
64822
|
-
color: "var(--ds-gray-900)",
|
|
64823
|
-
cursor: isSubmitting ? "not-allowed" : "pointer",
|
|
64824
|
-
opacity: isSubmitting ? 0.5 : 1,
|
|
64825
|
-
transition: "background 0.15s"
|
|
64826
|
-
}, onMouseEnter: (e) => {
|
|
64827
|
-
e.currentTarget.style.background = "var(--ds-gray-alpha-200)";
|
|
64828
|
-
}, onMouseLeave: (e) => {
|
|
64829
|
-
e.currentTarget.style.background = "transparent";
|
|
64830
|
-
}, children: jsxRuntimeExports.jsx(X$3, { style: { width: 16, height: 16 } }) })] }), jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [jsxRuntimeExports.jsxs("div", { style: { padding: "0 24px 16px" }, children: [jsxRuntimeExports.jsx("label", { htmlFor: "json-payload", style: {
|
|
64831
|
-
display: "block",
|
|
64832
|
-
fontSize: 14,
|
|
64833
|
-
fontWeight: 500,
|
|
64834
|
-
marginBottom: 6,
|
|
64835
|
-
color: "var(--ds-gray-1000)"
|
|
64836
|
-
}, children: "JSON Payload" }), jsxRuntimeExports.jsxs("p", { style: {
|
|
64837
|
-
fontSize: 13,
|
|
64838
|
-
marginBottom: 12,
|
|
64839
|
-
marginTop: 0,
|
|
64840
|
-
color: "var(--ds-gray-900)",
|
|
64841
|
-
lineHeight: 1.5
|
|
64842
|
-
}, children: ["Enter a JSON value to send to the hook. Leave empty to send", " ", jsxRuntimeExports.jsx("code", { style: {
|
|
64843
|
-
padding: "2px 6px",
|
|
64844
|
-
borderRadius: 4,
|
|
64845
|
-
fontSize: 12,
|
|
64846
|
-
fontFamily: 'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',
|
|
64847
|
-
background: "var(--ds-gray-alpha-200)",
|
|
64848
|
-
color: "var(--ds-gray-1000)"
|
|
64849
|
-
}, children: "null" }), "."] }), jsxRuntimeExports.jsx("textarea", { ref: textareaRef, id: "json-payload", value: jsonInput, onChange: (e) => {
|
|
64945
|
+
return jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", role: "dialog", "aria-modal": "true", "aria-labelledby": "resolve-hook-modal-title", children: [jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-black/70", onClick: isSubmitting ? void 0 : onClose }), jsxRuntimeExports.jsxs("div", { className: "relative z-10 w-[480px] max-w-[calc(100%_-_32px)] overflow-hidden !border-none bg-background-100 text-gray-1000 material-menu", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [jsxRuntimeExports.jsx("h2", { id: "resolve-hook-modal-title", className: "m-0 font-semibold text-base text-gray-1000", children: "Resolve Hook" }), jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, "aria-label": "Close modal", className: "flex cursor-pointer items-center justify-center rounded-md !border-none !bg-transparent p-1 text-gray-900 transition-colors hover:!bg-gray-alpha-200 disabled:cursor-not-allowed disabled:opacity-50", children: jsxRuntimeExports.jsx(X$3, { className: "size-4" }) })] }), jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [jsxRuntimeExports.jsxs("div", { className: "px-6 pb-4", children: [jsxRuntimeExports.jsx("label", { htmlFor: "json-payload", className: "mb-1.5 block font-medium text-gray-1000 text-sm", children: "JSON Payload" }), jsxRuntimeExports.jsxs("p", { className: "mt-0 mb-3 text-[13px] text-gray-900 leading-[1.5]", children: ["Enter a JSON value to send to the hook. Leave empty to send", " ", jsxRuntimeExports.jsx("code", { className: "rounded bg-gray-alpha-200 px-1.5 py-0.5 font-mono text-gray-1000 text-xs", children: "null" }), "."] }), jsxRuntimeExports.jsx("textarea", { ref: textareaRef, id: "json-payload", value: jsonInput, onChange: (e) => {
|
|
64850
64946
|
setJsonInput(e.target.value);
|
|
64851
64947
|
setParseError(null);
|
|
64852
|
-
}, onKeyDown: handleKeyDown, disabled: isSubmitting, placeholder: '{"key": "value"}',
|
|
64853
|
-
width: "100%",
|
|
64854
|
-
height: 160,
|
|
64855
|
-
padding: "8px 12px",
|
|
64856
|
-
fontFamily: 'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',
|
|
64857
|
-
fontSize: 13,
|
|
64858
|
-
lineHeight: 1.5,
|
|
64859
|
-
borderRadius: 8,
|
|
64860
|
-
border: `1px solid ${parseError ? "var(--ds-red-700)" : "var(--ds-gray-alpha-400)"}`,
|
|
64861
|
-
color: "var(--ds-gray-1000)",
|
|
64862
|
-
background: "var(--ds-background-100)",
|
|
64863
|
-
outline: "none",
|
|
64864
|
-
resize: "none",
|
|
64865
|
-
opacity: isSubmitting ? 0.5 : 1,
|
|
64866
|
-
cursor: isSubmitting ? "not-allowed" : "text",
|
|
64867
|
-
boxSizing: "border-box"
|
|
64868
|
-
} }), parseError && jsxRuntimeExports.jsx("p", { style: {
|
|
64869
|
-
marginTop: 8,
|
|
64870
|
-
fontSize: 13,
|
|
64871
|
-
color: "var(--ds-red-900)",
|
|
64872
|
-
margin: "8px 0 0"
|
|
64873
|
-
}, children: parseError }), jsxRuntimeExports.jsxs("p", { style: {
|
|
64874
|
-
marginTop: 8,
|
|
64875
|
-
fontSize: 12,
|
|
64876
|
-
color: "var(--ds-gray-800)",
|
|
64877
|
-
margin: "8px 0 0"
|
|
64878
|
-
}, children: ["Press", " ", jsxRuntimeExports.jsxs("kbd", { style: {
|
|
64879
|
-
padding: "2px 5px",
|
|
64880
|
-
borderRadius: 4,
|
|
64881
|
-
fontSize: 11,
|
|
64882
|
-
fontFamily: 'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',
|
|
64883
|
-
background: "var(--ds-gray-alpha-200)",
|
|
64884
|
-
border: "1px solid var(--ds-gray-alpha-400)"
|
|
64885
|
-
}, children: [isMacPlatform ? "⌘" : "Ctrl", "+Enter"] }), " ", "to submit"] })] }), jsxRuntimeExports.jsxs("div", { style: {
|
|
64886
|
-
display: "flex",
|
|
64887
|
-
alignItems: "center",
|
|
64888
|
-
justifyContent: "flex-end",
|
|
64889
|
-
gap: 8,
|
|
64890
|
-
padding: "12px 24px",
|
|
64891
|
-
borderTop: "1px solid var(--ds-gray-alpha-400)"
|
|
64892
|
-
}, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, style: {
|
|
64893
|
-
padding: "8px 16px",
|
|
64894
|
-
fontSize: 14,
|
|
64895
|
-
fontWeight: 500,
|
|
64896
|
-
borderRadius: 8,
|
|
64897
|
-
border: "1px solid var(--ds-gray-alpha-400)",
|
|
64898
|
-
background: "var(--ds-background-100)",
|
|
64899
|
-
color: "var(--ds-gray-1000)",
|
|
64900
|
-
cursor: isSubmitting ? "not-allowed" : "pointer",
|
|
64901
|
-
opacity: isSubmitting ? 0.5 : 1,
|
|
64902
|
-
transition: "background 0.15s"
|
|
64903
|
-
}, onMouseEnter: (e) => {
|
|
64904
|
-
e.currentTarget.style.background = "var(--ds-gray-alpha-100)";
|
|
64905
|
-
}, onMouseLeave: (e) => {
|
|
64906
|
-
e.currentTarget.style.background = "var(--ds-background-100)";
|
|
64907
|
-
}, children: "Cancel" }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => void submitPayload(), disabled: isSubmitting, style: {
|
|
64908
|
-
display: "flex",
|
|
64909
|
-
alignItems: "center",
|
|
64910
|
-
gap: 6,
|
|
64911
|
-
padding: "8px 16px",
|
|
64912
|
-
fontSize: 14,
|
|
64913
|
-
fontWeight: 500,
|
|
64914
|
-
borderRadius: 8,
|
|
64915
|
-
border: "none",
|
|
64916
|
-
background: "var(--ds-gray-1000)",
|
|
64917
|
-
color: "var(--ds-background-100)",
|
|
64918
|
-
cursor: isSubmitting ? "not-allowed" : "pointer",
|
|
64919
|
-
opacity: isSubmitting ? 0.5 : 1,
|
|
64920
|
-
transition: "opacity 0.15s"
|
|
64921
|
-
}, onMouseEnter: (e) => {
|
|
64922
|
-
if (!isSubmitting)
|
|
64923
|
-
e.currentTarget.style.opacity = "0.9";
|
|
64924
|
-
}, onMouseLeave: (e) => {
|
|
64925
|
-
if (!isSubmitting)
|
|
64926
|
-
e.currentTarget.style.opacity = "1";
|
|
64927
|
-
}, children: [jsxRuntimeExports.jsx(Send, { style: { width: 14, height: 14 } }), isSubmitting ? "Sending..." : "Send Payload"] })] })] })] })] });
|
|
64948
|
+
}, onKeyDown: handleKeyDown, disabled: isSubmitting, placeholder: '{"key": "value"}', className: cn$4("box-border h-40 w-full resize-none rounded-lg border bg-background-100 px-3 py-2 font-mono text-[13px] text-gray-1000 leading-[1.5] outline-none disabled:cursor-not-allowed disabled:opacity-50", parseError ? "border-red-700" : "border-gray-alpha-400") }), parseError && jsxRuntimeExports.jsx("p", { className: "mt-2 mb-0 text-[13px] text-red-900", children: parseError }), jsxRuntimeExports.jsxs("p", { className: "mt-2 mb-0 text-gray-800 text-xs", children: ["Press", " ", jsxRuntimeExports.jsxs("kbd", { className: "rounded border border-gray-alpha-400 bg-gray-alpha-200 px-[5px] py-0.5 font-mono text-[11px]", children: [isMacPlatform ? "⌘" : "Ctrl", "+Enter"] }), " ", "to submit"] })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2 border-gray-alpha-400 border-t px-6 py-3", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: onClose, disabled: isSubmitting, className: "cursor-pointer rounded-lg border border-gray-alpha-400 bg-background-100 px-4 py-2 font-medium text-gray-1000 text-sm transition-colors hover:bg-gray-alpha-100 disabled:cursor-not-allowed disabled:opacity-50", children: "Cancel" }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => void submitPayload(), disabled: isSubmitting, className: "flex cursor-pointer items-center gap-1.5 rounded-lg !border-none bg-gray-1000 px-4 py-2 font-medium text-background-100 text-sm transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:opacity-50", children: [jsxRuntimeExports.jsx(Send, { className: "size-3.5" }), isSubmitting ? "Sending..." : "Send Payload"] })] })] })] })] });
|
|
64928
64949
|
}
|
|
64929
64950
|
function useHookActions({ onResolve, callbacks }) {
|
|
64930
64951
|
const toast2 = useToast();
|
|
@@ -76498,7 +76519,7 @@ const knownMdxNames = /* @__PURE__ */ new Set([
|
|
|
76498
76519
|
"mdxTextExpression",
|
|
76499
76520
|
"mdxjsEsm"
|
|
76500
76521
|
]);
|
|
76501
|
-
const parseOptions = { sourceCodeLocationInfo: true, scriptingEnabled: false };
|
|
76522
|
+
const parseOptions$1 = { sourceCodeLocationInfo: true, scriptingEnabled: false };
|
|
76502
76523
|
function raw(tree, options) {
|
|
76503
76524
|
const document2 = documentMode(tree);
|
|
76504
76525
|
const one2 = zwitch("type", {
|
|
@@ -76506,7 +76527,7 @@ function raw(tree, options) {
|
|
|
76506
76527
|
unknown
|
|
76507
76528
|
});
|
|
76508
76529
|
const state = {
|
|
76509
|
-
parser: document2 ? new Parser(parseOptions) : Parser.getFragmentParser(void 0, parseOptions),
|
|
76530
|
+
parser: document2 ? new Parser(parseOptions$1) : Parser.getFragmentParser(void 0, parseOptions$1),
|
|
76510
76531
|
handle(node2) {
|
|
76511
76532
|
one2(node2, state);
|
|
76512
76533
|
},
|
|
@@ -91623,7 +91644,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
91623
91644
|
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 });
|
|
91624
91645
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
91625
91646
|
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 }) });
|
|
91626
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
91647
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-DMhwZQgG.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
91627
91648
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
91628
91649
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
91629
91650
|
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 }) })] }) });
|
|
@@ -91945,7 +91966,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
91945
91966
|
}, []), 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] });
|
|
91946
91967
|
};
|
|
91947
91968
|
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 }) })] });
|
|
91948
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
91969
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CK9fLYE8.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
91949
91970
|
function ke(e, t) {
|
|
91950
91971
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
91951
91972
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -92389,76 +92410,59 @@ var Nt = ({ chart: e, className: t, config: o, fullscreen: n = false, showContro
|
|
|
92389
92410
|
};
|
|
92390
92411
|
function ConversationView({ messages }) {
|
|
92391
92412
|
if (messages.length === 0) {
|
|
92392
|
-
return jsxRuntimeExports.jsx("div", { className: "
|
|
92413
|
+
return jsxRuntimeExports.jsx("div", { className: "py-8 text-center text-[11px] text-gray-600", children: "No messages" });
|
|
92393
92414
|
}
|
|
92394
92415
|
return jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3 p-3", children: messages.map((message2, index2) => jsxRuntimeExports.jsx(MessageBubble, { message: message2 }, index2)) });
|
|
92395
92416
|
}
|
|
92396
92417
|
function MessageBubble({ message: message2 }) {
|
|
92397
92418
|
const role = message2.role;
|
|
92398
92419
|
const parts = parseContent(message2.content);
|
|
92399
|
-
const
|
|
92400
|
-
return jsxRuntimeExports.jsxs("div", { className:
|
|
92401
|
-
backgroundColor: style2.bg,
|
|
92402
|
-
borderColor: style2.border
|
|
92403
|
-
}, children: [jsxRuntimeExports.jsx("div", { className: "px-2.5 py-1 border-b text-[10px] font-medium uppercase tracking-wide", style: {
|
|
92404
|
-
borderColor: style2.border,
|
|
92405
|
-
color: style2.label
|
|
92406
|
-
}, children: role }), jsxRuntimeExports.jsx("div", { className: "px-2.5 py-2 space-y-2", children: parts.map((part, i) => jsxRuntimeExports.jsx(ContentPart, { part, role }, i)) })] });
|
|
92420
|
+
const roleClasses = getRoleClasses(role);
|
|
92421
|
+
return jsxRuntimeExports.jsxs("div", { className: `rounded-md border text-[11px] ${roleClasses.bubble}`, children: [jsxRuntimeExports.jsx("div", { className: `border-b px-2.5 py-1 font-medium text-[10px] uppercase tracking-wide ${roleClasses.label}`, children: role }), jsxRuntimeExports.jsx("div", { className: "px-2.5 py-2 space-y-2", children: parts.map((part, i) => jsxRuntimeExports.jsx(ContentPart, { part, role }, i)) })] });
|
|
92407
92422
|
}
|
|
92408
92423
|
function ContentPart({ part, role }) {
|
|
92409
92424
|
if (part.type === "text") {
|
|
92410
92425
|
if (!part.text)
|
|
92411
92426
|
return null;
|
|
92412
92427
|
if (role === "assistant") {
|
|
92413
|
-
return jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none text-[11px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
92428
|
+
return jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none text-[11px] text-gray-1000 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children: jsxRuntimeExports.jsx(_r, { children: part.text }) });
|
|
92414
92429
|
}
|
|
92415
|
-
return jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap break-words
|
|
92430
|
+
return jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap break-words text-gray-1000", children: part.text });
|
|
92416
92431
|
}
|
|
92417
92432
|
if (part.type === "tool-call") {
|
|
92418
|
-
return jsxRuntimeExports.jsxs("div", { className: "rounded border px-2 py-1.5",
|
|
92419
|
-
backgroundColor: "var(--ds-purple-100)",
|
|
92420
|
-
borderColor: "var(--ds-purple-300)"
|
|
92421
|
-
}, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "🔧" }), jsxRuntimeExports.jsx("span", { style: { color: "var(--ds-purple-900)" }, children: part.toolName })] }), part.input != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 overflow-x-auto p-1.5 rounded", style: { backgroundColor: "var(--ds-gray-100)" }, children: typeof part.input === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px]", style: { color: "var(--ds-gray-800)" }, children: part.input }) : jsxRuntimeExports.jsx(DataInspector, { data: part.input }) })] });
|
|
92433
|
+
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-purple-300 bg-purple-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "🔧" }), jsxRuntimeExports.jsx("span", { className: "text-purple-900", children: part.toolName })] }), part.input != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 overflow-x-auto rounded bg-gray-100 p-1.5", children: typeof part.input === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.input }) : jsxRuntimeExports.jsx(DataInspector, { data: part.input }) })] });
|
|
92422
92434
|
}
|
|
92423
92435
|
if (part.type === "tool-result") {
|
|
92424
|
-
return jsxRuntimeExports.jsxs("div", { className: "rounded border px-2 py-1.5",
|
|
92425
|
-
backgroundColor: "var(--ds-green-100)",
|
|
92426
|
-
borderColor: "var(--ds-green-300)"
|
|
92427
|
-
}, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "✓" }), jsxRuntimeExports.jsxs("span", { style: { color: "var(--ds-green-900)" }, children: [part.toolName, " result"] })] }), part.output != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 overflow-x-auto max-h-[200px] overflow-y-auto p-1.5 rounded", style: { backgroundColor: "var(--ds-gray-100)" }, children: typeof part.output === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px]", style: { color: "var(--ds-gray-800)" }, children: part.output }) : jsxRuntimeExports.jsx(DataInspector, { data: part.output, expandLevel: 1 }) })] });
|
|
92436
|
+
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-green-300 bg-green-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "✓" }), jsxRuntimeExports.jsxs("span", { className: "text-green-900", children: [part.toolName, " result"] })] }), part.output != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 max-h-[200px] overflow-x-auto overflow-y-auto rounded bg-gray-100 p-1.5", children: typeof part.output === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.output }) : jsxRuntimeExports.jsx(DataInspector, { data: part.output, expandLevel: 1 }) })] });
|
|
92428
92437
|
}
|
|
92429
92438
|
return null;
|
|
92430
92439
|
}
|
|
92431
|
-
function
|
|
92440
|
+
function getRoleClasses(role) {
|
|
92432
92441
|
switch (role) {
|
|
92433
92442
|
case "user":
|
|
92434
92443
|
return {
|
|
92435
|
-
|
|
92436
|
-
|
|
92437
|
-
label: "var(--ds-blue-700)"
|
|
92444
|
+
bubble: "border-blue-300 bg-blue-100",
|
|
92445
|
+
label: "border-blue-300 text-blue-700"
|
|
92438
92446
|
};
|
|
92439
92447
|
case "assistant":
|
|
92440
92448
|
return {
|
|
92441
|
-
|
|
92442
|
-
|
|
92443
|
-
label: "var(--ds-gray-700)"
|
|
92449
|
+
bubble: "border-gray-300 bg-gray-100",
|
|
92450
|
+
label: "border-gray-300 text-gray-700"
|
|
92444
92451
|
};
|
|
92445
92452
|
case "system":
|
|
92446
92453
|
return {
|
|
92447
|
-
|
|
92448
|
-
|
|
92449
|
-
label: "var(--ds-amber-700)"
|
|
92454
|
+
bubble: "border-amber-300 bg-amber-100",
|
|
92455
|
+
label: "border-amber-300 text-amber-700"
|
|
92450
92456
|
};
|
|
92451
92457
|
case "tool":
|
|
92452
92458
|
return {
|
|
92453
|
-
|
|
92454
|
-
|
|
92455
|
-
label: "var(--ds-green-700)"
|
|
92459
|
+
bubble: "border-green-300 bg-green-100",
|
|
92460
|
+
label: "border-green-300 text-green-700"
|
|
92456
92461
|
};
|
|
92457
92462
|
default:
|
|
92458
92463
|
return {
|
|
92459
|
-
|
|
92460
|
-
|
|
92461
|
-
label: "var(--ds-gray-700)"
|
|
92464
|
+
bubble: "border-gray-300 bg-gray-100",
|
|
92465
|
+
label: "border-gray-300 text-gray-700"
|
|
92462
92466
|
};
|
|
92463
92467
|
}
|
|
92464
92468
|
}
|
|
@@ -92509,13 +92513,13 @@ function useSidebarDataOptional() {
|
|
|
92509
92513
|
return reactExports.useContext(SidebarDataContext);
|
|
92510
92514
|
}
|
|
92511
92515
|
const STREAM_SKELETON_ROWS = [
|
|
92512
|
-
{ id: "stream-skeleton-row-1",
|
|
92513
|
-
{ id: "stream-skeleton-row-2",
|
|
92514
|
-
{ id: "stream-skeleton-row-3",
|
|
92515
|
-
{ id: "stream-skeleton-row-4",
|
|
92516
|
+
{ id: "stream-skeleton-row-1", widthClassName: "w-[72%]" },
|
|
92517
|
+
{ id: "stream-skeleton-row-2", widthClassName: "w-[58%]" },
|
|
92518
|
+
{ id: "stream-skeleton-row-3", widthClassName: "w-4/5" },
|
|
92519
|
+
{ id: "stream-skeleton-row-4", widthClassName: "w-[64%]" }
|
|
92516
92520
|
];
|
|
92517
92521
|
function StreamViewerSkeleton() {
|
|
92518
|
-
return jsxRuntimeExports.jsxs("output", { "aria-busy": "true", "aria-label": "Loading stream", className: "flex h-full min-h-0 w-full flex-col overflow-hidden bg-background-100", children: [jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Loading stream…" }), jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center border-b border-gray-alpha-400 px-3", children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-10" }) }), jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: STREAM_SKELETON_ROWS.map((row) => jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center gap-2 border-b border-gray-alpha-400 px-3", children: [jsxRuntimeExports.jsx(Skeleton$1, { className:
|
|
92522
|
+
return jsxRuntimeExports.jsxs("output", { "aria-busy": "true", "aria-label": "Loading stream", className: "flex h-full min-h-0 w-full flex-col overflow-hidden bg-background-100", children: [jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Loading stream…" }), jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center border-b border-gray-alpha-400 px-3", children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-10" }) }), jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: STREAM_SKELETON_ROWS.map((row) => jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center gap-2 border-b border-gray-alpha-400 px-3", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: `h-3 ${row.widthClassName}` }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-4 w-4 shrink-0 rounded-sm" })] }, row.id)) })] });
|
|
92519
92523
|
}
|
|
92520
92524
|
const ChunkRow = ReactExports.memo(function ChunkRow2({ chunk }) {
|
|
92521
92525
|
return jsxRuntimeExports.jsxs("div", { className: "flex w-full items-start gap-1 border-b border-gray-alpha-400 px-3 py-2", children: [jsxRuntimeExports.jsx("div", { className: "min-w-0 flex-1", children: typeof chunk.value === "string" ? jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words text-label-12 font-mono text-gray-1000", children: chunk.value }) : jsxRuntimeExports.jsx(DataInspector, { data: chunk.value, expandLevel: 1 }) }), jsxRuntimeExports.jsx(CopyButton, { copyText: serializeForClipboard(chunk.value), ariaLabel: "Copy chunk", className: "shrink-0 -mr-1 [&>div]:h-4 [&>div]:w-4 [&_svg]:h-4 [&_svg]:w-4" })] });
|
|
@@ -92536,7 +92540,7 @@ function StreamViewer({ streamId: _streamId, chunks, isLive, error: error2, isLo
|
|
|
92536
92540
|
if (isLoading && chunks.length === 0) {
|
|
92537
92541
|
return jsxRuntimeExports.jsx(StreamViewerSkeleton, {});
|
|
92538
92542
|
}
|
|
92539
|
-
return jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden bg-background-100", children: [jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center gap-1.5 border-b border-gray-alpha-400 px-3", children: isLive && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: "inline-block h-2 w-2 rounded-full bg-green-600" }), jsxRuntimeExports.jsx("span", { className: "text-label-12 text-green-700", children: "Live" })] }) }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: error2 ? jsxRuntimeExports.jsxs("div", { className: "border-b border-red-400 bg-red-100 px-3 py-2 text-label-12 text-red-900", children: [jsxRuntimeExports.jsx("div", { children: "Error reading stream:" }), jsxRuntimeExports.jsx("div", { children: error2 })] }) : chunks.length === 0 ? jsxRuntimeExports.jsx("div", { className: "flex h-10 items-center border-b border-gray-alpha-400 bg-background-200 px-3 text-label-12 text-gray-900", children: isLive ? "Waiting for stream data..." : "Stream is empty" }) : jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: chunks.length, overscan: 10, endReached: () => onScrollEnd == null ? void 0 : onScrollEnd(), itemContent: (index2) => jsxRuntimeExports.jsx("div", { className: "w-full", children: jsxRuntimeExports.jsx(ChunkRow, { chunk: chunks[index2] }) }),
|
|
92543
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden bg-background-100", children: [jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center gap-1.5 border-b border-gray-alpha-400 px-3", children: isLive && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { className: "inline-block h-2 w-2 rounded-full bg-green-600" }), jsxRuntimeExports.jsx("span", { className: "text-label-12 text-green-700", children: "Live" })] }) }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: error2 ? jsxRuntimeExports.jsxs("div", { className: "border-b border-red-400 bg-red-100 px-3 py-2 text-label-12 text-red-900", children: [jsxRuntimeExports.jsx("div", { children: "Error reading stream:" }), jsxRuntimeExports.jsx("div", { children: error2 })] }) : chunks.length === 0 ? jsxRuntimeExports.jsx("div", { className: "flex h-10 items-center border-b border-gray-alpha-400 bg-background-200 px-3 text-label-12 text-gray-900", children: isLive ? "Waiting for stream data..." : "Stream is empty" }) : jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: chunks.length, overscan: 10, endReached: () => onScrollEnd == null ? void 0 : onScrollEnd(), itemContent: (index2) => jsxRuntimeExports.jsx("div", { className: "w-full", children: jsxRuntimeExports.jsx(ChunkRow, { chunk: chunks[index2] }) }), className: "min-h-0 flex-1" }) })] });
|
|
92540
92544
|
}
|
|
92541
92545
|
function shouldShowVerticalLine(eventType) {
|
|
92542
92546
|
if (isHookLifecycleEventType(eventType)) {
|
|
@@ -92929,9 +92933,13 @@ function cascadeSpans(runSpan, spans) {
|
|
|
92929
92933
|
};
|
|
92930
92934
|
});
|
|
92931
92935
|
}
|
|
92932
|
-
function buildTrace(run2, events2, now2) {
|
|
92933
|
-
const
|
|
92934
|
-
|
|
92936
|
+
function buildTrace(run2, events2, now2, { isCompleteHistory = false } = {}) {
|
|
92937
|
+
const duplicateEventIds = findDuplicateEventIds(events2, {
|
|
92938
|
+
isCompleteHistory
|
|
92939
|
+
});
|
|
92940
|
+
const actedOnEvents = duplicateEventIds.size === 0 ? events2 : events2.filter((event) => !duplicateEventIds.has(event.eventId));
|
|
92941
|
+
const groupedEvents = groupEventsByCorrelation(actedOnEvents);
|
|
92942
|
+
const latestKnownTime = computeLatestKnownTime(actedOnEvents, run2);
|
|
92935
92943
|
const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime);
|
|
92936
92944
|
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
92937
92945
|
const traceStartMs = otelTimeToMs(runSpan.startTime);
|
|
@@ -92948,34 +92956,72 @@ function buildTrace(run2, events2, now2) {
|
|
|
92948
92956
|
}
|
|
92949
92957
|
}
|
|
92950
92958
|
],
|
|
92951
|
-
knownDurationMs: Math.max(0, knownDurationMs)
|
|
92959
|
+
knownDurationMs: Math.max(0, knownDurationMs),
|
|
92960
|
+
duplicateEventIds
|
|
92952
92961
|
};
|
|
92953
92962
|
}
|
|
92954
|
-
const GUTTER_PX = 1;
|
|
92955
|
-
const MIN_PX = 50;
|
|
92956
|
-
const DEFAULT_START_PX = 340;
|
|
92957
|
-
function paneColTemplate(startPx) {
|
|
92958
|
-
return `${startPx}px ${GUTTER_PX}px minmax(${MIN_PX}px, 1fr)`;
|
|
92959
|
-
}
|
|
92960
|
-
const COL_TEMPLATE = paneColTemplate(DEFAULT_START_PX);
|
|
92961
92963
|
const ROWS = [
|
|
92962
|
-
{
|
|
92963
|
-
|
|
92964
|
-
|
|
92965
|
-
|
|
92966
|
-
|
|
92967
|
-
|
|
92968
|
-
|
|
92969
|
-
{
|
|
92964
|
+
{
|
|
92965
|
+
id: "r0",
|
|
92966
|
+
nameClassName: "w-[62%]",
|
|
92967
|
+
offsetClassName: "left-0",
|
|
92968
|
+
barClassName: "w-[72%]",
|
|
92969
|
+
topClassName: "top-0"
|
|
92970
|
+
},
|
|
92971
|
+
{
|
|
92972
|
+
id: "r1",
|
|
92973
|
+
nameClassName: "w-[78%]",
|
|
92974
|
+
offsetClassName: "left-[6%]",
|
|
92975
|
+
barClassName: "w-[48%]",
|
|
92976
|
+
topClassName: "top-[3.5px]"
|
|
92977
|
+
},
|
|
92978
|
+
{
|
|
92979
|
+
id: "r2",
|
|
92980
|
+
nameClassName: "w-1/2",
|
|
92981
|
+
offsetClassName: "left-[10%]",
|
|
92982
|
+
barClassName: "w-[55%]",
|
|
92983
|
+
topClassName: "top-[7px]"
|
|
92984
|
+
},
|
|
92985
|
+
{
|
|
92986
|
+
id: "r3",
|
|
92987
|
+
nameClassName: "w-[84%]",
|
|
92988
|
+
offsetClassName: "left-[18%]",
|
|
92989
|
+
barClassName: "w-[30%]",
|
|
92990
|
+
topClassName: "top-[10.5px]"
|
|
92991
|
+
},
|
|
92992
|
+
{
|
|
92993
|
+
id: "r4",
|
|
92994
|
+
nameClassName: "w-[45%]",
|
|
92995
|
+
offsetClassName: "left-[18%]",
|
|
92996
|
+
barClassName: "w-[42%]",
|
|
92997
|
+
topClassName: "top-[14px]"
|
|
92998
|
+
},
|
|
92999
|
+
{
|
|
93000
|
+
id: "r5",
|
|
93001
|
+
nameClassName: "w-[66%]",
|
|
93002
|
+
offsetClassName: "left-[34%]",
|
|
93003
|
+
barClassName: "w-[38%]",
|
|
93004
|
+
topClassName: "top-[17.5px]"
|
|
93005
|
+
},
|
|
93006
|
+
{
|
|
93007
|
+
id: "r6",
|
|
93008
|
+
nameClassName: "w-[55%]",
|
|
93009
|
+
offsetClassName: "left-[41%]",
|
|
93010
|
+
barClassName: "w-1/4",
|
|
93011
|
+
topClassName: "top-[21px]"
|
|
93012
|
+
},
|
|
93013
|
+
{
|
|
93014
|
+
id: "r7",
|
|
93015
|
+
nameClassName: "w-2/5",
|
|
93016
|
+
offsetClassName: "left-1/2",
|
|
93017
|
+
barClassName: "w-[30%]",
|
|
93018
|
+
topClassName: "top-[24.5px]"
|
|
93019
|
+
}
|
|
92970
93020
|
];
|
|
92971
93021
|
const HEADER_MARKERS = ["m0", "m1", "m2", "m3"];
|
|
92972
93022
|
const HeaderDivider = () => jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "h-full w-px bg-gray-alpha-400" }) });
|
|
92973
93023
|
function TraceViewerSkeleton() {
|
|
92974
|
-
return jsxRuntimeExports.jsxs("output", { "aria-busy": "true", "aria-label": "Loading trace", className: "flex flex-col w-full h-full min-h-0 bg-background-100", children: [jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Loading trace…" }), jsxRuntimeExports.jsx("div", { className: "relative h-10 min-h-10 shrink-0 border-b border-gray-alpha-400", children: jsxRuntimeExports.jsx("div", { className: "absolute inset-x-4 top-[6px]", children: ROWS.map((row,
|
|
92975
|
-
left: `${row.off}%`,
|
|
92976
|
-
width: `${row.bar}%`,
|
|
92977
|
-
top: index2 * 3.5
|
|
92978
|
-
} }, row.id)) }) }), jsxRuntimeExports.jsxs("div", { className: "shrink-0 grid", style: { gridTemplateColumns: COL_TEMPLATE }, children: [jsxRuntimeExports.jsxs("div", { className: "h-10 min-h-10 flex items-center border-b border-gray-alpha-400 pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "w-3.5 h-3.5 shrink-0 rounded-sm" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-40" })] }), jsxRuntimeExports.jsx(HeaderDivider, {}), jsxRuntimeExports.jsx("div", { className: "h-10 min-h-10 flex items-end border-b border-gray-alpha-400 px-4 pb-1 gap-2", children: jsxRuntimeExports.jsx("div", { className: "relative flex-1 flex items-end justify-between", children: HEADER_MARKERS.map((id2) => jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-9" }, id2)) }) })] }), jsxRuntimeExports.jsxs("div", { className: "grid flex-1 min-h-0 overflow-hidden", style: { gridTemplateColumns: COL_TEMPLATE }, children: [jsxRuntimeExports.jsx("div", { className: "block overflow-visible", children: jsxRuntimeExports.jsx("ul", { className: "block divide-y divide-gray-alpha-400 border-b border-gray-alpha-400", children: ROWS.map((row) => jsxRuntimeExports.jsxs("li", { className: "h-10 flex items-center pl-4 pr-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "w-4 h-4 shrink-0 rounded-sm" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5", style: { width: `${row.name}%` } })] }), jsxRuntimeExports.jsx(Skeleton$1, { className: "ml-2 h-3.5 w-10 shrink-0" })] }, row.id)) }) }), jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "h-full w-px bg-gray-alpha-400" }), jsxRuntimeExports.jsx("div", { className: "relative min-h-0", children: ROWS.map((row) => jsxRuntimeExports.jsx("div", { className: "relative h-10", children: jsxRuntimeExports.jsx("div", { className: "absolute inset-x-4 inset-y-0", children: jsxRuntimeExports.jsx(Skeleton$1, { className: "absolute top-1/2 -translate-y-1/2 h-6 rounded-[0.25rem]", style: { left: `${row.off}%`, width: `${row.bar}%` } }) }) }, row.id)) })] })] });
|
|
93024
|
+
return jsxRuntimeExports.jsxs("output", { "aria-busy": "true", "aria-label": "Loading trace", className: "flex flex-col w-full h-full min-h-0 bg-background-100", children: [jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Loading trace…" }), jsxRuntimeExports.jsx("div", { className: "relative h-10 min-h-10 shrink-0 border-b border-gray-alpha-400", children: jsxRuntimeExports.jsx("div", { className: "absolute inset-x-4 top-[6px]", children: ROWS.map((row) => jsxRuntimeExports.jsx(Skeleton$1, { className: `absolute h-[3px] rounded-full ${row.offsetClassName} ${row.barClassName} ${row.topClassName}` }, row.id)) }) }), jsxRuntimeExports.jsxs("div", { className: "grid shrink-0 grid-cols-[340px_1px_minmax(50px,1fr)]", children: [jsxRuntimeExports.jsxs("div", { className: "h-10 min-h-10 flex items-center border-b border-gray-alpha-400 pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "w-3.5 h-3.5 shrink-0 rounded-sm" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-40" })] }), jsxRuntimeExports.jsx(HeaderDivider, {}), jsxRuntimeExports.jsx("div", { className: "h-10 min-h-10 flex items-end border-b border-gray-alpha-400 px-4 pb-1 gap-2", children: jsxRuntimeExports.jsx("div", { className: "relative flex-1 flex items-end justify-between", children: HEADER_MARKERS.map((id2) => jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-9" }, id2)) }) })] }), jsxRuntimeExports.jsxs("div", { className: "grid min-h-0 flex-1 grid-cols-[340px_1px_minmax(50px,1fr)] overflow-hidden", children: [jsxRuntimeExports.jsx("div", { className: "block overflow-visible", children: jsxRuntimeExports.jsx("ul", { className: "block divide-y divide-gray-alpha-400 border-b border-gray-alpha-400", children: ROWS.map((row) => jsxRuntimeExports.jsxs("li", { className: "h-10 flex items-center pl-4 pr-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "w-4 h-4 shrink-0 rounded-sm" }), jsxRuntimeExports.jsx(Skeleton$1, { className: `h-3.5 ${row.nameClassName}` })] }), jsxRuntimeExports.jsx(Skeleton$1, { className: "ml-2 h-3.5 w-10 shrink-0" })] }, row.id)) }) }), jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "h-full w-px bg-gray-alpha-400" }), jsxRuntimeExports.jsx("div", { className: "relative min-h-0", children: ROWS.map((row) => jsxRuntimeExports.jsx("div", { className: "relative h-10", children: jsxRuntimeExports.jsx("div", { className: "absolute inset-x-4 inset-y-0", children: jsxRuntimeExports.jsx(Skeleton$1, { className: `absolute top-1/2 h-6 -translate-y-1/2 rounded-[0.25rem] ${row.offsetClassName} ${row.barClassName}` }) }) }, row.id)) })] })] });
|
|
92979
93025
|
}
|
|
92980
93026
|
function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargin = "0%", freezeOnceVisible = false } = {}) {
|
|
92981
93027
|
const [entry2, setEntry] = reactExports.useState();
|
|
@@ -93055,11 +93101,6 @@ const kbdVariants = cva("inline-flex items-center justify-center rounded px-1 te
|
|
|
93055
93101
|
function Kbd({ children: children2, className, variant, size: size2, ...props }) {
|
|
93056
93102
|
return jsxRuntimeExports.jsx("kbd", { className: cn$4(kbdVariants({ variant, size: size2, className })), ...props, children: children2 });
|
|
93057
93103
|
}
|
|
93058
|
-
const TooltipProvider = Provider$2;
|
|
93059
|
-
const Tooltip$1 = Root3$1;
|
|
93060
|
-
const TooltipTrigger$1 = Trigger$4;
|
|
93061
|
-
const TooltipContent$1 = reactExports.forwardRef(({ className, sideOffset = 8, showArrow = true, children: children2, ...props }, ref) => jsxRuntimeExports.jsx(Portal$6, { children: jsxRuntimeExports.jsxs(Content2$4, { ref, sideOffset, className: cn$4("z-[99999] flex items-center gap-1 rounded-[10px] bg-gray-1000 px-2 py-1.5 !text-label-13 text-background-100 shadow-md select-none", className), ...props, children: [children2, showArrow ? jsxRuntimeExports.jsx(Arrow2$1, { width: 11, height: 5, className: "fill-gray-1000" }) : null] }) }));
|
|
93062
|
-
TooltipContent$1.displayName = Content2$4.displayName;
|
|
93063
93104
|
const millisecondsInWeek = 6048e5;
|
|
93064
93105
|
const millisecondsInDay = 864e5;
|
|
93065
93106
|
const millisecondsInMinute = 6e4;
|
|
@@ -95151,7 +95192,7 @@ const formatEventTimestamp = (date2) => date2.toLocaleString(void 0, {
|
|
|
95151
95192
|
fractionalSecondDigits: 3,
|
|
95152
95193
|
timeZoneName: "short"
|
|
95153
95194
|
});
|
|
95154
|
-
function EventItem({ event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps = false }) {
|
|
95195
|
+
function EventItem({ event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps = false, isDuplicate = false }) {
|
|
95155
95196
|
const [loadedData, setLoadedData] = reactExports.useState(null);
|
|
95156
95197
|
const [isLoading, setIsLoading] = reactExports.useState(false);
|
|
95157
95198
|
const [loadError, setLoadError] = reactExports.useState(null);
|
|
@@ -95203,7 +95244,7 @@ function EventItem({ event, onLoadEventData, encryptionKey, showSeparateEventOcc
|
|
|
95203
95244
|
return jsxRuntimeExports.jsxs(CollapsibleRoot, { variant: "card", onOpenChange: canHaveData ? (open2) => {
|
|
95204
95245
|
if (open2)
|
|
95205
95246
|
handleExpand();
|
|
95206
|
-
} : void 0, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { className: "px-3 py-2", children: jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-3", children: [jsxRuntimeExports.jsx("span", { className:
|
|
95247
|
+
} : void 0, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { className: "px-3 py-2", children: jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-3", children: [jsxRuntimeExports.jsx(DuplicateEventTooltip, { isDuplicate, children: jsxRuntimeExports.jsx("span", { className: `text-label-12 font-mono ${isDuplicate ? "text-gray-700" : "text-gray-1000"}`, children: event.eventType }) }), jsxRuntimeExports.jsx("span", { className: "shrink-0 text-label-13 text-gray-900", children: displayedCreatedAtTime })] }) }), jsxRuntimeExports.jsxs(CollapsibleContent, { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col bg-background-200 [&:has(+_*)]:border-b [&:has(+_*)]:border-gray-alpha-400", children: [showSeparateEventOccurrenceTimestamps && occurredAt && jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Occurred" }), jsxRuntimeExports.jsx(TimestampTooltip, { date: occurredAt, children: jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: formatEventTimestamp(occurredAt) }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Event ID" }), jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: event.eventId })] }), event.correlationId && jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Correlation ID" }), jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: event.correlationId })] })] }), isLoading && jsxRuntimeExports.jsxs("div", { className: "p-3", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "h-4 w-[35%]" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "mt-2 h-4 w-[90%]" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "mt-2 h-4 w-[75%]" })] }), loadError && jsxRuntimeExports.jsx(ErrorCard, { title: "Failed to load event data", details: loadError, className: "mt-2" }), displayPayload != null && jsxRuntimeExports.jsx("div", { className: "[&>div]:border-none [&>div]:rounded-none", children: jsxRuntimeExports.jsx(EventDataBlock, { eventType: event.eventType, data: displayPayload }) })] })] });
|
|
95207
95248
|
}
|
|
95208
95249
|
function hasOnlyExpiredFields(data, eventType) {
|
|
95209
95250
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
@@ -95239,13 +95280,13 @@ function EventDataBlock({ eventType, data }) {
|
|
|
95239
95280
|
}
|
|
95240
95281
|
return jsxRuntimeExports.jsx(CopyableDataBlock, { data });
|
|
95241
95282
|
}
|
|
95242
|
-
function EventsList({ events: events2, isLoading = false, error: error2, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps = false }) {
|
|
95283
|
+
function EventsList({ events: events2, isLoading = false, error: error2, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps = false, duplicateEventIds }) {
|
|
95243
95284
|
const sortedEvents = reactExports.useMemo(() => [...events2].sort((a2, b2) => getEffectiveEventDate(a2).getTime() - getEffectiveEventDate(b2).getTime()), [events2]);
|
|
95244
95285
|
const hasEvents = sortedEvents.length > 0 && !error2;
|
|
95245
95286
|
if (!hasEvents && !isLoading) {
|
|
95246
95287
|
return jsxRuntimeExports.jsx(Collapsible, { label: "Events", disabled: true });
|
|
95247
95288
|
}
|
|
95248
|
-
return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Events" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-0", children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps }, event.eventId)) }) })] }) }) });
|
|
95289
|
+
return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Events" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-0", children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton$1, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps, isDuplicate: duplicateEventIds == null ? void 0 : duplicateEventIds.has(event.eventId) }, event.eventId)) }) })] }) }) });
|
|
95249
95290
|
}
|
|
95250
95291
|
const hasField = (value, key) => key in value;
|
|
95251
95292
|
const RESOURCES_WITH_FETCHED_DETAIL = /* @__PURE__ */ new Set(["run", "step", "sleep"]);
|
|
@@ -95565,7 +95606,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, fetchSpanDeta
|
|
|
95565
95606
|
}, children: [jsxRuntimeExports.jsx(Zap, { className: "h-4 w-4" }), stoppingSleep ? "Waking up..." : "Wake Up Sleep"] }), resource === "hook" && canResolveHook && jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => setShowResolveHookModal(true), disabled: resolvingHook, className: clsx("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-button-14", "disabled:opacity-50 disabled:cursor-not-allowed transition-colors", resolvingHook ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), style: {
|
|
95566
95607
|
background: "var(--ds-gray-1000)",
|
|
95567
95608
|
color: "var(--ds-background-100)"
|
|
95568
|
-
}, children: [jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), "Resolve Hook"] })] })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, moduleSourceUrl, expiredAt: run2.expiredAt, isLoading: loading, error: error2 ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, resource }), rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
95609
|
+
}, children: [jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), "Resolve Hook"] })] })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, moduleSourceUrl, expiredAt: run2.expiredAt, isLoading: loading, error: error2 ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, resource }), rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps, duplicateEventIds: selectedSpan == null ? void 0 : selectedSpan.duplicateEventIds })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
95569
95610
|
}
|
|
95570
95611
|
const ActiveSpanContext = reactExports.createContext(null);
|
|
95571
95612
|
ActiveSpanContext.displayName = "ActiveSpanContext";
|
|
@@ -95787,7 +95828,8 @@ function useSelectedSpanInfo() {
|
|
|
95787
95828
|
data: (_b2 = activeSpan.attributes) == null ? void 0 : _b2.data,
|
|
95788
95829
|
resource,
|
|
95789
95830
|
spanId: activeSpan.spanId,
|
|
95790
|
-
rawEvents
|
|
95831
|
+
rawEvents,
|
|
95832
|
+
duplicateEventIds: sidebar.duplicateEventIds
|
|
95791
95833
|
};
|
|
95792
95834
|
}, [activeSpan, sidebar]);
|
|
95793
95835
|
}
|
|
@@ -95863,16 +95905,16 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
95863
95905
|
return jsxRuntimeExports.jsxs("aside", { ref: asideRef, id: DETAIL_PANEL_ID, className: "relative flex flex-col h-full max-h-full shrink-0 bg-background-100 border-l border-gray-alpha-400", style: { width: panelWidth }, children: [jsxRuntimeExports.jsx(DraggableBorder, { element: asideRef, position: "left", onWidthChange: handleResize, onReset: () => handleResize(PANEL_DEFAULT_WIDTH), "aria-label": "Resize span details panel", "aria-controls": DETAIL_PANEL_ID, "aria-valuemin": PANEL_MIN_WIDTH, "aria-valuemax": panelMaxWidth, "aria-valuenow": Math.min(Math.max(Math.round(panelWidth), PANEL_MIN_WIDTH), panelMaxWidth) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 shrink-0 px-4 py-[7.5px]", children: [jsxRuntimeExports.jsx("span", { className: "text-label-14 font-medium text-gray-1000 truncate block", children: selectedSpanName }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5 shrink-0", children: [jsxRuntimeExports.jsxs(Tooltip$1, { children: [jsxRuntimeExports.jsx(TooltipTrigger$1, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate up", "aria-keyshortcuts": "K", onClick: handleSelectPrev, disabled: !prevSpanId, children: jsxRuntimeExports.jsx(ChevronUp, { className: "w-4 h-4" }) }) }), prevSpanId ? jsxRuntimeExports.jsxs(TooltipContent$1, { children: ["Navigate up", jsxRuntimeExports.jsx(Kbd, { children: "K" })] }) : null] }), jsxRuntimeExports.jsxs(Tooltip$1, { children: [jsxRuntimeExports.jsx(TooltipTrigger$1, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate down", "aria-keyshortcuts": "J", onClick: handleSelectNext, disabled: !nextSpanId, children: jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4" }) }) }), nextSpanId ? jsxRuntimeExports.jsxs(TooltipContent$1, { children: ["Navigate down", jsxRuntimeExports.jsx(Kbd, { children: "J" })] }) : null] }), jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "w-px h-4 bg-gray-alpha-400 mx-1" }), jsxRuntimeExports.jsx(IconButton, { "aria-label": "Close span details", "aria-keyshortcuts": "Escape", onClick: onClose, children: jsxRuntimeExports.jsx(X$3, { className: "w-4 h-4" }) })] })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary$1, { children: jsxRuntimeExports.jsx(EntityDetailPanel, { run: sidebar.run, onStreamClick: sidebar.onStreamClick, onRunClick: sidebar.onRunClick, fetchSpanDetail: sidebar.fetchSpanDetail, onWakeUpSleep: sidebar.onWakeUpSleep, onLoadEventData: sidebar.onLoadEventData, onResolveHook: sidebar.onResolveHook, encryptionKey: sidebar.encryptionKey, onDecrypt: sidebar.onDecrypt, isDecrypting: sidebar.isDecrypting, selectedSpan, showSeparateEventOccurrenceTimestamps: sidebar.showSeparateEventOccurrenceTimestamps, getModuleSourceUrl: sidebar.getModuleSourceUrl }) }) })] });
|
|
95864
95906
|
}
|
|
95865
95907
|
const WorkflowIcon = () => {
|
|
95866
|
-
return jsxRuntimeExports.jsx("svg", { "data-testid": "geist-icon", height: "16", strokeLinejoin: "round",
|
|
95908
|
+
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { d: "M5.75 7L6.4209 7.33594L4.85254 10.4717C5.38789 10.771 5.75 11.3431 5.75 12V14C5.75 14.9665 4.96648 15.75 4 15.75H2C1.03352 15.75 0.25 14.9665 0.25 14V12C0.25 11.0335 1.03352 10.25 2 10.25H3.28711L5.0791 6.66504L5.75 7ZM14 10.25C14.9665 10.25 15.75 11.0335 15.75 12V14C15.75 14.9665 14.9665 15.75 14 15.75H12C11.1185 15.75 10.3909 15.098 10.2695 14.25H7V12.75H10.25V12C10.25 11.0335 11.0335 10.25 12 10.25H14ZM2 11.75C1.86192 11.75 1.75 11.8619 1.75 12V14C1.75 14.1381 1.86192 14.25 2 14.25H4C4.13808 14.25 4.25 14.1381 4.25 14V12C4.25 11.8619 4.13808 11.75 4 11.75H2ZM12 11.75C11.8619 11.75 11.75 11.8619 11.75 12V14C11.75 14.1381 11.8619 14.25 12 14.25H14C14.1381 14.25 14.25 14.1381 14.25 14V12C14.25 11.8619 14.1381 11.75 14 11.75H12ZM9 0.25C9.96649 0.25 10.75 1.03351 10.75 2V4C10.75 4.44642 10.5808 4.85197 10.3057 5.16113L12.2041 8.6416L10.8877 9.36035L8.91895 5.75H7C6.03351 5.75 5.25 4.96649 5.25 4V2C5.25 1.03351 6.03351 0.25 7 0.25H9ZM7 1.75C6.86193 1.75 6.75 1.86193 6.75 2V4C6.75 4.13807 6.86193 4.25 7 4.25H9C9.13807 4.25 9.25 4.13807 9.25 4V2C9.25 1.86193 9.13807 1.75 9 1.75H7Z", fill: "currentColor" }) });
|
|
95867
95909
|
};
|
|
95868
95910
|
const WebhookIcon = () => {
|
|
95869
|
-
return jsxRuntimeExports.jsx("svg", { "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16",
|
|
95911
|
+
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.8349 3.24994C5.14454 4.44567 5.55423 5.97464 6.74996 6.665L7.39465 7.03721L7.02726 7.68466L5.14599 11C5.21289 11.1531 5.25 11.3222 5.25 11.5C5.25 12.1904 4.69036 12.75 4 12.75C3.30964 12.75 2.75 12.1904 2.75 11.5C2.75 10.8634 3.22584 10.338 3.84123 10.26L5.38944 7.5316C3.95909 6.30274 3.55857 4.19264 4.53586 2.49994C5.64043 0.586765 8.08679 -0.0687357 9.99996 1.03583C11.836 2.09584 12.5137 4.39156 11.5892 6.26591L10.4949 4.33754C10.4418 3.53274 10.0009 2.76843 9.24996 2.33487C8.05423 1.64452 6.52525 2.0542 5.8349 3.24994ZM9.146 4.99996C9.21289 4.84686 9.25 4.67776 9.25 4.5C9.25 3.80964 8.69036 3.25 8 3.25C7.30964 3.25 6.75 3.80964 6.75 4.5C6.75 5.13659 7.22586 5.66203 7.84127 5.74002L9.72266 9.05556L10.0956 9.71274L10.75 9.33493C11.9457 8.64458 13.4747 9.05427 14.165 10.25C14.8554 11.4457 14.4457 12.9747 13.25 13.6651C12.5047 14.0953 11.63 14.0983 10.9096 13.75H8.69252C9.85895 15.4685 12.1727 16.0191 14 14.9641C15.9131 13.8595 16.5686 11.4132 15.4641 9.5C14.4886 7.81038 12.4665 7.10169 10.6895 7.71998L9.146 4.99996ZM13.25 11.5C13.25 12.1904 12.6904 12.75 12 12.75C11.591 12.75 11.228 12.5536 10.9999 12.25H7.9298C7.57875 14.1006 5.95279 15.5 4 15.5C1.79086 15.5 0 13.7091 0 11.5C0 9.40018 1.61801 7.67826 3.67529 7.51299L2.58098 9.44147C1.92792 9.89251 1.5 10.6463 1.5 11.5C1.5 12.8807 2.61929 14 4 14C5.38071 14 6.5 12.8807 6.5 11.5V10.75H7.25H10.9999C11.228 10.4464 11.591 10.25 12 10.25C12.6904 10.25 13.25 10.8096 13.25 11.5Z", fill: "currentColor" }) });
|
|
95870
95912
|
};
|
|
95871
95913
|
const SleepIcon = () => {
|
|
95872
|
-
return jsxRuntimeExports.jsx("svg", { "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16",
|
|
95914
|
+
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.25 1.25V2.03971C5.87928 2.18571 4.62678 2.72736 3.6089 3.54824L3.03033 2.96967L2.5 2.43934L1.43934 3.5L1.96967 4.03033L2.54824 4.6089C1.57979 5.80976 1 7.33717 1 9C1 12.866 4.13401 16 8 16C11.866 16 15 12.866 15 9C15 7.33717 14.4202 5.80976 13.4518 4.6089L14.0303 4.03033L14.5607 3.5L13.5 2.43934L12.9697 2.96967L12.3911 3.54824C11.3732 2.72736 10.1207 2.18571 8.75 2.03971V1.25H9.25H10V-0.25H9.25H8.75H7.25H6.75H6V1.25H6.75H7.25ZM2.5 9C2.5 5.96243 4.96243 3.5 8 3.5C11.0376 3.5 13.5 5.96243 13.5 9C13.5 12.0376 11.0376 14.5 8 14.5C4.96243 14.5 2.5 12.0376 2.5 9ZM8.75 6.75V6H7.25V6.75V9V9.75H8.75V9V6.75Z", fill: "currentColor" }) });
|
|
95873
95915
|
};
|
|
95874
95916
|
const StepForwardIcon = () => {
|
|
95875
|
-
return jsxRuntimeExports.jsx("svg", { "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16",
|
|
95917
|
+
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.21969 12.5303L4.75002 13.0607L5.81068 12L5.28035 11.4697L1.81068 7.99999L5.28035 4.53032L5.81068 3.99999L4.75002 2.93933L4.21969 3.46966L0.39647 7.29289C0.00594562 7.68341 0.00594562 8.31658 0.39647 8.7071L4.21969 12.5303ZM11.7804 12.5303L11.25 13.0607L10.1894 12L10.7197 11.4697L14.1894 7.99999L10.7197 4.53032L10.1894 3.99999L11.25 2.93933L11.7804 3.46966L15.6036 7.29289C15.9941 7.68341 15.9941 8.31658 15.6036 8.7071L11.7804 12.5303Z", fill: "currentColor" }) });
|
|
95876
95918
|
};
|
|
95877
95919
|
const ATTR_FILTER_REGEX = /(?:^|\s)(?<pair>(?<key>[\w.]+):(?<value>\S*))/g;
|
|
95878
95920
|
function parseSpanSearchQuery(rawQuery) {
|
|
@@ -96150,41 +96192,31 @@ function computeSpanDelta(anchor, hovered, viewStart, viewEnd) {
|
|
|
96150
96192
|
hoveredOffscreen: hoveredStart > viewEnd ? "right" : hoveredEnd < viewStart ? "left" : null
|
|
96151
96193
|
};
|
|
96152
96194
|
}
|
|
96153
|
-
const
|
|
96195
|
+
const RESOURCE_CLASS_NAMES = {
|
|
96154
96196
|
run: {
|
|
96155
|
-
|
|
96156
|
-
|
|
96157
|
-
errorBg: "var(--ds-red-200)",
|
|
96158
|
-
errorBorder: "var(--ds-red-500)"
|
|
96197
|
+
className: "border-blue-500 bg-blue-200",
|
|
96198
|
+
errorClassName: "border-red-500 bg-red-200"
|
|
96159
96199
|
},
|
|
96160
96200
|
step: {
|
|
96161
|
-
|
|
96162
|
-
|
|
96163
|
-
errorBg: "var(--ds-red-200)",
|
|
96164
|
-
errorBorder: "var(--ds-red-500)"
|
|
96201
|
+
className: "border-green-500 bg-green-200",
|
|
96202
|
+
errorClassName: "border-red-500 bg-red-200"
|
|
96165
96203
|
},
|
|
96166
96204
|
// Passive spans (hooks) stay gray — matches event-list icons and the minimap.
|
|
96167
96205
|
hook: {
|
|
96168
|
-
|
|
96169
|
-
|
|
96170
|
-
errorBg: "var(--ds-red-200)",
|
|
96171
|
-
errorBorder: "var(--ds-red-500)"
|
|
96206
|
+
className: "border-gray-500 bg-gray-200",
|
|
96207
|
+
errorClassName: "border-red-500 bg-red-200"
|
|
96172
96208
|
},
|
|
96173
96209
|
sleep: {
|
|
96174
|
-
|
|
96175
|
-
|
|
96176
|
-
errorBg: "var(--ds-red-200)",
|
|
96177
|
-
errorBorder: "var(--ds-red-500)"
|
|
96210
|
+
className: "border-purple-500 bg-purple-200",
|
|
96211
|
+
errorClassName: "border-red-500 bg-red-200"
|
|
96178
96212
|
},
|
|
96179
96213
|
default: {
|
|
96180
|
-
|
|
96181
|
-
|
|
96182
|
-
errorBg: "var(--ds-red-200)",
|
|
96183
|
-
errorBorder: "var(--ds-red-500)"
|
|
96214
|
+
className: "border-gray-500 bg-gray-200",
|
|
96215
|
+
errorClassName: "border-red-500 bg-red-200"
|
|
96184
96216
|
}
|
|
96185
96217
|
};
|
|
96186
|
-
function
|
|
96187
|
-
return
|
|
96218
|
+
function getResourceClassNames(resource) {
|
|
96219
|
+
return RESOURCE_CLASS_NAMES[resource] ?? RESOURCE_CLASS_NAMES.default;
|
|
96188
96220
|
}
|
|
96189
96221
|
function clampFraction(value) {
|
|
96190
96222
|
return Math.max(0, Math.min(1, value));
|
|
@@ -96563,10 +96595,6 @@ const SEGMENT_CLASSES = {
|
|
|
96563
96595
|
sleeping: "bg-gray-400 border border-gray-500",
|
|
96564
96596
|
received: "bg-blue-200 border border-blue-500"
|
|
96565
96597
|
};
|
|
96566
|
-
const TIMELINE_INSET_STYLE = {
|
|
96567
|
-
left: TIMELINE_PADDING_PX,
|
|
96568
|
-
right: TIMELINE_PADDING_PX
|
|
96569
|
-
};
|
|
96570
96598
|
const STRIPED_SEGMENT_STATUSES = /* @__PURE__ */ new Set([
|
|
96571
96599
|
"pending",
|
|
96572
96600
|
"running",
|
|
@@ -96647,8 +96675,8 @@ function BoundaryArrow({ direction }) {
|
|
|
96647
96675
|
const Icon2 = direction === "right" ? ArrowRight : ArrowLeft;
|
|
96648
96676
|
return jsxRuntimeExports.jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-[0.25rem]", children: jsxRuntimeExports.jsx(Icon2, { className: "size-3 text-gray-900" }) });
|
|
96649
96677
|
}
|
|
96650
|
-
function PlainBar({
|
|
96651
|
-
return jsxRuntimeExports.jsx("div", { className: "relative h-6 w-full min-w-1 rounded-[0.25rem] border",
|
|
96678
|
+
function PlainBar({ className, label }) {
|
|
96679
|
+
return jsxRuntimeExports.jsx("div", { className: cn$4("relative h-6 w-full min-w-1 rounded-[0.25rem] border", className), children: label ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null });
|
|
96652
96680
|
}
|
|
96653
96681
|
function LeadInConnector({ leftPct, widthPct, label }) {
|
|
96654
96682
|
return jsxRuntimeExports.jsxs("div", { className: "absolute top-1/2 h-6 -translate-y-1/2", style: {
|
|
@@ -96668,11 +96696,10 @@ function SegmentBar({ segments, showLabels = true }) {
|
|
|
96668
96696
|
}
|
|
96669
96697
|
const label = formatDurationPrecise(seg.fullDurationMs);
|
|
96670
96698
|
const showLabel = showLabels && seg.pixelWidth >= Math.max(40, estimateLabelWidthPx(label));
|
|
96671
|
-
return jsxRuntimeExports.jsxs("div", { className: cn$4("absolute h-full overflow-hidden rounded-[0.25rem]", SEGMENT_CLASSES[seg.status]), style: {
|
|
96699
|
+
return jsxRuntimeExports.jsxs("div", { className: cn$4("absolute h-full min-w-px overflow-hidden rounded-[0.25rem]", SEGMENT_CLASSES[seg.status]), style: {
|
|
96672
96700
|
// 1px gap between adjacent segments, distributed equally.
|
|
96673
96701
|
left: `calc(${seg.leftPct}% + 0.5px)`,
|
|
96674
|
-
width: `calc(${seg.widthPct}% - 1px)
|
|
96675
|
-
minWidth: 1
|
|
96702
|
+
width: `calc(${seg.widthPct}% - 1px)`
|
|
96676
96703
|
}, children: [STRIPED_SEGMENT_STATUSES.has(seg.status) ? jsxRuntimeExports.jsx(AnimatedStripes, { status: seg.status }) : null, showLabel ? jsxRuntimeExports.jsx(DurationLabel, { label }) : null] }, i);
|
|
96677
96704
|
}) });
|
|
96678
96705
|
}
|
|
@@ -96688,15 +96715,14 @@ const TimelineBar = reactExports.memo(function TimelineBar2({ span, viewStart, v
|
|
|
96688
96715
|
const offscreen = reactExports.useMemo(() => geometry.mode.kind === "full" ? computeOffscreenMarkers(baseMarkers, geometry.visibleStartMs, geometry.visibleEndMs) : { left: null, right: null }, [geometry, baseMarkers]);
|
|
96689
96716
|
const hasMarkers = markers.length > 0 || offscreen.left !== null || offscreen.right !== null;
|
|
96690
96717
|
const isErrored = isSpanErrored(span);
|
|
96691
|
-
const colors =
|
|
96692
|
-
const
|
|
96693
|
-
const fallbackBorder = isErrored ? colors.errorBorder ?? "var(--ds-red-500)" : colors.border;
|
|
96718
|
+
const colors = getResourceClassNames(span.resource);
|
|
96719
|
+
const fallbackClassName = isErrored ? colors.errorClassName ?? "border-red-500 bg-red-200" : colors.className;
|
|
96694
96720
|
const totalLabel = formatDurationPrecise(totalDurationMs);
|
|
96695
96721
|
const showTotalLabel = geometry.visiblePixelWidth >= Math.max(40, estimateLabelWidthPx(totalLabel));
|
|
96696
96722
|
const handleClick = reactExports.useCallback(() => {
|
|
96697
96723
|
onSelect(span.spanId);
|
|
96698
96724
|
}, [onSelect, span.spanId]);
|
|
96699
|
-
return jsxRuntimeExports.jsx("div", { role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, className: cn$4("group/timeline-row h-10 relative flex items-center hover:bg-gray-100 aria-selected:bg-gray-100 aria-selected:hover:bg-gray-200 transition-opacity", isDimmed && "opacity-35"), onClick: handleClick, children: jsxRuntimeExports.jsxs("div", { className: "absolute inset-y-0",
|
|
96725
|
+
return jsxRuntimeExports.jsx("div", { role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, className: cn$4("group/timeline-row h-10 relative flex items-center hover:bg-gray-100 aria-selected:bg-gray-100 aria-selected:hover:bg-gray-200 transition-opacity", isDimmed && "opacity-35"), onClick: handleClick, children: jsxRuntimeExports.jsxs("div", { className: "absolute inset-x-4 inset-y-0", children: [jsxRuntimeExports.jsx("div", { className: "absolute top-1/2 h-6 -translate-y-1/2 overflow-hidden rounded-[0.25rem]", style: getBarPositionStyle(geometry), children: geometry.mode.kind === "arrow" ? jsxRuntimeExports.jsx(BoundaryArrow, { direction: geometry.mode.direction }) : geometry.mode.kind === "tiny" ? jsxRuntimeExports.jsx("div", { className: cn$4("h-6 rounded-[0.25rem] border", fallbackClassName) }) : segments.length > 0 ? jsxRuntimeExports.jsx(SegmentBar, { segments, showLabels: !hasMarkers }) : jsxRuntimeExports.jsx(PlainBar, { className: fallbackClassName, label: showTotalLabel ? totalLabel : null }) }), hasMarkers ? jsxRuntimeExports.jsxs("div", { className: "pointer-events-none absolute top-1/2 h-6 -translate-y-1/2", style: getBarPositionStyle(geometry), children: [markers.length > 0 ? jsxRuntimeExports.jsx(MarkerLayer, { markers }) : null, offscreen.left ? jsxRuntimeExports.jsx(OffscreenMarkerIndicator, { direction: "left", count: offscreen.left.count, targetMs: offscreen.left.nearestMs, onReveal: onRevealTime }) : null, offscreen.right ? jsxRuntimeExports.jsx(OffscreenMarkerIndicator, { direction: "right", count: offscreen.right.count, targetMs: offscreen.right.nearestMs, onReveal: onRevealTime }) : null, showTotalLabel ? jsxRuntimeExports.jsx(DurationLabel, {
|
|
96700
96726
|
label: totalLabel,
|
|
96701
96727
|
// Shift clear of the left edge indicator so it isn't covered.
|
|
96702
96728
|
className: offscreen.left ? "pl-10" : void 0
|
|
@@ -96717,9 +96743,8 @@ const DeltaMeasureLine = reactExports.memo(function DeltaMeasureLine2({ delta, a
|
|
|
96717
96743
|
const label = formatDurationPrecise(delta.deltaMs);
|
|
96718
96744
|
const labelWidthPx = estimateLabelWidthPx(label);
|
|
96719
96745
|
const labelPlacement = endX - startX >= labelWidthPx ? { left: (startX + endX) / 2, translate: "-translate-x-1/2" } : endX + 4 + labelWidthPx <= timelineWidth ? { left: endX + 4, translate: "" } : { left: startX - 4, translate: "-translate-x-full" };
|
|
96720
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "absolute h-px bg-amber-800", style: {
|
|
96746
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "absolute h-px w-1 bg-amber-800", style: {
|
|
96721
96747
|
left: Math.min(anchorX, guideX),
|
|
96722
|
-
width: MEASURE_GUIDE_OUTSET_PX,
|
|
96723
96748
|
top: anchorCenterY
|
|
96724
96749
|
} }), jsxRuntimeExports.jsx("div", { className: "absolute w-px bg-amber-800", style: {
|
|
96725
96750
|
left: guideX,
|
|
@@ -96769,10 +96794,10 @@ function Timeline({ spans, viewStart, viewEnd, markers, selectedId, searchResult
|
|
|
96769
96794
|
const delta = computeSpanDelta(anchorSpan, hoveredSpan, viewStart, viewEnd);
|
|
96770
96795
|
return delta ? { delta, anchorRowIndex: anchorIndex, hoveredRowIndex: hover.rowIndex } : null;
|
|
96771
96796
|
}, [altHeld, anchorIndex, hover, spans, viewStart, viewEnd]);
|
|
96772
|
-
return jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "relative h-full overflow-hidden", style: { minHeight: spans.length * ROW_HEIGHT_PX }, children: [jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "absolute inset-
|
|
96797
|
+
return jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "relative h-full overflow-hidden", style: { minHeight: spans.length * ROW_HEIGHT_PX }, children: [jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-4 inset-y-0", children: markers.map((marker) => (
|
|
96773
96798
|
// Skip the "0s" origin marker since the left edge already implies it.
|
|
96774
96799
|
Math.abs(marker.value) > 1e-6 ? jsxRuntimeExports.jsx("div", { className: "absolute top-0 bottom-0 w-px bg-gray-alpha-300", style: { left: `${marker.position * 100}%` } }, String(marker.value)) : null
|
|
96775
|
-
)) }), hover != null && jsxRuntimeExports.jsx("div", { className: "absolute inset-
|
|
96800
|
+
)) }), hover != null && jsxRuntimeExports.jsx("div", { className: "pointer-events-none absolute inset-x-4 inset-y-0 z-10", children: jsxRuntimeExports.jsx("div", { className: "absolute top-0 bottom-0 w-px bg-gray-alpha-500", style: { left: `${hover.fraction * 100}%` } }) }), jsxRuntimeExports.jsx("div", { style: { transform: `translateY(${start2 * ROW_HEIGHT_PX}px)` }, children: spans.slice(start2, end).map((span) => jsxRuntimeExports.jsx(TimelineBar, { span, viewStart, viewDuration, containerWidth: timelineWidth, isSelected: selectedId === span.spanId, isDimmed: isSpanDimmedBySearch(span.spanId, searchResult), onSelect, onRevealTime }, span.spanId)) }), altHeld && anchorIndex < 0 && jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-4 inset-y-0", children: gapMeasurements.map((gap) => jsxRuntimeExports.jsx(DeltaMeasureLine, { ...gap, timelineWidth }, gap.anchorRowIndex)) }), measurement && jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-4 inset-y-0 z-20", children: jsxRuntimeExports.jsx(DeltaMeasureLine, { ...measurement, timelineWidth }) })] });
|
|
96776
96801
|
}
|
|
96777
96802
|
const CANVAS_PAD_Y_PX = 6;
|
|
96778
96803
|
const MIN_LINE_HEIGHT_PX = 1.5;
|
|
@@ -97051,6 +97076,12 @@ const Minimap = reactExports.memo(function Minimap2({ spans, root: root2, viewpo
|
|
|
97051
97076
|
(drag2 == null ? void 0 : drag2.mode) === "pan" ? "cursor-grabbing" : "cursor-grab"
|
|
97052
97077
|
), style: brushStyle, children: [jsxRuntimeExports.jsx("div", { "data-minimap-handle": "left", className: "absolute inset-y-0 -left-1 flex w-2.5 cursor-ew-resize items-center justify-center", children: jsxRuntimeExports.jsx("span", { className: cn$4("h-3.5 w-[3px] rounded-full bg-gray-600 opacity-0 transition-opacity group-hover/minimap-brush:opacity-100 group-focus-visible/minimap-brush:opacity-100", drag2 && "opacity-100") }) }), jsxRuntimeExports.jsx("div", { "data-minimap-handle": "right", className: "absolute inset-y-0 -right-1 flex w-2.5 cursor-ew-resize items-center justify-center", children: jsxRuntimeExports.jsx("span", { className: cn$4("h-3.5 w-[3px] rounded-full bg-gray-600 opacity-0 transition-opacity group-hover/minimap-brush:opacity-100 group-focus-visible/minimap-brush:opacity-100", drag2 && "opacity-100") }) })] })] });
|
|
97053
97078
|
});
|
|
97079
|
+
const GUTTER_PX = 1;
|
|
97080
|
+
const MIN_PX = 50;
|
|
97081
|
+
const DEFAULT_START_PX = 340;
|
|
97082
|
+
function paneColTemplate(startPx) {
|
|
97083
|
+
return `${startPx}px ${GUTTER_PX}px minmax(${MIN_PX}px, 1fr)`;
|
|
97084
|
+
}
|
|
97054
97085
|
const SPLIT_PANE_START_ID = "trace-split-start";
|
|
97055
97086
|
function SplitPane({ children: children2, className, startHeader, endHeader, scrollContainerRef }) {
|
|
97056
97087
|
const parts = reactExports.Children.toArray(children2);
|
|
@@ -97434,12 +97465,15 @@ const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasM
|
|
|
97434
97465
|
if (!(run2 == null ? void 0 : run2.runId)) {
|
|
97435
97466
|
return void 0;
|
|
97436
97467
|
}
|
|
97437
|
-
return buildTrace(run2, events2, /* @__PURE__ */ new Date()
|
|
97438
|
-
|
|
97468
|
+
return buildTrace(run2, events2, /* @__PURE__ */ new Date(), {
|
|
97469
|
+
isCompleteHistory: !hasMore
|
|
97470
|
+
});
|
|
97471
|
+
}, [run2, events2, hasMore]);
|
|
97472
|
+
const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace2 == null ? void 0 : trace2.duplicateEventIds }), [sidebarData, trace2]);
|
|
97439
97473
|
if (!trace2 || loading && events2.length === 0) {
|
|
97440
97474
|
return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
|
|
97441
97475
|
}
|
|
97442
|
-
return jsxRuntimeExports.jsx(SidebarDataProvider, { value:
|
|
97476
|
+
return jsxRuntimeExports.jsx(SidebarDataProvider, { value: sidebarValue, children: jsxRuntimeExports.jsx("div", { className: "relative w-full h-full flex", children: jsxRuntimeExports.jsx(TraceViewer$1, { trace: trace2, onLoadMore, hasMore, isLoadingMore }) }) });
|
|
97443
97477
|
};
|
|
97444
97478
|
function analyzeEvents(events2) {
|
|
97445
97479
|
if (!events2 || events2.length === 0) {
|
|
@@ -101072,11 +101106,12 @@ async function flushablePipePerChunk(source, sink, state) {
|
|
|
101072
101106
|
}
|
|
101073
101107
|
}
|
|
101074
101108
|
function assertWorldSupportsRuntimeProtocol(world) {
|
|
101075
|
-
|
|
101109
|
+
const declared = world.specVersion;
|
|
101110
|
+
if (declared !== void 0 && declared !== null && declared >= SPEC_VERSION_CURRENT && declared <= SPEC_VERSION_MAX_SUPPORTED) {
|
|
101076
101111
|
return;
|
|
101077
101112
|
}
|
|
101078
|
-
const supportedVersion =
|
|
101079
|
-
throw new WorkflowRuntimeError(`This Workflow runtime
|
|
101113
|
+
const supportedVersion = declared ?? "none";
|
|
101114
|
+
throw new WorkflowRuntimeError(`This Workflow runtime supports Worlds with spec version ${SPEC_VERSION_CURRENT} through ${SPEC_VERSION_MAX_SUPPORTED}, but the configured World declares spec version ${supportedVersion}. Install a World package version compatible with the current Workflow runtime.`);
|
|
101080
101115
|
}
|
|
101081
101116
|
const WorldCacheKey = Symbol.for("@workflow/world//cache");
|
|
101082
101117
|
const WorldCachePromiseKey = Symbol.for("@workflow/world//cachePromise");
|
|
@@ -101906,6 +101941,17 @@ function getStepFunctionReviver(global2 = globalThis) {
|
|
|
101906
101941
|
}
|
|
101907
101942
|
const encoder = new TextEncoder();
|
|
101908
101943
|
const decoder = new TextDecoder();
|
|
101944
|
+
const MAX_SPARSE_ARRAY_LENGTH = 1e5;
|
|
101945
|
+
const parseOptions = {
|
|
101946
|
+
operations: {
|
|
101947
|
+
createSparseArray(length) {
|
|
101948
|
+
if (length > MAX_SPARSE_ARRAY_LENGTH) {
|
|
101949
|
+
throw new RangeError(`Sparse array length ${length} exceeds the maximum of ${MAX_SPARSE_ARRAY_LENGTH}`);
|
|
101950
|
+
}
|
|
101951
|
+
return default_parse_operations.createSparseArray(length);
|
|
101952
|
+
}
|
|
101953
|
+
}
|
|
101954
|
+
};
|
|
101909
101955
|
function getReducersForMode(mode, global2 = globalThis, extraReducers) {
|
|
101910
101956
|
let base;
|
|
101911
101957
|
switch (mode) {
|
|
@@ -101975,11 +102021,11 @@ const devalueCodec = {
|
|
|
101975
102021
|
deserialize(data, mode, options) {
|
|
101976
102022
|
const revivers = getReviversForMode(mode, options == null ? void 0 : options.global, options == null ? void 0 : options.extraRevivers);
|
|
101977
102023
|
const str = decoder.decode(data);
|
|
101978
|
-
return parse$5(str, revivers);
|
|
102024
|
+
return parse$5(str, revivers, parseOptions);
|
|
101979
102025
|
},
|
|
101980
102026
|
deserializeLegacy(data, mode, options) {
|
|
101981
102027
|
const revivers = getReviversForMode(mode, options == null ? void 0 : options.global, options == null ? void 0 : options.extraRevivers);
|
|
101982
|
-
return unflatten(data, revivers);
|
|
102028
|
+
return unflatten(data, revivers, parseOptions);
|
|
101983
102029
|
}
|
|
101984
102030
|
};
|
|
101985
102031
|
const COMPRESSION_MIN_BYTES = 1024;
|
|
@@ -102670,7 +102716,9 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
102670
102716
|
try {
|
|
102671
102717
|
await connect2();
|
|
102672
102718
|
return;
|
|
102673
|
-
} catch {
|
|
102719
|
+
} catch (error2) {
|
|
102720
|
+
if (StreamExpiredError.is(error2))
|
|
102721
|
+
throw error2;
|
|
102674
102722
|
}
|
|
102675
102723
|
}
|
|
102676
102724
|
}
|
|
@@ -104016,7 +104064,7 @@ function getStreamAndRequestRevivers(allRevivers) {
|
|
|
104016
104064
|
return extra;
|
|
104017
104065
|
}
|
|
104018
104066
|
`cinst_${ulid$3()}`;
|
|
104019
|
-
const version$1 = "5.0.0-beta.
|
|
104067
|
+
const version$1 = "5.0.0-beta.42";
|
|
104020
104068
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
104021
104069
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
104022
104070
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
@@ -104729,20 +104777,32 @@ async function listFilesByExtension(dirPath, extension2) {
|
|
|
104729
104777
|
throw error2;
|
|
104730
104778
|
}
|
|
104731
104779
|
}
|
|
104780
|
+
const SORT_KEY_CURSOR_PREFIX = "key:";
|
|
104732
104781
|
function parseCursor(cursor) {
|
|
104733
104782
|
if (!cursor)
|
|
104734
104783
|
return null;
|
|
104784
|
+
if (cursor.startsWith(SORT_KEY_CURSOR_PREFIX)) {
|
|
104785
|
+
return {
|
|
104786
|
+
timestamp: /* @__PURE__ */ new Date(0),
|
|
104787
|
+
id: null,
|
|
104788
|
+
sortKey: cursor.slice(SORT_KEY_CURSOR_PREFIX.length)
|
|
104789
|
+
};
|
|
104790
|
+
}
|
|
104735
104791
|
const parts = cursor.split("|");
|
|
104736
104792
|
return {
|
|
104737
104793
|
timestamp: new Date(parts[0]),
|
|
104738
|
-
id: parts[1] || null
|
|
104794
|
+
id: parts[1] || null,
|
|
104795
|
+
sortKey: null
|
|
104739
104796
|
};
|
|
104740
104797
|
}
|
|
104741
|
-
function createCursor(timestamp, id2) {
|
|
104798
|
+
function createCursor(timestamp, id2, sortKey) {
|
|
104799
|
+
if (sortKey) {
|
|
104800
|
+
return `${SORT_KEY_CURSOR_PREFIX}${sortKey}`;
|
|
104801
|
+
}
|
|
104742
104802
|
return id2 ? `${timestamp.toISOString()}|${id2}` : timestamp.toISOString();
|
|
104743
104803
|
}
|
|
104744
104804
|
async function paginatedFileSystemQuery(config2) {
|
|
104745
|
-
const { directory, schema, cachedItems, filePrefix, fileIdFilter, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId } = config2;
|
|
104805
|
+
const { directory, schema, cachedItems, filePrefix, fileIdFilter, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId, getSortKey, getSortKeyFromFileId } = config2;
|
|
104746
104806
|
if (filePrefix !== void 0) {
|
|
104747
104807
|
assertSafeEntityId("filePrefix", filePrefix);
|
|
104748
104808
|
}
|
|
@@ -104752,7 +104812,17 @@ async function paginatedFileSystemQuery(config2) {
|
|
|
104752
104812
|
const filteredFileIds = fileIdFilter ? relevantFileIds.filter(fileIdFilter) : relevantFileIds;
|
|
104753
104813
|
const parsedCursor = parseCursor(cursor);
|
|
104754
104814
|
let candidateFileIds = filteredFileIds;
|
|
104755
|
-
if (parsedCursor) {
|
|
104815
|
+
if ((parsedCursor == null ? void 0 : parsedCursor.sortKey) && getSortKeyFromFileId) {
|
|
104816
|
+
const cursorSortKey = parsedCursor.sortKey;
|
|
104817
|
+
candidateFileIds = filteredFileIds.filter((fileId) => {
|
|
104818
|
+
const key = getSortKeyFromFileId(fileId);
|
|
104819
|
+
if (key === null) {
|
|
104820
|
+
return true;
|
|
104821
|
+
}
|
|
104822
|
+
const comparison = key.localeCompare(cursorSortKey);
|
|
104823
|
+
return sortOrder === "desc" ? comparison < 0 : comparison > 0;
|
|
104824
|
+
});
|
|
104825
|
+
} else if (parsedCursor && !parsedCursor.sortKey) {
|
|
104756
104826
|
candidateFileIds = filteredFileIds.filter((fileId) => {
|
|
104757
104827
|
const filenameDate = getCreatedAt(`${fileId}.json`);
|
|
104758
104828
|
if (filenameDate) {
|
|
@@ -104789,6 +104859,17 @@ async function paginatedFileSystemQuery(config2) {
|
|
|
104789
104859
|
for (const item of loadedBatch) {
|
|
104790
104860
|
if (!item)
|
|
104791
104861
|
continue;
|
|
104862
|
+
const itemSortKey = (getSortKey == null ? void 0 : getSortKey(item)) ?? null;
|
|
104863
|
+
if (parsedCursor == null ? void 0 : parsedCursor.sortKey) {
|
|
104864
|
+
if (itemSortKey) {
|
|
104865
|
+
const comparison = itemSortKey.localeCompare(parsedCursor.sortKey);
|
|
104866
|
+
if (sortOrder === "desc" ? comparison >= 0 : comparison <= 0) {
|
|
104867
|
+
continue;
|
|
104868
|
+
}
|
|
104869
|
+
}
|
|
104870
|
+
validItems.push(item);
|
|
104871
|
+
continue;
|
|
104872
|
+
}
|
|
104792
104873
|
if (parsedCursor) {
|
|
104793
104874
|
const itemTime = item.createdAt.getTime();
|
|
104794
104875
|
const cursorTime = parsedCursor.timestamp.getTime();
|
|
@@ -104814,6 +104895,13 @@ async function paginatedFileSystemQuery(config2) {
|
|
|
104814
104895
|
}
|
|
104815
104896
|
}
|
|
104816
104897
|
validItems.sort((a2, b2) => {
|
|
104898
|
+
if (getSortKey) {
|
|
104899
|
+
const aKey = getSortKey(a2);
|
|
104900
|
+
const bKey = getSortKey(b2);
|
|
104901
|
+
if (aKey !== null && bKey !== null) {
|
|
104902
|
+
return sortOrder === "asc" ? aKey.localeCompare(bKey) : bKey.localeCompare(aKey);
|
|
104903
|
+
}
|
|
104904
|
+
}
|
|
104817
104905
|
const aTime = a2.createdAt.getTime();
|
|
104818
104906
|
const bTime = b2.createdAt.getTime();
|
|
104819
104907
|
const timeComparison = sortOrder === "asc" ? aTime - bTime : bTime - aTime;
|
|
@@ -104826,7 +104914,7 @@ async function paginatedFileSystemQuery(config2) {
|
|
|
104826
104914
|
});
|
|
104827
104915
|
const hasMore = validItems.length > limit;
|
|
104828
104916
|
const items = hasMore ? validItems.slice(0, limit) : validItems;
|
|
104829
|
-
const nextCursor = items.length > 0 ? createCursor(items[items.length - 1].createdAt, getId == null ? void 0 : getId(items[items.length - 1])) : null;
|
|
104917
|
+
const nextCursor = items.length > 0 ? createCursor(items[items.length - 1].createdAt, getId == null ? void 0 : getId(items[items.length - 1]), getSortKey == null ? void 0 : getSortKey(items[items.length - 1])) : null;
|
|
104830
104918
|
return {
|
|
104831
104919
|
data: items,
|
|
104832
104920
|
cursor: nextCursor,
|
|
@@ -133165,6 +133253,20 @@ async function reapPendingHookEvents(basedir, runId, tag) {
|
|
|
133165
133253
|
}
|
|
133166
133254
|
}
|
|
133167
133255
|
async function mintRunDominantEventKey(basedir, runId, tag) {
|
|
133256
|
+
const scan = await scanRunEventIds(basedir, runId, tag);
|
|
133257
|
+
let ts = Date.now();
|
|
133258
|
+
if (scan.maxId) {
|
|
133259
|
+
try {
|
|
133260
|
+
const maxTs = decodeTime(scan.maxId.replace(/^evnt_/, ""));
|
|
133261
|
+
if (ts <= maxTs) {
|
|
133262
|
+
ts = maxTs + 1;
|
|
133263
|
+
}
|
|
133264
|
+
} catch {
|
|
133265
|
+
}
|
|
133266
|
+
}
|
|
133267
|
+
return { eventId: `evnt_${monotonicUlid$1(ts)}`, createdAt: new Date(ts) };
|
|
133268
|
+
}
|
|
133269
|
+
async function scanRunEventIds(basedir, runId, tag) {
|
|
133168
133270
|
let files = [];
|
|
133169
133271
|
try {
|
|
133170
133272
|
files = await fs$1.readdir(path$3.join(basedir, "events"));
|
|
@@ -133174,7 +133276,11 @@ async function mintRunDominantEventKey(basedir, runId, tag) {
|
|
|
133174
133276
|
}
|
|
133175
133277
|
}
|
|
133176
133278
|
const prefix = `${runId}-`;
|
|
133177
|
-
|
|
133279
|
+
const ids = [];
|
|
133280
|
+
let maxId = null;
|
|
133281
|
+
let maxSlot = 0;
|
|
133282
|
+
let usesSlots = false;
|
|
133283
|
+
let count2 = 0;
|
|
133178
133284
|
for (const file2 of files) {
|
|
133179
133285
|
if (!file2.startsWith(prefix) || !file2.endsWith(".json")) {
|
|
133180
133286
|
continue;
|
|
@@ -133184,21 +133290,19 @@ async function mintRunDominantEventKey(basedir, runId, tag) {
|
|
|
133184
133290
|
continue;
|
|
133185
133291
|
}
|
|
133186
133292
|
const candidate = stripTag(fileId).slice(prefix.length);
|
|
133187
|
-
|
|
133188
|
-
|
|
133293
|
+
count2 += 1;
|
|
133294
|
+
ids.push(candidate);
|
|
133295
|
+
if (!maxId || candidate > maxId) {
|
|
133296
|
+
maxId = candidate;
|
|
133189
133297
|
}
|
|
133190
|
-
|
|
133191
|
-
|
|
133192
|
-
|
|
133193
|
-
|
|
133194
|
-
|
|
133195
|
-
if (ts <= maxTs) {
|
|
133196
|
-
ts = maxTs + 1;
|
|
133197
|
-
}
|
|
133198
|
-
} catch {
|
|
133298
|
+
const slot = eventIdToSlot(candidate);
|
|
133299
|
+
if (slot !== null) {
|
|
133300
|
+
usesSlots = true;
|
|
133301
|
+
if (slot > maxSlot)
|
|
133302
|
+
maxSlot = slot;
|
|
133199
133303
|
}
|
|
133200
133304
|
}
|
|
133201
|
-
return {
|
|
133305
|
+
return { maxId, usesSlots, maxSlot, count: count2, ids };
|
|
133202
133306
|
}
|
|
133203
133307
|
function hookTokenClaimPath(basedir, token) {
|
|
133204
133308
|
return path$3.join(basedir, "hooks", "tokens", `${hashToken(token)}.json`);
|
|
@@ -133901,13 +134005,8 @@ function createRunsStorage(basedir, tag) {
|
|
|
133901
134005
|
}
|
|
133902
134006
|
};
|
|
133903
134007
|
}
|
|
133904
|
-
const DEFAULT_MAX_EVENTS_PER_RUN = 25e3;
|
|
133905
|
-
function getMaxEventsPerRun() {
|
|
133906
|
-
const raw2 = process.env.WORKFLOW_MAX_EVENTS;
|
|
133907
|
-
const parsed = raw2 !== void 0 ? Number(raw2) : Number.NaN;
|
|
133908
|
-
return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_MAX_EVENTS_PER_RUN;
|
|
133909
|
-
}
|
|
133910
134008
|
const DAY_MS$1 = 24 * 60 * 60 * 1e3;
|
|
134009
|
+
const MAX_CACHED_EVENT_ENTRIES = 1e3;
|
|
133911
134010
|
function getHookRetentionLimitMs() {
|
|
133912
134011
|
const days = Number(process.env.WORKFLOW_LOCAL_HOOK_RETENTION_LIMIT_DAYS ?? 30);
|
|
133913
134012
|
if (!Number.isFinite(days) || days <= 0) {
|
|
@@ -133925,6 +134024,22 @@ const HookResumeClaimSchema = object$1({
|
|
|
133925
134024
|
eventId: string$3(),
|
|
133926
134025
|
payloadDigest: string$3().optional()
|
|
133927
134026
|
});
|
|
134027
|
+
function isResumeEvent(event, claim) {
|
|
134028
|
+
return event.eventType === "hook_received" && event.correlationId === claim.hookId && // `resumeId` is persisted on every hook_received written through the
|
|
134029
|
+
// resume path; an event without one predates that and can only be matched
|
|
134030
|
+
// by position.
|
|
134031
|
+
(event.resumeId === void 0 || event.resumeId === claim.resumeId);
|
|
134032
|
+
}
|
|
134033
|
+
async function findCommittedResumeEvent(basedir, runId, claim, tag) {
|
|
134034
|
+
const scan = await scanRunEventIds(basedir, runId, tag);
|
|
134035
|
+
for (const eventId of scan.ids) {
|
|
134036
|
+
const event = await readJSONWithFallback(basedir, "events", `${runId}-${eventId}`, EventSchema, tag);
|
|
134037
|
+
if (event && event.resumeId === claim.resumeId && isResumeEvent(event, claim)) {
|
|
134038
|
+
return event;
|
|
134039
|
+
}
|
|
134040
|
+
}
|
|
134041
|
+
return null;
|
|
134042
|
+
}
|
|
133928
134043
|
async function isHookTokenClaimReleasable(basedir, claim, tag) {
|
|
133929
134044
|
if (claim.hookId && await isHookDisposalCommitted(basedir, claim.hookId, tag)) {
|
|
133930
134045
|
return true;
|
|
@@ -133948,6 +134063,13 @@ async function readHookRecoveryMarker(markerPath) {
|
|
|
133948
134063
|
throw error2;
|
|
133949
134064
|
}
|
|
133950
134065
|
}
|
|
134066
|
+
function eventSortKey(event) {
|
|
134067
|
+
return isSlotEventId(event.eventId) ? event.eventId : null;
|
|
134068
|
+
}
|
|
134069
|
+
function eventSortKeyFromFileId(runId, fileId) {
|
|
134070
|
+
const eventId = stripTag(fileId).slice(runId.length + 1);
|
|
134071
|
+
return isSlotEventId(eventId) ? eventId : null;
|
|
134072
|
+
}
|
|
133951
134073
|
async function findExistingHookCreatedEventId(basedir, runId, correlationId) {
|
|
133952
134074
|
var _a3;
|
|
133953
134075
|
const result = await paginatedFileSystemQuery({
|
|
@@ -134031,7 +134153,7 @@ async function writeRunUnderLifecycleLock(basedir, runId, tag, proposed) {
|
|
|
134031
134153
|
function createEventsStorage(basedir, tag) {
|
|
134032
134154
|
const hookRetentionLimitMs = getHookRetentionLimitMs();
|
|
134033
134155
|
const maxCachedEventBytes = 4 * 1024 * 1024;
|
|
134034
|
-
const maxCachedEventEntries =
|
|
134156
|
+
const maxCachedEventEntries = MAX_CACHED_EVENT_ENTRIES;
|
|
134035
134157
|
const eventCache = /* @__PURE__ */ new Map();
|
|
134036
134158
|
const cachedEventBytes = /* @__PURE__ */ new Map();
|
|
134037
134159
|
const cachedPathsByRunId = /* @__PURE__ */ new Map();
|
|
@@ -134060,6 +134182,71 @@ function createEventsStorage(basedir, tag) {
|
|
|
134060
134182
|
cachedEventBytes.clear();
|
|
134061
134183
|
cachedPathsByRunId.clear();
|
|
134062
134184
|
totalCachedEventBytes = 0;
|
|
134185
|
+
runSlotState.clear();
|
|
134186
|
+
}
|
|
134187
|
+
const runSlotState = /* @__PURE__ */ new Map();
|
|
134188
|
+
function slotStateKey(runId) {
|
|
134189
|
+
return tag ? `${runId}.${tag}` : runId;
|
|
134190
|
+
}
|
|
134191
|
+
async function slotOccupied(runId, slot) {
|
|
134192
|
+
const fileId = `${runId}-${slotToEventId(slot)}`;
|
|
134193
|
+
for (const candidate of tag ? [
|
|
134194
|
+
taggedPath(basedir, "events", fileId, tag),
|
|
134195
|
+
taggedPath(basedir, "events", fileId)
|
|
134196
|
+
] : [taggedPath(basedir, "events", fileId)]) {
|
|
134197
|
+
try {
|
|
134198
|
+
await fs$1.stat(candidate);
|
|
134199
|
+
return true;
|
|
134200
|
+
} catch (error2) {
|
|
134201
|
+
if (error2.code !== "ENOENT") {
|
|
134202
|
+
throw error2;
|
|
134203
|
+
}
|
|
134204
|
+
}
|
|
134205
|
+
}
|
|
134206
|
+
return false;
|
|
134207
|
+
}
|
|
134208
|
+
async function drawEventSlot(runId, opts) {
|
|
134209
|
+
const key = slotStateKey(runId);
|
|
134210
|
+
let state = runSlotState.get(key);
|
|
134211
|
+
if (state === void 0 || (opts == null ? void 0 : opts.rescan)) {
|
|
134212
|
+
const scan = await scanRunEventIds(basedir, runId, tag);
|
|
134213
|
+
if (state === void 0) {
|
|
134214
|
+
state = scan.count > 0 && !scan.usesSlots ? null : { published: scan.maxSlot };
|
|
134215
|
+
runSlotState.set(key, state);
|
|
134216
|
+
} else if (state !== null) {
|
|
134217
|
+
state.published = Math.max(state.published, scan.maxSlot);
|
|
134218
|
+
}
|
|
134219
|
+
}
|
|
134220
|
+
if (state === null) {
|
|
134221
|
+
return null;
|
|
134222
|
+
}
|
|
134223
|
+
let slot = Math.max(state.published + 1, FIRST_EVENT_SLOT, (opts == null ? void 0 : opts.atLeast) ?? FIRST_EVENT_SLOT);
|
|
134224
|
+
while (await slotOccupied(runId, slot)) {
|
|
134225
|
+
state.published = Math.max(state.published, slot);
|
|
134226
|
+
slot += 1;
|
|
134227
|
+
}
|
|
134228
|
+
return slot;
|
|
134229
|
+
}
|
|
134230
|
+
function notePublishedSlot(runId, eventId) {
|
|
134231
|
+
const slot = eventIdToSlot(eventId);
|
|
134232
|
+
if (slot === null) {
|
|
134233
|
+
return;
|
|
134234
|
+
}
|
|
134235
|
+
const state = runSlotState.get(slotStateKey(runId));
|
|
134236
|
+
if (state) {
|
|
134237
|
+
state.published = Math.max(state.published, slot);
|
|
134238
|
+
}
|
|
134239
|
+
}
|
|
134240
|
+
async function mintEventId(runId) {
|
|
134241
|
+
const slot = await drawEventSlot(runId);
|
|
134242
|
+
return slot === null ? `evnt_${monotonicUlid$1()}` : slotToEventId(slot);
|
|
134243
|
+
}
|
|
134244
|
+
async function mintDominantEventKey(runId) {
|
|
134245
|
+
const slot = await drawEventSlot(runId, { rescan: true });
|
|
134246
|
+
if (slot !== null) {
|
|
134247
|
+
return { eventId: slotToEventId(slot), createdAt: /* @__PURE__ */ new Date() };
|
|
134248
|
+
}
|
|
134249
|
+
return mintRunDominantEventKey(basedir, runId, tag);
|
|
134063
134250
|
}
|
|
134064
134251
|
function cacheEvent(eventPath, cachedEvent, serializedBytes) {
|
|
134065
134252
|
if (serializedBytes > maxCachedEventBytes) {
|
|
@@ -134091,14 +134278,45 @@ function createEventsStorage(basedir, tag) {
|
|
|
134091
134278
|
}
|
|
134092
134279
|
}
|
|
134093
134280
|
async function storeEvent(event) {
|
|
134094
|
-
|
|
134095
|
-
|
|
134096
|
-
|
|
134097
|
-
|
|
134281
|
+
let current = event;
|
|
134282
|
+
for (let attempt = 0; ; attempt++) {
|
|
134283
|
+
const eventPath = taggedPath(basedir, "events", `${current.runId}-${current.eventId}`, tag);
|
|
134284
|
+
const serializedEvent = JSON.stringify(current, jsonReplacer, 2);
|
|
134285
|
+
const slot = eventIdToSlot(current.eventId);
|
|
134286
|
+
if (slot === null) {
|
|
134287
|
+
await write(eventPath, serializedEvent);
|
|
134288
|
+
rememberStoredEvent(current, eventPath, serializedEvent);
|
|
134289
|
+
return current;
|
|
134290
|
+
}
|
|
134291
|
+
if (await writeExclusive(eventPath, serializedEvent)) {
|
|
134292
|
+
notePublishedSlot(current.runId, current.eventId);
|
|
134293
|
+
rememberStoredEvent(current, eventPath, serializedEvent);
|
|
134294
|
+
return current;
|
|
134295
|
+
}
|
|
134296
|
+
const next2 = await drawEventSlot(current.runId, {
|
|
134297
|
+
rescan: attempt > 0 && attempt % 8 === 0,
|
|
134298
|
+
atLeast: slot + 1
|
|
134299
|
+
});
|
|
134300
|
+
require$$0$4(next2 !== null);
|
|
134301
|
+
current = { ...current, eventId: slotToEventId(next2) };
|
|
134302
|
+
}
|
|
134098
134303
|
}
|
|
134304
|
+
const queryRunEvents = (runId, pagination) => paginatedFileSystemQuery({
|
|
134305
|
+
directory: path$3.join(basedir, "events"),
|
|
134306
|
+
schema: EventSchema,
|
|
134307
|
+
cachedItems: eventCache,
|
|
134308
|
+
filePrefix: `${runId}-`,
|
|
134309
|
+
sortOrder: pagination.sortOrder ?? "asc",
|
|
134310
|
+
limit: pagination.limit,
|
|
134311
|
+
cursor: pagination.cursor,
|
|
134312
|
+
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
134313
|
+
getId: (event) => event.eventId,
|
|
134314
|
+
getSortKey: eventSortKey,
|
|
134315
|
+
getSortKeyFromFileId: (fileId) => eventSortKeyFromFileId(runId, fileId)
|
|
134316
|
+
});
|
|
134099
134317
|
const stepLocks = /* @__PURE__ */ new Map();
|
|
134100
134318
|
const hookLocks = /* @__PURE__ */ new Map();
|
|
134101
|
-
|
|
134319
|
+
const storage = {
|
|
134102
134320
|
clearCache,
|
|
134103
134321
|
async create(runId, data, params) {
|
|
134104
134322
|
if (data.eventType === "hook_created" && data.eventData.tokenRetentionUntil !== void 0 && data.eventData.tokenRetentionUntil.getTime() > Date.now() + hookRetentionLimitMs) {
|
|
@@ -134112,7 +134330,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134112
134330
|
}
|
|
134113
134331
|
if (isStepEventType(data.eventType) && runId && data.correlationId) {
|
|
134114
134332
|
const lockKey = tag ? `${runId}-${data.correlationId}.${tag}` : `${runId}-${data.correlationId}`;
|
|
134115
|
-
return withInProcessLock(stepLocks, lockKey,
|
|
134333
|
+
return withInProcessLock(stepLocks, lockKey, createImpl);
|
|
134116
134334
|
}
|
|
134117
134335
|
if (isHookLifecycleEventType(data.eventType) && runId && data.correlationId) {
|
|
134118
134336
|
const lockKey = tag ? `${runId}-${data.correlationId}.hook.${tag}` : `${runId}-${data.correlationId}.hook`;
|
|
@@ -134120,7 +134338,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
134120
134338
|
}
|
|
134121
134339
|
return createImpl();
|
|
134122
134340
|
async function createImpl() {
|
|
134123
|
-
let eventId =
|
|
134341
|
+
let eventId = "";
|
|
134342
|
+
let eventIdPinned = false;
|
|
134343
|
+
let resumeClaimRecordedId = null;
|
|
134124
134344
|
const now2 = /* @__PURE__ */ new Date();
|
|
134125
134345
|
let effectiveRunId;
|
|
134126
134346
|
if (data.eventType === "run_created" && (!runId || runId === "")) {
|
|
@@ -134170,7 +134390,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134170
134390
|
const runPath = taggedPath(basedir, "runs", effectiveRunId, tag);
|
|
134171
134391
|
const created = await writeExclusive(runPath, JSON.stringify(createdRun, jsonReplacer));
|
|
134172
134392
|
if (created) {
|
|
134173
|
-
const runCreatedEventId =
|
|
134393
|
+
const runCreatedEventId = await mintEventId(effectiveRunId);
|
|
134174
134394
|
const runCreatedEvent = {
|
|
134175
134395
|
eventType: "run_created",
|
|
134176
134396
|
runId: effectiveRunId,
|
|
@@ -134195,10 +134415,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
134195
134415
|
}
|
|
134196
134416
|
}
|
|
134197
134417
|
}
|
|
134198
|
-
|
|
134199
|
-
|
|
134200
|
-
}
|
|
134201
|
-
if (data.eventType === "attr_set" && !currentRun) {
|
|
134418
|
+
eventId = await mintEventId(effectiveRunId);
|
|
134419
|
+
if (!currentRun && (data.eventType === "run_failed" || data.eventType === "attr_set" || data.eventType === "run_started")) {
|
|
134202
134420
|
throw new WorkflowRunNotFoundError(effectiveRunId);
|
|
134203
134421
|
}
|
|
134204
134422
|
if (currentRun) {
|
|
@@ -134213,17 +134431,16 @@ function createEventsStorage(basedir, tag) {
|
|
|
134213
134431
|
const lazyStepStart = createsChildEntity && data.eventType === "step_started";
|
|
134214
134432
|
if (currentRun && isTerminalWorkflowRunStatus(currentRun.status)) {
|
|
134215
134433
|
if (data.eventType === "run_cancelled" && currentRun.status === "cancelled") {
|
|
134216
|
-
const
|
|
134434
|
+
const stored = await storeEvent({
|
|
134217
134435
|
...data,
|
|
134218
134436
|
runId: effectiveRunId,
|
|
134219
134437
|
eventId,
|
|
134220
134438
|
createdAt: now2,
|
|
134221
134439
|
specVersion: effectiveSpecVersion
|
|
134222
|
-
};
|
|
134223
|
-
await storeEvent(event2);
|
|
134440
|
+
});
|
|
134224
134441
|
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
134225
134442
|
return {
|
|
134226
|
-
event: stripEventDataRefs(
|
|
134443
|
+
event: stripEventDataRefs(stored, resolveData2),
|
|
134227
134444
|
run: currentRun,
|
|
134228
134445
|
...currentRun ? { maxEvents: getMaxEventsPerRun() } : {}
|
|
134229
134446
|
};
|
|
@@ -134267,7 +134484,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
134267
134484
|
if (data.eventType === "hook_received" && (params == null ? void 0 : params.resumeId)) {
|
|
134268
134485
|
const committedClaim = await readJSON(hookResumeClaimPath(basedir, effectiveRunId, params.resumeId), HookResumeClaimSchema);
|
|
134269
134486
|
if (committedClaim && committedClaim.hookId === data.correlationId && (!params.resumePayloadDigest || !committedClaim.payloadDigest || committedClaim.payloadDigest === params.resumePayloadDigest)) {
|
|
134270
|
-
const
|
|
134487
|
+
const atClaimedId = await readJSONWithFallback(basedir, "events", `${effectiveRunId}-${committedClaim.eventId}`, EventSchema, tag);
|
|
134488
|
+
const committedEvent = atClaimedId && isResumeEvent(atClaimedId, committedClaim) ? atClaimedId : await findCommittedResumeEvent(basedir, effectiveRunId, committedClaim, tag);
|
|
134271
134489
|
if (committedEvent) {
|
|
134272
134490
|
return { event: committedEvent };
|
|
134273
134491
|
}
|
|
@@ -134289,11 +134507,19 @@ function createEventsStorage(basedir, tag) {
|
|
|
134289
134507
|
if (params.resumePayloadDigest && claim.payloadDigest && claim.payloadDigest !== params.resumePayloadDigest) {
|
|
134290
134508
|
throw new EntityConflictError(`hook_received resumeId "${params.resumeId}" already recorded with a different payload`);
|
|
134291
134509
|
}
|
|
134292
|
-
const
|
|
134293
|
-
if (
|
|
134294
|
-
return { event:
|
|
134510
|
+
const atClaimedId = await readJSONWithFallback(basedir, "events", `${effectiveRunId}-${claim.eventId}`, EventSchema, tag);
|
|
134511
|
+
if (atClaimedId && isResumeEvent(atClaimedId, claim)) {
|
|
134512
|
+
return { event: atClaimedId };
|
|
134513
|
+
}
|
|
134514
|
+
const committed = await findCommittedResumeEvent(basedir, effectiveRunId, claim, tag);
|
|
134515
|
+
if (committed) {
|
|
134516
|
+
return { event: committed };
|
|
134517
|
+
}
|
|
134518
|
+
resumeClaimRecordedId = claim.eventId;
|
|
134519
|
+
if (!atClaimedId) {
|
|
134520
|
+
eventId = claim.eventId;
|
|
134521
|
+
eventIdPinned = true;
|
|
134295
134522
|
}
|
|
134296
|
-
eventId = claim.eventId;
|
|
134297
134523
|
return null;
|
|
134298
134524
|
};
|
|
134299
134525
|
const existingClaim = await readJSON(claimPath, HookResumeClaimSchema);
|
|
@@ -134303,6 +134529,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
134303
134529
|
return converged;
|
|
134304
134530
|
}
|
|
134305
134531
|
} else {
|
|
134532
|
+
eventIdPinned = !isSlotEventId(eventId);
|
|
134533
|
+
resumeClaimRecordedId = eventId;
|
|
134306
134534
|
const won = await writeExclusive(claimPath, JSON.stringify({
|
|
134307
134535
|
runId: effectiveRunId,
|
|
134308
134536
|
resumeId: params.resumeId,
|
|
@@ -134311,6 +134539,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134311
134539
|
...params.resumePayloadDigest ? { payloadDigest: params.resumePayloadDigest } : {}
|
|
134312
134540
|
}));
|
|
134313
134541
|
if (!won) {
|
|
134542
|
+
resumeClaimRecordedId = null;
|
|
134314
134543
|
const winner = await readJSON(claimPath, HookResumeClaimSchema);
|
|
134315
134544
|
if (winner) {
|
|
134316
134545
|
const converged = await converge(winner);
|
|
@@ -134353,7 +134582,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134353
134582
|
if (isTerminalRunEventType(data.eventType) && currentRun) {
|
|
134354
134583
|
await writeExclusive(runTerminalMarkerPath(basedir, effectiveRunId, tag), "");
|
|
134355
134584
|
await reapPendingHookEvents(basedir, effectiveRunId, tag);
|
|
134356
|
-
const dominantKey = await
|
|
134585
|
+
const dominantKey = await mintDominantEventKey(effectiveRunId);
|
|
134357
134586
|
eventId = dominantKey.eventId;
|
|
134358
134587
|
event = { ...event, eventId, createdAt: dominantKey.createdAt };
|
|
134359
134588
|
}
|
|
@@ -134391,7 +134620,22 @@ function createEventsStorage(basedir, tag) {
|
|
|
134391
134620
|
} else if (data.eventType === "run_started") {
|
|
134392
134621
|
if (currentRun) {
|
|
134393
134622
|
if (currentRun.status === "running") {
|
|
134394
|
-
|
|
134623
|
+
if (params == null ? void 0 : params.skipPreload) {
|
|
134624
|
+
return {
|
|
134625
|
+
run: currentRun,
|
|
134626
|
+
maxEvents: getMaxEventsPerRun()
|
|
134627
|
+
};
|
|
134628
|
+
}
|
|
134629
|
+
const preloaded = await queryRunEvents(effectiveRunId, {
|
|
134630
|
+
limit: getMaxEventsPerRun()
|
|
134631
|
+
});
|
|
134632
|
+
return {
|
|
134633
|
+
run: currentRun,
|
|
134634
|
+
events: preloaded.data,
|
|
134635
|
+
cursor: preloaded.cursor,
|
|
134636
|
+
hasMore: preloaded.hasMore,
|
|
134637
|
+
maxEvents: getMaxEventsPerRun()
|
|
134638
|
+
};
|
|
134395
134639
|
}
|
|
134396
134640
|
run2 = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
134397
134641
|
runId: currentRun.runId,
|
|
@@ -134570,7 +134814,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134570
134814
|
specVersion: effectiveSpecVersion
|
|
134571
134815
|
};
|
|
134572
134816
|
await writeJSON(taggedPath(basedir, "steps", `${effectiveRunId}-${data.correlationId}`, tag), createdStep);
|
|
134573
|
-
const stepCreatedEventId =
|
|
134817
|
+
const stepCreatedEventId = await mintEventId(effectiveRunId);
|
|
134574
134818
|
const stepCreatedEvent = {
|
|
134575
134819
|
eventType: "step_created",
|
|
134576
134820
|
runId: effectiveRunId,
|
|
@@ -134583,7 +134827,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134583
134827
|
input: lazyData.input
|
|
134584
134828
|
}
|
|
134585
134829
|
};
|
|
134586
|
-
await
|
|
134830
|
+
await storeEvent(stepCreatedEvent);
|
|
134587
134831
|
validatedStep = createdStep;
|
|
134588
134832
|
stepCreatedLazily = true;
|
|
134589
134833
|
}
|
|
@@ -134724,6 +134968,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
134724
134968
|
canonicalEventId = pinned;
|
|
134725
134969
|
}
|
|
134726
134970
|
eventId = canonicalEventId;
|
|
134971
|
+
eventIdPinned = true;
|
|
134727
134972
|
const canonicalCreatedAt = ulidToDate(eventId.replace(/^evnt_/, "")) ?? now2;
|
|
134728
134973
|
event = {
|
|
134729
134974
|
...data,
|
|
@@ -134753,10 +134998,10 @@ function createEventsStorage(basedir, tag) {
|
|
|
134753
134998
|
createdAt: now2,
|
|
134754
134999
|
specVersion: effectiveSpecVersion
|
|
134755
135000
|
};
|
|
134756
|
-
await storeEvent(conflictEvent);
|
|
135001
|
+
const storedConflict = await storeEvent(conflictEvent);
|
|
134757
135002
|
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
134758
135003
|
return {
|
|
134759
|
-
event: stripEventDataRefs(
|
|
135004
|
+
event: stripEventDataRefs(storedConflict, resolveData2),
|
|
134760
135005
|
run: run2,
|
|
134761
135006
|
step,
|
|
134762
135007
|
hook: void 0
|
|
@@ -134839,36 +135084,71 @@ function createEventsStorage(basedir, tag) {
|
|
|
134839
135084
|
if (data.eventType === "hook_received" && data.correlationId && await isHookDisposalCommitted(basedir, data.correlationId, tag)) {
|
|
134840
135085
|
throw new HookNotFoundError(data.correlationId);
|
|
134841
135086
|
}
|
|
134842
|
-
|
|
134843
|
-
|
|
134844
|
-
const
|
|
134845
|
-
|
|
134846
|
-
|
|
134847
|
-
|
|
134848
|
-
const runNow = terminalByMarker ? null : await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
|
|
134849
|
-
if (terminalByMarker || runNow && isTerminalWorkflowRunStatus(runNow.status)) {
|
|
134850
|
-
throw new RunExpiredError(`Workflow run "${effectiveRunId}" is already in a terminal state`);
|
|
134851
|
-
}
|
|
134852
|
-
const stagedPath = pendingHookEventPath(basedir, effectiveRunId, eventId, tag);
|
|
134853
|
-
const staged = await writeExclusive(stagedPath, serializedEvent);
|
|
134854
|
-
if (!staged) {
|
|
134855
|
-
throw new EntityConflictError(`Event "${eventId}" already exists for run "${effectiveRunId}"`);
|
|
135087
|
+
let eventPath = taggedPath(basedir, "events", `${effectiveRunId}-${eventId}`, tag);
|
|
135088
|
+
let serializedEvent = JSON.stringify(event, jsonReplacer, 2);
|
|
135089
|
+
const bumpEventSlot = async (attempt) => {
|
|
135090
|
+
const current = eventIdToSlot(eventId);
|
|
135091
|
+
if (eventIdPinned || current === null) {
|
|
135092
|
+
return false;
|
|
134856
135093
|
}
|
|
134857
|
-
|
|
134858
|
-
|
|
135094
|
+
const slot = await drawEventSlot(effectiveRunId, {
|
|
135095
|
+
rescan: attempt > 0 && attempt % 8 === 0,
|
|
135096
|
+
atLeast: current + 1
|
|
135097
|
+
});
|
|
135098
|
+
if (slot === null) {
|
|
135099
|
+
return false;
|
|
135100
|
+
}
|
|
135101
|
+
eventId = slotToEventId(slot);
|
|
135102
|
+
event = { ...event, eventId };
|
|
135103
|
+
eventPath = taggedPath(basedir, "events", `${effectiveRunId}-${eventId}`, tag);
|
|
135104
|
+
serializedEvent = JSON.stringify(event, jsonReplacer, 2);
|
|
135105
|
+
return true;
|
|
135106
|
+
};
|
|
135107
|
+
let eventPublished = false;
|
|
135108
|
+
for (let attempt = 0; ; attempt++) {
|
|
135109
|
+
if (data.eventType === "hook_received") {
|
|
135110
|
+
const terminalByMarker = await isRunTerminalCommitted(basedir, effectiveRunId, tag);
|
|
135111
|
+
const runNow = terminalByMarker ? null : await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
|
|
135112
|
+
if (terminalByMarker || runNow && isTerminalWorkflowRunStatus(runNow.status)) {
|
|
134859
135113
|
throw new RunExpiredError(`Workflow run "${effectiveRunId}" is already in a terminal state`);
|
|
134860
135114
|
}
|
|
134861
|
-
const
|
|
134862
|
-
|
|
134863
|
-
|
|
135115
|
+
const stagedPath = pendingHookEventPath(basedir, effectiveRunId, `${eventId}.${monotonicUlid$1()}`, tag);
|
|
135116
|
+
const staged = await writeExclusive(stagedPath, serializedEvent);
|
|
135117
|
+
if (!staged) {
|
|
135118
|
+
throw new WorkflowWorldError(`Failed to stage event "${eventId}" for run "${effectiveRunId}": staging path already exists`);
|
|
134864
135119
|
}
|
|
134865
|
-
|
|
134866
|
-
|
|
134867
|
-
|
|
134868
|
-
|
|
135120
|
+
try {
|
|
135121
|
+
if (await isRunTerminalCommitted(basedir, effectiveRunId, tag)) {
|
|
135122
|
+
throw new RunExpiredError(`Workflow run "${effectiveRunId}" is already in a terminal state`);
|
|
135123
|
+
}
|
|
135124
|
+
const promoted = await promoteExclusive(stagedPath, eventPath);
|
|
135125
|
+
if (promoted === "missing") {
|
|
135126
|
+
throw new RunExpiredError(`Workflow run "${effectiveRunId}" is already in a terminal state`);
|
|
135127
|
+
}
|
|
135128
|
+
eventPublished = promoted === "linked";
|
|
135129
|
+
} finally {
|
|
135130
|
+
await deleteJSON(stagedPath).catch(() => {
|
|
135131
|
+
});
|
|
135132
|
+
}
|
|
135133
|
+
} else {
|
|
135134
|
+
eventPublished = await writeExclusive(eventPath, serializedEvent);
|
|
135135
|
+
}
|
|
135136
|
+
if (eventPublished) {
|
|
135137
|
+
notePublishedSlot(effectiveRunId, eventId);
|
|
135138
|
+
break;
|
|
135139
|
+
}
|
|
135140
|
+
if (data.eventType === "hook_received" && (params == null ? void 0 : params.resumeId)) {
|
|
135141
|
+
const occupant = await readJSONWithFallback(basedir, "events", `${effectiveRunId}-${eventId}`, EventSchema, tag);
|
|
135142
|
+
if (occupant && isResumeEvent(occupant, {
|
|
135143
|
+
resumeId: params.resumeId,
|
|
135144
|
+
hookId: data.correlationId
|
|
135145
|
+
})) {
|
|
135146
|
+
return { event: occupant };
|
|
135147
|
+
}
|
|
135148
|
+
}
|
|
135149
|
+
if (!await bumpEventSlot(attempt)) {
|
|
135150
|
+
break;
|
|
134869
135151
|
}
|
|
134870
|
-
} else {
|
|
134871
|
-
eventPublished = await writeExclusive(eventPath, serializedEvent);
|
|
134872
135152
|
}
|
|
134873
135153
|
if (!eventPublished) {
|
|
134874
135154
|
if (data.eventType === "hook_created" && data.correlationId) {
|
|
@@ -134877,57 +135157,55 @@ function createEventsStorage(basedir, tag) {
|
|
|
134877
135157
|
throw new EntityConflictError(`Event "${eventId}" already exists for run "${effectiveRunId}"`);
|
|
134878
135158
|
}
|
|
134879
135159
|
rememberStoredEvent(event, eventPath, serializedEvent);
|
|
135160
|
+
if (data.eventType === "hook_received" && (params == null ? void 0 : params.resumeId) && resumeClaimRecordedId !== null && resumeClaimRecordedId !== eventId) {
|
|
135161
|
+
await write(hookResumeClaimPath(basedir, effectiveRunId, params.resumeId), JSON.stringify({
|
|
135162
|
+
runId: effectiveRunId,
|
|
135163
|
+
resumeId: params.resumeId,
|
|
135164
|
+
hookId: data.correlationId,
|
|
135165
|
+
eventId,
|
|
135166
|
+
...params.resumePayloadDigest ? { payloadDigest: params.resumePayloadDigest } : {}
|
|
135167
|
+
}), { overwrite: true });
|
|
135168
|
+
}
|
|
134880
135169
|
if (hook && data.eventType === "hook_created") {
|
|
134881
135170
|
await writeHookByRunMarker(basedir, hook.runId, hook.hookId, tag);
|
|
134882
135171
|
await writeJSON(taggedPath(basedir, "hooks", hook.hookId, tag), hook, hookEntityWriteOptions);
|
|
134883
135172
|
}
|
|
134884
135173
|
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
134885
135174
|
const filteredEvent = stripEventDataRefs(event, resolveData);
|
|
134886
|
-
let
|
|
134887
|
-
|
|
134888
|
-
|
|
134889
|
-
|
|
134890
|
-
const allEvents = await paginatedFileSystemQuery({
|
|
134891
|
-
directory: path$3.join(basedir, "events"),
|
|
134892
|
-
schema: EventSchema,
|
|
134893
|
-
cachedItems: eventCache,
|
|
134894
|
-
filePrefix: `${effectiveRunId}-`,
|
|
134895
|
-
sortOrder: "asc",
|
|
134896
|
-
limit: 1e3,
|
|
134897
|
-
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
134898
|
-
getId: (e) => e.eventId
|
|
135175
|
+
let eventPage;
|
|
135176
|
+
if (data.eventType === "run_started" && run2 && !(params == null ? void 0 : params.skipPreload)) {
|
|
135177
|
+
eventPage = await queryRunEvents(effectiveRunId, {
|
|
135178
|
+
limit: getMaxEventsPerRun()
|
|
134899
135179
|
});
|
|
134900
|
-
|
|
134901
|
-
|
|
134902
|
-
|
|
134903
|
-
}
|
|
134904
|
-
if (isTerminalStepEventType(data.eventType) && typeof (params == null ? void 0 : params.sinceCursor) === "string") {
|
|
134905
|
-
const delta = await paginatedFileSystemQuery({
|
|
134906
|
-
directory: path$3.join(basedir, "events"),
|
|
134907
|
-
schema: EventSchema,
|
|
134908
|
-
filePrefix: `${effectiveRunId}-`,
|
|
135180
|
+
}
|
|
135181
|
+
if (typeof (params == null ? void 0 : params.sinceCursor) === "string") {
|
|
135182
|
+
const delta = await queryRunEvents(effectiveRunId, {
|
|
134909
135183
|
sortOrder: "asc",
|
|
134910
|
-
cursor: params.sinceCursor
|
|
134911
|
-
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
134912
|
-
getId: (e) => e.eventId
|
|
135184
|
+
cursor: params.sinceCursor
|
|
134913
135185
|
});
|
|
134914
|
-
|
|
134915
|
-
|
|
134916
|
-
|
|
135186
|
+
eventPage = resolveData === "none" ? {
|
|
135187
|
+
...delta,
|
|
135188
|
+
data: delta.data.map((event2) => stripEventDataRefs(event2, resolveData))
|
|
135189
|
+
} : delta;
|
|
134917
135190
|
}
|
|
134918
|
-
|
|
135191
|
+
const result = {
|
|
134919
135192
|
event: filteredEvent,
|
|
134920
135193
|
run: run2,
|
|
134921
135194
|
step,
|
|
134922
135195
|
hook,
|
|
134923
135196
|
wait,
|
|
134924
|
-
events: events2,
|
|
134925
|
-
cursor,
|
|
134926
|
-
hasMore,
|
|
134927
135197
|
...stepCreatedLazily ? { stepCreated: true } : {},
|
|
134928
135198
|
// Per-run event ceiling (mirrors the Vercel World).
|
|
134929
135199
|
...run2 ? { maxEvents: getMaxEventsPerRun() } : {}
|
|
134930
135200
|
};
|
|
135201
|
+
if (!eventPage)
|
|
135202
|
+
return result;
|
|
135203
|
+
return {
|
|
135204
|
+
...result,
|
|
135205
|
+
events: eventPage.data,
|
|
135206
|
+
cursor: eventPage.cursor,
|
|
135207
|
+
hasMore: eventPage.hasMore
|
|
135208
|
+
};
|
|
134931
135209
|
}
|
|
134932
135210
|
},
|
|
134933
135211
|
async get(runId, eventId, params) {
|
|
@@ -134942,22 +135220,13 @@ function createEventsStorage(basedir, tag) {
|
|
|
134942
135220
|
return stripEventDataRefs(event, resolveData);
|
|
134943
135221
|
},
|
|
134944
135222
|
async list(params) {
|
|
134945
|
-
var _a3
|
|
135223
|
+
var _a3;
|
|
134946
135224
|
const { runId } = params;
|
|
134947
135225
|
assertSafeEntityId("runId", runId);
|
|
134948
135226
|
const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
134949
|
-
const result = await
|
|
134950
|
-
|
|
134951
|
-
|
|
134952
|
-
cachedItems: eventCache,
|
|
134953
|
-
filePrefix: `${runId}-`,
|
|
134954
|
-
// Events in chronological order (oldest first) by default,
|
|
134955
|
-
// different from the default for other list calls.
|
|
134956
|
-
sortOrder: ((_a3 = params.pagination) == null ? void 0 : _a3.sortOrder) ?? "asc",
|
|
134957
|
-
limit: (_b2 = params.pagination) == null ? void 0 : _b2.limit,
|
|
134958
|
-
cursor: (_c2 = params.pagination) == null ? void 0 : _c2.cursor,
|
|
134959
|
-
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
134960
|
-
getId: (event) => event.eventId
|
|
135227
|
+
const result = await queryRunEvents(runId, {
|
|
135228
|
+
...params.pagination,
|
|
135229
|
+
limit: ((_a3 = params.pagination) == null ? void 0 : _a3.limit) ?? getMaxEventsPerRun()
|
|
134961
135230
|
});
|
|
134962
135231
|
if (resolveData === "none") {
|
|
134963
135232
|
return {
|
|
@@ -134989,7 +135258,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
134989
135258
|
limit: (_b2 = params.pagination) == null ? void 0 : _b2.limit,
|
|
134990
135259
|
cursor: (_c2 = params.pagination) == null ? void 0 : _c2.cursor,
|
|
134991
135260
|
getCreatedAt: getObjectCreatedAt("evnt"),
|
|
134992
|
-
getId: (event) => event.eventId
|
|
135261
|
+
getId: (event) => event.eventId,
|
|
135262
|
+
getSortKey: eventSortKey,
|
|
135263
|
+
getSortKeyFromFileId: (fileId) => eventSortKeyFromFileId(params.runId, fileId)
|
|
134993
135264
|
});
|
|
134994
135265
|
if (resolveData === "none") {
|
|
134995
135266
|
return {
|
|
@@ -135000,6 +135271,48 @@ function createEventsStorage(basedir, tag) {
|
|
|
135000
135271
|
return result;
|
|
135001
135272
|
}
|
|
135002
135273
|
};
|
|
135274
|
+
async function reportSkippedSlots(result, askedFor, resolveData) {
|
|
135275
|
+
if (!result.event) {
|
|
135276
|
+
return result;
|
|
135277
|
+
}
|
|
135278
|
+
const committedSlot = eventIdToSlot(result.event.eventId);
|
|
135279
|
+
if (committedSlot === null || askedFor < FIRST_EVENT_SLOT || committedSlot <= askedFor + 1) {
|
|
135280
|
+
return result;
|
|
135281
|
+
}
|
|
135282
|
+
const span = committedSlot - askedFor - 1;
|
|
135283
|
+
const page = await storage.list({
|
|
135284
|
+
runId: result.event.runId,
|
|
135285
|
+
pagination: {
|
|
135286
|
+
cursor: `${SORT_KEY_CURSOR_PREFIX}${slotToEventId(askedFor)}`,
|
|
135287
|
+
limit: span,
|
|
135288
|
+
sortOrder: "asc"
|
|
135289
|
+
},
|
|
135290
|
+
resolveData
|
|
135291
|
+
});
|
|
135292
|
+
const committedEventId = result.event.eventId;
|
|
135293
|
+
const events2 = page.data.filter((event) => event.eventId < committedEventId);
|
|
135294
|
+
return {
|
|
135295
|
+
...result,
|
|
135296
|
+
events: events2,
|
|
135297
|
+
// Deliberately no cursor: the report is a lower bound on what this write
|
|
135298
|
+
// skipped over, not a page the caller has now read to the end of, so it
|
|
135299
|
+
// must not advance the caller's read position.
|
|
135300
|
+
cursor: null,
|
|
135301
|
+
hasMore: events2.length < committedSlot - askedFor - 1
|
|
135302
|
+
};
|
|
135303
|
+
}
|
|
135304
|
+
const create2 = (async (runId, data, params) => {
|
|
135305
|
+
if ((params == null ? void 0 : params.eventCount) === void 0) {
|
|
135306
|
+
return storage.create(runId, data, params);
|
|
135307
|
+
}
|
|
135308
|
+
const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
135309
|
+
const result = await storage.create(runId, data, params);
|
|
135310
|
+
if (typeof params.sinceCursor === "string") {
|
|
135311
|
+
return result;
|
|
135312
|
+
}
|
|
135313
|
+
return reportSkippedSlots(result, params.eventCount, resolveData);
|
|
135314
|
+
});
|
|
135315
|
+
return { ...storage, create: create2 };
|
|
135003
135316
|
}
|
|
135004
135317
|
function createStepsStorage(basedir, tag) {
|
|
135005
135318
|
return {
|
|
@@ -135478,7 +135791,7 @@ function createWorld$2(args) {
|
|
|
135478
135791
|
const basedir = mergedConfig.dataDir;
|
|
135479
135792
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
135480
135793
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
135481
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
135794
|
+
const { HookSchema: HookSchema2 } = await import("./index-DsnQrgwB.js");
|
|
135482
135795
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
135483
135796
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
135484
135797
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -135661,8 +135974,8 @@ function requireGetVercelOidcToken() {
|
|
|
135661
135974
|
}
|
|
135662
135975
|
try {
|
|
135663
135976
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
135664
|
-
await import("./token-util-
|
|
135665
|
-
await import("./token-
|
|
135977
|
+
await import("./token-util-CighjZkT.js").then((n) => n.t),
|
|
135978
|
+
await import("./token-sFDUVNm0.js").then((n) => n.t)
|
|
135666
135979
|
]);
|
|
135667
135980
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
135668
135981
|
await refreshToken(options);
|
|
@@ -136226,7 +136539,6 @@ function requireDist() {
|
|
|
136226
136539
|
}
|
|
136227
136540
|
var distExports = requireDist();
|
|
136228
136541
|
let _dispatcher;
|
|
136229
|
-
let _eventsDispatcher;
|
|
136230
136542
|
let _streamDispatcher;
|
|
136231
136543
|
let _streamCloseDispatcher;
|
|
136232
136544
|
const BASE_AGENT_OPTIONS = {
|
|
@@ -136250,6 +136562,11 @@ const EVENTS_AGENT_OPTIONS = {
|
|
|
136250
136562
|
initialWindowSize: H2_STREAM_WINDOW_BYTES,
|
|
136251
136563
|
connectionWindowSize: H2_CONNECTION_WINDOW_BYTES
|
|
136252
136564
|
};
|
|
136565
|
+
const EVENTS_AGENT_OPTIONS_NO_H2 = {
|
|
136566
|
+
...BASE_AGENT_OPTIONS,
|
|
136567
|
+
allowH2: false,
|
|
136568
|
+
pipelining: 1
|
|
136569
|
+
};
|
|
136253
136570
|
const STREAM_AGENT_OPTIONS = {
|
|
136254
136571
|
...BASE_AGENT_OPTIONS,
|
|
136255
136572
|
allowH2: true,
|
|
@@ -136280,7 +136597,7 @@ const STREAM_CLOSE_RETRY_OPTIONS = {
|
|
|
136280
136597
|
statusCodes: [429, 500, 502, 503, 504]
|
|
136281
136598
|
};
|
|
136282
136599
|
const H2_REBUFFER_MAX_BYTES = 1 << 20;
|
|
136283
|
-
function
|
|
136600
|
+
function h2EventsEnabled() {
|
|
136284
136601
|
return process.env.WORKFLOW_H2_MULTIPLEX !== "0";
|
|
136285
136602
|
}
|
|
136286
136603
|
function contentLength(headers2) {
|
|
@@ -136314,11 +136631,84 @@ function h2MultiplexInterceptor(dispatch2) {
|
|
|
136314
136631
|
return true;
|
|
136315
136632
|
};
|
|
136316
136633
|
}
|
|
136634
|
+
const EVENTS_RECYCLE_AFTER_CONSECUTIVE_FAILURES = 3;
|
|
136635
|
+
const RECYCLE_MIN_INTERVAL_MS = 5e3;
|
|
136636
|
+
const RETIRED_CLOSE_DELAY_MS = 5e3;
|
|
136637
|
+
const RETIRED_DESTROY_DELAY_MS = 6e4;
|
|
136638
|
+
const RECYCLABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
136639
|
+
// Covers H2 stream timeout, frameError and GOAWAY (undici InformationalError).
|
|
136640
|
+
"UND_ERR_INFO",
|
|
136641
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
136642
|
+
"UND_ERR_BODY_TIMEOUT"
|
|
136643
|
+
]);
|
|
136644
|
+
const MAX_CAUSE_DEPTH = 8;
|
|
136645
|
+
function isRecyclableTransportError(error2) {
|
|
136646
|
+
let current = error2;
|
|
136647
|
+
for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth++) {
|
|
136648
|
+
const code2 = current.code;
|
|
136649
|
+
if (typeof code2 === "string" && RECYCLABLE_ERROR_CODES.has(code2)) {
|
|
136650
|
+
return true;
|
|
136651
|
+
}
|
|
136652
|
+
current = current.cause;
|
|
136653
|
+
}
|
|
136654
|
+
return false;
|
|
136655
|
+
}
|
|
136656
|
+
function createDispatcherRecycler(factory, label) {
|
|
136657
|
+
let current;
|
|
136658
|
+
let consecutiveFailures = 0;
|
|
136659
|
+
let lastRecycledAt = 0;
|
|
136660
|
+
function retire(stale) {
|
|
136661
|
+
var _a3, _b2;
|
|
136662
|
+
const closeTimer = setTimeout(() => {
|
|
136663
|
+
var _a4;
|
|
136664
|
+
void Promise.resolve((_a4 = stale.close) == null ? void 0 : _a4.call(stale)).catch(() => void 0);
|
|
136665
|
+
}, RETIRED_CLOSE_DELAY_MS);
|
|
136666
|
+
const destroyTimer = setTimeout(() => {
|
|
136667
|
+
var _a4;
|
|
136668
|
+
void Promise.resolve((_a4 = stale.destroy) == null ? void 0 : _a4.call(stale)).catch(() => void 0);
|
|
136669
|
+
}, RETIRED_DESTROY_DELAY_MS);
|
|
136670
|
+
(_a3 = closeTimer.unref) == null ? void 0 : _a3.call(closeTimer);
|
|
136671
|
+
(_b2 = destroyTimer.unref) == null ? void 0 : _b2.call(destroyTimer);
|
|
136672
|
+
}
|
|
136673
|
+
return {
|
|
136674
|
+
get() {
|
|
136675
|
+
current ?? (current = factory());
|
|
136676
|
+
return current;
|
|
136677
|
+
},
|
|
136678
|
+
note(dispatcher2, error2) {
|
|
136679
|
+
if (!current || dispatcher2 !== current)
|
|
136680
|
+
return;
|
|
136681
|
+
if (error2 === void 0) {
|
|
136682
|
+
consecutiveFailures = 0;
|
|
136683
|
+
return;
|
|
136684
|
+
}
|
|
136685
|
+
if (!isRecyclableTransportError(error2))
|
|
136686
|
+
return;
|
|
136687
|
+
consecutiveFailures++;
|
|
136688
|
+
if (consecutiveFailures < EVENTS_RECYCLE_AFTER_CONSECUTIVE_FAILURES) {
|
|
136689
|
+
return;
|
|
136690
|
+
}
|
|
136691
|
+
const now2 = Date.now();
|
|
136692
|
+
if (now2 - lastRecycledAt < RECYCLE_MIN_INTERVAL_MS)
|
|
136693
|
+
return;
|
|
136694
|
+
lastRecycledAt = now2;
|
|
136695
|
+
consecutiveFailures = 0;
|
|
136696
|
+
const stale = current;
|
|
136697
|
+
current = void 0;
|
|
136698
|
+
console.warn(`[workflow] ${label}: rebuilding connection pool after ${EVENTS_RECYCLE_AFTER_CONSECUTIVE_FAILURES} consecutive transport failures`);
|
|
136699
|
+
retire(stale);
|
|
136700
|
+
}
|
|
136701
|
+
};
|
|
136702
|
+
}
|
|
136703
|
+
const eventsRecycler = createDispatcherRecycler(() => createEventsDispatcher(), "events transport");
|
|
136704
|
+
function noteEventsTransportOutcome(dispatcher2, error2) {
|
|
136705
|
+
eventsRecycler.note(dispatcher2, error2);
|
|
136706
|
+
}
|
|
136317
136707
|
function getDispatcher(config2) {
|
|
136318
136708
|
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultDispatcher();
|
|
136319
136709
|
}
|
|
136320
136710
|
function getEventsDispatcher(config2) {
|
|
136321
|
-
return (config2 == null ? void 0 : config2.dispatcher) ??
|
|
136711
|
+
return (config2 == null ? void 0 : config2.dispatcher) ?? eventsRecycler.get();
|
|
136322
136712
|
}
|
|
136323
136713
|
function getStreamDispatcher(config2) {
|
|
136324
136714
|
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultStreamDispatcher();
|
|
@@ -136330,8 +136720,12 @@ function makeRetryDispatcher(agentOptions, retryOptions) {
|
|
|
136330
136720
|
return new undiciExports.RetryAgent(new undiciExports.Agent(agentOptions), retryOptions);
|
|
136331
136721
|
}
|
|
136332
136722
|
function createEventsDispatcher(agentOverrides) {
|
|
136333
|
-
const
|
|
136334
|
-
|
|
136723
|
+
const h2 = h2EventsEnabled();
|
|
136724
|
+
const agent2 = new undiciExports.RetryAgent(new undiciExports.Agent({
|
|
136725
|
+
...h2 ? EVENTS_AGENT_OPTIONS : EVENTS_AGENT_OPTIONS_NO_H2,
|
|
136726
|
+
...agentOverrides
|
|
136727
|
+
}), RETRY_AGENT_OPTIONS);
|
|
136728
|
+
if (!h2) {
|
|
136335
136729
|
return agent2;
|
|
136336
136730
|
}
|
|
136337
136731
|
return withBoundLifecycle(agent2, agent2.compose(h2MultiplexInterceptor));
|
|
@@ -136348,10 +136742,6 @@ function getDefaultDispatcher() {
|
|
|
136348
136742
|
_dispatcher ?? (_dispatcher = makeRetryDispatcher(DEFAULT_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
136349
136743
|
return _dispatcher;
|
|
136350
136744
|
}
|
|
136351
|
-
function getDefaultEventsDispatcher() {
|
|
136352
|
-
_eventsDispatcher ?? (_eventsDispatcher = createEventsDispatcher());
|
|
136353
|
-
return _eventsDispatcher;
|
|
136354
|
-
}
|
|
136355
136745
|
function getDefaultStreamDispatcher() {
|
|
136356
136746
|
_streamDispatcher ?? (_streamDispatcher = createStreamDispatcher(STREAM_RETRY_OPTIONS));
|
|
136357
136747
|
return _streamDispatcher;
|
|
@@ -136461,6 +136851,7 @@ const ServerAddress = SemanticConvention("server.address");
|
|
|
136461
136851
|
const ServerPort = SemanticConvention("server.port");
|
|
136462
136852
|
const HttpResponseStatusCode = SemanticConvention("http.response.status_code");
|
|
136463
136853
|
const ErrorType = SemanticConvention("error.type");
|
|
136854
|
+
const NetworkProtocolName = SemanticConvention("network.protocol.name");
|
|
136464
136855
|
const WorldParseFormat = SemanticConvention("workflow.world.parse.format");
|
|
136465
136856
|
const PeerService = SemanticConvention("peer.service");
|
|
136466
136857
|
const RpcSystem = SemanticConvention("rpc.system");
|
|
@@ -136471,6 +136862,14 @@ const StepId = SemanticConvention("step.id");
|
|
|
136471
136862
|
const WorkflowStreamName = SemanticConvention("workflow.stream.name");
|
|
136472
136863
|
const WorkflowStreamOperation = SemanticConvention("workflow.stream.operation");
|
|
136473
136864
|
const WorkflowStreamStartIndex = SemanticConvention("workflow.stream.start_index");
|
|
136865
|
+
const WorkflowEventsTransport = SemanticConvention("workflow.events.transport");
|
|
136866
|
+
const WorkflowEventType = SemanticConvention("workflow.event.type");
|
|
136867
|
+
const WorkflowClientVersion = SemanticConvention("workflow.client.version");
|
|
136868
|
+
const StepStsoMs = SemanticConvention("step.stso_ms");
|
|
136869
|
+
const StepLatencyOptimizations = SemanticConvention("step.latency_optimizations");
|
|
136870
|
+
const WorkflowWsUrl = SemanticConvention("workflow.events.ws.url");
|
|
136871
|
+
const WorkflowWsRequestId = SemanticConvention("workflow.events.ws.req_id");
|
|
136872
|
+
const WorkflowWsReconnectAttempt = SemanticConvention("workflow.events.ws.reconnect_attempt");
|
|
136474
136873
|
const REQUEST_TIMEOUT_MS = 6e4;
|
|
136475
136874
|
const getRequestTimeoutMs = () => envNumber("WORKFLOW_REQUEST_TIMEOUT_MS", REQUEST_TIMEOUT_MS, {
|
|
136476
136875
|
integer: true,
|
|
@@ -136512,12 +136911,25 @@ function parseRetryAfter(value) {
|
|
|
136512
136911
|
const parsed = parseInt(value, 10);
|
|
136513
136912
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
136514
136913
|
}
|
|
136914
|
+
function headersToRecord(headers2) {
|
|
136915
|
+
const out = {};
|
|
136916
|
+
headers2.forEach((value, key) => {
|
|
136917
|
+
out[key] = value;
|
|
136918
|
+
});
|
|
136919
|
+
return out;
|
|
136920
|
+
}
|
|
136515
136921
|
function errorForResponse(status, message2, opts = {}) {
|
|
136516
136922
|
const { retryAfter, code: code2, url: url2, mitigated, details } = opts;
|
|
136517
136923
|
if (status === 409)
|
|
136518
136924
|
return new EntityConflictError(message2);
|
|
136519
|
-
if (status === 410)
|
|
136925
|
+
if (status === 410) {
|
|
136926
|
+
if (code2 === "stream-expired") {
|
|
136927
|
+
const streamDetails = details && typeof details === "object" ? details : void 0;
|
|
136928
|
+
const expiredAt = typeof (streamDetails == null ? void 0 : streamDetails.expiredAt) === "string" ? new Date(streamDetails.expiredAt) : void 0;
|
|
136929
|
+
return new StreamExpiredError(message2, typeof (streamDetails == null ? void 0 : streamDetails.runId) === "string" ? streamDetails.runId : void 0, typeof (streamDetails == null ? void 0 : streamDetails.streamId) === "string" ? streamDetails.streamId : void 0, expiredAt && !Number.isNaN(expiredAt.getTime()) ? expiredAt : void 0);
|
|
136930
|
+
}
|
|
136520
136931
|
return new RunExpiredError(message2);
|
|
136932
|
+
}
|
|
136521
136933
|
if (status === 412)
|
|
136522
136934
|
return new PreconditionFailedError(message2, { retryAfter, details });
|
|
136523
136935
|
if (status === 425)
|
|
@@ -136544,9 +136956,10 @@ async function resolveVercelApiToken(opts) {
|
|
|
136544
136956
|
function parseServer(url2) {
|
|
136545
136957
|
try {
|
|
136546
136958
|
const parsed = new URL(url2);
|
|
136959
|
+
const secure = parsed.protocol === "https:" || parsed.protocol === "wss:";
|
|
136547
136960
|
return {
|
|
136548
136961
|
serverAddress: parsed.hostname,
|
|
136549
|
-
serverPort: parsed.port ? parseInt(parsed.port, 10) :
|
|
136962
|
+
serverPort: parsed.port ? parseInt(parsed.port, 10) : secure ? 443 : 80
|
|
136550
136963
|
};
|
|
136551
136964
|
} catch {
|
|
136552
136965
|
return {};
|
|
@@ -136565,11 +136978,9 @@ function httpClientSpanAttributes(args) {
|
|
|
136565
136978
|
...RpcService(peerService)
|
|
136566
136979
|
};
|
|
136567
136980
|
}
|
|
136568
|
-
async function
|
|
136569
|
-
const { method, url: url2,
|
|
136570
|
-
const label = logLabel ?? url2;
|
|
136981
|
+
async function withHttpClientSpan(opts, fn2) {
|
|
136982
|
+
const { method, url: url2, peerService = "workflow-server", spanName, attributes } = opts;
|
|
136571
136983
|
return trace(spanName ?? `http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
136572
|
-
var _a3, _b2, _c2;
|
|
136573
136984
|
if (spanName && HTTP_DEBUG_ENABLED && span) {
|
|
136574
136985
|
const ctx = span.spanContext();
|
|
136575
136986
|
console.warn("[workflow:otel-diag] span-open", JSON.stringify({
|
|
@@ -136582,6 +136993,20 @@ async function instrumentedFetch(opts) {
|
|
|
136582
136993
|
span == null ? void 0 : span.setAttributes(httpClientSpanAttributes({ method, url: url2, peerService }));
|
|
136583
136994
|
if (attributes)
|
|
136584
136995
|
span == null ? void 0 : span.setAttributes(attributes);
|
|
136996
|
+
return fn2(span);
|
|
136997
|
+
});
|
|
136998
|
+
}
|
|
136999
|
+
function recordClientSpanStatus(span, status) {
|
|
137000
|
+
span == null ? void 0 : span.setAttributes({ ...HttpResponseStatusCode(status) });
|
|
137001
|
+
if (status < 200 || status >= 300) {
|
|
137002
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType(`HTTP ${status}`) });
|
|
137003
|
+
}
|
|
137004
|
+
}
|
|
137005
|
+
async function instrumentedFetch(opts) {
|
|
137006
|
+
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;
|
|
137007
|
+
const label = logLabel ?? url2;
|
|
137008
|
+
return withHttpClientSpan({ method, url: url2, peerService, spanName, attributes }, async (span) => {
|
|
137009
|
+
var _a3, _b2, _c2;
|
|
136585
137010
|
if (injectTraceContext2)
|
|
136586
137011
|
await injectTraceContextIntoHeaders(headers2);
|
|
136587
137012
|
if (cacheBust)
|
|
@@ -136601,6 +137026,7 @@ async function instrumentedFetch(opts) {
|
|
|
136601
137026
|
});
|
|
136602
137027
|
} catch (error2) {
|
|
136603
137028
|
const elapsed = Date.now() - start2;
|
|
137029
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome(error2);
|
|
136604
137030
|
if (error2 instanceof Error && (error2.name === "TimeoutError" || error2.name === "AbortError")) {
|
|
136605
137031
|
const timeoutError = new WorkflowWorldError(`${method} ${label} timed out after ${elapsed}ms`, { url: url2, cause: error2 });
|
|
136606
137032
|
span == null ? void 0 : span.setAttributes({ ...ErrorType("TIMEOUT") });
|
|
@@ -136610,12 +137036,12 @@ async function instrumentedFetch(opts) {
|
|
|
136610
137036
|
throw error2;
|
|
136611
137037
|
}
|
|
136612
137038
|
const ms2 = Date.now() - start2;
|
|
137039
|
+
onTransportOutcome == null ? void 0 : onTransportOutcome();
|
|
136613
137040
|
httpLog(method, label, response2, ms2);
|
|
136614
|
-
span
|
|
137041
|
+
recordClientSpanStatus(span, response2.status);
|
|
136615
137042
|
if (durationAttribute)
|
|
136616
137043
|
span == null ? void 0 : span.setAttributes({ [durationAttribute]: ms2 });
|
|
136617
137044
|
if (!response2.ok) {
|
|
136618
|
-
span == null ? void 0 : span.setAttributes({ ...ErrorType(`HTTP ${response2.status}`) });
|
|
136619
137045
|
logCurlRepro(method, url2, headers2);
|
|
136620
137046
|
if (buildError) {
|
|
136621
137047
|
const error3 = await buildError(response2);
|
|
@@ -136633,7 +137059,7 @@ async function instrumentedFetch(opts) {
|
|
|
136633
137059
|
return response2;
|
|
136634
137060
|
});
|
|
136635
137061
|
}
|
|
136636
|
-
const version = "5.0.0-beta.
|
|
137062
|
+
const version = "5.0.0-beta.38";
|
|
136637
137063
|
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
136638
137064
|
const MAX_BODY_PARSE_RETRIES = 2;
|
|
136639
137065
|
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
@@ -136823,7 +137249,8 @@ async function makeRequest({ endpoint, options = {}, config: config2 = {}, schem
|
|
|
136823
137249
|
url: url2,
|
|
136824
137250
|
code: errorCode,
|
|
136825
137251
|
retryAfter,
|
|
136826
|
-
mitigated: response2.headers.get("x-vercel-mitigated")
|
|
137252
|
+
mitigated: response2.headers.get("x-vercel-mitigated"),
|
|
137253
|
+
details: errorData.details
|
|
136827
137254
|
});
|
|
136828
137255
|
span == null ? void 0 : span.setAttributes({
|
|
136829
137256
|
...ErrorType(errorCode || `HTTP ${response2.status}`)
|
|
@@ -136910,6 +137337,16 @@ function createQueryString(params) {
|
|
|
136910
137337
|
const query = params.toString();
|
|
136911
137338
|
return query ? `?${query}` : "";
|
|
136912
137339
|
}
|
|
137340
|
+
function normalizeEventIds(eventIds) {
|
|
137341
|
+
const uniqueEventIds = [...new Set(eventIds)];
|
|
137342
|
+
if (uniqueEventIds.length === 0) {
|
|
137343
|
+
throw new RangeError("eventIds must contain at least one event ID");
|
|
137344
|
+
}
|
|
137345
|
+
if (uniqueEventIds.length > ANALYTICS_EVENTS_GET_MANY_LIMIT) {
|
|
137346
|
+
throw new RangeError(`eventIds must contain at most ${ANALYTICS_EVENTS_GET_MANY_LIMIT} unique event IDs`);
|
|
137347
|
+
}
|
|
137348
|
+
return uniqueEventIds;
|
|
137349
|
+
}
|
|
136913
137350
|
function appendAttributeListParams(searchParams, params) {
|
|
136914
137351
|
if (params.workflowName) {
|
|
136915
137352
|
searchParams.set("workflowName", params.workflowName);
|
|
@@ -136990,6 +137427,15 @@ function createAnalytics(config2) {
|
|
|
136990
137427
|
schema: AnalyticsEventSchema
|
|
136991
137428
|
});
|
|
136992
137429
|
},
|
|
137430
|
+
getMany(runId, eventIds) {
|
|
137431
|
+
return makeRequest({
|
|
137432
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/get-many`,
|
|
137433
|
+
options: { method: "POST" },
|
|
137434
|
+
data: { eventIds: normalizeEventIds(eventIds) },
|
|
137435
|
+
config: config2,
|
|
137436
|
+
schema: AnalyticsEventSchema.array()
|
|
137437
|
+
});
|
|
137438
|
+
},
|
|
136993
137439
|
list(params) {
|
|
136994
137440
|
const searchParams = new URLSearchParams();
|
|
136995
137441
|
if (params.eventType) {
|
|
@@ -137377,7 +137823,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
|
|
|
137377
137823
|
};
|
|
137378
137824
|
}
|
|
137379
137825
|
async function getDeadline() {
|
|
137380
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
137826
|
+
const { getDeadline: getDeadline2 } = await import("./index-ByPjQpgH.js").then((n) => n.i);
|
|
137381
137827
|
return getDeadline2();
|
|
137382
137828
|
}
|
|
137383
137829
|
const WORKFLOW_SERVER_SERVICE = {
|
|
@@ -142194,6 +142640,9 @@ var QueueClient = class {
|
|
|
142194
142640
|
function missingDeploymentIdMessage(operation) {
|
|
142195
142641
|
return `${operation} requires VERCEL_DEPLOYMENT_ID, which Vercel sets in every deployment, so this process is not running inside one. The Vercel world is only selected automatically when that variable is set, so it was requested explicitly here — most often by WORKFLOW_TARGET_WORLD=vercel in a process that is not a deployment, such as a production server started locally or in CI. To use the local filesystem world instead, set WORKFLOW_TARGET_WORLD=local or unset it.`;
|
|
142196
142642
|
}
|
|
142643
|
+
function isWsEventsTransportEnabled() {
|
|
142644
|
+
return process.env.WORKFLOW_EVENTS_TRANSPORT === "ws";
|
|
142645
|
+
}
|
|
142197
142646
|
class CborTransport {
|
|
142198
142647
|
constructor() {
|
|
142199
142648
|
__publicField(this, "contentType", "application/cbor");
|
|
@@ -142288,6 +142737,37 @@ function getRunIdFromPayload(payload) {
|
|
|
142288
142737
|
}
|
|
142289
142738
|
return void 0;
|
|
142290
142739
|
}
|
|
142740
|
+
const wsEventsChannelForInvocation = (runId, config2) => {
|
|
142741
|
+
let claim;
|
|
142742
|
+
return {
|
|
142743
|
+
/**
|
|
142744
|
+
* Unawaited and failure-proof: callers treat the handshake as free. The
|
|
142745
|
+
* refcount therefore rises a microtask late, so a write racing the import
|
|
142746
|
+
* finds no channel and goes over HTTP — one frame, not the invocation,
|
|
142747
|
+
* since `close` awaits this same promise and so cannot release ahead of
|
|
142748
|
+
* the claim it is releasing.
|
|
142749
|
+
*/
|
|
142750
|
+
open() {
|
|
142751
|
+
if (!runId || !isWsEventsTransportEnabled())
|
|
142752
|
+
return;
|
|
142753
|
+
claim = import("./ws-transport-DaZsgQ2B.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
|
|
142754
|
+
},
|
|
142755
|
+
/**
|
|
142756
|
+
* Awaited, unlike the open: work scheduled after the handler returns is not
|
|
142757
|
+
* guaranteed to run, and an open socket is not `unref`'d, so skipping this
|
|
142758
|
+
* stops the process exiting and keeps a server invocation pinned.
|
|
142759
|
+
*
|
|
142760
|
+
* Releases the claim the open returned rather than re-resolving the run,
|
|
142761
|
+
* which is what keeps a channel this invocation never opened — a later
|
|
142762
|
+
* invocation's, registered under the same URL after ours was evicted — out
|
|
142763
|
+
* of reach of our release.
|
|
142764
|
+
*/
|
|
142765
|
+
async close() {
|
|
142766
|
+
const release = await claim;
|
|
142767
|
+
release == null ? void 0 : release();
|
|
142768
|
+
}
|
|
142769
|
+
};
|
|
142770
|
+
};
|
|
142291
142771
|
const RUN_ID_PREFIX = "wrun_";
|
|
142292
142772
|
function regionFromTaggedRunId(runId) {
|
|
142293
142773
|
if (!runId)
|
|
@@ -142432,15 +142912,21 @@ function createQueue$1(config2) {
|
|
|
142432
142912
|
}
|
|
142433
142913
|
const requestId = requestIdStorage.getStore();
|
|
142434
142914
|
const { payload, queueName, deploymentId } = MessageWrapper.parse(message2);
|
|
142435
|
-
const
|
|
142436
|
-
|
|
142437
|
-
|
|
142438
|
-
|
|
142439
|
-
|
|
142440
|
-
|
|
142441
|
-
|
|
142442
|
-
|
|
142443
|
-
|
|
142915
|
+
const wsEvents = wsEventsChannelForInvocation(getRunIdFromPayload(payload), config2);
|
|
142916
|
+
wsEvents.open();
|
|
142917
|
+
try {
|
|
142918
|
+
const result = await handler(payload, {
|
|
142919
|
+
queueName,
|
|
142920
|
+
messageId: MessageId.parse(metadata.messageId),
|
|
142921
|
+
attempt: metadata.deliveryCount,
|
|
142922
|
+
requestId
|
|
142923
|
+
});
|
|
142924
|
+
if (typeof (result == null ? void 0 : result.timeoutSeconds) === "number") {
|
|
142925
|
+
const delaySeconds = result.timeoutSeconds > 0 ? Math.min(result.timeoutSeconds, MAX_DELAY_SECONDS) : void 0;
|
|
142926
|
+
await queue(queueName, payload, { deploymentId, delaySeconds });
|
|
142927
|
+
}
|
|
142928
|
+
} finally {
|
|
142929
|
+
await wsEvents.close();
|
|
142444
142930
|
}
|
|
142445
142931
|
}, {
|
|
142446
142932
|
// Without an explicit retry directive, @vercel/queue leaves failed
|
|
@@ -142517,15 +143003,6 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
142517
143003
|
return result.data.id;
|
|
142518
143004
|
};
|
|
142519
143005
|
}
|
|
142520
|
-
function coerceEventDates(raw2) {
|
|
142521
|
-
const parsed = EventSchema.safeParse(raw2);
|
|
142522
|
-
if (parsed.success)
|
|
142523
|
-
return parsed.data;
|
|
142524
|
-
if (EventTypeSchema.safeParse(raw2.eventType).success) {
|
|
142525
|
-
console.debug(`[workflow:world-vercel] v4 event ${raw2.eventId} failed EventSchema parse for known eventType '${raw2.eventType}'; passing through unparsed: ${parsed.error.message}`);
|
|
142526
|
-
}
|
|
142527
|
-
return raw2;
|
|
142528
|
-
}
|
|
142529
143006
|
const EVENT_RETRY_ELIGIBILITY = {
|
|
142530
143007
|
// Creates: conditional create → 409 EntityConflictError if it already exists.
|
|
142531
143008
|
run_created: {
|
|
@@ -142604,6 +143081,8 @@ const EVENT_RETRY_ELIGIBILITY = {
|
|
|
142604
143081
|
}
|
|
142605
143082
|
};
|
|
142606
143083
|
const MAX_EVENT_POST_RETRIES = 2;
|
|
143084
|
+
const THROTTLE_RETRY_BUDGET_MS = 3e4;
|
|
143085
|
+
const DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
|
|
142607
143086
|
const EVENT_POST_RETRY_BASE_MS = 100;
|
|
142608
143087
|
const EVENT_POST_RETRY_JITTER_MS = 50;
|
|
142609
143088
|
const TRANSIENT_CODES = /* @__PURE__ */ new Set([
|
|
@@ -142651,6 +143130,8 @@ function isRetryableEventPostError(err) {
|
|
|
142651
143130
|
if (WorkflowWorldError.is(err)) {
|
|
142652
143131
|
if (err.code === "PARSE_ERROR")
|
|
142653
143132
|
return true;
|
|
143133
|
+
if (err.code === "TRANSPORT")
|
|
143134
|
+
return true;
|
|
142654
143135
|
if (typeof err.status === "number") {
|
|
142655
143136
|
return err.status >= 500 && err.status <= 599;
|
|
142656
143137
|
}
|
|
@@ -142671,37 +143152,63 @@ function errorMarker(err) {
|
|
|
142671
143152
|
}
|
|
142672
143153
|
return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
|
|
142673
143154
|
}
|
|
142674
|
-
|
|
143155
|
+
function createThrottleWaiter(eventType) {
|
|
143156
|
+
let waitedMs = 0;
|
|
143157
|
+
return async (err) => {
|
|
143158
|
+
const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
|
|
143159
|
+
if (waitedMs + waitMs > THROTTLE_RETRY_BUDGET_MS) {
|
|
143160
|
+
logRetry("throttle retry budget exhausted; surfacing to the queue", {
|
|
143161
|
+
eventType,
|
|
143162
|
+
waitedMs,
|
|
143163
|
+
retryAfter: err.retryAfter
|
|
143164
|
+
});
|
|
143165
|
+
throw err;
|
|
143166
|
+
}
|
|
143167
|
+
waitedMs += waitMs;
|
|
143168
|
+
console.warn(`[workflow] Throttled (429) writing ${eventType} event; retrying in-process in ${waitMs / 1e3}s`);
|
|
143169
|
+
await sleep$1(waitMs);
|
|
143170
|
+
};
|
|
143171
|
+
}
|
|
143172
|
+
function isEligibleForTransientRetry(eventType, options) {
|
|
142675
143173
|
var _a3;
|
|
142676
|
-
|
|
142677
|
-
|
|
143174
|
+
return eventType === "hook_received" && (options == null ? void 0 : options.idempotentHookResume) === true || (((_a3 = EVENT_RETRY_ELIGIBILITY[eventType]) == null ? void 0 : _a3.retryable) ?? false);
|
|
143175
|
+
}
|
|
143176
|
+
async function withEventPostRetry(fn2, eventType, options) {
|
|
143177
|
+
const retryable = isEligibleForTransientRetry(eventType, options);
|
|
143178
|
+
const waitOutThrottle = createThrottleWaiter(eventType);
|
|
143179
|
+
for (let attempt = 0; ; ) {
|
|
142678
143180
|
try {
|
|
142679
143181
|
return await fn2();
|
|
142680
143182
|
} catch (err) {
|
|
142681
|
-
|
|
142682
|
-
|
|
142683
|
-
const backoff = EVENT_POST_RETRY_BASE_MS * 2 ** attempt + Math.floor(Math.random() * EVENT_POST_RETRY_JITTER_MS);
|
|
142684
|
-
logRetry("retrying event POST after transient failure", {
|
|
142685
|
-
eventType,
|
|
142686
|
-
attempt: attempt + 1,
|
|
142687
|
-
backoffMs: backoff,
|
|
142688
|
-
error: errorMarker(err)
|
|
142689
|
-
});
|
|
142690
|
-
await sleep$1(backoff);
|
|
143183
|
+
if (ThrottleError.is(err)) {
|
|
143184
|
+
await waitOutThrottle(err);
|
|
142691
143185
|
continue;
|
|
142692
143186
|
}
|
|
142693
|
-
if (
|
|
143187
|
+
if (!retryable || !isRetryableEventPostError(err)) {
|
|
143188
|
+
throw err;
|
|
143189
|
+
}
|
|
143190
|
+
if (attempt >= MAX_EVENT_POST_RETRIES) {
|
|
142694
143191
|
logRetry("exhausted in-process retries; surfacing for queue redelivery", {
|
|
142695
143192
|
eventType,
|
|
142696
143193
|
attempts: attempt + 1,
|
|
142697
143194
|
error: errorMarker(err)
|
|
142698
143195
|
});
|
|
143196
|
+
throw err;
|
|
142699
143197
|
}
|
|
142700
|
-
|
|
143198
|
+
const backoff = EVENT_POST_RETRY_BASE_MS * 2 ** attempt + Math.floor(Math.random() * EVENT_POST_RETRY_JITTER_MS);
|
|
143199
|
+
attempt++;
|
|
143200
|
+
logRetry("retrying event POST after transient failure", {
|
|
143201
|
+
eventType,
|
|
143202
|
+
attempt,
|
|
143203
|
+
backoffMs: backoff,
|
|
143204
|
+
error: errorMarker(err)
|
|
143205
|
+
});
|
|
143206
|
+
await sleep$1(backoff);
|
|
142701
143207
|
}
|
|
142702
143208
|
}
|
|
142703
143209
|
}
|
|
142704
143210
|
const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
|
|
143211
|
+
const CborObjectSchema = record(string$3(), unknown$1());
|
|
142705
143212
|
function encodeFrame(meta2, body2) {
|
|
142706
143213
|
const metaBytes = new Uint8Array(encode$1(meta2));
|
|
142707
143214
|
const out = new Uint8Array(4 + metaBytes.byteLength + 4 + body2.byteLength);
|
|
@@ -142743,7 +143250,7 @@ async function* decodeFrames(source) {
|
|
|
142743
143250
|
if (!await refill(metaLen)) {
|
|
142744
143251
|
throw new Error("decodeFrames: truncated meta block");
|
|
142745
143252
|
}
|
|
142746
|
-
const meta2 = decode$1(take(metaLen));
|
|
143253
|
+
const meta2 = CborObjectSchema.parse(decode$1(take(metaLen)));
|
|
142747
143254
|
if (!await refill(4)) {
|
|
142748
143255
|
throw new Error("decodeFrames: truncated body length");
|
|
142749
143256
|
}
|
|
@@ -142784,35 +143291,264 @@ async function* readerToIterator(reader) {
|
|
|
142784
143291
|
closeQuietly(() => reader.cancel());
|
|
142785
143292
|
}
|
|
142786
143293
|
}
|
|
142787
|
-
|
|
143294
|
+
const FORMAT_PREFIX_LENGTH = 4;
|
|
143295
|
+
const DEVALUE_FORMAT_PREFIX = "devl";
|
|
143296
|
+
const ENCRYPTED_FORMAT_PREFIX = "encr";
|
|
143297
|
+
const GZIP_FORMAT_PREFIX = "gzip";
|
|
143298
|
+
const ZSTD_FORMAT_PREFIX = "zstd";
|
|
143299
|
+
const formatDecoder = new TextDecoder();
|
|
143300
|
+
const SERIALIZED_DATA_FORMAT_PREFIXES = /* @__PURE__ */ new Set([
|
|
143301
|
+
DEVALUE_FORMAT_PREFIX,
|
|
143302
|
+
ENCRYPTED_FORMAT_PREFIX,
|
|
143303
|
+
GZIP_FORMAT_PREFIX,
|
|
143304
|
+
ZSTD_FORMAT_PREFIX
|
|
143305
|
+
]);
|
|
143306
|
+
function getNodeZlib() {
|
|
143307
|
+
var _a3, _b2;
|
|
143308
|
+
try {
|
|
143309
|
+
return (_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.getBuiltinModule) == null ? void 0 : _b2.call(_a3, "node:zlib");
|
|
143310
|
+
} catch {
|
|
143311
|
+
return void 0;
|
|
143312
|
+
}
|
|
143313
|
+
}
|
|
143314
|
+
function peekFormatPrefix(value) {
|
|
143315
|
+
if (!(value instanceof Uint8Array) || value.byteLength < FORMAT_PREFIX_LENGTH) {
|
|
143316
|
+
return null;
|
|
143317
|
+
}
|
|
143318
|
+
return formatDecoder.decode(value.subarray(0, FORMAT_PREFIX_LENGTH));
|
|
143319
|
+
}
|
|
143320
|
+
function hasSerializedDataFormatPrefix(value) {
|
|
143321
|
+
const format2 = peekFormatPrefix(value);
|
|
143322
|
+
return format2 !== null && SERIALIZED_DATA_FORMAT_PREFIXES.has(format2);
|
|
143323
|
+
}
|
|
143324
|
+
function decompress(format2, payload) {
|
|
143325
|
+
const zlib = getNodeZlib();
|
|
143326
|
+
const decompress2 = format2 === ZSTD_FORMAT_PREFIX ? zlib == null ? void 0 : zlib.zstdDecompressSync : zlib == null ? void 0 : zlib.gunzipSync;
|
|
143327
|
+
if (!decompress2) {
|
|
143328
|
+
throw new WorkflowWorldError(`Received ${format2}-compressed workflow data, but this Node.js runtime does not support ${format2} decompression. Use a compatible Node.js runtime or request unresolved data.`);
|
|
143329
|
+
}
|
|
143330
|
+
return new Uint8Array(decompress2(payload));
|
|
143331
|
+
}
|
|
143332
|
+
function normalizeSerializedData(value) {
|
|
143333
|
+
const format2 = peekFormatPrefix(value);
|
|
143334
|
+
if (format2 !== ZSTD_FORMAT_PREFIX && format2 !== GZIP_FORMAT_PREFIX) {
|
|
143335
|
+
return value;
|
|
143336
|
+
}
|
|
143337
|
+
const bytes = value;
|
|
143338
|
+
return decompress(format2, bytes.subarray(FORMAT_PREFIX_LENGTH));
|
|
143339
|
+
}
|
|
143340
|
+
function normalizeWorkflowRunData(run2) {
|
|
143341
|
+
return {
|
|
143342
|
+
...run2,
|
|
143343
|
+
input: normalizeSerializedData(run2.input),
|
|
143344
|
+
output: normalizeSerializedData(run2.output),
|
|
143345
|
+
error: normalizeSerializedData(run2.error)
|
|
143346
|
+
};
|
|
143347
|
+
}
|
|
143348
|
+
function normalizeStepData(step) {
|
|
143349
|
+
return {
|
|
143350
|
+
...step,
|
|
143351
|
+
input: normalizeSerializedData(step.input),
|
|
143352
|
+
output: normalizeSerializedData(step.output),
|
|
143353
|
+
error: normalizeSerializedData(step.error)
|
|
143354
|
+
};
|
|
143355
|
+
}
|
|
143356
|
+
function normalizeHookData(hook) {
|
|
143357
|
+
return {
|
|
143358
|
+
...hook,
|
|
143359
|
+
metadata: normalizeSerializedData(hook.metadata)
|
|
143360
|
+
};
|
|
143361
|
+
}
|
|
143362
|
+
const StepWireSchema = StepSchema.omit({
|
|
143363
|
+
error: true
|
|
143364
|
+
}).extend({
|
|
143365
|
+
error: union([SerializedDataSchema, any()]).optional(),
|
|
143366
|
+
errorRef: any().optional()
|
|
143367
|
+
});
|
|
143368
|
+
const StepWireWithRefsSchema = StepWireSchema.omit({
|
|
143369
|
+
input: true,
|
|
143370
|
+
output: true
|
|
143371
|
+
}).extend({
|
|
143372
|
+
// We discard the results of the refs, so we don't care about the type here
|
|
143373
|
+
inputRef: any().optional(),
|
|
143374
|
+
outputRef: any().optional(),
|
|
143375
|
+
input: _instanceof(Uint8Array).optional(),
|
|
143376
|
+
output: _instanceof(Uint8Array).optional()
|
|
143377
|
+
});
|
|
143378
|
+
function deserializeStep(wireStep) {
|
|
143379
|
+
const { error: error2, errorRef, ...rest } = wireStep;
|
|
143380
|
+
const result = { ...rest };
|
|
143381
|
+
const errorSource = error2 ?? errorRef;
|
|
143382
|
+
if (errorSource !== void 0 && errorSource !== null) {
|
|
143383
|
+
result.error = errorSource;
|
|
143384
|
+
}
|
|
143385
|
+
return result;
|
|
143386
|
+
}
|
|
143387
|
+
function filterStepData(step, resolveData) {
|
|
143388
|
+
if (resolveData === "none") {
|
|
143389
|
+
const { inputRef: _inputRef, outputRef: _outputRef, ...rest } = step;
|
|
143390
|
+
const deserialized = normalizeStepData(deserializeStep(rest));
|
|
143391
|
+
return {
|
|
143392
|
+
...deserialized,
|
|
143393
|
+
input: void 0,
|
|
143394
|
+
output: void 0
|
|
143395
|
+
};
|
|
143396
|
+
}
|
|
143397
|
+
return normalizeStepData(deserializeStep(step));
|
|
143398
|
+
}
|
|
143399
|
+
async function listWorkflowRunSteps(params, config2) {
|
|
143400
|
+
const { runId, pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
143401
|
+
const searchParams = new URLSearchParams();
|
|
143402
|
+
if (pagination == null ? void 0 : pagination.cursor)
|
|
143403
|
+
searchParams.set("cursor", pagination.cursor);
|
|
143404
|
+
if (pagination == null ? void 0 : pagination.limit)
|
|
143405
|
+
searchParams.set("limit", pagination.limit.toString());
|
|
143406
|
+
if (pagination == null ? void 0 : pagination.sortOrder)
|
|
143407
|
+
searchParams.set("sortOrder", pagination.sortOrder);
|
|
143408
|
+
const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
|
|
143409
|
+
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
143410
|
+
const queryString = searchParams.toString();
|
|
143411
|
+
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps${queryString ? `?${queryString}` : ""}`;
|
|
143412
|
+
const response2 = await makeRequest({
|
|
143413
|
+
endpoint,
|
|
143414
|
+
options: { method: "GET" },
|
|
143415
|
+
config: config2,
|
|
143416
|
+
schema: PaginatedResponseSchema(remoteRefBehavior === "lazy" ? StepWireWithRefsSchema : StepWireSchema)
|
|
143417
|
+
});
|
|
143418
|
+
return {
|
|
143419
|
+
...response2,
|
|
143420
|
+
data: response2.data.map((step) => filterStepData(step, resolveData))
|
|
143421
|
+
};
|
|
143422
|
+
}
|
|
143423
|
+
async function getStep(runId, stepId, params, config2) {
|
|
143424
|
+
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
143425
|
+
const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
|
|
143426
|
+
const searchParams = new URLSearchParams();
|
|
143427
|
+
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
143428
|
+
const queryString = searchParams.toString();
|
|
143429
|
+
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}${queryString ? `?${queryString}` : ""}`;
|
|
143430
|
+
const step = await makeRequest({
|
|
143431
|
+
endpoint,
|
|
143432
|
+
options: { method: "GET" },
|
|
143433
|
+
config: config2,
|
|
143434
|
+
schema: remoteRefBehavior === "lazy" ? StepWireWithRefsSchema : StepWireSchema
|
|
143435
|
+
});
|
|
143436
|
+
return filterStepData(step, resolveData);
|
|
143437
|
+
}
|
|
143438
|
+
async function fetchV4(url2, init2, config2, opName, attributes) {
|
|
143439
|
+
const dispatcher2 = getEventsDispatcher(config2);
|
|
142788
143440
|
return instrumentedFetch({
|
|
142789
143441
|
method: init2.method,
|
|
142790
143442
|
url: url2,
|
|
142791
143443
|
headers: init2.headers,
|
|
142792
143444
|
body: init2.body,
|
|
142793
|
-
dispatcher:
|
|
143445
|
+
dispatcher: dispatcher2,
|
|
143446
|
+
attributes,
|
|
143447
|
+
// Repeated transport failures retire the shared events pool and the next
|
|
143448
|
+
// request builds a fresh one. undici keeps a black-holed HTTP/2 session in
|
|
143449
|
+
// service indefinitely, so without this every request routed onto it fails
|
|
143450
|
+
// until the compute instance is recycled — see noteEventsTransportOutcome.
|
|
143451
|
+
onTransportOutcome: (error2) => noteEventsTransportOutcome(dispatcher2, error2),
|
|
142794
143452
|
timeoutMs: null,
|
|
142795
143453
|
logLabel: opName,
|
|
142796
|
-
|
|
143454
|
+
// Read the body as bytes, not text: a CBOR error body (the fence 412
|
|
143455
|
+
// carries event payloads back) does not survive a UTF-8 decode.
|
|
143456
|
+
buildError: async (response2) => errorFromV4Response(response2.status, headersToRecord(response2.headers), new Uint8Array(await response2.arrayBuffer()), opName, url2)
|
|
142797
143457
|
});
|
|
142798
143458
|
}
|
|
142799
|
-
|
|
142800
|
-
|
|
142801
|
-
|
|
142802
|
-
|
|
143459
|
+
const EVENT_ID_HEADER = "x-wf-event-id";
|
|
143460
|
+
const MAX_EVENTS_HEADER = "x-wf-max-events";
|
|
143461
|
+
function eventsV4Url(baseUrl, runId, eventType) {
|
|
143462
|
+
return `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventType)}`;
|
|
143463
|
+
}
|
|
143464
|
+
const CreateEventV4BodyBaseSchema = object$1({
|
|
143465
|
+
event: EventSchema,
|
|
143466
|
+
run: WorkflowRunSchema.optional(),
|
|
143467
|
+
step: StepWireSchema.transform(deserializeStep).optional(),
|
|
143468
|
+
hook: HookSchema.optional(),
|
|
143469
|
+
wait: WaitSchema.optional(),
|
|
143470
|
+
stepCreated: literal(true).optional(),
|
|
143471
|
+
maxEvents: number$3().int().positive().optional()
|
|
143472
|
+
});
|
|
143473
|
+
const CreateEventV4PageSchema = union([
|
|
143474
|
+
object$1({
|
|
143475
|
+
events: array$1(EventSchema),
|
|
143476
|
+
cursor: string$3().nullable(),
|
|
143477
|
+
hasMore: boolean$3()
|
|
143478
|
+
}),
|
|
143479
|
+
object$1({
|
|
143480
|
+
events: _undefined(),
|
|
143481
|
+
cursor: _undefined(),
|
|
143482
|
+
hasMore: _undefined()
|
|
143483
|
+
})
|
|
143484
|
+
]);
|
|
143485
|
+
const CreateEventV4BodySchema = CreateEventV4BodyBaseSchema.and(CreateEventV4PageSchema);
|
|
143486
|
+
const CreateEventV4BodySchemas = {
|
|
143487
|
+
run_created: CreateEventV4BodyBaseSchema.extend({
|
|
143488
|
+
run: WorkflowRunSchema
|
|
143489
|
+
}).and(CreateEventV4PageSchema),
|
|
143490
|
+
run_started: CreateEventV4BodyBaseSchema.extend({
|
|
143491
|
+
run: WorkflowRunSchema.and(object$1({ startedAt: date$2() }))
|
|
143492
|
+
}).and(CreateEventV4PageSchema),
|
|
143493
|
+
step_started: CreateEventV4BodyBaseSchema.extend({
|
|
143494
|
+
step: StepWireSchema.extend({
|
|
143495
|
+
startedAt: date$2()
|
|
143496
|
+
}).transform((step) => ({
|
|
143497
|
+
...deserializeStep(step),
|
|
143498
|
+
startedAt: step.startedAt
|
|
143499
|
+
}))
|
|
143500
|
+
}).and(CreateEventV4PageSchema),
|
|
143501
|
+
run_completed: CreateEventV4BodySchema,
|
|
143502
|
+
run_failed: CreateEventV4BodySchema,
|
|
143503
|
+
run_cancelled: CreateEventV4BodySchema,
|
|
143504
|
+
attr_set: CreateEventV4BodySchema,
|
|
143505
|
+
step_created: CreateEventV4BodySchema,
|
|
143506
|
+
step_completed: CreateEventV4BodySchema,
|
|
143507
|
+
step_failed: CreateEventV4BodySchema,
|
|
143508
|
+
step_retrying: CreateEventV4BodySchema,
|
|
143509
|
+
hook_created: CreateEventV4BodySchema,
|
|
143510
|
+
hook_received: CreateEventV4BodySchema,
|
|
143511
|
+
hook_disposed: CreateEventV4BodySchema,
|
|
143512
|
+
hook_conflict: CreateEventV4BodySchema,
|
|
143513
|
+
wait_created: CreateEventV4BodySchema,
|
|
143514
|
+
wait_completed: CreateEventV4BodySchema
|
|
143515
|
+
};
|
|
143516
|
+
const MaxEventsHeaderSchema = number$2().int().positive();
|
|
143517
|
+
const EventStreamEndSchema = object$1({
|
|
143518
|
+
_end: literal(1),
|
|
143519
|
+
next: string$3().optional(),
|
|
143520
|
+
hasMore: boolean$3()
|
|
143521
|
+
});
|
|
143522
|
+
const legacyStructuredErrorEventTypes = /* @__PURE__ */ new Set([
|
|
143523
|
+
"run_failed",
|
|
143524
|
+
"step_failed",
|
|
143525
|
+
"step_retrying"
|
|
143526
|
+
]);
|
|
143527
|
+
function decodeLegacyStructuredError(payload) {
|
|
143528
|
+
if (hasSerializedDataFormatPrefix(payload))
|
|
143529
|
+
return payload;
|
|
143530
|
+
try {
|
|
143531
|
+
const parsed = StructuredErrorSchema.safeParse(decode$1(payload.slice()));
|
|
143532
|
+
return parsed.success ? parsed.data : payload;
|
|
143533
|
+
} catch {
|
|
143534
|
+
return payload;
|
|
143535
|
+
}
|
|
143536
|
+
}
|
|
143537
|
+
function decodeEventFrame({ meta: meta2, body: body2 }) {
|
|
143538
|
+
const eventType = EventTypeSchema.parse(meta2.eventType);
|
|
143539
|
+
if (body2.byteLength === 0)
|
|
143540
|
+
return EventSchema.parse(meta2);
|
|
143541
|
+
const payloadField = getEventDataPayloadField(eventType);
|
|
143542
|
+
assert$1(payloadField, `Event type ${eventType} cannot carry a payload body`);
|
|
143543
|
+
assert$1(meta2.eventData && typeof meta2.eventData === "object");
|
|
143544
|
+
return EventSchema.parse({
|
|
143545
|
+
...meta2,
|
|
143546
|
+
eventData: {
|
|
143547
|
+
...meta2.eventData,
|
|
143548
|
+
[payloadField]: legacyStructuredErrorEventTypes.has(eventType) ? decodeLegacyStructuredError(body2) : body2
|
|
143549
|
+
}
|
|
142803
143550
|
});
|
|
142804
|
-
return out;
|
|
142805
143551
|
}
|
|
142806
|
-
const V4_RESPONSE_HEADERS = {
|
|
142807
|
-
eventId: "x-wf-event-id",
|
|
142808
|
-
runId: "x-wf-run-id",
|
|
142809
|
-
createdAt: "x-wf-created-at",
|
|
142810
|
-
/**
|
|
142811
|
-
* Server-owned per-run event ceiling. Set on streamed replay-log
|
|
142812
|
-
* responses, where there is no CBOR body to carry `maxEvents`.
|
|
142813
|
-
*/
|
|
142814
|
-
maxEvents: "x-wf-max-events"
|
|
142815
|
-
};
|
|
142816
143552
|
function buildPostFrameMeta(input) {
|
|
142817
143553
|
const meta2 = {
|
|
142818
143554
|
eventType: input.eventType,
|
|
@@ -142892,39 +143628,35 @@ function buildPostFrameMeta(input) {
|
|
|
142892
143628
|
}
|
|
142893
143629
|
if (input.sinceCursor !== void 0)
|
|
142894
143630
|
meta2.sinceCursor = input.sinceCursor;
|
|
142895
|
-
if (input.skipPreload
|
|
142896
|
-
meta2.skipPreload =
|
|
142897
|
-
if (input.
|
|
142898
|
-
meta2.
|
|
142899
|
-
}
|
|
142900
|
-
if (input.stateEventCount !== void 0) {
|
|
142901
|
-
meta2.stateEventCount = input.stateEventCount;
|
|
142902
|
-
}
|
|
142903
|
-
if (input.stateCursor !== void 0)
|
|
142904
|
-
meta2.stateCursor = input.stateCursor;
|
|
143631
|
+
if (input.skipPreload)
|
|
143632
|
+
meta2.skipPreload = true;
|
|
143633
|
+
if (input.maxSlot !== void 0)
|
|
143634
|
+
meta2.maxSlot = input.maxSlot;
|
|
142905
143635
|
if (input.replayDivergenceCount !== void 0) {
|
|
142906
143636
|
meta2.replayDivergenceCount = input.replayDivergenceCount;
|
|
142907
143637
|
}
|
|
142908
143638
|
if (input.resumePayloadDigest !== void 0) {
|
|
142909
143639
|
meta2.resumePayloadDigest = input.resumePayloadDigest;
|
|
142910
143640
|
}
|
|
143641
|
+
if (input.viaStepDispatch !== void 0) {
|
|
143642
|
+
meta2.viaStepDispatch = input.viaStepDispatch;
|
|
143643
|
+
}
|
|
142911
143644
|
return meta2;
|
|
142912
143645
|
}
|
|
142913
143646
|
function errorFromV4Response(statusCode, responseHeaders, errorBody, opName, url2) {
|
|
142914
143647
|
let message2 = `v4 ${opName} failed: HTTP ${statusCode}`;
|
|
142915
143648
|
let code2;
|
|
142916
143649
|
let details;
|
|
142917
|
-
|
|
142918
|
-
|
|
142919
|
-
if (typeof
|
|
142920
|
-
message2 =
|
|
142921
|
-
if (typeof
|
|
142922
|
-
code2 =
|
|
143650
|
+
const { record: record2, text: text2 } = parseV4ErrorBody(errorBody, readHeader(responseHeaders, "content-type"));
|
|
143651
|
+
if (record2) {
|
|
143652
|
+
if (typeof record2.message === "string")
|
|
143653
|
+
message2 = record2.message;
|
|
143654
|
+
if (typeof record2.code === "string")
|
|
143655
|
+
code2 = record2.code;
|
|
142923
143656
|
if (statusCode === 412)
|
|
142924
|
-
details = decodePreconditionDetails(
|
|
142925
|
-
}
|
|
142926
|
-
|
|
142927
|
-
message2 += ` ${errorBody}`;
|
|
143657
|
+
details = decodePreconditionDetails(record2);
|
|
143658
|
+
} else if (text2) {
|
|
143659
|
+
message2 += ` ${text2}`;
|
|
142928
143660
|
}
|
|
142929
143661
|
const retryAfter = parseRetryAfter(readHeader(responseHeaders, "retry-after"));
|
|
142930
143662
|
return errorForResponse(statusCode, message2, {
|
|
@@ -142935,6 +143667,27 @@ function errorFromV4Response(statusCode, responseHeaders, errorBody, opName, url
|
|
|
142935
143667
|
...details !== void 0 ? { details } : {}
|
|
142936
143668
|
});
|
|
142937
143669
|
}
|
|
143670
|
+
function parseV4ErrorBody(body2, contentType) {
|
|
143671
|
+
if (typeof body2 !== "string" && (contentType == null ? void 0 : contentType.includes("application/cbor"))) {
|
|
143672
|
+
try {
|
|
143673
|
+
const decoded = decode$1(body2.slice());
|
|
143674
|
+
if (typeof decoded === "object" && decoded !== null) {
|
|
143675
|
+
return { record: decoded };
|
|
143676
|
+
}
|
|
143677
|
+
} catch {
|
|
143678
|
+
}
|
|
143679
|
+
return {};
|
|
143680
|
+
}
|
|
143681
|
+
const text2 = typeof body2 === "string" ? body2 : new TextDecoder().decode(body2);
|
|
143682
|
+
try {
|
|
143683
|
+
const json2 = JSON.parse(text2);
|
|
143684
|
+
if (typeof json2 === "object" && json2 !== null) {
|
|
143685
|
+
return { record: json2 };
|
|
143686
|
+
}
|
|
143687
|
+
} catch {
|
|
143688
|
+
}
|
|
143689
|
+
return { text: text2 };
|
|
143690
|
+
}
|
|
142938
143691
|
function decodePreconditionDetails(json2) {
|
|
142939
143692
|
if (!Array.isArray(json2.events) || json2.events.length === 0)
|
|
142940
143693
|
return void 0;
|
|
@@ -142947,7 +143700,10 @@ function decodePreconditionDetails(json2) {
|
|
|
142947
143700
|
return void 0;
|
|
142948
143701
|
if (hasUnusablePayload(candidate))
|
|
142949
143702
|
return void 0;
|
|
142950
|
-
|
|
143703
|
+
const event = EventSchema.safeParse(candidate);
|
|
143704
|
+
if (!event.success)
|
|
143705
|
+
return void 0;
|
|
143706
|
+
events2.push(event.data);
|
|
142951
143707
|
}
|
|
142952
143708
|
return {
|
|
142953
143709
|
events: events2,
|
|
@@ -142969,49 +143725,155 @@ function hasUnusablePayload(candidate) {
|
|
|
142969
143725
|
return false;
|
|
142970
143726
|
return !(value instanceof Uint8Array);
|
|
142971
143727
|
}
|
|
142972
|
-
async function
|
|
143728
|
+
async function postWorkflowRunEventV4(input, responseType, config2) {
|
|
142973
143729
|
const { baseUrl, headers: baseHeaders } = await getHttpConfig(config2);
|
|
142974
143730
|
const headers2 = new Headers(baseHeaders);
|
|
142975
143731
|
headers2.set("Content-Type", "application/octet-stream");
|
|
143732
|
+
if (responseType === "event-stream") {
|
|
143733
|
+
headers2.set("Accept", V4_FRAME_CONTENT_TYPE);
|
|
143734
|
+
}
|
|
142976
143735
|
const frame2 = encodeFrame(buildPostFrameMeta(input), input.payload ?? new Uint8Array(0));
|
|
142977
|
-
const url2 =
|
|
142978
|
-
|
|
142979
|
-
|
|
143736
|
+
const url2 = eventsV4Url(baseUrl, input.runId, input.eventType);
|
|
143737
|
+
return fetchV4(url2, { method: "POST", headers: headers2, body: frame2 }, config2, "createEvent", {
|
|
143738
|
+
...WorkflowEventsTransport("http"),
|
|
143739
|
+
...WorkflowEventType(input.eventType),
|
|
143740
|
+
...WorkflowClientVersion(`@workflow/world-vercel/${version}`),
|
|
143741
|
+
...input.stso !== void 0 ? StepStsoMs(input.stso) : {},
|
|
143742
|
+
...input.optimizations !== void 0 ? StepLatencyOptimizations(input.optimizations) : {}
|
|
143743
|
+
});
|
|
142980
143744
|
}
|
|
142981
|
-
async function
|
|
142982
|
-
|
|
142983
|
-
|
|
142984
|
-
|
|
142985
|
-
|
|
142986
|
-
throw new Error("v4 createEvent: response missing required x-wf-* headers");
|
|
143745
|
+
async function createWorkflowRunEventV4(input, config2) {
|
|
143746
|
+
if (isWsEventsTransportEnabled()) {
|
|
143747
|
+
const reply = await postEventFrameOverWs(input, config2);
|
|
143748
|
+
if (reply)
|
|
143749
|
+
return decodeCreateEventResponse(reply, input.eventType);
|
|
142987
143750
|
}
|
|
143751
|
+
const response2 = await postWorkflowRunEventV4(input, "materialized", config2);
|
|
143752
|
+
const contentType = response2.headers.get("content-type");
|
|
143753
|
+
if (contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE)) {
|
|
143754
|
+
throw new Error("v4 createEvent: unexpected event page");
|
|
143755
|
+
}
|
|
143756
|
+
return decodeCreateEventResponse(response2, input.eventType);
|
|
143757
|
+
}
|
|
143758
|
+
async function decodeCreateEventResponse(response2, eventType) {
|
|
142988
143759
|
const bodyBytes = new Uint8Array(await response2.arrayBuffer());
|
|
142989
|
-
|
|
142990
|
-
|
|
143760
|
+
if (bodyBytes.byteLength === 0) {
|
|
143761
|
+
throw new Error("v4 createEvent: empty response body");
|
|
143762
|
+
}
|
|
143763
|
+
const schema = CreateEventV4BodySchemas[eventType].refine(({ event }) => event.eventType === eventType || eventType === "hook_created" && event.eventType === "hook_conflict", { path: ["event", "eventType"] });
|
|
143764
|
+
const parsedBody = schema.safeParse(decode$1(bodyBytes));
|
|
143765
|
+
if (!parsedBody.success) {
|
|
143766
|
+
throw new WorkflowWorldError("v4 createEvent: invalid response body", {
|
|
143767
|
+
code: "SCHEMA_VALIDATION",
|
|
143768
|
+
cause: parsedBody.error
|
|
143769
|
+
});
|
|
143770
|
+
}
|
|
143771
|
+
return parsedBody.data;
|
|
143772
|
+
}
|
|
143773
|
+
async function createWorkflowRunStartedEventV4(input, config2) {
|
|
143774
|
+
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "run_started" }, "event-stream", config2);
|
|
143775
|
+
const events2 = [];
|
|
143776
|
+
const page = await consumeEventFrameStream(response2, "createEvent", events2);
|
|
143777
|
+
assert$1(page.cursor, "v4 createEvent: event stream missing cursor");
|
|
143778
|
+
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
143779
|
+
if (!maxEvents.success) {
|
|
143780
|
+
throw new WorkflowWorldError("v4 createEvent: invalid max-events header", {
|
|
143781
|
+
code: "SCHEMA_VALIDATION",
|
|
143782
|
+
cause: maxEvents.error
|
|
143783
|
+
});
|
|
143784
|
+
}
|
|
143785
|
+
return { events: events2, ...page, maxEvents: maxEvents.data };
|
|
143786
|
+
}
|
|
143787
|
+
function replyMetaToHeaderRecord(meta2) {
|
|
143788
|
+
const out = {};
|
|
143789
|
+
if (typeof meta2.eventId === "string")
|
|
143790
|
+
out[EVENT_ID_HEADER] = meta2.eventId;
|
|
143791
|
+
if (typeof meta2.retryAfter === "string")
|
|
143792
|
+
out["retry-after"] = meta2.retryAfter;
|
|
143793
|
+
if (typeof meta2.mitigated === "string")
|
|
143794
|
+
out["x-vercel-mitigated"] = meta2.mitigated;
|
|
143795
|
+
return out;
|
|
143796
|
+
}
|
|
143797
|
+
function wsReplyStatus(reply, endpoint) {
|
|
143798
|
+
const { status } = reply.meta;
|
|
143799
|
+
if (typeof status !== "number") {
|
|
143800
|
+
throw new WorkflowWorldError(`Failed to parse response body for POST ${endpoint}: reply frame carried no numeric status (type: ${String(reply.meta.type ?? "absent")}). Refusing to treat an unrecognized reply as success — the write may or may not have been applied.`, { url: endpoint, code: "PARSE_ERROR" });
|
|
143801
|
+
}
|
|
143802
|
+
return status;
|
|
143803
|
+
}
|
|
143804
|
+
async function postEventFrameOverWs(input, config2) {
|
|
143805
|
+
const { resolveWsTransport } = await import("./ws-transport-DaZsgQ2B.js");
|
|
143806
|
+
const { runId } = input;
|
|
143807
|
+
const resolved = resolveWsTransport(runId, config2);
|
|
143808
|
+
if (!resolved)
|
|
143809
|
+
return void 0;
|
|
143810
|
+
const { transport, wsUrl } = resolved;
|
|
143811
|
+
const endpoint = `${wsUrl}#runs/${encodeURIComponent(runId)}/events`;
|
|
143812
|
+
const restUrl = eventsV4Url(getHttpUrl(config2).baseUrl, runId, input.eventType);
|
|
143813
|
+
return withHttpClientSpan({
|
|
143814
|
+
method: "POST",
|
|
143815
|
+
url: restUrl,
|
|
143816
|
+
attributes: {
|
|
143817
|
+
...WorkflowEventsTransport("ws"),
|
|
143818
|
+
...WorkflowEventType(input.eventType),
|
|
143819
|
+
...WorkflowClientVersion(`@workflow/world-vercel/${version}`),
|
|
143820
|
+
...input.stso !== void 0 ? StepStsoMs(input.stso) : {},
|
|
143821
|
+
...input.optimizations !== void 0 ? StepLatencyOptimizations(input.optimizations) : {},
|
|
143822
|
+
...NetworkProtocolName("websocket"),
|
|
143823
|
+
...WorkflowWsUrl(wsUrl)
|
|
143824
|
+
}
|
|
143825
|
+
}, async (span) => {
|
|
143826
|
+
var _a3, _b2;
|
|
143827
|
+
const start2 = Date.now();
|
|
143828
|
+
let reply;
|
|
143829
|
+
try {
|
|
143830
|
+
reply = await transport.request((reqId) => {
|
|
143831
|
+
span == null ? void 0 : span.setAttributes({ ...WorkflowWsRequestId(reqId) });
|
|
143832
|
+
return encodeFrame({ reqId, type: "event", event: buildPostFrameMeta(input) }, input.payload ?? new Uint8Array(0));
|
|
143833
|
+
});
|
|
143834
|
+
} catch (err) {
|
|
143835
|
+
const error2 = new WorkflowWorldError(`POST ${endpoint} transport failure: ${err instanceof Error ? err.message : String(err)}`, { url: wsUrl, code: "TRANSPORT", cause: err });
|
|
143836
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType("TRANSPORT") });
|
|
143837
|
+
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, error2);
|
|
143838
|
+
throw error2;
|
|
143839
|
+
}
|
|
143840
|
+
const ms2 = Date.now() - start2;
|
|
143841
|
+
const status = wsReplyStatus(reply, endpoint);
|
|
143842
|
+
const headerRecord = replyMetaToHeaderRecord(reply.meta);
|
|
143843
|
+
const headers2 = {
|
|
143844
|
+
get: (name2) => headerRecord[name2.toLowerCase()] ?? null
|
|
143845
|
+
};
|
|
143846
|
+
httpLog("POST", "createEvent", { status, headers: headers2 }, ms2);
|
|
143847
|
+
recordClientSpanStatus(span, status);
|
|
143848
|
+
if (status < 200 || status >= 300) {
|
|
143849
|
+
const error2 = errorFromV4Response(status, headerRecord, new TextDecoder().decode(reply.body), "createEvent", endpoint);
|
|
143850
|
+
(_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, error2);
|
|
143851
|
+
throw error2;
|
|
143852
|
+
}
|
|
143853
|
+
return {
|
|
143854
|
+
headers: headers2,
|
|
143855
|
+
arrayBuffer: async () => reply.body.slice().buffer
|
|
143856
|
+
};
|
|
143857
|
+
});
|
|
142991
143858
|
}
|
|
142992
143859
|
async function createHookReceivedPreloadEventV4(input, config2) {
|
|
142993
|
-
const {
|
|
142994
|
-
const headers2 = new Headers(baseHeaders);
|
|
142995
|
-
headers2.set("Content-Type", "application/octet-stream");
|
|
142996
|
-
headers2.set("Accept", V4_FRAME_CONTENT_TYPE);
|
|
142997
|
-
const frame2 = encodeFrame(buildPostFrameMeta(input), input.payload ?? new Uint8Array(0));
|
|
142998
|
-
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(input.runId)}/events/${encodeURIComponent(input.eventType)}`;
|
|
142999
|
-
const response2 = await fetchV4(url2, { method: "POST", headers: headers2, body: frame2 }, config2, "createEvent");
|
|
143860
|
+
const response2 = await postWorkflowRunEventV4({ ...input, eventType: "hook_received" }, "event-stream", config2);
|
|
143000
143861
|
const contentType = response2.headers.get("content-type");
|
|
143001
143862
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
143002
143863
|
return {
|
|
143003
143864
|
kind: "materialized",
|
|
143004
|
-
result: await
|
|
143865
|
+
result: await decodeCreateEventResponse(response2, "hook_received")
|
|
143005
143866
|
};
|
|
143006
143867
|
}
|
|
143007
|
-
const
|
|
143008
|
-
const
|
|
143009
|
-
const
|
|
143868
|
+
const events2 = [];
|
|
143869
|
+
const page = await consumeEventFrameStream(response2, "createEvent", events2);
|
|
143870
|
+
const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
|
|
143010
143871
|
return {
|
|
143011
143872
|
kind: "stream",
|
|
143873
|
+
events: events2,
|
|
143012
143874
|
...page,
|
|
143013
|
-
canonicalEventId: response2.headers.get(
|
|
143014
|
-
maxEvents:
|
|
143875
|
+
canonicalEventId: response2.headers.get(EVENT_ID_HEADER) ?? void 0,
|
|
143876
|
+
maxEvents: maxEvents.success ? maxEvents.data : void 0
|
|
143015
143877
|
};
|
|
143016
143878
|
}
|
|
143017
143879
|
function readHeader(responseHeaders, name2) {
|
|
@@ -143022,9 +143884,9 @@ function readHeader(responseHeaders, name2) {
|
|
|
143022
143884
|
return value[0];
|
|
143023
143885
|
return void 0;
|
|
143024
143886
|
}
|
|
143025
|
-
async function getEventV4(runId, eventId, config2) {
|
|
143887
|
+
async function getEventV4(runId, eventId, remoteRefBehavior, config2) {
|
|
143026
143888
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
143027
|
-
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}`;
|
|
143889
|
+
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}?remoteRefBehavior=${remoteRefBehavior}`;
|
|
143028
143890
|
const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, "getEvent");
|
|
143029
143891
|
const contentType = response2.headers.get("content-type");
|
|
143030
143892
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
@@ -143032,46 +143894,31 @@ async function getEventV4(runId, eventId, config2) {
|
|
|
143032
143894
|
}
|
|
143033
143895
|
const chunks = response2.body;
|
|
143034
143896
|
for await (const frame2 of decodeFrames(chunks)) {
|
|
143035
|
-
return
|
|
143897
|
+
return decodeEventFrame(frame2);
|
|
143036
143898
|
}
|
|
143037
143899
|
throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
|
|
143038
143900
|
}
|
|
143039
|
-
async function
|
|
143040
|
-
const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, opName);
|
|
143041
|
-
return decodeListFrameResponse(response2, opName);
|
|
143042
|
-
}
|
|
143043
|
-
async function decodeListFrameResponse(response2, opName) {
|
|
143901
|
+
async function consumeEventFrameStream(response2, opName, events2) {
|
|
143044
143902
|
const contentType = response2.headers.get("content-type");
|
|
143045
143903
|
if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
|
|
143046
143904
|
throw new Error(`v4 ${opName}: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`);
|
|
143047
143905
|
}
|
|
143048
143906
|
const chunks = response2.body;
|
|
143049
|
-
const events2 = [];
|
|
143050
|
-
let next2;
|
|
143051
|
-
let hasMore;
|
|
143052
|
-
let sawEndSentinel = false;
|
|
143053
143907
|
for await (const frame2 of decodeFrames(chunks)) {
|
|
143054
143908
|
if (frame2.meta._end === 1) {
|
|
143055
|
-
|
|
143056
|
-
|
|
143057
|
-
if (typeof frame2.meta.hasMore === "boolean")
|
|
143058
|
-
hasMore = frame2.meta.hasMore;
|
|
143059
|
-
sawEndSentinel = true;
|
|
143060
|
-
break;
|
|
143909
|
+
const end = EventStreamEndSchema.parse(frame2.meta);
|
|
143910
|
+
return { cursor: end.next ?? null, hasMore: end.hasMore };
|
|
143061
143911
|
}
|
|
143062
|
-
|
|
143063
|
-
|
|
143064
|
-
|
|
143065
|
-
|
|
143066
|
-
}
|
|
143067
|
-
if (!sawEndSentinel) {
|
|
143068
|
-
throw new Error(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read) — truncated response?`);
|
|
143912
|
+
if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
|
|
143913
|
+
throw new Error(`v4 ${opName}: unexpected control frame`);
|
|
143914
|
+
}
|
|
143915
|
+
events2.push(decodeEventFrame(frame2));
|
|
143069
143916
|
}
|
|
143070
|
-
|
|
143071
|
-
|
|
143072
|
-
|
|
143073
|
-
|
|
143074
|
-
|
|
143917
|
+
throw new Error(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read) — truncated response?`);
|
|
143918
|
+
}
|
|
143919
|
+
async function consumeListFrameStream(url2, headers2, config2, opName, events2) {
|
|
143920
|
+
const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, opName);
|
|
143921
|
+
return consumeEventFrameStream(response2, opName, events2);
|
|
143075
143922
|
}
|
|
143076
143923
|
function appendListParams(sp, params) {
|
|
143077
143924
|
if (params.cursor)
|
|
@@ -143086,14 +143933,28 @@ function appendListParams(sp, params) {
|
|
|
143086
143933
|
}
|
|
143087
143934
|
function paginationToQuery(params) {
|
|
143088
143935
|
const sp = new URLSearchParams();
|
|
143936
|
+
if (params.limit === void 0)
|
|
143937
|
+
sp.set("returnAll", "true");
|
|
143089
143938
|
appendListParams(sp, params);
|
|
143090
|
-
|
|
143091
|
-
return qs ? `?${qs}` : "";
|
|
143939
|
+
return `?${sp.toString()}`;
|
|
143092
143940
|
}
|
|
143093
143941
|
async function getWorkflowRunEventsV4(runId, params = {}, config2) {
|
|
143094
143942
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
143095
|
-
const
|
|
143096
|
-
|
|
143943
|
+
const events2 = [];
|
|
143944
|
+
let cursor = params.cursor;
|
|
143945
|
+
while (true) {
|
|
143946
|
+
const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({ ...params, cursor });
|
|
143947
|
+
try {
|
|
143948
|
+
const page = await consumeListFrameStream(url2, headers2, config2, "listEvents", events2);
|
|
143949
|
+
return { events: events2, ...page };
|
|
143950
|
+
} catch (error2) {
|
|
143951
|
+
const lastEvent = events2.at(-1);
|
|
143952
|
+
if (params.limit !== void 0 || !lastEvent || `eid:${lastEvent.eventId}` === cursor) {
|
|
143953
|
+
throw error2;
|
|
143954
|
+
}
|
|
143955
|
+
cursor = `eid:${lastEvent.eventId}`;
|
|
143956
|
+
}
|
|
143957
|
+
}
|
|
143097
143958
|
}
|
|
143098
143959
|
async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, config2) {
|
|
143099
143960
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
@@ -143102,100 +143963,9 @@ async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, con
|
|
|
143102
143963
|
sp.set("runId", runId);
|
|
143103
143964
|
appendListParams(sp, params);
|
|
143104
143965
|
const url2 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
143105
|
-
|
|
143106
|
-
|
|
143107
|
-
|
|
143108
|
-
const DEVALUE_FORMAT_PREFIX = "devl";
|
|
143109
|
-
const ENCRYPTED_FORMAT_PREFIX = "encr";
|
|
143110
|
-
const GZIP_FORMAT_PREFIX = "gzip";
|
|
143111
|
-
const ZSTD_FORMAT_PREFIX = "zstd";
|
|
143112
|
-
const formatDecoder = new TextDecoder();
|
|
143113
|
-
const SERIALIZED_DATA_FORMAT_PREFIXES = /* @__PURE__ */ new Set([
|
|
143114
|
-
DEVALUE_FORMAT_PREFIX,
|
|
143115
|
-
ENCRYPTED_FORMAT_PREFIX,
|
|
143116
|
-
GZIP_FORMAT_PREFIX,
|
|
143117
|
-
ZSTD_FORMAT_PREFIX
|
|
143118
|
-
]);
|
|
143119
|
-
function getNodeZlib() {
|
|
143120
|
-
var _a3, _b2;
|
|
143121
|
-
try {
|
|
143122
|
-
return (_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.getBuiltinModule) == null ? void 0 : _b2.call(_a3, "node:zlib");
|
|
143123
|
-
} catch {
|
|
143124
|
-
return void 0;
|
|
143125
|
-
}
|
|
143126
|
-
}
|
|
143127
|
-
function peekFormatPrefix(value) {
|
|
143128
|
-
if (!(value instanceof Uint8Array) || value.byteLength < FORMAT_PREFIX_LENGTH) {
|
|
143129
|
-
return null;
|
|
143130
|
-
}
|
|
143131
|
-
return formatDecoder.decode(value.subarray(0, FORMAT_PREFIX_LENGTH));
|
|
143132
|
-
}
|
|
143133
|
-
function hasSerializedDataFormatPrefix(value) {
|
|
143134
|
-
const format2 = peekFormatPrefix(value);
|
|
143135
|
-
return format2 !== null && SERIALIZED_DATA_FORMAT_PREFIXES.has(format2);
|
|
143136
|
-
}
|
|
143137
|
-
function decompress(format2, payload) {
|
|
143138
|
-
const zlib = getNodeZlib();
|
|
143139
|
-
const decompress2 = format2 === ZSTD_FORMAT_PREFIX ? zlib == null ? void 0 : zlib.zstdDecompressSync : zlib == null ? void 0 : zlib.gunzipSync;
|
|
143140
|
-
if (!decompress2) {
|
|
143141
|
-
throw new WorkflowWorldError(`Received ${format2}-compressed workflow data, but this Node.js runtime does not support ${format2} decompression. Use a compatible Node.js runtime or request unresolved data.`);
|
|
143142
|
-
}
|
|
143143
|
-
return new Uint8Array(decompress2(payload));
|
|
143144
|
-
}
|
|
143145
|
-
function normalizeSerializedData(value) {
|
|
143146
|
-
const format2 = peekFormatPrefix(value);
|
|
143147
|
-
if (format2 !== ZSTD_FORMAT_PREFIX && format2 !== GZIP_FORMAT_PREFIX) {
|
|
143148
|
-
return value;
|
|
143149
|
-
}
|
|
143150
|
-
const bytes = value;
|
|
143151
|
-
return decompress(format2, bytes.subarray(FORMAT_PREFIX_LENGTH));
|
|
143152
|
-
}
|
|
143153
|
-
function normalizeWorkflowRunData(run2) {
|
|
143154
|
-
return {
|
|
143155
|
-
...run2,
|
|
143156
|
-
input: normalizeSerializedData(run2.input),
|
|
143157
|
-
output: normalizeSerializedData(run2.output),
|
|
143158
|
-
error: normalizeSerializedData(run2.error)
|
|
143159
|
-
};
|
|
143160
|
-
}
|
|
143161
|
-
function normalizeStepData(step) {
|
|
143162
|
-
return {
|
|
143163
|
-
...step,
|
|
143164
|
-
input: normalizeSerializedData(step.input),
|
|
143165
|
-
output: normalizeSerializedData(step.output),
|
|
143166
|
-
error: normalizeSerializedData(step.error)
|
|
143167
|
-
};
|
|
143168
|
-
}
|
|
143169
|
-
function normalizeHookData(hook) {
|
|
143170
|
-
return {
|
|
143171
|
-
...hook,
|
|
143172
|
-
metadata: normalizeSerializedData(hook.metadata)
|
|
143173
|
-
};
|
|
143174
|
-
}
|
|
143175
|
-
function normalizeEventData(event) {
|
|
143176
|
-
const eventData = event.eventData;
|
|
143177
|
-
if (!eventData || typeof eventData !== "object") {
|
|
143178
|
-
return event;
|
|
143179
|
-
}
|
|
143180
|
-
const eventType = typeof event.eventType === "string" ? event.eventType : "";
|
|
143181
|
-
const refFields = getEventDataRefFields(eventType);
|
|
143182
|
-
if (refFields.length === 0) {
|
|
143183
|
-
return event;
|
|
143184
|
-
}
|
|
143185
|
-
const normalizedEventData = { ...eventData };
|
|
143186
|
-
let changed = false;
|
|
143187
|
-
for (const field of refFields) {
|
|
143188
|
-
if (!(field in normalizedEventData)) {
|
|
143189
|
-
continue;
|
|
143190
|
-
}
|
|
143191
|
-
const before = normalizedEventData[field];
|
|
143192
|
-
const after = normalizeSerializedData(before);
|
|
143193
|
-
if (after !== before) {
|
|
143194
|
-
normalizedEventData[field] = after;
|
|
143195
|
-
changed = true;
|
|
143196
|
-
}
|
|
143197
|
-
}
|
|
143198
|
-
return changed ? { ...event, eventData: normalizedEventData } : event;
|
|
143966
|
+
const events2 = [];
|
|
143967
|
+
const page = await consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId", events2);
|
|
143968
|
+
return { events: events2, ...page };
|
|
143199
143969
|
}
|
|
143200
143970
|
const WorkflowRunWireBaseSchema = WorkflowRunBaseSchema.omit({
|
|
143201
143971
|
error: true,
|
|
@@ -143366,82 +144136,6 @@ async function experimentalSetAttributes(runId, changes, options, config2) {
|
|
|
143366
144136
|
throw error2;
|
|
143367
144137
|
}
|
|
143368
144138
|
}
|
|
143369
|
-
const StepWireSchema = StepSchema.omit({
|
|
143370
|
-
error: true
|
|
143371
|
-
}).extend({
|
|
143372
|
-
error: union([SerializedDataSchema, any()]).optional(),
|
|
143373
|
-
errorRef: any().optional()
|
|
143374
|
-
});
|
|
143375
|
-
const StepWireWithRefsSchema = StepWireSchema.omit({
|
|
143376
|
-
input: true,
|
|
143377
|
-
output: true
|
|
143378
|
-
}).extend({
|
|
143379
|
-
// We discard the results of the refs, so we don't care about the type here
|
|
143380
|
-
inputRef: any().optional(),
|
|
143381
|
-
outputRef: any().optional(),
|
|
143382
|
-
input: _instanceof(Uint8Array).optional(),
|
|
143383
|
-
output: _instanceof(Uint8Array).optional()
|
|
143384
|
-
});
|
|
143385
|
-
function deserializeStep(wireStep) {
|
|
143386
|
-
const { error: error2, errorRef, ...rest } = wireStep;
|
|
143387
|
-
const result = { ...rest };
|
|
143388
|
-
const errorSource = error2 ?? errorRef;
|
|
143389
|
-
if (errorSource !== void 0 && errorSource !== null) {
|
|
143390
|
-
result.error = errorSource;
|
|
143391
|
-
}
|
|
143392
|
-
return result;
|
|
143393
|
-
}
|
|
143394
|
-
function filterStepData(step, resolveData) {
|
|
143395
|
-
if (resolveData === "none") {
|
|
143396
|
-
const { inputRef: _inputRef, outputRef: _outputRef, ...rest } = step;
|
|
143397
|
-
const deserialized = normalizeStepData(deserializeStep(rest));
|
|
143398
|
-
return {
|
|
143399
|
-
...deserialized,
|
|
143400
|
-
input: void 0,
|
|
143401
|
-
output: void 0
|
|
143402
|
-
};
|
|
143403
|
-
}
|
|
143404
|
-
return normalizeStepData(deserializeStep(step));
|
|
143405
|
-
}
|
|
143406
|
-
async function listWorkflowRunSteps(params, config2) {
|
|
143407
|
-
const { runId, pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
143408
|
-
const searchParams = new URLSearchParams();
|
|
143409
|
-
if (pagination == null ? void 0 : pagination.cursor)
|
|
143410
|
-
searchParams.set("cursor", pagination.cursor);
|
|
143411
|
-
if (pagination == null ? void 0 : pagination.limit)
|
|
143412
|
-
searchParams.set("limit", pagination.limit.toString());
|
|
143413
|
-
if (pagination == null ? void 0 : pagination.sortOrder)
|
|
143414
|
-
searchParams.set("sortOrder", pagination.sortOrder);
|
|
143415
|
-
const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
|
|
143416
|
-
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
143417
|
-
const queryString = searchParams.toString();
|
|
143418
|
-
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps${queryString ? `?${queryString}` : ""}`;
|
|
143419
|
-
const response2 = await makeRequest({
|
|
143420
|
-
endpoint,
|
|
143421
|
-
options: { method: "GET" },
|
|
143422
|
-
config: config2,
|
|
143423
|
-
schema: PaginatedResponseSchema(remoteRefBehavior === "lazy" ? StepWireWithRefsSchema : StepWireSchema)
|
|
143424
|
-
});
|
|
143425
|
-
return {
|
|
143426
|
-
...response2,
|
|
143427
|
-
data: response2.data.map((step) => filterStepData(step, resolveData))
|
|
143428
|
-
};
|
|
143429
|
-
}
|
|
143430
|
-
async function getStep(runId, stepId, params, config2) {
|
|
143431
|
-
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
143432
|
-
const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
|
|
143433
|
-
const searchParams = new URLSearchParams();
|
|
143434
|
-
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
143435
|
-
const queryString = searchParams.toString();
|
|
143436
|
-
const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}${queryString ? `?${queryString}` : ""}`;
|
|
143437
|
-
const step = await makeRequest({
|
|
143438
|
-
endpoint,
|
|
143439
|
-
options: { method: "GET" },
|
|
143440
|
-
config: config2,
|
|
143441
|
-
schema: remoteRefBehavior === "lazy" ? StepWireWithRefsSchema : StepWireSchema
|
|
143442
|
-
});
|
|
143443
|
-
return filterStepData(step, resolveData);
|
|
143444
|
-
}
|
|
143445
144139
|
function validateWorkflowRunIdTimestamp(id2) {
|
|
143446
144140
|
const raw2 = id2.startsWith("wrun_") ? id2.slice("wrun_".length) : id2;
|
|
143447
144141
|
try {
|
|
@@ -143458,11 +144152,6 @@ const eventsNeedingResolve = /* @__PURE__ */ new Set([
|
|
|
143458
144152
|
"step_started"
|
|
143459
144153
|
// runtime reads result.step (checks attempt, state)
|
|
143460
144154
|
]);
|
|
143461
|
-
const legacyStructuredErrorEventTypes = /* @__PURE__ */ new Set([
|
|
143462
|
-
"run_failed",
|
|
143463
|
-
"step_failed",
|
|
143464
|
-
"step_retrying"
|
|
143465
|
-
]);
|
|
143466
144155
|
function splitEventDataForV4(data) {
|
|
143467
144156
|
var _a3;
|
|
143468
144157
|
const eventData = data.eventData ?? {};
|
|
@@ -143566,83 +144255,43 @@ function splitEventDataForV4(data) {
|
|
|
143566
144255
|
}
|
|
143567
144256
|
return { payload, meta: meta2 };
|
|
143568
144257
|
}
|
|
143569
|
-
function coerceNormalizedEvent(raw2) {
|
|
143570
|
-
return coerceEventDates(normalizeEventData(raw2));
|
|
143571
|
-
}
|
|
143572
|
-
function decodeLegacyStructuredError(payload) {
|
|
143573
|
-
if (hasSerializedDataFormatPrefix(payload)) {
|
|
143574
|
-
return payload;
|
|
143575
|
-
}
|
|
143576
|
-
try {
|
|
143577
|
-
const parsed = StructuredErrorSchema.safeParse(decode$1(payload.slice()));
|
|
143578
|
-
return parsed.success ? parsed.data : payload;
|
|
143579
|
-
} catch {
|
|
143580
|
-
return payload;
|
|
143581
|
-
}
|
|
143582
|
-
}
|
|
143583
|
-
function buildEventFromV4(decoded, payloadBody, resolveData) {
|
|
143584
|
-
const eventData = decoded.eventData ?? {};
|
|
143585
|
-
if (payloadBody.byteLength > 0) {
|
|
143586
|
-
const payloadField = getEventDataPayloadField(decoded.eventType);
|
|
143587
|
-
const normalizedPayload = normalizeSerializedData(payloadBody);
|
|
143588
|
-
if (payloadField && normalizedPayload instanceof Uint8Array) {
|
|
143589
|
-
eventData[payloadField] = legacyStructuredErrorEventTypes.has(decoded.eventType) ? decodeLegacyStructuredError(normalizedPayload) : normalizedPayload;
|
|
143590
|
-
}
|
|
143591
|
-
}
|
|
143592
|
-
const raw2 = {
|
|
143593
|
-
eventId: decoded.eventId,
|
|
143594
|
-
runId: decoded.runId,
|
|
143595
|
-
eventType: decoded.eventType,
|
|
143596
|
-
createdAt: decoded.createdAt instanceof Date ? decoded.createdAt : new Date(decoded.createdAt),
|
|
143597
|
-
...decoded.occurredAt !== void 0 ? {
|
|
143598
|
-
occurredAt: decoded.occurredAt instanceof Date ? decoded.occurredAt : new Date(decoded.occurredAt)
|
|
143599
|
-
} : {},
|
|
143600
|
-
...decoded.correlationId ? { correlationId: decoded.correlationId } : {},
|
|
143601
|
-
eventData,
|
|
143602
|
-
...decoded.specVersion !== void 0 ? { specVersion: decoded.specVersion } : {},
|
|
143603
|
-
// The persisted lazy-resume idempotency key. The runtime matches it
|
|
143604
|
-
// against the queue message's hookInput.resumeId to recognize its own
|
|
143605
|
-
// resume in a preloaded log — dropping it here would silently disable
|
|
143606
|
-
// that check for frame-decoded events.
|
|
143607
|
-
...decoded.resumeId ? { resumeId: decoded.resumeId } : {}
|
|
143608
|
-
};
|
|
143609
|
-
const event = coerceNormalizedEvent(raw2);
|
|
143610
|
-
return resolveData === "none" ? stripEventDataRefs(event, "none") : event;
|
|
143611
|
-
}
|
|
143612
144258
|
async function getEvent(runId, eventId, params, config2) {
|
|
143613
|
-
|
|
143614
|
-
const { event, body: body2 } = await getEventV4(runId, eventId, config2);
|
|
143615
|
-
return buildEventFromV4(event, body2, resolveData);
|
|
144259
|
+
return getEventV4(runId, eventId, (params == null ? void 0 : params.resolveData) === "none" ? "lazy" : "resolve", config2);
|
|
143616
144260
|
}
|
|
143617
144261
|
async function getWorkflowRunEvents(params, config2) {
|
|
143618
144262
|
const { pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
143619
|
-
const
|
|
143620
|
-
|
|
143621
|
-
limit: pagination == null ? void 0 : pagination.limit,
|
|
143622
|
-
sortOrder: pagination == null ? void 0 : pagination.sortOrder,
|
|
144263
|
+
const listParams = {
|
|
144264
|
+
...pagination,
|
|
143623
144265
|
remoteRefBehavior: resolveData === "none" ? "lazy" : "resolve"
|
|
143624
144266
|
};
|
|
143625
|
-
const result = await ("correlationId" in params ? getEventsByCorrelationIdV4(params.correlationId, params.runId,
|
|
143626
|
-
const events2 = result.events.map((listed) => buildEventFromV4(listed.event, listed.body, resolveData));
|
|
143627
|
-
const runScoped = "correlationId" in params ? events2.filter((event) => event.runId === params.runId) : events2;
|
|
144267
|
+
const result = await ("correlationId" in params ? getEventsByCorrelationIdV4(params.correlationId, params.runId, listParams, config2) : getWorkflowRunEventsV4(params.runId, listParams, config2));
|
|
143628
144268
|
return {
|
|
143629
|
-
data:
|
|
143630
|
-
//
|
|
143631
|
-
// resume
|
|
143632
|
-
|
|
143633
|
-
|
|
143634
|
-
cursor: result.next ?? null,
|
|
143635
|
-
hasMore: typeof result.hasMore === "boolean" ? result.hasMore : Boolean(result.next)
|
|
144269
|
+
data: "correlationId" in params ? result.events.filter((event) => event.runId === params.runId) : result.events,
|
|
144270
|
+
// The cursor is present even on the final page because it is also the
|
|
144271
|
+
// incremental-load resume point. `hasMore` is the pagination signal.
|
|
144272
|
+
cursor: result.cursor,
|
|
144273
|
+
hasMore: result.hasMore
|
|
143636
144274
|
};
|
|
143637
144275
|
}
|
|
143638
144276
|
async function createWorkflowRunEvent(id2, data, params, config2) {
|
|
144277
|
+
var _a3, _b2;
|
|
143639
144278
|
try {
|
|
143640
|
-
|
|
144279
|
+
const result = await withEventPostRetry(() => createWorkflowRunEventInner(id2, data, params, config2), data.eventType, {
|
|
143641
144280
|
// The atomic lazy-resume shape is deduplicated server-side by the
|
|
143642
144281
|
// (runId, resumeId) claim, so its POST is idempotent-on-retry even
|
|
143643
144282
|
// though plain hook_received is not — see EVENT_RETRY_ELIGIBILITY.
|
|
143644
144283
|
idempotentHookResume: data.eventType === "hook_received" && (params == null ? void 0 : params.resumeId) !== void 0 && (params == null ? void 0 : params.resumePayloadDigest) !== void 0
|
|
143645
144284
|
});
|
|
144285
|
+
if (data.eventType === "run_created" && !result.run) {
|
|
144286
|
+
throw new WorkflowWorldError(`${data.eventType} response is missing the run entity`, { code: "SCHEMA_VALIDATION" });
|
|
144287
|
+
}
|
|
144288
|
+
if (data.eventType === "run_started" && !((_a3 = result.run) == null ? void 0 : _a3.startedAt)) {
|
|
144289
|
+
throw new WorkflowWorldError("run_started response is missing run.startedAt", { code: "SCHEMA_VALIDATION" });
|
|
144290
|
+
}
|
|
144291
|
+
if (data.eventType === "step_started" && !((_b2 = result.step) == null ? void 0 : _b2.startedAt)) {
|
|
144292
|
+
throw new WorkflowWorldError("step_started response is missing step.startedAt", { code: "SCHEMA_VALIDATION" });
|
|
144293
|
+
}
|
|
144294
|
+
return result;
|
|
143646
144295
|
} catch (err) {
|
|
143647
144296
|
if (isHookEventRequiringExistence(data.eventType) && WorkflowWorldError.is(err) && err.status === 404 && data.correlationId) {
|
|
143648
144297
|
throw new HookNotFoundError(data.correlationId);
|
|
@@ -143683,88 +144332,95 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
|
|
|
143683
144332
|
}
|
|
143684
144333
|
const remoteRefBehavior = eventsNeedingResolve.has(data.eventType) ? "resolve" : "lazy";
|
|
143685
144334
|
const { payload, meta: meta2 } = splitEventDataForV4(data);
|
|
143686
|
-
const
|
|
143687
|
-
const v4Input = {
|
|
144335
|
+
const input = {
|
|
143688
144336
|
runId: id2,
|
|
143689
|
-
eventType: data.eventType,
|
|
143690
144337
|
specVersion: data.specVersion ?? 2,
|
|
143691
144338
|
...data.correlationId ? { correlationId: data.correlationId } : {},
|
|
143692
144339
|
...(params == null ? void 0 : params.requestId) ? { vercelId: params.requestId } : {},
|
|
143693
144340
|
...(params == null ? void 0 : params.computeInstanceId) ? { computeInstanceId: params.computeInstanceId } : {},
|
|
143694
|
-
//
|
|
143695
|
-
//
|
|
143696
|
-
//
|
|
143697
|
-
|
|
143698
|
-
|
|
143699
|
-
...(params == null ? void 0 : params.stateEventCount) !== void 0 ? { stateEventCount: params.stateEventCount } : {},
|
|
143700
|
-
...(params == null ? void 0 : params.stateCursor) ? { stateCursor: params.stateCursor } : {},
|
|
143701
|
-
...(params == null ? void 0 : params.replayDivergenceCount) !== void 0 ? { replayDivergenceCount: params.replayDivergenceCount } : {},
|
|
144341
|
+
// Slot-identity snapshot: how much of the log the writer held. Rides as
|
|
144342
|
+
// `maxSlot` because the v4 meta already has an unrelated telemetry
|
|
144343
|
+
// `eventCount`.
|
|
144344
|
+
...(params == null ? void 0 : params.eventCount) !== void 0 ? { maxSlot: params.eventCount } : {},
|
|
144345
|
+
replayDivergenceCount: params == null ? void 0 : params.replayDivergenceCount,
|
|
143702
144346
|
occurredAt: (params == null ? void 0 : params.occurredAt) ?? /* @__PURE__ */ new Date(),
|
|
143703
144347
|
// Opt-in inline-delta: forward the cursor the runtime held before
|
|
143704
144348
|
// this write so the server can return the authoritative event-log
|
|
143705
|
-
// delta on the response (events/cursor/hasMore), letting the
|
|
143706
|
-
//
|
|
143707
|
-
//
|
|
143708
|
-
//
|
|
144349
|
+
// delta on the response (events/cursor/hasMore), letting the caller
|
|
144350
|
+
// skip a follow-up events.list. Outside turbo the runtime sends this on
|
|
144351
|
+
// every write, but a server may act on only some event types (or none);
|
|
144352
|
+
// a response without a delta just means the runtime keeps its cursor
|
|
144353
|
+
// and fetches when it next needs to.
|
|
143709
144354
|
...(params == null ? void 0 : params.sinceCursor) ? { sinceCursor: params.sinceCursor } : {},
|
|
143710
|
-
// Run-started preload opt-out: turbo backgrounds run_started as a write
|
|
143711
|
-
// barrier only and never reads the preloaded log, so tell the server to
|
|
143712
|
-
// skip the list+resolve. The server only acts on it for run_started;
|
|
143713
|
-
// older servers ignore it and simply preload as before.
|
|
143714
|
-
...(params == null ? void 0 : params.skipPreload) ? { skipPreload: true } : {},
|
|
143715
|
-
// Lazy hook resume idempotency key (hook_received only). Routes the
|
|
143716
|
-
// write through the server's (runId, resumeId) constraint so a
|
|
143717
|
-
// concurrent queue-consumer re-ensure deduplicates to one event.
|
|
143718
144355
|
...(params == null ? void 0 : params.resumeId) ? { resumeId: params.resumeId } : {},
|
|
143719
|
-
// Content digest forwarded alongside resumeId so the direct write and the
|
|
143720
|
-
// queue re-ensure record an identical digest on the server constraint.
|
|
143721
144356
|
...(params == null ? void 0 : params.resumePayloadDigest) ? { resumePayloadDigest: params.resumePayloadDigest } : {},
|
|
144357
|
+
// Resilient step dispatch re-ensure marker (step_created only). Advisory
|
|
144358
|
+
// — the server MAY refuse it with 410 → RunExpiredError as
|
|
144359
|
+
// defense-in-depth when it recorded a 412 rejection for this correlation
|
|
144360
|
+
// id and no step entity exists.
|
|
144361
|
+
...(params == null ? void 0 : params.viaStepDispatch) ? { viaStepDispatch: true } : {},
|
|
143722
144362
|
remoteRefBehavior,
|
|
143723
144363
|
payload,
|
|
143724
144364
|
...meta2
|
|
143725
144365
|
};
|
|
144366
|
+
if (data.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload)) {
|
|
144367
|
+
const result = await createWorkflowRunStartedEventV4(input, config2);
|
|
144368
|
+
const runCreated = result.events.find((event) => event.eventType === "run_created");
|
|
144369
|
+
const runStarted = result.events.find((event) => event.eventType === "run_started");
|
|
144370
|
+
if (!runCreated) {
|
|
144371
|
+
throw new Error("v4 createEvent: run_started stream is missing run_created");
|
|
144372
|
+
}
|
|
144373
|
+
if (!runStarted) {
|
|
144374
|
+
throw new Error("v4 createEvent: run_started stream is missing run_started");
|
|
144375
|
+
}
|
|
144376
|
+
let attributes = runCreated.eventData.attributes ?? {};
|
|
144377
|
+
let updatedAt = runStarted.createdAt;
|
|
144378
|
+
for (const event of result.events) {
|
|
144379
|
+
if (event.eventType === "attr_set") {
|
|
144380
|
+
attributes = applyAttributeChanges(attributes, event.eventData.changes);
|
|
144381
|
+
updatedAt = event.createdAt;
|
|
144382
|
+
}
|
|
144383
|
+
}
|
|
144384
|
+
return {
|
|
144385
|
+
event: runStarted,
|
|
144386
|
+
run: {
|
|
144387
|
+
runId: runCreated.runId,
|
|
144388
|
+
status: "running",
|
|
144389
|
+
deploymentId: runCreated.eventData.deploymentId,
|
|
144390
|
+
workflowName: runCreated.eventData.workflowName,
|
|
144391
|
+
specVersion: runCreated.specVersion,
|
|
144392
|
+
executionContext: runCreated.eventData.executionContext,
|
|
144393
|
+
input: runCreated.eventData.input,
|
|
144394
|
+
attributes,
|
|
144395
|
+
encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
|
|
144396
|
+
startedAt: runStarted.createdAt,
|
|
144397
|
+
createdAt: runCreated.createdAt,
|
|
144398
|
+
updatedAt
|
|
144399
|
+
},
|
|
144400
|
+
events: result.events,
|
|
144401
|
+
cursor: result.cursor,
|
|
144402
|
+
hasMore: result.hasMore,
|
|
144403
|
+
maxEvents: result.maxEvents
|
|
144404
|
+
};
|
|
144405
|
+
}
|
|
143726
144406
|
if (data.eventType === "hook_received" && (params == null ? void 0 : params.preloadEvents) === true && params.resumeId !== void 0 && params.resumePayloadDigest !== void 0) {
|
|
143727
|
-
const outcome = await createHookReceivedPreloadEventV4({ ...
|
|
144407
|
+
const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2);
|
|
143728
144408
|
if (outcome.kind === "materialized") {
|
|
143729
|
-
return
|
|
144409
|
+
return outcome.result;
|
|
143730
144410
|
}
|
|
143731
|
-
const { canonicalEventId, maxEvents,
|
|
143732
|
-
const events2 = outcome.events.map((listed) => buildEventFromV4(listed.event, listed.body, "all"));
|
|
144411
|
+
const { canonicalEventId, maxEvents, events: events2, cursor, hasMore } = outcome;
|
|
143733
144412
|
const canonicalEvent = events2.find((event) => event.eventId === canonicalEventId);
|
|
143734
144413
|
const run2 = reconstructRunFromReplayEvents(events2);
|
|
143735
144414
|
return {
|
|
143736
144415
|
...canonicalEvent ? { event: canonicalEvent } : {},
|
|
143737
144416
|
...run2 ? { run: run2 } : {},
|
|
143738
144417
|
events: events2,
|
|
143739
|
-
cursor
|
|
143740
|
-
|
|
143741
|
-
// missing flag as "not the complete log" so the runtime falls back
|
|
143742
|
-
// rather than replaying a possibly-truncated prefix.
|
|
143743
|
-
hasMore: hasMore ?? true,
|
|
144418
|
+
cursor,
|
|
144419
|
+
hasMore,
|
|
143744
144420
|
...maxEvents !== void 0 ? { maxEvents } : {}
|
|
143745
144421
|
};
|
|
143746
144422
|
}
|
|
143747
|
-
|
|
143748
|
-
return materializedV4ToEventResult(result, resolveData);
|
|
143749
|
-
}
|
|
143750
|
-
function materializedV4ToEventResult(result, resolveData) {
|
|
143751
|
-
const body2 = result.body;
|
|
143752
|
-
return {
|
|
143753
|
-
event: body2.event ? stripEventDataRefs(coerceEventDates(body2.event), resolveData) : void 0,
|
|
143754
|
-
run: body2.run ? deserializeError(body2.run) : void 0,
|
|
143755
|
-
step: body2.step ? deserializeStep(body2.step) : void 0,
|
|
143756
|
-
hook: body2.hook,
|
|
143757
|
-
wait: body2.wait,
|
|
143758
|
-
events: body2.events ? body2.events.map(coerceEventDates) : void 0,
|
|
143759
|
-
cursor: body2.cursor ?? void 0,
|
|
143760
|
-
hasMore: body2.hasMore,
|
|
143761
|
-
// Lazy step start: thread the server's "I created the step on this call"
|
|
143762
|
-
// signal through so the owned-inline runtime path can gate body execution
|
|
143763
|
-
// on it. Absent from older servers → undefined → safe default.
|
|
143764
|
-
...body2.stepCreated ? { stepCreated: true } : {},
|
|
143765
|
-
// Server-supplied per-run event ceiling; absent from older servers.
|
|
143766
|
-
...typeof body2.maxEvents === "number" ? { maxEvents: body2.maxEvents } : {}
|
|
143767
|
-
};
|
|
144423
|
+
return createWorkflowRunEventV4(data.eventType === "run_started" ? { ...input, eventType: "run_started", skipPreload: true } : { ...input, eventType: data.eventType }, config2);
|
|
143768
144424
|
}
|
|
143769
144425
|
function reconstructRunFromReplayEvents(events2) {
|
|
143770
144426
|
const runCreated = events2.find((event) => event.eventType === "run_created");
|
|
@@ -143913,6 +144569,17 @@ function streamSpanAttributes(args) {
|
|
|
143913
144569
|
...typeof args.startIndex === "number" ? WorkflowStreamStartIndex(args.startIndex) : {}
|
|
143914
144570
|
};
|
|
143915
144571
|
}
|
|
144572
|
+
async function createStreamReadError(response2) {
|
|
144573
|
+
const fallback = `Failed to fetch stream: ${response2.status}`;
|
|
144574
|
+
if (response2.status !== 410)
|
|
144575
|
+
return new Error(fallback);
|
|
144576
|
+
try {
|
|
144577
|
+
const body2 = await response2.json();
|
|
144578
|
+
return errorForResponse(response2.status, typeof body2.message === "string" ? body2.message : fallback, { code: body2.error, details: body2.details });
|
|
144579
|
+
} catch {
|
|
144580
|
+
return new Error(fallback);
|
|
144581
|
+
}
|
|
144582
|
+
}
|
|
143916
144583
|
function createStreamRequestError(operation, url2, response2, text2) {
|
|
143917
144584
|
const context = [
|
|
143918
144585
|
`PUT ${url2.origin}${url2.pathname}`,
|
|
@@ -144039,6 +144706,7 @@ function createStreamer(config2) {
|
|
|
144039
144706
|
},
|
|
144040
144707
|
async get(runId, name2, startIndex) {
|
|
144041
144708
|
const httpConfig = await getHttpConfig(config2);
|
|
144709
|
+
httpConfig.headers.set("Accept", "application/json");
|
|
144042
144710
|
const url2 = getStreamReadUrl(name2, runId, httpConfig);
|
|
144043
144711
|
if (typeof startIndex === "number") {
|
|
144044
144712
|
url2.searchParams.set("startIndex", String(startIndex));
|
|
@@ -144057,7 +144725,7 @@ function createStreamer(config2) {
|
|
|
144057
144725
|
operation: "read",
|
|
144058
144726
|
startIndex
|
|
144059
144727
|
}),
|
|
144060
|
-
buildError:
|
|
144728
|
+
buildError: createStreamReadError
|
|
144061
144729
|
});
|
|
144062
144730
|
if (!response2.body) {
|
|
144063
144731
|
throw new Error("No response body for stream");
|
|
@@ -144109,15 +144777,18 @@ function createWorld$1(config2) {
|
|
|
144109
144777
|
var _a3, _b2;
|
|
144110
144778
|
const projectId = ((_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.projectId) || process.env.VERCEL_PROJECT_ID;
|
|
144111
144779
|
return {
|
|
144112
|
-
//
|
|
144113
|
-
//
|
|
144114
|
-
|
|
144780
|
+
// The version is what tells the backend which id scheme a run uses: it is
|
|
144781
|
+
// stamped on `run_created` and read back on every later write, so a run
|
|
144782
|
+
// created before spec 6 keeps its ULIDs for its whole life even though this
|
|
144783
|
+
// adapter now asks for slot-numbered ids.
|
|
144784
|
+
//
|
|
144785
|
+
// Declared as the runtime's current version rather than as the literal
|
|
144786
|
+
// version that introduced slots: a bump has to move this declaration with
|
|
144787
|
+
// it, or the runtime's compatibility floor rises past the adapter shipped
|
|
144788
|
+
// alongside it and rejects it (see `assertWorldSupportsRuntimeProtocol`).
|
|
144789
|
+
specVersion: SPEC_VERSION_CURRENT,
|
|
144115
144790
|
capabilities: {
|
|
144116
|
-
|
|
144117
|
-
// guard: creations carrying a stale snapshot are rejected with 412
|
|
144118
|
-
// (PreconditionFailedError) when the run's outside-event marker is
|
|
144119
|
-
// newer. See vercel/workflow-server#484.
|
|
144120
|
-
preconditionGuard: true,
|
|
144791
|
+
hookRetention: { active: true },
|
|
144121
144792
|
// Vercel Queues supports maxConcurrency-limited consumers, which
|
|
144122
144793
|
// WORKFLOW_SEQUENTIAL_REPLAYS=1 uses for per-run `maxConcurrency: 1`
|
|
144123
144794
|
// flow topics (see queue.ts and @workflow/builders).
|
|
@@ -144133,12 +144804,6 @@ function createWorld$1(config2) {
|
|
|
144133
144804
|
// rollback or kill switch drop new resumes to the sequential path
|
|
144134
144805
|
// immediately, without a redeploy of this adapter.
|
|
144135
144806
|
},
|
|
144136
|
-
// On Vercel the platform fails the function invocation when the
|
|
144137
|
-
// process exits non-zero, and VQS redelivers the queue message via a
|
|
144138
|
-
// fresh invocation. The core runtime uses this to decide whether
|
|
144139
|
-
// `process.exit(1)` is an acceptable response to an exhausted replay
|
|
144140
|
-
// budget.
|
|
144141
|
-
processExitTriggersQueueRedelivery: true,
|
|
144142
144807
|
getRuntimeDeadline: getDeadline,
|
|
144143
144808
|
...createQueue$1(config2),
|
|
144144
144809
|
...createStorage(config2),
|
|
@@ -144281,7 +144946,7 @@ const getWorld = async () => {
|
|
|
144281
144946
|
const GetWorldFnKey = Symbol.for("@workflow/world//getWorldFn");
|
|
144282
144947
|
globalThis[GetWorldFnKey] ?? (globalThis[GetWorldFnKey] = getWorld);
|
|
144283
144948
|
function waitUntil(promise2) {
|
|
144284
|
-
void import("./index-
|
|
144949
|
+
void import("./index-ByPjQpgH.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
144285
144950
|
waitUntil2(promise2);
|
|
144286
144951
|
});
|
|
144287
144952
|
}
|
|
@@ -147057,9 +147722,9 @@ async function getHookByToken(token) {
|
|
|
147057
147722
|
return hook;
|
|
147058
147723
|
}
|
|
147059
147724
|
async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
147060
|
-
return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false);
|
|
147725
|
+
return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now());
|
|
147061
147726
|
}
|
|
147062
|
-
async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp) {
|
|
147727
|
+
async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs) {
|
|
147063
147728
|
return await waitedUntil(() => {
|
|
147064
147729
|
return trace$2("hook.resume", async (span) => {
|
|
147065
147730
|
var _a3, _b2, _c2;
|
|
@@ -147148,23 +147813,24 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
147148
147813
|
}
|
|
147149
147814
|
throw err;
|
|
147150
147815
|
}
|
|
147816
|
+
const queuePublishRequestedAtMs = Date.now();
|
|
147151
147817
|
await world.queue(queueName, {
|
|
147152
147818
|
runId: hook.runId,
|
|
147153
|
-
traceCarrier: resumeContext.traceCarrier ?? void 0
|
|
147819
|
+
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
147820
|
+
hookResumeTiming: {
|
|
147821
|
+
resumeRequestedAtMs,
|
|
147822
|
+
queuePublishRequestedAtMs,
|
|
147823
|
+
strategy: "sequential"
|
|
147824
|
+
}
|
|
147154
147825
|
}, queueOptions);
|
|
147155
147826
|
return hook;
|
|
147156
147827
|
}
|
|
147157
147828
|
const resumeId = generateResumeId();
|
|
147158
147829
|
const payloadDigest = await computeResumePayloadDigest(dehydratedPayload);
|
|
147159
147830
|
span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
|
|
147160
|
-
const
|
|
147161
|
-
|
|
147162
|
-
|
|
147163
|
-
specVersion: SPEC_VERSION_CURRENT,
|
|
147164
|
-
correlationId: hook.hookId,
|
|
147165
|
-
eventData
|
|
147166
|
-
}, { v1Compat, resumeId, resumePayloadDigest: payloadDigest }),
|
|
147167
|
-
world.queue(queueName, {
|
|
147831
|
+
const publishInvocation = () => {
|
|
147832
|
+
const queuePublishRequestedAtMs = Date.now();
|
|
147833
|
+
return world.queue(queueName, {
|
|
147168
147834
|
runId: hook.runId,
|
|
147169
147835
|
traceCarrier: resumeContext.traceCarrier ?? void 0,
|
|
147170
147836
|
hookInput: {
|
|
@@ -147172,9 +147838,27 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
147172
147838
|
hookId: hook.hookId,
|
|
147173
147839
|
token: hook.token,
|
|
147174
147840
|
payload: dehydratedPayload,
|
|
147175
|
-
payloadDigest
|
|
147841
|
+
payloadDigest,
|
|
147842
|
+
// Deployment affinity for the consumer's cheap pre-write
|
|
147843
|
+
// check: lets a misrouted delivery re-route before its
|
|
147844
|
+
// hoisted hook_received write instead of after.
|
|
147845
|
+
deploymentId: resumeContext.deploymentId
|
|
147846
|
+
},
|
|
147847
|
+
hookResumeTiming: {
|
|
147848
|
+
resumeRequestedAtMs,
|
|
147849
|
+
queuePublishRequestedAtMs,
|
|
147850
|
+
strategy: "parallel"
|
|
147176
147851
|
}
|
|
147177
|
-
}, queueOptions)
|
|
147852
|
+
}, queueOptions);
|
|
147853
|
+
};
|
|
147854
|
+
const [eventResult, queueResult] = await Promise.allSettled([
|
|
147855
|
+
world.events.create(hook.runId, {
|
|
147856
|
+
eventType: "hook_received",
|
|
147857
|
+
specVersion: SPEC_VERSION_CURRENT,
|
|
147858
|
+
correlationId: hook.hookId,
|
|
147859
|
+
eventData
|
|
147860
|
+
}, { v1Compat, resumeId, resumePayloadDigest: payloadDigest }),
|
|
147861
|
+
publishInvocation()
|
|
147178
147862
|
]);
|
|
147179
147863
|
if (queueResult.status === "rejected") {
|
|
147180
147864
|
throw queueResult.reason;
|
|
@@ -147214,6 +147898,7 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
|
|
|
147214
147898
|
});
|
|
147215
147899
|
}
|
|
147216
147900
|
async function resumeWebhook(token, request2) {
|
|
147901
|
+
const resumeRequestedAtMs = Date.now();
|
|
147217
147902
|
const { hook, encryptionKey } = await getHookByTokenWithKey(token);
|
|
147218
147903
|
if (hook.isWebhook === false) {
|
|
147219
147904
|
throw new HookNotFoundError(token);
|
|
@@ -147233,7 +147918,7 @@ async function resumeWebhook(token, request2) {
|
|
|
147233
147918
|
} else {
|
|
147234
147919
|
response2 = new Response(null, { status: 202 });
|
|
147235
147920
|
}
|
|
147236
|
-
await resumeHookImpl(hook, request2, encryptionKey, true);
|
|
147921
|
+
await resumeHookImpl(hook, request2, encryptionKey, true, resumeRequestedAtMs);
|
|
147237
147922
|
if (responseReadable) {
|
|
147238
147923
|
const reader = responseReadable.getReader();
|
|
147239
147924
|
const chunk = await reader.read();
|
|
@@ -147472,9 +148157,6 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
147472
148157
|
}
|
|
147473
148158
|
} else {
|
|
147474
148159
|
const result = runCreatedResult.value;
|
|
147475
|
-
if (!result.run) {
|
|
147476
|
-
throw new WorkflowRuntimeError("Missing 'run' in server response for 'run_created' event");
|
|
147477
|
-
}
|
|
147478
148160
|
if (!v1Compat && result.run.runId !== runId) {
|
|
147479
148161
|
throw new WorkflowRuntimeError(`Server returned different runId than requested: expected ${runId}, got ${result.run.runId}`);
|
|
147480
148162
|
}
|
|
@@ -147488,7 +148170,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
147488
148170
|
span == null ? void 0 : span.setAttributes({
|
|
147489
148171
|
...WorkflowRunId$2(runId),
|
|
147490
148172
|
...DeploymentId(deploymentId),
|
|
147491
|
-
...runCreatedResult.status === "fulfilled"
|
|
148173
|
+
...runCreatedResult.status === "fulfilled" ? WorkflowRunStatus(runCreatedResult.value.run.status) : {}
|
|
147492
148174
|
});
|
|
147493
148175
|
return new Run(runId, { resilientStart });
|
|
147494
148176
|
});
|
|
@@ -147624,7 +148306,7 @@ async function wakeUpRun$2(world, runId, options) {
|
|
|
147624
148306
|
do {
|
|
147625
148307
|
const eventsResult = await world.events.list({
|
|
147626
148308
|
runId,
|
|
147627
|
-
pagination: {
|
|
148309
|
+
pagination: { sortOrder: "asc", ...cursor ? { cursor } : {} },
|
|
147628
148310
|
resolveData: "none"
|
|
147629
148311
|
});
|
|
147630
148312
|
allEvents.push(...eventsResult.data);
|
|
@@ -171135,7 +171817,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
171135
171817
|
__proto__: null,
|
|
171136
171818
|
loader
|
|
171137
171819
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
171138
|
-
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-
|
|
171820
|
+
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-BfhMCbkz.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-gEw-Ch1C.js", "/assets/loader-circle-BOxaTUjK.js", "/assets/arrow-up-right-D39pnGsD.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-C6CuMqQu.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-CxrWityD.js", "/assets/mermaid-3ZIDBTTL-gEw-Ch1C.js", "/assets/loader-circle-BOxaTUjK.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-DKz7lp2q.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-CxrWityD.js", "/assets/mermaid-3ZIDBTTL-gEw-Ch1C.js", "/assets/arrow-up-right-D39pnGsD.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-cf88886b.js", "version": "cf88886b", "sri": void 0 };
|
|
171139
171821
|
const assetsBuildDirectory = "build/client";
|
|
171140
171822
|
const basename = "/";
|
|
171141
171823
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -171344,110 +172026,135 @@ function createFetchHandler(basename2 = "/") {
|
|
|
171344
172026
|
return (request2) => handler(request2, loadContext);
|
|
171345
172027
|
}
|
|
171346
172028
|
export {
|
|
171347
|
-
|
|
171348
|
-
|
|
172029
|
+
STEP_EVENT_TYPES as $,
|
|
172030
|
+
ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
|
|
171349
172031
|
BULK_CANCEL_MAX_RUN_IDS as B,
|
|
171350
172032
|
CHILD_ENTITY_CREATION_EVENT_TYPES as C,
|
|
171351
172033
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
|
|
171352
172034
|
EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE as E,
|
|
171353
|
-
|
|
171354
|
-
|
|
172035
|
+
FIRST_EVENT_SLOT as F,
|
|
172036
|
+
HealthCheckPayloadSchema as G,
|
|
171355
172037
|
HookSchema as H,
|
|
171356
|
-
|
|
171357
|
-
|
|
171358
|
-
|
|
172038
|
+
HookCreatedEventSchema as I,
|
|
172039
|
+
HookResumeCapabilitiesSchema as J,
|
|
172040
|
+
PaginatedResponseSchema as K,
|
|
171359
172041
|
LegacySerializedDataSchemaV1 as L,
|
|
171360
172042
|
MessageId as M,
|
|
171361
172043
|
Nt as N,
|
|
171362
|
-
|
|
172044
|
+
QueuePrefix as O,
|
|
171363
172045
|
PARENT_RUN_ID_ATTRIBUTE as P,
|
|
171364
172046
|
QueuePayloadSchema as Q,
|
|
171365
172047
|
RESERVED_ATTRIBUTE_KEY_PREFIX as R,
|
|
171366
|
-
|
|
171367
|
-
|
|
171368
|
-
|
|
171369
|
-
|
|
171370
|
-
|
|
171371
|
-
|
|
171372
|
-
|
|
171373
|
-
|
|
171374
|
-
|
|
171375
|
-
|
|
171376
|
-
|
|
171377
|
-
|
|
171378
|
-
|
|
171379
|
-
|
|
171380
|
-
|
|
171381
|
-
|
|
171382
|
-
|
|
171383
|
-
|
|
171384
|
-
|
|
171385
|
-
|
|
171386
|
-
|
|
171387
|
-
|
|
171388
|
-
|
|
171389
|
-
|
|
171390
|
-
|
|
171391
|
-
|
|
171392
|
-
|
|
171393
|
-
|
|
171394
|
-
|
|
171395
|
-
|
|
171396
|
-
|
|
171397
|
-
|
|
171398
|
-
|
|
171399
|
-
|
|
171400
|
-
|
|
171401
|
-
|
|
171402
|
-
|
|
171403
|
-
|
|
171404
|
-
|
|
171405
|
-
|
|
171406
|
-
|
|
171407
|
-
|
|
171408
|
-
|
|
171409
|
-
|
|
171410
|
-
|
|
171411
|
-
|
|
171412
|
-
|
|
171413
|
-
|
|
171414
|
-
|
|
171415
|
-
|
|
171416
|
-
|
|
171417
|
-
|
|
171418
|
-
|
|
171419
|
-
|
|
171420
|
-
|
|
171421
|
-
|
|
171422
|
-
|
|
171423
|
-
|
|
171424
|
-
|
|
171425
|
-
|
|
171426
|
-
|
|
171427
|
-
|
|
171428
|
-
|
|
171429
|
-
|
|
171430
|
-
|
|
171431
|
-
|
|
171432
|
-
|
|
171433
|
-
|
|
171434
|
-
|
|
171435
|
-
|
|
171436
|
-
|
|
171437
|
-
|
|
171438
|
-
|
|
171439
|
-
|
|
171440
|
-
|
|
171441
|
-
|
|
171442
|
-
|
|
171443
|
-
|
|
171444
|
-
|
|
171445
|
-
|
|
171446
|
-
|
|
171447
|
-
|
|
171448
|
-
|
|
171449
|
-
|
|
171450
|
-
|
|
171451
|
-
|
|
171452
|
-
|
|
172048
|
+
ROOT_RUN_ID_ATTRIBUTE as S,
|
|
172049
|
+
RunInputSchema as T,
|
|
172050
|
+
SPEC_VERSION_CURRENT as U,
|
|
172051
|
+
SPEC_VERSION_LEGACY as V,
|
|
172052
|
+
SPEC_VERSION_MAX_SUPPORTED as W,
|
|
172053
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as X,
|
|
172054
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as Y,
|
|
172055
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION as Z,
|
|
172056
|
+
SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as _,
|
|
172057
|
+
ATTRIBUTE_KEY_MAX_LENGTH as a,
|
|
172058
|
+
injectTraceContextIntoHeaders as a$,
|
|
172059
|
+
SerializedDataSchema as a0,
|
|
172060
|
+
StepSchema as a1,
|
|
172061
|
+
StepStatusSchema as a2,
|
|
172062
|
+
StructuredErrorSchema as a3,
|
|
172063
|
+
TERMINAL_RUN_EVENT_TYPES as a4,
|
|
172064
|
+
TERMINAL_STEP_EVENT_TYPES as a5,
|
|
172065
|
+
TERMINAL_STEP_STATUSES as a6,
|
|
172066
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as a7,
|
|
172067
|
+
TerminalRunEventTypeSchema as a8,
|
|
172068
|
+
TerminalStepStatusSchema as a9,
|
|
172069
|
+
isTerminalStepEventType as aA,
|
|
172070
|
+
isTerminalStepStatus as aB,
|
|
172071
|
+
isTerminalWorkflowRunStatus as aC,
|
|
172072
|
+
isWaitEventType as aD,
|
|
172073
|
+
parseQueueName as aE,
|
|
172074
|
+
reenqueueActiveRuns as aF,
|
|
172075
|
+
requiresNewerWorld as aG,
|
|
172076
|
+
resolveQueueNamespace as aH,
|
|
172077
|
+
slotToEventId as aI,
|
|
172078
|
+
stripEventDataRefs as aJ,
|
|
172079
|
+
ulidToDate as aK,
|
|
172080
|
+
validateAttributeChanges as aL,
|
|
172081
|
+
validateAttributeKey as aM,
|
|
172082
|
+
validateAttributeValue as aN,
|
|
172083
|
+
validateUlidTimestamp as aO,
|
|
172084
|
+
workflowRunIdSchema as aP,
|
|
172085
|
+
reactExports as aQ,
|
|
172086
|
+
R as aR,
|
|
172087
|
+
Ks as aS,
|
|
172088
|
+
jsxRuntimeExports as aT,
|
|
172089
|
+
Qe as aU,
|
|
172090
|
+
registerZstdDecoder as aV,
|
|
172091
|
+
isWsEventsTransportEnabled as aW,
|
|
172092
|
+
getHttpUrl as aX,
|
|
172093
|
+
getHttpConfig as aY,
|
|
172094
|
+
headersToRecord as aZ,
|
|
172095
|
+
getRequestTimeoutMs as a_,
|
|
172096
|
+
TerminalWorkflowRunStatusSchema as aa,
|
|
172097
|
+
ValidQueueName as ab,
|
|
172098
|
+
WAIT_EVENT_TYPES as ac,
|
|
172099
|
+
WaitSchema as ad,
|
|
172100
|
+
WaitStatusSchema as ae,
|
|
172101
|
+
WorkflowInvokePayloadSchema as af,
|
|
172102
|
+
WorkflowRunBaseSchema as ag,
|
|
172103
|
+
WorkflowRunSchema as ah,
|
|
172104
|
+
WorkflowRunStatusSchema as ai,
|
|
172105
|
+
applyAttributeChanges as aj,
|
|
172106
|
+
entityEventClass as ak,
|
|
172107
|
+
envNumber as al,
|
|
172108
|
+
eventIdToSlot as am,
|
|
172109
|
+
getEventDataPayloadField as an,
|
|
172110
|
+
getEventDataRefFields as ao,
|
|
172111
|
+
getMaxEventsPerRun as ap,
|
|
172112
|
+
getQueueTopicPrefix as aq,
|
|
172113
|
+
isChildEntityCreationEvent as ar,
|
|
172114
|
+
isChildEntityCreationEventType as as,
|
|
172115
|
+
isHookEventRequiringExistence as at,
|
|
172116
|
+
isHookLifecycleEventType as au,
|
|
172117
|
+
isLegacySpecVersion as av,
|
|
172118
|
+
isSlotBody as aw,
|
|
172119
|
+
isSlotEventId as ax,
|
|
172120
|
+
isStepEventType as ay,
|
|
172121
|
+
isTerminalRunEventType as az,
|
|
172122
|
+
ATTRIBUTE_MAX_PER_RUN as b,
|
|
172123
|
+
withHttpClientSpan as b0,
|
|
172124
|
+
ErrorType as b1,
|
|
172125
|
+
WorkflowWsReconnectAttempt as b2,
|
|
172126
|
+
NetworkProtocolName as b3,
|
|
172127
|
+
WorkflowEventsTransport as b4,
|
|
172128
|
+
distExports as b5,
|
|
172129
|
+
decodeFrames as b6,
|
|
172130
|
+
getDefaultExportFromCjs as b7,
|
|
172131
|
+
requireTokenUtil as b8,
|
|
172132
|
+
requireTokenError as b9,
|
|
172133
|
+
getAugmentedNamespace as ba,
|
|
172134
|
+
app as bb,
|
|
172135
|
+
createFetchHandler as bc,
|
|
172136
|
+
ATTRIBUTE_VALUE_MAX_BYTES as c,
|
|
172137
|
+
AnalyticsAttributeKeySchema as d,
|
|
172138
|
+
AnalyticsEventSchema as e,
|
|
172139
|
+
AnalyticsHookSchema as f,
|
|
172140
|
+
AnalyticsRunSchema as g,
|
|
172141
|
+
AnalyticsStepSchema as h,
|
|
172142
|
+
AnalyticsWaitSchema as i,
|
|
172143
|
+
AttributeChangeSchema as j,
|
|
172144
|
+
AttributeChangesSchema as k,
|
|
172145
|
+
AttributeValidationError as l,
|
|
172146
|
+
BaseEventSchema as m,
|
|
172147
|
+
BulkCancelWorkflowRunResultSchema as n,
|
|
172148
|
+
BulkCancelWorkflowRunsRequestSchema as o,
|
|
172149
|
+
BulkCancelWorkflowRunsResultSchema as p,
|
|
172150
|
+
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as q,
|
|
172151
|
+
EVENT_DATA_REF_FIELDS as r,
|
|
172152
|
+
EVENT_ID_BODY_LENGTH as s,
|
|
172153
|
+
EVENT_ID_PREFIX as t,
|
|
172154
|
+
EventSchema as u,
|
|
172155
|
+
EventTypeSchema as v,
|
|
172156
|
+
HOOK_EVENTS_REQUIRING_EXISTENCE as w,
|
|
172157
|
+
HOOK_LIFECYCLE_EVENT_TYPES as x,
|
|
172158
|
+
HOOK_RESUME_DEDUP_VERSION as y,
|
|
172159
|
+
HOOK_RESUME_INPUT_VERSION as z
|
|
171453
172160
|
};
|