@workflow/web 5.3.1 → 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.
- package/README.md +11 -34
- package/build/client/assets/app-CmaRLUwS.css +1 -0
- package/build/client/assets/arrow-up-right-AHTyWXU2.js +9 -0
- package/build/client/assets/{entry.client-DDsh88VE.js → entry.client-BqbaswKw.js} +13 -35
- package/build/client/assets/{highlighted-body-JLMTFACH-CWHg5f-6.js → highlighted-body-JLMTFACH-_kzpqYmW.js} +2 -2
- package/build/client/assets/{home-DZqYMSiD.js → home-DjUPTrY5.js} +91 -159
- package/build/client/assets/{index-BS6T0Zjc.js → index-BUQuaV5X.js} +108 -174
- package/build/client/assets/manifest-9126df65.js +1 -0
- package/build/client/assets/{mermaid-WFAXDIZX-BLO7Z8RE.js → mermaid-WFAXDIZX-CNo_0yWo.js} +1499 -4067
- package/build/client/assets/mermaid-WFAXDIZX-F88p7PFX.css +1 -0
- package/build/client/assets/meta-9cjJ0pVb.js +6 -0
- package/build/client/assets/{root-wdKzRZGT.js → root-Bh-E5He-.js} +17 -35
- package/build/client/assets/root-kJB77No4.css +1 -0
- package/build/client/assets/rpc-client-DL_nSX36.js +2481 -0
- package/build/client/assets/{run-detail-DyXpnv9C.js → run-detail-5dPVsaSm.js} +533 -807
- package/build/client/assets/run-usage-BEswHGKU.js +1252 -0
- package/build/client/assets/run-usage-C_wyncgV.js +33 -0
- package/build/client/assets/skeleton-DE14mNQw.js +76 -0
- package/build/client/assets/{url-state-DhOv2zv0.js → url-state-5GKQwo-f.js} +546 -857
- package/build/client/assets/{zstd-browser-decoder-BNeg7hxG.js → zstd-browser-decoder-CbTMLAMd.js} +2 -2
- package/build/server/assets/{app-CNGxG3wL.js → app-C-e60j14.js} +13627 -12777
- package/build/server/assets/{esm-CETb4fkq.js → esm-BzrGWk7J.js} +2 -2
- package/build/server/assets/{highlighted-body-JLMTFACH-Bj8JsfUl.js → highlighted-body-JLMTFACH-B7y0X_Kn.js} +1 -1
- package/build/server/assets/{index-DGn_6xEN.js → index-DRDsjR--.js} +398 -490
- package/build/server/assets/{mermaid-WFAXDIZX-C_v93dNU.js → mermaid-WFAXDIZX-MsPxEM1Y.js} +1 -1
- package/build/server/assets/{token-b1ZjKN2Q.js → token-CKgyaeCJ.js} +5 -5
- package/build/server/assets/{token-5fcfNNDG.js → token-DXh0TnqB.js} +6 -6
- package/build/server/assets/{token-util-BJhEZw83.js → token-util-CCc0uYVy.js} +2 -2
- package/build/server/assets/{token-util-spPPOelu.js → token-util-DOHYMq7D.js} +1 -1
- package/build/server/assets/{wrapper-Cc-ChiPM.js → wrapper-BzLz38Oh.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-y4X_FyMk.js → zstd-browser-decoder-BSSEC3XP.js} +1 -1
- package/build/server/index.js +1 -1
- package/handler.d.ts +9 -0
- package/handler.js +16 -2
- package/host-guard.js +179 -0
- package/package.json +9 -8
- package/server.d.ts +15 -1
- package/server.js +14 -1
- package/build/client/assets/app-BE8uqS_d.css +0 -1
- package/build/client/assets/arrow-up-right-CNHh1bh2.js +0 -15
- package/build/client/assets/manifest-f2e93220.js +0 -1
- package/build/client/assets/mermaid-WFAXDIZX-D8CjRQta.css +0 -1
- package/build/client/assets/root-BBptRWmF.css +0 -1
|
@@ -1,50 +1,30 @@
|
|
|
1
|
-
import { r as reactExports,
|
|
2
|
-
import {
|
|
3
|
-
import { c as createLucideIcon, Q as isSlotEventId, U as classifyEntityEvent, X as TERMINAL_EVENT_CLASSES, Y as isSealedNoopEvent$1,
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* This source code is licensed under the ISC license.
|
|
9
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
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-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";
|
|
11
8
|
const __iconNode$9 = [
|
|
9
|
+
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
10
|
+
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
11
|
+
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
12
|
+
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
13
|
+
];
|
|
14
|
+
const ChartColumn = createLucideIcon("chart-column", __iconNode$9);
|
|
15
|
+
const __iconNode$8 = [
|
|
12
16
|
["path", { d: "M10 6h8", key: "zvc2xc" }],
|
|
13
17
|
["path", { d: "M12 16h6", key: "yi5mkt" }],
|
|
14
18
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
15
19
|
["path", { d: "M8 11h7", key: "wz2hg0" }]
|
|
16
20
|
];
|
|
17
|
-
const ChartGantt = createLucideIcon("chart-gantt", __iconNode$
|
|
18
|
-
/**
|
|
19
|
-
* @license lucide-react v0.575.0 - ISC
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the ISC license.
|
|
22
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/
|
|
24
|
-
const __iconNode$8 = [
|
|
25
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
26
|
-
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
|
|
27
|
-
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
28
|
-
];
|
|
29
|
-
const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$8);
|
|
30
|
-
/**
|
|
31
|
-
* @license lucide-react v0.575.0 - ISC
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the ISC license.
|
|
34
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/
|
|
21
|
+
const ChartGantt = createLucideIcon("chart-gantt", __iconNode$8);
|
|
36
22
|
const __iconNode$7 = [
|
|
37
23
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38
24
|
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
39
25
|
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
40
26
|
];
|
|
41
27
|
const Info = createLucideIcon("info", __iconNode$7);
|
|
42
|
-
/**
|
|
43
|
-
* @license lucide-react v0.575.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/
|
|
48
28
|
const __iconNode$6 = [
|
|
49
29
|
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
50
30
|
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
@@ -54,45 +34,21 @@ const __iconNode$6 = [
|
|
|
54
34
|
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
55
35
|
];
|
|
56
36
|
const List = createLucideIcon("list", __iconNode$6);
|
|
57
|
-
/**
|
|
58
|
-
* @license lucide-react v0.575.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/
|
|
63
37
|
const __iconNode$5 = [
|
|
64
38
|
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
65
39
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
|
66
40
|
];
|
|
67
41
|
const LockOpen = createLucideIcon("lock-open", __iconNode$5);
|
|
68
|
-
/**
|
|
69
|
-
* @license lucide-react v0.575.0 - ISC
|
|
70
|
-
*
|
|
71
|
-
* This source code is licensed under the ISC license.
|
|
72
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/
|
|
74
42
|
const __iconNode$4 = [
|
|
75
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" }],
|
|
76
44
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
77
45
|
];
|
|
78
46
|
const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$4);
|
|
79
|
-
/**
|
|
80
|
-
* @license lucide-react v0.575.0 - ISC
|
|
81
|
-
*
|
|
82
|
-
* This source code is licensed under the ISC license.
|
|
83
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
-
*/
|
|
85
47
|
const __iconNode$3 = [
|
|
86
48
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
87
49
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
88
50
|
];
|
|
89
51
|
const Search = createLucideIcon("search", __iconNode$3);
|
|
90
|
-
/**
|
|
91
|
-
* @license lucide-react v0.575.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/
|
|
96
52
|
const __iconNode$2 = [
|
|
97
53
|
[
|
|
98
54
|
"path",
|
|
@@ -105,12 +61,6 @@ const __iconNode$2 = [
|
|
|
105
61
|
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
106
62
|
];
|
|
107
63
|
const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$2);
|
|
108
|
-
/**
|
|
109
|
-
* @license lucide-react v0.575.0 - ISC
|
|
110
|
-
*
|
|
111
|
-
* This source code is licensed under the ISC license.
|
|
112
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/
|
|
114
64
|
const __iconNode$1 = [
|
|
115
65
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
116
66
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
@@ -118,12 +68,6 @@ const __iconNode$1 = [
|
|
|
118
68
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
119
69
|
];
|
|
120
70
|
const ZoomIn = createLucideIcon("zoom-in", __iconNode$1);
|
|
121
|
-
/**
|
|
122
|
-
* @license lucide-react v0.575.0 - ISC
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the ISC license.
|
|
125
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/
|
|
127
71
|
const __iconNode = [
|
|
128
72
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
129
73
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
@@ -274,14 +218,13 @@ function getEventResource(event, entity) {
|
|
|
274
218
|
return entity.kind === "wait" ? "sleep" : entity.kind;
|
|
275
219
|
}
|
|
276
220
|
function buildNameMaps(events, run) {
|
|
277
|
-
var _a, _b, _c;
|
|
278
221
|
const correlationNameMap = /* @__PURE__ */ new Map();
|
|
279
222
|
const hookNameMap = /* @__PURE__ */ new Map();
|
|
280
223
|
for (const event of events ?? []) {
|
|
281
224
|
if (!event.correlationId)
|
|
282
225
|
continue;
|
|
283
226
|
if (event.eventType === "hook_created") {
|
|
284
|
-
const token =
|
|
227
|
+
const token = event.eventData?.token;
|
|
285
228
|
if (typeof token === "string")
|
|
286
229
|
hookNameMap.set(event.correlationId, token);
|
|
287
230
|
continue;
|
|
@@ -289,16 +232,16 @@ function buildNameMaps(events, run) {
|
|
|
289
232
|
if (event.eventType !== "step_created" && event.eventType !== "step_started") {
|
|
290
233
|
continue;
|
|
291
234
|
}
|
|
292
|
-
const stepName =
|
|
235
|
+
const stepName = event.eventData?.stepName;
|
|
293
236
|
if (typeof stepName !== "string")
|
|
294
237
|
continue;
|
|
295
238
|
if (event.eventType === "step_started" && correlationNameMap.has(event.correlationId)) {
|
|
296
239
|
continue;
|
|
297
240
|
}
|
|
298
241
|
const parsed = parseStepName(stepName) ?? parseWorkflowName(stepName);
|
|
299
|
-
correlationNameMap.set(event.correlationId,
|
|
242
|
+
correlationNameMap.set(event.correlationId, parsed?.shortName ?? stepName);
|
|
300
243
|
}
|
|
301
|
-
const workflowName =
|
|
244
|
+
const workflowName = run?.workflowName ? parseWorkflowName(run.workflowName)?.shortName ?? run.workflowName : null;
|
|
302
245
|
return { correlationNameMap, hookNameMap, workflowName };
|
|
303
246
|
}
|
|
304
247
|
function getEventName(entity, names) {
|
|
@@ -335,7 +278,7 @@ function buildEventTiming(events, duplicateEventIds = /* @__PURE__ */ new Set())
|
|
|
335
278
|
switch (type) {
|
|
336
279
|
case "step_created":
|
|
337
280
|
case "run_created":
|
|
338
|
-
clock.createdAt
|
|
281
|
+
clock.createdAt ??= ts;
|
|
339
282
|
break;
|
|
340
283
|
case "step_started":
|
|
341
284
|
if (clock.attempt === 0 && clock.createdAt !== void 0) {
|
|
@@ -440,7 +383,7 @@ function getEventMessage(event, queuedMs) {
|
|
|
440
383
|
}
|
|
441
384
|
}
|
|
442
385
|
function getRunStartMs(events, run) {
|
|
443
|
-
const created = parseEventDate(run
|
|
386
|
+
const created = parseEventDate(run?.createdAt);
|
|
444
387
|
if (created)
|
|
445
388
|
return created.getTime();
|
|
446
389
|
let min;
|
|
@@ -460,7 +403,6 @@ function buildEventLookups(events, run, duplicateEventIds) {
|
|
|
460
403
|
};
|
|
461
404
|
}
|
|
462
405
|
function buildEventRow(event, lookups) {
|
|
463
|
-
var _a;
|
|
464
406
|
const entity = getEventEntity(event);
|
|
465
407
|
const segments = entity.key === null ? [] : lookups.timing.stepSegments.get(entity.key) ?? [];
|
|
466
408
|
const ignored = lookups.duplicateEventIds.has(event.eventId) ? {
|
|
@@ -476,8 +418,8 @@ function buildEventRow(event, lookups) {
|
|
|
476
418
|
level: ignored ? "muted" : getEventLevel(event),
|
|
477
419
|
resource: getEventResource(event, entity),
|
|
478
420
|
name: getEventName(entity, lookups.names),
|
|
479
|
-
message:
|
|
480
|
-
notice: ignored
|
|
421
|
+
message: ignored?.message ?? getEventMessage(event, segments.find((segment) => segment.kind === "queued")?.ms),
|
|
422
|
+
notice: ignored?.notice,
|
|
481
423
|
segments,
|
|
482
424
|
durationMs: lookups.timing.eventDurations.get(event.eventId),
|
|
483
425
|
sinceStartMs: lookups.runStartMs === void 0 ? void 0 : getEffectiveEventTime(event) - lookups.runStartMs
|
|
@@ -617,7 +559,7 @@ const MARKER_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
617
559
|
"attr_set"
|
|
618
560
|
]);
|
|
619
561
|
const getEventTimestamp = (event) => {
|
|
620
|
-
const value =
|
|
562
|
+
const value = event?.occurredAt ?? event?.createdAt;
|
|
621
563
|
if (!value)
|
|
622
564
|
return void 0;
|
|
623
565
|
const date = value instanceof Date ? value : new Date(value);
|
|
@@ -637,7 +579,6 @@ function convertEventsToSpanEvents(events, filterTypes = true, options = {}) {
|
|
|
637
579
|
}));
|
|
638
580
|
}
|
|
639
581
|
const waitEventsToWaitEntity = (events) => {
|
|
640
|
-
var _a;
|
|
641
582
|
const startEvent = events.find((event) => event.eventType === "wait_created");
|
|
642
583
|
if (!startEvent) {
|
|
643
584
|
return null;
|
|
@@ -647,7 +588,7 @@ const waitEventsToWaitEntity = (events) => {
|
|
|
647
588
|
waitId: startEvent.correlationId,
|
|
648
589
|
runId: startEvent.runId,
|
|
649
590
|
createdAt: getEventTimestamp(startEvent) ?? startEvent.createdAt,
|
|
650
|
-
resumeAt:
|
|
591
|
+
resumeAt: startEvent.eventData?.resumeAt ? new Date(startEvent.eventData.resumeAt) : void 0,
|
|
651
592
|
completedAt: getEventTimestamp(completedEvent)
|
|
652
593
|
};
|
|
653
594
|
};
|
|
@@ -689,7 +630,6 @@ function waitToSpan(events, maxEndTime, fallbackEndTime = maxEndTime) {
|
|
|
689
630
|
};
|
|
690
631
|
}
|
|
691
632
|
const stepEventsToStepEntity = (events) => {
|
|
692
|
-
var _a, _b;
|
|
693
633
|
const createdEvent = events.find((event) => event.eventType === "step_created");
|
|
694
634
|
const anchorEvent = createdEvent ?? events[0];
|
|
695
635
|
const firstStartedEvent = events.find((event) => event.eventType === "step_started");
|
|
@@ -729,11 +669,11 @@ const stepEventsToStepEntity = (events) => {
|
|
|
729
669
|
return {
|
|
730
670
|
stepId: anchorEvent.correlationId ?? "",
|
|
731
671
|
runId: anchorEvent.runId,
|
|
732
|
-
stepName:
|
|
672
|
+
stepName: createdEvent?.eventData?.stepName ?? firstStartedEvent?.eventData?.stepName ?? "",
|
|
733
673
|
status,
|
|
734
674
|
attempt,
|
|
735
675
|
createdAt: getEventTimestamp(anchorEvent) ?? anchorEvent.createdAt,
|
|
736
|
-
updatedAt: getEventTimestamp(lastEvent) ??
|
|
676
|
+
updatedAt: getEventTimestamp(lastEvent) ?? lastEvent?.createdAt ?? anchorEvent.createdAt,
|
|
737
677
|
startedAt,
|
|
738
678
|
completedAt,
|
|
739
679
|
specVersion: anchorEvent.specVersion
|
|
@@ -748,7 +688,7 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
|
748
688
|
const attributes = {
|
|
749
689
|
resource: "step",
|
|
750
690
|
data: {
|
|
751
|
-
...getStepAttributes
|
|
691
|
+
...getStepAttributes?.(stepEvents),
|
|
752
692
|
// Canonical event-derived fields cannot be overridden by extensions.
|
|
753
693
|
...step
|
|
754
694
|
}
|
|
@@ -771,7 +711,7 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
|
771
711
|
}
|
|
772
712
|
return {
|
|
773
713
|
spanId: String(step.stepId),
|
|
774
|
-
name:
|
|
714
|
+
name: parsedName?.shortName ?? String(step.stepName),
|
|
775
715
|
kind: 1,
|
|
776
716
|
// INTERNAL span kind
|
|
777
717
|
resource,
|
|
@@ -789,12 +729,11 @@ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
|
789
729
|
};
|
|
790
730
|
}
|
|
791
731
|
const hookEventsToHookEntity = (events, startHook) => {
|
|
792
|
-
var _a;
|
|
793
732
|
const createdEvent = events.find((event) => event.eventType === "hook_created");
|
|
794
733
|
const creation = createdEvent ? {
|
|
795
734
|
hookId: createdEvent.correlationId,
|
|
796
735
|
runId: createdEvent.runId,
|
|
797
|
-
token:
|
|
736
|
+
token: createdEvent.eventData?.token,
|
|
798
737
|
createdAt: getEventTimestamp(createdEvent) ?? createdEvent.createdAt
|
|
799
738
|
} : startHook && events.every((event) => event.correlationId === startHook.hookId) ? startHook : void 0;
|
|
800
739
|
if (!creation) {
|
|
@@ -841,7 +780,6 @@ function hookToSpan(hookEvents, maxEndTime, startHook) {
|
|
|
841
780
|
};
|
|
842
781
|
}
|
|
843
782
|
function runToSpan(run, runEvents, nowTime) {
|
|
844
|
-
var _a, _b;
|
|
845
783
|
const now = nowTime ?? /* @__PURE__ */ new Date();
|
|
846
784
|
const runCreatedEvent = runEvents.find(isRunCreationEvent);
|
|
847
785
|
const runStartedEvent = runEvents.find((event) => event.eventType === "run_started");
|
|
@@ -850,8 +788,8 @@ function runToSpan(run, runEvents, nowTime) {
|
|
|
850
788
|
const activeStartTime = getEventTimestamp(runStartedEvent) ?? (run.startedAt ? new Date(run.startedAt) : void 0);
|
|
851
789
|
const completedAt = getEventTimestamp(terminalEvent) ?? run.completedAt ?? void 0;
|
|
852
790
|
const endTime = completedAt ?? now;
|
|
853
|
-
const wasCancelled = run.status === "cancelled" ||
|
|
854
|
-
const cancelReason =
|
|
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;
|
|
855
793
|
const { input: _i, output: _o, error: _e, ...runIdentity } = run;
|
|
856
794
|
const attributes = {
|
|
857
795
|
resource: "run",
|
|
@@ -868,7 +806,7 @@ function runToSpan(run, runEvents, nowTime) {
|
|
|
868
806
|
});
|
|
869
807
|
return {
|
|
870
808
|
spanId: String(run.runId),
|
|
871
|
-
name: String(
|
|
809
|
+
name: String(parseWorkflowName(run.workflowName)?.shortName ?? "?"),
|
|
872
810
|
kind: 1,
|
|
873
811
|
// INTERNAL span kind
|
|
874
812
|
resource: "run",
|
|
@@ -950,7 +888,7 @@ function buildSpans(run, groupedEvents, now, latestKnownTime, startHook, getStep
|
|
|
950
888
|
if (startHook && !hookEventGroups.has(startHook.hookId)) {
|
|
951
889
|
hookEventGroups.set(startHook.hookId, []);
|
|
952
890
|
}
|
|
953
|
-
const hookSpans = Array.from(hookEventGroups).map(([hookId, events]) => hookToSpan(events, childMaxEnd, hookId ===
|
|
891
|
+
const hookSpans = Array.from(hookEventGroups).map(([hookId, events]) => hookToSpan(events, childMaxEnd, hookId === startHook?.hookId ? startHook : void 0)).filter((span) => span !== null);
|
|
954
892
|
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events) => waitToSpan(events, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
|
|
955
893
|
return {
|
|
956
894
|
runSpan: runToSpan(run, groupedEvents.runLevelEvents, now),
|
|
@@ -1001,379 +939,6 @@ function buildTrace(run, events, now, { isCompleteHistory = false, getStepAttrib
|
|
|
1001
939
|
duplicateEventIds
|
|
1002
940
|
};
|
|
1003
941
|
}
|
|
1004
|
-
const ELLIPSIS = "…";
|
|
1005
|
-
const MIN_START = 3;
|
|
1006
|
-
const MIN_END = 3;
|
|
1007
|
-
const MIN_KEPT = MIN_START + MIN_END;
|
|
1008
|
-
const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
1009
|
-
function toGraphemes(text) {
|
|
1010
|
-
if (graphemeSegmenter) {
|
|
1011
|
-
return [...graphemeSegmenter.segment(text)].map((s) => s.segment);
|
|
1012
|
-
}
|
|
1013
|
-
return Array.from(text);
|
|
1014
|
-
}
|
|
1015
|
-
function buildCandidate(graphemes, kept) {
|
|
1016
|
-
if (kept <= 0) {
|
|
1017
|
-
return {
|
|
1018
|
-
prefixText: "",
|
|
1019
|
-
prefixGraphemeCount: 0,
|
|
1020
|
-
suffixText: "",
|
|
1021
|
-
suffixGraphemeCount: 0,
|
|
1022
|
-
text: ELLIPSIS,
|
|
1023
|
-
truncated: true
|
|
1024
|
-
};
|
|
1025
|
-
}
|
|
1026
|
-
const suffixGraphemeCount = kept >= MIN_KEPT ? Math.max(MIN_END, Math.floor(kept / 2)) : Math.floor(kept / 2);
|
|
1027
|
-
const prefixGraphemeCount = kept - suffixGraphemeCount;
|
|
1028
|
-
const prefixText = graphemes.slice(0, prefixGraphemeCount).join("");
|
|
1029
|
-
const suffixText = suffixGraphemeCount > 0 ? graphemes.slice(-suffixGraphemeCount).join("") : "";
|
|
1030
|
-
return {
|
|
1031
|
-
prefixText,
|
|
1032
|
-
prefixGraphemeCount,
|
|
1033
|
-
suffixText,
|
|
1034
|
-
suffixGraphemeCount,
|
|
1035
|
-
text: prefixText + ELLIPSIS + suffixText,
|
|
1036
|
-
truncated: true
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
function middleTruncate(graphemes, availableWidth, measure, fullWidth) {
|
|
1040
|
-
const fullText = graphemes.join("");
|
|
1041
|
-
const resolvedFullWidth = fullWidth ?? measure(fullText);
|
|
1042
|
-
if (availableWidth <= 0 || graphemes.length === 0) {
|
|
1043
|
-
return {
|
|
1044
|
-
prefixText: fullText,
|
|
1045
|
-
prefixGraphemeCount: graphemes.length,
|
|
1046
|
-
suffixText: "",
|
|
1047
|
-
suffixGraphemeCount: 0,
|
|
1048
|
-
text: fullText,
|
|
1049
|
-
truncated: false
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
if (resolvedFullWidth <= availableWidth) {
|
|
1053
|
-
return {
|
|
1054
|
-
prefixText: fullText,
|
|
1055
|
-
prefixGraphemeCount: graphemes.length,
|
|
1056
|
-
suffixText: "",
|
|
1057
|
-
suffixGraphemeCount: 0,
|
|
1058
|
-
text: fullText,
|
|
1059
|
-
truncated: false
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
let lo = 0;
|
|
1063
|
-
let hi = graphemes.length - 1;
|
|
1064
|
-
let best = -1;
|
|
1065
|
-
while (lo <= hi) {
|
|
1066
|
-
const mid = lo + hi >>> 1;
|
|
1067
|
-
const candidate = buildCandidate(graphemes, mid);
|
|
1068
|
-
if (measure(candidate.text) <= availableWidth) {
|
|
1069
|
-
best = mid;
|
|
1070
|
-
lo = mid + 1;
|
|
1071
|
-
} else {
|
|
1072
|
-
hi = mid - 1;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
if (best === -1) {
|
|
1076
|
-
return {
|
|
1077
|
-
prefixText: "",
|
|
1078
|
-
prefixGraphemeCount: 0,
|
|
1079
|
-
suffixText: "",
|
|
1080
|
-
suffixGraphemeCount: 0,
|
|
1081
|
-
text: "",
|
|
1082
|
-
truncated: true
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
return buildCandidate(graphemes, best);
|
|
1086
|
-
}
|
|
1087
|
-
function getMiddleTruncateCopyText({ prefixText, selectionEnd, selectionStart, suffixText, value }) {
|
|
1088
|
-
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
1089
|
-
if (selectionStart < 0 || selectionEnd > visibleText.length || selectionStart >= selectionEnd) {
|
|
1090
|
-
return null;
|
|
1091
|
-
}
|
|
1092
|
-
if (selectionStart === 0 && selectionEnd === visibleText.length) {
|
|
1093
|
-
return value;
|
|
1094
|
-
}
|
|
1095
|
-
const ellipsisStart = prefixText.length;
|
|
1096
|
-
const ellipsisEnd = ellipsisStart + ELLIPSIS.length;
|
|
1097
|
-
if (selectionStart > ellipsisStart || selectionEnd < ellipsisEnd) {
|
|
1098
|
-
return null;
|
|
1099
|
-
}
|
|
1100
|
-
const originalGraphemes = toGraphemes(value);
|
|
1101
|
-
const selectedPrefixGraphemeCount = toGraphemes(visibleText.slice(0, selectionStart)).length;
|
|
1102
|
-
const selectedSuffixGraphemeCount = toGraphemes(visibleText.slice(ellipsisEnd, selectionEnd)).length;
|
|
1103
|
-
const suffixStart = originalGraphemes.length - toGraphemes(suffixText).length;
|
|
1104
|
-
return originalGraphemes.slice(selectedPrefixGraphemeCount, suffixStart + selectedSuffixGraphemeCount).join("");
|
|
1105
|
-
}
|
|
1106
|
-
function getMiddleTruncateCopyTextFromSelectionText({ prefixText, selectionText, suffixText, value }) {
|
|
1107
|
-
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
1108
|
-
const trimmedSelectionText = selectionText.trim();
|
|
1109
|
-
if (!trimmedSelectionText) {
|
|
1110
|
-
return null;
|
|
1111
|
-
}
|
|
1112
|
-
const leading = selectionText.slice(0, selectionText.length - selectionText.trimStart().length);
|
|
1113
|
-
const trailing = selectionText.slice(selectionText.trimEnd().length);
|
|
1114
|
-
if (trimmedSelectionText === visibleText) {
|
|
1115
|
-
return leading + value + trailing;
|
|
1116
|
-
}
|
|
1117
|
-
if (!trimmedSelectionText.includes(ELLIPSIS)) {
|
|
1118
|
-
return null;
|
|
1119
|
-
}
|
|
1120
|
-
const selectionStart = visibleText.indexOf(trimmedSelectionText);
|
|
1121
|
-
if (selectionStart === -1) {
|
|
1122
|
-
return null;
|
|
1123
|
-
}
|
|
1124
|
-
const selectionEnd = selectionStart + trimmedSelectionText.length;
|
|
1125
|
-
const mappedText = getMiddleTruncateCopyText({
|
|
1126
|
-
prefixText,
|
|
1127
|
-
selectionEnd,
|
|
1128
|
-
selectionStart,
|
|
1129
|
-
suffixText,
|
|
1130
|
-
value
|
|
1131
|
-
});
|
|
1132
|
-
return mappedText === null ? null : leading + mappedText + trailing;
|
|
1133
|
-
}
|
|
1134
|
-
const pendingMeasurements = /* @__PURE__ */ new Map();
|
|
1135
|
-
let measurementFrame = 0;
|
|
1136
|
-
function flushMeasurements() {
|
|
1137
|
-
measurementFrame = 0;
|
|
1138
|
-
const reads = [...pendingMeasurements.values()];
|
|
1139
|
-
pendingMeasurements.clear();
|
|
1140
|
-
const measures = reads.map((read) => read());
|
|
1141
|
-
for (const measure of measures) {
|
|
1142
|
-
measure == null ? void 0 : measure();
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
function scheduleMeasurement(key, { read, measure }) {
|
|
1146
|
-
pendingMeasurements.set(key, () => {
|
|
1147
|
-
const measurement = read();
|
|
1148
|
-
return measurement === null ? null : () => measure(measurement);
|
|
1149
|
-
});
|
|
1150
|
-
if (measurementFrame === 0) {
|
|
1151
|
-
measurementFrame = requestAnimationFrame(flushMeasurements);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
function cancelMeasurement(key) {
|
|
1155
|
-
pendingMeasurements.delete(key);
|
|
1156
|
-
if (pendingMeasurements.size === 0 && measurementFrame !== 0) {
|
|
1157
|
-
cancelAnimationFrame(measurementFrame);
|
|
1158
|
-
measurementFrame = 0;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
const useIsomorphicLayoutEffect = typeof window === "undefined" ? reactExports.useEffect : reactExports.useLayoutEffect;
|
|
1162
|
-
function createFullState(value, graphemes) {
|
|
1163
|
-
return {
|
|
1164
|
-
displayText: value,
|
|
1165
|
-
isTruncated: false,
|
|
1166
|
-
prefixGraphemeCount: graphemes.length,
|
|
1167
|
-
prefixText: value,
|
|
1168
|
-
suffixGraphemeCount: 0,
|
|
1169
|
-
suffixText: ""
|
|
1170
|
-
};
|
|
1171
|
-
}
|
|
1172
|
-
function useMiddleTruncate(value) {
|
|
1173
|
-
const graphemes = reactExports.useMemo(() => toGraphemes(value), [value]);
|
|
1174
|
-
const fullState = reactExports.useMemo(() => createFullState(value, graphemes), [graphemes, value]);
|
|
1175
|
-
const ref = reactExports.useRef(null);
|
|
1176
|
-
const measureRef = reactExports.useRef(null);
|
|
1177
|
-
const [state, setState] = reactExports.useState(() => fullState);
|
|
1178
|
-
const measurementKeyRef = reactExports.useRef({});
|
|
1179
|
-
const textMeasurementCacheRef = reactExports.useRef({
|
|
1180
|
-
typography: "",
|
|
1181
|
-
value,
|
|
1182
|
-
widths: /* @__PURE__ */ new Map()
|
|
1183
|
-
});
|
|
1184
|
-
const lastMeasurementRef = reactExports.useRef(null);
|
|
1185
|
-
const updateState = reactExports.useCallback((nextState) => {
|
|
1186
|
-
setState((currentState) => {
|
|
1187
|
-
if (currentState.displayText === nextState.displayText && currentState.isTruncated === nextState.isTruncated && currentState.prefixText === nextState.prefixText && currentState.prefixGraphemeCount === nextState.prefixGraphemeCount && currentState.suffixText === nextState.suffixText && currentState.suffixGraphemeCount === nextState.suffixGraphemeCount) {
|
|
1188
|
-
return currentState;
|
|
1189
|
-
}
|
|
1190
|
-
return nextState;
|
|
1191
|
-
});
|
|
1192
|
-
}, []);
|
|
1193
|
-
const readMeasurement = reactExports.useCallback(() => {
|
|
1194
|
-
const el = ref.current;
|
|
1195
|
-
const measureEl = measureRef.current;
|
|
1196
|
-
if (!el || !measureEl)
|
|
1197
|
-
return null;
|
|
1198
|
-
const availableWidth = el.clientWidth;
|
|
1199
|
-
const style = getComputedStyle(measureEl);
|
|
1200
|
-
return {
|
|
1201
|
-
availableWidth,
|
|
1202
|
-
typography: [
|
|
1203
|
-
style.fontFamily,
|
|
1204
|
-
style.fontFeatureSettings,
|
|
1205
|
-
style.fontKerning,
|
|
1206
|
-
style.fontSize,
|
|
1207
|
-
style.fontStretch,
|
|
1208
|
-
style.fontStyle,
|
|
1209
|
-
style.fontVariationSettings,
|
|
1210
|
-
style.fontWeight,
|
|
1211
|
-
style.letterSpacing,
|
|
1212
|
-
style.textTransform
|
|
1213
|
-
].join("\0")
|
|
1214
|
-
};
|
|
1215
|
-
}, []);
|
|
1216
|
-
const recalculate = reactExports.useCallback(({ availableWidth, typography }) => {
|
|
1217
|
-
const measureEl = measureRef.current;
|
|
1218
|
-
if (!measureEl)
|
|
1219
|
-
return;
|
|
1220
|
-
const lastMeasurement = lastMeasurementRef.current;
|
|
1221
|
-
if ((lastMeasurement == null ? void 0 : lastMeasurement.availableWidth) === availableWidth && lastMeasurement.typography === typography && lastMeasurement.value === value) {
|
|
1222
|
-
return;
|
|
1223
|
-
}
|
|
1224
|
-
lastMeasurementRef.current = {
|
|
1225
|
-
availableWidth,
|
|
1226
|
-
typography,
|
|
1227
|
-
value
|
|
1228
|
-
};
|
|
1229
|
-
if (availableWidth <= 0) {
|
|
1230
|
-
updateState(fullState);
|
|
1231
|
-
return;
|
|
1232
|
-
}
|
|
1233
|
-
const textMeasurementCache = textMeasurementCacheRef.current;
|
|
1234
|
-
if (textMeasurementCache.typography !== typography || textMeasurementCache.value !== value) {
|
|
1235
|
-
textMeasurementCache.typography = typography;
|
|
1236
|
-
textMeasurementCache.value = value;
|
|
1237
|
-
textMeasurementCache.widths.clear();
|
|
1238
|
-
}
|
|
1239
|
-
const measure = (text) => {
|
|
1240
|
-
const cachedWidth = textMeasurementCache.widths.get(text);
|
|
1241
|
-
if (cachedWidth !== void 0) {
|
|
1242
|
-
return cachedWidth;
|
|
1243
|
-
}
|
|
1244
|
-
measureEl.textContent = text;
|
|
1245
|
-
const width = measureEl.scrollWidth;
|
|
1246
|
-
textMeasurementCache.widths.set(text, width);
|
|
1247
|
-
return width;
|
|
1248
|
-
};
|
|
1249
|
-
const fullWidth = measure(value);
|
|
1250
|
-
if (fullWidth <= availableWidth) {
|
|
1251
|
-
updateState(fullState);
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
|
-
const result = middleTruncate(graphemes, availableWidth, measure, fullWidth);
|
|
1255
|
-
updateState({
|
|
1256
|
-
displayText: result.text,
|
|
1257
|
-
isTruncated: result.truncated,
|
|
1258
|
-
prefixGraphemeCount: result.prefixGraphemeCount,
|
|
1259
|
-
prefixText: result.prefixText,
|
|
1260
|
-
suffixGraphemeCount: result.suffixGraphemeCount,
|
|
1261
|
-
suffixText: result.suffixText
|
|
1262
|
-
});
|
|
1263
|
-
}, [fullState, graphemes, updateState, value]);
|
|
1264
|
-
useIsomorphicLayoutEffect(() => {
|
|
1265
|
-
const measurement = readMeasurement();
|
|
1266
|
-
if (measurement) {
|
|
1267
|
-
recalculate(measurement);
|
|
1268
|
-
}
|
|
1269
|
-
}, [readMeasurement, recalculate]);
|
|
1270
|
-
reactExports.useEffect(() => {
|
|
1271
|
-
var _a;
|
|
1272
|
-
const el = ref.current;
|
|
1273
|
-
if (!el)
|
|
1274
|
-
return;
|
|
1275
|
-
const measurementKey = measurementKeyRef.current;
|
|
1276
|
-
const scheduleRecalculation = () => {
|
|
1277
|
-
scheduleMeasurement(measurementKey, {
|
|
1278
|
-
read: readMeasurement,
|
|
1279
|
-
measure: recalculate
|
|
1280
|
-
});
|
|
1281
|
-
};
|
|
1282
|
-
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(scheduleRecalculation) : null;
|
|
1283
|
-
ro == null ? void 0 : ro.observe(el);
|
|
1284
|
-
if (!ro) {
|
|
1285
|
-
window.addEventListener("resize", scheduleRecalculation);
|
|
1286
|
-
}
|
|
1287
|
-
const onFontsLoaded = () => {
|
|
1288
|
-
textMeasurementCacheRef.current.widths.clear();
|
|
1289
|
-
lastMeasurementRef.current = null;
|
|
1290
|
-
scheduleRecalculation();
|
|
1291
|
-
};
|
|
1292
|
-
const fontSet = "fonts" in document ? document.fonts : null;
|
|
1293
|
-
(_a = fontSet == null ? void 0 : fontSet.addEventListener) == null ? void 0 : _a.call(fontSet, "loadingdone", onFontsLoaded);
|
|
1294
|
-
return () => {
|
|
1295
|
-
var _a2;
|
|
1296
|
-
ro == null ? void 0 : ro.disconnect();
|
|
1297
|
-
if (!ro) {
|
|
1298
|
-
window.removeEventListener("resize", scheduleRecalculation);
|
|
1299
|
-
}
|
|
1300
|
-
cancelMeasurement(measurementKey);
|
|
1301
|
-
(_a2 = fontSet == null ? void 0 : fontSet.removeEventListener) == null ? void 0 : _a2.call(fontSet, "loadingdone", onFontsLoaded);
|
|
1302
|
-
};
|
|
1303
|
-
}, [readMeasurement, recalculate]);
|
|
1304
|
-
return {
|
|
1305
|
-
ref,
|
|
1306
|
-
measureRef,
|
|
1307
|
-
displayText: state.displayText,
|
|
1308
|
-
isTruncated: state.isTruncated,
|
|
1309
|
-
prefixGraphemeCount: state.prefixGraphemeCount,
|
|
1310
|
-
prefixText: state.prefixText,
|
|
1311
|
-
suffixGraphemeCount: state.suffixGraphemeCount,
|
|
1312
|
-
suffixText: state.suffixText
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
function getRangeOffsets(container, range) {
|
|
1316
|
-
if (!container.contains(range.startContainer) || !container.contains(range.endContainer)) {
|
|
1317
|
-
return null;
|
|
1318
|
-
}
|
|
1319
|
-
let startRange;
|
|
1320
|
-
let endRange;
|
|
1321
|
-
try {
|
|
1322
|
-
startRange = document.createRange();
|
|
1323
|
-
startRange.selectNodeContents(container);
|
|
1324
|
-
startRange.setEnd(range.startContainer, range.startOffset);
|
|
1325
|
-
endRange = document.createRange();
|
|
1326
|
-
endRange.selectNodeContents(container);
|
|
1327
|
-
endRange.setEnd(range.endContainer, range.endOffset);
|
|
1328
|
-
} catch {
|
|
1329
|
-
return null;
|
|
1330
|
-
}
|
|
1331
|
-
return {
|
|
1332
|
-
end: endRange.toString().length,
|
|
1333
|
-
start: startRange.toString().length
|
|
1334
|
-
};
|
|
1335
|
-
}
|
|
1336
|
-
function MiddleTruncate({ value, className, onCopy: onCopyProp, ...props }) {
|
|
1337
|
-
const { ref, measureRef, displayText, isTruncated, prefixText, suffixText } = useMiddleTruncate(value);
|
|
1338
|
-
const visibleRef = reactExports.useRef(null);
|
|
1339
|
-
const handleCopy = reactExports.useCallback((e) => {
|
|
1340
|
-
onCopyProp == null ? void 0 : onCopyProp(e);
|
|
1341
|
-
if (e.defaultPrevented || !isTruncated)
|
|
1342
|
-
return;
|
|
1343
|
-
const selection = window.getSelection();
|
|
1344
|
-
if (!selection || selection.rangeCount === 0)
|
|
1345
|
-
return;
|
|
1346
|
-
const selectionText = selection.toString();
|
|
1347
|
-
if (!selectionText)
|
|
1348
|
-
return;
|
|
1349
|
-
const range = selection.getRangeAt(0);
|
|
1350
|
-
const visibleEl = visibleRef.current;
|
|
1351
|
-
let copyText = null;
|
|
1352
|
-
if (selectionText.includes(ELLIPSIS) && e.currentTarget.contains(range.startContainer) && e.currentTarget.contains(range.endContainer) && visibleEl) {
|
|
1353
|
-
const offsets = getRangeOffsets(visibleEl, range);
|
|
1354
|
-
if (offsets) {
|
|
1355
|
-
copyText = getMiddleTruncateCopyText({
|
|
1356
|
-
prefixText,
|
|
1357
|
-
selectionEnd: offsets.end,
|
|
1358
|
-
selectionStart: offsets.start,
|
|
1359
|
-
suffixText,
|
|
1360
|
-
value
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
copyText ?? (copyText = getMiddleTruncateCopyTextFromSelectionText({
|
|
1365
|
-
prefixText,
|
|
1366
|
-
selectionText,
|
|
1367
|
-
suffixText,
|
|
1368
|
-
value
|
|
1369
|
-
}));
|
|
1370
|
-
if (copyText === null)
|
|
1371
|
-
return;
|
|
1372
|
-
e.preventDefault();
|
|
1373
|
-
e.clipboardData.setData("text/plain", copyText);
|
|
1374
|
-
}, [onCopyProp, isTruncated, prefixText, suffixText, value]);
|
|
1375
|
-
return jsxRuntimeExports.jsxs("span", { title: isTruncated ? value : void 0, ...props, ref, className: cn("relative inline-grid min-w-0 max-w-full overflow-hidden whitespace-nowrap", className), onCopy: handleCopy, children: [isTruncated && jsxRuntimeExports.jsx("span", { className: "sr-only select-none", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none col-start-1 row-start-1 invisible select-none whitespace-nowrap", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": isTruncated || void 0, className: "col-start-1 row-start-1 min-w-0 overflow-hidden", ref: visibleRef, children: isTruncated ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { children: prefixText }), jsxRuntimeExports.jsx("span", { children: ELLIPSIS }), jsxRuntimeExports.jsx("span", { children: suffixText })] }) : displayText }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute left-0 top-0 inline-block invisible select-none whitespace-nowrap", ref: measureRef })] });
|
|
1376
|
-
}
|
|
1377
942
|
function isReservedAttributeKey(key) {
|
|
1378
943
|
return key.startsWith(RESERVED_ATTRIBUTE_KEY_PREFIX);
|
|
1379
944
|
}
|
|
@@ -1618,7 +1183,7 @@ function DraggableBorder({ element, position, onWidthChange, onReset, "aria-labe
|
|
|
1618
1183
|
if (movedRef.current || performance.now() - lastDragEndAtRef.current < 500) {
|
|
1619
1184
|
return;
|
|
1620
1185
|
}
|
|
1621
|
-
onReset
|
|
1186
|
+
onReset?.();
|
|
1622
1187
|
};
|
|
1623
1188
|
const handleKeyDown = (e) => {
|
|
1624
1189
|
const el = element.current;
|
|
@@ -1882,18 +1447,17 @@ function SearchInput({ value, onValueChange, label, className, id, onKeyDown, on
|
|
|
1882
1447
|
};
|
|
1883
1448
|
}, []);
|
|
1884
1449
|
const clear = () => {
|
|
1885
|
-
var _a;
|
|
1886
1450
|
onValueChange("");
|
|
1887
|
-
|
|
1451
|
+
inputRef.current?.focus();
|
|
1888
1452
|
};
|
|
1889
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) => {
|
|
1890
|
-
onFocus
|
|
1454
|
+
onFocus?.(e);
|
|
1891
1455
|
setFocusVisible(lastInputRef.current === "keyboard");
|
|
1892
1456
|
}, onBlur: (e) => {
|
|
1893
|
-
onBlur
|
|
1457
|
+
onBlur?.(e);
|
|
1894
1458
|
setFocusVisible(false);
|
|
1895
1459
|
}, onKeyDown: (e) => {
|
|
1896
|
-
onKeyDown
|
|
1460
|
+
onKeyDown?.(e);
|
|
1897
1461
|
if (e.defaultPrevented)
|
|
1898
1462
|
return;
|
|
1899
1463
|
if (e.key === "Escape" && value) {
|
|
@@ -1918,56 +1482,6 @@ function EventListToolbar({ query, hint: hint2, onQueryChange }) {
|
|
|
1918
1482
|
const shownHint = paused ? hint2 : null;
|
|
1919
1483
|
return jsxRuntimeExports.jsxs("div", { className: "shrink-0", children: [jsxRuntimeExports.jsx(SearchInput, { name: "event-list-search", label: "Search events", placeholder: "Search by step ID, wait ID, hook ID, or event ID…", "aria-describedby": hintId, value: query, onValueChange: handleQueryChange, className: "pl-[34px]" }), jsxRuntimeExports.jsx("div", { id: hintId, "aria-live": "polite", children: shownHint ? jsxRuntimeExports.jsxs("div", { className: "flex h-8 items-center gap-1.5 bg-gray-100 pl-[34px] pr-2 text-label-13 text-gray-1000", children: [jsxRuntimeExports.jsx(Info, { className: "h-3.5 w-3.5 shrink-0 text-gray-900" }), jsxRuntimeExports.jsx("span", { className: "min-w-0 truncate", children: shownHint })] }) : null })] });
|
|
1920
1484
|
}
|
|
1921
|
-
const WorkflowIcon = () => {
|
|
1922
|
-
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { d: "M5.75 7L6.4209 7.33594L4.85254 10.4717C5.38789 10.771 5.75 11.3431 5.75 12V14C5.75 14.9665 4.96648 15.75 4 15.75H2C1.03352 15.75 0.25 14.9665 0.25 14V12C0.25 11.0335 1.03352 10.25 2 10.25H3.28711L5.0791 6.66504L5.75 7ZM14 10.25C14.9665 10.25 15.75 11.0335 15.75 12V14C15.75 14.9665 14.9665 15.75 14 15.75H12C11.1185 15.75 10.3909 15.098 10.2695 14.25H7V12.75H10.25V12C10.25 11.0335 11.0335 10.25 12 10.25H14ZM2 11.75C1.86192 11.75 1.75 11.8619 1.75 12V14C1.75 14.1381 1.86192 14.25 2 14.25H4C4.13808 14.25 4.25 14.1381 4.25 14V12C4.25 11.8619 4.13808 11.75 4 11.75H2ZM12 11.75C11.8619 11.75 11.75 11.8619 11.75 12V14C11.75 14.1381 11.8619 14.25 12 14.25H14C14.1381 14.25 14.25 14.1381 14.25 14V12C14.25 11.8619 14.1381 11.75 14 11.75H12ZM9 0.25C9.96649 0.25 10.75 1.03351 10.75 2V4C10.75 4.44642 10.5808 4.85197 10.3057 5.16113L12.2041 8.6416L10.8877 9.36035L8.91895 5.75H7C6.03351 5.75 5.25 4.96649 5.25 4V2C5.25 1.03351 6.03351 0.25 7 0.25H9ZM7 1.75C6.86193 1.75 6.75 1.86193 6.75 2V4C6.75 4.13807 6.86193 4.25 7 4.25H9C9.13807 4.25 9.25 4.13807 9.25 4V2C9.25 1.86193 9.13807 1.75 9 1.75H7Z", fill: "currentColor" }) });
|
|
1923
|
-
};
|
|
1924
|
-
const WebhookIcon = () => {
|
|
1925
|
-
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.8349 3.24994C5.14454 4.44567 5.55423 5.97464 6.74996 6.665L7.39465 7.03721L7.02726 7.68466L5.14599 11C5.21289 11.1531 5.25 11.3222 5.25 11.5C5.25 12.1904 4.69036 12.75 4 12.75C3.30964 12.75 2.75 12.1904 2.75 11.5C2.75 10.8634 3.22584 10.338 3.84123 10.26L5.38944 7.5316C3.95909 6.30274 3.55857 4.19264 4.53586 2.49994C5.64043 0.586765 8.08679 -0.0687357 9.99996 1.03583C11.836 2.09584 12.5137 4.39156 11.5892 6.26591L10.4949 4.33754C10.4418 3.53274 10.0009 2.76843 9.24996 2.33487C8.05423 1.64452 6.52525 2.0542 5.8349 3.24994ZM9.146 4.99996C9.21289 4.84686 9.25 4.67776 9.25 4.5C9.25 3.80964 8.69036 3.25 8 3.25C7.30964 3.25 6.75 3.80964 6.75 4.5C6.75 5.13659 7.22586 5.66203 7.84127 5.74002L9.72266 9.05556L10.0956 9.71274L10.75 9.33493C11.9457 8.64458 13.4747 9.05427 14.165 10.25C14.8554 11.4457 14.4457 12.9747 13.25 13.6651C12.5047 14.0953 11.63 14.0983 10.9096 13.75H8.69252C9.85895 15.4685 12.1727 16.0191 14 14.9641C15.9131 13.8595 16.5686 11.4132 15.4641 9.5C14.4886 7.81038 12.4665 7.10169 10.6895 7.71998L9.146 4.99996ZM13.25 11.5C13.25 12.1904 12.6904 12.75 12 12.75C11.591 12.75 11.228 12.5536 10.9999 12.25H7.9298C7.57875 14.1006 5.95279 15.5 4 15.5C1.79086 15.5 0 13.7091 0 11.5C0 9.40018 1.61801 7.67826 3.67529 7.51299L2.58098 9.44147C1.92792 9.89251 1.5 10.6463 1.5 11.5C1.5 12.8807 2.61929 14 4 14C5.38071 14 6.5 12.8807 6.5 11.5V10.75H7.25H10.9999C11.228 10.4464 11.591 10.25 12 10.25C12.6904 10.25 13.25 10.8096 13.25 11.5Z", fill: "currentColor" }) });
|
|
1926
|
-
};
|
|
1927
|
-
const SleepIcon = () => {
|
|
1928
|
-
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.25 1.25V2.03971C5.87928 2.18571 4.62678 2.72736 3.6089 3.54824L3.03033 2.96967L2.5 2.43934L1.43934 3.5L1.96967 4.03033L2.54824 4.6089C1.57979 5.80976 1 7.33717 1 9C1 12.866 4.13401 16 8 16C11.866 16 15 12.866 15 9C15 7.33717 14.4202 5.80976 13.4518 4.6089L14.0303 4.03033L14.5607 3.5L13.5 2.43934L12.9697 2.96967L12.3911 3.54824C11.3732 2.72736 10.1207 2.18571 8.75 2.03971V1.25H9.25H10V-0.25H9.25H8.75H7.25H6.75H6V1.25H6.75H7.25ZM2.5 9C2.5 5.96243 4.96243 3.5 8 3.5C11.0376 3.5 13.5 5.96243 13.5 9C13.5 12.0376 11.0376 14.5 8 14.5C4.96243 14.5 2.5 12.0376 2.5 9ZM8.75 6.75V6H7.25V6.75V9V9.75H8.75V9V6.75Z", fill: "currentColor" }) });
|
|
1929
|
-
};
|
|
1930
|
-
const StepForwardIcon = () => {
|
|
1931
|
-
return jsxRuntimeExports.jsx("svg", { "aria-hidden": "true", "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.21969 12.5303L4.75002 13.0607L5.81068 12L5.28035 11.4697L1.81068 7.99999L5.28035 4.53032L5.81068 3.99999L4.75002 2.93933L4.21969 3.46966L0.39647 7.29289C0.00594562 7.68341 0.00594562 8.31658 0.39647 8.7071L4.21969 12.5303ZM11.7804 12.5303L11.25 13.0607L10.1894 12L10.7197 11.4697L14.1894 7.99999L10.7197 4.53032L10.1894 3.99999L11.25 2.93933L11.7804 3.46966L15.6036 7.29289C15.9941 7.68341 15.9941 8.31658 15.6036 8.7071L11.7804 12.5303Z", fill: "currentColor" }) });
|
|
1932
|
-
};
|
|
1933
|
-
const eventStyles = {
|
|
1934
|
-
run: { icon: WorkflowIcon, className: "text-blue-900", label: "Workflow" },
|
|
1935
|
-
step: { icon: StepForwardIcon, className: "text-green-900", label: "Step" },
|
|
1936
|
-
hook: { icon: WebhookIcon, className: "text-gray-900", label: "Hook" },
|
|
1937
|
-
sleep: { icon: SleepIcon, className: "text-gray-900", label: "Sleep" }
|
|
1938
|
-
};
|
|
1939
|
-
const defaultStyle = {
|
|
1940
|
-
icon: Circle,
|
|
1941
|
-
className: "text-gray-900",
|
|
1942
|
-
label: "Event"
|
|
1943
|
-
};
|
|
1944
|
-
const ROW_HEIGHT_CLASS = "h-10";
|
|
1945
|
-
function getEventStyle(resource, isErrored, isCancelled) {
|
|
1946
|
-
const style = eventStyles[resource] ?? defaultStyle;
|
|
1947
|
-
return {
|
|
1948
|
-
icon: style.icon,
|
|
1949
|
-
className: cn(isErrored ? "text-red-900" : isCancelled ? "text-gray-900" : style.className),
|
|
1950
|
-
label: style.label
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
function ResourceIcon({ resource, isErrored = false, isCancelled = false }) {
|
|
1954
|
-
const { icon: Icon, className, label } = getEventStyle(resource, isErrored, isCancelled);
|
|
1955
|
-
return jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 500, children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx("span", { className: cn("shrink-0", className), children: jsxRuntimeExports.jsx(Icon, { className: "w-4 h-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: label })] });
|
|
1956
|
-
}
|
|
1957
|
-
const EventRow$1 = ({ span, isSelected, isDimmed, onSelectSpan }) => {
|
|
1958
|
-
const durationMs = getSpanDurationMs(span);
|
|
1959
|
-
const isErrored = isSpanErrored(span);
|
|
1960
|
-
const isCancelled = isSpanCancelled(span);
|
|
1961
|
-
return jsxRuntimeExports.jsx("li", { className: cn("relative overflow-clip transition-opacity hover:bg-gray-100 aria-selected:bg-gray-100 aria-selected:hover:bg-gray-200", ROW_HEIGHT_CLASS, isDimmed && "opacity-35"), role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, onClick: () => onSelectSpan(span.spanId), children: jsxRuntimeExports.jsxs("div", { className: "flex h-full min-w-0 items-center pl-4 pr-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [jsxRuntimeExports.jsx(ResourceIcon, { resource: span.resource, isErrored, isCancelled }), jsxRuntimeExports.jsx("span", { className: "min-w-0 text-label-14", children: jsxRuntimeExports.jsx(MiddleTruncate, { value: span.name }) })] }), jsxRuntimeExports.jsx("div", { className: "ml-2 shrink-0", children: jsxRuntimeExports.jsx("span", { className: "text-label-14 text-gray-900 tabular-nums", children: formatDurationPrecise(durationMs) }) })] }) });
|
|
1962
|
-
};
|
|
1963
|
-
const EventList = ({ spans, activeSpanId, searchResult, onSelectSpan }) => {
|
|
1964
|
-
const listRef = reactExports.useRef(null);
|
|
1965
|
-
const { start, end } = useRowWindow(listRef, spans.length, ROW_HEIGHT_PX);
|
|
1966
|
-
return jsxRuntimeExports.jsx("ul", { ref: listRef, id: "event-list", role: "tree", className: "block min-h-0 overflow-visible divide-y divide-gray-400 border-b border-gray-400", style: {
|
|
1967
|
-
paddingTop: start * ROW_HEIGHT_PX,
|
|
1968
|
-
paddingBottom: (spans.length - end) * ROW_HEIGHT_PX
|
|
1969
|
-
}, children: spans.slice(start, end).map((span) => jsxRuntimeExports.jsx(EventRow$1, { span, isSelected: span.spanId === activeSpanId, isDimmed: isSpanDimmedBySearch(span.spanId, searchResult), onSelectSpan }, span.spanId)) });
|
|
1970
|
-
};
|
|
1971
1485
|
function EventNoticeTooltip({ notice, children }) {
|
|
1972
1486
|
if (!notice)
|
|
1973
1487
|
return children;
|
|
@@ -2111,7 +1625,7 @@ function useEventSearch(onExactIdSearch) {
|
|
|
2111
1625
|
}
|
|
2112
1626
|
if (!onExactIdSearch)
|
|
2113
1627
|
return { status: "unavailable", query: trimmed };
|
|
2114
|
-
if (
|
|
1628
|
+
if (outcome?.query !== trimmed || outcome.attempt !== attempt) {
|
|
2115
1629
|
return { status: "loading", query: trimmed, id: parsed };
|
|
2116
1630
|
}
|
|
2117
1631
|
return { ...outcome.answer, query: trimmed, id: parsed };
|
|
@@ -2128,7 +1642,7 @@ function useElementWidth(ref, enabled = true) {
|
|
|
2128
1642
|
return;
|
|
2129
1643
|
setWidth(Math.round(el.getBoundingClientRect().width));
|
|
2130
1644
|
const observer = new ResizeObserver(([entry]) => {
|
|
2131
|
-
setWidth(Math.round(
|
|
1645
|
+
setWidth(Math.round(entry?.contentRect.width ?? 0));
|
|
2132
1646
|
});
|
|
2133
1647
|
observer.observe(el);
|
|
2134
1648
|
return () => observer.disconnect();
|
|
@@ -2183,7 +1697,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2183
1697
|
const event = knownEvents.find((e) => e.eventId === selectedEventId);
|
|
2184
1698
|
return event ? buildEventRow(event, lookups) : void 0;
|
|
2185
1699
|
}, [selectedEventId, knownEvents, lookups]);
|
|
2186
|
-
const relatedKey = search.status === "ok" ? search.id.kind === "event" ? getEventEntity(search.events[0]).key : search.id.id :
|
|
1700
|
+
const relatedKey = search.status === "ok" ? search.id.kind === "event" ? getEventEntity(search.events[0]).key : search.id.id : selectedRow?.entity.key ?? null;
|
|
2187
1701
|
const [visibleRange, setVisibleRange] = reactExports.useState({
|
|
2188
1702
|
startIndex: 0,
|
|
2189
1703
|
endIndex: 0
|
|
@@ -2191,14 +1705,11 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2191
1705
|
const relatedIndexes = reactExports.useMemo(() => listItems.flatMap((item, i) => item.kind === "event" && item.row.entity.key === relatedKey ? [i] : []), [listItems, relatedKey]);
|
|
2192
1706
|
const relatedAbove = relatedIndexes.filter((i) => i < visibleRange.startIndex);
|
|
2193
1707
|
const relatedBelow = relatedIndexes.filter((i) => i > visibleRange.endIndex);
|
|
2194
|
-
const scrollToItem = (index) => {
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
behavior: "smooth"
|
|
2200
|
-
});
|
|
2201
|
-
};
|
|
1708
|
+
const scrollToItem = (index) => virtuosoRef.current?.scrollToIndex({
|
|
1709
|
+
index,
|
|
1710
|
+
align: "center",
|
|
1711
|
+
behavior: "smooth"
|
|
1712
|
+
});
|
|
2202
1713
|
const eventDataCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
2203
1714
|
const cacheEventData = reactExports.useCallback((eventId, data) => {
|
|
2204
1715
|
eventDataCacheRef.current.set(eventId, data);
|
|
@@ -2211,7 +1722,6 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2211
1722
|
const isRefetching = isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
|
|
2212
1723
|
const selectedIndex = selectedEventId ? rows.findIndex((row) => row.event.eventId === selectedEventId) : -1;
|
|
2213
1724
|
const moveSelection = reactExports.useCallback((delta) => {
|
|
2214
|
-
var _a;
|
|
2215
1725
|
if (rows.length === 0)
|
|
2216
1726
|
return;
|
|
2217
1727
|
const nextIndex = selectedIndex === -1 ? 0 : Math.min(Math.max(selectedIndex + delta, 0), rows.length - 1);
|
|
@@ -2219,11 +1729,10 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2219
1729
|
setSelectedEventId(next.eventId);
|
|
2220
1730
|
const itemIndex = listItems.findIndex((item) => item.kind === "event" && item.row.event.eventId === next.eventId);
|
|
2221
1731
|
if (itemIndex >= 0) {
|
|
2222
|
-
|
|
1732
|
+
virtuosoRef.current?.scrollIntoView({ index: itemIndex });
|
|
2223
1733
|
}
|
|
2224
1734
|
requestAnimationFrame(() => {
|
|
2225
|
-
|
|
2226
|
-
(_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();
|
|
2227
1736
|
});
|
|
2228
1737
|
}, [selectedIndex, rows, listItems]);
|
|
2229
1738
|
const handleListKeyDown = reactExports.useCallback((e) => {
|
|
@@ -2249,7 +1758,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2249
1758
|
return item.kind === "gap" ? item.key : item.row.event.eventId;
|
|
2250
1759
|
}, endReached: () => {
|
|
2251
1760
|
if (list.hasMore && !isLoadingMoreEvents) {
|
|
2252
|
-
void
|
|
1761
|
+
void onLoadMoreEvents?.();
|
|
2253
1762
|
}
|
|
2254
1763
|
}, components: { Footer: () => jsxRuntimeExports.jsx("div", { className: "h-2" }) }, itemContent: (i) => {
|
|
2255
1764
|
const item = listItems[i];
|
|
@@ -2262,7 +1771,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
|
|
|
2262
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, {
|
|
2263
1772
|
total: sortedEvents.length,
|
|
2264
1773
|
hasMoreEvents
|
|
2265
|
-
}) }), 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
|
|
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] })] }) });
|
|
2266
1775
|
}
|
|
2267
1776
|
function RelatedHint({ direction, count, onClick }) {
|
|
2268
1777
|
const label = `${count} related ${count === 1 ? "event" : "events"}`;
|
|
@@ -2337,9 +1846,9 @@ function TraceViewerSkeleton() {
|
|
|
2337
1846
|
}
|
|
2338
1847
|
function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargin = "0%", freezeOnceVisible = false } = {}) {
|
|
2339
1848
|
const [entry, setEntry] = reactExports.useState();
|
|
2340
|
-
const frozen =
|
|
1849
|
+
const frozen = entry?.isIntersecting && freezeOnceVisible;
|
|
2341
1850
|
reactExports.useEffect(() => {
|
|
2342
|
-
const node = elementRef
|
|
1851
|
+
const node = elementRef?.current;
|
|
2343
1852
|
const hasIOSupport = !!window.IntersectionObserver;
|
|
2344
1853
|
if (!hasIOSupport || frozen || !node)
|
|
2345
1854
|
return;
|
|
@@ -2348,7 +1857,7 @@ function useIntersectionObserver(elementRef, { threshold = 0, rootRef, rootMargi
|
|
|
2348
1857
|
};
|
|
2349
1858
|
const observer = new IntersectionObserver(updateEntry, {
|
|
2350
1859
|
threshold,
|
|
2351
|
-
root:
|
|
1860
|
+
root: rootRef?.current ?? null,
|
|
2352
1861
|
rootMargin
|
|
2353
1862
|
});
|
|
2354
1863
|
observer.observe(node);
|
|
@@ -2364,10 +1873,10 @@ function useLoadMoreOnScroll(loadMore, { hasMore, isLoadingMore, rootRef, rootMa
|
|
|
2364
1873
|
loadMoreRef.current = loadMore;
|
|
2365
1874
|
}, [loadMore]);
|
|
2366
1875
|
reactExports.useEffect(() => {
|
|
2367
|
-
if (
|
|
1876
|
+
if (entry?.isIntersecting && hasMore && !isLoadingMore) {
|
|
2368
1877
|
loadMoreRef.current();
|
|
2369
1878
|
}
|
|
2370
|
-
}, [entry
|
|
1879
|
+
}, [entry?.isIntersecting, hasMore, isLoadingMore]);
|
|
2371
1880
|
return sentinelRef;
|
|
2372
1881
|
}
|
|
2373
1882
|
function ConversationView({ messages }) {
|
|
@@ -2437,17 +1946,17 @@ function parseContent(content) {
|
|
|
2437
1946
|
if (typeof part === "string") {
|
|
2438
1947
|
return { type: "text", text: part };
|
|
2439
1948
|
}
|
|
2440
|
-
if (
|
|
1949
|
+
if (part?.type === "text") {
|
|
2441
1950
|
return { type: "text", text: String(part.text ?? "") };
|
|
2442
1951
|
}
|
|
2443
|
-
if (
|
|
1952
|
+
if (part?.type === "tool-call") {
|
|
2444
1953
|
return {
|
|
2445
1954
|
type: "tool-call",
|
|
2446
1955
|
toolName: part.toolName,
|
|
2447
1956
|
input: part.input
|
|
2448
1957
|
};
|
|
2449
1958
|
}
|
|
2450
|
-
if (
|
|
1959
|
+
if (part?.type === "tool-result") {
|
|
2451
1960
|
return {
|
|
2452
1961
|
type: "tool-result",
|
|
2453
1962
|
toolName: part.toolName,
|
|
@@ -2674,7 +2183,7 @@ const attributeToDisplayFn = {
|
|
|
2674
2183
|
// A force-claimed hook (`experimental_force`): the run whose token it took.
|
|
2675
2184
|
claimedFrom: (value) => {
|
|
2676
2185
|
const from = value;
|
|
2677
|
-
return typeof
|
|
2186
|
+
return typeof from?.runId === "string" ? from.runId : null;
|
|
2678
2187
|
},
|
|
2679
2188
|
isWebhook: (value) => String(value),
|
|
2680
2189
|
isSystem: (value) => String(value),
|
|
@@ -2732,7 +2241,7 @@ const attributeToDisplayFn = {
|
|
|
2732
2241
|
},
|
|
2733
2242
|
input: (value, context) => {
|
|
2734
2243
|
if (isEncryptedMarker(value)) {
|
|
2735
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context
|
|
2244
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
2736
2245
|
}
|
|
2737
2246
|
if (isExpiredMarker(value))
|
|
2738
2247
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
@@ -2741,31 +2250,31 @@ const attributeToDisplayFn = {
|
|
|
2741
2250
|
const hasClosureVars = hasDisplayContent(closureVars);
|
|
2742
2251
|
const hasThisVal = hasDisplayContent(thisVal);
|
|
2743
2252
|
const hasArgs = hasDisplayContent(args);
|
|
2744
|
-
if (
|
|
2253
|
+
if (context?.stepName && isDoStreamStep(context.stepName)) {
|
|
2745
2254
|
const conversation = extractConversation(args);
|
|
2746
2255
|
if (conversation && conversation.length > 0) {
|
|
2747
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args, defaultOpen: context
|
|
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) })] });
|
|
2748
2257
|
}
|
|
2749
2258
|
}
|
|
2750
2259
|
if (!hasArgs && !hasClosureVars && !hasThisVal) {
|
|
2751
2260
|
return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
|
|
2752
2261
|
}
|
|
2753
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context
|
|
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) })] });
|
|
2754
2263
|
}
|
|
2755
2264
|
if (!hasDisplayContent(value)) {
|
|
2756
2265
|
return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
|
|
2757
2266
|
}
|
|
2758
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", defaultOpen: context
|
|
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) });
|
|
2759
2268
|
},
|
|
2760
2269
|
output: (value, context) => {
|
|
2761
2270
|
if (isEncryptedMarker(value)) {
|
|
2762
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context
|
|
2271
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
2763
2272
|
}
|
|
2764
2273
|
if (!hasDisplayContent(value))
|
|
2765
2274
|
return null;
|
|
2766
2275
|
if (isExpiredMarker(value))
|
|
2767
2276
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
2768
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context
|
|
2277
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: JsonBlock(value) });
|
|
2769
2278
|
},
|
|
2770
2279
|
error: (value) => {
|
|
2771
2280
|
if (isEncryptedMarker(value)) {
|
|
@@ -2801,7 +2310,7 @@ const attributeToDisplayFn = {
|
|
|
2801
2310
|
encryptionPublicKey: (_value) => null,
|
|
2802
2311
|
// The token of the Hook `start({ experimental_hook })` created: the run's idempotency key.
|
|
2803
2312
|
startHook: (value) => {
|
|
2804
|
-
const token = value
|
|
2313
|
+
const token = value?.token;
|
|
2805
2314
|
return typeof token === "string" && token.length > 0 ? token : null;
|
|
2806
2315
|
},
|
|
2807
2316
|
// A dynamic run's own workflow code — the code the run actually executed,
|
|
@@ -2814,13 +2323,13 @@ const attributeToDisplayFn = {
|
|
|
2814
2323
|
// decrypt flow is the gate on reading it.
|
|
2815
2324
|
dynamicWorkflowCode: (value, context) => {
|
|
2816
2325
|
if (isEncryptedMarker(value)) {
|
|
2817
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context
|
|
2326
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
2818
2327
|
}
|
|
2819
2328
|
if (isExpiredMarker(value))
|
|
2820
2329
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
2821
2330
|
if (typeof value !== "string" || value.trim().length === 0)
|
|
2822
2331
|
return null;
|
|
2823
|
-
return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context
|
|
2332
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Workflow Code", defaultOpen: context?.sectionOpen, onOpenChange: context?.onSectionOpenChange, children: jsxRuntimeExports.jsx(CopyableDataBlock, { data: value }) });
|
|
2824
2333
|
}
|
|
2825
2334
|
};
|
|
2826
2335
|
const resolvableAttributes = [
|
|
@@ -2870,7 +2379,7 @@ const AttributeBlock = ({ attribute, value, isLoading, inline = false, context }
|
|
|
2870
2379
|
}, []);
|
|
2871
2380
|
const label = loadingSectionLabels[attribute];
|
|
2872
2381
|
if (isLoading && label && !hasDisplayContent(value)) {
|
|
2873
|
-
if (decryptCtx
|
|
2382
|
+
if (decryptCtx?.hasEncryptedData) {
|
|
2874
2383
|
return jsxRuntimeExports.jsx(Collapsible, { label, defaultOpen: attribute === "eventData" || sectionOpenRef.current, onOpenChange: handleSectionOpenChange, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
2875
2384
|
}
|
|
2876
2385
|
return jsxRuntimeExports.jsx(Collapsible, { label });
|
|
@@ -2899,10 +2408,10 @@ const AttributePanel = ({ data, moduleSpecifier, moduleSourceUrl, isLoading, err
|
|
|
2899
2408
|
const displayData = reactExports.useMemo(() => {
|
|
2900
2409
|
const result = { ...data };
|
|
2901
2410
|
const execCtx = data.executionContext;
|
|
2902
|
-
if (execCtx
|
|
2411
|
+
if (execCtx?.workflowCoreVersion) {
|
|
2903
2412
|
result.workflowCoreVersion = execCtx.workflowCoreVersion;
|
|
2904
2413
|
}
|
|
2905
|
-
if (typeof
|
|
2414
|
+
if (typeof execCtx?.workflowVm === "string") {
|
|
2906
2415
|
result.workflowVm = execCtx.workflowVm;
|
|
2907
2416
|
}
|
|
2908
2417
|
if (moduleSpecifier) {
|
|
@@ -2966,11 +2475,10 @@ const AttributePanel = ({ data, moduleSpecifier, moduleSourceUrl, isLoading, err
|
|
|
2966
2475
|
isDecrypting,
|
|
2967
2476
|
isDecryptDisabled,
|
|
2968
2477
|
decryptDisabledReason,
|
|
2969
|
-
hasEncryptedData: outerDecryptCtx
|
|
2478
|
+
hasEncryptedData: outerDecryptCtx?.hasEncryptedData
|
|
2970
2479
|
} : outerDecryptCtx;
|
|
2971
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) => {
|
|
2972
|
-
|
|
2973
|
-
const displayValue = (_a = attributeToDisplayFn[attribute]) == null ? void 0 : _a.call(attributeToDisplayFn, displayData[attribute]);
|
|
2481
|
+
const displayValue = attributeToDisplayFn[attribute]?.(displayData[attribute]);
|
|
2974
2482
|
const isCopyableBasicAttribute = copyableBasicAttributes.has(attribute) && typeof displayValue === "string";
|
|
2975
2483
|
const label = getAttributeDisplayName(attribute);
|
|
2976
2484
|
return jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label, value: displayValue, copyText: isCopyableBasicAttribute ? displayValue : void 0, href: attribute === "moduleSpecifier" ? moduleSourceUrl : void 0 }, attribute);
|
|
@@ -3087,7 +2595,7 @@ function EventsList({ events, isLoading = false, error, onLoadEventData, onStrea
|
|
|
3087
2595
|
if (!hasEvents && !isLoading) {
|
|
3088
2596
|
return jsxRuntimeExports.jsx(Collapsible, { label: "Events", disabled: true });
|
|
3089
2597
|
}
|
|
3090
|
-
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
|
|
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)) }) })] }) }) });
|
|
3091
2599
|
}
|
|
3092
2600
|
const hasField = (value, key) => key in value;
|
|
3093
2601
|
const RESOURCES_WITH_FETCHED_DETAIL = /* @__PURE__ */ new Set(["run", "step", "sleep"]);
|
|
@@ -3180,16 +2688,16 @@ function deriveSpanSelection(selectedSpan) {
|
|
|
3180
2688
|
return {
|
|
3181
2689
|
resource: "sleep",
|
|
3182
2690
|
resourceId: selectedSpan.spanId,
|
|
3183
|
-
runId: waitData
|
|
2691
|
+
runId: waitData?.runId
|
|
3184
2692
|
};
|
|
3185
2693
|
}
|
|
3186
2694
|
return null;
|
|
3187
2695
|
}
|
|
3188
2696
|
function useSelectedSpanDetail(selectedSpan, fetchSpanDetail) {
|
|
3189
2697
|
const selection = reactExports.useMemo(() => deriveSpanSelection(selectedSpan), [selectedSpan]);
|
|
3190
|
-
const resource = selection
|
|
3191
|
-
const resourceId = selection
|
|
3192
|
-
const runId = selection
|
|
2698
|
+
const resource = selection?.resource;
|
|
2699
|
+
const resourceId = selection?.resourceId;
|
|
2700
|
+
const runId = selection?.runId;
|
|
3193
2701
|
const selectionKey = resource && resourceId ? `${resource}:${resourceId}` : null;
|
|
3194
2702
|
const needsFetch = resourceNeedsFetchedDetail(resource);
|
|
3195
2703
|
const [fetched, setFetched] = reactExports.useState({ detail: null, error: null, errorKey: null });
|
|
@@ -3223,10 +2731,10 @@ function useSelectedSpanDetail(selectedSpan, fetchSpanDetail) {
|
|
|
3223
2731
|
const view = reactExports.useMemo(() => deriveSpanDetailView({
|
|
3224
2732
|
resource,
|
|
3225
2733
|
resourceId,
|
|
3226
|
-
inlineData: selectedSpan
|
|
2734
|
+
inlineData: selectedSpan?.data,
|
|
3227
2735
|
fetchedDetail: fetched.detail,
|
|
3228
2736
|
fetchedError: scopedError
|
|
3229
|
-
}), [resource, resourceId, selectedSpan
|
|
2737
|
+
}), [resource, resourceId, selectedSpan?.data, fetched.detail, scopedError]);
|
|
3230
2738
|
return {
|
|
3231
2739
|
status: view.status,
|
|
3232
2740
|
resource,
|
|
@@ -3247,10 +2755,10 @@ function EntityDetailPanel({ run, onStreamClick, onRunClick, fetchSpanDetail, on
|
|
|
3247
2755
|
const [resolvingHook, setResolvingHook] = reactExports.useState(false);
|
|
3248
2756
|
const [resolvedHookIds, setResolvedHookIds] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
3249
2757
|
const sidebar = useSidebarDataOptional();
|
|
3250
|
-
const hasEncryptedData = Boolean(
|
|
3251
|
-
const data = selectedSpan
|
|
3252
|
-
const rawEvents = selectedSpan
|
|
3253
|
-
const rawEventsLength =
|
|
2758
|
+
const hasEncryptedData = Boolean(sidebar?.hasEncryptedData && !encryptionKey);
|
|
2759
|
+
const data = selectedSpan?.data;
|
|
2760
|
+
const rawEvents = selectedSpan?.rawEvents;
|
|
2761
|
+
const rawEventsLength = rawEvents?.length ?? 0;
|
|
3254
2762
|
const { status, resource, resourceId, displayData, detail: matchedSpanDetailData, error } = useSelectedSpanDetail(selectedSpan, fetchSpanDetail);
|
|
3255
2763
|
const loading = status === "loading";
|
|
3256
2764
|
const canWakeUp = reactExports.useMemo(() => {
|
|
@@ -3404,20 +2912,19 @@ function EntityDetailPanel({ run, onStreamClick, onRunClick, fetchSpanDetail, on
|
|
|
3404
2912
|
isDecryptDisabled,
|
|
3405
2913
|
decryptDisabledReason,
|
|
3406
2914
|
hasEncryptedData
|
|
3407
|
-
} : 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
|
|
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 })] });
|
|
3408
2916
|
}
|
|
3409
2917
|
const DETAIL_PANEL_ID = "trace-detail-panel";
|
|
3410
2918
|
function useSelectedSpanInfo() {
|
|
3411
2919
|
const { activeSpan } = useActiveSpan();
|
|
3412
2920
|
const sidebar = useSidebarData();
|
|
3413
2921
|
return reactExports.useMemo(() => {
|
|
3414
|
-
var _a, _b;
|
|
3415
2922
|
if (!activeSpan)
|
|
3416
2923
|
return null;
|
|
3417
|
-
const resource =
|
|
2924
|
+
const resource = activeSpan.attributes?.resource;
|
|
3418
2925
|
const rawEvents = filterSpanRawEvents(sidebar.events, resource, activeSpan.spanId);
|
|
3419
2926
|
return {
|
|
3420
|
-
data:
|
|
2927
|
+
data: activeSpan.attributes?.data,
|
|
3421
2928
|
resource,
|
|
3422
2929
|
spanId: activeSpan.spanId,
|
|
3423
2930
|
rawEvents,
|
|
@@ -3431,15 +2938,14 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3431
2938
|
const selectedSpan = useSelectedSpanInfo();
|
|
3432
2939
|
const panelWidth = useDetailPanelWidth(containerRef, Boolean(activeSpan));
|
|
3433
2940
|
const { prevSpanId, nextSpanId } = reactExports.useMemo(() => {
|
|
3434
|
-
var _a, _b;
|
|
3435
2941
|
if (!activeSpanId)
|
|
3436
2942
|
return { prevSpanId: null, nextSpanId: null };
|
|
3437
2943
|
const i = spans.findIndex((s) => s.spanId === activeSpanId);
|
|
3438
2944
|
if (i === -1)
|
|
3439
2945
|
return { prevSpanId: null, nextSpanId: null };
|
|
3440
2946
|
return {
|
|
3441
|
-
prevSpanId:
|
|
3442
|
-
nextSpanId:
|
|
2947
|
+
prevSpanId: spans[i - 1]?.spanId ?? null,
|
|
2948
|
+
nextSpanId: spans[i + 1]?.spanId ?? null
|
|
3443
2949
|
};
|
|
3444
2950
|
}, [activeSpanId, spans]);
|
|
3445
2951
|
const handleSelectPrev = reactExports.useCallback(() => {
|
|
@@ -3451,8 +2957,7 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3451
2957
|
onNavigateToSpan(nextSpanId);
|
|
3452
2958
|
}, [nextSpanId, onNavigateToSpan]);
|
|
3453
2959
|
const selectedSpanName = reactExports.useMemo(() => {
|
|
3454
|
-
|
|
3455
|
-
if (!(selectedSpan == null ? void 0 : selectedSpan.data))
|
|
2960
|
+
if (!selectedSpan?.data)
|
|
3456
2961
|
return "Details";
|
|
3457
2962
|
const data = selectedSpan.data;
|
|
3458
2963
|
if (selectedSpan.resource === "hook") {
|
|
@@ -3460,8 +2965,8 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3460
2965
|
}
|
|
3461
2966
|
const stepName = data.stepName;
|
|
3462
2967
|
const workflowName = data.workflowName;
|
|
3463
|
-
return (stepName ?
|
|
3464
|
-
}, [selectedSpan
|
|
2968
|
+
return (stepName ? parseStepName(stepName)?.shortName : void 0) ?? (workflowName ? parseWorkflowName(workflowName)?.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
|
|
2969
|
+
}, [selectedSpan?.data, selectedSpan?.resource]);
|
|
3465
2970
|
if (!activeSpan)
|
|
3466
2971
|
return null;
|
|
3467
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 }) }) });
|
|
@@ -3626,7 +3131,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3626
3131
|
const root = reactExports.useMemo(() => computeRootBounds(trace.spans), [trace.spans]);
|
|
3627
3132
|
const scrollContainerRef = reactExports.useRef(null);
|
|
3628
3133
|
const loadMore = reactExports.useCallback(() => {
|
|
3629
|
-
void
|
|
3134
|
+
void onLoadMore?.();
|
|
3630
3135
|
}, [onLoadMore]);
|
|
3631
3136
|
const loadMoreSentinelRef = useLoadMoreOnScroll(loadMore, {
|
|
3632
3137
|
hasMore: Boolean(onLoadMore && hasMore),
|
|
@@ -3713,11 +3218,10 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3713
3218
|
clampToRoot
|
|
3714
3219
|
]);
|
|
3715
3220
|
const scrollSpanIntoView = reactExports.useCallback((spanId) => {
|
|
3716
|
-
var _a;
|
|
3717
3221
|
const index = trace.spans.findIndex((s) => s.spanId === spanId);
|
|
3718
3222
|
if (index === -1)
|
|
3719
3223
|
return;
|
|
3720
|
-
const list =
|
|
3224
|
+
const list = scrollContainerRef.current?.querySelector("#event-list") ?? null;
|
|
3721
3225
|
scrollRowIntoView(list, index, ROW_HEIGHT_PX, {
|
|
3722
3226
|
behavior: reducedMotion ? "auto" : "smooth"
|
|
3723
3227
|
});
|
|
@@ -3829,7 +3333,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3829
3333
|
}
|
|
3830
3334
|
const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes, initialSelectedSpanId }) => {
|
|
3831
3335
|
const trace = reactExports.useMemo(() => {
|
|
3832
|
-
if (!
|
|
3336
|
+
if (!run?.runId) {
|
|
3833
3337
|
return void 0;
|
|
3834
3338
|
}
|
|
3835
3339
|
return buildTrace(run, events, /* @__PURE__ */ new Date(), {
|
|
@@ -3837,7 +3341,7 @@ const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingM
|
|
|
3837
3341
|
getStepAttributes
|
|
3838
3342
|
});
|
|
3839
3343
|
}, [run, events, hasMore, getStepAttributes]);
|
|
3840
|
-
const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace
|
|
3344
|
+
const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace?.duplicateEventIds }), [sidebarData, trace]);
|
|
3841
3345
|
if (!trace || loading && events.length === 0) {
|
|
3842
3346
|
return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
|
|
3843
3347
|
}
|
|
@@ -3849,8 +3353,8 @@ const DOCS_BASE_URL = "https://workflow-sdk.dev/err";
|
|
|
3849
3353
|
function readVmPolicy(run) {
|
|
3850
3354
|
const ctx = run.executionContext && typeof run.executionContext === "object" ? run.executionContext : void 0;
|
|
3851
3355
|
return {
|
|
3852
|
-
workflowVm: run.workflowVm ??
|
|
3853
|
-
snapshotThreshold: run.snapshotThreshold ??
|
|
3356
|
+
workflowVm: run.workflowVm ?? ctx?.workflowVm,
|
|
3357
|
+
snapshotThreshold: run.snapshotThreshold ?? ctx?.snapshotThreshold
|
|
3854
3358
|
};
|
|
3855
3359
|
}
|
|
3856
3360
|
function isQuickJSSnapshotRun(run) {
|
|
@@ -3937,7 +3441,7 @@ function createRunStateHydrator(options) {
|
|
|
3937
3441
|
for (let pages = 0; pages < MAX_PAGES; pages++) {
|
|
3938
3442
|
const page = await options.loadEvents(current.cursor);
|
|
3939
3443
|
for (const event of page.data) {
|
|
3940
|
-
const id = event
|
|
3444
|
+
const id = event?.eventId;
|
|
3941
3445
|
if (typeof id === "string") {
|
|
3942
3446
|
if (current.seen.has(id))
|
|
3943
3447
|
continue;
|
|
@@ -4159,7 +3663,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4159
3663
|
}
|
|
4160
3664
|
if (!runResult.error) {
|
|
4161
3665
|
const ctx = runResult.result.executionContext;
|
|
4162
|
-
if (
|
|
3666
|
+
if (ctx?.features && ctx.features.encryption) {
|
|
4163
3667
|
setHasEncryptedData(true);
|
|
4164
3668
|
} else {
|
|
4165
3669
|
unwrapServerActionResult(
|
|
@@ -4223,7 +3727,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4223
3727
|
loadMoreTraceData();
|
|
4224
3728
|
}, [events.length, loadMoreTraceData]);
|
|
4225
3729
|
const pollRun = reactExports.useCallback(async () => {
|
|
4226
|
-
if (run
|
|
3730
|
+
if (run?.completedAt) {
|
|
4227
3731
|
return false;
|
|
4228
3732
|
}
|
|
4229
3733
|
const { error: error2, result } = await unwrapServerActionResult(
|
|
@@ -4236,7 +3740,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4236
3740
|
setError(null);
|
|
4237
3741
|
setRun(hydrateResourceIO(result));
|
|
4238
3742
|
return true;
|
|
4239
|
-
}, [env, runId, run
|
|
3743
|
+
}, [env, runId, run?.completedAt]);
|
|
4240
3744
|
const pollEvents = reactExports.useCallback(
|
|
4241
3745
|
() => pollResource({
|
|
4242
3746
|
fetchFn: () => unwrapServerActionResult(
|
|
@@ -4278,7 +3782,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4278
3782
|
};
|
|
4279
3783
|
}, []);
|
|
4280
3784
|
reactExports.useEffect(() => {
|
|
4281
|
-
if (!live || !initialLoadCompleted ||
|
|
3785
|
+
if (!live || !initialLoadCompleted || run?.completedAt) {
|
|
4282
3786
|
return;
|
|
4283
3787
|
}
|
|
4284
3788
|
const interval = setInterval(() => {
|
|
@@ -4287,7 +3791,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4287
3791
|
return () => {
|
|
4288
3792
|
clearInterval(interval);
|
|
4289
3793
|
};
|
|
4290
|
-
}, [live, initialLoadCompleted, update, run
|
|
3794
|
+
}, [live, initialLoadCompleted, update, run?.completedAt]);
|
|
4291
3795
|
return {
|
|
4292
3796
|
run: run ?? {},
|
|
4293
3797
|
events,
|
|
@@ -4395,8 +3899,7 @@ const PAGE_SIZE = 100;
|
|
|
4395
3899
|
const MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
4396
3900
|
const getEventId = (event) => event.eventId;
|
|
4397
3901
|
function toSearchFailure(error) {
|
|
4398
|
-
|
|
4399
|
-
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) };
|
|
4400
3903
|
}
|
|
4401
3904
|
function useEventsListData(env, runId, options = {}) {
|
|
4402
3905
|
const { sortOrder = "asc", encryptionKey } = options;
|
|
@@ -4425,7 +3928,7 @@ function useEventsListData(env, runId, options = {}) {
|
|
|
4425
3928
|
);
|
|
4426
3929
|
const searchByExactId = reactExports.useCallback(
|
|
4427
3930
|
async (id, kind, signal) => {
|
|
4428
|
-
if (signal
|
|
3931
|
+
if (signal?.aborted) {
|
|
4429
3932
|
throw new DOMException("Aborted", "AbortError");
|
|
4430
3933
|
}
|
|
4431
3934
|
if (kind === "event") {
|
|
@@ -4435,18 +3938,18 @@ function useEventsListData(env, runId, options = {}) {
|
|
|
4435
3938
|
if (fetchError) {
|
|
4436
3939
|
return toSearchFailure(fetchError);
|
|
4437
3940
|
}
|
|
4438
|
-
if (signal
|
|
3941
|
+
if (signal?.aborted) {
|
|
4439
3942
|
throw new DOMException("Aborted", "AbortError");
|
|
4440
3943
|
}
|
|
4441
3944
|
const [event] = await hydrateEvents([result]);
|
|
4442
|
-
return
|
|
3945
|
+
return event?.runId === runId ? { status: "ok", events: [event] } : { status: "not_found" };
|
|
4443
3946
|
}
|
|
4444
3947
|
const matched = [];
|
|
4445
3948
|
let nextCursor;
|
|
4446
3949
|
let pagesFetched = 0;
|
|
4447
3950
|
let truncated = false;
|
|
4448
3951
|
do {
|
|
4449
|
-
if (signal
|
|
3952
|
+
if (signal?.aborted) {
|
|
4450
3953
|
throw new DOMException("Aborted", "AbortError");
|
|
4451
3954
|
}
|
|
4452
3955
|
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
@@ -4461,7 +3964,7 @@ function useEventsListData(env, runId, options = {}) {
|
|
|
4461
3964
|
if (fetchError) {
|
|
4462
3965
|
return toSearchFailure(fetchError);
|
|
4463
3966
|
}
|
|
4464
|
-
if (signal
|
|
3967
|
+
if (signal?.aborted) {
|
|
4465
3968
|
throw new DOMException("Aborted", "AbortError");
|
|
4466
3969
|
}
|
|
4467
3970
|
pagesFetched += 1;
|
|
@@ -4587,9 +4090,8 @@ var AlertDialogContent$1 = reactExports.forwardRef(
|
|
|
4587
4090
|
...contentProps,
|
|
4588
4091
|
ref: composedRefs,
|
|
4589
4092
|
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
4590
|
-
var _a;
|
|
4591
4093
|
event.preventDefault();
|
|
4592
|
-
|
|
4094
|
+
cancelRef.current?.focus({ preventScroll: true });
|
|
4593
4095
|
}),
|
|
4594
4096
|
onPointerDownOutside: (event) => event.preventDefault(),
|
|
4595
4097
|
onInteractOutside: (event) => event.preventDefault(),
|
|
@@ -4670,7 +4172,7 @@ function AlertDialogContent({
|
|
|
4670
4172
|
),
|
|
4671
4173
|
onSubmit: (e) => {
|
|
4672
4174
|
e.preventDefault();
|
|
4673
|
-
onSubmit
|
|
4175
|
+
onSubmit?.(e);
|
|
4674
4176
|
},
|
|
4675
4177
|
...props
|
|
4676
4178
|
}
|
|
@@ -4832,12 +4334,11 @@ function BreadcrumbSeparator({
|
|
|
4832
4334
|
);
|
|
4833
4335
|
}
|
|
4834
4336
|
function getCancellationReason(events) {
|
|
4835
|
-
var _a, _b;
|
|
4836
4337
|
if (!events) return void 0;
|
|
4837
4338
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
4838
4339
|
const event = events[index];
|
|
4839
4340
|
if (event.eventType !== "run_cancelled") continue;
|
|
4840
|
-
const reason =
|
|
4341
|
+
const reason = event.eventData?.cancelReason?.trim();
|
|
4841
4342
|
if (reason) return reason;
|
|
4842
4343
|
}
|
|
4843
4344
|
return void 0;
|
|
@@ -4866,6 +4367,88 @@ function useCancellationReason(env, runId, status, events) {
|
|
|
4866
4367
|
}, [env, runId, status, loadedReason]);
|
|
4867
4368
|
return loadedReason ?? terminalReason;
|
|
4868
4369
|
}
|
|
4370
|
+
const RUN_USAGE_REFRESH_INTERVAL_MS = 5e3;
|
|
4371
|
+
const SLOW_READ_BACKOFF = 10;
|
|
4372
|
+
function useRunUsage(env, runId, {
|
|
4373
|
+
enabled = true,
|
|
4374
|
+
live = false,
|
|
4375
|
+
refreshInterval = RUN_USAGE_REFRESH_INTERVAL_MS
|
|
4376
|
+
} = {}) {
|
|
4377
|
+
const [usage, setUsage] = reactExports.useState(void 0);
|
|
4378
|
+
const [loading, setLoading] = reactExports.useState(false);
|
|
4379
|
+
const [error, setError] = reactExports.useState(null);
|
|
4380
|
+
const latestRef = reactExports.useRef(0);
|
|
4381
|
+
const lastReadMsRef = reactExports.useRef(0);
|
|
4382
|
+
const inFlightRef = reactExports.useRef(0);
|
|
4383
|
+
const mountedRef = reactExports.useRef(true);
|
|
4384
|
+
reactExports.useEffect(() => {
|
|
4385
|
+
mountedRef.current = true;
|
|
4386
|
+
return () => {
|
|
4387
|
+
mountedRef.current = false;
|
|
4388
|
+
};
|
|
4389
|
+
}, []);
|
|
4390
|
+
const read = reactExports.useCallback(async () => {
|
|
4391
|
+
const seq = ++latestRef.current;
|
|
4392
|
+
const startedAt = Date.now();
|
|
4393
|
+
const isCurrent = () => mountedRef.current && seq === latestRef.current;
|
|
4394
|
+
inFlightRef.current++;
|
|
4395
|
+
setLoading(true);
|
|
4396
|
+
try {
|
|
4397
|
+
const result = await unwrapOrThrow(fetchRunUsage(env, runId));
|
|
4398
|
+
if (isCurrent()) {
|
|
4399
|
+
setUsage(result);
|
|
4400
|
+
setError(null);
|
|
4401
|
+
}
|
|
4402
|
+
} catch (err) {
|
|
4403
|
+
if (isCurrent()) {
|
|
4404
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
4405
|
+
}
|
|
4406
|
+
} finally {
|
|
4407
|
+
lastReadMsRef.current = Date.now() - startedAt;
|
|
4408
|
+
inFlightRef.current--;
|
|
4409
|
+
if (isCurrent()) setLoading(false);
|
|
4410
|
+
}
|
|
4411
|
+
}, [env, runId]);
|
|
4412
|
+
reactExports.useEffect(() => {
|
|
4413
|
+
setUsage(void 0);
|
|
4414
|
+
setError(null);
|
|
4415
|
+
}, [runId]);
|
|
4416
|
+
reactExports.useEffect(() => {
|
|
4417
|
+
if (!enabled) return;
|
|
4418
|
+
void read();
|
|
4419
|
+
}, [enabled, read]);
|
|
4420
|
+
const wasLiveRef = reactExports.useRef(live);
|
|
4421
|
+
reactExports.useEffect(() => {
|
|
4422
|
+
const wasLive = wasLiveRef.current;
|
|
4423
|
+
wasLiveRef.current = live;
|
|
4424
|
+
if (enabled && wasLive && !live) void read();
|
|
4425
|
+
}, [enabled, live, read]);
|
|
4426
|
+
const unsupported = usage === null;
|
|
4427
|
+
const polling = live || usage?.inProgress === true;
|
|
4428
|
+
reactExports.useEffect(() => {
|
|
4429
|
+
if (!enabled || !polling || unsupported) return;
|
|
4430
|
+
if (!refreshInterval || refreshInterval <= 0) return;
|
|
4431
|
+
let cancelled = false;
|
|
4432
|
+
let timer;
|
|
4433
|
+
const schedule = () => {
|
|
4434
|
+
const delay = Math.max(
|
|
4435
|
+
refreshInterval,
|
|
4436
|
+
SLOW_READ_BACKOFF * lastReadMsRef.current
|
|
4437
|
+
);
|
|
4438
|
+
timer = setTimeout(async () => {
|
|
4439
|
+
if (cancelled) return;
|
|
4440
|
+
if (inFlightRef.current === 0) await read();
|
|
4441
|
+
if (!cancelled) schedule();
|
|
4442
|
+
}, delay);
|
|
4443
|
+
};
|
|
4444
|
+
schedule();
|
|
4445
|
+
return () => {
|
|
4446
|
+
cancelled = true;
|
|
4447
|
+
clearTimeout(timer);
|
|
4448
|
+
};
|
|
4449
|
+
}, [enabled, polling, unsupported, refreshInterval, read]);
|
|
4450
|
+
return { usage, loading, error, refresh: read };
|
|
4451
|
+
}
|
|
4869
4452
|
const FRAME_HEADER_SIZE = 4;
|
|
4870
4453
|
const ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
4871
4454
|
const POLL_INTERVAL_MS = 3e3;
|
|
@@ -4899,9 +4482,8 @@ function concatBytes(parts) {
|
|
|
4899
4482
|
return joined;
|
|
4900
4483
|
}
|
|
4901
4484
|
function hasSameImageBytes(previous, next) {
|
|
4902
|
-
|
|
4903
|
-
const
|
|
4904
|
-
const after = (_b = next[0]) == null ? void 0 : _b.value;
|
|
4485
|
+
const before = previous[0]?.value;
|
|
4486
|
+
const after = next[0]?.value;
|
|
4905
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]);
|
|
4906
4488
|
}
|
|
4907
4489
|
function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
@@ -4991,9 +4573,9 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
4991
4573
|
streamId,
|
|
4992
4574
|
runId,
|
|
4993
4575
|
abortController.signal,
|
|
4994
|
-
isImageStream ? void 0 :
|
|
4576
|
+
isImageStream ? void 0 : options?.cursor ?? void 0
|
|
4995
4577
|
);
|
|
4996
|
-
const skipFrames = isImageStream ? 0 :
|
|
4578
|
+
const skipFrames = isImageStream ? 0 : options?.skipFrames ?? 0;
|
|
4997
4579
|
const reader = streamResponse.body.getReader();
|
|
4998
4580
|
const decoder = new TextDecoder();
|
|
4999
4581
|
let buffer = new Uint8Array(0);
|
|
@@ -5017,7 +4599,7 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5017
4599
|
if (encoding === "legacy") textRemainder = decoder.decode(buffer);
|
|
5018
4600
|
}
|
|
5019
4601
|
if (encoding === "image") {
|
|
5020
|
-
imageChunkId
|
|
4602
|
+
imageChunkId ??= chunkIdRef.current++;
|
|
5021
4603
|
frameIndex++;
|
|
5022
4604
|
targetBuffer.push({
|
|
5023
4605
|
id: imageChunkId,
|
|
@@ -5117,7 +4699,7 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5117
4699
|
}
|
|
5118
4700
|
buffer = buffer.slice(offset);
|
|
5119
4701
|
}
|
|
5120
|
-
isImageStream
|
|
4702
|
+
isImageStream ||= encoding === "image";
|
|
5121
4703
|
return {
|
|
5122
4704
|
encrypted: false,
|
|
5123
4705
|
image: isImageStream,
|
|
@@ -5236,11 +4818,74 @@ function LiveStatus({ hasError, errorMessage }) {
|
|
|
5236
4818
|
({
|
|
5237
4819
|
...LAYOUT
|
|
5238
4820
|
});
|
|
4821
|
+
const RUN_TABS = [
|
|
4822
|
+
{ value: "trace", label: "Trace" },
|
|
4823
|
+
{ value: "events", label: "Events" },
|
|
4824
|
+
{ value: "streams", label: "Streams" }
|
|
4825
|
+
];
|
|
4826
|
+
function focusRunViewItem(root, item) {
|
|
4827
|
+
const target = root?.querySelector(
|
|
4828
|
+
`[data-run-view-item="${item}"]:is([aria-current="page"], [data-state="active"])`
|
|
4829
|
+
);
|
|
4830
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
4831
|
+
target.focus();
|
|
4832
|
+
return true;
|
|
4833
|
+
}
|
|
4834
|
+
function runTabPath(runId, tab) {
|
|
4835
|
+
return `${runPath(runId)}?tab=${tab}`;
|
|
4836
|
+
}
|
|
4837
|
+
function UsageNavLink({
|
|
4838
|
+
runId,
|
|
4839
|
+
current = false,
|
|
4840
|
+
onNavigate
|
|
4841
|
+
}) {
|
|
4842
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4843
|
+
Link,
|
|
4844
|
+
{
|
|
4845
|
+
to: runUsagePath(runId),
|
|
4846
|
+
className: cn(tabsTriggerClassName, "gap-2"),
|
|
4847
|
+
"aria-current": current ? "page" : void 0,
|
|
4848
|
+
"data-testid": "run-usage-nav-link",
|
|
4849
|
+
"data-run-view-item": "usage",
|
|
4850
|
+
onClick: () => onNavigate?.("usage"),
|
|
4851
|
+
children: [
|
|
4852
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChartColumn, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
4853
|
+
"Usage"
|
|
4854
|
+
]
|
|
4855
|
+
}
|
|
4856
|
+
);
|
|
4857
|
+
}
|
|
4858
|
+
const RUN_VIEW_ROW_CLASS = cn(
|
|
4859
|
+
tabsListClassName,
|
|
4860
|
+
"mb-4 max-w-full flex-none max-sm:[&_svg]:hidden"
|
|
4861
|
+
);
|
|
4862
|
+
function RunViewNav({
|
|
4863
|
+
runId,
|
|
4864
|
+
showUsage,
|
|
4865
|
+
onNavigate
|
|
4866
|
+
}) {
|
|
4867
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("nav", { "aria-label": "Run views", className: RUN_VIEW_ROW_CLASS, children: [
|
|
4868
|
+
RUN_TABS.map((tab) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4869
|
+
Link,
|
|
4870
|
+
{
|
|
4871
|
+
to: runTabPath(runId, tab.value),
|
|
4872
|
+
className: cn(tabsTriggerClassName, "gap-2"),
|
|
4873
|
+
"data-run-view-item": tab.value,
|
|
4874
|
+
onClick: () => onNavigate?.(tab.value),
|
|
4875
|
+
children: [
|
|
4876
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
4877
|
+
tab.label
|
|
4878
|
+
]
|
|
4879
|
+
},
|
|
4880
|
+
tab.value
|
|
4881
|
+
)),
|
|
4882
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageNavLink, { runId, current: true, onNavigate })
|
|
4883
|
+
] });
|
|
4884
|
+
}
|
|
5239
4885
|
function RunDetailView({
|
|
5240
4886
|
runId,
|
|
5241
4887
|
selectedId: _selectedId
|
|
5242
4888
|
}) {
|
|
5243
|
-
var _a, _b;
|
|
5244
4889
|
const navigate = useNavigate();
|
|
5245
4890
|
const [searchParams, updateSearchParams] = useOptimisticSearchParams();
|
|
5246
4891
|
const { serverConfig } = useServerConfig();
|
|
@@ -5249,8 +4894,8 @@ function RunDetailView({
|
|
|
5249
4894
|
const [showCancelDialog, setShowCancelDialog] = reactExports.useState(false);
|
|
5250
4895
|
const [showRerunDialog, setShowRerunDialog] = reactExports.useState(false);
|
|
5251
4896
|
const env = reactExports.useMemo(() => ({}), []);
|
|
5252
|
-
const rawTab = searchParams.get("tab")
|
|
5253
|
-
const activeTab = rawTab === "
|
|
4897
|
+
const rawTab = searchParams.get("tab");
|
|
4898
|
+
const activeTab = rawTab === "events" || rawTab === "streams" ? rawTab : "trace";
|
|
5254
4899
|
const selectedStreamId = searchParams.get("streamId");
|
|
5255
4900
|
const initialSelectedSpanId = searchParams.get("spanId") ?? void 0;
|
|
5256
4901
|
const setActiveTab = reactExports.useCallback(
|
|
@@ -5317,7 +4962,7 @@ function RunDetailView({
|
|
|
5317
4962
|
},
|
|
5318
4963
|
[env, stateHydrator]
|
|
5319
4964
|
);
|
|
5320
|
-
serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
4965
|
+
const isLocalBackend = serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
5321
4966
|
const {
|
|
5322
4967
|
run: runData,
|
|
5323
4968
|
events: allEvents,
|
|
@@ -5392,6 +5037,23 @@ function RunDetailView({
|
|
|
5392
5037
|
hasEncryptedData
|
|
5393
5038
|
]
|
|
5394
5039
|
);
|
|
5040
|
+
const runIsLive = Boolean(run.status) && !isTerminalWorkflowRunStatus(run.status);
|
|
5041
|
+
const runUsageState = useRunUsage(env, runId, { live: runIsLive });
|
|
5042
|
+
const { usage: runUsage, error: runUsageError } = runUsageState;
|
|
5043
|
+
const showUsage = usageVisible(runUsage, isLocalBackend);
|
|
5044
|
+
const usageContext = { runId, usage: runUsageState };
|
|
5045
|
+
const usagePage = useOutlet(usageContext);
|
|
5046
|
+
const viewRootRef = reactExports.useRef(null);
|
|
5047
|
+
const pendingRowFocus = reactExports.useRef(null);
|
|
5048
|
+
const focusRowItemAfterNavigation = reactExports.useCallback((item) => {
|
|
5049
|
+
pendingRowFocus.current = item;
|
|
5050
|
+
}, []);
|
|
5051
|
+
reactExports.useEffect(() => {
|
|
5052
|
+
const item = pendingRowFocus.current;
|
|
5053
|
+
if (item && focusRunViewItem(viewRootRef.current, item)) {
|
|
5054
|
+
pendingRowFocus.current = null;
|
|
5055
|
+
}
|
|
5056
|
+
});
|
|
5395
5057
|
const {
|
|
5396
5058
|
streams,
|
|
5397
5059
|
loading: streamsLoading,
|
|
@@ -5423,7 +5085,7 @@ function RunDetailView({
|
|
|
5423
5085
|
setCancelling(false);
|
|
5424
5086
|
}
|
|
5425
5087
|
};
|
|
5426
|
-
const isDynamicRun = Boolean(
|
|
5088
|
+
const isDynamicRun = Boolean(run.executionContext?.dynamicWorkflow);
|
|
5427
5089
|
const handleRerunClick = () => {
|
|
5428
5090
|
if (isDynamicRun) return;
|
|
5429
5091
|
setShowRerunDialog(true);
|
|
@@ -5455,7 +5117,7 @@ function RunDetailView({
|
|
|
5455
5117
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: getErrorMessage(error) })
|
|
5456
5118
|
] });
|
|
5457
5119
|
}
|
|
5458
|
-
const workflowName =
|
|
5120
|
+
const workflowName = parseWorkflowName(run.workflowName)?.shortName;
|
|
5459
5121
|
const hasError = false;
|
|
5460
5122
|
const errorMessage = "";
|
|
5461
5123
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -5486,196 +5148,260 @@ function RunDetailView({
|
|
|
5486
5148
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogAction, { onClick: handleConfirmRerun, children: "Replay Run" })
|
|
5487
5149
|
] })
|
|
5488
5150
|
] }) }),
|
|
5489
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
}
|
|
5527
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[55px] h-[24px]" })
|
|
5528
|
-
] }),
|
|
5529
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5530
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Duration" }),
|
|
5531
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.startedAt ? (() => {
|
|
5532
|
-
const ms = (run.completedAt ? new Date(run.completedAt).getTime() : Date.now()) - new Date(run.startedAt).getTime();
|
|
5533
|
-
const seconds = Math.floor(ms / 1e3);
|
|
5534
|
-
if (seconds < 60) return `${seconds}s`;
|
|
5535
|
-
const minutes = Math.floor(seconds / 60);
|
|
5536
|
-
const remainingSeconds = seconds % 60;
|
|
5537
|
-
if (minutes < 60) {
|
|
5538
|
-
return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
5539
|
-
}
|
|
5540
|
-
const hours = Math.floor(minutes / 60);
|
|
5541
|
-
const remainingMinutes = minutes % 60;
|
|
5542
|
-
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
5543
|
-
})() : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[60px] h-[20px]" }) })
|
|
5544
|
-
] }),
|
|
5545
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5546
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Run ID" }),
|
|
5547
|
-
run.runId ? /* @__PURE__ */ jsxRuntimeExports.jsx(CopyableText, { text: run.runId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-0.5 font-mono", children: run.runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[280px] h-[20px]" })
|
|
5548
|
-
] }),
|
|
5549
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5550
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Queued" }),
|
|
5551
|
-
run.createdAt ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.createdAt }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" })
|
|
5552
|
-
] }),
|
|
5553
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5554
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Started" }),
|
|
5555
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.startedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.startedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" }) })
|
|
5556
|
-
] }),
|
|
5557
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5558
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Completed" }),
|
|
5559
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.completedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.completedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" }) })
|
|
5560
|
-
] }),
|
|
5561
|
-
run.expiredAt != null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5562
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5563
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground cursor-help flex items-center gap-1", children: [
|
|
5564
|
-
"Expired",
|
|
5565
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "w-3 h-3" })
|
|
5566
|
-
] }) }),
|
|
5567
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "The storage data for this run has expired and is no longer available." }) })
|
|
5568
|
-
] }),
|
|
5569
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.expiredAt }) })
|
|
5570
|
-
] })
|
|
5571
|
-
] })
|
|
5572
|
-
] }),
|
|
5573
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RunLimitGuidanceAlert, { run: runData })
|
|
5574
|
-
] }),
|
|
5575
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5576
|
-
Tabs,
|
|
5577
|
-
{
|
|
5578
|
-
value: activeTab,
|
|
5579
|
-
onValueChange: (v) => setActiveTab(v),
|
|
5580
|
-
className: "flex-1 flex flex-col min-h-0",
|
|
5581
|
-
children: [
|
|
5582
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 flex-none", children: [
|
|
5583
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "trace", className: "gap-2", children: [
|
|
5584
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
5585
|
-
"Trace"
|
|
5586
|
-
] }),
|
|
5587
|
-
false,
|
|
5588
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
|
|
5589
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
5590
|
-
"Events"
|
|
5151
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5152
|
+
"div",
|
|
5153
|
+
{
|
|
5154
|
+
ref: viewRootRef,
|
|
5155
|
+
className: usagePage ? "flex flex-col" : "flex flex-col h-[calc(100vh-97px)]",
|
|
5156
|
+
children: [
|
|
5157
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-none space-y-4", children: [
|
|
5158
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(BreadcrumbList, { children: [
|
|
5159
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/", children: "Runs" }) }) }),
|
|
5160
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbSeparator, {}),
|
|
5161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: usagePage ? /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: runPath(runId), className: "font-mono text-xs", children: runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbPage, { className: "font-mono text-xs", children: runId }) }),
|
|
5162
|
+
usagePage && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5163
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbSeparator, {}),
|
|
5164
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbPage, { children: "Usage" }) })
|
|
5165
|
+
] })
|
|
5166
|
+
] }) }),
|
|
5167
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 p-6 border rounded-lg", children: [
|
|
5168
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-4 gap-y-2", children: [
|
|
5169
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold", children: workflowName ? workflowName : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[260px] h-[28px]" }) }) }),
|
|
5170
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5171
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LiveStatus, { hasError, errorMessage }),
|
|
5172
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5173
|
+
RunActionsButtons,
|
|
5174
|
+
{
|
|
5175
|
+
env,
|
|
5176
|
+
runId,
|
|
5177
|
+
runStatus: run.status,
|
|
5178
|
+
events: allEvents,
|
|
5179
|
+
eventsLoading: loading,
|
|
5180
|
+
loading,
|
|
5181
|
+
replayDisabledReason: isDynamicRun ? "Dynamic runs cannot be replayed as a new run." : void 0,
|
|
5182
|
+
onRerunClick: handleRerunClick,
|
|
5183
|
+
onCancelClick: handleCancelClick,
|
|
5184
|
+
callbacks: { onSuccess: update }
|
|
5185
|
+
}
|
|
5186
|
+
)
|
|
5187
|
+
] })
|
|
5591
5188
|
] }),
|
|
5592
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5593
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
5594
|
-
|
|
5189
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start gap-x-8 gap-y-4", children: [
|
|
5190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5191
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Status" }),
|
|
5192
|
+
run.status ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5193
|
+
StatusBadge,
|
|
5194
|
+
{
|
|
5195
|
+
status: run.status,
|
|
5196
|
+
context: { error: run.error, cancelReason }
|
|
5197
|
+
}
|
|
5198
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[55px] h-[24px]" })
|
|
5199
|
+
] }),
|
|
5200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Duration" }),
|
|
5202
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.startedAt ? (() => {
|
|
5203
|
+
const ms = (run.completedAt ? new Date(run.completedAt).getTime() : Date.now()) - new Date(run.startedAt).getTime();
|
|
5204
|
+
const seconds = Math.floor(ms / 1e3);
|
|
5205
|
+
if (seconds < 60) return `${seconds}s`;
|
|
5206
|
+
const minutes = Math.floor(seconds / 60);
|
|
5207
|
+
const remainingSeconds = seconds % 60;
|
|
5208
|
+
if (minutes < 60) {
|
|
5209
|
+
return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
5210
|
+
}
|
|
5211
|
+
const hours = Math.floor(minutes / 60);
|
|
5212
|
+
const remainingMinutes = minutes % 60;
|
|
5213
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
5214
|
+
})() : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[60px] h-[20px]" }) })
|
|
5215
|
+
] }),
|
|
5216
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5217
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Run ID" }),
|
|
5218
|
+
run.runId ? /* @__PURE__ */ jsxRuntimeExports.jsx(CopyableText, { text: run.runId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-0.5 font-mono", children: run.runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[280px] h-[20px]" })
|
|
5219
|
+
] }),
|
|
5220
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5221
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Queued" }),
|
|
5222
|
+
run.createdAt ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.createdAt }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" })
|
|
5223
|
+
] }),
|
|
5224
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5225
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Started" }),
|
|
5226
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.startedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.startedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" }) })
|
|
5227
|
+
] }),
|
|
5228
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5229
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Completed" }),
|
|
5230
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run.runId ? run.completedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.completedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "w-[110px] h-[20px]" }) })
|
|
5231
|
+
] }),
|
|
5232
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5233
|
+
RunUsageHeaderStats,
|
|
5234
|
+
{
|
|
5235
|
+
runId,
|
|
5236
|
+
usage: runUsage ?? void 0,
|
|
5237
|
+
error: runUsageError,
|
|
5238
|
+
isLocalBackend,
|
|
5239
|
+
onUsagePage: usagePage != null
|
|
5240
|
+
}
|
|
5241
|
+
),
|
|
5242
|
+
run.expiredAt != null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
5243
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5244
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground cursor-help flex items-center gap-1", children: [
|
|
5245
|
+
"Expired",
|
|
5246
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "w-3 h-3" })
|
|
5247
|
+
] }) }),
|
|
5248
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "The storage data for this run has expired and is no longer available." }) })
|
|
5249
|
+
] }),
|
|
5250
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run.expiredAt }) })
|
|
5251
|
+
] })
|
|
5595
5252
|
] })
|
|
5596
5253
|
] }),
|
|
5597
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
loading,
|
|
5603
|
-
sidebarData,
|
|
5604
|
-
onLoadMore: loadMoreTraceData,
|
|
5605
|
-
hasMore: hasMoreTraceData,
|
|
5606
|
-
isLoadingMore: isLoadingMoreTraceData,
|
|
5607
|
-
initialSelectedSpanId
|
|
5608
|
-
}
|
|
5609
|
-
) }) }) }),
|
|
5610
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5611
|
-
RunEventsTab,
|
|
5254
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RunLimitGuidanceAlert, { run: runData })
|
|
5255
|
+
] }),
|
|
5256
|
+
usagePage ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
|
|
5257
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5258
|
+
RunViewNav,
|
|
5612
5259
|
{
|
|
5613
|
-
env,
|
|
5614
5260
|
runId,
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
encryptionKey: encryptionKey ?? void 0,
|
|
5618
|
-
sortOrder: eventsSortOrder,
|
|
5619
|
-
onSortOrderChange: setEventsSortOrder,
|
|
5620
|
-
onDecrypt: handleDecrypt,
|
|
5621
|
-
isDecrypting,
|
|
5622
|
-
onViewInTrace: (spanId) => updateSearchParams({ tab: "trace", spanId })
|
|
5261
|
+
showUsage,
|
|
5262
|
+
onNavigate: focusRowItemAfterNavigation
|
|
5623
5263
|
}
|
|
5624
|
-
)
|
|
5625
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5264
|
+
),
|
|
5265
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load run usage", children: usagePage })
|
|
5266
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5267
|
+
Tabs,
|
|
5268
|
+
{
|
|
5269
|
+
value: activeTab,
|
|
5270
|
+
onValueChange: (v) => setActiveTab(v),
|
|
5271
|
+
className: "flex-1 flex flex-col min-h-0",
|
|
5272
|
+
children: [
|
|
5273
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: RUN_VIEW_ROW_CLASS, children: [
|
|
5274
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "h-auto border-0 bg-transparent p-0", children: [
|
|
5275
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5276
|
+
TabsTrigger,
|
|
5277
|
+
{
|
|
5278
|
+
value: "trace",
|
|
5279
|
+
className: "gap-2",
|
|
5280
|
+
"data-run-view-item": "trace",
|
|
5281
|
+
children: [
|
|
5282
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
5283
|
+
"Trace"
|
|
5284
|
+
]
|
|
5285
|
+
}
|
|
5286
|
+
),
|
|
5287
|
+
false,
|
|
5288
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5289
|
+
TabsTrigger,
|
|
5290
|
+
{
|
|
5291
|
+
value: "events",
|
|
5292
|
+
className: "gap-2",
|
|
5293
|
+
"data-run-view-item": "events",
|
|
5294
|
+
children: [
|
|
5295
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
5296
|
+
"Events"
|
|
5297
|
+
]
|
|
5298
|
+
}
|
|
5299
|
+
),
|
|
5300
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5301
|
+
TabsTrigger,
|
|
5302
|
+
{
|
|
5303
|
+
value: "streams",
|
|
5304
|
+
className: "gap-2",
|
|
5305
|
+
"data-run-view-item": "streams",
|
|
5306
|
+
children: [
|
|
5307
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
5308
|
+
"Streams"
|
|
5309
|
+
]
|
|
5310
|
+
}
|
|
5311
|
+
)
|
|
5312
|
+
] }),
|
|
5313
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5314
|
+
UsageNavLink,
|
|
5315
|
+
{
|
|
5316
|
+
runId,
|
|
5317
|
+
onNavigate: focusRowItemAfterNavigation
|
|
5318
|
+
}
|
|
5319
|
+
)
|
|
5320
|
+
] }),
|
|
5321
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "trace", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load trace viewer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5322
|
+
TraceViewer,
|
|
5629
5323
|
{
|
|
5630
|
-
|
|
5631
|
-
|
|
5324
|
+
run,
|
|
5325
|
+
events: allEvents ?? [],
|
|
5326
|
+
loading,
|
|
5327
|
+
sidebarData,
|
|
5328
|
+
onLoadMore: loadMoreTraceData,
|
|
5329
|
+
hasMore: hasMoreTraceData,
|
|
5330
|
+
isLoadingMore: isLoadingMoreTraceData,
|
|
5331
|
+
initialSelectedSpanId
|
|
5632
5332
|
}
|
|
5633
|
-
),
|
|
5634
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("
|
|
5635
|
-
|
|
5636
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-32" }) }),
|
|
5637
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-20" }) })
|
|
5638
|
-
] }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-2 text-label-12 text-red-900", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center px-4 text-label-12 text-gray-900", children: "No streams found for this run" }) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5639
|
-
"button",
|
|
5640
|
-
{
|
|
5641
|
-
type: "button",
|
|
5642
|
-
onClick: () => setSelectedStreamId(streamId),
|
|
5643
|
-
className: `flex h-10 min-h-10 w-full min-w-0 items-center truncate pl-4 pr-2 text-left text-label-14 transition-colors ${selectedStreamId === streamId ? "bg-gray-100 text-gray-1000 hover:bg-gray-200 active:bg-gray-200" : "bg-transparent text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000"}`,
|
|
5644
|
-
title: streamId,
|
|
5645
|
-
children: streamId
|
|
5646
|
-
},
|
|
5647
|
-
streamId
|
|
5648
|
-
)) })
|
|
5649
|
-
] }),
|
|
5650
|
-
/* @__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: [
|
|
5651
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
5652
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
5653
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 font-medium text-gray-1000", children: "Encrypted Stream" }),
|
|
5654
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-12 text-gray-900", children: "Decrypt this stream to view its chunks." })
|
|
5655
|
-
] }),
|
|
5656
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5657
|
-
DecryptButton,
|
|
5333
|
+
) }) }) }),
|
|
5334
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5335
|
+
RunEventsTab,
|
|
5658
5336
|
{
|
|
5659
|
-
|
|
5660
|
-
|
|
5337
|
+
env,
|
|
5338
|
+
runId,
|
|
5339
|
+
run,
|
|
5340
|
+
onLoadEventData: handleLoadEventData,
|
|
5341
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
5342
|
+
sortOrder: eventsSortOrder,
|
|
5343
|
+
onSortOrderChange: setEventsSortOrder,
|
|
5344
|
+
onDecrypt: handleDecrypt,
|
|
5345
|
+
isDecrypting,
|
|
5346
|
+
onViewInTrace: (spanId) => updateSearchParams({ tab: "trace", spanId })
|
|
5661
5347
|
}
|
|
5662
|
-
)
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5348
|
+
) }) }) }),
|
|
5349
|
+
/* @__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: "relative -mx-6 flex h-full min-h-0 overflow-hidden border-t border-gray-alpha-400 bg-background-100", children: [
|
|
5350
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-[340px] shrink-0 flex-col border-r border-gray-alpha-400 bg-background-100", children: [
|
|
5351
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5352
|
+
"div",
|
|
5353
|
+
{
|
|
5354
|
+
"aria-hidden": "true",
|
|
5355
|
+
className: "h-10 min-h-10 border-b border-gray-alpha-400"
|
|
5356
|
+
}
|
|
5357
|
+
),
|
|
5358
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1 divide-y divide-gray-400 overflow-y-auto", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col divide-y divide-gray-400", children: [
|
|
5359
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-24" }) }),
|
|
5360
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-32" }) }),
|
|
5361
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3.5 w-20" }) })
|
|
5362
|
+
] }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-2 text-label-12 text-red-900", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center px-4 text-label-12 text-gray-900", children: "No streams found for this run" }) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5363
|
+
"button",
|
|
5364
|
+
{
|
|
5365
|
+
type: "button",
|
|
5366
|
+
onClick: () => setSelectedStreamId(streamId),
|
|
5367
|
+
className: `flex h-10 min-h-10 w-full min-w-0 items-center truncate pl-4 pr-2 text-left text-label-14 transition-colors ${selectedStreamId === streamId ? "bg-gray-100 text-gray-1000 hover:bg-gray-200 active:bg-gray-200" : "bg-transparent text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000"}`,
|
|
5368
|
+
title: streamId,
|
|
5369
|
+
children: streamId
|
|
5370
|
+
},
|
|
5371
|
+
streamId
|
|
5372
|
+
)) })
|
|
5373
|
+
] }),
|
|
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: [
|
|
5375
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
5376
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
5377
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 font-medium text-gray-1000", children: "Encrypted Stream" }),
|
|
5378
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-12 text-gray-900", children: "Decrypt this stream to view its chunks." })
|
|
5379
|
+
] }),
|
|
5380
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5381
|
+
DecryptButton,
|
|
5382
|
+
{
|
|
5383
|
+
onClick: handleDecrypt,
|
|
5384
|
+
loading: isDecrypting
|
|
5385
|
+
}
|
|
5386
|
+
)
|
|
5387
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5388
|
+
StreamViewer,
|
|
5389
|
+
{
|
|
5390
|
+
streamId: selectedStreamId,
|
|
5391
|
+
chunks: streamChunks,
|
|
5392
|
+
isLive: streamIsLive,
|
|
5393
|
+
isLoading: streamIsInitialLoading,
|
|
5394
|
+
error: streamError?.includes("encrypted") ? null : streamError
|
|
5395
|
+
}
|
|
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" }) }) })
|
|
5397
|
+
] }) }) }),
|
|
5398
|
+
false
|
|
5399
|
+
]
|
|
5400
|
+
}
|
|
5401
|
+
) })
|
|
5402
|
+
]
|
|
5403
|
+
}
|
|
5404
|
+
)
|
|
5679
5405
|
] });
|
|
5680
5406
|
}
|
|
5681
5407
|
const runDetail = withComponentProps(function RunDetailPage() {
|