@workflow/web 5.3.2 → 5.3.3

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 (35) hide show
  1. package/build/client/assets/app-CmaRLUwS.css +1 -0
  2. package/build/client/assets/arrow-up-right-AHTyWXU2.js +9 -0
  3. package/build/client/assets/{entry.client-xzxVCL3o.js → entry.client-BqbaswKw.js} +13 -35
  4. package/build/client/assets/{highlighted-body-JLMTFACH-1yzOVKg0.js → highlighted-body-JLMTFACH-_kzpqYmW.js} +2 -2
  5. package/build/client/assets/{home--wf0CrF6.js → home-DjUPTrY5.js} +91 -161
  6. package/build/client/assets/{index-wl5l5E8H.js → index-BUQuaV5X.js} +78 -149
  7. package/build/client/assets/{manifest-7b81d8d4.js → manifest-9126df65.js} +1 -1
  8. package/build/client/assets/{mermaid-WFAXDIZX-CB__BxYb.js → mermaid-WFAXDIZX-CNo_0yWo.js} +1236 -1340
  9. package/build/client/assets/mermaid-WFAXDIZX-F88p7PFX.css +1 -0
  10. package/build/client/assets/{root-C1XwTNUK.js → root-Bh-E5He-.js} +7 -31
  11. package/build/client/assets/root-kJB77No4.css +1 -0
  12. package/build/client/assets/{rpc-client-SbyXJdFV.js → rpc-client-DL_nSX36.js} +3 -4
  13. package/build/client/assets/{run-detail-2CnpdXm1.js → run-detail-5dPVsaSm.js} +121 -203
  14. package/build/client/assets/{run-usage-DRV6lopZ.js → run-usage-BEswHGKU.js} +15 -24
  15. package/build/client/assets/{run-usage-C3aywyqa.js → run-usage-C_wyncgV.js} +5 -5
  16. package/build/client/assets/{skeleton-DMLgjvZZ.js → skeleton-DE14mNQw.js} +3 -21
  17. package/build/client/assets/{url-state-JAVaNZ_m.js → url-state-5GKQwo-f.js} +471 -702
  18. package/build/client/assets/{zstd-browser-decoder-Z5736ep5.js → zstd-browser-decoder-CbTMLAMd.js} +2 -2
  19. package/build/server/assets/{app-C4Vf0mu1.js → app-C-e60j14.js} +11450 -12386
  20. package/build/server/assets/{esm-CETb4fkq.js → esm-BzrGWk7J.js} +2 -2
  21. package/build/server/assets/{highlighted-body-JLMTFACH-CF_5tt3-.js → highlighted-body-JLMTFACH-B7y0X_Kn.js} +1 -1
  22. package/build/server/assets/{index-BrYeW--s.js → index-DRDsjR--.js} +398 -490
  23. package/build/server/assets/{mermaid-WFAXDIZX-BHZz_uL6.js → mermaid-WFAXDIZX-MsPxEM1Y.js} +1 -1
  24. package/build/server/assets/{token-B94O3LuJ.js → token-CKgyaeCJ.js} +5 -5
  25. package/build/server/assets/{token-k0na1G9v.js → token-DXh0TnqB.js} +6 -6
  26. package/build/server/assets/{token-util-DFlzY9Hw.js → token-util-CCc0uYVy.js} +2 -2
  27. package/build/server/assets/{token-util-DgTmPzWb.js → token-util-DOHYMq7D.js} +1 -1
  28. package/build/server/assets/{wrapper-BEqyNEir.js → wrapper-BzLz38Oh.js} +2 -2
  29. package/build/server/assets/{zstd-browser-decoder-LnaKiDUZ.js → zstd-browser-decoder-BSSEC3XP.js} +1 -1
  30. package/build/server/index.js +1 -1
  31. package/package.json +8 -8
  32. package/build/client/assets/app-BHCSMHev.css +0 -1
  33. package/build/client/assets/arrow-up-right-DyaB_ak4.js +0 -15
  34. package/build/client/assets/mermaid-WFAXDIZX-D8CjRQta.css +0 -1
  35. package/build/client/assets/root-C3ED6Dwc.css +0 -1
@@ -1,16 +1,10 @@
1
- import { j as jsxRuntimeExports, r as reactExports, L as Link, B as useNavigate, E as useOutlet, w as withComponentProps, G as useParams, C as useSearchParams } from "./index-wl5l5E8H.js";
2
- import { U as findStartHookCreation, q as ChevronUp, X, x as CircleX, V as Wrench, Y as ErrorCard, _ as format, R as ResolveHookModal, Q as ErrorBoundary, u as unwrapOrThrow, W as WorkflowWebAPIError, K as unwrapServerActionResult, $ as useInfiniteList, e as getErrorMessage, A as Alert, b as AlertTitle, d as AlertDescription, I as DialogPortal, J as DialogOverlay, a0 as createDialogScope, z as Dialog, a1 as DialogTrigger, B as DialogContent, G as DialogTitle, H as DialogDescription, F as DialogClose, a2 as LIVE_UPDATE_INTERVAL_MS$1, a3 as LAYOUT, a4 as tabsListClassName, a5 as tabsTriggerClassName, M as useOptimisticSearchParams, a6 as wakeUpRun, r as resumeHook, c as getErrorTitle, a7 as RunActionsButtons, w as StatusBadge, C as CopyableText, a as RelativeTime, T as Tabs, N as TabsList, O as TabsTrigger, P as TabsContent, a8 as cancelRun, a9 as recreateRun } from "./url-state-JAVaNZ_m.js";
3
- import { c as createLucideIcon, Q as isSlotEventId, U as classifyEntityEvent, X as TERMINAL_EVENT_CLASSES, Y as isSealedNoopEvent$1, j as formatDurationPrecise, Z as isStepEventType, $ as isWaitEventType, a0 as isHookLifecycleEventType, a1 as isEncryptedMarker, a2 as isTerminalStepEventType, a3 as isRunCreationEvent, a as cn, a4 as CopyButton, a5 as CopyableDataBlock, a6 as CollapsibleRoot, a7 as CollapsibleTrigger, a8 as CollapsibleContent, O as cva, a9 as RESERVED_ATTRIBUTE_KEY_PREFIX, T as Tooltip, d as TooltipTrigger, aa as IconButton, e as TooltipContent, L as ChevronDown, B as Button, ab as Lock, ac as getEventDataRefFields, ad as Collapsible, ae as Skeleton, af as DecryptClickContext, ag as DataInspector, ah as serializeForClipboard, ai as TooltipProvider, aj as TimestampTooltip, ak as ContextCardProvider, al as es, am as Ui, n as Check, an as RunClickContext, ao as StreamClickContext, ap as isExpiredMarker, aq as isDoStreamStep, ar as extractConversation, as as EncryptedDataBlock, S as Spinner, at as hasEncryptedFields, m as useToast, au as useSidebarDataOptional, av as isTerminalWorkflowRunStatus, aw as useActiveSpan, ax as useSidebarData, ay as ActiveSpanProvider, az as useReducedMotion, aA as searchSpans, aB as computeRootBounds, aC as computeTimeMarkers, aD as clampViewportToRoot, aE as getHighResInMs, aF as scrollRowIntoView, aG as TIMELINE_PADDING_PX, b as ROW_HEIGHT_PX, aH as Minimap, aI as Timeline, aJ as TimelineHeader, aK as wheelZoomScaleFactor, aL as wheelDeltaToPixels, aM as SidebarDataProvider, aN as hydrateResourceIOAsync, aO as createStateResolver, aP as deriveRunPayloadKeys, aQ as decodePayloadWithKey, aR as stateSourceId, aS as getWebRevivers, aT as hydrateResourceIO, y as createContextScope, p as useComposedRefs, A as composeEventHandlers, aU as buttonVariants, aV as Slot, C as ChevronRight, aW as isEncryptedData, aX as hydrateData, aY as decrypt, aZ as getStreamImageType, a_ as SerializationFormat, t as toast, a$ as StreamViewerSkeleton, b0 as StreamViewer } from "./mermaid-WFAXDIZX-CB__BxYb.js";
4
- import { p as parseStepName, a as parseWorkflowName, b as CircleAlert, S as Skeleton$1 } from "./skeleton-DMLgjvZZ.js";
5
- import { M as MiddleTruncate, a as ResourceIcon, E as EventList, r as runUsagePath, b as runPath, c as RunUsageHeaderStats, C as CircleQuestionMark, u as usageVisible } from "./run-usage-DRV6lopZ.js";
6
- import { A as ArrowUpRight } from "./arrow-up-right-DyaB_ak4.js";
7
- import { d as fetchHook, a as fetchEvents, b as fetchRun, e as fetchStep, g as fetchStreams, h as apiBase, i as fetchEvent, j as fetchEventsByCorrelationId, k as fetchRunUsage, u as useServerConfig, l as getEncryptionKeyForRun } from "./rpc-client-SbyXJdFV.js";
8
- /**
9
- * @license lucide-react v0.575.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */
1
+ import { j as jsxRuntimeExports, r as reactExports, L as Link, B as useNavigate, E as useOutlet, w as withComponentProps, G as useParams, C as useSearchParams } from "./index-BUQuaV5X.js";
2
+ import { U as findStartHookCreation, q as ChevronUp, X, x as CircleX, V as Wrench, Y as ErrorCard, _ as format, R as ResolveHookModal, Q as ErrorBoundary, u as unwrapOrThrow, W as WorkflowWebAPIError, K as unwrapServerActionResult, $ as useInfiniteList, e as getErrorMessage, A as Alert, b as AlertTitle, d as AlertDescription, I as DialogPortal, J as DialogOverlay, a0 as createDialogScope, z as Dialog, a1 as DialogTrigger, B as DialogContent, G as DialogTitle, H as DialogDescription, F as DialogClose, a2 as LIVE_UPDATE_INTERVAL_MS$1, a3 as LAYOUT, a4 as tabsListClassName, a5 as tabsTriggerClassName, M as useOptimisticSearchParams, a6 as wakeUpRun, r as resumeHook, c as getErrorTitle, a7 as RunActionsButtons, w as StatusBadge, C as CopyableText, a as RelativeTime, T as Tabs, N as TabsList, O as TabsTrigger, P as TabsContent, a8 as cancelRun, a9 as recreateRun } from "./url-state-5GKQwo-f.js";
3
+ import { c as createLucideIcon, Q as isSlotEventId, U as classifyEntityEvent, X as TERMINAL_EVENT_CLASSES, Y as isSealedNoopEvent$1, j as formatDurationPrecise, Z as isStepEventType, $ as isWaitEventType, a0 as isHookLifecycleEventType, a1 as isEncryptedMarker, a2 as isTerminalStepEventType, a3 as isRunCreationEvent, a as cn, a4 as CopyButton, a5 as CopyableDataBlock, a6 as CollapsibleRoot, a7 as CollapsibleTrigger, a8 as CollapsibleContent, O as cva, a9 as RESERVED_ATTRIBUTE_KEY_PREFIX, T as Tooltip, d as TooltipTrigger, aa as IconButton, e as TooltipContent, L as ChevronDown, B as Button, ab as Lock, ac as getEventDataRefFields, ad as Collapsible, ae as Skeleton, af as DecryptClickContext, ag as DataInspector, ah as serializeForClipboard, ai as TooltipProvider, aj as TimestampTooltip, ak as ContextCardProvider, al as es, am as Ui, n as Check, an as RunClickContext, ao as StreamClickContext, ap as isExpiredMarker, aq as isDoStreamStep, ar as extractConversation, as as EncryptedDataBlock, S as Spinner, at as hasEncryptedFields, m as useToast, au as useSidebarDataOptional, av as isTerminalWorkflowRunStatus, aw as useActiveSpan, ax as useSidebarData, ay as ActiveSpanProvider, az as useReducedMotion, aA as searchSpans, aB as computeRootBounds, aC as computeTimeMarkers, aD as clampViewportToRoot, aE as getHighResInMs, aF as scrollRowIntoView, aG as TIMELINE_PADDING_PX, b as ROW_HEIGHT_PX, aH as Minimap, aI as Timeline, aJ as TimelineHeader, aK as wheelZoomScaleFactor, aL as wheelDeltaToPixels, aM as SidebarDataProvider, aN as hydrateResourceIOAsync, aO as createStateResolver, aP as deriveRunPayloadKeys, aQ as decodePayloadWithKey, aR as stateSourceId, aS as getWebRevivers, aT as hydrateResourceIO, y as createContextScope, p as useComposedRefs, A as composeEventHandlers, aU as buttonVariants, aV as Slot, C as ChevronRight, aW as isEncryptedData, aX as hydrateData, aY as decrypt, aZ as getStreamImageType, a_ as SerializationFormat, t as toast, a$ as StreamViewerSkeleton, b0 as StreamViewer } from "./mermaid-WFAXDIZX-CNo_0yWo.js";
4
+ import { p as parseStepName, a as parseWorkflowName, b as CircleAlert, S as Skeleton$1 } from "./skeleton-DE14mNQw.js";
5
+ import { M as MiddleTruncate, a as ResourceIcon, E as EventList, r as runUsagePath, b as runPath, c as RunUsageHeaderStats, C as CircleQuestionMark, u as usageVisible } from "./run-usage-BEswHGKU.js";
6
+ import { A as ArrowUpRight } from "./arrow-up-right-AHTyWXU2.js";
7
+ import { d as fetchHook, a as fetchEvents, b as fetchRun, e as fetchStep, g as fetchStreams, h as apiBase, i as fetchEvent, j as fetchEventsByCorrelationId, k as fetchRunUsage, u as useServerConfig, l as getEncryptionKeyForRun } from "./rpc-client-DL_nSX36.js";
14
8
  const __iconNode$9 = [
15
9
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
16
10
  ["path", { d: "M18 17V9", key: "2bz60n" }],
@@ -18,12 +12,6 @@ const __iconNode$9 = [
18
12
  ["path", { d: "M8 17v-3", key: "17ska0" }]
19
13
  ];
20
14
  const ChartColumn = createLucideIcon("chart-column", __iconNode$9);
21
- /**
22
- * @license lucide-react v0.575.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
15
  const __iconNode$8 = [
28
16
  ["path", { d: "M10 6h8", key: "zvc2xc" }],
29
17
  ["path", { d: "M12 16h6", key: "yi5mkt" }],
@@ -31,24 +19,12 @@ const __iconNode$8 = [
31
19
  ["path", { d: "M8 11h7", key: "wz2hg0" }]
32
20
  ];
33
21
  const ChartGantt = createLucideIcon("chart-gantt", __iconNode$8);
34
- /**
35
- * @license lucide-react v0.575.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */
40
22
  const __iconNode$7 = [
41
23
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
42
24
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
43
25
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
44
26
  ];
45
27
  const Info = createLucideIcon("info", __iconNode$7);
46
- /**
47
- * @license lucide-react v0.575.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */
52
28
  const __iconNode$6 = [
53
29
  ["path", { d: "M3 5h.01", key: "18ugdj" }],
54
30
  ["path", { d: "M3 12h.01", key: "nlz23k" }],
@@ -58,45 +34,21 @@ const __iconNode$6 = [
58
34
  ["path", { d: "M8 19h13", key: "m83p4d" }]
59
35
  ];
60
36
  const List = createLucideIcon("list", __iconNode$6);
61
- /**
62
- * @license lucide-react v0.575.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */
67
37
  const __iconNode$5 = [
68
38
  ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
69
39
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
70
40
  ];
71
41
  const LockOpen = createLucideIcon("lock-open", __iconNode$5);
72
- /**
73
- * @license lucide-react v0.575.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */
78
42
  const __iconNode$4 = [
79
43
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
80
44
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
81
45
  ];
82
46
  const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$4);
83
- /**
84
- * @license lucide-react v0.575.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */
89
47
  const __iconNode$3 = [
90
48
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
91
49
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
92
50
  ];
93
51
  const Search = createLucideIcon("search", __iconNode$3);
94
- /**
95
- * @license lucide-react v0.575.0 - ISC
96
- *
97
- * This source code is licensed under the ISC license.
98
- * See the LICENSE file in the root directory of this source tree.
99
- */
100
52
  const __iconNode$2 = [
101
53
  [
102
54
  "path",
@@ -109,12 +61,6 @@ const __iconNode$2 = [
109
61
  ["path", { d: "M12 17h.01", key: "p32p05" }]
110
62
  ];
111
63
  const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$2);
112
- /**
113
- * @license lucide-react v0.575.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */
118
64
  const __iconNode$1 = [
119
65
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
120
66
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
@@ -122,12 +68,6 @@ const __iconNode$1 = [
122
68
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
123
69
  ];
124
70
  const ZoomIn = createLucideIcon("zoom-in", __iconNode$1);
125
- /**
126
- * @license lucide-react v0.575.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */
131
71
  const __iconNode = [
132
72
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
133
73
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
@@ -278,14 +218,13 @@ function getEventResource(event, entity) {
278
218
  return entity.kind === "wait" ? "sleep" : entity.kind;
279
219
  }
280
220
  function buildNameMaps(events, run) {
281
- var _a, _b, _c;
282
221
  const correlationNameMap = /* @__PURE__ */ new Map();
283
222
  const hookNameMap = /* @__PURE__ */ new Map();
284
223
  for (const event of events ?? []) {
285
224
  if (!event.correlationId)
286
225
  continue;
287
226
  if (event.eventType === "hook_created") {
288
- const token = (_a = event.eventData) == null ? void 0 : _a.token;
227
+ const token = event.eventData?.token;
289
228
  if (typeof token === "string")
290
229
  hookNameMap.set(event.correlationId, token);
291
230
  continue;
@@ -293,16 +232,16 @@ function buildNameMaps(events, run) {
293
232
  if (event.eventType !== "step_created" && event.eventType !== "step_started") {
294
233
  continue;
295
234
  }
296
- const stepName = (_b = event.eventData) == null ? void 0 : _b.stepName;
235
+ const stepName = event.eventData?.stepName;
297
236
  if (typeof stepName !== "string")
298
237
  continue;
299
238
  if (event.eventType === "step_started" && correlationNameMap.has(event.correlationId)) {
300
239
  continue;
301
240
  }
302
241
  const parsed = parseStepName(stepName) ?? parseWorkflowName(stepName);
303
- correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
242
+ correlationNameMap.set(event.correlationId, parsed?.shortName ?? stepName);
304
243
  }
305
- const workflowName = (run == null ? void 0 : run.workflowName) ? ((_c = parseWorkflowName(run.workflowName)) == null ? void 0 : _c.shortName) ?? run.workflowName : null;
244
+ const workflowName = run?.workflowName ? parseWorkflowName(run.workflowName)?.shortName ?? run.workflowName : null;
306
245
  return { correlationNameMap, hookNameMap, workflowName };
307
246
  }
308
247
  function getEventName(entity, names) {
@@ -339,7 +278,7 @@ function buildEventTiming(events, duplicateEventIds = /* @__PURE__ */ new Set())
339
278
  switch (type) {
340
279
  case "step_created":
341
280
  case "run_created":
342
- clock.createdAt ?? (clock.createdAt = ts);
281
+ clock.createdAt ??= ts;
343
282
  break;
344
283
  case "step_started":
345
284
  if (clock.attempt === 0 && clock.createdAt !== void 0) {
@@ -444,7 +383,7 @@ function getEventMessage(event, queuedMs) {
444
383
  }
445
384
  }
446
385
  function getRunStartMs(events, run) {
447
- const created = parseEventDate(run == null ? void 0 : run.createdAt);
386
+ const created = parseEventDate(run?.createdAt);
448
387
  if (created)
449
388
  return created.getTime();
450
389
  let min;
@@ -464,7 +403,6 @@ function buildEventLookups(events, run, duplicateEventIds) {
464
403
  };
465
404
  }
466
405
  function buildEventRow(event, lookups) {
467
- var _a;
468
406
  const entity = getEventEntity(event);
469
407
  const segments = entity.key === null ? [] : lookups.timing.stepSegments.get(entity.key) ?? [];
470
408
  const ignored = lookups.duplicateEventIds.has(event.eventId) ? {
@@ -480,8 +418,8 @@ function buildEventRow(event, lookups) {
480
418
  level: ignored ? "muted" : getEventLevel(event),
481
419
  resource: getEventResource(event, entity),
482
420
  name: getEventName(entity, lookups.names),
483
- message: (ignored == null ? void 0 : ignored.message) ?? getEventMessage(event, (_a = segments.find((segment) => segment.kind === "queued")) == null ? void 0 : _a.ms),
484
- notice: ignored == null ? void 0 : ignored.notice,
421
+ message: ignored?.message ?? getEventMessage(event, segments.find((segment) => segment.kind === "queued")?.ms),
422
+ notice: ignored?.notice,
485
423
  segments,
486
424
  durationMs: lookups.timing.eventDurations.get(event.eventId),
487
425
  sinceStartMs: lookups.runStartMs === void 0 ? void 0 : getEffectiveEventTime(event) - lookups.runStartMs
@@ -621,7 +559,7 @@ const MARKER_EVENT_TYPES = /* @__PURE__ */ new Set([
621
559
  "attr_set"
622
560
  ]);
623
561
  const getEventTimestamp = (event) => {
624
- const value = (event == null ? void 0 : event.occurredAt) ?? (event == null ? void 0 : event.createdAt);
562
+ const value = event?.occurredAt ?? event?.createdAt;
625
563
  if (!value)
626
564
  return void 0;
627
565
  const date = value instanceof Date ? value : new Date(value);
@@ -641,7 +579,6 @@ function convertEventsToSpanEvents(events, filterTypes = true, options = {}) {
641
579
  }));
642
580
  }
643
581
  const waitEventsToWaitEntity = (events) => {
644
- var _a;
645
582
  const startEvent = events.find((event) => event.eventType === "wait_created");
646
583
  if (!startEvent) {
647
584
  return null;
@@ -651,7 +588,7 @@ const waitEventsToWaitEntity = (events) => {
651
588
  waitId: startEvent.correlationId,
652
589
  runId: startEvent.runId,
653
590
  createdAt: getEventTimestamp(startEvent) ?? startEvent.createdAt,
654
- resumeAt: ((_a = startEvent.eventData) == null ? void 0 : _a.resumeAt) ? new Date(startEvent.eventData.resumeAt) : void 0,
591
+ resumeAt: startEvent.eventData?.resumeAt ? new Date(startEvent.eventData.resumeAt) : void 0,
655
592
  completedAt: getEventTimestamp(completedEvent)
656
593
  };
657
594
  };
@@ -693,7 +630,6 @@ function waitToSpan(events, maxEndTime, fallbackEndTime = maxEndTime) {
693
630
  };
694
631
  }
695
632
  const stepEventsToStepEntity = (events) => {
696
- var _a, _b;
697
633
  const createdEvent = events.find((event) => event.eventType === "step_created");
698
634
  const anchorEvent = createdEvent ?? events[0];
699
635
  const firstStartedEvent = events.find((event) => event.eventType === "step_started");
@@ -733,11 +669,11 @@ const stepEventsToStepEntity = (events) => {
733
669
  return {
734
670
  stepId: anchorEvent.correlationId ?? "",
735
671
  runId: anchorEvent.runId,
736
- stepName: ((_a = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a.stepName) ?? ((_b = firstStartedEvent == null ? void 0 : firstStartedEvent.eventData) == null ? void 0 : _b.stepName) ?? "",
672
+ stepName: createdEvent?.eventData?.stepName ?? firstStartedEvent?.eventData?.stepName ?? "",
737
673
  status,
738
674
  attempt,
739
675
  createdAt: getEventTimestamp(anchorEvent) ?? anchorEvent.createdAt,
740
- updatedAt: getEventTimestamp(lastEvent) ?? (lastEvent == null ? void 0 : lastEvent.createdAt) ?? anchorEvent.createdAt,
676
+ updatedAt: getEventTimestamp(lastEvent) ?? lastEvent?.createdAt ?? anchorEvent.createdAt,
741
677
  startedAt,
742
678
  completedAt,
743
679
  specVersion: anchorEvent.specVersion
@@ -752,7 +688,7 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
752
688
  const attributes = {
753
689
  resource: "step",
754
690
  data: {
755
- ...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
691
+ ...getStepAttributes?.(stepEvents),
756
692
  // Canonical event-derived fields cannot be overridden by extensions.
757
693
  ...step
758
694
  }
@@ -775,7 +711,7 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
775
711
  }
776
712
  return {
777
713
  spanId: String(step.stepId),
778
- name: (parsedName == null ? void 0 : parsedName.shortName) ?? String(step.stepName),
714
+ name: parsedName?.shortName ?? String(step.stepName),
779
715
  kind: 1,
780
716
  // INTERNAL span kind
781
717
  resource,
@@ -793,12 +729,11 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
793
729
  };
794
730
  }
795
731
  const hookEventsToHookEntity = (events, startHook) => {
796
- var _a;
797
732
  const createdEvent = events.find((event) => event.eventType === "hook_created");
798
733
  const creation = createdEvent ? {
799
734
  hookId: createdEvent.correlationId,
800
735
  runId: createdEvent.runId,
801
- token: (_a = createdEvent.eventData) == null ? void 0 : _a.token,
736
+ token: createdEvent.eventData?.token,
802
737
  createdAt: getEventTimestamp(createdEvent) ?? createdEvent.createdAt
803
738
  } : startHook && events.every((event) => event.correlationId === startHook.hookId) ? startHook : void 0;
804
739
  if (!creation) {
@@ -845,7 +780,6 @@ function hookToSpan(hookEvents, maxEndTime, startHook) {
845
780
  };
846
781
  }
847
782
  function runToSpan(run, runEvents, nowTime) {
848
- var _a, _b;
849
783
  const now = nowTime ?? /* @__PURE__ */ new Date();
850
784
  const runCreatedEvent = runEvents.find(isRunCreationEvent);
851
785
  const runStartedEvent = runEvents.find((event) => event.eventType === "run_started");
@@ -854,8 +788,8 @@ function runToSpan(run, runEvents, nowTime) {
854
788
  const activeStartTime = getEventTimestamp(runStartedEvent) ?? (run.startedAt ? new Date(run.startedAt) : void 0);
855
789
  const completedAt = getEventTimestamp(terminalEvent) ?? run.completedAt ?? void 0;
856
790
  const endTime = completedAt ?? now;
857
- const wasCancelled = run.status === "cancelled" || (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled";
858
- const cancelReason = (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled" && typeof ((_a = terminalEvent.eventData) == null ? void 0 : _a.cancelReason) === "string" ? terminalEvent.eventData.cancelReason : null;
791
+ const wasCancelled = run.status === "cancelled" || terminalEvent?.eventType === "run_cancelled";
792
+ const cancelReason = terminalEvent?.eventType === "run_cancelled" && typeof terminalEvent.eventData?.cancelReason === "string" ? terminalEvent.eventData.cancelReason : null;
859
793
  const { input: _i, output: _o, error: _e, ...runIdentity } = run;
860
794
  const attributes = {
861
795
  resource: "run",
@@ -872,7 +806,7 @@ function runToSpan(run, runEvents, nowTime) {
872
806
  });
873
807
  return {
874
808
  spanId: String(run.runId),
875
- name: String(((_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName) ?? "?"),
809
+ name: String(parseWorkflowName(run.workflowName)?.shortName ?? "?"),
876
810
  kind: 1,
877
811
  // INTERNAL span kind
878
812
  resource: "run",
@@ -954,7 +888,7 @@ function buildSpans(run, groupedEvents, now, latestKnownTime, startHook, getStep
954
888
  if (startHook && !hookEventGroups.has(startHook.hookId)) {
955
889
  hookEventGroups.set(startHook.hookId, []);
956
890
  }
957
- const hookSpans = Array.from(hookEventGroups).map(([hookId, events]) => hookToSpan(events, childMaxEnd, hookId === (startHook == null ? void 0 : startHook.hookId) ? startHook : void 0)).filter((span) => span !== null);
891
+ const hookSpans = Array.from(hookEventGroups).map(([hookId, events]) => hookToSpan(events, childMaxEnd, hookId === startHook?.hookId ? startHook : void 0)).filter((span) => span !== null);
958
892
  const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events) => waitToSpan(events, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
959
893
  return {
960
894
  runSpan: runToSpan(run, groupedEvents.runLevelEvents, now),
@@ -1249,7 +1183,7 @@ function DraggableBorder({ element, position, onWidthChange, onReset, "aria-labe
1249
1183
  if (movedRef.current || performance.now() - lastDragEndAtRef.current < 500) {
1250
1184
  return;
1251
1185
  }
1252
- onReset == null ? void 0 : onReset();
1186
+ onReset?.();
1253
1187
  };
1254
1188
  const handleKeyDown = (e) => {
1255
1189
  const el = element.current;
@@ -1513,18 +1447,17 @@ function SearchInput({ value, onValueChange, label, className, id, onKeyDown, on
1513
1447
  };
1514
1448
  }, []);
1515
1449
  const clear = () => {
1516
- var _a;
1517
1450
  onValueChange("");
1518
- (_a = inputRef.current) == null ? void 0 : _a.focus();
1451
+ inputRef.current?.focus();
1519
1452
  };
1520
1453
  return jsxRuntimeExports.jsxs("div", { className: cn("@container flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-gray-alpha-400 bg-background-100 pr-2", focusVisible && "[outline:var(--ds-focus-ring-outline,2px_solid_var(--ds-focus-color))] -outline-offset-2", className), children: [jsxRuntimeExports.jsx("label", { htmlFor: inputId, className: "sr-only", children: label }), jsxRuntimeExports.jsx(Search, { "aria-hidden": true, className: "size-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { ...props, ref: inputRef, id: inputId, type: "search", autoComplete: "off", spellCheck: false, value, onChange: (e) => onValueChange(e.target.value), onFocus: (e) => {
1521
- onFocus == null ? void 0 : onFocus(e);
1454
+ onFocus?.(e);
1522
1455
  setFocusVisible(lastInputRef.current === "keyboard");
1523
1456
  }, onBlur: (e) => {
1524
- onBlur == null ? void 0 : onBlur(e);
1457
+ onBlur?.(e);
1525
1458
  setFocusVisible(false);
1526
1459
  }, onKeyDown: (e) => {
1527
- onKeyDown == null ? void 0 : onKeyDown(e);
1460
+ onKeyDown?.(e);
1528
1461
  if (e.defaultPrevented)
1529
1462
  return;
1530
1463
  if (e.key === "Escape" && value) {
@@ -1692,7 +1625,7 @@ function useEventSearch(onExactIdSearch) {
1692
1625
  }
1693
1626
  if (!onExactIdSearch)
1694
1627
  return { status: "unavailable", query: trimmed };
1695
- if ((outcome == null ? void 0 : outcome.query) !== trimmed || outcome.attempt !== attempt) {
1628
+ if (outcome?.query !== trimmed || outcome.attempt !== attempt) {
1696
1629
  return { status: "loading", query: trimmed, id: parsed };
1697
1630
  }
1698
1631
  return { ...outcome.answer, query: trimmed, id: parsed };
@@ -1709,7 +1642,7 @@ function useElementWidth(ref, enabled = true) {
1709
1642
  return;
1710
1643
  setWidth(Math.round(el.getBoundingClientRect().width));
1711
1644
  const observer = new ResizeObserver(([entry]) => {
1712
- setWidth(Math.round((entry == null ? void 0 : entry.contentRect.width) ?? 0));
1645
+ setWidth(Math.round(entry?.contentRect.width ?? 0));
1713
1646
  });
1714
1647
  observer.observe(el);
1715
1648
  return () => observer.disconnect();
@@ -1764,7 +1697,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1764
1697
  const event = knownEvents.find((e) => e.eventId === selectedEventId);
1765
1698
  return event ? buildEventRow(event, lookups) : void 0;
1766
1699
  }, [selectedEventId, knownEvents, lookups]);
1767
- const relatedKey = search.status === "ok" ? search.id.kind === "event" ? getEventEntity(search.events[0]).key : search.id.id : (selectedRow == null ? void 0 : selectedRow.entity.key) ?? null;
1700
+ const relatedKey = search.status === "ok" ? search.id.kind === "event" ? getEventEntity(search.events[0]).key : search.id.id : selectedRow?.entity.key ?? null;
1768
1701
  const [visibleRange, setVisibleRange] = reactExports.useState({
1769
1702
  startIndex: 0,
1770
1703
  endIndex: 0
@@ -1772,14 +1705,11 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1772
1705
  const relatedIndexes = reactExports.useMemo(() => listItems.flatMap((item, i) => item.kind === "event" && item.row.entity.key === relatedKey ? [i] : []), [listItems, relatedKey]);
1773
1706
  const relatedAbove = relatedIndexes.filter((i) => i < visibleRange.startIndex);
1774
1707
  const relatedBelow = relatedIndexes.filter((i) => i > visibleRange.endIndex);
1775
- const scrollToItem = (index) => {
1776
- var _a;
1777
- return (_a = virtuosoRef.current) == null ? void 0 : _a.scrollToIndex({
1778
- index,
1779
- align: "center",
1780
- behavior: "smooth"
1781
- });
1782
- };
1708
+ const scrollToItem = (index) => virtuosoRef.current?.scrollToIndex({
1709
+ index,
1710
+ align: "center",
1711
+ behavior: "smooth"
1712
+ });
1783
1713
  const eventDataCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
1784
1714
  const cacheEventData = reactExports.useCallback((eventId, data) => {
1785
1715
  eventDataCacheRef.current.set(eventId, data);
@@ -1792,7 +1722,6 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1792
1722
  const isRefetching = isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
1793
1723
  const selectedIndex = selectedEventId ? rows.findIndex((row) => row.event.eventId === selectedEventId) : -1;
1794
1724
  const moveSelection = reactExports.useCallback((delta) => {
1795
- var _a;
1796
1725
  if (rows.length === 0)
1797
1726
  return;
1798
1727
  const nextIndex = selectedIndex === -1 ? 0 : Math.min(Math.max(selectedIndex + delta, 0), rows.length - 1);
@@ -1800,11 +1729,10 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1800
1729
  setSelectedEventId(next.eventId);
1801
1730
  const itemIndex = listItems.findIndex((item) => item.kind === "event" && item.row.event.eventId === next.eventId);
1802
1731
  if (itemIndex >= 0) {
1803
- (_a = virtuosoRef.current) == null ? void 0 : _a.scrollIntoView({ index: itemIndex });
1732
+ virtuosoRef.current?.scrollIntoView({ index: itemIndex });
1804
1733
  }
1805
1734
  requestAnimationFrame(() => {
1806
- var _a2, _b;
1807
- (_b = (_a2 = bodyRef.current) == null ? void 0 : _a2.querySelector(`[data-event-id="${CSS.escape(next.eventId)}"]`)) == null ? void 0 : _b.focus();
1735
+ bodyRef.current?.querySelector(`[data-event-id="${CSS.escape(next.eventId)}"]`)?.focus();
1808
1736
  });
1809
1737
  }, [selectedIndex, rows, listItems]);
1810
1738
  const handleListKeyDown = reactExports.useCallback((e) => {
@@ -1830,7 +1758,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1830
1758
  return item.kind === "gap" ? item.key : item.row.event.eventId;
1831
1759
  }, endReached: () => {
1832
1760
  if (list.hasMore && !isLoadingMoreEvents) {
1833
- void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
1761
+ void onLoadMoreEvents?.();
1834
1762
  }
1835
1763
  }, components: { Footer: () => jsxRuntimeExports.jsx("div", { className: "h-2" }) }, itemContent: (i) => {
1836
1764
  const item = listItems[i];
@@ -1843,7 +1771,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
1843
1771
  }, style: { flex: 1, minHeight: 0 } }), relatedAbove.length > 0 && jsxRuntimeExports.jsx(RelatedHint, { direction: "above", count: relatedAbove.length, onClick: () => scrollToItem(relatedAbove.at(-1) ?? 0) }), relatedBelow.length > 0 && jsxRuntimeExports.jsx(RelatedHint, { direction: "below", count: relatedBelow.length, onClick: () => scrollToItem(relatedBelow[0]) })] }), jsxRuntimeExports.jsxs("div", { className: "relative flex h-10 shrink-0 items-center border-t border-gray-alpha-400 px-4 text-label-13 text-gray-900", children: [jsxRuntimeExports.jsx("span", { children: getFooterLabel(search, {
1844
1772
  total: sortedEvents.length,
1845
1773
  hasMoreEvents
1846
- }) }), list.hasMore && jsxRuntimeExports.jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(Button, { variant: "secondary", loading: isLoadingMoreEvents, onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()), children: "Load more" }) }) })] })] }), selectedRow ? jsxRuntimeExports.jsx(EventDetailsPanel, { row: selectedRow, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(selectedRow.event.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, width: panelWidth, onPrev: selectedIndex > 0 ? () => moveSelection(-1) : void 0, onNext: selectedIndex >= 0 && selectedIndex < rows.length - 1 ? () => moveSelection(1) : void 0, onClose: () => setSelectedEventId(void 0), onViewInTrace }) : null] })] }) });
1774
+ }) }), list.hasMore && jsxRuntimeExports.jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(Button, { variant: "secondary", loading: isLoadingMoreEvents, onClick: () => void onLoadMoreEvents?.(), children: "Load more" }) }) })] })] }), selectedRow ? jsxRuntimeExports.jsx(EventDetailsPanel, { row: selectedRow, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(selectedRow.event.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, width: panelWidth, onPrev: selectedIndex > 0 ? () => moveSelection(-1) : void 0, onNext: selectedIndex >= 0 && selectedIndex < rows.length - 1 ? () => moveSelection(1) : void 0, onClose: () => setSelectedEventId(void 0), onViewInTrace }) : null] })] }) });
1847
1775
  }
1848
1776
  function RelatedHint({ direction, count, onClick }) {
1849
1777
  const label = `${count} related ${count === 1 ? "event" : "events"}`;
@@ -1918,9 +1846,9 @@ function TraceViewerSkeleton() {
1918
1846
  }
1919
1847
  function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargin = "0%", freezeOnceVisible = false } = {}) {
1920
1848
  const [entry, setEntry] = reactExports.useState();
1921
- const frozen = (entry == null ? void 0 : entry.isIntersecting) && freezeOnceVisible;
1849
+ const frozen = entry?.isIntersecting && freezeOnceVisible;
1922
1850
  reactExports.useEffect(() => {
1923
- const node = elementRef == null ? void 0 : elementRef.current;
1851
+ const node = elementRef?.current;
1924
1852
  const hasIOSupport = !!window.IntersectionObserver;
1925
1853
  if (!hasIOSupport || frozen || !node)
1926
1854
  return;
@@ -1929,7 +1857,7 @@ function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargi
1929
1857
  };
1930
1858
  const observer = new IntersectionObserver(updateEntry, {
1931
1859
  threshold,
1932
- root: (rootRef == null ? void 0 : rootRef.current) ?? null,
1860
+ root: rootRef?.current ?? null,
1933
1861
  rootMargin
1934
1862
  });
1935
1863
  observer.observe(node);
@@ -1945,10 +1873,10 @@ function useLoadMoreOnScroll(loadMore, { hasMore, isLoadingMore, rootRef, rootMa
1945
1873
  loadMoreRef.current = loadMore;
1946
1874
  }, [loadMore]);
1947
1875
  reactExports.useEffect(() => {
1948
- if ((entry == null ? void 0 : entry.isIntersecting) && hasMore && !isLoadingMore) {
1876
+ if (entry?.isIntersecting && hasMore && !isLoadingMore) {
1949
1877
  loadMoreRef.current();
1950
1878
  }
1951
- }, [entry == null ? void 0 : entry.isIntersecting, hasMore, isLoadingMore]);
1879
+ }, [entry?.isIntersecting, hasMore, isLoadingMore]);
1952
1880
  return sentinelRef;
1953
1881
  }
1954
1882
  function ConversationView({ messages }) {
@@ -2018,17 +1946,17 @@ function parseContent(content) {
2018
1946
  if (typeof part === "string") {
2019
1947
  return { type: "text", text: part };
2020
1948
  }
2021
- if ((part == null ? void 0 : part.type) === "text") {
1949
+ if (part?.type === "text") {
2022
1950
  return { type: "text", text: String(part.text ?? "") };
2023
1951
  }
2024
- if ((part == null ? void 0 : part.type) === "tool-call") {
1952
+ if (part?.type === "tool-call") {
2025
1953
  return {
2026
1954
  type: "tool-call",
2027
1955
  toolName: part.toolName,
2028
1956
  input: part.input
2029
1957
  };
2030
1958
  }
2031
- if ((part == null ? void 0 : part.type) === "tool-result") {
1959
+ if (part?.type === "tool-result") {
2032
1960
  return {
2033
1961
  type: "tool-result",
2034
1962
  toolName: part.toolName,
@@ -2255,7 +2183,7 @@ const attributeToDisplayFn = {
2255
2183
  // A force-claimed hook (`experimental_force`): the run whose token it took.
2256
2184
  claimedFrom: (value) => {
2257
2185
  const from = value;
2258
- return typeof (from == null ? void 0 : from.runId) === "string" ? from.runId : null;
2186
+ return typeof from?.runId === "string" ? from.runId : null;
2259
2187
  },
2260
2188
  isWebhook: (value) => String(value),
2261
2189
  isSystem: (value) => String(value),
@@ -2313,7 +2241,7 @@ const attributeToDisplayFn = {
2313
2241
  },
2314
2242
  input: (value, context) => {
2315
2243
  if (isEncryptedMarker(value)) {
2316
- return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2244
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2317
2245
  }
2318
2246
  if (isExpiredMarker(value))
2319
2247
  return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
@@ -2322,31 +2250,31 @@ const attributeToDisplayFn = {
2322
2250
  const hasClosureVars = hasDisplayContent(closureVars);
2323
2251
  const hasThisVal = hasDisplayContent(thisVal);
2324
2252
  const hasArgs = hasDisplayContent(args);
2325
- if ((context == null ? void 0 : context.stepName) && isDoStreamStep(context.stepName)) {
2253
+ if (context?.stepName && isDoStreamStep(context.stepName)) {
2326
2254
  const conversation = extractConversation(args);
2327
2255
  if (conversation && conversation.length > 0) {
2328
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args, defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "This Value", children: JsonBlock(thisVal) })] });
2256
+ return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args, defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "This Value", children: JsonBlock(thisVal) })] });
2329
2257
  }
2330
2258
  }
2331
2259
  if (!hasArgs && !hasClosureVars && !hasThisVal) {
2332
2260
  return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
2333
2261
  }
2334
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: Array.isArray(args) ? args.map((v, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v) }, i)) : JsonBlock(args) }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "Context", children: JsonBlock(thisVal) })] });
2262
+ return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: Array.isArray(args) ? args.map((v, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v) }, i)) : JsonBlock(args) }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "Context", children: JsonBlock(thisVal) })] });
2335
2263
  }
2336
2264
  if (!hasDisplayContent(value)) {
2337
2265
  return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
2338
2266
  }
2339
- return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: Array.isArray(value) ? value.map((v, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v) }, i)) : JsonBlock(value) });
2267
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: Array.isArray(value) ? value.map((v, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v) }, i)) : JsonBlock(value) });
2340
2268
  },
2341
2269
  output: (value, context) => {
2342
2270
  if (isEncryptedMarker(value)) {
2343
- return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2271
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2344
2272
  }
2345
2273
  if (!hasDisplayContent(value))
2346
2274
  return null;
2347
2275
  if (isExpiredMarker(value))
2348
2276
  return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
2349
- return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: JsonBlock(value) });
2277
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: JsonBlock(value) });
2350
2278
  },
2351
2279
  error: (value) => {
2352
2280
  if (isEncryptedMarker(value)) {
@@ -2382,7 +2310,7 @@ const attributeToDisplayFn = {
2382
2310
  encryptionPublicKey: (_value) => null,
2383
2311
  // The token of the Hook `start({ experimental_hook })` created: the run's idempotency key.
2384
2312
  startHook: (value) => {
2385
- const token = value == null ? void 0 : value.token;
2313
+ const token = value?.token;
2386
2314
  return typeof token === "string" && token.length > 0 ? token : null;
2387
2315
  },
2388
2316
  // A dynamic run's own workflow code — the code the run actually executed,
@@ -2395,13 +2323,13 @@ const attributeToDisplayFn = {
2395
2323
  // decrypt flow is the gate on reading it.
2396
2324
  dynamicWorkflowCode: (value, context) => {
2397
2325
  if (isEncryptedMarker(value)) {
2398
- return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2326
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2399
2327
  }
2400
2328
  if (isExpiredMarker(value))
2401
2329
  return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
2402
2330
  if (typeof value !== "string" || value.trim().length === 0)
2403
2331
  return null;
2404
- return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context == null ? void 0 : context.sectionOpen, onOpenChange: context == null ? void 0 : context.onSectionOpenChange, children: jsxRuntimeExports.jsx(CopyableDataBlock, { data: value }) });
2332
+ return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(CopyableDataBlock, { data: value }) });
2405
2333
  }
2406
2334
  };
2407
2335
  const resolvableAttributes = [
@@ -2451,7 +2379,7 @@ const AttributeBlock = ({ attribute, value, isLoading, inline = false, context }
2451
2379
  }, []);
2452
2380
  const label = loadingSectionLabels[attribute];
2453
2381
  if (isLoading && label && !hasDisplayContent(value)) {
2454
- if (decryptCtx == null ? void 0 : decryptCtx.hasEncryptedData) {
2382
+ if (decryptCtx?.hasEncryptedData) {
2455
2383
  return jsxRuntimeExports.jsx(Collapsible, { label, defaultOpen: attribute === "eventData" || sectionOpenRef.current, onOpenChange: handleSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
2456
2384
  }
2457
2385
  return jsxRuntimeExports.jsx(Collapsible, { label });
@@ -2480,10 +2408,10 @@ const AttributePanel = ({ data, moduleSpecifier, moduleSourceUrl, isLoading, err
2480
2408
  const displayData = reactExports.useMemo(() => {
2481
2409
  const result = { ...data };
2482
2410
  const execCtx = data.executionContext;
2483
- if (execCtx == null ? void 0 : execCtx.workflowCoreVersion) {
2411
+ if (execCtx?.workflowCoreVersion) {
2484
2412
  result.workflowCoreVersion = execCtx.workflowCoreVersion;
2485
2413
  }
2486
- if (typeof (execCtx == null ? void 0 : execCtx.workflowVm) === "string") {
2414
+ if (typeof execCtx?.workflowVm === "string") {
2487
2415
  result.workflowVm = execCtx.workflowVm;
2488
2416
  }
2489
2417
  if (moduleSpecifier) {
@@ -2547,11 +2475,10 @@ const AttributePanel = ({ data, moduleSpecifier, moduleSourceUrl, isLoading, err
2547
2475
  isDecrypting,
2548
2476
  isDecryptDisabled,
2549
2477
  decryptDisabledReason,
2550
- hasEncryptedData: outerDecryptCtx == null ? void 0 : outerDecryptCtx.hasEncryptedData
2478
+ hasEncryptedData: outerDecryptCtx?.hasEncryptedData
2551
2479
  } : outerDecryptCtx;
2552
2480
  return jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(DecryptClickContext.Provider, { value: decryptValue, children: [visibleBasicAttributes.length > 0 && jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Metadata" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mt-0 mb-2", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [orderedBasicAttributes.map((attribute) => {
2553
- var _a;
2554
- const displayValue = (_a = attributeToDisplayFn[attribute]) == null ? void 0 : _a.call(attributeToDisplayFn, displayData[attribute]);
2481
+ const displayValue = attributeToDisplayFn[attribute]?.(displayData[attribute]);
2555
2482
  const isCopyableBasicAttribute = copyableBasicAttributes.has(attribute) && typeof displayValue === "string";
2556
2483
  const label = getAttributeDisplayName(attribute);
2557
2484
  return jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label, value: displayValue, copyText: isCopyableBasicAttribute ? displayValue : void 0, href: attribute === "moduleSpecifier" ? moduleSourceUrl : void 0 }, attribute);
@@ -2668,7 +2595,7 @@ function EventsList({ events, isLoading = false, error, onLoadEventData, onStrea
2668
2595
  if (!hasEvents && !isLoading) {
2669
2596
  return jsxRuntimeExports.jsx(Collapsible, { label: "Events", disabled: true });
2670
2597
  }
2671
- return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Events" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-0", children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps, isDuplicate: duplicateEventIds == null ? void 0 : duplicateEventIds.has(event.eventId) }, event.eventId)) }) })] }) }) });
2598
+ return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Events" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-0", children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps, isDuplicate: duplicateEventIds?.has(event.eventId) }, event.eventId)) }) })] }) }) });
2672
2599
  }
2673
2600
  const hasField = (value, key) => key in value;
2674
2601
  const RESOURCES_WITH_FETCHED_DETAIL = /* @__PURE__ */ new Set(["run", "step", "sleep"]);
@@ -2761,16 +2688,16 @@ function deriveSpanSelection(selectedSpan) {
2761
2688
  return {
2762
2689
  resource: "sleep",
2763
2690
  resourceId: selectedSpan.spanId,
2764
- runId: waitData == null ? void 0 : waitData.runId
2691
+ runId: waitData?.runId
2765
2692
  };
2766
2693
  }
2767
2694
  return null;
2768
2695
  }
2769
2696
  function useSelectedSpanDetail(selectedSpan, fetchSpanDetail) {
2770
2697
  const selection = reactExports.useMemo(() => deriveSpanSelection(selectedSpan), [selectedSpan]);
2771
- const resource = selection == null ? void 0 : selection.resource;
2772
- const resourceId = selection == null ? void 0 : selection.resourceId;
2773
- const runId = selection == null ? void 0 : selection.runId;
2698
+ const resource = selection?.resource;
2699
+ const resourceId = selection?.resourceId;
2700
+ const runId = selection?.runId;
2774
2701
  const selectionKey = resource && resourceId ? `${resource}:${resourceId}` : null;
2775
2702
  const needsFetch = resourceNeedsFetchedDetail(resource);
2776
2703
  const [fetched, setFetched] = reactExports.useState({ detail: null, error: null, errorKey: null });
@@ -2804,10 +2731,10 @@ function useSelectedSpanDetail(selectedSpan, fetchSpanDetail) {
2804
2731
  const view = reactExports.useMemo(() => deriveSpanDetailView({
2805
2732
  resource,
2806
2733
  resourceId,
2807
- inlineData: selectedSpan == null ? void 0 : selectedSpan.data,
2734
+ inlineData: selectedSpan?.data,
2808
2735
  fetchedDetail: fetched.detail,
2809
2736
  fetchedError: scopedError
2810
- }), [resource, resourceId, selectedSpan == null ? void 0 : selectedSpan.data, fetched.detail, scopedError]);
2737
+ }), [resource, resourceId, selectedSpan?.data, fetched.detail, scopedError]);
2811
2738
  return {
2812
2739
  status: view.status,
2813
2740
  resource,
@@ -2828,10 +2755,10 @@ function EntityDetailPanel({ run, onStreamClick, onRunClick, fetchSpanDetail, on
2828
2755
  const [resolvingHook, setResolvingHook] = reactExports.useState(false);
2829
2756
  const [resolvedHookIds, setResolvedHookIds] = reactExports.useState(/* @__PURE__ */ new Set());
2830
2757
  const sidebar = useSidebarDataOptional();
2831
- const hasEncryptedData = Boolean((sidebar == null ? void 0 : sidebar.hasEncryptedData) && !encryptionKey);
2832
- const data = selectedSpan == null ? void 0 : selectedSpan.data;
2833
- const rawEvents = selectedSpan == null ? void 0 : selectedSpan.rawEvents;
2834
- const rawEventsLength = (rawEvents == null ? void 0 : rawEvents.length) ?? 0;
2758
+ const hasEncryptedData = Boolean(sidebar?.hasEncryptedData && !encryptionKey);
2759
+ const data = selectedSpan?.data;
2760
+ const rawEvents = selectedSpan?.rawEvents;
2761
+ const rawEventsLength = rawEvents?.length ?? 0;
2835
2762
  const { status, resource, resourceId, displayData, detail: matchedSpanDetailData, error } = useSelectedSpanDetail(selectedSpan, fetchSpanDetail);
2836
2763
  const loading = status === "loading";
2837
2764
  const canWakeUp = reactExports.useMemo(() => {
@@ -2985,20 +2912,19 @@ function EntityDetailPanel({ run, onStreamClick, onRunClick, fetchSpanDetail, on
2985
2912
  isDecryptDisabled,
2986
2913
  decryptDisabledReason,
2987
2914
  hasEncryptedData
2988
- } : void 0, children: jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-4 pb-8", children: [hasPendingActions && jsxRuntimeExports.jsxs("div", { className: "mb-4 flex flex-col gap-2", children: [resource === "sleep" && canWakeUp && jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "small", className: "w-full", onClick: handleWakeUp, loading: stoppingSleep, children: "Wake Up Sleep" }), resource === "hook" && canResolveHook && jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "small", className: "w-full", onClick: () => setShowResolveHookModal(true), loading: resolvingHook, children: "Resolve Hook" })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, moduleSourceUrl, expiredAt: run.expiredAt, isLoading: loading, error: error ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, isDecryptDisabled, decryptDisabledReason, resource }), rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps, duplicateEventIds: selectedSpan == null ? void 0 : selectedSpan.duplicateEventIds })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
2915
+ } : void 0, children: jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-4 pb-8", children: [hasPendingActions && jsxRuntimeExports.jsxs("div", { className: "mb-4 flex flex-col gap-2", children: [resource === "sleep" && canWakeUp && jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "small", className: "w-full", onClick: handleWakeUp, loading: stoppingSleep, children: "Wake Up Sleep" }), resource === "hook" && canResolveHook && jsxRuntimeExports.jsx(Button, { variant: "secondary", size: "small", className: "w-full", onClick: () => setShowResolveHookModal(true), loading: resolvingHook, children: "Resolve Hook" })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, moduleSourceUrl, expiredAt: run.expiredAt, isLoading: loading, error: error ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, isDecryptDisabled, decryptDisabledReason, resource }), rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps, duplicateEventIds: selectedSpan?.duplicateEventIds })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
2989
2916
  }
2990
2917
  const DETAIL_PANEL_ID = "trace-detail-panel";
2991
2918
  function useSelectedSpanInfo() {
2992
2919
  const { activeSpan } = useActiveSpan();
2993
2920
  const sidebar = useSidebarData();
2994
2921
  return reactExports.useMemo(() => {
2995
- var _a, _b;
2996
2922
  if (!activeSpan)
2997
2923
  return null;
2998
- const resource = (_a = activeSpan.attributes) == null ? void 0 : _a.resource;
2924
+ const resource = activeSpan.attributes?.resource;
2999
2925
  const rawEvents = filterSpanRawEvents(sidebar.events, resource, activeSpan.spanId);
3000
2926
  return {
3001
- data: (_b = activeSpan.attributes) == null ? void 0 : _b.data,
2927
+ data: activeSpan.attributes?.data,
3002
2928
  resource,
3003
2929
  spanId: activeSpan.spanId,
3004
2930
  rawEvents,
@@ -3012,15 +2938,14 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
3012
2938
  const selectedSpan = useSelectedSpanInfo();
3013
2939
  const panelWidth = useDetailPanelWidth(containerRef, Boolean(activeSpan));
3014
2940
  const { prevSpanId, nextSpanId } = reactExports.useMemo(() => {
3015
- var _a, _b;
3016
2941
  if (!activeSpanId)
3017
2942
  return { prevSpanId: null, nextSpanId: null };
3018
2943
  const i = spans.findIndex((s) => s.spanId === activeSpanId);
3019
2944
  if (i === -1)
3020
2945
  return { prevSpanId: null, nextSpanId: null };
3021
2946
  return {
3022
- prevSpanId: ((_a = spans[i - 1]) == null ? void 0 : _a.spanId) ?? null,
3023
- nextSpanId: ((_b = spans[i + 1]) == null ? void 0 : _b.spanId) ?? null
2947
+ prevSpanId: spans[i - 1]?.spanId ?? null,
2948
+ nextSpanId: spans[i + 1]?.spanId ?? null
3024
2949
  };
3025
2950
  }, [activeSpanId, spans]);
3026
2951
  const handleSelectPrev = reactExports.useCallback(() => {
@@ -3032,8 +2957,7 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
3032
2957
  onNavigateToSpan(nextSpanId);
3033
2958
  }, [nextSpanId, onNavigateToSpan]);
3034
2959
  const selectedSpanName = reactExports.useMemo(() => {
3035
- var _a, _b;
3036
- if (!(selectedSpan == null ? void 0 : selectedSpan.data))
2960
+ if (!selectedSpan?.data)
3037
2961
  return "Details";
3038
2962
  const data = selectedSpan.data;
3039
2963
  if (selectedSpan.resource === "hook") {
@@ -3041,8 +2965,8 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
3041
2965
  }
3042
2966
  const stepName = data.stepName;
3043
2967
  const workflowName = data.workflowName;
3044
- return (stepName ? (_a = parseStepName(stepName)) == null ? void 0 : _a.shortName : void 0) ?? (workflowName ? (_b = parseWorkflowName(workflowName)) == null ? void 0 : _b.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
3045
- }, [selectedSpan == null ? void 0 : selectedSpan.data, selectedSpan == null ? void 0 : selectedSpan.resource]);
2968
+ return (stepName ? parseStepName(stepName)?.shortName : void 0) ?? (workflowName ? parseWorkflowName(workflowName)?.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
2969
+ }, [selectedSpan?.data, selectedSpan?.resource]);
3046
2970
  if (!activeSpan)
3047
2971
  return null;
3048
2972
  return jsxRuntimeExports.jsx(DetailPanelShell, { id: DETAIL_PANEL_ID, width: panelWidth, title: jsxRuntimeExports.jsx("span", { className: "truncate block", children: selectedSpanName }), itemLabel: "span", onPrev: prevSpanId ? handleSelectPrev : void 0, onNext: nextSpanId ? handleSelectNext : void 0, onClose, children: jsxRuntimeExports.jsx(ErrorBoundary, { children: jsxRuntimeExports.jsx(EntityDetailPanel, { run: sidebar.run, onStreamClick: sidebar.onStreamClick, onRunClick: sidebar.onRunClick, fetchSpanDetail: sidebar.fetchSpanDetail, onWakeUpSleep: sidebar.onWakeUpSleep, onLoadEventData: sidebar.onLoadEventData, onResolveHook: sidebar.onResolveHook, encryptionKey: sidebar.encryptionKey, onDecrypt: sidebar.onDecrypt, isDecrypting: sidebar.isDecrypting, isDecryptDisabled: sidebar.isDecryptDisabled, decryptDisabledReason: sidebar.decryptDisabledReason, selectedSpan, showSeparateEventOccurrenceTimestamps: sidebar.showSeparateEventOccurrenceTimestamps, getModuleSourceUrl: sidebar.getModuleSourceUrl }) }) });
@@ -3207,7 +3131,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
3207
3131
  const root = reactExports.useMemo(() => computeRootBounds(trace.spans), [trace.spans]);
3208
3132
  const scrollContainerRef = reactExports.useRef(null);
3209
3133
  const loadMore = reactExports.useCallback(() => {
3210
- void (onLoadMore == null ? void 0 : onLoadMore());
3134
+ void onLoadMore?.();
3211
3135
  }, [onLoadMore]);
3212
3136
  const loadMoreSentinelRef = useLoadMoreOnScroll(loadMore, {
3213
3137
  hasMore: Boolean(onLoadMore && hasMore),
@@ -3294,11 +3218,10 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
3294
3218
  clampToRoot
3295
3219
  ]);
3296
3220
  const scrollSpanIntoView = reactExports.useCallback((spanId) => {
3297
- var _a;
3298
3221
  const index = trace.spans.findIndex((s) => s.spanId === spanId);
3299
3222
  if (index === -1)
3300
3223
  return;
3301
- const list = ((_a = scrollContainerRef.current) == null ? void 0 : _a.querySelector("#event-list")) ?? null;
3224
+ const list = scrollContainerRef.current?.querySelector("#event-list") ?? null;
3302
3225
  scrollRowIntoView(list, index, ROW_HEIGHT_PX, {
3303
3226
  behavior: reducedMotion ? "auto" : "smooth"
3304
3227
  });
@@ -3410,7 +3333,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
3410
3333
  }
3411
3334
  const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes, initialSelectedSpanId }) => {
3412
3335
  const trace = reactExports.useMemo(() => {
3413
- if (!(run == null ? void 0 : run.runId)) {
3336
+ if (!run?.runId) {
3414
3337
  return void 0;
3415
3338
  }
3416
3339
  return buildTrace(run, events, /* @__PURE__ */ new Date(), {
@@ -3418,7 +3341,7 @@ const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingM
3418
3341
  getStepAttributes
3419
3342
  });
3420
3343
  }, [run, events, hasMore, getStepAttributes]);
3421
- const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace == null ? void 0 : trace.duplicateEventIds }), [sidebarData, trace]);
3344
+ const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace?.duplicateEventIds }), [sidebarData, trace]);
3422
3345
  if (!trace || loading && events.length === 0) {
3423
3346
  return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
3424
3347
  }
@@ -3430,8 +3353,8 @@ const DOCS_BASE_URL = "https://workflow-sdk.dev/err";
3430
3353
  function readVmPolicy(run) {
3431
3354
  const ctx = run.executionContext && typeof run.executionContext === "object" ? run.executionContext : void 0;
3432
3355
  return {
3433
- workflowVm: run.workflowVm ?? (ctx == null ? void 0 : ctx.workflowVm),
3434
- snapshotThreshold: run.snapshotThreshold ?? (ctx == null ? void 0 : ctx.snapshotThreshold)
3356
+ workflowVm: run.workflowVm ?? ctx?.workflowVm,
3357
+ snapshotThreshold: run.snapshotThreshold ?? ctx?.snapshotThreshold
3435
3358
  };
3436
3359
  }
3437
3360
  function isQuickJSSnapshotRun(run) {
@@ -3518,7 +3441,7 @@ function createRunStateHydrator(options) {
3518
3441
  for (let pages = 0; pages < MAX_PAGES; pages++) {
3519
3442
  const page = await options.loadEvents(current.cursor);
3520
3443
  for (const event of page.data) {
3521
- const id = event == null ? void 0 : event.eventId;
3444
+ const id = event?.eventId;
3522
3445
  if (typeof id === "string") {
3523
3446
  if (current.seen.has(id))
3524
3447
  continue;
@@ -3740,7 +3663,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
3740
3663
  }
3741
3664
  if (!runResult.error) {
3742
3665
  const ctx = runResult.result.executionContext;
3743
- if ((ctx == null ? void 0 : ctx.features) && ctx.features.encryption) {
3666
+ if (ctx?.features && ctx.features.encryption) {
3744
3667
  setHasEncryptedData(true);
3745
3668
  } else {
3746
3669
  unwrapServerActionResult(
@@ -3804,7 +3727,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
3804
3727
  loadMoreTraceData();
3805
3728
  }, [events.length, loadMoreTraceData]);
3806
3729
  const pollRun = reactExports.useCallback(async () => {
3807
- if (run == null ? void 0 : run.completedAt) {
3730
+ if (run?.completedAt) {
3808
3731
  return false;
3809
3732
  }
3810
3733
  const { error: error2, result } = await unwrapServerActionResult(
@@ -3817,7 +3740,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
3817
3740
  setError(null);
3818
3741
  setRun(hydrateResourceIO(result));
3819
3742
  return true;
3820
- }, [env, runId, run == null ? void 0 : run.completedAt]);
3743
+ }, [env, runId, run?.completedAt]);
3821
3744
  const pollEvents = reactExports.useCallback(
3822
3745
  () => pollResource({
3823
3746
  fetchFn: () => unwrapServerActionResult(
@@ -3859,7 +3782,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
3859
3782
  };
3860
3783
  }, []);
3861
3784
  reactExports.useEffect(() => {
3862
- if (!live || !initialLoadCompleted || (run == null ? void 0 : run.completedAt)) {
3785
+ if (!live || !initialLoadCompleted || run?.completedAt) {
3863
3786
  return;
3864
3787
  }
3865
3788
  const interval = setInterval(() => {
@@ -3868,7 +3791,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
3868
3791
  return () => {
3869
3792
  clearInterval(interval);
3870
3793
  };
3871
- }, [live, initialLoadCompleted, update, run == null ? void 0 : run.completedAt]);
3794
+ }, [live, initialLoadCompleted, update, run?.completedAt]);
3872
3795
  return {
3873
3796
  run: run ?? {},
3874
3797
  events,
@@ -3976,8 +3899,7 @@ const PAGE_SIZE = 100;
3976
3899
  const MAX_CORRELATION_SEARCH_PAGES = 5;
3977
3900
  const getEventId = (event) => event.eventId;
3978
3901
  function toSearchFailure(error) {
3979
- var _a;
3980
- return ((_a = error.request) == null ? void 0 : _a.status) === 404 ? { status: "not_found" } : { status: "error", message: getErrorMessage(error) };
3902
+ return error.request?.status === 404 ? { status: "not_found" } : { status: "error", message: getErrorMessage(error) };
3981
3903
  }
3982
3904
  function useEventsListData(env, runId, options = {}) {
3983
3905
  const { sortOrder = "asc", encryptionKey } = options;
@@ -4006,7 +3928,7 @@ function useEventsListData(env, runId, options = {}) {
4006
3928
  );
4007
3929
  const searchByExactId = reactExports.useCallback(
4008
3930
  async (id, kind, signal) => {
4009
- if (signal == null ? void 0 : signal.aborted) {
3931
+ if (signal?.aborted) {
4010
3932
  throw new DOMException("Aborted", "AbortError");
4011
3933
  }
4012
3934
  if (kind === "event") {
@@ -4016,18 +3938,18 @@ function useEventsListData(env, runId, options = {}) {
4016
3938
  if (fetchError) {
4017
3939
  return toSearchFailure(fetchError);
4018
3940
  }
4019
- if (signal == null ? void 0 : signal.aborted) {
3941
+ if (signal?.aborted) {
4020
3942
  throw new DOMException("Aborted", "AbortError");
4021
3943
  }
4022
3944
  const [event] = await hydrateEvents([result]);
4023
- return (event == null ? void 0 : event.runId) === runId ? { status: "ok", events: [event] } : { status: "not_found" };
3945
+ return event?.runId === runId ? { status: "ok", events: [event] } : { status: "not_found" };
4024
3946
  }
4025
3947
  const matched = [];
4026
3948
  let nextCursor;
4027
3949
  let pagesFetched = 0;
4028
3950
  let truncated = false;
4029
3951
  do {
4030
- if (signal == null ? void 0 : signal.aborted) {
3952
+ if (signal?.aborted) {
4031
3953
  throw new DOMException("Aborted", "AbortError");
4032
3954
  }
4033
3955
  const { error: fetchError, result } = await unwrapServerActionResult(
@@ -4042,7 +3964,7 @@ function useEventsListData(env, runId, options = {}) {
4042
3964
  if (fetchError) {
4043
3965
  return toSearchFailure(fetchError);
4044
3966
  }
4045
- if (signal == null ? void 0 : signal.aborted) {
3967
+ if (signal?.aborted) {
4046
3968
  throw new DOMException("Aborted", "AbortError");
4047
3969
  }
4048
3970
  pagesFetched += 1;
@@ -4168,9 +4090,8 @@ var AlertDialogContent$1 = reactExports.forwardRef(
4168
4090
  ...contentProps,
4169
4091
  ref: composedRefs,
4170
4092
  onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
4171
- var _a;
4172
4093
  event.preventDefault();
4173
- (_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
4094
+ cancelRef.current?.focus({ preventScroll: true });
4174
4095
  }),
4175
4096
  onPointerDownOutside: (event) => event.preventDefault(),
4176
4097
  onInteractOutside: (event) => event.preventDefault(),
@@ -4251,7 +4172,7 @@ function AlertDialogContent({
4251
4172
  ),
4252
4173
  onSubmit: (e) => {
4253
4174
  e.preventDefault();
4254
- onSubmit == null ? void 0 : onSubmit(e);
4175
+ onSubmit?.(e);
4255
4176
  },
4256
4177
  ...props
4257
4178
  }
@@ -4413,12 +4334,11 @@ function BreadcrumbSeparator({
4413
4334
  );
4414
4335
  }
4415
4336
  function getCancellationReason(events) {
4416
- var _a, _b;
4417
4337
  if (!events) return void 0;
4418
4338
  for (let index = events.length - 1; index >= 0; index -= 1) {
4419
4339
  const event = events[index];
4420
4340
  if (event.eventType !== "run_cancelled") continue;
4421
- const reason = (_b = (_a = event.eventData) == null ? void 0 : _a.cancelReason) == null ? void 0 : _b.trim();
4341
+ const reason = event.eventData?.cancelReason?.trim();
4422
4342
  if (reason) return reason;
4423
4343
  }
4424
4344
  return void 0;
@@ -4504,7 +4424,7 @@ function useRunUsage(env, runId, {
4504
4424
  if (enabled && wasLive && !live) void read();
4505
4425
  }, [enabled, live, read]);
4506
4426
  const unsupported = usage === null;
4507
- const polling = live || (usage == null ? void 0 : usage.inProgress) === true;
4427
+ const polling = live || usage?.inProgress === true;
4508
4428
  reactExports.useEffect(() => {
4509
4429
  if (!enabled || !polling || unsupported) return;
4510
4430
  if (!refreshInterval || refreshInterval <= 0) return;
@@ -4562,9 +4482,8 @@ function concatBytes(parts) {
4562
4482
  return joined;
4563
4483
  }
4564
4484
  function hasSameImageBytes(previous, next) {
4565
- var _a, _b;
4566
- const before = (_a = previous[0]) == null ? void 0 : _a.value;
4567
- const after = (_b = next[0]) == null ? void 0 : _b.value;
4485
+ const before = previous[0]?.value;
4486
+ const after = next[0]?.value;
4568
4487
  return previous.length === 1 && next.length === 1 && before instanceof Uint8Array && after instanceof Uint8Array && before.length === after.length && before.every((byte, index) => byte === after[index]);
4569
4488
  }
4570
4489
  function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
@@ -4654,9 +4573,9 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
4654
4573
  streamId,
4655
4574
  runId,
4656
4575
  abortController.signal,
4657
- isImageStream ? void 0 : (options == null ? void 0 : options.cursor) ?? void 0
4576
+ isImageStream ? void 0 : options?.cursor ?? void 0
4658
4577
  );
4659
- const skipFrames = isImageStream ? 0 : (options == null ? void 0 : options.skipFrames) ?? 0;
4578
+ const skipFrames = isImageStream ? 0 : options?.skipFrames ?? 0;
4660
4579
  const reader = streamResponse.body.getReader();
4661
4580
  const decoder = new TextDecoder();
4662
4581
  let buffer = new Uint8Array(0);
@@ -4680,7 +4599,7 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
4680
4599
  if (encoding === "legacy") textRemainder = decoder.decode(buffer);
4681
4600
  }
4682
4601
  if (encoding === "image") {
4683
- imageChunkId ?? (imageChunkId = chunkIdRef.current++);
4602
+ imageChunkId ??= chunkIdRef.current++;
4684
4603
  frameIndex++;
4685
4604
  targetBuffer.push({
4686
4605
  id: imageChunkId,
@@ -4780,7 +4699,7 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
4780
4699
  }
4781
4700
  buffer = buffer.slice(offset);
4782
4701
  }
4783
- isImageStream || (isImageStream = encoding === "image");
4702
+ isImageStream ||= encoding === "image";
4784
4703
  return {
4785
4704
  encrypted: false,
4786
4705
  image: isImageStream,
@@ -4905,7 +4824,7 @@ const RUN_TABS = [
4905
4824
  { value: "streams", label: "Streams" }
4906
4825
  ];
4907
4826
  function focusRunViewItem(root, item) {
4908
- const target = root == null ? void 0 : root.querySelector(
4827
+ const target = root?.querySelector(
4909
4828
  `[data-run-view-item="${item}"]:is([aria-current="page"], [data-state="active"])`
4910
4829
  );
4911
4830
  if (!(target instanceof HTMLElement)) return false;
@@ -4928,7 +4847,7 @@ function UsageNavLink({
4928
4847
  "aria-current": current ? "page" : void 0,
4929
4848
  "data-testid": "run-usage-nav-link",
4930
4849
  "data-run-view-item": "usage",
4931
- onClick: () => onNavigate == null ? void 0 : onNavigate("usage"),
4850
+ onClick: () => onNavigate?.("usage"),
4932
4851
  children: [
4933
4852
  /* @__PURE__ */ jsxRuntimeExports.jsx(ChartColumn, { className: "h-4 w-4", "aria-hidden": "true" }),
4934
4853
  "Usage"
@@ -4952,7 +4871,7 @@ function RunViewNav({
4952
4871
  to: runTabPath(runId, tab.value),
4953
4872
  className: cn(tabsTriggerClassName, "gap-2"),
4954
4873
  "data-run-view-item": tab.value,
4955
- onClick: () => onNavigate == null ? void 0 : onNavigate(tab.value),
4874
+ onClick: () => onNavigate?.(tab.value),
4956
4875
  children: [
4957
4876
  /* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4", "aria-hidden": "true" }),
4958
4877
  tab.label
@@ -4967,7 +4886,6 @@ function RunDetailView({
4967
4886
  runId,
4968
4887
  selectedId: _selectedId
4969
4888
  }) {
4970
- var _a, _b;
4971
4889
  const navigate = useNavigate();
4972
4890
  const [searchParams, updateSearchParams] = useOptimisticSearchParams();
4973
4891
  const { serverConfig } = useServerConfig();
@@ -5167,7 +5085,7 @@ function RunDetailView({
5167
5085
  setCancelling(false);
5168
5086
  }
5169
5087
  };
5170
- const isDynamicRun = Boolean((_a = run.executionContext) == null ? void 0 : _a.dynamicWorkflow);
5088
+ const isDynamicRun = Boolean(run.executionContext?.dynamicWorkflow);
5171
5089
  const handleRerunClick = () => {
5172
5090
  if (isDynamicRun) return;
5173
5091
  setShowRerunDialog(true);
@@ -5199,7 +5117,7 @@ function RunDetailView({
5199
5117
  /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: getErrorMessage(error) })
5200
5118
  ] });
5201
5119
  }
5202
- const workflowName = (_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName;
5120
+ const workflowName = parseWorkflowName(run.workflowName)?.shortName;
5203
5121
  const hasError = false;
5204
5122
  const errorMessage = "";
5205
5123
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -5453,7 +5371,7 @@ function RunDetailView({
5453
5371
  streamId
5454
5372
  )) })
5455
5373
  ] }),
5456
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StreamViewerSkeleton, {}) }) : selectedStreamId ? (streamError == null ? void 0 : streamError.includes("encrypted")) && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5374
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StreamViewerSkeleton, {}) }) : selectedStreamId ? streamError?.includes("encrypted") && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5457
5375
  /* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-8 w-8 text-gray-700" }),
5458
5376
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
5459
5377
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 font-medium text-gray-1000", children: "Encrypted Stream" }),
@@ -5473,7 +5391,7 @@ function RunDetailView({
5473
5391
  chunks: streamChunks,
5474
5392
  isLive: streamIsLive,
5475
5393
  isLoading: streamIsInitialLoading,
5476
- error: (streamError == null ? void 0 : streamError.includes("encrypted")) ? null : streamError
5394
+ error: streamError?.includes("encrypted") ? null : streamError
5477
5395
  }
5478
5396
  ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 text-gray-600", children: streams.length > 0 ? "Select a stream to view its data" : "No streams available" }) }) })
5479
5397
  ] }) }) }),