@workflow/web 4.1.0-beta.40 → 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 (24) hide show
  1. package/README.md +5 -0
  2. package/build/client/assets/{highlighted-body-B3W2YXNL-BlfdcYh0.js → highlighted-body-B3W2YXNL-DKVOCXmq.js} +1 -1
  3. package/build/client/assets/{home-Xl3EX8M3.js → home-MMGoJh7w.js} +1 -1
  4. package/build/client/assets/{manifest-0e172cba.js → manifest-678c3cbf.js} +1 -1
  5. package/build/client/assets/{mermaid-3ZIDBTTL-RlQIshou.js → mermaid-3ZIDBTTL-BPJg8vAL.js} +3 -3
  6. package/build/client/assets/root-BMRA92qM.css +1 -0
  7. package/build/client/assets/{root-D-041AAq.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-C-GqGBPl.js → use-workflow-graph-B8LKXrpA.js} +1 -1
  11. package/build/server/assets/{app-DLRJr3zg.js → app-Bdxmgv4c.js} +1 -1
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-7BMdhIzo.js → highlighted-body-B3W2YXNL-uEj5-2nD.js} +2 -2
  13. package/build/server/assets/{mermaid-3ZIDBTTL-C-mhM4Cx.js → mermaid-3ZIDBTTL-BvjkIiuk.js} +2 -2
  14. package/build/server/assets/{server-build-B-uZ5KmC.js → server-build-CKAakcyN.js} +388 -148
  15. package/build/server/assets/{token-mzBpVePm.js → token-CNug9NIq.js} +3 -3
  16. package/build/server/assets/{token-BRJJ012D.js → token-DLqvw7I2.js} +2 -2
  17. package/build/server/assets/{token-util-YAVqVR6-.js → token-util-DMDYM1rE.js} +2 -2
  18. package/build/server/assets/{token-util-C29I-on4.js → token-util-DgFyM3ow.js} +1 -1
  19. package/build/server/assets/{token-util-D7WmNSMO.js → token-util-_HYGsI73.js} +2 -2
  20. package/build/server/index.js +1 -1
  21. package/package.json +5 -5
  22. package/build/client/assets/root-9gRDb_Jz.css +0 -1
  23. package/build/client/assets/run-detail-BPOihWwO.js +0 -41
  24. package/build/client/assets/server-build-Dj97HEP4.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-DLRJr3zg.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";
@@ -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 } });
@@ -37220,7 +37273,7 @@ function TreeGutter({ isFirst, isLast, isRunLevel: isRun, statusDotColor, pulse
37220
37273
  zIndex: 0
37221
37274
  } })] });
37222
37275
  }
37223
- function CopyableCell({ value, className }) {
37276
+ function CopyableCell({ value, className, style: styleProp }) {
37224
37277
  const [copied, setCopied] = reactExports.useState(false);
37225
37278
  const resetCopiedTimeoutRef = reactExports.useRef(null);
37226
37279
  reactExports.useEffect(() => {
@@ -37243,7 +37296,7 @@ function CopyableCell({ value, className }) {
37243
37296
  }, 1500);
37244
37297
  });
37245
37298
  }, [value]);
37246
- 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] });
37247
37300
  }
37248
37301
  function deepParseJson(value) {
37249
37302
  if (typeof value === "string") {
@@ -37321,18 +37374,16 @@ function PayloadBlock({ data, eventType }) {
37321
37374
  }
37322
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" })] }) })] });
37323
37376
  }
37324
- function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, encryptionKey }) {
37325
- 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 }) {
37326
37382
  const [isLoading, setIsLoading] = reactExports.useState(false);
37327
- const [loadedEventData, setLoadedEventData] = reactExports.useState(null);
37383
+ const [loadedEventData, setLoadedEventData] = reactExports.useState(cachedEventData);
37328
37384
  const [loadError, setLoadError] = reactExports.useState(null);
37329
- const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(false);
37330
- const rowGroupKey = event.correlationId ?? (isRunLevel(event.eventType) ? "__run__" : void 0);
37331
- reactExports.useEffect(() => {
37332
- if (selectedGroupKey !== void 0 && selectedGroupKey !== rowGroupKey) {
37333
- setIsExpanded(false);
37334
- }
37335
- }, [selectedGroupKey, rowGroupKey]);
37385
+ const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(cachedEventData !== null);
37386
+ const rowGroupKey = isRunLevel(event.eventType) ? "__run__" : event.correlationId ?? void 0;
37336
37387
  const statusDotColor = getStatusDotColor(event.eventType);
37337
37388
  const createdAt = new Date(event.createdAt);
37338
37389
  const hasExistingEventData = "eventData" in event && event.eventData != null;
@@ -37359,9 +37410,10 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37359
37410
  setLoadError("Event details unavailable");
37360
37411
  return;
37361
37412
  }
37362
- const eventData2 = await onLoadEventData(event);
37363
- if (eventData2 !== null && eventData2 !== void 0) {
37364
- setLoadedEventData(eventData2);
37413
+ const data = await onLoadEventData(event);
37414
+ if (data !== null && data !== void 0) {
37415
+ setLoadedEventData(data);
37416
+ onCacheEventData(event.eventId, data);
37365
37417
  }
37366
37418
  } catch (err) {
37367
37419
  setLoadError(err instanceof Error ? err.message : "Failed to load event details");
@@ -37369,7 +37421,18 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37369
37421
  setIsLoading(false);
37370
37422
  setHasAttemptedLoad(true);
37371
37423
  }
37372
- }, [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
+ }, []);
37373
37436
  reactExports.useEffect(() => {
37374
37437
  if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
37375
37438
  setLoadedEventData(null);
@@ -37377,6 +37440,7 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37377
37440
  onLoadEventData(event).then((data) => {
37378
37441
  if (data !== null && data !== void 0) {
37379
37442
  setLoadedEventData(data);
37443
+ onCacheEventData(event.eventId, data);
37380
37444
  }
37381
37445
  setHasAttemptedLoad(true);
37382
37446
  }).catch(() => {
@@ -37384,33 +37448,34 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37384
37448
  });
37385
37449
  }
37386
37450
  }, [encryptionKey]);
37387
- const handleExpandToggle = reactExports.useCallback((e) => {
37388
- e.stopPropagation();
37389
- const newExpanded = !isExpanded;
37390
- setIsExpanded(newExpanded);
37391
- if (newExpanded && loadedEventData === null && !hasExistingEventData) {
37392
- loadEventDetails();
37393
- }
37394
- }, [isExpanded, loadedEventData, hasExistingEventData, loadEventDetails]);
37395
37451
  const handleRowClick = reactExports.useCallback(() => {
37396
- if (selectedGroupKey === rowGroupKey) {
37397
- onSelectGroup(void 0);
37398
- } else {
37399
- onSelectGroup(rowGroupKey);
37452
+ onSelectGroup(rowGroupKey === selectedGroupKey ? void 0 : rowGroupKey);
37453
+ onToggleExpand(event.eventId);
37454
+ if (!isExpanded && loadedEventData === null && !hasExistingEventData) {
37455
+ loadEventDetails();
37400
37456
  }
37401
- }, [selectedGroupKey, rowGroupKey, onSelectGroup]);
37457
+ }, [
37458
+ selectedGroupKey,
37459
+ rowGroupKey,
37460
+ onSelectGroup,
37461
+ onToggleExpand,
37462
+ event.eventId,
37463
+ isExpanded,
37464
+ loadedEventData,
37465
+ hasExistingEventData,
37466
+ loadEventDetails
37467
+ ]);
37402
37468
  const eventData = hasExistingEventData ? event.eventData : loadedEventData;
37403
37469
  const contentOpacity = isDimmed ? 0.3 : 1;
37404
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) => {
37405
37471
  if (e.key === "Enter" || e.key === " ")
37406
37472
  handleRowClick();
37407
- }, 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: {
37408
- ...BUTTON_RESET_STYLE,
37409
- border: "1px solid var(--ds-gray-alpha-400)"
37410
- }, "aria-label": isExpanded ? "Collapse details" : "Expand details", children: jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 transition-transform", style: {
37411
- 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)",
37412
37477
  transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
37413
- } }) }), 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: {
37414
37479
  position: "relative",
37415
37480
  display: "inline-flex",
37416
37481
  width: 6,
@@ -37429,7 +37494,7 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37429
37494
  height: 6,
37430
37495
  borderRadius: "50%",
37431
37496
  backgroundColor: statusDotColor
37432
- } })] }), 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: {
37433
37498
  borderColor: "var(--ds-gray-alpha-200)",
37434
37499
  opacity: contentOpacity,
37435
37500
  transition: "opacity 150ms"
@@ -37439,12 +37504,22 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
37439
37504
  color: "var(--ds-red-900)"
37440
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" })] })] })] });
37441
37506
  }
37442
- function EventListView({ events: events2, 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]);
37443
37517
  const sortedEvents2 = reactExports.useMemo(() => {
37444
37518
  if (!events2 || events2.length === 0)
37445
37519
  return [];
37446
- return [...events2].sort((a2, b2) => new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime());
37447
- }, [events2]);
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]);
37448
37523
  const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(events2 ?? null, run ?? null), [events2, run]);
37449
37524
  const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents2), [sortedEvents2]);
37450
37525
  const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
@@ -37456,6 +37531,49 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
37456
37531
  setHoveredGroupKey(groupKey);
37457
37532
  }, []);
37458
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]);
37459
37577
  const selectedGroupRange = reactExports.useMemo(() => {
37460
37578
  if (!activeGroupKey || activeGroupKey === "__run__")
37461
37579
  return null;
@@ -37476,15 +37594,23 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
37476
37594
  const entries = [];
37477
37595
  for (let i = 0; i < sortedEvents2.length; i++) {
37478
37596
  const ev = sortedEvents2[i];
37597
+ const isRun = isRunLevel(ev.eventType);
37598
+ const name2 = isRun ? workflowName ?? "" : ev.correlationId ? correlationNameMap.get(ev.correlationId) ?? "" : "";
37479
37599
  entries.push({
37480
- text: [ev.eventId, ev.correlationId ?? ""].join(" ").toLowerCase(),
37481
- 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),
37482
37608
  eventId: ev.eventId,
37483
37609
  index: i
37484
37610
  });
37485
37611
  }
37486
37612
  return entries;
37487
- }, [sortedEvents2]);
37613
+ }, [sortedEvents2, correlationNameMap, workflowName]);
37488
37614
  reactExports.useEffect(() => {
37489
37615
  var _a3;
37490
37616
  const q2 = searchQuery.trim().toLowerCase();
@@ -37492,27 +37618,49 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
37492
37618
  setSelectedGroupKey(void 0);
37493
37619
  return;
37494
37620
  }
37495
- const match2 = searchIndex.find((entry2) => entry2.text.includes(q2));
37496
- if (match2) {
37497
- 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);
37498
37636
  (_a3 = virtuosoRef.current) == null ? void 0 : _a3.scrollToIndex({
37499
- index: match2.index,
37637
+ index: bestMatch.index,
37500
37638
  align: "center",
37501
37639
  behavior: "smooth"
37502
37640
  });
37503
37641
  }
37504
37642
  }, [searchQuery, searchIndex]);
37505
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
+ }
37506
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" });
37507
37648
  }
37508
- 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: {
37509
37655
  display: "flex",
37510
37656
  alignItems: "center",
37511
37657
  justifyContent: "center",
37512
37658
  borderRadius: 6,
37513
37659
  boxShadow: "0 0 0 1px var(--ds-gray-alpha-400)",
37514
37660
  background: "var(--ds-background-100)",
37515
- height: 40
37661
+ height: 40,
37662
+ flex: 1,
37663
+ minWidth: 0
37516
37664
  }, children: [jsxRuntimeExports.jsx("div", { style: {
37517
37665
  width: 40,
37518
37666
  height: 40,
@@ -37521,7 +37669,7 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
37521
37669
  justifyContent: "center",
37522
37670
  color: "var(--ds-gray-800)",
37523
37671
  flexShrink: 0
37524
- }, 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: {
37525
37673
  marginLeft: -16,
37526
37674
  paddingInline: 12,
37527
37675
  fontFamily: "inherit",
@@ -37531,27 +37679,29 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
37531
37679
  outline: "none",
37532
37680
  height: 40,
37533
37681
  width: "100%"
37534
- } })] }) }), 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: {
37535
37683
  borderColor: "var(--ds-gray-alpha-200)",
37536
37684
  color: "var(--ds-gray-900)",
37537
37685
  backgroundColor: "var(--ds-background-100)"
37538
- }, 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: () => {
37539
37687
  if (!hasMoreEvents || isLoadingMoreEvents) {
37540
37688
  return;
37541
37689
  }
37542
37690
  void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
37543
37691
  }, itemContent: (index2) => {
37544
- 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 });
37545
37694
  }, components: {
37546
- 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: {
37547
37696
  borderColor: "var(--ds-gray-alpha-400)",
37548
37697
  color: "var(--ds-gray-900)",
37549
37698
  backgroundColor: "var(--ds-background-100)"
37550
- }, children: isLoadingMoreEvents ? "Loading more events..." : "Load more" }) }), jsxRuntimeExports.jsxs("div", { className: "mt-4 pt-3 border-t text-xs px-3", style: {
37551
- borderColor: "var(--ds-gray-alpha-200)",
37552
- color: "var(--ds-gray-900)"
37553
- }, children: [sortedEvents2.length, " event", sortedEvents2.length !== 1 ? "s" : "", " total"] })] })
37554
- }, 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"] })] });
37555
37705
  }
37556
37706
  function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
37557
37707
  var _a3;
@@ -64427,7 +64577,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
64427
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 });
64428
64578
  var Se = reactExports.createContext({ code: "" }), de$1 = () => reactExports.useContext(Se);
64429
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 }) });
64430
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-7BMdhIzo.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 }) => {
64431
64581
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
64432
64582
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
64433
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 }) })] }) });
@@ -64749,7 +64899,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
64749
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] });
64750
64900
  };
64751
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 }) })] });
64752
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-C-mhM4Cx.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]+)/;
64753
64903
  function ke(e, t) {
64754
64904
  if (!(e != null && e.position || t != null && t.position)) return true;
64755
64905
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -69841,9 +69991,9 @@ function PanelResizeHandle({ onResize }) {
69841
69991
  }, [onResize]);
69842
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 });
69843
69993
  }
69844
- function TraceViewerFooter({ hasMore, isLive }) {
69994
+ function TraceViewerFooter({ hasMore, isLive, isInitialLoading }) {
69845
69995
  const style2 = { color: "var(--ds-gray-900)" };
69846
- if (hasMore) {
69996
+ if (hasMore || isInitialLoading) {
69847
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…"] });
69848
69998
  }
69849
69999
  if (isLive) {
@@ -69951,7 +70101,7 @@ const WorkflowTraceViewer = ({ run, events: events2, isLoading, error: error2, s
69951
70101
  if (!trace2) {
69952
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]" })] })] });
69953
70103
  }
69954
- 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, footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive }) }) })] }) }), 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: {
69955
70105
  width: panelWidth,
69956
70106
  borderColor: "var(--ds-gray-200)",
69957
70107
  backgroundColor: "var(--ds-background-100)"
@@ -89523,8 +89673,8 @@ function requireGetVercelOidcToken$1() {
89523
89673
  }
89524
89674
  try {
89525
89675
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
89526
- await import("./token-util-YAVqVR6-.js").then((n) => n.t),
89527
- await import("./token-mzBpVePm.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)
89528
89678
  ]);
89529
89679
  if (!token || isExpired(getTokenPayload(token))) {
89530
89680
  await refreshToken();
@@ -115634,17 +115784,84 @@ const LOCAL_QUEUE_MAX_VISIBILITY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_MAX
115634
115784
  const MAX_SAFE_TIMEOUT_MS = 2147483647;
115635
115785
  const DEFAULT_CONCURRENCY_LIMIT = 1e3;
115636
115786
  const WORKFLOW_LOCAL_QUEUE_CONCURRENCY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_CONCURRENCY ?? "0", 10) || DEFAULT_CONCURRENCY_LIMIT;
115637
- 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) {
115638
115797
  const httpAgent = new undiciExports.Agent({
115639
115798
  headersTimeout: 0,
115640
115799
  connections: 1e3,
115641
115800
  keepAliveTimeout: 3e4
115642
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);
115643
115861
  const transport = new JsonTransport();
115644
115862
  const generateId2 = monotonicFactory();
115645
115863
  const semaphore = new libExports.Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
115646
115864
  const inflightMessages = /* @__PURE__ */ new Map();
115647
- const directHandlers = /* @__PURE__ */ new Map();
115648
115865
  const queue = async (queueName, message2, opts) => {
115649
115866
  const cleanup = [];
115650
115867
  if (opts == null ? void 0 : opts.idempotencyKey) {
@@ -115654,17 +115871,7 @@ function createQueue$2(config2) {
115654
115871
  }
115655
115872
  }
115656
115873
  const body2 = transport.serialize(message2);
115657
- let pathname;
115658
- let prefix;
115659
- if (queueName.startsWith("__wkf_step_")) {
115660
- pathname = `step`;
115661
- prefix = "__wkf_step_";
115662
- } else if (queueName.startsWith("__wkf_workflow_")) {
115663
- pathname = `flow`;
115664
- prefix = "__wkf_workflow_";
115665
- } else {
115666
- throw new Error("Unknown queue name prefix");
115667
- }
115874
+ getQueueRoute(queueName);
115668
115875
  const messageId = MessageId.parse(`msg_${generateId2()}`);
115669
115876
  if (opts == null ? void 0 : opts.idempotencyKey) {
115670
115877
  const key = opts.idempotencyKey;
@@ -115681,55 +115888,31 @@ function createQueue$2(config2) {
115681
115888
  }
115682
115889
  try {
115683
115890
  let defaultRetriesLeft = 3;
115684
- const directHandler = directHandlers.get(prefix);
115685
115891
  for (let attempt = 0; defaultRetriesLeft > 0; attempt++) {
115686
115892
  defaultRetriesLeft--;
115687
- let response2;
115688
- const headers2 = {
115689
- ...opts == null ? void 0 : opts.headers,
115690
- "content-type": "application/json",
115691
- "x-vqs-queue-name": queueName,
115692
- "x-vqs-message-id": messageId,
115693
- "x-vqs-message-attempt": String(attempt + 1)
115694
- };
115695
- if (directHandler) {
115696
- const req = new Request("http://localhost/.well-known/workflow/v1/" + pathname, {
115697
- method: "POST",
115698
- headers: headers2,
115699
- body: body2
115700
- });
115701
- response2 = await directHandler(req);
115702
- } else {
115703
- const baseUrl = await resolveBaseUrl$1(config2);
115704
- response2 = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
115705
- method: "POST",
115706
- duplex: "half",
115707
- dispatcher: httpAgent,
115708
- headers: headers2,
115709
- body: body2
115710
- });
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") {
115901
+ return;
115711
115902
  }
115712
- const text2 = await response2.text();
115713
- if (response2.ok) {
115714
- try {
115715
- const timeoutSeconds = Number(JSON.parse(text2).timeoutSeconds);
115716
- if (Number.isFinite(timeoutSeconds) && timeoutSeconds >= 0) {
115717
- if (timeoutSeconds > 0) {
115718
- const timeoutMs = Math.min(timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
115719
- await setTimeout$1(timeoutMs);
115720
- }
115721
- defaultRetriesLeft++;
115722
- continue;
115723
- }
115724
- } catch {
115903
+ if (result.type === "reschedule") {
115904
+ if (result.timeoutSeconds > 0) {
115905
+ const timeoutMs = Math.min(result.timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
115906
+ await setTimeout$1(timeoutMs);
115725
115907
  }
115726
- return;
115908
+ defaultRetriesLeft++;
115909
+ continue;
115727
115910
  }
115728
115911
  console.error(`[local world] Failed to queue message`, {
115729
115912
  queueName,
115730
- text: text2,
115731
- status: response2.status,
115732
- headers: Object.fromEntries(response2.headers.entries()),
115913
+ text: result.text,
115914
+ status: result.status,
115915
+ headers: result.headers,
115733
115916
  body: body2.toString()
115734
115917
  });
115735
115918
  }
@@ -115792,11 +115975,9 @@ function createQueue$2(config2) {
115792
115975
  queue,
115793
115976
  createQueueHandler,
115794
115977
  getDeploymentId,
115795
- registerHandler(prefix, handler) {
115796
- directHandlers.set(prefix, handler);
115797
- },
115978
+ registerHandler: executor.registerHandler,
115798
115979
  async close() {
115799
- await httpAgent.close();
115980
+ await executor.close();
115800
115981
  }
115801
115982
  };
115802
115983
  }
@@ -117227,8 +117408,8 @@ function requireGetVercelOidcToken() {
117227
117408
  }
117228
117409
  try {
117229
117410
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
117230
- await import("./token-util-D7WmNSMO.js").then((n) => n.t),
117231
- await import("./token-BRJJ012D.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)
117232
117413
  ]);
117233
117414
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
117234
117415
  await refreshToken(options);
@@ -117957,7 +118138,7 @@ const PeerService = SemanticConvention("peer.service");
117957
118138
  const RpcSystem = SemanticConvention("rpc.system");
117958
118139
  const RpcService = SemanticConvention("rpc.service");
117959
118140
  const RpcMethod = SemanticConvention("rpc.method");
117960
- const version$1 = "4.1.0-beta.42";
118141
+ const version$1 = "4.1.0-beta.43";
117961
118142
  const DEFAULT_RESOLVE_DATA_OPTION = "all";
117962
118143
  function deserializeError(obj) {
117963
118144
  const { error: error2, ...rest } = obj;
@@ -118270,6 +118451,46 @@ function createQueue$1(config2) {
118270
118451
  };
118271
118452
  return { queue, createQueueHandler, getDeploymentId };
118272
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
+ }
118273
118494
  function isRefDescriptor(value) {
118274
118495
  return typeof value === "object" && value !== null && "_type" in value && "_ref" in value && typeof value._ref === "string" && value._type === "RemoteRef";
118275
118496
  }
@@ -118427,7 +118648,7 @@ async function getWorkflowRun(id2, params, config2) {
118427
118648
  const searchParams = new URLSearchParams();
118428
118649
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118429
118650
  const queryString = searchParams.toString();
118430
- const endpoint = `/v2/runs/${id2}${queryString ? `?${queryString}` : ""}`;
118651
+ const endpoint = `/v2/runs/${encodeURIComponent(id2)}${queryString ? `?${queryString}` : ""}`;
118431
118652
  try {
118432
118653
  const run = await makeRequest({
118433
118654
  endpoint,
@@ -118449,7 +118670,7 @@ async function cancelWorkflowRunV1(id2, params, config2) {
118449
118670
  const searchParams = new URLSearchParams();
118450
118671
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118451
118672
  const queryString = searchParams.toString();
118452
- const endpoint = `/v1/runs/${id2}/cancel${queryString ? `?${queryString}` : ""}`;
118673
+ const endpoint = `/v1/runs/${encodeURIComponent(id2)}/cancel${queryString ? `?${queryString}` : ""}`;
118453
118674
  try {
118454
118675
  const run = await makeRequest({
118455
118676
  endpoint,
@@ -118548,7 +118769,7 @@ async function listWorkflowRunSteps(params, config2) {
118548
118769
  const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
118549
118770
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118550
118771
  const queryString = searchParams.toString();
118551
- const endpoint = `/v2/runs/${runId}/steps${queryString ? `?${queryString}` : ""}`;
118772
+ const endpoint = `/v2/runs/${encodeURIComponent(runId)}/steps${queryString ? `?${queryString}` : ""}`;
118552
118773
  const response2 = await makeRequest({
118553
118774
  endpoint,
118554
118775
  options: { method: "GET" },
@@ -118566,7 +118787,7 @@ async function getStep(runId, stepId, params, config2) {
118566
118787
  const searchParams = new URLSearchParams();
118567
118788
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118568
118789
  const queryString = searchParams.toString();
118569
- 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}` : ""}`;
118570
118791
  const step = await makeRequest({
118571
118792
  endpoint,
118572
118793
  options: { method: "GET" },
@@ -118703,7 +118924,7 @@ async function getEvent(runId, eventId, params, config2) {
118703
118924
  const searchParams = new URLSearchParams();
118704
118925
  searchParams.set("remoteRefBehavior", remoteRefBehavior);
118705
118926
  const queryString = searchParams.toString();
118706
- const endpoint = `/v2/runs/${runId}/events/${eventId}${queryString ? `?${queryString}` : ""}`;
118927
+ const endpoint = `/v2/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}${queryString ? `?${queryString}` : ""}`;
118707
118928
  const event = await makeRequest({
118708
118929
  endpoint,
118709
118930
  options: { method: "GET" },
@@ -118736,7 +118957,7 @@ async function getWorkflowRunEvents(params, config2) {
118736
118957
  searchParams.set("remoteRefBehavior", "lazy");
118737
118958
  const queryString = searchParams.toString();
118738
118959
  const query = queryString ? `?${queryString}` : "";
118739
- const endpoint = correlationId ? `/v2/events${query}` : `/v2/runs/${runId}/events${query}`;
118960
+ const endpoint = correlationId ? `/v2/events${query}` : `/v2/runs/${encodeURIComponent(runId)}/events${query}`;
118740
118961
  let refResolveConcurrency;
118741
118962
  const response2 = await makeRequest({
118742
118963
  endpoint,
@@ -118787,7 +119008,7 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
118787
119008
  return { run };
118788
119009
  }
118789
119010
  const wireResult2 = await makeRequest({
118790
- endpoint: `/v1/runs/${id2}/events`,
119011
+ endpoint: `/v1/runs/${encodeURIComponent(id2)}/events`,
118791
119012
  options: { method: "POST" },
118792
119013
  data,
118793
119014
  config: config2,
@@ -118801,7 +119022,7 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
118801
119022
  throw new WorkflowAPIError(validationError, { status: 400 });
118802
119023
  }
118803
119024
  }
118804
- const runIdPath = id2 === null ? "null" : id2;
119025
+ const runIdPath = id2 === null ? "null" : encodeURIComponent(id2);
118805
119026
  const remoteRefBehavior = eventsNeedingResolve.has(data.eventType) ? "resolve" : "lazy";
118806
119027
  if (remoteRefBehavior === "resolve") {
118807
119028
  const wireResult2 = await makeRequest({
@@ -118872,7 +119093,7 @@ async function listHooks(params, config2) {
118872
119093
  }
118873
119094
  async function getHook(hookId, params, config2) {
118874
119095
  const resolveData = (params == null ? void 0 : params.resolveData) || "all";
118875
- const endpoint = `/v2/hooks/${hookId}`;
119096
+ const endpoint = `/v2/hooks/${encodeURIComponent(hookId)}`;
118876
119097
  const hook = await makeRequest({
118877
119098
  endpoint,
118878
119099
  options: { method: "GET" },
@@ -118974,7 +119195,7 @@ function createStorage(config2) {
118974
119195
  }
118975
119196
  function getStreamUrl(name2, runId, httpConfig) {
118976
119197
  if (runId) {
118977
- return new URL(`${httpConfig.baseUrl}/v2/runs/${runId}/stream/${encodeURIComponent(name2)}`);
119198
+ return new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/stream/${encodeURIComponent(name2)}`);
118978
119199
  }
118979
119200
  return new URL(`${httpConfig.baseUrl}/v2/stream/${encodeURIComponent(name2)}`);
118980
119201
  }
@@ -119053,7 +119274,7 @@ function createStreamer(config2) {
119053
119274
  },
119054
119275
  async listStreamsByRunId(runId) {
119055
119276
  const httpConfig = await getHttpConfig(config2);
119056
- const url2 = new URL(`${httpConfig.baseUrl}/v2/runs/${runId}/streams`);
119277
+ const url2 = new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/streams`);
119057
119278
  const response2 = await fetch(url2, {
119058
119279
  headers: httpConfig.headers
119059
119280
  });
@@ -119071,7 +119292,8 @@ function createVercelWorld(config2) {
119071
119292
  ...createQueue$1(config2),
119072
119293
  ...createStorage(config2),
119073
119294
  ...createStreamer(config2),
119074
- 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)
119075
119297
  };
119076
119298
  }
119077
119299
  const require$1 = createRequire$1(join$1(process.cwd(), "index.js"));
@@ -122312,7 +122534,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
122312
122534
  });
122313
122535
  });
122314
122536
  }
122315
- const version = "4.2.0-beta.68";
122537
+ const version = "4.2.0-beta.69";
122316
122538
  const ulid = monotonicFactory();
122317
122539
  async function start$1(workflow, argsOrOptions, options) {
122318
122540
  return await waitedUntil(() => {
@@ -122337,7 +122559,13 @@ async function start$1(workflow, argsOrOptions, options) {
122337
122559
  ...WorkflowArgumentsCount(args.length)
122338
122560
  });
122339
122561
  const world = (opts == null ? void 0 : opts.world) ?? getWorld();
122340
- 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
+ }
122341
122569
  const ops = [];
122342
122570
  const runId = `wrun_${ulid()}`;
122343
122571
  const traceCarrier = await serializeTraceCarrier();
@@ -122553,6 +122781,17 @@ class Run {
122553
122781
  specVersion: SPEC_VERSION_CURRENT
122554
122782
  });
122555
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
+ }
122556
122795
  /**
122557
122796
  * The status of the workflow run.
122558
122797
  */
@@ -147215,7 +147454,8 @@ function RunDetailView({
147215
147454
  events: allEvents,
147216
147455
  run,
147217
147456
  onLoadEventData: handleLoadEventData,
147218
- encryptionKey: encryptionKey ?? void 0
147457
+ encryptionKey: encryptionKey ?? void 0,
147458
+ isLoading: loading
147219
147459
  }
147220
147460
  ) }) }) }),
147221
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: [
@@ -147478,7 +147718,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
147478
147718
  __proto__: null,
147479
147719
  loader
147480
147720
  }, Symbol.toStringTag, { value: "Module" }));
147481
- 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-D-041AAq.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.js"], "css": ["/assets/root-9gRDb_Jz.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-Xl3EX8M3.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-C-GqGBPl.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.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-BPOihWwO.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-C-GqGBPl.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.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-0e172cba.js", "version": "0e172cba", "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 };
147482
147722
  const assetsBuildDirectory = "build/client";
147483
147723
  const basename = "/";
147484
147724
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };