@workflow/web 4.1.0-beta.39 → 4.1.0-beta.41

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.
Files changed (25) hide show
  1. package/README.md +5 -0
  2. package/build/client/assets/{highlighted-body-B3W2YXNL-BlI_3W94.js → highlighted-body-B3W2YXNL-DKVOCXmq.js} +1 -1
  3. package/build/client/assets/home-MMGoJh7w.js +35 -0
  4. package/build/client/assets/{manifest-ef94afe1.js → manifest-678c3cbf.js} +1 -1
  5. package/build/client/assets/{mermaid-3ZIDBTTL-BhkyG8Sq.js → mermaid-3ZIDBTTL-BPJg8vAL.js} +11 -11
  6. package/build/client/assets/root-BMRA92qM.css +1 -0
  7. package/build/client/assets/{root-B2fanH6r.js → root-DQpGl57T.js} +1 -1
  8. package/build/client/assets/run-detail-DZDSfYol.js +46 -0
  9. package/build/client/assets/server-build-ClfhJhzu.css +1 -0
  10. package/build/client/assets/{use-workflow-graph-D6xsvBGu.js → use-workflow-graph-B8LKXrpA.js} +1 -1
  11. package/build/server/assets/{app-YwmyVuwT.js → app-Bdxmgv4c.js} +1 -1
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-Dqsnck2u.js → highlighted-body-B3W2YXNL-uEj5-2nD.js} +2 -2
  13. package/build/server/assets/{mermaid-3ZIDBTTL-mfJ74Epj.js → mermaid-3ZIDBTTL-BvjkIiuk.js} +2 -2
  14. package/build/server/assets/{server-build-B3ijdJBL.js → server-build-CKAakcyN.js} +972 -862
  15. package/build/server/assets/{token-CWWXwMh8.js → token-CNug9NIq.js} +3 -3
  16. package/build/server/assets/{token-DJXheGCg.js → token-DLqvw7I2.js} +2 -2
  17. package/build/server/assets/{token-util-CvLiUUQD.js → token-util-DMDYM1rE.js} +2 -2
  18. package/build/server/assets/{token-util-REQ15piK.js → token-util-DgFyM3ow.js} +1 -1
  19. package/build/server/assets/{token-util-l0RNhdPG.js → token-util-_HYGsI73.js} +2 -2
  20. package/build/server/index.js +1 -1
  21. package/package.json +6 -8
  22. package/build/client/assets/home-B4MMr7LP.js +0 -35
  23. package/build/client/assets/root-Dr_TuMgh.css +0 -1
  24. package/build/client/assets/run-detail-D40YBNgh.js +0 -41
  25. package/build/client/assets/server-build-CgcbAXmU.css +0 -1
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
16
16
  var _a2, _reader;
17
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, M as Meta, L as Links, d as ScrollRestoration, e as Scripts, O as Outlet, u as useNavigate, f as useSearchParams, h as Link$1, i as useLocation, j as useParams } from "./app-YwmyVuwT.js";
17
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, M as Meta, L as Links, d as ScrollRestoration, e as Scripts, O as Outlet, u as useNavigate, f as useSearchParams, h as Link$1, i as useLocation, j as useParams } from "./app-Bdxmgv4c.js";
18
18
  import require$$0$4, { PassThrough } from "node:stream";
19
19
  import require$$0 from "util";
20
20
  import require$$1$1 from "crypto";
@@ -23352,8 +23352,8 @@ function handleRequest(request2, responseStatusCode, responseHeaders, routerCont
23352
23352
  }
23353
23353
  return new Promise((resolve2, reject) => {
23354
23354
  let shellRendered = false;
23355
- let userAgent = request2.headers.get("user-agent");
23356
- let readyOption = userAgent && isbot(userAgent) || routerContext.isSpaMode ? "onAllReady" : "onShellReady";
23355
+ const userAgent = request2.headers.get("user-agent");
23356
+ const readyOption = userAgent && isbot(userAgent) || routerContext.isSpaMode ? "onAllReady" : "onShellReady";
23357
23357
  let timeoutId = setTimeout(
23358
23358
  () => abort(),
23359
23359
  streamTimeout + 1e3
@@ -37045,16 +37045,69 @@ function ErrorStackBlock({ value }) {
37045
37045
  const copyText = message2 ? `${message2}
37046
37046
 
37047
37047
  ${stack}` : stack;
37048
- return jsxRuntimeExports.jsxs("div", { className: "relative overflow-x-auto rounded-md border p-3 pt-9", style: { borderColor: "var(--ds-gray-300)" }, children: [jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Copy error", title: "Copy", className: "!absolute !right-2 !top-2 !flex !h-6 !w-6 !items-center !justify-center !rounded-md !border !bg-[var(--ds-background-100)] !text-[var(--ds-gray-800)] transition-transform transition-colors duration-100 hover:!bg-[var(--ds-gray-alpha-200)] active:!scale-95 active:!bg-[var(--ds-gray-alpha-300)]", style: { borderColor: "var(--ds-gray-300)" }, onClick: () => {
37048
+ return jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden rounded-md border", style: {
37049
+ borderColor: "var(--ds-red-400)",
37050
+ background: "var(--ds-red-100)"
37051
+ }, children: [jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Copy error", title: "Copy", className: "!absolute !right-2 !top-2 !flex !h-6 !w-6 !items-center !justify-center !rounded-md !border transition-transform transition-colors duration-100 hover:!bg-[var(--ds-red-200)] active:!scale-95", style: {
37052
+ borderColor: "var(--ds-red-400)",
37053
+ background: "var(--ds-red-100)",
37054
+ color: "var(--ds-red-900)"
37055
+ }, onClick: () => {
37049
37056
  navigator.clipboard.writeText(copyText).then(() => {
37050
37057
  toast.success("Copied to clipboard");
37051
37058
  }).catch(() => {
37052
37059
  toast.error("Failed to copy");
37053
37060
  });
37054
- }, children: jsxRuntimeExports.jsx(Copy, { size: 12 }) }), message2 && jsxRuntimeExports.jsx("p", { className: "pb-2 mb-2 text-xs font-semibold font-mono", style: {
37061
+ }, children: jsxRuntimeExports.jsx(Copy, { size: 12 }) }), message2 && jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 px-3 py-2.5 pr-10", style: {
37062
+ color: "var(--ds-red-900)",
37063
+ borderBottom: "1px solid var(--ds-red-400)"
37064
+ }, children: [jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4 shrink-0", style: { marginTop: 1 } }), jsxRuntimeExports.jsx("p", { className: "text-xs font-semibold m-0 break-words", children: message2 })] }), jsxRuntimeExports.jsx("pre", { className: "px-3 py-2.5 text-xs font-mono whitespace-pre-wrap break-words overflow-auto m-0", style: {
37055
37065
  color: "var(--ds-red-900)",
37056
- borderBottom: "1px solid var(--ds-gray-300)"
37057
- }, children: message2 }), jsxRuntimeExports.jsx("pre", { className: "text-xs font-mono whitespace-pre-wrap break-words overflow-auto m-0", style: { color: "var(--ds-gray-1000)" }, children: stack })] });
37066
+ background: "var(--ds-red-200)"
37067
+ }, children: stack })] });
37068
+ }
37069
+ function MenuDropdown({ options, value, onChange }) {
37070
+ var _a3, _b;
37071
+ const [open, setOpen] = reactExports.useState(false);
37072
+ const ref = reactExports.useRef(null);
37073
+ const label = ((_a3 = options.find((o) => o.value === value)) == null ? void 0 : _a3.label) ?? ((_b = options[0]) == null ? void 0 : _b.label) ?? "";
37074
+ reactExports.useEffect(() => {
37075
+ if (!open)
37076
+ return;
37077
+ function handleClickOutside(e) {
37078
+ if (ref.current && !ref.current.contains(e.target)) {
37079
+ setOpen(false);
37080
+ }
37081
+ }
37082
+ document.addEventListener("mousedown", handleClickOutside);
37083
+ return () => document.removeEventListener("mousedown", handleClickOutside);
37084
+ }, [open]);
37085
+ return jsxRuntimeExports.jsxs("div", { ref, style: { position: "relative", flexShrink: 0 }, children: [jsxRuntimeExports.jsx("style", { children: `
37086
+ .wf-menu-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;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;transition:background 150ms}
37087
+ .wf-menu-btn:hover{background:var(--ds-gray-alpha-200)}
37088
+ .wf-menu-item{appearance:none;-webkit-appearance:none;border:none;display:flex;align-items:center;width:100%;height:40px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--ds-gray-1000);background:transparent;cursor:pointer;transition:background 150ms}
37089
+ .wf-menu-item:hover{background:var(--ds-gray-alpha-100)}
37090
+ ` }), jsxRuntimeExports.jsxs("button", { type: "button", className: "wf-menu-btn", onClick: () => setOpen(!open), children: [jsxRuntimeExports.jsx("span", { children: label }), jsxRuntimeExports.jsx("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", style: {
37091
+ marginLeft: 16,
37092
+ marginRight: -4,
37093
+ color: "var(--ds-gray-900)"
37094
+ }, children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open && jsxRuntimeExports.jsx("div", { style: {
37095
+ position: "absolute",
37096
+ right: 0,
37097
+ top: "100%",
37098
+ marginTop: 4,
37099
+ minWidth: 140,
37100
+ padding: 4,
37101
+ borderRadius: 12,
37102
+ background: "var(--ds-background-100)",
37103
+ boxShadow: "var(--ds-shadow-menu, var(--ds-shadow-medium))",
37104
+ zIndex: 2001
37105
+ }, role: "menu", children: options.map((option) => jsxRuntimeExports.jsx("button", { type: "button", role: "menuitem", className: "wf-menu-item", style: {
37106
+ fontWeight: option.value === value ? 500 : 400
37107
+ }, onClick: () => {
37108
+ onChange(option.value);
37109
+ setOpen(false);
37110
+ }, children: option.label }, option.value)) })] });
37058
37111
  }
37059
37112
  function Skeleton$2({ className, style: style2, ...props }) {
37060
37113
  return jsxRuntimeExports.jsx("div", { ...props, className: cn$4("rounded-md", className), style: { backgroundColor: "var(--ds-gray-200)", ...style2 } });
@@ -37101,16 +37154,19 @@ function getStatusDotColor(eventType) {
37101
37154
  }
37102
37155
  return "var(--ds-gray-600)";
37103
37156
  }
37104
- function buildNameMaps(steps, run) {
37105
- var _a3;
37157
+ function buildNameMaps(events2, run) {
37158
+ var _a3, _b;
37106
37159
  const correlationNameMap = /* @__PURE__ */ new Map();
37107
- if (steps) {
37108
- for (const step of steps) {
37109
- const parsed = parseStepName(String(step.stepName));
37110
- correlationNameMap.set(step.stepId, (parsed == null ? void 0 : parsed.shortName) ?? step.stepName);
37160
+ if (events2) {
37161
+ for (const event of events2) {
37162
+ if (event.eventType === "step_created" && event.correlationId) {
37163
+ const stepName = ((_a3 = event.eventData) == null ? void 0 : _a3.stepName) ?? "";
37164
+ const parsed = parseStepName(String(stepName));
37165
+ correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
37166
+ }
37111
37167
  }
37112
37168
  }
37113
- const workflowName = (run == null ? void 0 : run.workflowName) ? ((_a3 = parseWorkflowName(run.workflowName)) == null ? void 0 : _a3.shortName) ?? run.workflowName : null;
37169
+ const workflowName = (run == null ? void 0 : run.workflowName) ? ((_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName) ?? run.workflowName : null;
37114
37170
  return { correlationNameMap, workflowName };
37115
37171
  }
37116
37172
  function buildDurationMap(events2) {
@@ -37217,7 +37273,7 @@ function TreeGutter({ isFirst, isLast, isRunLevel: isRun, statusDotColor, pulse
37217
37273
  zIndex: 0
37218
37274
  } })] });
37219
37275
  }
37220
- function CopyableCell({ value, className }) {
37276
+ function CopyableCell({ value, className, style: styleProp }) {
37221
37277
  const [copied, setCopied] = reactExports.useState(false);
37222
37278
  const resetCopiedTimeoutRef = reactExports.useRef(null);
37223
37279
  reactExports.useEffect(() => {
@@ -37240,7 +37296,7 @@ function CopyableCell({ value, className }) {
37240
37296
  }, 1500);
37241
37297
  });
37242
37298
  }, [value]);
37243
- return jsxRuntimeExports.jsxs("div", { className: `group/copy flex items-center gap-1 flex-1 min-w-0 px-4 ${className ?? ""}`, children: [jsxRuntimeExports.jsx("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: value || "-" }), value ? jsxRuntimeExports.jsx("button", { type: "button", onClick: handleCopy, className: "flex-shrink-0 opacity-0 group-hover/copy:opacity-100 transition-opacity p-0.5 rounded hover:bg-[var(--ds-gray-alpha-200)]", style: BUTTON_RESET_STYLE, "aria-label": `Copy ${value}`, children: copied ? jsxRuntimeExports.jsx(Check, { className: "h-3 w-3", style: { color: "var(--ds-green-700)" } }) : jsxRuntimeExports.jsx(Copy, { className: "h-3 w-3", style: { color: "var(--ds-gray-700)" } }) }) : null] });
37299
+ return jsxRuntimeExports.jsxs("div", { className: `group/copy flex items-center gap-1 min-w-0 px-4 ${className ?? ""}`, style: styleProp, children: [jsxRuntimeExports.jsx("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: value || "-" }), value ? jsxRuntimeExports.jsx("button", { type: "button", onClick: handleCopy, className: "flex-shrink-0 opacity-0 group-hover/copy:opacity-100 transition-opacity p-0.5 rounded hover:bg-[var(--ds-gray-alpha-200)]", style: BUTTON_RESET_STYLE, "aria-label": `Copy ${value}`, children: copied ? jsxRuntimeExports.jsx(Check, { className: "h-3 w-3", style: { color: "var(--ds-green-700)" } }) : jsxRuntimeExports.jsx(Copy, { className: "h-3 w-3", style: { color: "var(--ds-gray-700)" } }) }) : null] });
37244
37300
  }
37245
37301
  function deepParseJson(value) {
37246
37302
  if (typeof value === "string") {
@@ -37318,18 +37374,16 @@ function PayloadBlock({ data, eventType }) {
37318
37374
  }
37319
37375
  return jsxRuntimeExports.jsxs("div", { className: "relative group/payload", children: [jsxRuntimeExports.jsx("div", { className: "overflow-x-auto p-2 text-[11px]", style: { color: "var(--ds-gray-1000)" }, children: jsxRuntimeExports.jsx(DataInspector, { data: cleaned, expandLevel: 2 }) }), jsxRuntimeExports.jsx("button", { type: "button", onClick: handleCopy, className: "absolute bottom-2 right-2 opacity-0 group-hover/payload:opacity-100 transition-opacity flex items-center gap-1 px-2 py-1 rounded-md text-xs hover:bg-[var(--ds-gray-alpha-200)]", style: { ...BUTTON_RESET_STYLE, color: "var(--ds-gray-700)" }, "aria-label": "Copy payload", children: copied ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Check, { className: "h-3 w-3", style: { color: "var(--ds-green-700)" } }), jsxRuntimeExports.jsx("span", { style: { color: "var(--ds-green-700)" }, children: "Copied" })] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Copy, { className: "h-3 w-3" }), jsxRuntimeExports.jsx("span", { children: "Copy" })] }) })] });
37320
37376
  }
37321
- function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, encryptionKey }) {
37322
- const [isExpanded, setIsExpanded] = reactExports.useState(false);
37377
+ const SORT_OPTIONS = [
37378
+ { value: "desc", label: "Newest" },
37379
+ { value: "asc", label: "Oldest" }
37380
+ ];
37381
+ function EventRow({ event, index: index2, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey }) {
37323
37382
  const [isLoading, setIsLoading] = reactExports.useState(false);
37324
- const [loadedEventData, setLoadedEventData] = reactExports.useState(null);
37383
+ const [loadedEventData, setLoadedEventData] = reactExports.useState(cachedEventData);
37325
37384
  const [loadError, setLoadError] = reactExports.useState(null);
37326
- const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(false);
37327
- const rowGroupKey = event.correlationId ?? (isRunLevel(event.eventType) ? "__run__" : void 0);
37328
- reactExports.useEffect(() => {
37329
- if (selectedGroupKey !== void 0 && selectedGroupKey !== rowGroupKey) {
37330
- setIsExpanded(false);
37331
- }
37332
- }, [selectedGroupKey, rowGroupKey]);
37385
+ const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(cachedEventData !== null);
37386
+ const rowGroupKey = isRunLevel(event.eventType) ? "__run__" : event.correlationId ?? void 0;
37333
37387
  const statusDotColor = getStatusDotColor(event.eventType);
37334
37388
  const createdAt = new Date(event.createdAt);
37335
37389
  const hasExistingEventData = "eventData" in event && event.eventData != null;
@@ -37356,9 +37410,10 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37356
37410
  setLoadError("Event details unavailable");
37357
37411
  return;
37358
37412
  }
37359
- const eventData2 = await onLoadEventData(event);
37360
- if (eventData2 !== null && eventData2 !== void 0) {
37361
- setLoadedEventData(eventData2);
37413
+ const data = await onLoadEventData(event);
37414
+ if (data !== null && data !== void 0) {
37415
+ setLoadedEventData(data);
37416
+ onCacheEventData(event.eventId, data);
37362
37417
  }
37363
37418
  } catch (err) {
37364
37419
  setLoadError(err instanceof Error ? err.message : "Failed to load event details");
@@ -37366,7 +37421,18 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37366
37421
  setIsLoading(false);
37367
37422
  setHasAttemptedLoad(true);
37368
37423
  }
37369
- }, [event, loadedEventData, hasExistingEventData, onLoadEventData]);
37424
+ }, [
37425
+ event,
37426
+ loadedEventData,
37427
+ hasExistingEventData,
37428
+ onLoadEventData,
37429
+ onCacheEventData
37430
+ ]);
37431
+ reactExports.useEffect(() => {
37432
+ if (isExpanded && loadedEventData === null && !hasExistingEventData && !isLoading && !hasAttemptedLoad) {
37433
+ loadEventDetails();
37434
+ }
37435
+ }, []);
37370
37436
  reactExports.useEffect(() => {
37371
37437
  if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
37372
37438
  setLoadedEventData(null);
@@ -37374,6 +37440,7 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37374
37440
  onLoadEventData(event).then((data) => {
37375
37441
  if (data !== null && data !== void 0) {
37376
37442
  setLoadedEventData(data);
37443
+ onCacheEventData(event.eventId, data);
37377
37444
  }
37378
37445
  setHasAttemptedLoad(true);
37379
37446
  }).catch(() => {
@@ -37381,33 +37448,34 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37381
37448
  });
37382
37449
  }
37383
37450
  }, [encryptionKey]);
37384
- const handleExpandToggle = reactExports.useCallback((e) => {
37385
- e.stopPropagation();
37386
- const newExpanded = !isExpanded;
37387
- setIsExpanded(newExpanded);
37388
- if (newExpanded && loadedEventData === null && !hasExistingEventData) {
37389
- loadEventDetails();
37390
- }
37391
- }, [isExpanded, loadedEventData, hasExistingEventData, loadEventDetails]);
37392
37451
  const handleRowClick = reactExports.useCallback(() => {
37393
- if (selectedGroupKey === rowGroupKey) {
37394
- onSelectGroup(void 0);
37395
- } else {
37396
- onSelectGroup(rowGroupKey);
37452
+ onSelectGroup(rowGroupKey === selectedGroupKey ? void 0 : rowGroupKey);
37453
+ onToggleExpand(event.eventId);
37454
+ if (!isExpanded && loadedEventData === null && !hasExistingEventData) {
37455
+ loadEventDetails();
37397
37456
  }
37398
- }, [selectedGroupKey, rowGroupKey, onSelectGroup]);
37457
+ }, [
37458
+ selectedGroupKey,
37459
+ rowGroupKey,
37460
+ onSelectGroup,
37461
+ onToggleExpand,
37462
+ event.eventId,
37463
+ isExpanded,
37464
+ loadedEventData,
37465
+ hasExistingEventData,
37466
+ loadEventDetails
37467
+ ]);
37399
37468
  const eventData = hasExistingEventData ? event.eventData : loadedEventData;
37400
37469
  const contentOpacity = isDimmed ? 0.3 : 1;
37401
37470
  return jsxRuntimeExports.jsxs("div", { "data-event-id": event.eventId, onMouseEnter: () => onHoverGroup(rowGroupKey), onMouseLeave: () => onHoverGroup(void 0), children: [jsxRuntimeExports.jsxs("div", { role: "button", tabIndex: 0, onClick: handleRowClick, onKeyDown: (e) => {
37402
37471
  if (e.key === "Enter" || e.key === " ")
37403
37472
  handleRowClick();
37404
- }, className: "w-full text-left flex items-center gap-0 text-sm hover:bg-[var(--ds-gray-alpha-100)] transition-colors cursor-pointer", style: { minHeight: 40 }, children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst, isLast: isLast && !isExpanded, isRunLevel: isRun, statusDotColor, pulse: isPulsing, hasSelection: hasActive, showBranch, showLaneLine, isLaneStart, isLaneEnd }), jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-1 min-w-0", style: { opacity: contentOpacity, transition: "opacity 150ms" }, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: handleExpandToggle, className: "flex items-center justify-center w-5 h-5 flex-shrink-0 rounded hover:bg-[var(--ds-gray-alpha-200)] transition-colors", style: {
37405
- ...BUTTON_RESET_STYLE,
37406
- border: "1px solid var(--ds-gray-alpha-400)"
37407
- }, "aria-label": isExpanded ? "Collapse details" : "Expand details", children: jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 transition-transform", style: {
37408
- color: "var(--ds-gray-700)",
37473
+ }, className: "w-full text-left flex items-center gap-0 text-[13px] hover:bg-[var(--ds-gray-alpha-100)] transition-colors cursor-pointer", style: { minHeight: 40 }, children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst, isLast: isLast && !isExpanded, isRunLevel: isRun, statusDotColor, pulse: isPulsing, hasSelection: hasActive, showBranch, showLaneLine, isLaneStart, isLaneEnd }), jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-1 min-w-0", style: { opacity: contentOpacity, transition: "opacity 150ms" }, children: [jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-5 h-5 flex-shrink-0 rounded", style: {
37474
+ border: "1px solid var(--ds-gray-400)"
37475
+ }, children: jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 transition-transform", style: {
37476
+ color: "var(--ds-gray-900)",
37409
37477
  transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
37410
- } }) }), jsxRuntimeExports.jsx("div", { className: "text-xs tabular-nums flex-1 min-w-0 px-4", style: { color: "var(--ds-gray-900)" }, children: formatEventTime(createdAt) }), jsxRuntimeExports.jsx("div", { className: "text-xs font-medium flex-1 min-w-0 px-4", children: jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5", style: { color: "var(--ds-gray-900)" }, children: [jsxRuntimeExports.jsxs("span", { style: {
37478
+ } }) }), jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: formatEventTime(createdAt) }), 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: { color: "var(--ds-gray-900)" }, children: [jsxRuntimeExports.jsxs("span", { style: {
37411
37479
  position: "relative",
37412
37480
  display: "inline-flex",
37413
37481
  width: 6,
@@ -37426,7 +37494,7 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37426
37494
  height: 6,
37427
37495
  borderRadius: "50%",
37428
37496
  backgroundColor: statusDotColor
37429
- } })] }), formatEventType(event.eventType)] }) }), jsxRuntimeExports.jsx("div", { className: "text-xs flex-1 min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap", title: eventName2 !== "-" ? eventName2 : void 0, children: eventName2 }), jsxRuntimeExports.jsx(CopyableCell, { value: event.correlationId || "", className: "font-mono text-xs" }), jsxRuntimeExports.jsx(CopyableCell, { value: event.eventId, className: "font-mono text-xs" })] })] }), 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: {
37497
+ } })] }), formatEventType(event.eventType)] }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap", style: { flex: "2 1 0%" }, title: eventName2 !== "-" ? eventName2 : void 0, children: eventName2 }), 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: {
37430
37498
  borderColor: "var(--ds-gray-alpha-200)",
37431
37499
  opacity: contentOpacity,
37432
37500
  transition: "opacity 150ms"
@@ -37436,13 +37504,23 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37436
37504
  color: "var(--ds-red-900)"
37437
37505
  }, children: loadError }) : isLoading || !hasExistingEventData && !hasAttemptedLoad && event.correlationId ? jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-3", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "75%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "50%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "60%" } })] }) : jsxRuntimeExports.jsx("div", { className: "p-2 text-xs", style: { color: "var(--ds-gray-900)" }, children: "No data" })] })] })] });
37438
37506
  }
37439
- function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey }) {
37507
+ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey, isLoading = false, sortOrder: sortOrderProp, onSortOrderChange }) {
37508
+ const [internalSortOrder, setInternalSortOrder] = reactExports.useState("asc");
37509
+ const effectiveSortOrder = sortOrderProp ?? internalSortOrder;
37510
+ const handleSortOrderChange = reactExports.useCallback((order2) => {
37511
+ if (onSortOrderChange) {
37512
+ onSortOrderChange(order2);
37513
+ } else {
37514
+ setInternalSortOrder(order2);
37515
+ }
37516
+ }, [onSortOrderChange]);
37440
37517
  const sortedEvents2 = reactExports.useMemo(() => {
37441
37518
  if (!events2 || events2.length === 0)
37442
37519
  return [];
37443
- return [...events2].sort((a2, b2) => new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime());
37444
- }, [events2]);
37445
- const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(steps ?? null, run ?? null), [steps, run]);
37520
+ const dir = effectiveSortOrder === "desc" ? -1 : 1;
37521
+ return [...events2].sort((a2, b2) => dir * (new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime()));
37522
+ }, [events2, effectiveSortOrder]);
37523
+ const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(events2 ?? null, run ?? null), [events2, run]);
37446
37524
  const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents2), [sortedEvents2]);
37447
37525
  const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
37448
37526
  const [hoveredGroupKey, setHoveredGroupKey] = reactExports.useState(void 0);
@@ -37453,6 +37531,49 @@ function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEv
37453
37531
  setHoveredGroupKey(groupKey);
37454
37532
  }, []);
37455
37533
  const activeGroupKey = selectedGroupKey ?? hoveredGroupKey;
37534
+ const [expandedEventIds, setExpandedEventIds] = reactExports.useState(() => /* @__PURE__ */ new Set());
37535
+ const toggleEventExpanded = reactExports.useCallback((eventId) => {
37536
+ setExpandedEventIds((prev) => {
37537
+ const next2 = new Set(prev);
37538
+ if (next2.has(eventId)) {
37539
+ next2.delete(eventId);
37540
+ } else {
37541
+ next2.add(eventId);
37542
+ }
37543
+ return next2;
37544
+ });
37545
+ }, []);
37546
+ const eventDataCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
37547
+ const cacheEventData = reactExports.useCallback((eventId, data) => {
37548
+ eventDataCacheRef.current.set(eventId, data);
37549
+ }, []);
37550
+ const eventGroupKeyMap = reactExports.useMemo(() => {
37551
+ const map2 = /* @__PURE__ */ new Map();
37552
+ for (const ev of sortedEvents2) {
37553
+ const gk = isRunLevel(ev.eventType) ? "__run__" : ev.correlationId ?? "";
37554
+ if (gk)
37555
+ map2.set(ev.eventId, gk);
37556
+ }
37557
+ return map2;
37558
+ }, [sortedEvents2]);
37559
+ reactExports.useEffect(() => {
37560
+ if (selectedGroupKey === void 0)
37561
+ return;
37562
+ setExpandedEventIds((prev) => {
37563
+ if (prev.size === 0)
37564
+ return prev;
37565
+ let changed = false;
37566
+ const next2 = /* @__PURE__ */ new Set();
37567
+ for (const eventId of prev) {
37568
+ if (eventGroupKeyMap.get(eventId) === selectedGroupKey) {
37569
+ next2.add(eventId);
37570
+ } else {
37571
+ changed = true;
37572
+ }
37573
+ }
37574
+ return changed ? next2 : prev;
37575
+ });
37576
+ }, [selectedGroupKey, eventGroupKeyMap]);
37456
37577
  const selectedGroupRange = reactExports.useMemo(() => {
37457
37578
  if (!activeGroupKey || activeGroupKey === "__run__")
37458
37579
  return null;
@@ -37473,15 +37594,23 @@ function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEv
37473
37594
  const entries = [];
37474
37595
  for (let i = 0; i < sortedEvents2.length; i++) {
37475
37596
  const ev = sortedEvents2[i];
37597
+ const isRun = isRunLevel(ev.eventType);
37598
+ const name2 = isRun ? workflowName ?? "" : ev.correlationId ? correlationNameMap.get(ev.correlationId) ?? "" : "";
37476
37599
  entries.push({
37477
- text: [ev.eventId, ev.correlationId ?? ""].join(" ").toLowerCase(),
37478
- groupKey: ev.correlationId ?? (isRunLevel(ev.eventType) ? "__run__" : void 0),
37600
+ fields: [
37601
+ ev.eventId,
37602
+ ev.correlationId ?? "",
37603
+ ev.eventType,
37604
+ formatEventType(ev.eventType),
37605
+ name2
37606
+ ].map((f2) => f2.toLowerCase()),
37607
+ groupKey: ev.correlationId ?? (isRun ? "__run__" : void 0),
37479
37608
  eventId: ev.eventId,
37480
37609
  index: i
37481
37610
  });
37482
37611
  }
37483
37612
  return entries;
37484
- }, [sortedEvents2]);
37613
+ }, [sortedEvents2, correlationNameMap, workflowName]);
37485
37614
  reactExports.useEffect(() => {
37486
37615
  var _a3;
37487
37616
  const q2 = searchQuery.trim().toLowerCase();
@@ -37489,27 +37618,49 @@ function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEv
37489
37618
  setSelectedGroupKey(void 0);
37490
37619
  return;
37491
37620
  }
37492
- const match2 = searchIndex.find((entry2) => entry2.text.includes(q2));
37493
- if (match2) {
37494
- setSelectedGroupKey(match2.groupKey);
37621
+ let bestMatch = null;
37622
+ let bestScore = 0;
37623
+ for (const entry2 of searchIndex) {
37624
+ for (const field of entry2.fields) {
37625
+ if (field && field.includes(q2)) {
37626
+ const score = q2.length / field.length;
37627
+ if (score > bestScore) {
37628
+ bestScore = score;
37629
+ bestMatch = entry2;
37630
+ }
37631
+ }
37632
+ }
37633
+ }
37634
+ if (bestMatch) {
37635
+ setSelectedGroupKey(bestMatch.groupKey);
37495
37636
  (_a3 = virtuosoRef.current) == null ? void 0 : _a3.scrollToIndex({
37496
- index: match2.index,
37637
+ index: bestMatch.index,
37497
37638
  align: "center",
37498
37639
  behavior: "smooth"
37499
37640
  });
37500
37641
  }
37501
37642
  }, [searchQuery, searchIndex]);
37502
37643
  if (!events2 || events2.length === 0) {
37644
+ if (isLoading) {
37645
+ return jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("div", { style: { padding: 6 }, children: jsxRuntimeExports.jsx(Skeleton$2, { style: { height: 40, borderRadius: 6 } }) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 h-10 border-b flex-shrink-0 px-4", style: { borderColor: "var(--ds-gray-alpha-200)" }, children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 60 } }), jsxRuntimeExports.jsx("div", { style: { flex: 1 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 80 } }), jsxRuntimeExports.jsx("div", { style: { flex: 1 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 50 } }), jsxRuntimeExports.jsx("div", { style: { flex: 1 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 90 } }), jsxRuntimeExports.jsx("div", { style: { flex: 1 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 70 } })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden", children: Array.from({ length: 8 }, (_2, i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 px-4", style: { height: 40 }, children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-2 w-2 flex-shrink-0", style: { borderRadius: "50%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 90 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 100 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 80 } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3 flex-1" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3 flex-1" })] }, i)) })] });
37646
+ }
37503
37647
  return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full text-sm", style: { color: "var(--ds-gray-700)" }, children: "No events found" });
37504
37648
  }
37505
- return jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("style", { children: `@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}` }), jsxRuntimeExports.jsx("div", { style: { padding: 6, backgroundColor: "var(--ds-background-100)" }, children: jsxRuntimeExports.jsxs("label", { style: {
37649
+ return jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("style", { children: `@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}` }), jsxRuntimeExports.jsxs("div", { style: {
37650
+ padding: 6,
37651
+ backgroundColor: "var(--ds-background-100)",
37652
+ display: "flex",
37653
+ gap: 6
37654
+ }, children: [jsxRuntimeExports.jsxs("label", { style: {
37506
37655
  display: "flex",
37507
37656
  alignItems: "center",
37508
37657
  justifyContent: "center",
37509
37658
  borderRadius: 6,
37510
37659
  boxShadow: "0 0 0 1px var(--ds-gray-alpha-400)",
37511
37660
  background: "var(--ds-background-100)",
37512
- height: 40
37661
+ height: 40,
37662
+ flex: 1,
37663
+ minWidth: 0
37513
37664
  }, children: [jsxRuntimeExports.jsx("div", { style: {
37514
37665
  width: 40,
37515
37666
  height: 40,
@@ -37518,7 +37669,7 @@ function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEv
37518
37669
  justifyContent: "center",
37519
37670
  color: "var(--ds-gray-800)",
37520
37671
  flexShrink: 0
37521
- }, children: jsxRuntimeExports.jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [jsxRuntimeExports.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntimeExports.jsx("path", { d: "M11.5 11.5L14 14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }), jsxRuntimeExports.jsx("input", { type: "search", placeholder: "Search by event ID or correlation ID…", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: {
37672
+ }, children: jsxRuntimeExports.jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [jsxRuntimeExports.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntimeExports.jsx("path", { d: "M11.5 11.5L14 14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }), jsxRuntimeExports.jsx("input", { type: "search", placeholder: "Search by name, event type, or ID…", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: {
37522
37673
  marginLeft: -16,
37523
37674
  paddingInline: 12,
37524
37675
  fontFamily: "inherit",
@@ -37528,27 +37679,29 @@ function EventListView({ events: events2, steps, run, onLoadEventData, hasMoreEv
37528
37679
  outline: "none",
37529
37680
  height: 40,
37530
37681
  width: "100%"
37531
- } })] }) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 text-sm font-medium h-10 border-b flex-shrink-0", style: {
37682
+ } })] }), jsxRuntimeExports.jsx(MenuDropdown, { options: SORT_OPTIONS, value: effectiveSortOrder, onChange: handleSortOrderChange })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 text-[13px] font-medium h-10 border-b flex-shrink-0", style: {
37532
37683
  borderColor: "var(--ds-gray-alpha-200)",
37533
37684
  color: "var(--ds-gray-900)",
37534
37685
  backgroundColor: "var(--ds-background-100)"
37535
- }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 px-4", children: "Time" }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 px-4", children: "Event Type" }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 px-4", children: "Name" }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 px-4", children: "Correlation ID" }), jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 px-4", children: "Event ID" })] }), jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: sortedEvents2.length, overscan: 20, defaultItemHeight: 40, endReached: () => {
37686
+ }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Time" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Event Type" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Name" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Correlation ID" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Event ID" })] }), jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: sortedEvents2.length, overscan: 20, defaultItemHeight: 40, endReached: () => {
37536
37687
  if (!hasMoreEvents || isLoadingMoreEvents) {
37537
37688
  return;
37538
37689
  }
37539
37690
  void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
37540
37691
  }, itemContent: (index2) => {
37541
- return jsxRuntimeExports.jsx(EventRow, { event: sortedEvents2[index2], index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents2.length - 1, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, encryptionKey });
37692
+ const ev = sortedEvents2[index2];
37693
+ return jsxRuntimeExports.jsx(EventRow, { event: ev, index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents2.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 });
37542
37694
  }, components: {
37543
- Footer: () => jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [hasMoreEvents && jsxRuntimeExports.jsx("div", { className: "px-3 pt-3 flex justify-center", children: jsxRuntimeExports.jsx("button", { type: "button", onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()), disabled: isLoadingMoreEvents, className: "h-8 px-3 text-xs rounded-md border transition-colors disabled:opacity-60 disabled:cursor-not-allowed", style: {
37695
+ Footer: hasMoreEvents ? () => jsxRuntimeExports.jsx("div", { className: "px-3 pt-3 flex justify-center", children: jsxRuntimeExports.jsx("button", { type: "button", onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()), disabled: isLoadingMoreEvents, className: "h-8 px-3 text-xs rounded-md border transition-colors disabled:opacity-60 disabled:cursor-not-allowed", style: {
37544
37696
  borderColor: "var(--ds-gray-alpha-400)",
37545
37697
  color: "var(--ds-gray-900)",
37546
37698
  backgroundColor: "var(--ds-background-100)"
37547
- }, children: isLoadingMoreEvents ? "Loading more events..." : "Load more" }) }), jsxRuntimeExports.jsxs("div", { className: "mt-4 pt-3 border-t text-xs px-3", style: {
37548
- borderColor: "var(--ds-gray-alpha-200)",
37549
- color: "var(--ds-gray-900)"
37550
- }, children: [sortedEvents2.length, " event", sortedEvents2.length !== 1 ? "s" : "", " total"] })] })
37551
- }, style: { flex: 1, minHeight: 0 } })] });
37699
+ }, children: isLoadingMoreEvents ? "Loading more events..." : "Load more" }) }) : void 0
37700
+ }, style: { flex: 1, minHeight: 0 } }), jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 border-t text-xs px-3 py-2", style: {
37701
+ borderColor: "var(--ds-gray-alpha-200)",
37702
+ color: "var(--ds-gray-900)",
37703
+ backgroundColor: "var(--ds-background-100)"
37704
+ }, children: [sortedEvents2.length, " event", sortedEvents2.length !== 1 ? "s" : "", " total"] })] });
37552
37705
  }
37553
37706
  function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
37554
37707
  var _a3;
@@ -64424,7 +64577,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
64424
64577
  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 });
64425
64578
  var Se = reactExports.createContext({ code: "" }), de$1 = () => reactExports.useContext(Se);
64426
64579
  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 }) });
64427
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-Dqsnck2u.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
64580
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-uEj5-2nD.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
64428
64581
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
64429
64582
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
64430
64583
  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 }) })] }) });
@@ -64746,7 +64899,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
64746
64899
  }, []), 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] });
64747
64900
  };
64748
64901
  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 }) })] });
64749
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-mfJ74Epj.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
64902
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-BvjkIiuk.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
64750
64903
  function ke(e, t) {
64751
64904
  if (!(e != null && e.position || t != null && t.position)) return true;
64752
64905
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -65325,11 +65478,12 @@ function DetailCard({ summary, children: children2, onToggle, disabled = false,
65325
65478
  opacity: 0.8
65326
65479
  }, children: summary });
65327
65480
  }
65328
- return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle == null ? void 0 : onToggle(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 ${summaryClassName ?? ""}`, style: {
65481
+ return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle == null ? void 0 : onToggle(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 [&::-webkit-details-marker]:hidden ${summaryClassName ?? ""}`, style: {
65329
65482
  borderColor: "var(--ds-gray-300)",
65330
65483
  backgroundColor: "var(--ds-gray-100)",
65331
- color: "var(--ds-gray-900)"
65332
- }, children: summary }), jsxRuntimeExports.jsxs("div", { className: `relative pl-6 mt-3 ${contentClassName ?? ""}`, children: [jsxRuntimeExports.jsx("div", { className: "absolute left-3 -top-3 w-px h-3", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg", style: { borderColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-6 top-3 w-0 h-px -translate-y-px", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { children: children2 })] })] });
65484
+ color: "var(--ds-gray-900)",
65485
+ listStyle: "none"
65486
+ }, children: jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5", children: [jsxRuntimeExports.jsx(ChevronRight, { size: 14, className: "shrink-0 transition-transform group-open:rotate-90" }), summary] }) }), jsxRuntimeExports.jsxs("div", { className: `relative pl-6 mt-3 ${contentClassName ?? ""}`, children: [jsxRuntimeExports.jsx("div", { className: "absolute left-3 -top-3 w-px h-3", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg", style: { borderColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-6 top-3 w-0 h-px -translate-y-px", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { children: children2 })] })] });
65333
65487
  }
65334
65488
  function TabButton({ active, onClick, children: children2 }) {
65335
65489
  return jsxRuntimeExports.jsx("button", { type: "button", role: "tab", "aria-selected": active, tabIndex: active ? 0 : -1, onClick, className: "px-3 py-1.5 text-[11px] font-medium transition-colors -mb-px", style: {
@@ -65404,6 +65558,9 @@ const attributeOrder = [
65404
65558
  "runId",
65405
65559
  "attempt",
65406
65560
  "token",
65561
+ "receivedCount",
65562
+ "lastReceivedAt",
65563
+ "disposedAt",
65407
65564
  "correlationId",
65408
65565
  "eventType",
65409
65566
  "deploymentId",
@@ -65432,7 +65589,8 @@ const sortByAttributeOrder = (a2, b2) => {
65432
65589
  return aIndex - bIndex;
65433
65590
  };
65434
65591
  const attributeDisplayNames = {
65435
- workflowCoreVersion: "@workflow/core version"
65592
+ workflowCoreVersion: "@workflow/core version",
65593
+ receivedCount: "times resolved"
65436
65594
  };
65437
65595
  const getAttributeDisplayName = (attribute) => {
65438
65596
  return attributeDisplayNames[attribute] ?? attribute;
@@ -65507,6 +65665,9 @@ const attributeToDisplayFn = {
65507
65665
  // Hook details
65508
65666
  token: (value) => String(value),
65509
65667
  isWebhook: (value) => String(value),
65668
+ receivedCount: (value) => String(value),
65669
+ lastReceivedAt: localMillisecondTimeOrNull,
65670
+ disposedAt: localMillisecondTimeOrNull,
65510
65671
  // Event details
65511
65672
  eventType: (value) => String(value),
65512
65673
  correlationId: (value) => String(value),
@@ -65683,8 +65844,9 @@ const AttributePanel = ({ data, moduleSpecifier, isLoading, error: error2, expir
65683
65844
  const displayValue = (_a3 = attributeToDisplayFn[attribute]) == null ? void 0 : _a3.call(attributeToDisplayFn, displayData[attribute]);
65684
65845
  const isModuleSpecifier = attribute === "moduleSpecifier";
65685
65846
  const moduleSpecifierValue = typeof displayValue === "string" ? displayValue : String(displayValue ?? displayData.moduleSpecifier ?? "");
65847
+ const shouldCapitalizeLabel = attribute !== "workflowCoreVersion";
65686
65848
  const showDivider = index2 < orderedBasicAttributes.length - 1;
65687
- return jsxRuntimeExports.jsxs("div", { className: "py-1", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1", children: [jsxRuntimeExports.jsx("span", { className: "text-[14px] first-letter:uppercase", style: { color: "var(--ds-gray-700)" }, children: getAttributeDisplayName(attribute) }), isModuleSpecifier ? jsxRuntimeExports.jsx("button", { type: "button", className: "min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono", style: {
65849
+ return jsxRuntimeExports.jsxs("div", { className: "py-1", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1", children: [jsxRuntimeExports.jsx("span", { className: shouldCapitalizeLabel ? "text-[14px] first-letter:uppercase" : "text-[14px]", style: { color: "var(--ds-gray-700)" }, children: getAttributeDisplayName(attribute) }), isModuleSpecifier ? jsxRuntimeExports.jsx("button", { type: "button", className: "min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono", style: {
65688
65850
  color: "var(--ds-gray-1000)",
65689
65851
  background: "transparent",
65690
65852
  border: "none",
@@ -65775,7 +65937,7 @@ function isWorkflowRun(data) {
65775
65937
  function isHook(data) {
65776
65938
  return data !== null && typeof data === "object" && "hookId" in data;
65777
65939
  }
65778
- function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDetailError, spanDetailLoading, onSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, selectedSpan }) {
65940
+ function EntityDetailPanel({ run, onStreamClick, spanDetailData, spanDetailError, spanDetailLoading, onSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, onDecrypt, selectedSpan }) {
65779
65941
  const [stoppingSleep, setStoppingSleep] = reactExports.useState(false);
65780
65942
  const [showResolveHookModal, setShowResolveHookModal] = reactExports.useState(false);
65781
65943
  const [resolvingHook, setResolvingHook] = reactExports.useState(false);
@@ -65798,10 +65960,11 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
65798
65960
  return { resource: "hook", resourceId: data.hookId, runId: void 0 };
65799
65961
  }
65800
65962
  if (res === "sleep") {
65963
+ const waitData = data;
65801
65964
  return {
65802
65965
  resource: "sleep",
65803
65966
  resourceId: selectedSpan.spanId,
65804
- runId: void 0
65967
+ runId: waitData == null ? void 0 : waitData.runId
65805
65968
  };
65806
65969
  }
65807
65970
  return { resource: void 0, resourceId: void 0, runId: void 0 };
@@ -65849,21 +66012,23 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
65849
66012
  ]);
65850
66013
  const error2 = spanDetailError ?? void 0;
65851
66014
  const loading = spanDetailLoading ?? false;
66015
+ const hasEncryptedFields = reactExports.useMemo(() => {
66016
+ if (!spanDetailData)
66017
+ return false;
66018
+ const d2 = spanDetailData;
66019
+ return isEncryptedMarker(d2.input) || isEncryptedMarker(d2.output) || isEncryptedMarker(d2.error) || isEncryptedMarker(d2.metadata);
66020
+ }, [spanDetailData]);
65852
66021
  const hookToken = reactExports.useMemo(() => {
65853
66022
  if (resource !== "hook" || !resourceId)
65854
66023
  return void 0;
65855
66024
  if (isHook(spanDetailData) && spanDetailData.token) {
65856
66025
  return spanDetailData.token;
65857
66026
  }
65858
- const hookFromArray = hooks == null ? void 0 : hooks.find((h2) => h2.hookId === resourceId);
65859
- if (hookFromArray == null ? void 0 : hookFromArray.token) {
65860
- return hookFromArray.token;
65861
- }
65862
66027
  if (isHook(data) && data.token) {
65863
66028
  return data.token;
65864
66029
  }
65865
66030
  return void 0;
65866
- }, [resource, resourceId, spanDetailData, data, hooks]);
66031
+ }, [resource, resourceId, spanDetailData, data]);
65867
66032
  reactExports.useEffect(() => {
65868
66033
  if (error2 && selectedSpan && resource) {
65869
66034
  toast.error(`Failed to load ${resource} details`, {
@@ -65937,10 +66102,7 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
65937
66102
  setResolvingHook(false);
65938
66103
  }
65939
66104
  }, [onResolveHook, hookToken, resolvingHook, spanDetailData, data]);
65940
- if (!selectedSpan || !resource || !resourceId) {
65941
- return null;
65942
- }
65943
- const displayData = resource === "sleep" ? data : spanDetailData ?? data;
66105
+ const displayData = spanDetailData ?? data;
65944
66106
  const moduleSpecifier = reactExports.useMemo(() => {
65945
66107
  const displayRecord = displayData;
65946
66108
  const displayStepName = displayRecord.stepName;
@@ -65956,16 +66118,24 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
65956
66118
  }
65957
66119
  return void 0;
65958
66120
  }, [displayData, run.workflowName]);
66121
+ if (!selectedSpan || !resource || !resourceId) {
66122
+ return null;
66123
+ }
65959
66124
  const resourceLabel = resource.charAt(0).toUpperCase() + resource.slice(1);
65960
66125
  const hasPendingActions = resource === "sleep" && canWakeUp || resource === "hook" && canResolveHook;
65961
66126
  const runStateLabel = run.completedAt ? "Completed" : "Live";
65962
- return jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [jsxRuntimeExports.jsx("div", { className: "border-b px-3 py-3", style: { borderColor: "var(--ds-gray-200)" }, children: jsxRuntimeExports.jsx("div", { className: "flex items-start justify-between gap-2", children: jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: "inline-flex items-center rounded-full border px-2 py-0.5 text-[13px] font-medium", style: {
66127
+ return jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [jsxRuntimeExports.jsx("div", { className: "border-b px-3 py-3", style: { borderColor: "var(--ds-gray-200)" }, children: jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-2", children: [jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: "inline-flex items-center rounded-full border px-2 py-0.5 text-[13px] font-medium", style: {
65963
66128
  borderColor: "var(--ds-gray-300)",
65964
66129
  color: "var(--ds-gray-900)",
65965
66130
  backgroundColor: "var(--ds-background-100)"
65966
66131
  }, children: resourceLabel }), jsxRuntimeExports.jsx("span", { className: "text-[13px]", style: {
65967
66132
  color: run.completedAt ? "var(--ds-gray-700)" : "var(--ds-green-800)"
65968
- }, children: runStateLabel })] }), jsxRuntimeExports.jsx("p", { className: "mt-1 truncate font-mono text-[13px]", style: { color: "var(--ds-gray-700)" }, title: resourceId, children: resourceId })] }) }) }), jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-3 pt-3 pb-8", children: [hasPendingActions && jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded-lg border p-2", style: {
66133
+ }, children: runStateLabel })] }), jsxRuntimeExports.jsx("p", { className: "mt-1 truncate font-mono text-[13px]", style: { color: "var(--ds-gray-700)" }, title: resourceId, children: resourceId })] }), (hasEncryptedFields || encryptionKey) && onDecrypt && jsxRuntimeExports.jsxs("button", { type: "button", onClick: onDecrypt, disabled: !!encryptionKey, className: "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium transition-colors flex-shrink-0", style: {
66134
+ borderColor: encryptionKey ? "var(--ds-green-400)" : "var(--ds-gray-300)",
66135
+ color: encryptionKey ? "var(--ds-green-900)" : "var(--ds-gray-900)",
66136
+ backgroundColor: encryptionKey ? "var(--ds-green-100)" : "var(--ds-background-100)",
66137
+ cursor: encryptionKey ? "default" : "pointer"
66138
+ }, children: [encryptionKey ? jsxRuntimeExports.jsx(LockOpen, { className: "h-3 w-3" }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), encryptionKey ? "Decrypted" : "Decrypt"] })] }) }), jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-3 pt-3 pb-8", children: [hasPendingActions && jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded-lg border p-2", style: {
65969
66139
  borderColor: "var(--ds-gray-300)",
65970
66140
  backgroundColor: "var(--ds-gray-100)"
65971
66141
  }, children: [jsxRuntimeExports.jsx("p", { className: "mb-2 px-1 text-[13px] font-medium uppercase tracking-wide", style: { color: "var(--ds-gray-700)" }, children: "Actions" }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [resource === "sleep" && canWakeUp && jsxRuntimeExports.jsxs("button", { type: "button", onClick: handleWakeUp, disabled: stoppingSleep, className: clsx("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium", "disabled:opacity-50 disabled:cursor-not-allowed transition-colors", stoppingSleep ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), style: {
@@ -68719,7 +68889,7 @@ const skeletonTrace = {
68719
68889
  ],
68720
68890
  rootSpanId: "root"
68721
68891
  };
68722
- function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", scrollLock = false, height, withPanel = false, highlightedSpans, eagerRender = false, isLive = false }) {
68892
+ function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", scrollLock = false, height, withPanel = false, highlightedSpans, eagerRender = false, isLive = false, footer: footer2, knownDurationMs, hasMoreData = false }) {
68723
68893
  const isSkeleton = trace2 === skeletonTrace;
68724
68894
  const { state, dispatch: dispatch2 } = useTraceViewer();
68725
68895
  const { timelineRef, scrollSnapshotRef } = state;
@@ -68954,16 +69124,35 @@ function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", sc
68954
69124
  "--scrollbar-width": `${state.scrollbarWidth}px`,
68955
69125
  "--marker-height": `${MARKER_HEIGHT}px`,
68956
69126
  "--marker-notch-height": `${MARKER_NOTCH_HEIGHT}px`
68957
- }, children: [!hideSearchBar ? jsxRuntimeExports.jsx(SearchBar, {}) : null, jsxRuntimeExports.jsx(MiniMap, { rows, scale, timelineRef }), jsxRuntimeExports.jsxs("div", { className: clsx(styles.traceViewerContent, inert2 && styles.inert), children: [jsxRuntimeExports.jsx("div", { className: styles.timeline, ref: timelineRef, children: jsxRuntimeExports.jsx("div", { style: {
69127
+ }, children: [!hideSearchBar ? jsxRuntimeExports.jsx(SearchBar, {}) : null, jsxRuntimeExports.jsx(MiniMap, { rows, scale, timelineRef }), jsxRuntimeExports.jsxs("div", { className: clsx(styles.traceViewerContent, inert2 && styles.inert), children: [jsxRuntimeExports.jsxs("div", { className: styles.timeline, ref: timelineRef, children: [jsxRuntimeExports.jsx("div", { style: {
68958
69128
  position: "relative",
68959
69129
  width: state.timelineWidth,
68960
- height: state.timelineHeight - TIMELINE_PADDING * 2,
69130
+ minHeight: state.timelineHeight - TIMELINE_PADDING * 2,
68961
69131
  padding: TIMELINE_PADDING,
68962
69132
  paddingBottom: 0
68963
69133
  }, children: jsxRuntimeExports.jsxs("div", { className: styles.traceNode, style: {
68964
69134
  width: state.root.duration * scale || void 0,
68965
69135
  height: timelineHeight - TIMELINE_PADDING * 2
68966
- }, children: [jsxRuntimeExports.jsx(Markers, { scale, isLive }), jsxRuntimeExports.jsx(EventMarkers, { events: events2, root: state.root, scale }), jsxRuntimeExports.jsx(CursorMarker, { dispatch: dispatch2, events: events2, memoCacheRef: state.memoCacheRef, root: state.root, scale, scrollSnapshotRef, spans, timelineRef }), jsxRuntimeExports.jsx(SpanNodes, { cacheKey: memoCache.get(""), cache: memoCache, customSpanClassNameFunc: state.customSpanClassNameFunc, customSpanEventClassNameFunc: state.customSpanEventClassNameFunc, isLive, root: state.root, scale, scrollSnapshotRef, spans })] }) }) }), jsxRuntimeExports.jsx("div", { className: styles.zoomButtonTraceViewer, children: jsxRuntimeExports.jsx(ZoomButton, {}) })] }), withPanel ? jsxRuntimeExports.jsx("div", { className: clsx(styles.spanDetailPanelTraceViewer, !state.selected && styles.hidden, state.isMobile && styles.mobile), children: jsxRuntimeExports.jsx(SpanDetailPanel, { attached: true }) }) : null] });
69136
+ }, children: [jsxRuntimeExports.jsx(Markers, { scale, isLive }), jsxRuntimeExports.jsx(EventMarkers, { events: events2, root: state.root, scale }), jsxRuntimeExports.jsx(CursorMarker, { dispatch: dispatch2, events: events2, memoCacheRef: state.memoCacheRef, root: state.root, scale, scrollSnapshotRef, spans, timelineRef }), jsxRuntimeExports.jsx(SpanNodes, { cacheKey: memoCache.get(""), cache: memoCache, customSpanClassNameFunc: state.customSpanClassNameFunc, customSpanEventClassNameFunc: state.customSpanEventClassNameFunc, isLive, root: state.root, scale, scrollSnapshotRef, spans }), knownDurationMs != null && knownDurationMs > 0 && (hasMoreData || isLive) && state.root.duration > 0 && (() => {
69137
+ const knownPx = knownDurationMs * scale;
69138
+ const totalPx = state.root.duration * scale;
69139
+ const unknownWidth = totalPx - knownPx;
69140
+ if (unknownWidth < 4)
69141
+ return null;
69142
+ const insetPx = Math.min(unknownWidth * 0.05, 20);
69143
+ return jsxRuntimeExports.jsx("div", { style: {
69144
+ position: "absolute",
69145
+ top: 0,
69146
+ left: knownPx + insetPx,
69147
+ width: unknownWidth - insetPx,
69148
+ height: "100%",
69149
+ pointerEvents: "none",
69150
+ zIndex: 1,
69151
+ maskImage: "linear-gradient(to right, transparent 1%, black 3%)",
69152
+ WebkitMaskImage: "linear-gradient(to right, transparent 1%, black 3%)",
69153
+ background: "repeating-linear-gradient(-45deg, var(--ds-background-200) 0, var(--ds-background-200) 11px, var(--ds-gray-200) 11px, var(--ds-gray-200) 12px)"
69154
+ } });
69155
+ })()] }) }), footer2] }), jsxRuntimeExports.jsx("div", { className: styles.zoomButtonTraceViewer, children: jsxRuntimeExports.jsx(ZoomButton, {}) })] }), withPanel ? jsxRuntimeExports.jsx("div", { className: clsx(styles.spanDetailPanelTraceViewer, !state.selected && styles.hidden, state.isMobile && styles.mobile), children: jsxRuntimeExports.jsx(SpanDetailPanel, { attached: true }) }) : null] });
68967
69156
  }
68968
69157
  function getStatusClassName(status, isStripped = false) {
68969
69158
  if (isStripped && status === "pending") {
@@ -69106,14 +69295,13 @@ const waitEventsToWaitEntity = (events2) => {
69106
69295
  completedAt: completedEvent == null ? void 0 : completedEvent.createdAt
69107
69296
  };
69108
69297
  };
69109
- function waitToSpan(events2, run, nowTime) {
69298
+ function waitToSpan(events2, maxEndTime) {
69110
69299
  const wait = waitEventsToWaitEntity(events2);
69111
69300
  if (!wait) {
69112
69301
  return null;
69113
69302
  }
69114
- const viewerEndTime = new Date(run.completedAt || nowTime) ?? nowTime;
69115
- const startTime = (wait == null ? void 0 : wait.createdAt) ?? nowTime;
69116
- const endTime = (wait == null ? void 0 : wait.completedAt) ?? viewerEndTime;
69303
+ const startTime = wait.createdAt;
69304
+ const endTime = wait.completedAt ?? maxEndTime;
69117
69305
  const start2 = dateToOtelTime(startTime);
69118
69306
  const end = dateToOtelTime(endTime);
69119
69307
  const duration2 = calculateDuration(startTime, endTime);
@@ -69139,16 +69327,67 @@ function waitToSpan(events2, run, nowTime) {
69139
69327
  endTime: end
69140
69328
  };
69141
69329
  }
69142
- function stepToSpan(step, stepEvents, nowTime, maxEndTime) {
69143
- const now2 = nowTime ?? /* @__PURE__ */ new Date();
69330
+ const stepEventsToStepEntity = (events2) => {
69331
+ var _a3;
69332
+ const createdEvent = events2.find((event) => event.eventType === "step_created");
69333
+ if (!createdEvent) {
69334
+ return null;
69335
+ }
69336
+ let status = "pending";
69337
+ let attempt = 0;
69338
+ let startedAt;
69339
+ let completedAt;
69340
+ for (const e of events2) {
69341
+ switch (e.eventType) {
69342
+ case "step_started":
69343
+ status = "running";
69344
+ attempt += 1;
69345
+ if (!startedAt)
69346
+ startedAt = e.createdAt;
69347
+ completedAt = void 0;
69348
+ break;
69349
+ case "step_completed":
69350
+ status = "completed";
69351
+ completedAt = e.createdAt;
69352
+ break;
69353
+ case "step_failed":
69354
+ status = "failed";
69355
+ completedAt = e.createdAt;
69356
+ break;
69357
+ case "step_retrying":
69358
+ status = "pending";
69359
+ completedAt = void 0;
69360
+ break;
69361
+ }
69362
+ }
69363
+ if (attempt === 0)
69364
+ attempt = 1;
69365
+ const lastEvent = events2[events2.length - 1];
69366
+ return {
69367
+ stepId: createdEvent.correlationId,
69368
+ runId: createdEvent.runId,
69369
+ stepName: ((_a3 = createdEvent.eventData) == null ? void 0 : _a3.stepName) ?? "",
69370
+ status,
69371
+ attempt,
69372
+ createdAt: createdEvent.createdAt,
69373
+ updatedAt: (lastEvent == null ? void 0 : lastEvent.createdAt) ?? createdEvent.createdAt,
69374
+ startedAt,
69375
+ completedAt,
69376
+ specVersion: createdEvent.specVersion
69377
+ };
69378
+ };
69379
+ function stepToSpan(stepEvents, maxEndTime) {
69380
+ const step = stepEventsToStepEntity(stepEvents);
69381
+ if (!step) {
69382
+ return null;
69383
+ }
69144
69384
  const parsedName = parseStepName(String(step.stepName));
69145
- const { input: _i, output: _o2, error: _e2, ...stepIdentity } = step;
69146
69385
  const attributes = {
69147
69386
  resource: "step",
69148
- data: stepIdentity
69387
+ data: step
69149
69388
  };
69150
69389
  const resource = "step";
69151
- const endTime = new Date(step.completedAt ?? maxEndTime ?? now2);
69390
+ const endTime = new Date(step.completedAt ?? maxEndTime);
69152
69391
  const events2 = convertEventsToSpanEvents(stepEvents, false);
69153
69392
  const spanStartTime = new Date(step.createdAt);
69154
69393
  let activeStartTime = step.startedAt ? new Date(step.startedAt) : void 0;
@@ -69176,7 +69415,7 @@ function stepToSpan(step, stepEvents, nowTime, maxEndTime) {
69176
69415
  };
69177
69416
  }
69178
69417
  const hookEventsToHookEntity = (events2) => {
69179
- var _a3;
69418
+ var _a3, _b;
69180
69419
  const createdEvent = events2.find((event) => event.eventType === "hook_created");
69181
69420
  if (!createdEvent) {
69182
69421
  return null;
@@ -69187,20 +69426,20 @@ const hookEventsToHookEntity = (events2) => {
69187
69426
  return {
69188
69427
  hookId: createdEvent.correlationId,
69189
69428
  runId: createdEvent.runId,
69429
+ token: (_a3 = createdEvent.eventData) == null ? void 0 : _a3.token,
69190
69430
  createdAt: createdEvent.createdAt,
69191
69431
  receivedCount: receivedEvents.length,
69192
69432
  lastReceivedAt: (lastReceivedEvent == null ? void 0 : lastReceivedEvent.createdAt) || void 0,
69193
- disposedAt: ((_a3 = disposedEvents.at(-1)) == null ? void 0 : _a3.createdAt) || void 0
69433
+ disposedAt: ((_b = disposedEvents.at(-1)) == null ? void 0 : _b.createdAt) || void 0
69194
69434
  };
69195
69435
  };
69196
- function hookToSpan(hookEvents, run, nowTime) {
69436
+ function hookToSpan(hookEvents, maxEndTime) {
69197
69437
  const hook = hookEventsToHookEntity(hookEvents);
69198
69438
  if (!hook) {
69199
69439
  return null;
69200
69440
  }
69201
69441
  const events2 = convertEventsToSpanEvents(hookEvents, false);
69202
- const viewerEndTime = new Date(run.completedAt || nowTime) ?? nowTime;
69203
- const endTime = hook.disposedAt || viewerEndTime;
69442
+ const endTime = hook.disposedAt || maxEndTime;
69204
69443
  return {
69205
69444
  spanId: String(hook.hookId),
69206
69445
  name: String(hook.hookId),
@@ -69252,6 +69491,102 @@ function runToSpan(run, runEvents, nowTime) {
69252
69491
  activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
69253
69492
  };
69254
69493
  }
69494
+ const isStepEvent = (eventType) => eventType.startsWith("step_");
69495
+ const isTimerEvent = (eventType) => eventType === "wait_created" || eventType === "wait_completed";
69496
+ const isHookLifecycleEvent = (eventType) => eventType === "hook_received" || eventType === "hook_created" || eventType === "hook_disposed";
69497
+ function pushEvent(map2, correlationId, event) {
69498
+ const existing = map2.get(correlationId);
69499
+ if (existing) {
69500
+ existing.push(event);
69501
+ return;
69502
+ }
69503
+ map2.set(correlationId, [event]);
69504
+ }
69505
+ function groupEventsByCorrelation(events2) {
69506
+ const eventsByStepId = /* @__PURE__ */ new Map();
69507
+ const runLevelEvents = [];
69508
+ const timerEvents = /* @__PURE__ */ new Map();
69509
+ const hookEvents = /* @__PURE__ */ new Map();
69510
+ for (const event of events2) {
69511
+ const correlationId = event.correlationId;
69512
+ if (!correlationId) {
69513
+ runLevelEvents.push(event);
69514
+ continue;
69515
+ }
69516
+ if (isTimerEvent(event.eventType)) {
69517
+ pushEvent(timerEvents, correlationId, event);
69518
+ continue;
69519
+ }
69520
+ if (isHookLifecycleEvent(event.eventType)) {
69521
+ pushEvent(hookEvents, correlationId, event);
69522
+ continue;
69523
+ }
69524
+ if (isStepEvent(event.eventType)) {
69525
+ pushEvent(eventsByStepId, correlationId, event);
69526
+ continue;
69527
+ }
69528
+ runLevelEvents.push(event);
69529
+ }
69530
+ return { eventsByStepId, runLevelEvents, timerEvents, hookEvents };
69531
+ }
69532
+ function computeLatestKnownTime(events2, run) {
69533
+ let latest = new Date(run.createdAt).getTime();
69534
+ for (const event of events2) {
69535
+ const t = new Date(event.createdAt).getTime();
69536
+ if (t > latest)
69537
+ latest = t;
69538
+ }
69539
+ return new Date(latest);
69540
+ }
69541
+ function buildSpans(run, groupedEvents, now2, latestKnownTime) {
69542
+ const childMaxEnd = latestKnownTime;
69543
+ const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd)).filter((span) => span !== null);
69544
+ const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, childMaxEnd)).filter((span) => span !== null);
69545
+ const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, childMaxEnd)).filter((span) => span !== null);
69546
+ return {
69547
+ runSpan: runToSpan(run, groupedEvents.runLevelEvents, now2),
69548
+ spans: [...stepSpans, ...hookSpans, ...waitSpans]
69549
+ };
69550
+ }
69551
+ function cascadeSpans(runSpan, spans) {
69552
+ const sortedSpans = [
69553
+ runSpan,
69554
+ ...spans.slice().sort((a2, b2) => {
69555
+ const aStart = otelTimeToMs(a2.startTime);
69556
+ const bStart = otelTimeToMs(b2.startTime);
69557
+ return aStart - bStart;
69558
+ })
69559
+ ];
69560
+ return sortedSpans.map((span, index2) => {
69561
+ const parentSpanId = index2 === 0 ? void 0 : String(sortedSpans[index2 - 1].spanId);
69562
+ return {
69563
+ ...span,
69564
+ parentSpanId
69565
+ };
69566
+ });
69567
+ }
69568
+ function buildTrace(run, events2, now2) {
69569
+ const groupedEvents = groupEventsByCorrelation(events2);
69570
+ const latestKnownTime = computeLatestKnownTime(events2, run);
69571
+ const { runSpan, spans } = buildSpans(run, groupedEvents, now2, latestKnownTime);
69572
+ const sortedCascadingSpans = cascadeSpans(runSpan, spans);
69573
+ const traceStartMs = otelTimeToMs(runSpan.startTime);
69574
+ const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
69575
+ return {
69576
+ traceId: run.runId,
69577
+ rootSpanId: run.runId,
69578
+ spans: sortedCascadingSpans,
69579
+ resources: [
69580
+ {
69581
+ name: "workflow",
69582
+ attributes: {
69583
+ "service.name": WORKFLOW_LIBRARY.name
69584
+ }
69585
+ }
69586
+ ],
69587
+ knownDurationMs: Math.max(0, knownDurationMs)
69588
+ };
69589
+ }
69255
69590
  function useLiveTick(isLive) {
69256
69591
  const { state, dispatch: dispatch2 } = useTraceViewer();
69257
69592
  const stateRef = reactExports.useRef(state);
@@ -69394,7 +69729,7 @@ function SpanContextMenu({ menu, items, onClose }) {
69394
69729
  onClose();
69395
69730
  }, children: [item.icon ?? null, item.label] }, item.label))] }), document.body);
69396
69731
  }
69397
- function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, children: children2 }) {
69732
+ function TraceViewerWithContextMenu({ trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, children: children2 }) {
69398
69733
  const { state, dispatch: dispatch2 } = useTraceViewer();
69399
69734
  useLiveTick(isLive);
69400
69735
  const [contextMenu, setContextMenu] = reactExports.useState(null);
@@ -69408,13 +69743,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
69408
69743
  }
69409
69744
  return map2;
69410
69745
  }, [trace2.spans]);
69411
- const hookLookup = reactExports.useMemo(() => {
69412
- const map2 = /* @__PURE__ */ new Map();
69413
- for (const hook of hooks) {
69414
- map2.set(hook.hookId, hook);
69415
- }
69416
- return map2;
69417
- }, [hooks]);
69418
69746
  const handleResolveHook = reactExports.useCallback(async (payload) => {
69419
69747
  if (resolvingHook || !resolveHookTarget || !onResolveHook)
69420
69748
  return;
@@ -69426,7 +69754,7 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
69426
69754
  }
69427
69755
  try {
69428
69756
  setResolvingHook(true);
69429
- await onResolveHook(resolveHookTarget.token, payload, resolveHookTarget);
69757
+ await onResolveHook(resolveHookTarget.token, payload);
69430
69758
  toast.success("Hook resolved", {
69431
69759
  description: "The payload has been sent and the hook resolved."
69432
69760
  });
@@ -69536,16 +69864,18 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
69536
69864
  });
69537
69865
  }
69538
69866
  if (menu.resourceType === "hook" && isRunActive && onResolveHook) {
69539
- const hook = hookLookup.get(menu.spanId);
69540
69867
  const span = spanLookup.get(menu.spanId);
69541
69868
  const hookData = (_a3 = span == null ? void 0 : span.attributes) == null ? void 0 : _a3.data;
69542
69869
  const isDisposed = Boolean(hookData == null ? void 0 : hookData.disposedAt) || Boolean((_b = span == null ? void 0 : span.events) == null ? void 0 : _b.some((e) => e.name === "hook_disposed")) || resolvedHookIds.has(menu.spanId);
69543
- if ((hook == null ? void 0 : hook.token) && !isDisposed) {
69870
+ if ((hookData == null ? void 0 : hookData.token) && !isDisposed) {
69544
69871
  items.push({
69545
69872
  label: "Resolve Hook",
69546
69873
  icon: jsxRuntimeExports.jsx(Send, { className: "h-3.5 w-3.5" }),
69547
69874
  action: () => {
69548
- setResolveHookTarget(hook);
69875
+ setResolveHookTarget({
69876
+ hookId: menu.spanId,
69877
+ token: hookData.token
69878
+ });
69549
69879
  }
69550
69880
  });
69551
69881
  }
@@ -69599,7 +69929,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
69599
69929
  onWakeUpSleep,
69600
69930
  onCancelRun,
69601
69931
  onResolveHook,
69602
- hookLookup,
69603
69932
  spanLookup,
69604
69933
  resolvedHookIds,
69605
69934
  run.runId,
@@ -69607,104 +69936,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
69607
69936
  ]);
69608
69937
  return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", ref: containerRef, children: [children2, contextMenu ? jsxRuntimeExports.jsx(SpanContextMenu, { menu: contextMenu, items: getMenuItems(contextMenu), onClose: closeMenu }) : null, jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: resolveHookTarget !== null, onClose: () => setResolveHookTarget(null), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
69609
69938
  }
69610
- const isTimerEvent = (eventType) => eventType === "wait_created" || eventType === "wait_completed";
69611
- const isHookLifecycleEvent = (eventType) => eventType === "hook_received" || eventType === "hook_created" || eventType === "hook_disposed";
69612
- const pushEvent = (map2, correlationId, event) => {
69613
- const existing = map2.get(correlationId);
69614
- if (existing) {
69615
- existing.push(event);
69616
- return;
69617
- }
69618
- map2.set(correlationId, [event]);
69619
- };
69620
- const groupEventsByCorrelation = (events2, steps, hooks) => {
69621
- const eventsByStepId = /* @__PURE__ */ new Map();
69622
- const eventsByHookId = /* @__PURE__ */ new Map();
69623
- const runLevelEvents = [];
69624
- const timerEvents = /* @__PURE__ */ new Map();
69625
- const hookEvents = /* @__PURE__ */ new Map();
69626
- const stepIds = new Set(steps.map((step) => step.stepId));
69627
- const hookIds = new Set(hooks.map((hook) => hook.hookId));
69628
- for (const event of events2) {
69629
- const correlationId = event.correlationId;
69630
- if (!correlationId) {
69631
- runLevelEvents.push(event);
69632
- continue;
69633
- }
69634
- if (isTimerEvent(event.eventType)) {
69635
- pushEvent(timerEvents, correlationId, event);
69636
- continue;
69637
- }
69638
- if (isHookLifecycleEvent(event.eventType)) {
69639
- pushEvent(hookEvents, correlationId, event);
69640
- continue;
69641
- }
69642
- if (stepIds.has(correlationId)) {
69643
- pushEvent(eventsByStepId, correlationId, event);
69644
- continue;
69645
- }
69646
- if (hookIds.has(correlationId)) {
69647
- pushEvent(eventsByHookId, correlationId, event);
69648
- continue;
69649
- }
69650
- runLevelEvents.push(event);
69651
- }
69652
- return {
69653
- eventsByStepId,
69654
- eventsByHookId,
69655
- runLevelEvents,
69656
- timerEvents,
69657
- hookEvents
69658
- };
69659
- };
69660
- const buildSpans = (run, steps, groupedEvents, now2) => {
69661
- const viewerEndTime = new Date(run.completedAt || now2);
69662
- const stepSpans = steps.map((step) => {
69663
- const stepEvents = groupedEvents.eventsByStepId.get(step.stepId) || [];
69664
- return stepToSpan(step, stepEvents, now2, viewerEndTime);
69665
- });
69666
- const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, run, now2)).filter((span) => span !== null);
69667
- const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, run, now2)).filter((span) => span !== null);
69668
- return {
69669
- runSpan: runToSpan(run, groupedEvents.runLevelEvents, now2),
69670
- spans: [...stepSpans, ...hookSpans, ...waitSpans]
69671
- };
69672
- };
69673
- const cascadeSpans = (runSpan, spans) => {
69674
- const sortedSpans = [
69675
- runSpan,
69676
- ...spans.slice().sort((a2, b2) => {
69677
- const aStart = otelTimeToMs(a2.startTime);
69678
- const bStart = otelTimeToMs(b2.startTime);
69679
- return aStart - bStart;
69680
- })
69681
- ];
69682
- return sortedSpans.map((span, index2) => {
69683
- const parentSpanId = index2 === 0 ? void 0 : String(sortedSpans[index2 - 1].spanId);
69684
- return {
69685
- ...span,
69686
- parentSpanId
69687
- };
69688
- });
69689
- };
69690
- const buildTrace = (run, steps, hooks, events2, now2) => {
69691
- const groupedEvents = groupEventsByCorrelation(events2, steps, hooks);
69692
- const { runSpan, spans } = buildSpans(run, steps, groupedEvents, now2);
69693
- const sortedCascadingSpans = cascadeSpans(runSpan, spans);
69694
- return {
69695
- traceId: run.runId,
69696
- rootSpanId: run.runId,
69697
- spans: sortedCascadingSpans,
69698
- resources: [
69699
- {
69700
- name: "workflow",
69701
- attributes: {
69702
- "service.name": WORKFLOW_LIBRARY.name
69703
- }
69704
- }
69705
- ]
69706
- };
69707
- };
69708
69939
  function SelectionBridge({ onSelectionChange }) {
69709
69940
  const { state } = useTraceViewer();
69710
69941
  const { selected: selected2 } = state;
@@ -69760,18 +69991,29 @@ function PanelResizeHandle({ onResize }) {
69760
69991
  }, [onResize]);
69761
69992
  return jsxRuntimeExports.jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-400/50 z-10", onPointerDown: handlePointerDown });
69762
69993
  }
69763
- const WorkflowTraceViewer = ({ run, steps, hooks, events: events2, isLoading, error: error2, spanDetailData, spanDetailLoading, spanDetailError, onWakeUpSleep, onResolveHook, onCancelRun, onStreamClick, onSpanSelect, onLoadEventData, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, encryptionKey }) => {
69994
+ function TraceViewerFooter({ hasMore, isLive, isInitialLoading }) {
69995
+ const style2 = { color: "var(--ds-gray-900)" };
69996
+ if (hasMore || isInitialLoading) {
69997
+ return jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-xs", style: style2, children: [jsxRuntimeExports.jsxs("svg", { className: "h-3.5 w-3.5 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [jsxRuntimeExports.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsxRuntimeExports.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })] }), "Loading more events…"] });
69998
+ }
69999
+ if (isLive) {
70000
+ return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-3 text-xs", style: style2, children: "Waiting for more events…" });
70001
+ }
70002
+ return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-3 text-xs", style: style2, children: "End of run" });
70003
+ }
70004
+ const WorkflowTraceViewer = ({ run, events: events2, isLoading, error: error2, spanDetailData, spanDetailLoading, spanDetailError, onWakeUpSleep, onResolveHook, onCancelRun, onStreamClick, onSpanSelect, onLoadEventData, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, encryptionKey, onDecrypt }) => {
69764
70005
  const [selectedSpan, setSelectedSpan] = reactExports.useState(null);
69765
70006
  const [panelWidth, setPanelWidth] = reactExports.useState(DEFAULT_PANEL_WIDTH);
69766
70007
  const [deselectTrigger, setDeselectTrigger] = reactExports.useState(0);
69767
70008
  const [selectRequest, setSelectRequest] = reactExports.useState(null);
69768
70009
  const isLive = Boolean(run && !run.completedAt);
69769
- const trace2 = reactExports.useMemo(() => {
69770
- if (!run) {
70010
+ const traceWithMeta = reactExports.useMemo(() => {
70011
+ if (!(run == null ? void 0 : run.runId)) {
69771
70012
  return void 0;
69772
70013
  }
69773
- return buildTrace(run, steps, hooks, events2, /* @__PURE__ */ new Date());
69774
- }, [run, steps, hooks, events2]);
70014
+ return buildTrace(run, events2, /* @__PURE__ */ new Date());
70015
+ }, [run, events2]);
70016
+ const trace2 = traceWithMeta;
69775
70017
  reactExports.useEffect(() => {
69776
70018
  if (error2 && !isLoading) {
69777
70019
  console.error(error2);
@@ -69856,10 +70098,10 @@ const WorkflowTraceViewer = ({ run, steps, hooks, events: events2, isLoading, er
69856
70098
  const workflowName = data.workflowName;
69857
70099
  return (stepName ? (_a3 = parseStepName(stepName)) == null ? void 0 : _a3.shortName : void 0) ?? (workflowName ? (_b = parseWorkflowName(workflowName)) == null ? void 0 : _b.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
69858
70100
  }, [selectedSpan == null ? void 0 : selectedSpan.data]);
69859
- if (isLoading || !trace2) {
70101
+ if (!trace2) {
69860
70102
  return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", children: [jsxRuntimeExports.jsx("div", { className: "border-b border-gray-alpha-400 w-full" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full ml-2 mt-1 mb-1 h-[56px]" }), jsxRuntimeExports.jsxs("div", { className: "p-2 relative w-full", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full mt-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-12 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[20%] mt-2 ml-16 h-[20px]" })] })] });
69861
70103
  }
69862
- return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run, hooks, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace: trace2 }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
70104
+ return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace: trace2, knownDurationMs: traceWithMeta == null ? void 0 : traceWithMeta.knownDurationMs, hasMoreData: hasMoreSpans || Boolean(isLoading), footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive, isInitialLoading: Boolean(isLoading) }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
69863
70105
  width: panelWidth,
69864
70106
  borderColor: "var(--ds-gray-200)",
69865
70107
  backgroundColor: "var(--ds-background-100)"
@@ -69929,7 +70171,7 @@ const WorkflowTraceViewer = ({ run, steps, hooks, events: events2, isLoading, er
69929
70171
  e.currentTarget.style.background = "var(--ds-gray-alpha-100)";
69930
70172
  }, onMouseLeave: (e) => {
69931
70173
  e.currentTarget.style.background = "transparent";
69932
- }, children: jsxRuntimeExports.jsx(X$3, { size: 16 }) }) })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load entity details", children: jsxRuntimeExports.jsx(EntityDetailPanel, { run, hooks, onStreamClick, spanDetailData: spanDetailData ?? null, spanDetailError, spanDetailLoading, onSpanSelect: handleSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, selectedSpan }) }) })] })] });
70174
+ }, children: jsxRuntimeExports.jsx(X$3, { size: 16 }) }) })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load entity details", children: jsxRuntimeExports.jsx(EntityDetailPanel, { run, onStreamClick, spanDetailData: spanDetailData ?? null, spanDetailError, spanDetailLoading, onSpanSelect: handleSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, onDecrypt, selectedSpan }) }) })] })] });
69933
70175
  };
69934
70176
  function deserializeChunkText(text2) {
69935
70177
  try {
@@ -72703,9 +72945,6 @@ async function fetchRuns$1(worldEnv, params) {
72703
72945
  async function fetchRun$1(worldEnv, runId, resolveData = "all") {
72704
72946
  return rpc("fetchRun", { worldEnv, runId, resolveData });
72705
72947
  }
72706
- async function fetchSteps$1(worldEnv, runId, params) {
72707
- return rpc("fetchSteps", { worldEnv, runId, params });
72708
- }
72709
72948
  async function fetchStep$1(worldEnv, runId, stepId, resolveData = "all") {
72710
72949
  return rpc("fetchStep", { worldEnv, runId, stepId, resolveData });
72711
72950
  }
@@ -72715,9 +72954,6 @@ async function fetchEvents$1(worldEnv, runId, params) {
72715
72954
  async function fetchEvent$1(worldEnv, runId, eventId, resolveData = "all") {
72716
72955
  return rpc("fetchEvent", { worldEnv, runId, eventId, resolveData });
72717
72956
  }
72718
- async function fetchEventsByCorrelationId$1(worldEnv, correlationId, params) {
72719
- return rpc("fetchEventsByCorrelationId", { worldEnv, correlationId, params });
72720
- }
72721
72957
  async function fetchHooks$1(worldEnv, params) {
72722
72958
  return rpc("fetchHooks", { worldEnv, params });
72723
72959
  }
@@ -73161,6 +73397,16 @@ function parseDurationToDate(param) {
73161
73397
  throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
73162
73398
  }
73163
73399
  }
73400
+ function resolveWorkflowTargetWorld(env2 = process.env) {
73401
+ const configuredWorld = env2.WORKFLOW_TARGET_WORLD;
73402
+ if (configuredWorld) {
73403
+ return configuredWorld;
73404
+ }
73405
+ return env2.VERCEL_DEPLOYMENT_ID ? "vercel" : "local";
73406
+ }
73407
+ function isVercelWorldTarget(targetWorld) {
73408
+ return targetWorld === "vercel" || targetWorld === "@workflow/world-vercel";
73409
+ }
73164
73410
  const BASE_URL = "https://useworkflow.dev/err";
73165
73411
  function isError(value) {
73166
73412
  return typeof value === "object" && value !== null && "name" in value && "message" in value;
@@ -89427,8 +89673,8 @@ function requireGetVercelOidcToken$1() {
89427
89673
  }
89428
89674
  try {
89429
89675
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
89430
- await import("./token-util-CvLiUUQD.js").then((n) => n.t),
89431
- await import("./token-CWWXwMh8.js").then((n) => n.t)
89676
+ await import("./token-util-DMDYM1rE.js").then((n) => n.t),
89677
+ await import("./token-CNug9NIq.js").then((n) => n.t)
89432
89678
  ]);
89433
89679
  if (!token || isExpired(getTokenPayload(token))) {
89434
89680
  await refreshToken();
@@ -115538,17 +115784,84 @@ const LOCAL_QUEUE_MAX_VISIBILITY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_MAX
115538
115784
  const MAX_SAFE_TIMEOUT_MS = 2147483647;
115539
115785
  const DEFAULT_CONCURRENCY_LIMIT = 1e3;
115540
115786
  const WORKFLOW_LOCAL_QUEUE_CONCURRENCY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_CONCURRENCY ?? "0", 10) || DEFAULT_CONCURRENCY_LIMIT;
115541
- function createQueue$2(config2) {
115787
+ function getQueueRoute(queueName) {
115788
+ if (queueName.startsWith("__wkf_step_")) {
115789
+ return { pathname: "step", prefix: "__wkf_step_" };
115790
+ }
115791
+ if (queueName.startsWith("__wkf_workflow_")) {
115792
+ return { pathname: "flow", prefix: "__wkf_workflow_" };
115793
+ }
115794
+ throw new Error("Unknown queue name prefix");
115795
+ }
115796
+ function createQueueExecutor(config2) {
115542
115797
  const httpAgent = new undiciExports.Agent({
115543
115798
  headersTimeout: 0,
115544
115799
  connections: 1e3,
115545
115800
  keepAliveTimeout: 3e4
115546
115801
  });
115802
+ const directHandlers = /* @__PURE__ */ new Map();
115803
+ const executeMessage = async ({ queueName, messageId, attempt, body: body2, headers: extraHeaders }) => {
115804
+ const { pathname, prefix } = getQueueRoute(queueName);
115805
+ const headers2 = {
115806
+ ...extraHeaders,
115807
+ "content-type": "application/json",
115808
+ "x-vqs-queue-name": queueName,
115809
+ "x-vqs-message-id": messageId,
115810
+ "x-vqs-message-attempt": String(attempt)
115811
+ };
115812
+ const directHandler = directHandlers.get(prefix);
115813
+ let response2;
115814
+ if (directHandler) {
115815
+ const req = new Request("http://localhost/.well-known/workflow/v1/" + pathname, {
115816
+ method: "POST",
115817
+ headers: headers2,
115818
+ body: body2
115819
+ });
115820
+ response2 = await directHandler(req);
115821
+ } else {
115822
+ const baseUrl = await resolveBaseUrl$1(config2);
115823
+ response2 = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
115824
+ method: "POST",
115825
+ duplex: "half",
115826
+ dispatcher: httpAgent,
115827
+ headers: headers2,
115828
+ body: body2
115829
+ });
115830
+ }
115831
+ const text2 = await response2.text();
115832
+ if (!response2.ok) {
115833
+ return {
115834
+ type: "error",
115835
+ status: response2.status,
115836
+ text: text2,
115837
+ headers: Object.fromEntries(response2.headers.entries())
115838
+ };
115839
+ }
115840
+ try {
115841
+ const timeoutSeconds = Number(JSON.parse(text2).timeoutSeconds);
115842
+ if (Number.isFinite(timeoutSeconds) && timeoutSeconds >= 0) {
115843
+ return { type: "reschedule", timeoutSeconds };
115844
+ }
115845
+ } catch {
115846
+ }
115847
+ return { type: "completed" };
115848
+ };
115849
+ return {
115850
+ executeMessage,
115851
+ registerHandler(prefix, handler) {
115852
+ directHandlers.set(prefix, handler);
115853
+ },
115854
+ async close() {
115855
+ await httpAgent.close();
115856
+ }
115857
+ };
115858
+ }
115859
+ function createQueue$2(config2) {
115860
+ const executor = createQueueExecutor(config2);
115547
115861
  const transport = new JsonTransport();
115548
115862
  const generateId2 = monotonicFactory();
115549
115863
  const semaphore = new libExports.Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
115550
115864
  const inflightMessages = /* @__PURE__ */ new Map();
115551
- const directHandlers = /* @__PURE__ */ new Map();
115552
115865
  const queue = async (queueName, message2, opts) => {
115553
115866
  const cleanup = [];
115554
115867
  if (opts == null ? void 0 : opts.idempotencyKey) {
@@ -115558,17 +115871,7 @@ function createQueue$2(config2) {
115558
115871
  }
115559
115872
  }
115560
115873
  const body2 = transport.serialize(message2);
115561
- let pathname;
115562
- let prefix;
115563
- if (queueName.startsWith("__wkf_step_")) {
115564
- pathname = `step`;
115565
- prefix = "__wkf_step_";
115566
- } else if (queueName.startsWith("__wkf_workflow_")) {
115567
- pathname = `flow`;
115568
- prefix = "__wkf_workflow_";
115569
- } else {
115570
- throw new Error("Unknown queue name prefix");
115571
- }
115874
+ getQueueRoute(queueName);
115572
115875
  const messageId = MessageId.parse(`msg_${generateId2()}`);
115573
115876
  if (opts == null ? void 0 : opts.idempotencyKey) {
115574
115877
  const key = opts.idempotencyKey;
@@ -115585,53 +115888,31 @@ function createQueue$2(config2) {
115585
115888
  }
115586
115889
  try {
115587
115890
  let defaultRetriesLeft = 3;
115588
- const directHandler = directHandlers.get(prefix);
115589
115891
  for (let attempt = 0; defaultRetriesLeft > 0; attempt++) {
115590
115892
  defaultRetriesLeft--;
115591
- let response2;
115592
- const headers2 = {
115593
- ...opts == null ? void 0 : opts.headers,
115594
- "content-type": "application/json",
115595
- "x-vqs-queue-name": queueName,
115596
- "x-vqs-message-id": messageId,
115597
- "x-vqs-message-attempt": String(attempt + 1)
115598
- };
115599
- if (directHandler) {
115600
- const req = new Request("http://localhost/.well-known/workflow/v1/" + pathname, {
115601
- method: "POST",
115602
- headers: headers2,
115603
- body: body2
115604
- });
115605
- response2 = await directHandler(req);
115606
- } else {
115607
- const baseUrl = await resolveBaseUrl$1(config2);
115608
- response2 = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
115609
- method: "POST",
115610
- duplex: "half",
115611
- dispatcher: httpAgent,
115612
- headers: headers2,
115613
- body: body2
115614
- });
115615
- }
115616
- if (response2.ok) {
115893
+ const result = await executor.executeMessage({
115894
+ queueName,
115895
+ messageId,
115896
+ attempt: attempt + 1,
115897
+ body: body2,
115898
+ headers: opts == null ? void 0 : opts.headers
115899
+ });
115900
+ if (result.type === "completed") {
115617
115901
  return;
115618
115902
  }
115619
- const text2 = await response2.text();
115620
- if (response2.status === 503) {
115621
- try {
115622
- const timeoutSeconds = Number(JSON.parse(text2).timeoutSeconds);
115623
- const timeoutMs = Math.min(timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
115903
+ if (result.type === "reschedule") {
115904
+ if (result.timeoutSeconds > 0) {
115905
+ const timeoutMs = Math.min(result.timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
115624
115906
  await setTimeout$1(timeoutMs);
115625
- defaultRetriesLeft++;
115626
- continue;
115627
- } catch {
115628
115907
  }
115908
+ defaultRetriesLeft++;
115909
+ continue;
115629
115910
  }
115630
115911
  console.error(`[local world] Failed to queue message`, {
115631
115912
  queueName,
115632
- text: text2,
115633
- status: response2.status,
115634
- headers: Object.fromEntries(response2.headers.entries()),
115913
+ text: result.text,
115914
+ status: result.status,
115915
+ headers: result.headers,
115635
115916
  body: body2.toString()
115636
115917
  });
115637
115918
  }
@@ -115678,7 +115959,7 @@ function createQueue$2(config2) {
115678
115959
  timeoutSeconds = Math.min(result.timeoutSeconds, LOCAL_QUEUE_MAX_VISIBILITY);
115679
115960
  }
115680
115961
  if (timeoutSeconds != null) {
115681
- return Response.json({ timeoutSeconds }, { status: 503 });
115962
+ return Response.json({ timeoutSeconds });
115682
115963
  }
115683
115964
  return Response.json({ ok: true });
115684
115965
  } catch (error2) {
@@ -115694,11 +115975,9 @@ function createQueue$2(config2) {
115694
115975
  queue,
115695
115976
  createQueueHandler,
115696
115977
  getDeploymentId,
115697
- registerHandler(prefix, handler) {
115698
- directHandlers.set(prefix, handler);
115699
- },
115978
+ registerHandler: executor.registerHandler,
115700
115979
  async close() {
115701
- await httpAgent.close();
115980
+ await executor.close();
115702
115981
  }
115703
115982
  };
115704
115983
  }
@@ -117129,8 +117408,8 @@ function requireGetVercelOidcToken() {
117129
117408
  }
117130
117409
  try {
117131
117410
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
117132
- await import("./token-util-l0RNhdPG.js").then((n) => n.t),
117133
- await import("./token-DJXheGCg.js").then((n) => n.t)
117411
+ await import("./token-util-_HYGsI73.js").then((n) => n.t),
117412
+ await import("./token-DLqvw7I2.js").then((n) => n.t)
117134
117413
  ]);
117135
117414
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
117136
117415
  await refreshToken(options);
@@ -117749,11 +118028,17 @@ async function fetchRunKey(deploymentId, projectId, runId, options) {
117749
118028
  headers: {
117750
118029
  authorization: `Bearer ${token}`
117751
118030
  },
118031
+ // @ts-expect-error -- undici dispatcher is accepted by Node.js fetch but not in @types/node's RequestInit
117752
118032
  dispatcher: getDispatcher()
117753
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici v7 dispatcher types don't match @types/node's RequestInit
117754
118033
  });
117755
118034
  if (!response2.ok) {
117756
- throw new Error(`Failed to fetch run key for ${runId} (deployment ${deploymentId}): HTTP ${response2.status}`);
118035
+ let body2;
118036
+ try {
118037
+ body2 = await response2.text();
118038
+ } catch {
118039
+ body2 = "<unable to read response body>";
118040
+ }
118041
+ throw new Error(`Failed to fetch run key for ${runId} (deployment ${deploymentId}): HTTP ${response2.status} ${response2.statusText}${body2 ? ` — ${body2}` : ""}`);
117757
118042
  }
117758
118043
  const data = await response2.json();
117759
118044
  const result = object$1({ key: string$1().nullable() }).safeParse(data);
@@ -117768,7 +118053,7 @@ async function fetchRunKey(deploymentId, projectId, runId, options) {
117768
118053
  function createGetEncryptionKeyForRun(projectId, teamId, token) {
117769
118054
  if (!projectId)
117770
118055
  return void 0;
117771
- const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
118056
+ const isServerlessRuntime = process.env.VERCEL === "1";
117772
118057
  let localDeploymentKey;
117773
118058
  function getLocalDeploymentKey() {
117774
118059
  if (localDeploymentKey)
@@ -117782,12 +118067,16 @@ function createGetEncryptionKeyForRun(projectId, teamId, token) {
117782
118067
  return async function getEncryptionKeyForRun2(run, context) {
117783
118068
  const runId = typeof run === "string" ? run : run.runId;
117784
118069
  const deploymentId = typeof run === "string" ? context == null ? void 0 : context.deploymentId : run.deploymentId;
117785
- if (!deploymentId || deploymentId === currentDeploymentId) {
117786
- const localKey = getLocalDeploymentKey();
117787
- if (!localKey)
117788
- return void 0;
117789
- return deriveRunKey(localKey, projectId, runId);
118070
+ if (isServerlessRuntime) {
118071
+ if (!deploymentId || deploymentId === process.env.VERCEL_DEPLOYMENT_ID) {
118072
+ const localKey = getLocalDeploymentKey();
118073
+ if (!localKey)
118074
+ return void 0;
118075
+ return deriveRunKey(localKey, projectId, runId);
118076
+ }
117790
118077
  }
118078
+ if (!deploymentId)
118079
+ return void 0;
117791
118080
  return fetchRunKey(deploymentId, projectId, runId, { token, teamId });
117792
118081
  };
117793
118082
  }
@@ -117849,7 +118138,7 @@ const PeerService = SemanticConvention("peer.service");
117849
118138
  const RpcSystem = SemanticConvention("rpc.system");
117850
118139
  const RpcService = SemanticConvention("rpc.service");
117851
118140
  const RpcMethod = SemanticConvention("rpc.method");
117852
- const version$1 = "4.1.0-beta.41";
118141
+ const version$1 = "4.1.0-beta.43";
117853
118142
  const DEFAULT_RESOLVE_DATA_OPTION = "all";
117854
118143
  function deserializeError(obj) {
117855
118144
  const { error: error2, ...rest } = obj;
@@ -118162,6 +118451,46 @@ function createQueue$1(config2) {
118162
118451
  };
118163
118452
  return { queue, createQueueHandler, getDeploymentId };
118164
118453
  }
118454
+ const ResolveLatestDeploymentResponseSchema = object$1({
118455
+ id: string$1()
118456
+ });
118457
+ function createResolveLatestDeploymentId(config2) {
118458
+ return async function resolveLatestDeploymentId() {
118459
+ const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
118460
+ if (!currentDeploymentId) {
118461
+ throw new Error("Cannot resolve latest deployment: VERCEL_DEPLOYMENT_ID environment variable is not set");
118462
+ }
118463
+ const oidcToken = await distExports.getVercelOidcToken().catch(() => null);
118464
+ const token = (config2 == null ? void 0 : config2.token) ?? oidcToken ?? process.env.VERCEL_TOKEN;
118465
+ if (!token) {
118466
+ throw new Error("Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available");
118467
+ }
118468
+ const url2 = `https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(currentDeploymentId)}`;
118469
+ const response2 = await fetch(url2, {
118470
+ method: "GET",
118471
+ headers: {
118472
+ authorization: `Bearer ${token}`
118473
+ },
118474
+ // @ts-expect-error -- undici dispatcher is accepted by Node.js fetch but not in @types/node's RequestInit
118475
+ dispatcher: getDispatcher()
118476
+ });
118477
+ if (!response2.ok) {
118478
+ let body2;
118479
+ try {
118480
+ body2 = await response2.text();
118481
+ } catch {
118482
+ body2 = "<unable to read response body>";
118483
+ }
118484
+ throw new Error(`Failed to resolve latest deployment for ${currentDeploymentId}: HTTP ${response2.status} ${response2.statusText}${body2 ? ` — ${body2}` : ""}`);
118485
+ }
118486
+ const data = await response2.json();
118487
+ const result = ResolveLatestDeploymentResponseSchema.safeParse(data);
118488
+ if (!result.success) {
118489
+ throw new Error(`Invalid response from Vercel API: expected { id: string }. Zod error: ${result.error.message}`);
118490
+ }
118491
+ return result.data.id;
118492
+ };
118493
+ }
118165
118494
  function isRefDescriptor(value) {
118166
118495
  return typeof value === "object" && value !== null && "_type" in value && "_ref" in value && typeof value._ref === "string" && value._type === "RemoteRef";
118167
118496
  }
@@ -118319,7 +118648,7 @@ async function getWorkflowRun(id2, params, config2) {
118319
118648
  const searchParams = new URLSearchParams();
118320
118649
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118321
118650
  const queryString = searchParams.toString();
118322
- const endpoint = `/v2/runs/${id2}${queryString ? `?${queryString}` : ""}`;
118651
+ const endpoint = `/v2/runs/${encodeURIComponent(id2)}${queryString ? `?${queryString}` : ""}`;
118323
118652
  try {
118324
118653
  const run = await makeRequest({
118325
118654
  endpoint,
@@ -118341,7 +118670,7 @@ async function cancelWorkflowRunV1(id2, params, config2) {
118341
118670
  const searchParams = new URLSearchParams();
118342
118671
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118343
118672
  const queryString = searchParams.toString();
118344
- const endpoint = `/v1/runs/${id2}/cancel${queryString ? `?${queryString}` : ""}`;
118673
+ const endpoint = `/v1/runs/${encodeURIComponent(id2)}/cancel${queryString ? `?${queryString}` : ""}`;
118345
118674
  try {
118346
118675
  const run = await makeRequest({
118347
118676
  endpoint,
@@ -118440,7 +118769,7 @@ async function listWorkflowRunSteps(params, config2) {
118440
118769
  const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
118441
118770
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118442
118771
  const queryString = searchParams.toString();
118443
- const endpoint = `/v2/runs/${runId}/steps${queryString ? `?${queryString}` : ""}`;
118772
+ const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps${queryString ? `?${queryString}` : ""}`;
118444
118773
  const response2 = await makeRequest({
118445
118774
  endpoint,
118446
118775
  options: { method: "GET" },
@@ -118458,7 +118787,7 @@ async function getStep(runId, stepId, params, config2) {
118458
118787
  const searchParams = new URLSearchParams();
118459
118788
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118460
118789
  const queryString = searchParams.toString();
118461
- const endpoint = runId ? `/v2/runs/${runId}/steps/${stepId}${queryString ? `?${queryString}` : ""}` : `/v2/steps/${stepId}${queryString ? `?${queryString}` : ""}`;
118790
+ const endpoint = runId ? `/v2/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}${queryString ? `?${queryString}` : ""}` : `/v2/steps/${encodeURIComponent(stepId)}${queryString ? `?${queryString}` : ""}`;
118462
118791
  const step = await makeRequest({
118463
118792
  endpoint,
118464
118793
  options: { method: "GET" },
@@ -118595,7 +118924,7 @@ async function getEvent(runId, eventId, params, config2) {
118595
118924
  const searchParams = new URLSearchParams();
118596
118925
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118597
118926
  const queryString = searchParams.toString();
118598
- const endpoint = `/v2/runs/${runId}/events/${eventId}${queryString ? `?${queryString}` : ""}`;
118927
+ const endpoint = `/v2/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}${queryString ? `?${queryString}` : ""}`;
118599
118928
  const event = await makeRequest({
118600
118929
  endpoint,
118601
118930
  options: { method: "GET" },
@@ -118628,7 +118957,7 @@ async function getWorkflowRunEvents(params, config2) {
118628
118957
  searchParams.set("remoteRefBehavior", "lazy");
118629
118958
  const queryString = searchParams.toString();
118630
118959
  const query = queryString ? `?${queryString}` : "";
118631
- const endpoint = correlationId ? `/v2/events${query}` : `/v2/runs/${runId}/events${query}`;
118960
+ const endpoint = correlationId ? `/v2/events${query}` : `/v2/runs/${encodeURIComponent(runId)}/events${query}`;
118632
118961
  let refResolveConcurrency;
118633
118962
  const response2 = await makeRequest({
118634
118963
  endpoint,
@@ -118679,7 +119008,7 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
118679
119008
  return { run };
118680
119009
  }
118681
119010
  const wireResult2 = await makeRequest({
118682
- endpoint: `/v1/runs/${id2}/events`,
119011
+ endpoint: `/v1/runs/${encodeURIComponent(id2)}/events`,
118683
119012
  options: { method: "POST" },
118684
119013
  data,
118685
119014
  config: config2,
@@ -118693,7 +119022,7 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
118693
119022
  throw new WorkflowAPIError(validationError, { status: 400 });
118694
119023
  }
118695
119024
  }
118696
- const runIdPath = id2 === null ? "null" : id2;
119025
+ const runIdPath = id2 === null ? "null" : encodeURIComponent(id2);
118697
119026
  const remoteRefBehavior = eventsNeedingResolve.has(data.eventType) ? "resolve" : "lazy";
118698
119027
  if (remoteRefBehavior === "resolve") {
118699
119028
  const wireResult2 = await makeRequest({
@@ -118764,7 +119093,7 @@ async function listHooks(params, config2) {
118764
119093
  }
118765
119094
  async function getHook(hookId, params, config2) {
118766
119095
  const resolveData = (params == null ? void 0 : params.resolveData) || "all";
118767
- const endpoint = `/v2/hooks/${hookId}`;
119096
+ const endpoint = `/v2/hooks/${encodeURIComponent(hookId)}`;
118768
119097
  const hook = await makeRequest({
118769
119098
  endpoint,
118770
119099
  options: { method: "GET" },
@@ -118866,7 +119195,7 @@ function createStorage(config2) {
118866
119195
  }
118867
119196
  function getStreamUrl(name2, runId, httpConfig) {
118868
119197
  if (runId) {
118869
- return new URL(`${httpConfig.baseUrl}/v2/runs/${runId}/stream/${encodeURIComponent(name2)}`);
119198
+ return new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/stream/${encodeURIComponent(name2)}`);
118870
119199
  }
118871
119200
  return new URL(`${httpConfig.baseUrl}/v2/stream/${encodeURIComponent(name2)}`);
118872
119201
  }
@@ -118945,7 +119274,7 @@ function createStreamer(config2) {
118945
119274
  },
118946
119275
  async listStreamsByRunId(runId) {
118947
119276
  const httpConfig = await getHttpConfig(config2);
118948
- const url2 = new URL(`${httpConfig.baseUrl}/v2/runs/${runId}/streams`);
119277
+ const url2 = new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/streams`);
118949
119278
  const response2 = await fetch(url2, {
118950
119279
  headers: httpConfig.headers
118951
119280
  });
@@ -118963,33 +119292,27 @@ function createVercelWorld(config2) {
118963
119292
  ...createQueue$1(config2),
118964
119293
  ...createStorage(config2),
118965
119294
  ...createStreamer(config2),
118966
- getEncryptionKeyForRun: createGetEncryptionKeyForRun(projectId, (_b = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _b.teamId, config2 == null ? void 0 : config2.token)
119295
+ getEncryptionKeyForRun: createGetEncryptionKeyForRun(projectId, (_b = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _b.teamId, config2 == null ? void 0 : config2.token),
119296
+ resolveLatestDeploymentId: createResolveLatestDeploymentId(config2)
118967
119297
  };
118968
119298
  }
118969
119299
  const require$1 = createRequire$1(join$1(process.cwd(), "index.js"));
118970
119300
  const WorldCache = Symbol.for("@workflow/world//cache");
118971
119301
  const StubbedWorldCache = Symbol.for("@workflow/world//stubbedCache");
118972
119302
  const globalSymbols = globalThis;
118973
- function defaultWorld() {
118974
- if (process.env.VERCEL_DEPLOYMENT_ID) {
118975
- return "vercel";
118976
- }
118977
- return "local";
118978
- }
118979
119303
  const createWorld = () => {
118980
- const targetWorld = process.env.WORKFLOW_TARGET_WORLD || defaultWorld();
118981
- if (targetWorld === "vercel") {
118982
- return createVercelWorld({
118983
- token: process.env.WORKFLOW_VERCEL_AUTH_TOKEN,
118984
- projectConfig: {
118985
- environment: process.env.WORKFLOW_VERCEL_ENV,
118986
- projectId: process.env.WORKFLOW_VERCEL_PROJECT,
118987
- // real ID (prj_xxx)
118988
- projectName: process.env.WORKFLOW_VERCEL_PROJECT_NAME,
118989
- // slug (my-app)
118990
- teamId: process.env.WORKFLOW_VERCEL_TEAM
118991
- }
118992
- });
119304
+ const targetWorld = resolveWorkflowTargetWorld();
119305
+ if (isVercelWorldTarget(targetWorld)) {
119306
+ const staleEnvVars = [
119307
+ "WORKFLOW_VERCEL_PROJECT",
119308
+ "WORKFLOW_VERCEL_TEAM",
119309
+ "WORKFLOW_VERCEL_AUTH_TOKEN",
119310
+ "WORKFLOW_VERCEL_ENV"
119311
+ ].filter((key) => process.env[key]);
119312
+ if (staleEnvVars.length > 0) {
119313
+ console.warn(`[workflow] Warning: ${staleEnvVars.join(", ")} env var(s) are set but have no effect at runtime. These are only used by the Workflow CLI. Remove them from your Vercel project environment variables.`);
119314
+ }
119315
+ return createVercelWorld();
118993
119316
  }
118994
119317
  if (targetWorld === "local") {
118995
119318
  return createLocalWorld({
@@ -122211,7 +122534,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
122211
122534
  });
122212
122535
  });
122213
122536
  }
122214
- const version = "4.2.0-beta.67";
122537
+ const version = "4.2.0-beta.69";
122215
122538
  const ulid = monotonicFactory();
122216
122539
  async function start$1(workflow, argsOrOptions, options) {
122217
122540
  return await waitedUntil(() => {
@@ -122236,13 +122559,22 @@ async function start$1(workflow, argsOrOptions, options) {
122236
122559
  ...WorkflowArgumentsCount(args.length)
122237
122560
  });
122238
122561
  const world = (opts == null ? void 0 : opts.world) ?? getWorld();
122239
- const deploymentId = opts.deploymentId ?? await world.getDeploymentId();
122562
+ let deploymentId = opts.deploymentId ?? await world.getDeploymentId();
122563
+ if (deploymentId === "latest") {
122564
+ if (!world.resolveLatestDeploymentId) {
122565
+ throw new WorkflowRuntimeError("deploymentId 'latest' requires a World that implements resolveLatestDeploymentId()");
122566
+ }
122567
+ deploymentId = await world.resolveLatestDeploymentId();
122568
+ }
122240
122569
  const ops = [];
122241
122570
  const runId = `wrun_${ulid()}`;
122242
122571
  const traceCarrier = await serializeTraceCarrier();
122243
122572
  const specVersion = opts.specVersion ?? SPEC_VERSION_CURRENT;
122244
122573
  const v1Compat = isLegacySpecVersion(specVersion);
122245
- const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, runId, { ...opts }));
122574
+ const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, runId, {
122575
+ ...opts,
122576
+ deploymentId
122577
+ }));
122246
122578
  const encryptionKey = rawKey ? await importKey(rawKey) : void 0;
122247
122579
  const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat);
122248
122580
  const result = await world.events.create(runId, {
@@ -122449,6 +122781,17 @@ class Run {
122449
122781
  specVersion: SPEC_VERSION_CURRENT
122450
122782
  });
122451
122783
  }
122784
+ /**
122785
+ * Whether the workflow run exists.
122786
+ */
122787
+ get exists() {
122788
+ return this.world.runs.get(this.runId, { resolveData: "none" }).then(() => true).catch((error2) => {
122789
+ if (WorkflowRunNotFoundError.is(error2)) {
122790
+ return false;
122791
+ }
122792
+ throw error2;
122793
+ });
122794
+ }
122452
122795
  /**
122453
122796
  * The status of the workflow run.
122454
122797
  */
@@ -123506,31 +123849,6 @@ async function fetchEvent(worldEnv, runId, eventId, resolveData = "all") {
123506
123849
  });
123507
123850
  }
123508
123851
  }
123509
- async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
123510
- const { cursor, sortOrder = "asc", limit = 1e3, withData = false } = params;
123511
- try {
123512
- const world = await getWorldFromEnv(worldEnv);
123513
- const result = await world.events.listByCorrelationId({
123514
- correlationId,
123515
- pagination: { cursor, limit, sortOrder },
123516
- resolveData: withData ? "all" : "none"
123517
- });
123518
- return createResponse({
123519
- data: result.data,
123520
- cursor: result.cursor ?? void 0,
123521
- hasMore: result.hasMore
123522
- });
123523
- } catch (error2) {
123524
- return createServerActionError(
123525
- error2,
123526
- "world.events.listByCorrelationId",
123527
- {
123528
- correlationId,
123529
- ...params
123530
- }
123531
- );
123532
- }
123533
- }
123534
123852
  async function fetchHooks(worldEnv, params) {
123535
123853
  const { runId, cursor, sortOrder = "desc", limit = 10 } = params;
123536
123854
  try {
@@ -129521,57 +129839,72 @@ function useWorkflowResourceData(env2, resource, resourceId, options = {}) {
129521
129839
  }
129522
129840
  setData(null);
129523
129841
  setError(null);
129842
+ setLoading(true);
129524
129843
  if (resource === "hook") {
129525
- const { error: error22, result } = await unwrapServerActionResult(
129526
- fetchHook$1(env2, resourceId, "all")
129527
- );
129528
- if (error22) {
129529
- setError(error22);
129530
- return;
129531
- }
129532
129844
  try {
129533
- setData(await hydrate(result));
129534
- } catch (hydrateError) {
129535
- setError(
129536
- hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
129845
+ const { error: error22, result } = await unwrapServerActionResult(
129846
+ fetchHook$1(env2, resourceId, "all")
129537
129847
  );
129848
+ if (error22) {
129849
+ setError(error22);
129850
+ return;
129851
+ }
129852
+ try {
129853
+ setData(await hydrate(result));
129854
+ } catch (hydrateError) {
129855
+ setError(
129856
+ hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
129857
+ );
129858
+ }
129859
+ } finally {
129860
+ setLoading(false);
129538
129861
  }
129539
129862
  return;
129540
129863
  }
129541
129864
  if (resource === "sleep") {
129542
- const { error: error22, result } = await unwrapServerActionResult(
129543
- fetchEventsByCorrelationId$1(env2, resourceId, {
129544
- sortOrder: "asc",
129545
- limit: 100,
129546
- withData: true
129547
- })
129548
- );
129549
- if (error22) {
129550
- setError(error22);
129551
- return;
129552
- }
129553
129865
  try {
129554
- const events2 = await Promise.all(
129555
- result.data.map(hydrate)
129866
+ if (!runId) {
129867
+ setError(new Error("runId is required for loading sleep details"));
129868
+ return;
129869
+ }
129870
+ const { error: error22, result } = await unwrapServerActionResult(
129871
+ fetchEvents$1(env2, runId, {
129872
+ sortOrder: "asc",
129873
+ limit: 1e3,
129874
+ withData: true
129875
+ })
129556
129876
  );
129557
- const data2 = waitEventsToWaitEntity(events2);
129558
- if (data2 === null) {
129877
+ if (error22) {
129878
+ setError(error22);
129879
+ return;
129880
+ }
129881
+ try {
129882
+ const allEvents = result.data.map(
129883
+ hydrateResourceIO
129884
+ );
129885
+ const waitEvents = await Promise.all(
129886
+ allEvents.filter((e) => e.correlationId === resourceId).map(hydrate)
129887
+ );
129888
+ const data2 = waitEventsToWaitEntity(waitEvents);
129889
+ if (data2 === null) {
129890
+ setError(
129891
+ new Error(
129892
+ `Failed to load ${resource} details: missing required event data`
129893
+ )
129894
+ );
129895
+ return;
129896
+ }
129897
+ setData(data2);
129898
+ } catch (hydrateError) {
129559
129899
  setError(
129560
- new Error(
129561
- `Failed to load ${resource} details: missing required event data`
129562
- )
129900
+ hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
129563
129901
  );
129564
- return;
129565
129902
  }
129566
- setData(data2);
129567
- } catch (hydrateError) {
129568
- setError(
129569
- hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
129570
- );
129903
+ } finally {
129904
+ setLoading(false);
129571
129905
  }
129572
129906
  return;
129573
129907
  }
129574
- setLoading(true);
129575
129908
  try {
129576
129909
  const { data: resourceData } = await fetchResourceWithCorrelationId(
129577
129910
  env2,
@@ -129608,7 +129941,6 @@ function useWorkflowResourceData(env2, resource, resourceId, options = {}) {
129608
129941
  refresh: fetchData
129609
129942
  };
129610
129943
  }
129611
- const MAX_ITEMS = 1e3;
129612
129944
  function mergeById(prev, next2, idKey) {
129613
129945
  const combined = [...prev, ...next2];
129614
129946
  const uniqueById = new Map(
@@ -129642,89 +129974,35 @@ async function pollResource(opts) {
129642
129974
  }
129643
129975
  return false;
129644
129976
  }
129645
- const LIVE_POLL_LIMIT = 10;
129646
- const TRACE_VIEWER_BATCH_SIZE = 50;
129647
- const LIVE_STEP_UPDATE_INTERVAL_MS = 2e3;
129977
+ const LIVE_POLL_LIMIT = 100;
129978
+ const INITIAL_PAGE_SIZE = 500;
129979
+ const LOAD_MORE_PAGE_SIZE = 100;
129648
129980
  const LIVE_UPDATE_INTERVAL_MS = 5e3;
129649
- async function fetchAllEventsForCorrelationId(env2, correlationId) {
129650
- let eventsData = [];
129651
- let cursor;
129652
- while (true) {
129653
- const { error: error2, result } = await unwrapServerActionResult(
129654
- fetchEventsByCorrelationId$1(env2, correlationId, {
129655
- cursor,
129656
- sortOrder: "asc",
129657
- limit: 1e3
129658
- })
129659
- );
129660
- if (error2) {
129661
- break;
129662
- }
129663
- eventsData = [...eventsData, ...result.data];
129664
- if (!result.hasMore || !result.cursor || eventsData.length >= MAX_ITEMS) {
129665
- break;
129666
- }
129667
- cursor = result.cursor;
129668
- }
129669
- return eventsData;
129670
- }
129671
- async function fetchEventsForCorrelationIds(env2, correlationIds) {
129672
- if (correlationIds.length === 0) {
129673
- return [];
129674
- }
129675
- const results = await Promise.all(
129676
- correlationIds.map(
129677
- (correlationId) => fetchAllEventsForCorrelationId(env2, correlationId)
129678
- )
129679
- );
129680
- return results.flat();
129681
- }
129682
129981
  function useWorkflowTraceViewerData(env2, runId, options = {}) {
129683
129982
  const { live = false } = options;
129684
129983
  const [run, setRun] = reactExports.useState(null);
129685
- const [steps, setSteps] = reactExports.useState([]);
129686
- const [hooks, setHooks] = reactExports.useState([]);
129687
129984
  const [events2, setEvents] = reactExports.useState([]);
129688
129985
  const [loading, setLoading] = reactExports.useState(true);
129689
- const [auxiliaryDataLoading, setAuxiliaryDataLoading] = reactExports.useState(false);
129690
129986
  const [error2, setError] = reactExports.useState(null);
129691
- const [stepsCursor, setStepsCursor] = reactExports.useState();
129692
- const [hooksCursor, setHooksCursor] = reactExports.useState();
129693
129987
  const [eventsCursor, setEventsCursor] = reactExports.useState();
129694
- const [stepsHasMore, setStepsHasMore] = reactExports.useState(false);
129695
- const [hooksHasMore, setHooksHasMore] = reactExports.useState(false);
129696
129988
  const [eventsHasMore, setEventsHasMore] = reactExports.useState(false);
129697
129989
  const [isLoadingMoreTraceData, setIsLoadingMoreTraceData] = reactExports.useState(false);
129698
129990
  const isFetchingRef = reactExports.useRef(false);
129699
129991
  const [initialLoadCompleted, setInitialLoadCompleted] = reactExports.useState(false);
129700
129992
  const fetchAllData = reactExports.useCallback(async () => {
129701
- var _a3;
129702
129993
  if (isFetchingRef.current) {
129703
129994
  return;
129704
129995
  }
129705
129996
  isFetchingRef.current = true;
129706
129997
  setLoading(true);
129707
- setAuxiliaryDataLoading(true);
129708
129998
  setError(null);
129709
- const [runResult, stepsResult, hooksResult, eventsResult] = await Promise.all([
129999
+ const [runResult, eventsResult] = await Promise.all([
129710
130000
  unwrapServerActionResult(fetchRun$1(env2, runId, "none")),
129711
- unwrapServerActionResult(
129712
- fetchSteps$1(env2, runId, {
129713
- sortOrder: "asc",
129714
- limit: TRACE_VIEWER_BATCH_SIZE
129715
- })
129716
- ),
129717
- unwrapServerActionResult(
129718
- fetchHooks$1(env2, {
129719
- runId,
129720
- sortOrder: "asc",
129721
- limit: TRACE_VIEWER_BATCH_SIZE
129722
- })
129723
- ),
129724
130001
  unwrapServerActionResult(
129725
130002
  fetchEvents$1(env2, runId, {
129726
130003
  sortOrder: "asc",
129727
- limit: TRACE_VIEWER_BATCH_SIZE
130004
+ limit: INITIAL_PAGE_SIZE,
130005
+ withData: true
129728
130006
  })
129729
130007
  )
129730
130008
  ]);
@@ -129733,133 +130011,45 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129733
130011
  } else {
129734
130012
  setRun(hydrateResourceIO(runResult.result));
129735
130013
  }
129736
- const nextSteps = stepsResult.error ? [] : stepsResult.result.data.map(hydrateResourceIO);
129737
- const nextHooks = hooksResult.error ? [] : hooksResult.result.data.map(hydrateResourceIO);
129738
130014
  const initialEvents = eventsResult.error ? [] : eventsResult.result.data.map(hydrateResourceIO);
129739
- const correlationIds = [
129740
- ...nextSteps.map((step) => step.stepId),
129741
- ...nextHooks.map((hook) => hook.hookId)
129742
- ];
129743
- const correlationEventsRaw = await fetchEventsForCorrelationIds(
129744
- env2,
129745
- correlationIds
129746
- );
129747
- const correlationEvents = correlationEventsRaw.map(hydrateResourceIO);
129748
- setSteps(nextSteps);
129749
- setHooks(nextHooks);
129750
- setEvents(
129751
- mergeById([], [...initialEvents, ...correlationEvents], "eventId")
129752
- );
129753
- setStepsCursor(
129754
- stepsResult.error || !stepsResult.result.hasMore ? void 0 : stepsResult.result.cursor
129755
- );
129756
- setHooksCursor(
129757
- hooksResult.error || !hooksResult.result.hasMore ? void 0 : hooksResult.result.cursor
129758
- );
130015
+ setEvents(mergeById([], initialEvents, "eventId"));
129759
130016
  setEventsCursor(
129760
130017
  eventsResult.error || !eventsResult.result.hasMore ? void 0 : eventsResult.result.cursor
129761
130018
  );
129762
- setStepsHasMore(Boolean(!stepsResult.error && stepsResult.result.hasMore));
129763
- setHooksHasMore(Boolean(!hooksResult.error && hooksResult.result.hasMore));
129764
130019
  setEventsHasMore(
129765
130020
  Boolean(!eventsResult.error && eventsResult.result.hasMore)
129766
130021
  );
129767
- const settledResults = [runResult, stepsResult, hooksResult, eventsResult];
129768
130022
  setLoading(false);
129769
- setAuxiliaryDataLoading(false);
129770
130023
  setInitialLoadCompleted(true);
129771
130024
  isFetchingRef.current = false;
129772
- if (!runResult.error) {
129773
- const firstError = (_a3 = settledResults.find((result) => result.error)) == null ? void 0 : _a3.error;
129774
- if (firstError) {
129775
- setError(firstError);
129776
- }
130025
+ if (!runResult.error && eventsResult.error) {
130026
+ setError(eventsResult.error);
129777
130027
  }
129778
130028
  }, [env2, runId]);
129779
130029
  const loadMoreTraceData = reactExports.useCallback(async () => {
129780
- var _a3, _b, _c, _d, _e2, _f;
129781
- if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData) {
129782
- return;
129783
- }
129784
- if (!stepsHasMore && !hooksHasMore && !eventsHasMore) {
130030
+ if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData || !eventsHasMore) {
129785
130031
  return;
129786
130032
  }
129787
130033
  setIsLoadingMoreTraceData(true);
129788
130034
  try {
129789
- const [nextStepsResult, nextHooksResult, nextEventsResult] = await Promise.all([
129790
- stepsHasMore ? unwrapServerActionResult(
129791
- fetchSteps$1(env2, runId, {
129792
- cursor: stepsCursor,
129793
- sortOrder: "asc",
129794
- limit: TRACE_VIEWER_BATCH_SIZE
129795
- })
129796
- ) : Promise.resolve({ error: null, result: null }),
129797
- hooksHasMore ? unwrapServerActionResult(
129798
- fetchHooks$1(env2, {
129799
- runId,
129800
- cursor: hooksCursor,
129801
- sortOrder: "asc",
129802
- limit: TRACE_VIEWER_BATCH_SIZE
129803
- })
129804
- ) : Promise.resolve({ error: null, result: null }),
129805
- eventsHasMore ? unwrapServerActionResult(
129806
- fetchEvents$1(env2, runId, {
129807
- cursor: eventsCursor,
129808
- sortOrder: "asc",
129809
- limit: TRACE_VIEWER_BATCH_SIZE
129810
- })
129811
- ) : Promise.resolve({ error: null, result: null })
129812
- ]);
129813
- if (nextStepsResult.error) {
129814
- setError(nextStepsResult.error);
129815
- }
129816
- if (nextHooksResult.error) {
129817
- setError(nextHooksResult.error);
129818
- }
130035
+ const nextEventsResult = await unwrapServerActionResult(
130036
+ fetchEvents$1(env2, runId, {
130037
+ cursor: eventsCursor,
130038
+ sortOrder: "asc",
130039
+ limit: LOAD_MORE_PAGE_SIZE,
130040
+ withData: true
130041
+ })
130042
+ );
129819
130043
  if (nextEventsResult.error) {
129820
130044
  setError(nextEventsResult.error);
129821
- }
129822
- const nextSteps = ((_a3 = nextStepsResult.result) == null ? void 0 : _a3.data.map(hydrateResourceIO)) ?? [];
129823
- const nextHooks = ((_b = nextHooksResult.result) == null ? void 0 : _b.data.map(hydrateResourceIO)) ?? [];
129824
- const nextEvents = ((_c = nextEventsResult.result) == null ? void 0 : _c.data.map(hydrateResourceIO)) ?? [];
129825
- if (nextSteps.length > 0) {
129826
- setSteps((prev) => mergeById(prev, nextSteps, "stepId"));
129827
- }
129828
- if (nextHooks.length > 0) {
129829
- setHooks((prev) => mergeById(prev, nextHooks, "hookId"));
129830
- }
129831
- const newCorrelationIds = [
129832
- ...nextSteps.map((step) => step.stepId),
129833
- ...nextHooks.map((hook) => hook.hookId)
129834
- ];
129835
- const correlationEventsRaw = await fetchEventsForCorrelationIds(
129836
- env2,
129837
- newCorrelationIds
129838
- );
129839
- const correlationEvents = correlationEventsRaw.map(hydrateResourceIO);
129840
- const allNewEvents = [...nextEvents, ...correlationEvents];
129841
- if (allNewEvents.length > 0) {
129842
- setEvents((prev) => mergeById(prev, allNewEvents, "eventId"));
129843
- }
129844
- const nextStepsHasMore = nextStepsResult.error ? stepsHasMore : Boolean(nextStepsResult.result && nextStepsResult.result.hasMore);
129845
- const nextHooksHasMore = nextHooksResult.error ? hooksHasMore : Boolean(nextHooksResult.result && nextHooksResult.result.hasMore);
129846
- const nextEventsHasMore = nextEventsResult.error ? eventsHasMore : Boolean(nextEventsResult.result && nextEventsResult.result.hasMore);
129847
- setStepsHasMore(nextStepsHasMore);
129848
- setHooksHasMore(nextHooksHasMore);
129849
- setEventsHasMore(nextEventsHasMore);
129850
- if (!nextStepsResult.error) {
129851
- setStepsCursor(
129852
- ((_d = nextStepsResult.result) == null ? void 0 : _d.hasMore) ? nextStepsResult.result.cursor : void 0
129853
- );
129854
- }
129855
- if (!nextHooksResult.error) {
129856
- setHooksCursor(
129857
- ((_e2 = nextHooksResult.result) == null ? void 0 : _e2.hasMore) ? nextHooksResult.result.cursor : void 0
129858
- );
129859
- }
129860
- if (!nextEventsResult.error) {
130045
+ } else {
130046
+ const nextEvents = nextEventsResult.result.data.map(hydrateResourceIO);
130047
+ if (nextEvents.length > 0) {
130048
+ setEvents((prev) => mergeById(prev, nextEvents, "eventId"));
130049
+ }
130050
+ setEventsHasMore(Boolean(nextEventsResult.result.hasMore));
129861
130051
  setEventsCursor(
129862
- ((_f = nextEventsResult.result) == null ? void 0 : _f.hasMore) ? nextEventsResult.result.cursor : void 0
130052
+ nextEventsResult.result.hasMore ? nextEventsResult.result.cursor : void 0
129863
130053
  );
129864
130054
  }
129865
130055
  } finally {
@@ -129870,11 +130060,7 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129870
130060
  runId,
129871
130061
  initialLoadCompleted,
129872
130062
  isLoadingMoreTraceData,
129873
- stepsHasMore,
129874
- hooksHasMore,
129875
130063
  eventsHasMore,
129876
- stepsCursor,
129877
- hooksCursor,
129878
130064
  eventsCursor
129879
130065
  ]);
129880
130066
  const pollRun = reactExports.useCallback(async () => {
@@ -129892,49 +130078,14 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129892
130078
  setRun(hydrateResourceIO(result));
129893
130079
  return true;
129894
130080
  }, [env2, runId, run == null ? void 0 : run.completedAt]);
129895
- const pollSteps = reactExports.useCallback(
129896
- () => pollResource({
129897
- fetchFn: () => unwrapServerActionResult(
129898
- fetchSteps$1(env2, runId, {
129899
- cursor: stepsCursor,
129900
- sortOrder: "asc",
129901
- limit: LIVE_POLL_LIMIT
129902
- })
129903
- ),
129904
- setItems: setSteps,
129905
- setCursor: setStepsCursor,
129906
- setError,
129907
- idKey: "stepId",
129908
- cursorStrategy: "onHasMore",
129909
- transform: hydrateResourceIO
129910
- }),
129911
- [env2, runId, stepsCursor]
129912
- );
129913
- const pollHooks = reactExports.useCallback(
129914
- () => pollResource({
129915
- fetchFn: () => unwrapServerActionResult(
129916
- fetchHooks$1(env2, {
129917
- runId,
129918
- cursor: hooksCursor,
129919
- sortOrder: "asc",
129920
- limit: LIVE_POLL_LIMIT
129921
- })
129922
- ),
129923
- setItems: setHooks,
129924
- setCursor: setHooksCursor,
129925
- setError,
129926
- idKey: "hookId",
129927
- transform: hydrateResourceIO
129928
- }),
129929
- [env2, runId, hooksCursor]
129930
- );
129931
130081
  const pollEvents = reactExports.useCallback(
129932
130082
  () => pollResource({
129933
130083
  fetchFn: () => unwrapServerActionResult(
129934
130084
  fetchEvents$1(env2, runId, {
129935
130085
  cursor: eventsCursor,
129936
130086
  sortOrder: "asc",
129937
- limit: LIVE_POLL_LIMIT
130087
+ limit: LIVE_POLL_LIMIT,
130088
+ withData: true
129938
130089
  })
129939
130090
  ),
129940
130091
  setItems: setEvents,
@@ -129945,27 +130096,19 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129945
130096
  }),
129946
130097
  [env2, runId, eventsCursor]
129947
130098
  );
129948
- const update = reactExports.useCallback(
129949
- async (stepsOnly = false) => {
129950
- if (isFetchingRef.current || !initialLoadCompleted) {
129951
- return { foundNewItems: false };
129952
- }
129953
- let foundNewItems = false;
129954
- try {
129955
- const [_2, stepsUpdated, hooksUpdated, eventsUpdated] = await Promise.all([
129956
- stepsOnly ? Promise.resolve(false) : pollRun(),
129957
- pollSteps(),
129958
- stepsOnly ? Promise.resolve(false) : pollHooks(),
129959
- stepsOnly ? Promise.resolve(false) : pollEvents()
129960
- ]);
129961
- foundNewItems = stepsUpdated || hooksUpdated || eventsUpdated;
129962
- } catch (err) {
129963
- console.error("Update error:", err);
129964
- }
129965
- return { foundNewItems };
129966
- },
129967
- [pollSteps, pollHooks, pollEvents, initialLoadCompleted, pollRun]
129968
- );
130099
+ const update = reactExports.useCallback(async () => {
130100
+ if (isFetchingRef.current || !initialLoadCompleted) {
130101
+ return { foundNewItems: false };
130102
+ }
130103
+ let foundNewItems = false;
130104
+ try {
130105
+ const [_2, eventsUpdated] = await Promise.all([pollRun(), pollEvents()]);
130106
+ foundNewItems = eventsUpdated;
130107
+ } catch (err) {
130108
+ console.error("Update error:", err);
130109
+ }
130110
+ return { foundNewItems };
130111
+ }, [pollEvents, initialLoadCompleted, pollRun]);
129969
130112
  reactExports.useEffect(() => {
129970
130113
  fetchAllData();
129971
130114
  }, [fetchAllData]);
@@ -129976,25 +130119,18 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129976
130119
  const interval2 = setInterval(() => {
129977
130120
  update();
129978
130121
  }, LIVE_UPDATE_INTERVAL_MS);
129979
- const stepInterval = setInterval(() => {
129980
- update(true);
129981
- }, LIVE_STEP_UPDATE_INTERVAL_MS);
129982
130122
  return () => {
129983
130123
  clearInterval(interval2);
129984
- clearInterval(stepInterval);
129985
130124
  };
129986
130125
  }, [live, initialLoadCompleted, update, run == null ? void 0 : run.completedAt]);
129987
130126
  return {
129988
130127
  run: run ?? {},
129989
- steps,
129990
- hooks,
129991
130128
  events: events2,
129992
130129
  loading,
129993
- auxiliaryDataLoading,
129994
130130
  error: error2,
129995
130131
  update,
129996
130132
  loadMoreTraceData,
129997
- hasMoreTraceData: stepsHasMore || hooksHasMore || eventsHasMore,
130133
+ hasMoreTraceData: eventsHasMore,
129998
130134
  isLoadingMoreTraceData
129999
130135
  };
130000
130136
  }
@@ -130127,7 +130263,7 @@ function HooksTable({
130127
130263
  };
130128
130264
  const [invocationData, setInvocationData] = reactExports.useState(/* @__PURE__ */ new Map());
130129
130265
  reactExports.useEffect(() => {
130130
- if (!hooks.length) return;
130266
+ if (!hooks.length || !runId) return;
130131
130267
  const fetchInvocations = async () => {
130132
130268
  const initialData = /* @__PURE__ */ new Map();
130133
130269
  for (const hook of hooks) {
@@ -130138,65 +130274,55 @@ function HooksTable({
130138
130274
  });
130139
130275
  }
130140
130276
  setInvocationData(initialData);
130141
- const results = await Promise.allSettled(
130142
- hooks.map(async (hook) => {
130143
- var _a3;
130144
- try {
130145
- const serverResult = await fetchEventsByCorrelationId$1(
130146
- env2,
130147
- hook.hookId,
130148
- {
130149
- sortOrder: "asc",
130150
- limit: 100
130151
- }
130152
- );
130153
- if (!serverResult.success) {
130154
- return {
130155
- hookId: hook.hookId,
130156
- count: new Error(
130157
- ((_a3 = serverResult.error) == null ? void 0 : _a3.message) || "Failed to fetch events"
130158
- ),
130159
- hasMore: false
130160
- };
130277
+ try {
130278
+ const serverResult = await fetchEvents$1(env2, runId, {
130279
+ sortOrder: "asc",
130280
+ limit: 1e3
130281
+ });
130282
+ if (!serverResult.success) {
130283
+ setInvocationData((prev) => {
130284
+ const updated = new Map(prev);
130285
+ for (const hook of hooks) {
130286
+ updated.set(hook.hookId, { count: 0, hasMore: false, loading: false });
130161
130287
  }
130162
- const events2 = serverResult.data;
130163
- const count2 = events2.data.filter(
130164
- (e) => e.eventType === "hook_received"
130165
- ).length;
130166
- return {
130167
- hookId: hook.hookId,
130168
- count: count2,
130169
- hasMore: events2.hasMore
130170
- };
130171
- } catch (e) {
130172
- return {
130173
- hookId: hook.hookId,
130174
- count: e,
130175
- hasMore: false
130176
- };
130288
+ return updated;
130289
+ });
130290
+ return;
130291
+ }
130292
+ const allEvents = serverResult.data.data;
130293
+ const hookIds = new Set(hooks.map((h2) => h2.hookId));
130294
+ const counts = /* @__PURE__ */ new Map();
130295
+ for (const event of allEvents) {
130296
+ if (event.eventType === "hook_received" && event.correlationId && hookIds.has(event.correlationId)) {
130297
+ counts.set(
130298
+ event.correlationId,
130299
+ (counts.get(event.correlationId) ?? 0) + 1
130300
+ );
130177
130301
  }
130178
- })
130179
- );
130180
- setInvocationData((prev) => {
130181
- const updated = new Map(prev);
130182
- for (let i = 0; i < results.length; i++) {
130183
- const result = results[i];
130184
- const hookId = hooks[i].hookId;
130185
- if (result.status === "fulfilled") {
130186
- updated.set(result.value.hookId, {
130187
- count: result.value.count,
130188
- hasMore: result.value.hasMore,
130302
+ }
130303
+ setInvocationData((prev) => {
130304
+ const updated = new Map(prev);
130305
+ for (const hook of hooks) {
130306
+ updated.set(hook.hookId, {
130307
+ count: counts.get(hook.hookId) ?? 0,
130308
+ hasMore: serverResult.data.hasMore,
130189
130309
  loading: false
130190
130310
  });
130191
- } else {
130192
- updated.set(hookId, { count: 0, hasMore: false, loading: false });
130193
130311
  }
130194
- }
130195
- return updated;
130196
- });
130312
+ return updated;
130313
+ });
130314
+ } catch {
130315
+ setInvocationData((prev) => {
130316
+ const updated = new Map(prev);
130317
+ for (const hook of hooks) {
130318
+ updated.set(hook.hookId, { count: 0, hasMore: false, loading: false });
130319
+ }
130320
+ return updated;
130321
+ });
130322
+ }
130197
130323
  };
130198
130324
  fetchInvocations();
130199
- }, [hooks, env2]);
130325
+ }, [hooks, env2, runId]);
130200
130326
  const renderInvocationCount = (hook) => {
130201
130327
  const data2 = invocationData.get(hook.hookId);
130202
130328
  if (!data2 || data2.loading) {
@@ -146879,7 +147005,6 @@ function WorkflowGraphExecutionViewer({
146879
147005
  }
146880
147006
  function GraphTabContent({
146881
147007
  run,
146882
- allSteps,
146883
147008
  allEvents,
146884
147009
  env: env2
146885
147010
  }) {
@@ -146904,15 +147029,30 @@ function GraphTabContent({
146904
147029
  return ((_a4 = parseWorkflowName(wf.workflowName)) == null ? void 0 : _a4.shortName) === runShortName;
146905
147030
  }) ?? null;
146906
147031
  }, [graphManifest, run.workflowName]);
147032
+ const stepsFromEvents = reactExports.useMemo(() => {
147033
+ if (!allEvents) return [];
147034
+ const stepEventsMap = /* @__PURE__ */ new Map();
147035
+ for (const event of allEvents) {
147036
+ if (event.eventType.startsWith("step_") && event.correlationId) {
147037
+ const existing = stepEventsMap.get(event.correlationId);
147038
+ if (existing) {
147039
+ existing.push(event);
147040
+ } else {
147041
+ stepEventsMap.set(event.correlationId, [event]);
147042
+ }
147043
+ }
147044
+ }
147045
+ return Array.from(stepEventsMap.values()).map(stepEventsToStepEntity).filter((s2) => s2 !== null);
147046
+ }, [allEvents]);
146907
147047
  const execution = reactExports.useMemo(() => {
146908
147048
  if (!workflowGraph || !run.runId) return null;
146909
147049
  return mapRunToExecution(
146910
147050
  run,
146911
- allSteps || [],
147051
+ stepsFromEvents,
146912
147052
  allEvents || [],
146913
147053
  workflowGraph
146914
147054
  );
146915
- }, [workflowGraph, run, allSteps, allEvents]);
147055
+ }, [workflowGraph, run, stepsFromEvents, allEvents]);
146916
147056
  if (graphLoading) {
146917
147057
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center w-full h-full", children: [
146918
147058
  /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
@@ -147042,11 +147182,8 @@ function RunDetailView({
147042
147182
  const isLocalBackend = serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
147043
147183
  const {
147044
147184
  run: runData,
147045
- steps: allSteps,
147046
- hooks: allHooks,
147047
147185
  events: allEvents,
147048
147186
  loading,
147049
- auxiliaryDataLoading,
147050
147187
  error: error2,
147051
147188
  update,
147052
147189
  loadMoreTraceData,
@@ -147198,24 +147335,6 @@ function RunDetailView({
147198
147335
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold", children: workflowName ? workflowName : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[260px] h-[28px]" }) }) }),
147199
147336
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
147200
147337
  /* @__PURE__ */ jsxRuntimeExports.jsx(LiveStatus, { hasError, errorMessage }),
147201
- (isEncryptedMarker(run.input) || isEncryptedMarker(run.output) || isEncryptedMarker(run.error) || allSteps.some(
147202
- (s2) => isEncryptedMarker(s2.input) || isEncryptedMarker(s2.output)
147203
- )) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
147204
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
147205
- Button,
147206
- {
147207
- variant: "outline",
147208
- size: "sm",
147209
- onClick: handleDecrypt,
147210
- disabled: !!encryptionKey,
147211
- children: [
147212
- encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx(LockOpen, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-4 w-4" }),
147213
- encryptionKey ? "Decrypted" : "Decrypt"
147214
- ]
147215
- }
147216
- ) }) }),
147217
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Data has been decrypted for this workflow run. All encrypted input, output, and event data is now visible across all tabs." }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "This run's data is end-to-end encrypted. Decrypt to reveal input, output, and event data across all tabs for this workflow run." }) })
147218
- ] }),
147219
147338
  /* @__PURE__ */ jsxRuntimeExports.jsx(
147220
147339
  RunActionsButtons,
147221
147340
  {
@@ -147223,7 +147342,7 @@ function RunDetailView({
147223
147342
  runId,
147224
147343
  runStatus: run.status,
147225
147344
  events: allEvents,
147226
- eventsLoading: auxiliaryDataLoading,
147345
+ eventsLoading: loading,
147227
147346
  loading,
147228
147347
  onRerunClick: handleRerunClick,
147229
147348
  onCancelClick: handleCancelClick,
@@ -147282,159 +147401,151 @@ function RunDetailView({
147282
147401
  ] })
147283
147402
  ] })
147284
147403
  ] }),
147285
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: [
147286
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
147287
- Tabs,
147288
- {
147289
- value: activeTab,
147290
- onValueChange: (v2) => setActiveTab(v2),
147291
- className: "flex-1 flex flex-col min-h-0",
147292
- children: [
147293
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 flex-none", children: [
147294
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "trace", className: "gap-2", children: [
147295
- /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147296
- "Trace"
147297
- ] }),
147298
- isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "graph", className: "gap-2", children: [
147299
- /* @__PURE__ */ jsxRuntimeExports.jsx(GitBranch, { className: "h-4 w-4" }),
147300
- "Graph"
147301
- ] }),
147302
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
147303
- /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147304
- "Events"
147305
- ] }),
147306
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "streams", className: "gap-2", children: [
147307
- /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147308
- "Streams"
147309
- ] })
147404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
147405
+ Tabs,
147406
+ {
147407
+ value: activeTab,
147408
+ onValueChange: (v2) => setActiveTab(v2),
147409
+ className: "flex-1 flex flex-col min-h-0",
147410
+ children: [
147411
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 flex-none", children: [
147412
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "trace", className: "gap-2", children: [
147413
+ /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147414
+ "Trace"
147310
147415
  ] }),
147311
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "trace", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load trace viewer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147312
- WorkflowTraceViewer,
147313
- {
147314
- error: error2,
147315
- steps: allSteps,
147316
- events: allEvents,
147317
- hooks: allHooks,
147318
- run,
147319
- isLoading: loading,
147320
- spanDetailData,
147321
- spanDetailLoading,
147322
- spanDetailError,
147323
- onSpanSelect: handleSpanSelect,
147324
- onStreamClick: handleStreamClick,
147325
- onWakeUpSleep: handleWakeUpSleep,
147326
- onResolveHook: handleResolveHook,
147327
- onLoadEventData: handleLoadSidebarEventData,
147328
- onLoadMoreSpans: loadMoreTraceData,
147329
- hasMoreSpans: hasMoreTraceData,
147330
- isLoadingMoreSpans: isLoadingMoreTraceData,
147331
- encryptionKey: encryptionKey ?? void 0
147332
- }
147333
- ) }) }) }),
147334
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147335
- EventListView,
147416
+ isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "graph", className: "gap-2", children: [
147417
+ /* @__PURE__ */ jsxRuntimeExports.jsx(GitBranch, { className: "h-4 w-4" }),
147418
+ "Graph"
147419
+ ] }),
147420
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
147421
+ /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147422
+ "Events"
147423
+ ] }),
147424
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "streams", className: "gap-2", children: [
147425
+ /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
147426
+ "Streams"
147427
+ ] })
147428
+ ] }),
147429
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "trace", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load trace viewer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147430
+ WorkflowTraceViewer,
147431
+ {
147432
+ error: error2,
147433
+ events: allEvents,
147434
+ run,
147435
+ isLoading: loading,
147436
+ spanDetailData,
147437
+ spanDetailLoading,
147438
+ spanDetailError,
147439
+ onSpanSelect: handleSpanSelect,
147440
+ onStreamClick: handleStreamClick,
147441
+ onWakeUpSleep: handleWakeUpSleep,
147442
+ onResolveHook: handleResolveHook,
147443
+ onLoadEventData: handleLoadSidebarEventData,
147444
+ onLoadMoreSpans: loadMoreTraceData,
147445
+ hasMoreSpans: hasMoreTraceData,
147446
+ isLoadingMoreSpans: isLoadingMoreTraceData,
147447
+ encryptionKey: encryptionKey ?? void 0,
147448
+ onDecrypt: handleDecrypt
147449
+ }
147450
+ ) }) }) }),
147451
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147452
+ EventListView,
147453
+ {
147454
+ events: allEvents,
147455
+ run,
147456
+ onLoadEventData: handleLoadEventData,
147457
+ encryptionKey: encryptionKey ?? void 0,
147458
+ isLoading: loading
147459
+ }
147460
+ ) }) }) }),
147461
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "streams", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load stream data", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex gap-4", children: [
147462
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
147463
+ "div",
147336
147464
  {
147337
- events: allEvents,
147338
- steps: allSteps,
147339
- run,
147340
- onLoadEventData: handleLoadEventData,
147341
- encryptionKey: encryptionKey ?? void 0
147342
- }
147343
- ) }) }) }),
147344
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "streams", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load stream data", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex gap-4", children: [
147345
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
147346
- "div",
147347
- {
147348
- className: "w-64 flex-shrink-0 border rounded-lg overflow-hidden",
147349
- style: {
147350
- borderColor: "var(--ds-gray-300)",
147351
- backgroundColor: "var(--ds-background-100)"
147352
- },
147353
- children: [
147354
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
147355
- "div",
147356
- {
147357
- className: "px-3 py-2 border-b text-xs font-medium",
147358
- style: {
147359
- borderColor: "var(--ds-gray-300)",
147360
- color: "var(--ds-gray-900)"
147361
- },
147362
- children: [
147363
- "Streams (",
147364
- streams.length,
147365
- ")"
147366
- ]
147367
- }
147368
- ),
147369
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-auto max-h-[calc(100vh-400px)]", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-xs text-destructive", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
147370
- "div",
147371
- {
147372
- className: "p-4 text-xs",
147373
- style: { color: "var(--ds-gray-600)" },
147374
- children: "No streams found for this run"
147375
- }
147376
- ) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
147377
- "button",
147378
- {
147379
- type: "button",
147380
- onClick: () => setSelectedStreamId(streamId),
147381
- className: "w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",
147382
- style: {
147383
- backgroundColor: selectedStreamId === streamId ? "var(--ds-gray-200)" : "transparent",
147384
- color: "var(--ds-gray-1000)"
147385
- },
147386
- title: streamId,
147387
- children: streamId
147465
+ className: "w-64 flex-shrink-0 border rounded-lg overflow-hidden",
147466
+ style: {
147467
+ borderColor: "var(--ds-gray-300)",
147468
+ backgroundColor: "var(--ds-background-100)"
147469
+ },
147470
+ children: [
147471
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
147472
+ "div",
147473
+ {
147474
+ className: "px-3 py-2 border-b text-xs font-medium",
147475
+ style: {
147476
+ borderColor: "var(--ds-gray-300)",
147477
+ color: "var(--ds-gray-900)"
147388
147478
  },
147389
- streamId
147390
- )) })
147391
- ]
147392
- }
147393
- ),
147394
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: selectedStreamId ? /* @__PURE__ */ jsxRuntimeExports.jsx(
147395
- StreamViewer,
147396
- {
147397
- streamId: selectedStreamId,
147398
- chunks: streamChunks,
147399
- isLive: streamIsLive,
147400
- error: streamError
147401
- }
147402
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
147403
- "div",
147404
- {
147405
- className: "h-full flex items-center justify-center rounded-lg border",
147406
- style: {
147407
- borderColor: "var(--ds-gray-300)",
147408
- backgroundColor: "var(--ds-gray-100)"
147409
- },
147410
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147479
+ children: [
147480
+ "Streams (",
147481
+ streams.length,
147482
+ ")"
147483
+ ]
147484
+ }
147485
+ ),
147486
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-auto max-h-[calc(100vh-400px)]", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-xs text-destructive", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
147411
147487
  "div",
147412
147488
  {
147413
- className: "text-sm",
147489
+ className: "p-4 text-xs",
147414
147490
  style: { color: "var(--ds-gray-600)" },
147415
- children: streams.length > 0 ? "Select a stream to view its data" : "No streams available"
147491
+ children: "No streams found for this run"
147416
147492
  }
147417
- )
147418
- }
147419
- ) })
147420
- ] }) }) }),
147421
- isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "graph", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load execution graph", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full min-h-[500px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147422
- GraphTabContent,
147493
+ ) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
147494
+ "button",
147495
+ {
147496
+ type: "button",
147497
+ onClick: () => setSelectedStreamId(streamId),
147498
+ className: "w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",
147499
+ style: {
147500
+ backgroundColor: selectedStreamId === streamId ? "var(--ds-gray-200)" : "transparent",
147501
+ color: "var(--ds-gray-1000)"
147502
+ },
147503
+ title: streamId,
147504
+ children: streamId
147505
+ },
147506
+ streamId
147507
+ )) })
147508
+ ]
147509
+ }
147510
+ ),
147511
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: selectedStreamId ? /* @__PURE__ */ jsxRuntimeExports.jsx(
147512
+ StreamViewer,
147423
147513
  {
147424
- run,
147425
- allSteps,
147426
- allEvents,
147427
- env: env2
147514
+ streamId: selectedStreamId,
147515
+ chunks: streamChunks,
147516
+ isLive: streamIsLive,
147517
+ error: streamError
147428
147518
  }
147429
- ) }) }) })
147430
- ]
147431
- }
147432
- ),
147433
- auxiliaryDataLoading && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed flex items-center gap-2 left-8 bottom-8 bg-background border rounded-md px-4 py-2 shadow-lg", children: [
147434
- /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "size-4 animate-spin" }),
147435
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: "Fetching data..." })
147436
- ] })
147437
- ] })
147519
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
147520
+ "div",
147521
+ {
147522
+ className: "h-full flex items-center justify-center rounded-lg border",
147523
+ style: {
147524
+ borderColor: "var(--ds-gray-300)",
147525
+ backgroundColor: "var(--ds-gray-100)"
147526
+ },
147527
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147528
+ "div",
147529
+ {
147530
+ className: "text-sm",
147531
+ style: { color: "var(--ds-gray-600)" },
147532
+ children: streams.length > 0 ? "Select a stream to view its data" : "No streams available"
147533
+ }
147534
+ )
147535
+ }
147536
+ ) })
147537
+ ] }) }) }),
147538
+ isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "graph", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load execution graph", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full min-h-[500px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147539
+ GraphTabContent,
147540
+ {
147541
+ run,
147542
+ allEvents,
147543
+ env: env2
147544
+ }
147545
+ ) }) }) })
147546
+ ]
147547
+ }
147548
+ ) })
147438
147549
  ] })
147439
147550
  ] });
147440
147551
  }
@@ -147465,7 +147576,6 @@ const handlers = {
147465
147576
  fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
147466
147577
  fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
147467
147578
  fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
147468
- fetchEventsByCorrelationId: (p2) => fetchEventsByCorrelationId(p2.worldEnv ?? {}, p2.correlationId, p2.params ?? {}),
147469
147579
  fetchHooks: (p2) => fetchHooks(p2.worldEnv ?? {}, p2.params ?? {}),
147470
147580
  fetchHook: (p2) => fetchHook(p2.worldEnv ?? {}, p2.hookId, p2.resolveData),
147471
147581
  cancelRun: (p2) => cancelRun$1(p2.worldEnv ?? {}, p2.runId),
@@ -147608,7 +147718,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
147608
147718
  __proto__: null,
147609
147719
  loader
147610
147720
  }, Symbol.toStringTag, { value: "Module" }));
147611
- const serverManifest = { "entry": { "module": "/assets/entry.client-BjpmGyLC.js", "imports": ["/assets/index-DklpUtP3.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": false, "module": "/assets/root-B2fanH6r.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-BhkyG8Sq.js"], "css": ["/assets/root-Dr_TuMgh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-B4MMr7LP.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-D6xsvBGu.js", "/assets/mermaid-3ZIDBTTL-BhkyG8Sq.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-D40YBNgh.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-D6xsvBGu.js", "/assets/mermaid-3ZIDBTTL-BhkyG8Sq.js", "/assets/encryption-8OvC6eoJ.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-ef94afe1.js", "version": "ef94afe1", "sri": void 0 };
147721
+ const serverManifest = { "entry": { "module": "/assets/entry.client-BjpmGyLC.js", "imports": ["/assets/index-DklpUtP3.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": false, "module": "/assets/root-DQpGl57T.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-BPJg8vAL.js"], "css": ["/assets/root-BMRA92qM.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-MMGoJh7w.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-B8LKXrpA.js", "/assets/mermaid-3ZIDBTTL-BPJg8vAL.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-DZDSfYol.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-B8LKXrpA.js", "/assets/mermaid-3ZIDBTTL-BPJg8vAL.js", "/assets/encryption-8OvC6eoJ.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-678c3cbf.js", "version": "678c3cbf", "sri": void 0 };
147612
147722
  const assetsBuildDirectory = "build/client";
147613
147723
  const basename = "/";
147614
147724
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };