@workflow/web 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/assets/app-DSMA-d-h.css +1 -0
- package/build/client/assets/{arrow-up-right-KWrqnTig.js → arrow-up-right-Cpa3Pdwo.js} +1 -1
- package/build/client/assets/{highlighted-body-JLMTFACH-DcETTNIg.js → highlighted-body-JLMTFACH-B3GqULNn.js} +1 -1
- package/build/client/assets/{home-DXDIbwXs.js → home-D79hgIWW.js} +18 -1412
- package/build/client/assets/{loader-circle-CTGjdS9p.js → loader-circle-JR85kUd5.js} +1 -1
- package/build/client/assets/manifest-59ebdf79.js +1 -0
- package/build/client/assets/{mermaid-WFAXDIZX-C05IxJpM.js → mermaid-WFAXDIZX-CWiYj6ob.js} +21920 -21866
- package/build/client/assets/root-Cv68eh5c.css +1 -0
- package/build/client/assets/{root-BxCk7uqa.js → root-DgYJfBXO.js} +24 -9
- package/build/client/assets/{run-detail-CZBOEgvx.js → run-detail-Befe_Bls.js} +1868 -1952
- package/build/client/assets/{index-DsOfMZH2.js → url-state-DtiYSmtM.js} +1520 -95
- package/build/client/assets/{zstd-browser-decoder-DADxxRqK.js → zstd-browser-decoder-feFoAFP-.js} +1 -1
- package/build/server/assets/{app-DT6Gt-BX.js → app-BXJVj0oU.js} +22544 -25746
- package/build/server/assets/{highlighted-body-JLMTFACH-CHR6of_B.js → highlighted-body-JLMTFACH-DBscEG8Y.js} +2 -4
- package/build/server/assets/{index-puMiLsWF.js → index-DFAOTIzy.js} +276 -87
- package/build/server/assets/{mermaid-WFAXDIZX-D-xr2vKt.js → mermaid-WFAXDIZX-hv3921YS.js} +2 -4
- package/build/server/assets/{token-D41jJA1K.js → token-BPk8AzMN.js} +2 -2
- package/build/server/assets/{token-CwT5ChW-.js → token-CXneDSmI.js} +1 -1
- package/build/server/assets/{token-util-DqfRGa3d.js → token-util-C_CN233b.js} +1 -1
- package/build/server/assets/{token-util-BJpBdFnQ.js → token-util-lTSClVuJ.js} +2 -2
- package/build/server/assets/{wrapper-Cr0R902L.js → wrapper-CaZIHABu.js} +10 -12
- package/build/server/assets/{zstd-browser-decoder-B48pzCro.js → zstd-browser-decoder-XCzFkM-Z.js} +2 -4
- package/build/server/index.js +3 -5
- package/package.json +10 -10
- package/build/client/assets/app-C_84j2Id.css +0 -1
- package/build/client/assets/manifest-d238ca03.js +0 -1
- package/build/client/assets/root-DUrWgRk7.css +0 -1
- package/build/server/assets/dist-BQmT5wQz.js +0 -210
- /package/build/client/assets/{index-C9ccOmbh.css → url-state-C9ccOmbh.css} +0 -0
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { r as reactExports, j as jsxRuntimeExports, A as useNavigate,
|
|
2
|
-
import {
|
|
3
|
-
import { c as createLucideIcon,
|
|
4
|
-
import { A as ArrowUpRight } from "./arrow-up-right-
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports, A as useNavigate, z as Link, w as withComponentProps, D as useParams, B as useSearchParams } from "./index-BS6T0Zjc.js";
|
|
2
|
+
import { V as parseStepName, w as parseWorkflowName, Y as findStartHookCreation, q as ChevronUp, X, C as CircleAlert, _ as Circle, y as CircleX, $ as ErrorCard, a0 as format, R as ResolveHookModal, U as ErrorBoundary, u as unwrapOrThrow, W as WorkflowWebAPIError, L as unwrapServerActionResult, a1 as useInfiniteList, A as Alert, c as AlertTitle, d as AlertDescription, J as DialogPortal, K as DialogOverlay, a2 as createDialogScope, B as Dialog, a3 as DialogTrigger, F as DialogContent, H as DialogTitle, I as DialogDescription, G as DialogClose, a4 as LAYOUT, N as useOptimisticSearchParams, a5 as wakeUpRun, r as resumeHook, g as getErrorTitle, e as getErrorMessage, a as Skeleton$1, a6 as RunActionsButtons, x as StatusBadge, h as CopyableText, b as RelativeTime, T as Tabs, O as TabsList, P as TabsTrigger, Q as TabsContent, a7 as cancelRun, a8 as recreateRun } from "./url-state-DtiYSmtM.js";
|
|
3
|
+
import { c as createLucideIcon, U as isSlotEventId, X as classifyEntityEvent, Y as TERMINAL_EVENT_CLASSES, Z as isSealedNoopEvent$1, $ as formatDurationPrecise, a0 as isStepEventType, a1 as isWaitEventType, a2 as isHookLifecycleEventType, a3 as isEncryptedMarker, a4 as isTerminalStepEventType, a5 as isRunCreationEvent, a6 as cn, a7 as CopyButton, a8 as CopyableDataBlock, a9 as CollapsibleRoot, aa as CollapsibleTrigger, ab as CollapsibleContent, O as cva, ac as RESERVED_ATTRIBUTE_KEY_PREFIX, T as Tooltip, a as TooltipTrigger, ad as IconButton, b as TooltipContent, K as ChevronDown, ae as Spinner, af as getEventDataRefFields, ag as Collapsible, ah as Skeleton, ai as DecryptClickContext, aj as Lock, ak as DataInspector, al as serializeForClipboard, am as useRowWindow, an as isSpanDimmedBySearch, ao as ROW_HEIGHT_PX, ap as getSpanDurationMs, aq as isSpanErrored, ar as isSpanCancelled, as as TooltipProvider, at as TimestampTooltip, au as ContextCardProvider, av as es, aw as Ui, ax as RunClickContext, ay as StreamClickContext, az as isExpiredMarker, aA as isDoStreamStep, aB as extractConversation, aC as EncryptedDataBlock, aD as hasEncryptedFields, h as useToast, aE as useSidebarDataOptional, aF as isTerminalWorkflowRunStatus, B as Button, aG as useActiveSpan, aH as useSidebarData, aI as ActiveSpanProvider, aJ as useReducedMotion, aK as searchSpans, aL as computeRootBounds, aM as computeTimeMarkers, aN as clampViewportToRoot, aO as getHighResInMs, aP as scrollRowIntoView, aQ as TIMELINE_PADDING_PX, aR as Minimap, aS as Timeline, aT as TimelineHeader, aU as wheelZoomScaleFactor, aV as wheelDeltaToPixels, aW as SidebarDataProvider, aX as hydrateResourceIOAsync, aY as createStateResolver, aZ as deriveRunPayloadKeys, a_ as decodePayloadWithKey, a$ as stateSourceId, b0 as getWebRevivers, b1 as fetchHook, m as fetchEvents, N as fetchRun, b2 as fetchStep, b3 as hydrateResourceIO, b4 as fetchStreams, b5 as apiBase, b6 as fetchEvent, b7 as fetchEventsByCorrelationId, w as createContextScope, n as useComposedRefs, y as composeEventHandlers, e as cn$1, b8 as buttonVariants, b9 as Slot, l as ChevronRight, ba as isEncryptedData, bb as hydrateData, bc as decrypt, bd as getStreamImageType, be as SerializationFormat, bf as LIVE_UPDATE_INTERVAL_MS$1, u as useServerConfig, bg as getEncryptionKeyForRun, t as toast, bh as StreamViewerSkeleton, bi as StreamViewer } from "./mermaid-WFAXDIZX-CWiYj6ob.js";
|
|
4
|
+
import { A as ArrowUpRight } from "./arrow-up-right-Cpa3Pdwo.js";
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.575.0 - ISC
|
|
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
|
+
*/
|
|
11
|
+
const __iconNode$7 = [
|
|
12
|
+
["path", { d: "M10 6h8", key: "zvc2xc" }],
|
|
13
|
+
["path", { d: "M12 16h6", key: "yi5mkt" }],
|
|
14
|
+
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
15
|
+
["path", { d: "M8 11h7", key: "wz2hg0" }]
|
|
16
|
+
];
|
|
17
|
+
const ChartGantt = createLucideIcon("chart-gantt", __iconNode$7);
|
|
5
18
|
/**
|
|
6
19
|
* @license lucide-react v0.575.0 - ISC
|
|
7
20
|
*
|
|
@@ -157,166 +170,944 @@ function findDuplicateEventIds(events, { isCompleteHistory }) {
|
|
|
157
170
|
return /* @__PURE__ */ new Set();
|
|
158
171
|
return foldDuplicates(ordered);
|
|
159
172
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
164
|
-
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
165
|
-
const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
|
|
166
|
-
function matchPrefixedId(pattern, prefix, kind, query) {
|
|
167
|
-
const match = query.match(pattern);
|
|
168
|
-
if (!match) {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
return { kind, id: `${prefix}_${match[1].toUpperCase()}` };
|
|
173
|
+
const SEALED_EVENT_MESSAGE = "No-op events are written by the backend to seal an abandoned log position";
|
|
174
|
+
function isSealedNoopEvent(event) {
|
|
175
|
+
return isSealedNoopEvent$1(event);
|
|
172
176
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
if (!trimmed) {
|
|
177
|
+
function parseEventDate(value) {
|
|
178
|
+
if (value == null)
|
|
176
179
|
return null;
|
|
180
|
+
const date = value instanceof Date ? value : new Date(String(value));
|
|
181
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
182
|
+
}
|
|
183
|
+
function getEffectiveEventDate$1(event) {
|
|
184
|
+
return parseEventDate(event.occurredAt) ?? new Date(event.createdAt);
|
|
185
|
+
}
|
|
186
|
+
function getEffectiveEventTime(event) {
|
|
187
|
+
return getEffectiveEventDate$1(event).getTime();
|
|
188
|
+
}
|
|
189
|
+
const pad = (n, width = 2) => n.toString().padStart(width, "0");
|
|
190
|
+
function formatTimestampParts(date) {
|
|
191
|
+
const month = date.toLocaleString("en-US", { month: "short" }).toUpperCase();
|
|
192
|
+
return {
|
|
193
|
+
day: `${month} ${pad(date.getDate())}`,
|
|
194
|
+
clock: `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`,
|
|
195
|
+
ms: `.${pad(date.getMilliseconds(), 3)}`
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function formatClock(value) {
|
|
199
|
+
const date = parseEventDate(value);
|
|
200
|
+
return date ? formatTimestampParts(date).clock : null;
|
|
201
|
+
}
|
|
202
|
+
function formatSinceStart(ms) {
|
|
203
|
+
return ms <= 0 ? "0ms" : `+${formatDurationPrecise(ms)}`;
|
|
204
|
+
}
|
|
205
|
+
function sortEventsByTime(events, order) {
|
|
206
|
+
const dir = order === "desc" ? -1 : 1;
|
|
207
|
+
return [...events].sort((a, b) => dir * (getEffectiveEventTime(a) - getEffectiveEventTime(b)));
|
|
208
|
+
}
|
|
209
|
+
function mergeEventsById(...lists) {
|
|
210
|
+
const seen = /* @__PURE__ */ new Set();
|
|
211
|
+
const merged = [];
|
|
212
|
+
for (const list of lists) {
|
|
213
|
+
for (const event of list) {
|
|
214
|
+
if (seen.has(event.eventId))
|
|
215
|
+
continue;
|
|
216
|
+
seen.add(event.eventId);
|
|
217
|
+
merged.push(event);
|
|
218
|
+
}
|
|
177
219
|
}
|
|
178
|
-
return
|
|
220
|
+
return merged;
|
|
179
221
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
if (!WORKFLOW_ID_PREFIX_PATTERN.test(trimmed)) {
|
|
222
|
+
function hasEncryptedValues(data) {
|
|
223
|
+
if (!data || typeof data !== "object")
|
|
183
224
|
return false;
|
|
225
|
+
for (const val of Object.values(data)) {
|
|
226
|
+
if (isEncryptedMarker(val))
|
|
227
|
+
return true;
|
|
184
228
|
}
|
|
185
|
-
return
|
|
229
|
+
return false;
|
|
186
230
|
}
|
|
187
|
-
const
|
|
188
|
-
function
|
|
189
|
-
|
|
231
|
+
const RUN_ENTITY_KEY = "__run__";
|
|
232
|
+
function getEntityKind(eventType) {
|
|
233
|
+
if (isStepEventType(eventType))
|
|
234
|
+
return "step";
|
|
235
|
+
if (isWaitEventType(eventType))
|
|
236
|
+
return "wait";
|
|
237
|
+
if (isHookLifecycleEventType(eventType) || eventType === "hook_conflict") {
|
|
238
|
+
return "hook";
|
|
239
|
+
}
|
|
240
|
+
return "run";
|
|
190
241
|
}
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
242
|
+
function getEventEntity(event) {
|
|
243
|
+
const kind = getEntityKind(event.eventType);
|
|
244
|
+
if (kind === "run")
|
|
245
|
+
return { kind, key: RUN_ENTITY_KEY };
|
|
246
|
+
return { kind, key: event.correlationId ?? null };
|
|
247
|
+
}
|
|
248
|
+
function getEventResource(event, entity) {
|
|
249
|
+
if (event.eventType === "noop")
|
|
250
|
+
return "event";
|
|
251
|
+
return entity.kind === "wait" ? "sleep" : entity.kind;
|
|
252
|
+
}
|
|
253
|
+
function buildNameMaps(events, run) {
|
|
254
|
+
var _a, _b, _c;
|
|
255
|
+
const correlationNameMap = /* @__PURE__ */ new Map();
|
|
256
|
+
const hookNameMap = /* @__PURE__ */ new Map();
|
|
257
|
+
for (const event of events ?? []) {
|
|
258
|
+
if (!event.correlationId)
|
|
259
|
+
continue;
|
|
260
|
+
if (event.eventType === "hook_created") {
|
|
261
|
+
const token = (_a = event.eventData) == null ? void 0 : _a.token;
|
|
262
|
+
if (typeof token === "string")
|
|
263
|
+
hookNameMap.set(event.correlationId, token);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (event.eventType !== "step_created" && event.eventType !== "step_started") {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const stepName = (_b = event.eventData) == null ? void 0 : _b.stepName;
|
|
270
|
+
if (typeof stepName !== "string")
|
|
271
|
+
continue;
|
|
272
|
+
if (event.eventType === "step_started" && correlationNameMap.has(event.correlationId)) {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const parsed = parseStepName(stepName) ?? parseWorkflowName(stepName);
|
|
276
|
+
correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
|
|
277
|
+
}
|
|
278
|
+
const workflowName = (run == null ? void 0 : run.workflowName) ? ((_c = parseWorkflowName(run.workflowName)) == null ? void 0 : _c.shortName) ?? run.workflowName : null;
|
|
279
|
+
return { correlationNameMap, hookNameMap, workflowName };
|
|
280
|
+
}
|
|
281
|
+
function getEventName(entity, names) {
|
|
282
|
+
if (entity.kind === "run")
|
|
283
|
+
return names.workflowName ?? "";
|
|
284
|
+
if (entity.key === null)
|
|
285
|
+
return "";
|
|
286
|
+
if (entity.kind === "hook")
|
|
287
|
+
return names.hookNameMap.get(entity.key) ?? "hook";
|
|
288
|
+
if (entity.kind === "wait")
|
|
289
|
+
return "sleep";
|
|
290
|
+
return names.correlationNameMap.get(entity.key) ?? "";
|
|
291
|
+
}
|
|
292
|
+
const ATTEMPT_OUTCOME = {
|
|
293
|
+
step_completed: "ok",
|
|
294
|
+
step_failed: "failed",
|
|
295
|
+
step_retrying: "failed"
|
|
296
|
+
};
|
|
297
|
+
function buildEventTiming(events, duplicateEventIds = /* @__PURE__ */ new Set()) {
|
|
298
|
+
const chronological = events.filter((event) => !duplicateEventIds.has(event.eventId)).sort((a, b) => getEffectiveEventTime(a) - getEffectiveEventTime(b));
|
|
299
|
+
const clocks = /* @__PURE__ */ new Map();
|
|
300
|
+
const eventDurations = /* @__PURE__ */ new Map();
|
|
301
|
+
for (const event of chronological) {
|
|
302
|
+
const { key } = getEventEntity(event);
|
|
303
|
+
if (key === null)
|
|
304
|
+
continue;
|
|
305
|
+
const ts = getEffectiveEventTime(event);
|
|
306
|
+
const type = event.eventType;
|
|
307
|
+
let clock = clocks.get(key);
|
|
308
|
+
if (!clock) {
|
|
309
|
+
clock = { attempt: 0, segments: [] };
|
|
310
|
+
clocks.set(key, clock);
|
|
311
|
+
}
|
|
312
|
+
switch (type) {
|
|
313
|
+
case "step_created":
|
|
314
|
+
case "run_created":
|
|
315
|
+
clock.createdAt ?? (clock.createdAt = ts);
|
|
316
|
+
break;
|
|
317
|
+
case "step_started":
|
|
318
|
+
if (clock.attempt === 0 && clock.createdAt !== void 0) {
|
|
319
|
+
clock.segments.push({
|
|
320
|
+
kind: "queued",
|
|
321
|
+
label: "Queued",
|
|
322
|
+
ms: ts - clock.createdAt
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
if (clock.backoffStart !== void 0) {
|
|
326
|
+
clock.segments.push({
|
|
327
|
+
kind: "backoff",
|
|
328
|
+
label: "Backoff",
|
|
329
|
+
ms: ts - clock.backoffStart
|
|
330
|
+
});
|
|
331
|
+
clock.backoffStart = void 0;
|
|
332
|
+
}
|
|
333
|
+
clock.attempt += 1;
|
|
334
|
+
clock.openedAt = ts;
|
|
335
|
+
break;
|
|
336
|
+
case "run_started":
|
|
337
|
+
case "wait_created":
|
|
338
|
+
clock.openedAt = ts;
|
|
339
|
+
break;
|
|
340
|
+
case "step_completed":
|
|
341
|
+
case "step_failed":
|
|
342
|
+
case "step_retrying":
|
|
343
|
+
case "run_completed":
|
|
344
|
+
case "run_failed":
|
|
345
|
+
case "run_cancelled":
|
|
346
|
+
case "wait_completed": {
|
|
347
|
+
if (type === "step_retrying")
|
|
348
|
+
clock.backoffStart = ts;
|
|
349
|
+
if (clock.openedAt === void 0)
|
|
350
|
+
break;
|
|
351
|
+
const ms = ts - clock.openedAt;
|
|
352
|
+
clock.openedAt = void 0;
|
|
353
|
+
eventDurations.set(event.eventId, ms);
|
|
354
|
+
const outcome = ATTEMPT_OUTCOME[type];
|
|
355
|
+
if (outcome) {
|
|
356
|
+
clock.segments.push({
|
|
357
|
+
kind: outcome,
|
|
358
|
+
label: `Attempt ${clock.attempt} · ${outcome}`,
|
|
359
|
+
ms
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
199
365
|
}
|
|
200
|
-
|
|
366
|
+
const stepSegments = /* @__PURE__ */ new Map();
|
|
367
|
+
for (const [key, clock] of clocks) {
|
|
368
|
+
stepSegments.set(key, clock.segments.filter((segment) => segment.ms > 0));
|
|
369
|
+
}
|
|
370
|
+
return { eventDurations, stepSegments };
|
|
201
371
|
}
|
|
202
|
-
function
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
372
|
+
function getEventLevel(event) {
|
|
373
|
+
switch (event.eventType) {
|
|
374
|
+
case "step_failed":
|
|
375
|
+
case "run_failed":
|
|
376
|
+
return "error";
|
|
377
|
+
case "step_retrying":
|
|
378
|
+
case "hook_conflict":
|
|
379
|
+
return "warning";
|
|
380
|
+
default:
|
|
381
|
+
return "default";
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function getEventMessage(event, queuedMs) {
|
|
385
|
+
const data = event.eventData ?? {};
|
|
386
|
+
const attempt = typeof data.attempt === "number" ? data.attempt : void 0;
|
|
387
|
+
switch (event.eventType) {
|
|
388
|
+
case "step_started":
|
|
389
|
+
if (attempt && attempt > 1)
|
|
390
|
+
return `attempt ${attempt}`;
|
|
391
|
+
return queuedMs ? `queued ${formatDurationPrecise(queuedMs)}` : "";
|
|
392
|
+
case "step_retrying": {
|
|
393
|
+
const retryAt = formatClock(data.retryAfter);
|
|
394
|
+
const head = attempt ? `attempt ${attempt} failed` : "attempt failed";
|
|
395
|
+
return retryAt ? `${head} · retry at ${retryAt}` : head;
|
|
396
|
+
}
|
|
397
|
+
case "step_failed":
|
|
398
|
+
return attempt ? `failed on attempt ${attempt}` : "failed";
|
|
399
|
+
case "run_failed":
|
|
400
|
+
return typeof data.errorCode === "string" ? data.errorCode : "";
|
|
401
|
+
case "run_cancelled":
|
|
402
|
+
return typeof data.cancelReason === "string" ? data.cancelReason : "";
|
|
403
|
+
case "wait_created": {
|
|
404
|
+
const resumeAt = formatClock(data.resumeAt);
|
|
405
|
+
return resumeAt ? `resumes at ${resumeAt}` : "";
|
|
406
|
+
}
|
|
407
|
+
case "hook_created":
|
|
408
|
+
return data.isWebhook ? "webhook" : "";
|
|
409
|
+
case "hook_conflict":
|
|
410
|
+
return typeof data.conflictingRunId === "string" ? `token held by ${data.conflictingRunId}` : "token already in use";
|
|
411
|
+
case "attr_set": {
|
|
412
|
+
const changes = Array.isArray(data.changes) ? data.changes : [];
|
|
413
|
+
return changes.map((change) => change.value === null ? `${String(change.key)} removed` : `${String(change.key)} = ${JSON.stringify(change.value)}`).join(", ");
|
|
414
|
+
}
|
|
415
|
+
default:
|
|
416
|
+
return "";
|
|
212
417
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
418
|
+
}
|
|
419
|
+
function getRunStartMs(events, run) {
|
|
420
|
+
const created = parseEventDate(run == null ? void 0 : run.createdAt);
|
|
421
|
+
if (created)
|
|
422
|
+
return created.getTime();
|
|
423
|
+
let min;
|
|
424
|
+
for (const event of events) {
|
|
425
|
+
const t = getEffectiveEventTime(event);
|
|
426
|
+
if (min === void 0 || t < min)
|
|
427
|
+
min = t;
|
|
428
|
+
}
|
|
429
|
+
return min;
|
|
430
|
+
}
|
|
431
|
+
function buildEventLookups(events, run, duplicateEventIds) {
|
|
217
432
|
return {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
text: prefixText + ELLIPSIS + suffixText,
|
|
223
|
-
truncated: true
|
|
433
|
+
names: buildNameMaps(events, run),
|
|
434
|
+
timing: buildEventTiming(events, duplicateEventIds),
|
|
435
|
+
runStartMs: getRunStartMs(events, run),
|
|
436
|
+
duplicateEventIds
|
|
224
437
|
};
|
|
225
438
|
}
|
|
226
|
-
function
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
439
|
+
function buildEventRow(event, lookups) {
|
|
440
|
+
var _a;
|
|
441
|
+
const entity = getEventEntity(event);
|
|
442
|
+
const segments = entity.key === null ? [] : lookups.timing.stepSegments.get(entity.key) ?? [];
|
|
443
|
+
const ignored = lookups.duplicateEventIds.has(event.eventId) ? {
|
|
444
|
+
message: "duplicate, ignored on replay",
|
|
445
|
+
notice: DUPLICATE_EVENT_MESSAGE
|
|
446
|
+
} : isSealedNoopEvent(event) ? {
|
|
447
|
+
message: "sealed slot, never observed by the run",
|
|
448
|
+
notice: SEALED_EVENT_MESSAGE
|
|
449
|
+
} : null;
|
|
450
|
+
return {
|
|
451
|
+
event,
|
|
452
|
+
entity,
|
|
453
|
+
level: ignored ? "muted" : getEventLevel(event),
|
|
454
|
+
resource: getEventResource(event, entity),
|
|
455
|
+
name: getEventName(entity, lookups.names),
|
|
456
|
+
message: (ignored == null ? void 0 : ignored.message) ?? getEventMessage(event, (_a = segments.find((segment) => segment.kind === "queued")) == null ? void 0 : _a.ms),
|
|
457
|
+
notice: ignored == null ? void 0 : ignored.notice,
|
|
458
|
+
segments,
|
|
459
|
+
durationMs: lookups.timing.eventDurations.get(event.eventId),
|
|
460
|
+
sinceStartMs: lookups.runStartMs === void 0 ? void 0 : getEffectiveEventTime(event) - lookups.runStartMs
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const IDLE_GAP_MS = 3e4;
|
|
464
|
+
function describeGap(later, hookNameMap) {
|
|
465
|
+
if (later.eventType === "wait_completed")
|
|
466
|
+
return "waiting on sleep";
|
|
467
|
+
if (later.eventType === "hook_received") {
|
|
468
|
+
const token = later.correlationId ? hookNameMap.get(later.correlationId) : void 0;
|
|
469
|
+
return token ? `waiting on hook ${token}` : "waiting on hook";
|
|
470
|
+
}
|
|
471
|
+
return "";
|
|
472
|
+
}
|
|
473
|
+
function buildListItems(rows, options) {
|
|
474
|
+
const items = [];
|
|
475
|
+
rows.forEach((row, index) => {
|
|
476
|
+
if (options.showGaps && index > 0) {
|
|
477
|
+
const prev = rows[index - 1].event;
|
|
478
|
+
const event = row.event;
|
|
479
|
+
const a = getEffectiveEventTime(prev);
|
|
480
|
+
const b = getEffectiveEventTime(event);
|
|
481
|
+
const ms = Math.abs(b - a);
|
|
482
|
+
if (ms >= IDLE_GAP_MS) {
|
|
483
|
+
const later = b >= a ? event : prev;
|
|
484
|
+
items.push({
|
|
485
|
+
kind: "gap",
|
|
486
|
+
key: `gap-${prev.eventId}-${event.eventId}`,
|
|
487
|
+
ms,
|
|
488
|
+
reason: describeGap(later, options.hookNameMap)
|
|
489
|
+
});
|
|
490
|
+
}
|
|
260
491
|
}
|
|
492
|
+
items.push({ kind: "event", row, index });
|
|
493
|
+
});
|
|
494
|
+
return items;
|
|
495
|
+
}
|
|
496
|
+
const NO_EVENTS = [];
|
|
497
|
+
function getListSource(search, log) {
|
|
498
|
+
switch (search.status) {
|
|
499
|
+
case "ok":
|
|
500
|
+
return { events: search.events, hasMore: false, isLog: false };
|
|
501
|
+
case "not_found":
|
|
502
|
+
case "error":
|
|
503
|
+
return { events: NO_EVENTS, hasMore: false, isLog: false };
|
|
504
|
+
default:
|
|
505
|
+
return {
|
|
506
|
+
events: log.events ?? NO_EVENTS,
|
|
507
|
+
hasMore: log.hasMore,
|
|
508
|
+
isLog: true
|
|
509
|
+
};
|
|
261
510
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
511
|
+
}
|
|
512
|
+
function countEvents(n) {
|
|
513
|
+
return `${n} event${n !== 1 ? "s" : ""}`;
|
|
514
|
+
}
|
|
515
|
+
function getEmptyMessage(search) {
|
|
516
|
+
switch (search.status) {
|
|
517
|
+
case "not_found":
|
|
518
|
+
return `No events found for ${search.query}`;
|
|
519
|
+
case "error":
|
|
520
|
+
return search.message;
|
|
521
|
+
case "unavailable":
|
|
522
|
+
return "Exact ID search is unavailable in this view.";
|
|
523
|
+
default:
|
|
524
|
+
return "No events found";
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function getFooterLabel(search, counts) {
|
|
528
|
+
const { total, hasMoreEvents } = counts;
|
|
529
|
+
switch (search.status) {
|
|
530
|
+
case "ok":
|
|
531
|
+
return `${countEvents(total)} for ${search.query}${search.truncated ? " (results may be truncated)" : ""}`;
|
|
532
|
+
case "not_found":
|
|
533
|
+
return `No events found for ${search.query}`;
|
|
534
|
+
case "error":
|
|
535
|
+
return search.message;
|
|
536
|
+
case "incomplete":
|
|
537
|
+
return "Enter a full step ID, wait ID, hook ID, or event ID";
|
|
538
|
+
default:
|
|
539
|
+
return `${countEvents(total)}${hasMoreEvents ? " loaded" : ""}`;
|
|
271
540
|
}
|
|
272
|
-
return buildCandidate(graphemes, best);
|
|
273
541
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return null;
|
|
542
|
+
function shouldShowVerticalLine(eventType) {
|
|
543
|
+
if (isHookLifecycleEventType(eventType)) {
|
|
544
|
+
return true;
|
|
278
545
|
}
|
|
279
|
-
|
|
280
|
-
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
function dateToOtelTime(date) {
|
|
549
|
+
if (typeof date === "string") {
|
|
550
|
+
date = new Date(date);
|
|
281
551
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (selectionStart > ellipsisStart || selectionEnd < ellipsisEnd) {
|
|
285
|
-
return null;
|
|
552
|
+
if (!date || !(date instanceof Date)) {
|
|
553
|
+
return [0, 0];
|
|
286
554
|
}
|
|
287
|
-
const
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
return originalGraphemes.slice(selectedPrefixGraphemeCount, suffixStart + selectedSuffixGraphemeCount).join("");
|
|
555
|
+
const ms = date.getTime();
|
|
556
|
+
const seconds = Math.floor(ms / 1e3);
|
|
557
|
+
const nanoseconds = ms % 1e3 * 1e6;
|
|
558
|
+
return [seconds, nanoseconds];
|
|
292
559
|
}
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (trimmedSelectionText === visibleText) {
|
|
302
|
-
return leading + value + trailing;
|
|
560
|
+
function otelTimeToMs(time) {
|
|
561
|
+
const secondsToMs = time[0] * 1e3;
|
|
562
|
+
const nanosecondsToMs = time[1] / 1e6;
|
|
563
|
+
return secondsToMs + nanosecondsToMs;
|
|
564
|
+
}
|
|
565
|
+
function calculateDuration(start, end) {
|
|
566
|
+
if (typeof start === "string") {
|
|
567
|
+
start = new Date(start);
|
|
303
568
|
}
|
|
304
|
-
if (
|
|
305
|
-
|
|
569
|
+
if (typeof end === "string") {
|
|
570
|
+
end = new Date(end);
|
|
306
571
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return null;
|
|
572
|
+
if (!start || !(start instanceof Date)) {
|
|
573
|
+
return [0, 0];
|
|
310
574
|
}
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
575
|
+
const endTime = end && end instanceof Date ? end : /* @__PURE__ */ new Date();
|
|
576
|
+
const durationMs = endTime.getTime() - start.getTime();
|
|
577
|
+
const seconds = Math.floor(durationMs / 1e3);
|
|
578
|
+
const nanoseconds = durationMs % 1e3 * 1e6;
|
|
579
|
+
return [seconds, nanoseconds];
|
|
580
|
+
}
|
|
581
|
+
const WORKFLOW_LIBRARY = {
|
|
582
|
+
name: "workflow-development-kit",
|
|
583
|
+
version: "4.0.0"
|
|
584
|
+
};
|
|
585
|
+
const MARKER_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
586
|
+
"hook_created",
|
|
587
|
+
"hook_received",
|
|
588
|
+
"hook_disposed",
|
|
589
|
+
"step_started",
|
|
590
|
+
"step_retrying",
|
|
591
|
+
"step_failed",
|
|
592
|
+
"run_failed",
|
|
593
|
+
"wait_created",
|
|
594
|
+
"wait_completed",
|
|
595
|
+
"attr_set"
|
|
596
|
+
]);
|
|
597
|
+
const getEventTimestamp = (event) => {
|
|
598
|
+
const value = (event == null ? void 0 : event.occurredAt) ?? (event == null ? void 0 : event.createdAt);
|
|
599
|
+
if (!value)
|
|
600
|
+
return void 0;
|
|
601
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
602
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
603
|
+
};
|
|
604
|
+
function convertEventsToSpanEvents(events, filterTypes = true, options = {}) {
|
|
605
|
+
return events.filter((event) => filterTypes ? MARKER_EVENT_TYPES.has(event.eventType) : true).map((event) => ({
|
|
606
|
+
name: event.eventType,
|
|
607
|
+
timestamp: dateToOtelTime(options.preferOccurredAt ? getEventTimestamp(event) ?? event.createdAt : event.createdAt),
|
|
608
|
+
attributes: {
|
|
609
|
+
eventId: event.eventId,
|
|
610
|
+
correlationId: event.correlationId,
|
|
611
|
+
eventData: "eventData" in event ? event.eventData : void 0
|
|
612
|
+
},
|
|
613
|
+
// Control whether to show vertical line in timeline
|
|
614
|
+
showVerticalLine: shouldShowVerticalLine(event.eventType)
|
|
615
|
+
}));
|
|
616
|
+
}
|
|
617
|
+
const waitEventsToWaitEntity = (events) => {
|
|
618
|
+
var _a;
|
|
619
|
+
const startEvent = events.find((event) => event.eventType === "wait_created");
|
|
620
|
+
if (!startEvent) {
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
const completedEvent = events.find((event) => event.eventType === "wait_completed");
|
|
624
|
+
return {
|
|
625
|
+
waitId: startEvent.correlationId,
|
|
626
|
+
runId: startEvent.runId,
|
|
627
|
+
createdAt: getEventTimestamp(startEvent) ?? startEvent.createdAt,
|
|
628
|
+
resumeAt: ((_a = startEvent.eventData) == null ? void 0 : _a.resumeAt) ? new Date(startEvent.eventData.resumeAt) : void 0,
|
|
629
|
+
completedAt: getEventTimestamp(completedEvent)
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
function waitToSpan(events, maxEndTime, fallbackEndTime = maxEndTime) {
|
|
633
|
+
const wait = waitEventsToWaitEntity(events);
|
|
634
|
+
if (!wait) {
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
const startTime = wait.createdAt;
|
|
638
|
+
const startMs = startTime.getTime();
|
|
639
|
+
let endTime = wait.completedAt;
|
|
640
|
+
if (!endTime) {
|
|
641
|
+
const fallbackCap = wait.resumeAt && wait.resumeAt.getTime() < fallbackEndTime.getTime() ? wait.resumeAt : fallbackEndTime;
|
|
642
|
+
endTime = maxEndTime.getTime() > startMs && maxEndTime.getTime() < fallbackCap.getTime() ? maxEndTime : fallbackCap;
|
|
643
|
+
}
|
|
644
|
+
const start = dateToOtelTime(startTime);
|
|
645
|
+
const end = dateToOtelTime(endTime);
|
|
646
|
+
const duration = calculateDuration(startTime, endTime);
|
|
647
|
+
const spanEvents = convertEventsToSpanEvents(events, false);
|
|
648
|
+
return {
|
|
649
|
+
spanId: wait.waitId,
|
|
650
|
+
name: "sleep",
|
|
651
|
+
kind: 1,
|
|
652
|
+
// INTERNAL span kind
|
|
653
|
+
resource: "sleep",
|
|
654
|
+
library: WORKFLOW_LIBRARY,
|
|
655
|
+
status: { code: 0 },
|
|
656
|
+
traceFlags: 1,
|
|
657
|
+
attributes: {
|
|
658
|
+
resource: "sleep",
|
|
659
|
+
data: wait
|
|
660
|
+
// wait is a plain object built from events, no non-cloneable types
|
|
661
|
+
},
|
|
662
|
+
links: [],
|
|
663
|
+
events: spanEvents,
|
|
664
|
+
duration,
|
|
665
|
+
startTime: start,
|
|
666
|
+
endTime: end
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
const stepEventsToStepEntity = (events) => {
|
|
670
|
+
var _a, _b;
|
|
671
|
+
const createdEvent = events.find((event) => event.eventType === "step_created");
|
|
672
|
+
const anchorEvent = createdEvent ?? events[0];
|
|
673
|
+
const firstStartedEvent = events.find((event) => event.eventType === "step_started");
|
|
674
|
+
if (!anchorEvent) {
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
let status = "pending";
|
|
678
|
+
let attempt = 0;
|
|
679
|
+
let startedAt;
|
|
680
|
+
let completedAt;
|
|
681
|
+
for (const e of events) {
|
|
682
|
+
switch (e.eventType) {
|
|
683
|
+
case "step_started":
|
|
684
|
+
status = "running";
|
|
685
|
+
attempt += 1;
|
|
686
|
+
if (!startedAt)
|
|
687
|
+
startedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
688
|
+
completedAt = void 0;
|
|
689
|
+
break;
|
|
690
|
+
case "step_completed":
|
|
691
|
+
status = "completed";
|
|
692
|
+
completedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
693
|
+
break;
|
|
694
|
+
case "step_failed":
|
|
695
|
+
status = "failed";
|
|
696
|
+
completedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
697
|
+
break;
|
|
698
|
+
case "step_retrying":
|
|
699
|
+
status = "pending";
|
|
700
|
+
completedAt = void 0;
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (attempt === 0)
|
|
705
|
+
attempt = 1;
|
|
706
|
+
const lastEvent = events[events.length - 1];
|
|
707
|
+
return {
|
|
708
|
+
stepId: anchorEvent.correlationId ?? "",
|
|
709
|
+
runId: anchorEvent.runId,
|
|
710
|
+
stepName: ((_a = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a.stepName) ?? ((_b = firstStartedEvent == null ? void 0 : firstStartedEvent.eventData) == null ? void 0 : _b.stepName) ?? "",
|
|
711
|
+
status,
|
|
712
|
+
attempt,
|
|
713
|
+
createdAt: getEventTimestamp(anchorEvent) ?? anchorEvent.createdAt,
|
|
714
|
+
updatedAt: getEventTimestamp(lastEvent) ?? (lastEvent == null ? void 0 : lastEvent.createdAt) ?? anchorEvent.createdAt,
|
|
715
|
+
startedAt,
|
|
716
|
+
completedAt,
|
|
717
|
+
specVersion: anchorEvent.specVersion
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
721
|
+
const step = stepEventsToStepEntity(stepEvents);
|
|
722
|
+
if (!step) {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
const parsedName = parseStepName(String(step.stepName)) ?? parseWorkflowName(String(step.stepName));
|
|
726
|
+
const attributes = {
|
|
727
|
+
resource: "step",
|
|
728
|
+
data: {
|
|
729
|
+
...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
|
|
730
|
+
// Canonical event-derived fields cannot be overridden by extensions.
|
|
731
|
+
...step
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
const resource = "step";
|
|
735
|
+
const events = convertEventsToSpanEvents(stepEvents, false, {
|
|
736
|
+
preferOccurredAt: true
|
|
737
|
+
});
|
|
738
|
+
const spanStartEvent = stepEvents.find((event) => event.eventType === "step_created") ?? stepEvents[0];
|
|
739
|
+
const spanStartTime = getEventTimestamp(spanStartEvent) ?? new Date(step.createdAt);
|
|
740
|
+
let activeStartTime = step.startedAt ? new Date(step.startedAt) : void 0;
|
|
741
|
+
const firstStartEvent = stepEvents.find((event) => event.eventType === "step_started");
|
|
742
|
+
if (firstStartEvent) {
|
|
743
|
+
activeStartTime = getEventTimestamp(firstStartEvent) ?? new Date(firstStartEvent.createdAt);
|
|
744
|
+
}
|
|
745
|
+
let endTime = new Date(maxEndTime);
|
|
746
|
+
if (step.completedAt) {
|
|
747
|
+
const completedEvent = stepEvents.slice().reverse().find((event) => isTerminalStepEventType(event.eventType));
|
|
748
|
+
endTime = getEventTimestamp(completedEvent) ?? new Date(step.completedAt);
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
spanId: String(step.stepId),
|
|
752
|
+
name: (parsedName == null ? void 0 : parsedName.shortName) ?? String(step.stepName),
|
|
753
|
+
kind: 1,
|
|
754
|
+
// INTERNAL span kind
|
|
755
|
+
resource,
|
|
756
|
+
library: WORKFLOW_LIBRARY,
|
|
757
|
+
status: { code: 0 },
|
|
758
|
+
traceFlags: 1,
|
|
759
|
+
attributes,
|
|
760
|
+
links: [],
|
|
761
|
+
events,
|
|
762
|
+
startTime: dateToOtelTime(spanStartTime),
|
|
763
|
+
endTime: dateToOtelTime(endTime),
|
|
764
|
+
duration: calculateDuration(spanStartTime, endTime),
|
|
765
|
+
// Only set activeStartTime if it differs from startTime (i.e., there was a queued period)
|
|
766
|
+
activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
const hookEventsToHookEntity = (events, startHook) => {
|
|
770
|
+
var _a;
|
|
771
|
+
const createdEvent = events.find((event) => event.eventType === "hook_created");
|
|
772
|
+
const creation = createdEvent ? {
|
|
773
|
+
hookId: createdEvent.correlationId,
|
|
774
|
+
runId: createdEvent.runId,
|
|
775
|
+
token: (_a = createdEvent.eventData) == null ? void 0 : _a.token,
|
|
776
|
+
createdAt: getEventTimestamp(createdEvent) ?? createdEvent.createdAt
|
|
777
|
+
} : startHook && events.every((event) => event.correlationId === startHook.hookId) ? startHook : void 0;
|
|
778
|
+
if (!creation) {
|
|
779
|
+
return null;
|
|
780
|
+
}
|
|
781
|
+
const receivedEvents = events.filter((event) => event.eventType === "hook_received");
|
|
782
|
+
const disposedEvents = events.filter((event) => event.eventType === "hook_disposed");
|
|
783
|
+
const lastReceivedEvent = receivedEvents.at(-1);
|
|
784
|
+
return {
|
|
785
|
+
hookId: creation.hookId,
|
|
786
|
+
runId: creation.runId,
|
|
787
|
+
token: creation.token,
|
|
788
|
+
createdAt: creation.createdAt,
|
|
789
|
+
receivedCount: receivedEvents.length,
|
|
790
|
+
lastReceivedAt: getEventTimestamp(lastReceivedEvent),
|
|
791
|
+
disposedAt: getEventTimestamp(disposedEvents.at(-1))
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
function hookToSpan(hookEvents, maxEndTime, startHook) {
|
|
795
|
+
const hook = hookEventsToHookEntity(hookEvents, startHook);
|
|
796
|
+
if (!hook) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
const events = convertEventsToSpanEvents(hookEvents, false);
|
|
800
|
+
const endTime = hook.disposedAt || maxEndTime;
|
|
801
|
+
return {
|
|
802
|
+
spanId: String(hook.hookId),
|
|
803
|
+
name: hook.token ?? String(hook.hookId),
|
|
804
|
+
kind: 1,
|
|
805
|
+
// INTERNAL span kind
|
|
806
|
+
resource: "hook",
|
|
807
|
+
library: WORKFLOW_LIBRARY,
|
|
808
|
+
status: { code: 1 },
|
|
809
|
+
traceFlags: 1,
|
|
810
|
+
attributes: {
|
|
811
|
+
resource: "hook",
|
|
812
|
+
data: hook
|
|
813
|
+
},
|
|
814
|
+
links: [],
|
|
815
|
+
events,
|
|
816
|
+
startTime: dateToOtelTime(hook.createdAt),
|
|
817
|
+
endTime: dateToOtelTime(endTime),
|
|
818
|
+
duration: calculateDuration(hook.createdAt, endTime)
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
function runToSpan(run, runEvents, nowTime) {
|
|
822
|
+
var _a, _b;
|
|
823
|
+
const now = nowTime ?? /* @__PURE__ */ new Date();
|
|
824
|
+
const runCreatedEvent = runEvents.find(isRunCreationEvent);
|
|
825
|
+
const runStartedEvent = runEvents.find((event) => event.eventType === "run_started");
|
|
826
|
+
const terminalEvent = runEvents.slice().reverse().find((event) => event.eventType === "run_completed" || event.eventType === "run_failed" || event.eventType === "run_cancelled");
|
|
827
|
+
const spanStartTime = getEventTimestamp(runCreatedEvent) ?? new Date(run.createdAt);
|
|
828
|
+
const activeStartTime = getEventTimestamp(runStartedEvent) ?? (run.startedAt ? new Date(run.startedAt) : void 0);
|
|
829
|
+
const completedAt = getEventTimestamp(terminalEvent) ?? run.completedAt ?? void 0;
|
|
830
|
+
const endTime = completedAt ?? now;
|
|
831
|
+
const wasCancelled = run.status === "cancelled" || (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled";
|
|
832
|
+
const cancelReason = (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled" && typeof ((_a = terminalEvent.eventData) == null ? void 0 : _a.cancelReason) === "string" ? terminalEvent.eventData.cancelReason : null;
|
|
833
|
+
const { input: _i, output: _o, error: _e, ...runIdentity } = run;
|
|
834
|
+
const attributes = {
|
|
835
|
+
resource: "run",
|
|
836
|
+
data: {
|
|
837
|
+
...runIdentity,
|
|
838
|
+
createdAt: spanStartTime,
|
|
839
|
+
startedAt: activeStartTime,
|
|
840
|
+
completedAt,
|
|
841
|
+
...wasCancelled ? { cancelReason } : {}
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
const events = convertEventsToSpanEvents(runEvents, false, {
|
|
845
|
+
preferOccurredAt: true
|
|
846
|
+
});
|
|
847
|
+
return {
|
|
848
|
+
spanId: String(run.runId),
|
|
849
|
+
name: String(((_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName) ?? "?"),
|
|
850
|
+
kind: 1,
|
|
851
|
+
// INTERNAL span kind
|
|
852
|
+
resource: "run",
|
|
853
|
+
library: WORKFLOW_LIBRARY,
|
|
854
|
+
status: { code: 0 },
|
|
855
|
+
traceFlags: 1,
|
|
856
|
+
attributes,
|
|
857
|
+
links: [],
|
|
858
|
+
events,
|
|
859
|
+
startTime: dateToOtelTime(spanStartTime),
|
|
860
|
+
endTime: dateToOtelTime(endTime),
|
|
861
|
+
duration: calculateDuration(spanStartTime, endTime),
|
|
862
|
+
// Only set activeStartTime if it differs from startTime (i.e., there was a queued period)
|
|
863
|
+
activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
const isRunLevelEvent = (event) => !event.correlationId || !isWaitEventType(event.eventType) && !isHookLifecycleEventType(event.eventType) && !isStepEventType(event.eventType);
|
|
867
|
+
function filterSpanRawEvents(events, resource, spanId) {
|
|
868
|
+
if (resource === "run") {
|
|
869
|
+
return events.filter(isRunLevelEvent);
|
|
870
|
+
}
|
|
871
|
+
if (!spanId)
|
|
872
|
+
return [];
|
|
873
|
+
return events.filter((e) => e.correlationId === spanId);
|
|
874
|
+
}
|
|
875
|
+
function getEventSpanId(event) {
|
|
876
|
+
const { correlationId } = event;
|
|
877
|
+
return correlationId && !isRunLevelEvent(event) ? correlationId : event.runId;
|
|
878
|
+
}
|
|
879
|
+
function pushEvent(map, correlationId, event) {
|
|
880
|
+
const existing = map.get(correlationId);
|
|
881
|
+
if (existing) {
|
|
882
|
+
existing.push(event);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
map.set(correlationId, [event]);
|
|
886
|
+
}
|
|
887
|
+
function groupEventsByCorrelation(events) {
|
|
888
|
+
const eventsByStepId = /* @__PURE__ */ new Map();
|
|
889
|
+
const runLevelEvents = [];
|
|
890
|
+
const timerEvents = /* @__PURE__ */ new Map();
|
|
891
|
+
const hookEvents = /* @__PURE__ */ new Map();
|
|
892
|
+
for (const event of events) {
|
|
893
|
+
const correlationId = event.correlationId;
|
|
894
|
+
if (!correlationId) {
|
|
895
|
+
runLevelEvents.push(event);
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
if (isWaitEventType(event.eventType)) {
|
|
899
|
+
pushEvent(timerEvents, correlationId, event);
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (isHookLifecycleEventType(event.eventType)) {
|
|
903
|
+
pushEvent(hookEvents, correlationId, event);
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
if (isStepEventType(event.eventType)) {
|
|
907
|
+
pushEvent(eventsByStepId, correlationId, event);
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
runLevelEvents.push(event);
|
|
911
|
+
}
|
|
912
|
+
return { eventsByStepId, runLevelEvents, timerEvents, hookEvents };
|
|
913
|
+
}
|
|
914
|
+
function computeLatestKnownTime(events, run) {
|
|
915
|
+
let latest = new Date(run.createdAt).getTime();
|
|
916
|
+
for (const event of events) {
|
|
917
|
+
const t = (getEventTimestamp(event) ?? new Date(event.createdAt)).getTime();
|
|
918
|
+
if (t > latest)
|
|
919
|
+
latest = t;
|
|
920
|
+
}
|
|
921
|
+
return new Date(latest);
|
|
922
|
+
}
|
|
923
|
+
function buildSpans(run, groupedEvents, now, latestKnownTime, startHook, getStepAttributes) {
|
|
924
|
+
const childMaxEnd = latestKnownTime;
|
|
925
|
+
const runMaxEnd = run.completedAt ?? now;
|
|
926
|
+
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events) => stepToSpan(events, childMaxEnd, getStepAttributes)).filter((span) => span !== null);
|
|
927
|
+
const hookEventGroups = new Map(groupedEvents.hookEvents);
|
|
928
|
+
if (startHook && !hookEventGroups.has(startHook.hookId)) {
|
|
929
|
+
hookEventGroups.set(startHook.hookId, []);
|
|
930
|
+
}
|
|
931
|
+
const hookSpans = Array.from(hookEventGroups).map(([hookId, events]) => hookToSpan(events, childMaxEnd, hookId === (startHook == null ? void 0 : startHook.hookId) ? startHook : void 0)).filter((span) => span !== null);
|
|
932
|
+
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events) => waitToSpan(events, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
|
|
933
|
+
return {
|
|
934
|
+
runSpan: runToSpan(run, groupedEvents.runLevelEvents, now),
|
|
935
|
+
spans: [...stepSpans, ...hookSpans, ...waitSpans]
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function cascadeSpans(runSpan, spans) {
|
|
939
|
+
const sortedSpans = [
|
|
940
|
+
runSpan,
|
|
941
|
+
...spans.slice().sort((a, b) => {
|
|
942
|
+
const aStart = otelTimeToMs(a.startTime);
|
|
943
|
+
const bStart = otelTimeToMs(b.startTime);
|
|
944
|
+
return aStart - bStart;
|
|
945
|
+
})
|
|
946
|
+
];
|
|
947
|
+
return sortedSpans.map((span, index) => {
|
|
948
|
+
const parentSpanId = index === 0 ? void 0 : String(sortedSpans[index - 1].spanId);
|
|
949
|
+
return {
|
|
950
|
+
...span,
|
|
951
|
+
parentSpanId
|
|
952
|
+
};
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function buildTrace(run, events, now, { isCompleteHistory = false, getStepAttributes } = {}) {
|
|
956
|
+
const duplicateEventIds = findDuplicateEventIds(events, {
|
|
957
|
+
isCompleteHistory
|
|
958
|
+
});
|
|
959
|
+
const actedOnEvents = events.filter((event) => !duplicateEventIds.has(event.eventId) && !isSealedNoopEvent(event));
|
|
960
|
+
const groupedEvents = groupEventsByCorrelation(actedOnEvents);
|
|
961
|
+
const latestKnownTime = computeLatestKnownTime(actedOnEvents, run);
|
|
962
|
+
const { runSpan, spans } = buildSpans(run, groupedEvents, now, latestKnownTime, findStartHookCreation(actedOnEvents, run), getStepAttributes);
|
|
963
|
+
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
964
|
+
const traceStartMs = otelTimeToMs(runSpan.startTime);
|
|
965
|
+
const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
|
|
966
|
+
return {
|
|
967
|
+
traceId: run.runId,
|
|
968
|
+
rootSpanId: run.runId,
|
|
969
|
+
spans: sortedCascadingSpans,
|
|
970
|
+
resources: [
|
|
971
|
+
{
|
|
972
|
+
name: "workflow",
|
|
973
|
+
attributes: {
|
|
974
|
+
"service.name": WORKFLOW_LIBRARY.name
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
],
|
|
978
|
+
knownDurationMs: Math.max(0, knownDurationMs),
|
|
979
|
+
duplicateEventIds
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
const ELLIPSIS = "…";
|
|
983
|
+
const MIN_START = 3;
|
|
984
|
+
const MIN_END = 3;
|
|
985
|
+
const MIN_KEPT = MIN_START + MIN_END;
|
|
986
|
+
const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
987
|
+
function toGraphemes(text) {
|
|
988
|
+
if (graphemeSegmenter) {
|
|
989
|
+
return [...graphemeSegmenter.segment(text)].map((s) => s.segment);
|
|
990
|
+
}
|
|
991
|
+
return Array.from(text);
|
|
992
|
+
}
|
|
993
|
+
function buildCandidate(graphemes, kept) {
|
|
994
|
+
if (kept <= 0) {
|
|
995
|
+
return {
|
|
996
|
+
prefixText: "",
|
|
997
|
+
prefixGraphemeCount: 0,
|
|
998
|
+
suffixText: "",
|
|
999
|
+
suffixGraphemeCount: 0,
|
|
1000
|
+
text: ELLIPSIS,
|
|
1001
|
+
truncated: true
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
const suffixGraphemeCount = kept >= MIN_KEPT ? Math.max(MIN_END, Math.floor(kept / 2)) : Math.floor(kept / 2);
|
|
1005
|
+
const prefixGraphemeCount = kept - suffixGraphemeCount;
|
|
1006
|
+
const prefixText = graphemes.slice(0, prefixGraphemeCount).join("");
|
|
1007
|
+
const suffixText = suffixGraphemeCount > 0 ? graphemes.slice(-suffixGraphemeCount).join("") : "";
|
|
1008
|
+
return {
|
|
1009
|
+
prefixText,
|
|
1010
|
+
prefixGraphemeCount,
|
|
1011
|
+
suffixText,
|
|
1012
|
+
suffixGraphemeCount,
|
|
1013
|
+
text: prefixText + ELLIPSIS + suffixText,
|
|
1014
|
+
truncated: true
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
function middleTruncate(graphemes, availableWidth, measure, fullWidth) {
|
|
1018
|
+
const fullText = graphemes.join("");
|
|
1019
|
+
const resolvedFullWidth = fullWidth ?? measure(fullText);
|
|
1020
|
+
if (availableWidth <= 0 || graphemes.length === 0) {
|
|
1021
|
+
return {
|
|
1022
|
+
prefixText: fullText,
|
|
1023
|
+
prefixGraphemeCount: graphemes.length,
|
|
1024
|
+
suffixText: "",
|
|
1025
|
+
suffixGraphemeCount: 0,
|
|
1026
|
+
text: fullText,
|
|
1027
|
+
truncated: false
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
if (resolvedFullWidth <= availableWidth) {
|
|
1031
|
+
return {
|
|
1032
|
+
prefixText: fullText,
|
|
1033
|
+
prefixGraphemeCount: graphemes.length,
|
|
1034
|
+
suffixText: "",
|
|
1035
|
+
suffixGraphemeCount: 0,
|
|
1036
|
+
text: fullText,
|
|
1037
|
+
truncated: false
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
let lo = 0;
|
|
1041
|
+
let hi = graphemes.length - 1;
|
|
1042
|
+
let best = -1;
|
|
1043
|
+
while (lo <= hi) {
|
|
1044
|
+
const mid = lo + hi >>> 1;
|
|
1045
|
+
const candidate = buildCandidate(graphemes, mid);
|
|
1046
|
+
if (measure(candidate.text) <= availableWidth) {
|
|
1047
|
+
best = mid;
|
|
1048
|
+
lo = mid + 1;
|
|
1049
|
+
} else {
|
|
1050
|
+
hi = mid - 1;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
if (best === -1) {
|
|
1054
|
+
return {
|
|
1055
|
+
prefixText: "",
|
|
1056
|
+
prefixGraphemeCount: 0,
|
|
1057
|
+
suffixText: "",
|
|
1058
|
+
suffixGraphemeCount: 0,
|
|
1059
|
+
text: "",
|
|
1060
|
+
truncated: true
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
return buildCandidate(graphemes, best);
|
|
1064
|
+
}
|
|
1065
|
+
function getMiddleTruncateCopyText({ prefixText, selectionEnd, selectionStart, suffixText, value }) {
|
|
1066
|
+
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
1067
|
+
if (selectionStart < 0 || selectionEnd > visibleText.length || selectionStart >= selectionEnd) {
|
|
1068
|
+
return null;
|
|
1069
|
+
}
|
|
1070
|
+
if (selectionStart === 0 && selectionEnd === visibleText.length) {
|
|
1071
|
+
return value;
|
|
1072
|
+
}
|
|
1073
|
+
const ellipsisStart = prefixText.length;
|
|
1074
|
+
const ellipsisEnd = ellipsisStart + ELLIPSIS.length;
|
|
1075
|
+
if (selectionStart > ellipsisStart || selectionEnd < ellipsisEnd) {
|
|
1076
|
+
return null;
|
|
1077
|
+
}
|
|
1078
|
+
const originalGraphemes = toGraphemes(value);
|
|
1079
|
+
const selectedPrefixGraphemeCount = toGraphemes(visibleText.slice(0, selectionStart)).length;
|
|
1080
|
+
const selectedSuffixGraphemeCount = toGraphemes(visibleText.slice(ellipsisEnd, selectionEnd)).length;
|
|
1081
|
+
const suffixStart = originalGraphemes.length - toGraphemes(suffixText).length;
|
|
1082
|
+
return originalGraphemes.slice(selectedPrefixGraphemeCount, suffixStart + selectedSuffixGraphemeCount).join("");
|
|
1083
|
+
}
|
|
1084
|
+
function getMiddleTruncateCopyTextFromSelectionText({ prefixText, selectionText, suffixText, value }) {
|
|
1085
|
+
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
1086
|
+
const trimmedSelectionText = selectionText.trim();
|
|
1087
|
+
if (!trimmedSelectionText) {
|
|
1088
|
+
return null;
|
|
1089
|
+
}
|
|
1090
|
+
const leading = selectionText.slice(0, selectionText.length - selectionText.trimStart().length);
|
|
1091
|
+
const trailing = selectionText.slice(selectionText.trimEnd().length);
|
|
1092
|
+
if (trimmedSelectionText === visibleText) {
|
|
1093
|
+
return leading + value + trailing;
|
|
1094
|
+
}
|
|
1095
|
+
if (!trimmedSelectionText.includes(ELLIPSIS)) {
|
|
1096
|
+
return null;
|
|
1097
|
+
}
|
|
1098
|
+
const selectionStart = visibleText.indexOf(trimmedSelectionText);
|
|
1099
|
+
if (selectionStart === -1) {
|
|
1100
|
+
return null;
|
|
1101
|
+
}
|
|
1102
|
+
const selectionEnd = selectionStart + trimmedSelectionText.length;
|
|
1103
|
+
const mappedText = getMiddleTruncateCopyText({
|
|
1104
|
+
prefixText,
|
|
1105
|
+
selectionEnd,
|
|
1106
|
+
selectionStart,
|
|
1107
|
+
suffixText,
|
|
1108
|
+
value
|
|
1109
|
+
});
|
|
1110
|
+
return mappedText === null ? null : leading + mappedText + trailing;
|
|
320
1111
|
}
|
|
321
1112
|
const pendingMeasurements = /* @__PURE__ */ new Map();
|
|
322
1113
|
let measurementFrame = 0;
|
|
@@ -665,1363 +1456,805 @@ function AttrSetEventBlock({ data }) {
|
|
|
665
1456
|
const writerLabel = describeWriter(data.writer);
|
|
666
1457
|
return jsxRuntimeExports.jsxs("div", { className: "flex flex-col px-3 py-1", children: [jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: data.changes.map((change, index) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: change.key, removed: change.value === null, value: change.value ?? void 0 }, `${change.key}:${index}`)) }), writerLabel && jsxRuntimeExports.jsx("div", { className: "border-gray-alpha-400 border-t py-1.5 text-gray-700 text-label-12", children: writerLabel })] });
|
|
667
1458
|
}
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
return value != null && typeof value === "object" && (typeof value.message === "string" || typeof value.stack === "string");
|
|
679
|
-
}
|
|
680
|
-
function deriveTitle(message) {
|
|
681
|
-
const firstLine = message.split("\n").find((line) => line.trim().length > 0) ?? message;
|
|
682
|
-
return firstLine.trim();
|
|
683
|
-
}
|
|
684
|
-
function ErrorStackBlock({ value }) {
|
|
685
|
-
const stack = typeof value.stack === "string" ? value.stack : void 0;
|
|
686
|
-
const message = typeof value.message === "string" ? value.message : void 0;
|
|
687
|
-
const body = stack ?? message ?? "";
|
|
688
|
-
const title = message ? deriveTitle(message) : deriveTitle(body);
|
|
689
|
-
const copyText = message && stack && !stack.includes(message) ? `${message}
|
|
690
|
-
|
|
691
|
-
${stack}` : body;
|
|
692
|
-
return jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden rounded-md border", style: {
|
|
693
|
-
borderColor: "var(--ds-red-400)",
|
|
694
|
-
background: "var(--ds-red-100)"
|
|
695
|
-
}, children: [jsxRuntimeExports.jsx(CopyButton, { copyText, ariaLabel: "Copy error", className: "absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-md border border-red-400 bg-red-100 p-0 text-red-900 transition-transform transition-colors duration-100 hover:bg-red-200 active:scale-95" }), title && jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-3 py-2.5 pr-10", style: {
|
|
696
|
-
color: "var(--ds-red-900)",
|
|
697
|
-
borderBottom: "1px solid var(--ds-red-400)"
|
|
698
|
-
}, children: [jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4 shrink-0" }), jsxRuntimeExports.jsx("p", {
|
|
699
|
-
className: "text-label-12 font-semibold m-0 truncate",
|
|
700
|
-
// The full message or stack is in the body below; the header
|
|
701
|
-
// shows the first line, single-line, with overflow
|
|
702
|
-
// ellipsised so a long title doesn't push the copy button or
|
|
703
|
-
// wrap into the framed hint/docs lines.
|
|
704
|
-
title: message,
|
|
705
|
-
children: title
|
|
706
|
-
})] }), body && jsxRuntimeExports.jsx("pre", { className: "px-3 py-2.5 text-label-12-mono whitespace-pre-wrap break-words overflow-auto m-0", style: {
|
|
707
|
-
color: "var(--ds-red-900)",
|
|
708
|
-
background: "var(--ds-red-200)"
|
|
709
|
-
}, children: body })] });
|
|
710
|
-
}
|
|
711
|
-
const STYLES$1 = `.wf-load-more{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;border-radius:6px;font-size:13px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-load-more:hover{background:var(--ds-gray-alpha-200)}.wf-load-more:disabled{opacity:.6;cursor:default}.wf-load-more:disabled:hover{background:var(--ds-background-100)}`;
|
|
712
|
-
function LoadMoreButton({ loading = false, onClick, label = "Load more", loadingLabel = "Loading..." }) {
|
|
713
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES$1 } }), jsxRuntimeExports.jsxs("button", { type: "button", onClick, disabled: loading, className: "wf-load-more", children: [loading && jsxRuntimeExports.jsx(Spinner, { size: 14 }), loading ? loadingLabel : label] })] });
|
|
714
|
-
}
|
|
715
|
-
const STYLES = `.wf-menu-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;transition:background 150ms}.wf-menu-btn:hover{background:var(--ds-gray-alpha-200)}.wf-menu-item{appearance:none;-webkit-appearance:none;border:none;display:flex;align-items:center;width:100%;height:40px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--ds-gray-1000);background:transparent;cursor:pointer;transition:background 150ms}.wf-menu-item:hover{background:var(--ds-gray-alpha-100)}`;
|
|
716
|
-
function MenuDropdown({ options, value, onChange }) {
|
|
717
|
-
var _a, _b;
|
|
718
|
-
const [open, setOpen] = reactExports.useState(false);
|
|
719
|
-
const ref = reactExports.useRef(null);
|
|
720
|
-
const label = ((_a = options.find((o) => o.value === value)) == null ? void 0 : _a.label) ?? ((_b = options[0]) == null ? void 0 : _b.label) ?? "";
|
|
721
|
-
reactExports.useEffect(() => {
|
|
722
|
-
if (!open)
|
|
723
|
-
return;
|
|
724
|
-
function handleClickOutside(e) {
|
|
725
|
-
if (ref.current && !ref.current.contains(e.target)) {
|
|
726
|
-
setOpen(false);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
730
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
731
|
-
}, [open]);
|
|
732
|
-
return jsxRuntimeExports.jsxs("div", { ref, className: "relative shrink-0", children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES } }), jsxRuntimeExports.jsxs("button", { type: "button", className: "wf-menu-btn", onClick: () => setOpen(!open), children: [jsxRuntimeExports.jsx("span", { children: label }), jsxRuntimeExports.jsx("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", className: "-mr-1 ml-4 text-gray-900", children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open && jsxRuntimeExports.jsx("div", { className: "absolute top-full right-0 z-[2001] mt-1 min-w-[140px] bg-background-100 p-1 material-menu", role: "menu", children: options.map((option) => jsxRuntimeExports.jsx("button", { type: "button", role: "menuitem", className: cn("wf-menu-item", option.value === value ? "font-medium" : "font-normal"), onClick: () => {
|
|
733
|
-
onChange(option.value);
|
|
734
|
-
setOpen(false);
|
|
735
|
-
}, children: option.label }, option.value)) })] });
|
|
736
|
-
}
|
|
737
|
-
const ERROR_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
738
|
-
"step_failed",
|
|
739
|
-
"step_retrying",
|
|
740
|
-
"run_failed",
|
|
741
|
-
"workflow_failed"
|
|
742
|
-
]);
|
|
743
|
-
const BUTTON_RESET_STYLE = {
|
|
744
|
-
appearance: "none",
|
|
745
|
-
WebkitAppearance: "none",
|
|
746
|
-
border: "none",
|
|
747
|
-
background: "transparent"
|
|
748
|
-
};
|
|
749
|
-
const DOT_PULSE_ANIMATION = "workflow-dot-pulse 1.25s cubic-bezier(0, 0, 0.2, 1) infinite";
|
|
750
|
-
function formatEventTime(date) {
|
|
751
|
-
return date.toLocaleTimeString("en-US", {
|
|
752
|
-
hour: "2-digit",
|
|
753
|
-
minute: "2-digit",
|
|
754
|
-
second: "2-digit",
|
|
755
|
-
hour12: false
|
|
756
|
-
}) + "." + date.getMilliseconds().toString().padStart(3, "0");
|
|
757
|
-
}
|
|
758
|
-
function parseEventDate(value) {
|
|
759
|
-
if (value == null)
|
|
760
|
-
return null;
|
|
761
|
-
const date = value instanceof Date ? value : new Date(String(value));
|
|
762
|
-
return Number.isNaN(date.getTime()) ? null : date;
|
|
763
|
-
}
|
|
764
|
-
function getEffectiveEventDate$1(event) {
|
|
765
|
-
return parseEventDate(event.occurredAt) ?? new Date(event.createdAt);
|
|
766
|
-
}
|
|
767
|
-
function getEffectiveEventTime(event) {
|
|
768
|
-
return getEffectiveEventDate$1(event).getTime();
|
|
769
|
-
}
|
|
770
|
-
function formatEventType(eventType) {
|
|
771
|
-
return eventType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
772
|
-
}
|
|
773
|
-
function getStatusDotColor(eventType) {
|
|
774
|
-
if (eventType === "step_failed" || eventType === "run_failed" || eventType === "workflow_failed") {
|
|
775
|
-
return "var(--geist-error, var(--ds-red-700))";
|
|
776
|
-
}
|
|
777
|
-
if (eventType === "run_cancelled") {
|
|
778
|
-
return "var(--ds-gray-500)";
|
|
779
|
-
}
|
|
780
|
-
if (eventType === "step_retrying") {
|
|
781
|
-
return "var(--geist-warning, var(--ds-amber-700))";
|
|
782
|
-
}
|
|
783
|
-
if (eventType === "attr_set") {
|
|
784
|
-
return "var(--ds-teal-900)";
|
|
785
|
-
}
|
|
786
|
-
if (eventType === "step_completed" || eventType === "run_completed" || eventType === "workflow_completed" || eventType === "hook_disposed" || eventType === "wait_completed") {
|
|
787
|
-
return "var(--geist-cyan, var(--ds-teal-700))";
|
|
788
|
-
}
|
|
789
|
-
if (eventType === "step_started" || eventType === "run_started" || eventType === "workflow_started" || eventType === "hook_received") {
|
|
790
|
-
return "var(--geist-warning, var(--ds-amber-700))";
|
|
791
|
-
}
|
|
792
|
-
if (eventType === "noop") {
|
|
793
|
-
return "var(--ds-gray-500)";
|
|
794
|
-
}
|
|
795
|
-
return "var(--ds-gray-500)";
|
|
796
|
-
}
|
|
797
|
-
function buildNameMaps(events, run) {
|
|
798
|
-
var _a, _b;
|
|
799
|
-
const correlationNameMap = /* @__PURE__ */ new Map();
|
|
800
|
-
if (events) {
|
|
801
|
-
for (const event of events) {
|
|
802
|
-
if ((event.eventType === "step_created" || event.eventType === "step_started") && event.correlationId) {
|
|
803
|
-
const stepName = (_a = event.eventData) == null ? void 0 : _a.stepName;
|
|
804
|
-
if (typeof stepName !== "string")
|
|
805
|
-
continue;
|
|
806
|
-
if (event.eventType === "step_started" && correlationNameMap.has(event.correlationId)) {
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
809
|
-
const parsed = parseStepName(String(stepName)) ?? parseWorkflowName(String(stepName));
|
|
810
|
-
correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
|
|
811
|
-
}
|
|
1459
|
+
const kbdVariants = cva("inline-flex items-center justify-center rounded px-1 text-center font-sans", {
|
|
1460
|
+
variants: {
|
|
1461
|
+
variant: {
|
|
1462
|
+
subtle: "bg-background-100/20",
|
|
1463
|
+
outline: "border border-gray-alpha-400 bg-background-100 font-medium text-gray-900"
|
|
1464
|
+
},
|
|
1465
|
+
size: {
|
|
1466
|
+
default: "h-5 min-w-5 text-label-12 leading-none",
|
|
1467
|
+
compact: "h-4 min-h-4 min-w-4 text-[11px] leading-none",
|
|
1468
|
+
search: "h-5 min-h-5 min-w-5 text-label-13 leading-[1.7em]"
|
|
812
1469
|
}
|
|
1470
|
+
},
|
|
1471
|
+
defaultVariants: {
|
|
1472
|
+
variant: "subtle",
|
|
1473
|
+
size: "default"
|
|
813
1474
|
}
|
|
814
|
-
|
|
815
|
-
|
|
1475
|
+
});
|
|
1476
|
+
function Kbd({ children, className, variant, size, ...props }) {
|
|
1477
|
+
return jsxRuntimeExports.jsx("kbd", { className: cn(kbdVariants({ variant, size, className })), ...props, children });
|
|
816
1478
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
const ts = getEffectiveEventTime(event);
|
|
825
|
-
const key = event.correlationId ?? "__run__";
|
|
826
|
-
const type = event.eventType;
|
|
827
|
-
if (type === "step_created" || type === "run_created") {
|
|
828
|
-
if (!createdTimes.has(key)) {
|
|
829
|
-
createdTimes.set(key, ts);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
if (type === "step_started" || type === "run_started" || type === "workflow_started") {
|
|
833
|
-
startedTimes.set(key, ts);
|
|
834
|
-
if (!firstStartedTimes.has(key)) {
|
|
835
|
-
firstStartedTimes.set(key, ts);
|
|
836
|
-
if (!createdTimes.has(key)) {
|
|
837
|
-
createdTimes.set(key, ts);
|
|
838
|
-
}
|
|
839
|
-
const createdAt = createdTimes.get(key);
|
|
840
|
-
const info = durations.get(key) ?? {};
|
|
841
|
-
if (createdAt !== void 0) {
|
|
842
|
-
info.queued = ts - createdAt;
|
|
843
|
-
}
|
|
844
|
-
durations.set(key, info);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
if (type === "step_completed" || type === "step_failed" || type === "run_completed" || type === "run_failed" || type === "run_cancelled" || type === "workflow_completed" || type === "workflow_failed" || type === "wait_completed" || type === "hook_disposed") {
|
|
848
|
-
const startedAt = startedTimes.get(key);
|
|
849
|
-
const info = durations.get(key) ?? {};
|
|
850
|
-
if (startedAt !== void 0) {
|
|
851
|
-
info.ran = ts - startedAt;
|
|
852
|
-
}
|
|
853
|
-
durations.set(key, info);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
return durations;
|
|
1479
|
+
const PANEL_MIN_WIDTH = 280;
|
|
1480
|
+
const PANEL_HARD_MAX_WIDTH = 1300;
|
|
1481
|
+
const PANEL_DEFAULT_WIDTH = 360;
|
|
1482
|
+
const MAIN_MIN_WIDTH = 400;
|
|
1483
|
+
const PANEL_WIDTH_STORAGE_KEY = "workflow-trace-detail-panel-width";
|
|
1484
|
+
function clamp(value, min, max) {
|
|
1485
|
+
return Math.min(Math.max(value, min), max);
|
|
857
1486
|
}
|
|
858
|
-
function
|
|
859
|
-
if (
|
|
860
|
-
return
|
|
861
|
-
|
|
862
|
-
if (isEncryptedMarker(val))
|
|
863
|
-
return true;
|
|
864
|
-
}
|
|
865
|
-
return false;
|
|
1487
|
+
function computeMaxPanelWidth(availableWidth) {
|
|
1488
|
+
if (availableWidth <= 0)
|
|
1489
|
+
return PANEL_HARD_MAX_WIDTH;
|
|
1490
|
+
return Math.min(Math.max(availableWidth - MAIN_MIN_WIDTH, 0), PANEL_HARD_MAX_WIDTH);
|
|
866
1491
|
}
|
|
867
|
-
function
|
|
868
|
-
return
|
|
869
|
-
// child entity ID, so they group and label with the run itself.
|
|
870
|
-
eventType === "attr_set" || eventType === "noop";
|
|
871
|
-
}
|
|
872
|
-
const GUTTER_WIDTH = 36;
|
|
873
|
-
const LANE_X = 20;
|
|
874
|
-
const ROOT_LINE_COLOR = "var(--ds-gray-500)";
|
|
875
|
-
function TreeGutter({ isFirst, isLast, isRunLevel: isRun, statusDotColor, pulse = false, hasSelection, showBranch, showLaneLine, isLaneStart, isLaneEnd, continuationOnly = false }) {
|
|
876
|
-
const dotSize = isRun ? 8 : 6;
|
|
877
|
-
const dotLeft = isRun ? 5 : 6;
|
|
878
|
-
const dotOpacity = hasSelection && !showBranch && !isRun ? 0.3 : 1;
|
|
879
|
-
return jsxRuntimeExports.jsxs("div", { className: "relative flex-shrink-0 self-stretch", style: {
|
|
880
|
-
width: GUTTER_WIDTH,
|
|
881
|
-
minHeight: continuationOnly ? 0 : void 0
|
|
882
|
-
}, children: [jsxRuntimeExports.jsx("div", { style: {
|
|
883
|
-
position: "absolute",
|
|
884
|
-
left: 8,
|
|
885
|
-
top: continuationOnly ? 0 : isFirst ? "50%" : 0,
|
|
886
|
-
bottom: continuationOnly ? 0 : isLast ? "50%" : 0,
|
|
887
|
-
width: 2,
|
|
888
|
-
backgroundColor: ROOT_LINE_COLOR,
|
|
889
|
-
zIndex: 0
|
|
890
|
-
} }), !continuationOnly && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { style: {
|
|
891
|
-
position: "absolute",
|
|
892
|
-
left: dotLeft,
|
|
893
|
-
top: "50%",
|
|
894
|
-
transform: "translateY(-50%)",
|
|
895
|
-
width: dotSize,
|
|
896
|
-
height: dotSize,
|
|
897
|
-
zIndex: 2
|
|
898
|
-
}, children: [jsxRuntimeExports.jsx("div", { style: {
|
|
899
|
-
position: "absolute",
|
|
900
|
-
inset: 0,
|
|
901
|
-
borderRadius: "50%",
|
|
902
|
-
backgroundColor: "var(--ds-background-100)",
|
|
903
|
-
zIndex: 0
|
|
904
|
-
} }), pulse && jsxRuntimeExports.jsx("div", { style: {
|
|
905
|
-
position: "absolute",
|
|
906
|
-
inset: 0,
|
|
907
|
-
borderRadius: "50%",
|
|
908
|
-
backgroundColor: statusDotColor,
|
|
909
|
-
opacity: 0.75 * dotOpacity,
|
|
910
|
-
animation: DOT_PULSE_ANIMATION,
|
|
911
|
-
zIndex: 1
|
|
912
|
-
} }), jsxRuntimeExports.jsx("div", { style: {
|
|
913
|
-
position: "relative",
|
|
914
|
-
width: "100%",
|
|
915
|
-
height: "100%",
|
|
916
|
-
borderRadius: "50%",
|
|
917
|
-
backgroundColor: statusDotColor,
|
|
918
|
-
opacity: dotOpacity,
|
|
919
|
-
transition: "opacity 150ms",
|
|
920
|
-
zIndex: 2
|
|
921
|
-
} })] }), showBranch && jsxRuntimeExports.jsx("div", { style: {
|
|
922
|
-
position: "absolute",
|
|
923
|
-
left: 9,
|
|
924
|
-
top: "50%",
|
|
925
|
-
width: GUTTER_WIDTH - 9,
|
|
926
|
-
height: 2,
|
|
927
|
-
backgroundColor: ROOT_LINE_COLOR,
|
|
928
|
-
zIndex: 0
|
|
929
|
-
} })] }), showLaneLine && jsxRuntimeExports.jsx("div", { style: {
|
|
930
|
-
position: "absolute",
|
|
931
|
-
left: LANE_X,
|
|
932
|
-
top: continuationOnly ? 0 : isLaneStart ? "50%" : 0,
|
|
933
|
-
bottom: continuationOnly ? 0 : isLaneEnd ? "50%" : 0,
|
|
934
|
-
width: 2,
|
|
935
|
-
backgroundColor: ROOT_LINE_COLOR,
|
|
936
|
-
zIndex: 0
|
|
937
|
-
} })] });
|
|
938
|
-
}
|
|
939
|
-
function CopyableCell({ value, className, style: styleProp }) {
|
|
940
|
-
const [copied, setCopied] = reactExports.useState(false);
|
|
941
|
-
const resetCopiedTimeoutRef = reactExports.useRef(null);
|
|
942
|
-
reactExports.useEffect(() => {
|
|
943
|
-
return () => {
|
|
944
|
-
if (resetCopiedTimeoutRef.current !== null) {
|
|
945
|
-
window.clearTimeout(resetCopiedTimeoutRef.current);
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
}, []);
|
|
949
|
-
const handleCopy = reactExports.useCallback((e) => {
|
|
950
|
-
e.stopPropagation();
|
|
951
|
-
navigator.clipboard.writeText(value).then(() => {
|
|
952
|
-
setCopied(true);
|
|
953
|
-
if (resetCopiedTimeoutRef.current !== null) {
|
|
954
|
-
window.clearTimeout(resetCopiedTimeoutRef.current);
|
|
955
|
-
}
|
|
956
|
-
resetCopiedTimeoutRef.current = window.setTimeout(() => {
|
|
957
|
-
setCopied(false);
|
|
958
|
-
resetCopiedTimeoutRef.current = null;
|
|
959
|
-
}, 1500);
|
|
960
|
-
});
|
|
961
|
-
}, [value]);
|
|
962
|
-
return jsxRuntimeExports.jsxs("div", { className: `group/copy flex items-center gap-1 min-w-0 px-4 ${className ?? ""}`, style: styleProp, children: [jsxRuntimeExports.jsx("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: value || "-" }), value ? jsxRuntimeExports.jsx("button", { type: "button", onClick: handleCopy, className: "flex-shrink-0 opacity-0 group-hover/copy:opacity-100 transition-opacity p-0.5 rounded hover:bg-[var(--ds-gray-alpha-200)]", style: BUTTON_RESET_STYLE, "aria-label": `Copy ${value}`, children: copied ? jsxRuntimeExports.jsx(Check, { className: "h-3 w-3", style: { color: "var(--ds-green-700)" } }) : jsxRuntimeExports.jsx(Copy, { className: "h-3 w-3", style: { color: "var(--ds-gray-700)" } }) }) : null] });
|
|
1492
|
+
function clampPanelWidth(width, availableWidth) {
|
|
1493
|
+
return clamp(width, PANEL_MIN_WIDTH, computeMaxPanelWidth(availableWidth));
|
|
963
1494
|
}
|
|
964
|
-
function
|
|
965
|
-
if (typeof
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
return
|
|
975
|
-
}
|
|
976
|
-
if (Array.isArray(value)) {
|
|
977
|
-
return value.map(deepParseJson);
|
|
978
|
-
}
|
|
979
|
-
if (value !== null && typeof value === "object") {
|
|
980
|
-
if (value.constructor !== Object) {
|
|
981
|
-
return value;
|
|
982
|
-
}
|
|
983
|
-
const result = {};
|
|
984
|
-
for (const [k, v] of Object.entries(value)) {
|
|
985
|
-
result[k] = deepParseJson(v);
|
|
986
|
-
}
|
|
987
|
-
return result;
|
|
1495
|
+
function readStoredPanelWidth() {
|
|
1496
|
+
if (typeof window === "undefined")
|
|
1497
|
+
return PANEL_DEFAULT_WIDTH;
|
|
1498
|
+
try {
|
|
1499
|
+
const raw = window.localStorage.getItem(PANEL_WIDTH_STORAGE_KEY);
|
|
1500
|
+
const value = raw ? Number(raw) : Number.NaN;
|
|
1501
|
+
if (!Number.isFinite(value))
|
|
1502
|
+
return PANEL_DEFAULT_WIDTH;
|
|
1503
|
+
return clamp(value, PANEL_MIN_WIDTH, PANEL_HARD_MAX_WIDTH);
|
|
1504
|
+
} catch {
|
|
1505
|
+
return PANEL_DEFAULT_WIDTH;
|
|
988
1506
|
}
|
|
989
|
-
return value;
|
|
990
|
-
}
|
|
991
|
-
function extractStructuredError(data, eventType) {
|
|
992
|
-
if (!eventType || !ERROR_EVENT_TYPES.has(eventType))
|
|
993
|
-
return null;
|
|
994
|
-
if (data == null || typeof data !== "object")
|
|
995
|
-
return null;
|
|
996
|
-
const record = data;
|
|
997
|
-
if (isStructuredError(record.error))
|
|
998
|
-
return record.error;
|
|
999
|
-
if (isStructuredError(record))
|
|
1000
|
-
return record;
|
|
1001
|
-
return null;
|
|
1002
1507
|
}
|
|
1003
|
-
function
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
return () => {
|
|
1010
|
-
if (resetCopiedTimeoutRef.current !== null) {
|
|
1011
|
-
window.clearTimeout(resetCopiedTimeoutRef.current);
|
|
1012
|
-
}
|
|
1013
|
-
};
|
|
1014
|
-
}, []);
|
|
1015
|
-
const formatted = reactExports.useMemo(() => {
|
|
1016
|
-
try {
|
|
1017
|
-
return JSON.stringify(cleaned, null, 2);
|
|
1018
|
-
} catch {
|
|
1019
|
-
return String(cleaned);
|
|
1020
|
-
}
|
|
1021
|
-
}, [cleaned]);
|
|
1022
|
-
const handleCopy = reactExports.useCallback((e) => {
|
|
1023
|
-
e.stopPropagation();
|
|
1024
|
-
navigator.clipboard.writeText(formatted).then(() => {
|
|
1025
|
-
setCopied(true);
|
|
1026
|
-
if (resetCopiedTimeoutRef.current !== null) {
|
|
1027
|
-
window.clearTimeout(resetCopiedTimeoutRef.current);
|
|
1028
|
-
}
|
|
1029
|
-
resetCopiedTimeoutRef.current = window.setTimeout(() => {
|
|
1030
|
-
setCopied(false);
|
|
1031
|
-
resetCopiedTimeoutRef.current = null;
|
|
1032
|
-
}, 1500);
|
|
1033
|
-
});
|
|
1034
|
-
}, [formatted]);
|
|
1035
|
-
if (structuredError) {
|
|
1036
|
-
return jsxRuntimeExports.jsx("div", { className: "p-2", children: jsxRuntimeExports.jsx(ErrorStackBlock, { value: structuredError }) });
|
|
1037
|
-
}
|
|
1038
|
-
if (eventType === "attr_set") {
|
|
1039
|
-
return jsxRuntimeExports.jsx(AttrSetEventBlock, { data: cleaned });
|
|
1040
|
-
}
|
|
1041
|
-
if (eventType === "run_cancelled") {
|
|
1042
|
-
const cancelReason = cleaned != null && typeof cleaned === "object" && typeof cleaned.cancelReason === "string" ? cleaned.cancelReason : null;
|
|
1043
|
-
if (cancelReason) {
|
|
1044
|
-
return jsxRuntimeExports.jsxs("div", { className: "p-2 text-label-12", style: { color: "var(--ds-gray-1000)" }, children: [jsxRuntimeExports.jsx("span", { style: { color: "var(--ds-gray-900)" }, children: "Reason: " }), jsxRuntimeExports.jsx("span", { className: "whitespace-pre-wrap break-words", children: cancelReason })] });
|
|
1045
|
-
}
|
|
1508
|
+
function writeStoredPanelWidth(width) {
|
|
1509
|
+
if (typeof window === "undefined")
|
|
1510
|
+
return;
|
|
1511
|
+
try {
|
|
1512
|
+
window.localStorage.setItem(PANEL_WIDTH_STORAGE_KEY, String(Math.round(width)));
|
|
1513
|
+
} catch {
|
|
1046
1514
|
}
|
|
1047
|
-
return jsxRuntimeExports.jsxs("div", { className: "relative group/payload", children: [jsxRuntimeExports.jsx("div", { className: "overflow-x-auto p-2 text-[11px]", style: { color: "var(--ds-gray-1000)" }, children: jsxRuntimeExports.jsx(DataInspector, { data: cleaned, expandLevel: 2 }) }), jsxRuntimeExports.jsx("button", { type: "button", onClick: handleCopy, className: "absolute bottom-2 right-2 opacity-0 group-hover/payload:opacity-100 transition-opacity flex items-center gap-1 px-2 py-1 rounded-md text-button-12 hover:bg-[var(--ds-gray-alpha-200)]", style: { ...BUTTON_RESET_STYLE, color: "var(--ds-gray-700)" }, "aria-label": "Copy payload", children: copied ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Check, { className: "h-3 w-3", style: { color: "var(--ds-green-700)" } }), jsxRuntimeExports.jsx("span", { style: { color: "var(--ds-green-700)" }, children: "Copied" })] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Copy, { className: "h-3 w-3" }), jsxRuntimeExports.jsx("span", { children: "Copy" })] }) })] });
|
|
1048
1515
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
bottom: 0,
|
|
1059
|
-
width: 2
|
|
1060
|
-
}, children: jsxRuntimeExports.jsx(Skeleton, { className: "w-full h-full", style: { borderRadius: 1 } }) }), jsxRuntimeExports.jsx(Skeleton, { className: "flex-shrink-0", style: {
|
|
1061
|
-
width: i % 4 === 0 ? 8 : 6,
|
|
1062
|
-
height: i % 4 === 0 ? 8 : 6,
|
|
1063
|
-
borderRadius: "50%",
|
|
1064
|
-
marginLeft: i % 4 === 0 ? 5 : 6
|
|
1065
|
-
} })] }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0 flex items-center justify-center", children: jsxRuntimeExports.jsx(Skeleton, { className: "w-5 h-5", style: { borderRadius: 4 } }) }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "70%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "70%" } }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 px-4 flex items-center gap-1.5", style: { flex: "2 1 0%" }, children: [jsxRuntimeExports.jsx(Skeleton, { className: "flex-shrink-0", style: { width: 6, height: 6, borderRadius: "50%" } }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "60%" } })] }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "50%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "75%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "75%" } }) })] }, i)) });
|
|
1066
|
-
}
|
|
1067
|
-
function EventRow$1({ event, index, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey, onEncryptedDataDetected, suppressGroupDimming = false, showSeparateEventOccurrenceTimestamps = false, isDuplicate = false }) {
|
|
1068
|
-
const [isLoading, setIsLoading] = reactExports.useState(false);
|
|
1069
|
-
const [loadedEventData, setLoadedEventData] = reactExports.useState(cachedEventData);
|
|
1070
|
-
const [loadError, setLoadError] = reactExports.useState(null);
|
|
1071
|
-
const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(cachedEventData !== null);
|
|
1516
|
+
function DraggableBorder({ element, position, onWidthChange, onReset, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow }) {
|
|
1517
|
+
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
1518
|
+
const pointerIdRef = reactExports.useRef(null);
|
|
1519
|
+
const startXRef = reactExports.useRef(0);
|
|
1520
|
+
const startWidthRef = reactExports.useRef(0);
|
|
1521
|
+
const pendingWidthRef = reactExports.useRef(0);
|
|
1522
|
+
const rafRef = reactExports.useRef(null);
|
|
1523
|
+
const movedRef = reactExports.useRef(false);
|
|
1524
|
+
const lastDragEndAtRef = reactExports.useRef(0);
|
|
1072
1525
|
reactExports.useEffect(() => {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1526
|
+
return () => {
|
|
1527
|
+
if (rafRef.current)
|
|
1528
|
+
cancelAnimationFrame(rafRef.current);
|
|
1529
|
+
};
|
|
1076
1530
|
}, []);
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
const rowNotice = isDuplicate ? DUPLICATE_EVENT_MESSAGE : isSealed ? SEALED_EVENT_MESSAGE : void 0;
|
|
1080
|
-
const statusDotColor = getStatusDotColor(event.eventType);
|
|
1081
|
-
const createdAt = new Date(event.createdAt);
|
|
1082
|
-
const occurredAt = parseEventDate(event.occurredAt);
|
|
1083
|
-
const displayedCreatedAt = showSeparateEventOccurrenceTimestamps ? createdAt : getEffectiveEventDate$1(event);
|
|
1084
|
-
const hasExistingEventData = "eventData" in event && event.eventData != null && (!onLoadEventData || getEventDataRefFields(event.eventType).length === 0);
|
|
1085
|
-
const isRun = isRunLevel(event.eventType);
|
|
1086
|
-
const eventName = isRun ? workflowName ?? "-" : event.correlationId ? correlationNameMap.get(event.correlationId) ?? "-" : "-";
|
|
1087
|
-
const durationKey = event.correlationId ?? (isRun ? "__run__" : "");
|
|
1088
|
-
const durationInfo = durationKey ? durationMap.get(durationKey) : void 0;
|
|
1089
|
-
const hasActive = activeGroupKey !== void 0;
|
|
1090
|
-
const isRelated = rowGroupKey !== void 0 && rowGroupKey === activeGroupKey;
|
|
1091
|
-
const isDimmed = hasActive && !isRelated && !suppressGroupDimming;
|
|
1092
|
-
const isPulsing = hasActive && isRelated;
|
|
1093
|
-
const showBranch = hasActive && isRelated && !isRun;
|
|
1094
|
-
const showLaneLine = selectedGroupRange !== null && index >= selectedGroupRange.first && index <= selectedGroupRange.last;
|
|
1095
|
-
const isLaneStart = selectedGroupRange !== null && index === selectedGroupRange.first;
|
|
1096
|
-
const isLaneEnd = selectedGroupRange !== null && index === selectedGroupRange.last;
|
|
1097
|
-
const loadEventDetails = reactExports.useCallback(async () => {
|
|
1098
|
-
if (loadedEventData !== null) {
|
|
1531
|
+
reactExports.useEffect(() => {
|
|
1532
|
+
if (!isDragging)
|
|
1099
1533
|
return;
|
|
1534
|
+
const previous = document.body.style.userSelect;
|
|
1535
|
+
document.body.style.userSelect = "none";
|
|
1536
|
+
return () => {
|
|
1537
|
+
document.body.style.userSelect = previous;
|
|
1538
|
+
};
|
|
1539
|
+
}, [isDragging]);
|
|
1540
|
+
const stopDrag = () => {
|
|
1541
|
+
pointerIdRef.current = null;
|
|
1542
|
+
setIsDragging(false);
|
|
1543
|
+
if (rafRef.current) {
|
|
1544
|
+
cancelAnimationFrame(rafRef.current);
|
|
1545
|
+
rafRef.current = null;
|
|
1546
|
+
if (movedRef.current)
|
|
1547
|
+
onWidthChange(pendingWidthRef.current);
|
|
1100
1548
|
}
|
|
1101
|
-
if (
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
return;
|
|
1549
|
+
if (movedRef.current) {
|
|
1550
|
+
movedRef.current = false;
|
|
1551
|
+
lastDragEndAtRef.current = performance.now();
|
|
1105
1552
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1553
|
+
};
|
|
1554
|
+
const handlePointerDown = (e) => {
|
|
1555
|
+
if (pointerIdRef.current !== null)
|
|
1108
1556
|
return;
|
|
1109
|
-
|
|
1110
|
-
if (
|
|
1557
|
+
const el = element.current;
|
|
1558
|
+
if (!el)
|
|
1111
1559
|
return;
|
|
1112
|
-
|
|
1113
|
-
setIsLoading(true);
|
|
1114
|
-
setLoadError(null);
|
|
1115
|
-
try {
|
|
1116
|
-
if (!onLoadEventData) {
|
|
1117
|
-
setLoadError("Event details unavailable");
|
|
1118
|
-
return;
|
|
1119
|
-
}
|
|
1120
|
-
const data = await onLoadEventData(event);
|
|
1121
|
-
if (data !== null && data !== void 0) {
|
|
1122
|
-
setLoadedEventData(data);
|
|
1123
|
-
onCacheEventData(event.eventId, data);
|
|
1124
|
-
if (!encryptionKey && hasEncryptedValues(data)) {
|
|
1125
|
-
onEncryptedDataDetected == null ? void 0 : onEncryptedDataDetected();
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
} catch (err) {
|
|
1129
|
-
setLoadError(err instanceof Error ? err.message : "Failed to load event details");
|
|
1130
|
-
} finally {
|
|
1131
|
-
setIsLoading(false);
|
|
1132
|
-
setHasAttemptedLoad(true);
|
|
1133
|
-
}
|
|
1134
|
-
}, [
|
|
1135
|
-
event,
|
|
1136
|
-
loadedEventData,
|
|
1137
|
-
isLoading,
|
|
1138
|
-
onLoadEventData,
|
|
1139
|
-
onCacheEventData,
|
|
1140
|
-
encryptionKey,
|
|
1141
|
-
onEncryptedDataDetected,
|
|
1142
|
-
cachedEventData,
|
|
1143
|
-
hasExistingEventData
|
|
1144
|
-
]);
|
|
1145
|
-
reactExports.useEffect(() => {
|
|
1146
|
-
if (!isExpanded || isLoading) {
|
|
1560
|
+
if (e.pointerType === "mouse" && e.button !== 0)
|
|
1147
1561
|
return;
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
onCacheEventData(event.eventId, data);
|
|
1158
|
-
}
|
|
1159
|
-
setHasAttemptedLoad(true);
|
|
1160
|
-
}).catch(() => {
|
|
1161
|
-
setHasAttemptedLoad(true);
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
}, [encryptionKey]);
|
|
1165
|
-
const handleRowClick = reactExports.useCallback(() => {
|
|
1166
|
-
onSelectGroup(rowGroupKey === selectedGroupKey ? void 0 : rowGroupKey);
|
|
1167
|
-
onToggleExpand(event.eventId);
|
|
1168
|
-
if (!isExpanded) {
|
|
1169
|
-
void loadEventDetails();
|
|
1170
|
-
}
|
|
1171
|
-
}, [
|
|
1172
|
-
selectedGroupKey,
|
|
1173
|
-
rowGroupKey,
|
|
1174
|
-
onSelectGroup,
|
|
1175
|
-
onToggleExpand,
|
|
1176
|
-
event.eventId,
|
|
1177
|
-
isExpanded,
|
|
1178
|
-
loadEventDetails
|
|
1179
|
-
]);
|
|
1180
|
-
const mergedEventData = loadedEventData ?? (hasExistingEventData ? event.eventData : null);
|
|
1181
|
-
const displayPayload = isLoading ? loadedEventData : mergedEventData;
|
|
1182
|
-
const contentOpacity = isDimmed ? 0.3 : 1;
|
|
1183
|
-
return jsxRuntimeExports.jsxs("div", { "data-event-id": event.eventId, onMouseEnter: () => onHoverGroup(rowGroupKey), onMouseLeave: () => onHoverGroup(void 0), children: [jsxRuntimeExports.jsxs("div", { role: "button", tabIndex: 0, onClick: handleRowClick, onKeyDown: (e) => {
|
|
1184
|
-
if (e.key === "Enter" || e.key === " ")
|
|
1185
|
-
handleRowClick();
|
|
1186
|
-
}, className: "w-full text-left flex items-center gap-0 text-label-13 hover:bg-[var(--ds-gray-alpha-100)] transition-colors cursor-pointer", style: { minHeight: 40 }, children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst, isLast: isLast && !isExpanded, isRunLevel: isRun, statusDotColor, pulse: isPulsing, hasSelection: hasActive, showBranch, showLaneLine, isLaneStart, isLaneEnd }), jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-1 min-w-0", style: { opacity: contentOpacity, transition: "opacity 150ms" }, children: [jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-5 h-5 flex-shrink-0 rounded", style: {
|
|
1187
|
-
border: "1px solid var(--ds-gray-400)"
|
|
1188
|
-
}, children: jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 transition-transform", style: {
|
|
1189
|
-
color: "var(--ds-gray-900)",
|
|
1190
|
-
transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
1191
|
-
} }) }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: occurredAt ? jsxRuntimeExports.jsx(TimestampTooltip, { date: occurredAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(occurredAt) }) }) : "-" }), jsxRuntimeExports.jsx("div", { className: "tabular-nums min-w-0 px-4", style: { color: "var(--ds-gray-900)", flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(TimestampTooltip, { date: displayedCreatedAt, children: jsxRuntimeExports.jsx("span", { children: formatEventTime(displayedCreatedAt) }) }) }), jsxRuntimeExports.jsx("div", { className: "font-medium min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(EventNoticeTooltip, { notice: rowNotice, children: jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5", style: {
|
|
1192
|
-
color: rowNotice ? "var(--ds-gray-700)" : "var(--ds-gray-900)"
|
|
1193
|
-
}, children: [jsxRuntimeExports.jsxs("span", { style: {
|
|
1194
|
-
position: "relative",
|
|
1195
|
-
display: "inline-flex",
|
|
1196
|
-
width: 6,
|
|
1197
|
-
height: 6,
|
|
1198
|
-
flexShrink: 0
|
|
1199
|
-
}, children: [isPulsing && jsxRuntimeExports.jsx("span", { style: {
|
|
1200
|
-
position: "absolute",
|
|
1201
|
-
inset: 0,
|
|
1202
|
-
borderRadius: "50%",
|
|
1203
|
-
backgroundColor: statusDotColor,
|
|
1204
|
-
opacity: 0.75,
|
|
1205
|
-
animation: DOT_PULSE_ANIMATION
|
|
1206
|
-
} }), jsxRuntimeExports.jsx("span", { style: {
|
|
1207
|
-
position: "relative",
|
|
1208
|
-
width: 6,
|
|
1209
|
-
height: 6,
|
|
1210
|
-
borderRadius: "50%",
|
|
1211
|
-
backgroundColor: statusDotColor
|
|
1212
|
-
} })] }), formatEventType(event.eventType)] }) }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap", style: { flex: "2 1 0%" }, title: eventName !== "-" ? eventName : void 0, children: eventName }), jsxRuntimeExports.jsx(CopyableCell, { value: event.correlationId || "", className: "font-mono", style: { flex: "3 1 0%" } }), jsxRuntimeExports.jsx(CopyableCell, { value: event.eventId, className: "font-mono", style: { flex: "3 1 0%" } })] })] }), isExpanded && jsxRuntimeExports.jsxs("div", { className: "flex", children: [jsxRuntimeExports.jsx(TreeGutter, { isFirst: false, isLast, isRunLevel: isRun, hasSelection: hasActive, showBranch: false, showLaneLine: showLaneLine && !isLaneEnd, isLaneStart: false, isLaneEnd: false, continuationOnly: true }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsxs("div", { className: "flex-1 my-1.5 mr-3 ml-2 py-2 rounded-md border overflow-hidden", style: {
|
|
1213
|
-
borderColor: "var(--ds-gray-alpha-200)",
|
|
1214
|
-
opacity: contentOpacity,
|
|
1215
|
-
transition: "opacity 150ms"
|
|
1216
|
-
}, children: [((durationInfo == null ? void 0 : durationInfo.queued) !== void 0 || (durationInfo == null ? void 0 : durationInfo.ran) !== void 0) && jsxRuntimeExports.jsxs("div", { className: "px-2 pb-1.5 text-label-12 flex gap-3", style: { color: "var(--ds-gray-900)" }, children: [durationInfo.queued !== void 0 && durationInfo.queued > 0 && jsxRuntimeExports.jsxs("span", { children: ["Queued for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.queued) })] }), durationInfo.ran !== void 0 && jsxRuntimeExports.jsxs("span", { children: ["Ran for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.ran) })] })] }), displayPayload != null ? jsxRuntimeExports.jsx(PayloadBlock, { data: displayPayload, eventType: event.eventType }) : loadError ? jsxRuntimeExports.jsx("div", { className: "rounded-md border p-3 text-label-12", style: {
|
|
1217
|
-
borderColor: "var(--ds-red-400)",
|
|
1218
|
-
backgroundColor: "var(--ds-red-100)",
|
|
1219
|
-
color: "var(--ds-red-900)"
|
|
1220
|
-
}, children: loadError }) : isLoading || loadedEventData === null && !hasAttemptedLoad && event.correlationId ? jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-3", children: [jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "75%" } }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "50%" } }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "60%" } })] }) : jsxRuntimeExports.jsx("div", { className: "p-2 text-label-12", style: { color: "var(--ds-gray-900)" }, children: "No data" })] })] })] });
|
|
1221
|
-
}
|
|
1222
|
-
function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey, isLoading = false, sortOrder: sortOrderProp, onSortOrderChange, onDecrypt, isDecrypting = false, isDecryptDisabled = false, decryptDisabledReason, hasEncryptedData: hasEncryptedDataProp = false, onExactIdSearch, showSeparateEventOccurrenceTimestamps = false }) {
|
|
1223
|
-
const toast2 = useToast();
|
|
1224
|
-
const [internalSortOrder, setInternalSortOrder] = reactExports.useState("asc");
|
|
1225
|
-
const effectiveSortOrder = sortOrderProp ?? internalSortOrder;
|
|
1226
|
-
const handleSortOrderChange = reactExports.useCallback((order) => {
|
|
1227
|
-
if (onSortOrderChange) {
|
|
1228
|
-
onSortOrderChange(order);
|
|
1229
|
-
} else {
|
|
1230
|
-
setInternalSortOrder(order);
|
|
1231
|
-
}
|
|
1232
|
-
}, [onSortOrderChange]);
|
|
1233
|
-
const [searchQuery, setSearchQuery] = reactExports.useState("");
|
|
1234
|
-
const [searchResults, setSearchResults] = reactExports.useState(null);
|
|
1235
|
-
const [searchResultsTruncated, setSearchResultsTruncated] = reactExports.useState(false);
|
|
1236
|
-
const [searchError, setSearchError] = reactExports.useState(null);
|
|
1237
|
-
const [searchLoading, setSearchLoading] = reactExports.useState(false);
|
|
1238
|
-
const [searchNotFound, setSearchNotFound] = reactExports.useState(false);
|
|
1239
|
-
const searchRequestRef = reactExports.useRef(0);
|
|
1240
|
-
const virtuosoRef = reactExports.useRef(null);
|
|
1241
|
-
const parsedSearchId = reactExports.useMemo(() => parseExactWorkflowSearchId(searchQuery), [searchQuery]);
|
|
1242
|
-
const isExactSearchActive = searchResults !== null;
|
|
1243
|
-
const sortedEvents = reactExports.useMemo(() => {
|
|
1244
|
-
const sourceEvents = isExactSearchActive ? searchResults : events ?? [];
|
|
1245
|
-
if (sourceEvents.length === 0)
|
|
1246
|
-
return [];
|
|
1247
|
-
const dir = effectiveSortOrder === "desc" ? -1 : 1;
|
|
1248
|
-
return [...sourceEvents].sort((a, b) => dir * (getEffectiveEventTime(a) - getEffectiveEventTime(b)));
|
|
1249
|
-
}, [events, effectiveSortOrder, isExactSearchActive, searchResults]);
|
|
1250
|
-
const duplicateEventIds = reactExports.useMemo(() => findDuplicateEventIds(events ?? [], {
|
|
1251
|
-
isCompleteHistory: !hasMoreEvents && !isExactSearchActive
|
|
1252
|
-
}), [events, hasMoreEvents, isExactSearchActive]);
|
|
1253
|
-
const hasEncryptedInlineData = reactExports.useMemo(() => {
|
|
1254
|
-
const sourceEvents = isExactSearchActive ? searchResults : events;
|
|
1255
|
-
if (!sourceEvents)
|
|
1256
|
-
return false;
|
|
1257
|
-
for (const event of sourceEvents) {
|
|
1258
|
-
const ed = event.eventData;
|
|
1259
|
-
if (hasEncryptedValues(ed))
|
|
1260
|
-
return true;
|
|
1261
|
-
}
|
|
1262
|
-
return false;
|
|
1263
|
-
}, [events, isExactSearchActive, searchResults]);
|
|
1264
|
-
const [foundEncryptedInLazyData, setFoundEncryptedInLazyData] = reactExports.useState(false);
|
|
1265
|
-
const handleEncryptedDataDetected = reactExports.useCallback(() => {
|
|
1266
|
-
setFoundEncryptedInLazyData(true);
|
|
1267
|
-
}, []);
|
|
1268
|
-
const hasEncryptedData = hasEncryptedDataProp || hasEncryptedInlineData || foundEncryptedInLazyData;
|
|
1269
|
-
const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(isExactSearchActive ? searchResults : events ?? null, run ?? null), [events, isExactSearchActive, run, searchResults]);
|
|
1270
|
-
const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents, duplicateEventIds), [sortedEvents, duplicateEventIds]);
|
|
1271
|
-
const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
|
|
1272
|
-
const [hoveredGroupKey, setHoveredGroupKey] = reactExports.useState(void 0);
|
|
1273
|
-
const onSelectGroup = reactExports.useCallback((groupKey) => {
|
|
1274
|
-
setSelectedGroupKey(groupKey);
|
|
1275
|
-
}, []);
|
|
1276
|
-
const onHoverGroup = reactExports.useCallback((groupKey) => {
|
|
1277
|
-
setHoveredGroupKey(groupKey);
|
|
1278
|
-
}, []);
|
|
1279
|
-
const activeGroupKey = selectedGroupKey ?? hoveredGroupKey;
|
|
1280
|
-
const [expandedEventIds, setExpandedEventIds] = reactExports.useState(() => /* @__PURE__ */ new Set());
|
|
1281
|
-
const toggleEventExpanded = reactExports.useCallback((eventId) => {
|
|
1282
|
-
setExpandedEventIds((prev) => {
|
|
1283
|
-
const next = new Set(prev);
|
|
1284
|
-
if (next.has(eventId)) {
|
|
1285
|
-
next.delete(eventId);
|
|
1286
|
-
} else {
|
|
1287
|
-
next.add(eventId);
|
|
1288
|
-
}
|
|
1289
|
-
return next;
|
|
1290
|
-
});
|
|
1291
|
-
}, []);
|
|
1292
|
-
const eventDataCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
1293
|
-
const cacheEventData = reactExports.useCallback((eventId, data) => {
|
|
1294
|
-
eventDataCacheRef.current.set(eventId, data);
|
|
1295
|
-
}, []);
|
|
1296
|
-
const eventGroupKeyMap = reactExports.useMemo(() => {
|
|
1297
|
-
const map = /* @__PURE__ */ new Map();
|
|
1298
|
-
for (const ev of sortedEvents) {
|
|
1299
|
-
const gk = isRunLevel(ev.eventType) ? "__run__" : ev.correlationId ?? "";
|
|
1300
|
-
if (gk)
|
|
1301
|
-
map.set(ev.eventId, gk);
|
|
1302
|
-
}
|
|
1303
|
-
return map;
|
|
1304
|
-
}, [sortedEvents]);
|
|
1305
|
-
reactExports.useEffect(() => {
|
|
1306
|
-
if (selectedGroupKey === void 0)
|
|
1562
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
1563
|
+
pointerIdRef.current = e.pointerId;
|
|
1564
|
+
startXRef.current = e.clientX;
|
|
1565
|
+
startWidthRef.current = el.offsetWidth;
|
|
1566
|
+
movedRef.current = false;
|
|
1567
|
+
setIsDragging(true);
|
|
1568
|
+
};
|
|
1569
|
+
const handlePointerMove = (e) => {
|
|
1570
|
+
if (pointerIdRef.current !== e.pointerId)
|
|
1307
1571
|
return;
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
return prev;
|
|
1311
|
-
let changed = false;
|
|
1312
|
-
const next = /* @__PURE__ */ new Set();
|
|
1313
|
-
for (const eventId of prev) {
|
|
1314
|
-
if (eventGroupKeyMap.get(eventId) === selectedGroupKey) {
|
|
1315
|
-
next.add(eventId);
|
|
1316
|
-
} else {
|
|
1317
|
-
changed = true;
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
return changed ? next : prev;
|
|
1321
|
-
});
|
|
1322
|
-
}, [selectedGroupKey, eventGroupKeyMap]);
|
|
1323
|
-
const selectedGroupRange = reactExports.useMemo(() => {
|
|
1324
|
-
if (!activeGroupKey || activeGroupKey === "__run__")
|
|
1325
|
-
return null;
|
|
1326
|
-
let first = -1;
|
|
1327
|
-
let last = -1;
|
|
1328
|
-
for (let i = 0; i < sortedEvents.length; i++) {
|
|
1329
|
-
if (sortedEvents[i].correlationId === activeGroupKey) {
|
|
1330
|
-
if (first === -1)
|
|
1331
|
-
first = i;
|
|
1332
|
-
last = i;
|
|
1333
|
-
}
|
|
1572
|
+
if (Math.abs(e.clientX - startXRef.current) > 4) {
|
|
1573
|
+
movedRef.current = true;
|
|
1334
1574
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
setSearchResultsTruncated(false);
|
|
1343
|
-
setSearchError(null);
|
|
1344
|
-
setSearchLoading(false);
|
|
1345
|
-
setSearchNotFound(false);
|
|
1346
|
-
setSelectedGroupKey(void 0);
|
|
1347
|
-
return;
|
|
1575
|
+
const delta = position === "left" ? startXRef.current - e.clientX : e.clientX - startXRef.current;
|
|
1576
|
+
pendingWidthRef.current = startWidthRef.current + delta;
|
|
1577
|
+
if (!rafRef.current) {
|
|
1578
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
1579
|
+
rafRef.current = null;
|
|
1580
|
+
onWidthChange(pendingWidthRef.current);
|
|
1581
|
+
});
|
|
1348
1582
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
setSearchLoading(false);
|
|
1353
|
-
setSearchNotFound(false);
|
|
1583
|
+
};
|
|
1584
|
+
const handlePointerEnd = (e) => {
|
|
1585
|
+
if (pointerIdRef.current !== e.pointerId)
|
|
1354
1586
|
return;
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
setSearchError(null);
|
|
1360
|
-
const abortController = new AbortController();
|
|
1361
|
-
const timer = setTimeout(() => {
|
|
1362
|
-
void (async () => {
|
|
1363
|
-
var _a;
|
|
1364
|
-
try {
|
|
1365
|
-
const results = await onExactIdSearch(parsed.id, parsed.kind, abortController.signal);
|
|
1366
|
-
if (abortController.signal.aborted || searchRequestRef.current !== requestId) {
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
if (results.status === "error") {
|
|
1370
|
-
setSearchResults([]);
|
|
1371
|
-
setSearchResultsTruncated(false);
|
|
1372
|
-
setSearchNotFound(false);
|
|
1373
|
-
setSearchError(results.message);
|
|
1374
|
-
setSelectedGroupKey(void 0);
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
if (results.status === "not_found" || results.status === "ok" && results.events.length === 0) {
|
|
1378
|
-
setSearchResults([]);
|
|
1379
|
-
setSearchResultsTruncated(false);
|
|
1380
|
-
setSearchNotFound(true);
|
|
1381
|
-
setSearchError(null);
|
|
1382
|
-
setSelectedGroupKey(void 0);
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
setSearchResults(results.events);
|
|
1386
|
-
setSearchResultsTruncated(Boolean(results.truncated));
|
|
1387
|
-
setSearchNotFound(false);
|
|
1388
|
-
setSearchError(null);
|
|
1389
|
-
setSelectedGroupKey(parsed.kind === "event" ? (() => {
|
|
1390
|
-
const first = results.events[0];
|
|
1391
|
-
if (!first)
|
|
1392
|
-
return void 0;
|
|
1393
|
-
return isRunLevel(first.eventType) ? "__run__" : first.correlationId ?? void 0;
|
|
1394
|
-
})() : parsed.id);
|
|
1395
|
-
(_a = virtuosoRef.current) == null ? void 0 : _a.scrollToIndex({
|
|
1396
|
-
index: 0,
|
|
1397
|
-
align: "start",
|
|
1398
|
-
behavior: "smooth"
|
|
1399
|
-
});
|
|
1400
|
-
} catch {
|
|
1401
|
-
if (abortController.signal.aborted || searchRequestRef.current !== requestId) {
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
setSearchResults([]);
|
|
1405
|
-
setSearchResultsTruncated(false);
|
|
1406
|
-
setSearchNotFound(false);
|
|
1407
|
-
setSearchError("Failed to search events. Try again.");
|
|
1408
|
-
setSelectedGroupKey(void 0);
|
|
1409
|
-
} finally {
|
|
1410
|
-
if (searchRequestRef.current === requestId && !abortController.signal.aborted) {
|
|
1411
|
-
setSearchLoading(false);
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
})();
|
|
1415
|
-
}, 300);
|
|
1416
|
-
return () => {
|
|
1417
|
-
clearTimeout(timer);
|
|
1418
|
-
abortController.abort();
|
|
1419
|
-
};
|
|
1420
|
-
}, [searchQuery, onExactIdSearch]);
|
|
1421
|
-
const handleSearchKeyDown = reactExports.useCallback((event) => {
|
|
1422
|
-
if (event.key !== "Enter") {
|
|
1587
|
+
stopDrag();
|
|
1588
|
+
};
|
|
1589
|
+
const handleLostPointerCapture = (e) => {
|
|
1590
|
+
if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current) {
|
|
1423
1591
|
return;
|
|
1424
1592
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1593
|
+
stopDrag();
|
|
1594
|
+
};
|
|
1595
|
+
const handleDoubleClick = () => {
|
|
1596
|
+
if (movedRef.current || performance.now() - lastDragEndAtRef.current < 500) {
|
|
1427
1597
|
return;
|
|
1428
1598
|
}
|
|
1429
|
-
|
|
1430
|
-
}
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
const isInitialLoad = isLoading && !hasHadEventsRef.current;
|
|
1436
|
-
const isRefetching = isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
|
|
1437
|
-
if (isInitialLoad) {
|
|
1438
|
-
return jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("div", { style: { padding: 6 }, children: jsxRuntimeExports.jsx(Skeleton, { style: { height: 40, borderRadius: 6 } }) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 h-10 border-b flex-shrink-0", style: { borderColor: "var(--ds-gray-alpha-200)" }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: 40 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: 72 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: 44 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: 92 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: 60 } }) })] }), jsxRuntimeExports.jsx(RowsSkeleton, {})] });
|
|
1439
|
-
}
|
|
1440
|
-
return jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: onDecrypt ? {
|
|
1441
|
-
onDecrypt,
|
|
1442
|
-
isDecrypting,
|
|
1443
|
-
isDecryptDisabled,
|
|
1444
|
-
decryptDisabledReason
|
|
1445
|
-
} : void 0, children: jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("style", { children: `@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}` }), jsxRuntimeExports.jsxs("div", { style: {
|
|
1446
|
-
padding: 6,
|
|
1447
|
-
backgroundColor: "var(--ds-background-100)",
|
|
1448
|
-
display: "flex",
|
|
1449
|
-
gap: 6
|
|
1450
|
-
}, children: [jsxRuntimeExports.jsxs("label", { style: {
|
|
1451
|
-
display: "flex",
|
|
1452
|
-
alignItems: "center",
|
|
1453
|
-
justifyContent: "center",
|
|
1454
|
-
borderRadius: 6,
|
|
1455
|
-
boxShadow: "0 0 0 1px var(--ds-gray-alpha-400)",
|
|
1456
|
-
background: "var(--ds-background-100)",
|
|
1457
|
-
height: 40,
|
|
1458
|
-
flex: 1,
|
|
1459
|
-
minWidth: 0
|
|
1460
|
-
}, children: [jsxRuntimeExports.jsx("div", { style: {
|
|
1461
|
-
width: 40,
|
|
1462
|
-
height: 40,
|
|
1463
|
-
display: "flex",
|
|
1464
|
-
alignItems: "center",
|
|
1465
|
-
justifyContent: "center",
|
|
1466
|
-
color: "var(--ds-gray-800)",
|
|
1467
|
-
flexShrink: 0
|
|
1468
|
-
}, children: jsxRuntimeExports.jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [jsxRuntimeExports.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntimeExports.jsx("path", { d: "M11.5 11.5L14 14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }), jsxRuntimeExports.jsx("input", { type: "search", placeholder: "Search by step ID, wait ID, hook ID, or event ID…", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: handleSearchKeyDown, disabled: !onExactIdSearch, title: onExactIdSearch ? void 0 : "Exact ID search is unavailable in this view.", style: {
|
|
1469
|
-
marginLeft: -16,
|
|
1470
|
-
paddingInline: 12,
|
|
1471
|
-
fontFamily: "inherit",
|
|
1472
|
-
fontSize: 14,
|
|
1473
|
-
background: "transparent",
|
|
1474
|
-
border: "none",
|
|
1475
|
-
outline: "none",
|
|
1476
|
-
height: 40,
|
|
1477
|
-
width: "100%",
|
|
1478
|
-
opacity: onExactIdSearch ? 1 : 0.5,
|
|
1479
|
-
cursor: onExactIdSearch ? "text" : "not-allowed"
|
|
1480
|
-
} })] }), jsxRuntimeExports.jsx(MenuDropdown, { options: SORT_OPTIONS, value: effectiveSortOrder, onChange: handleSortOrderChange }), (hasEncryptedData || encryptionKey) && onDecrypt && jsxRuntimeExports.jsx(DecryptButton, { decrypted: !!encryptionKey, loading: isDecrypting, disabled: isDecryptDisabled, disabledReason: decryptDisabledReason, onClick: onDecrypt })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 text-label-13 font-medium h-10 border-b flex-shrink-0", style: {
|
|
1481
|
-
borderColor: "var(--ds-gray-alpha-200)",
|
|
1482
|
-
color: "var(--ds-gray-900)",
|
|
1483
|
-
backgroundColor: "var(--ds-background-100)"
|
|
1484
|
-
}, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), showSeparateEventOccurrenceTimestamps && jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Occurred" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Created" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Event Type" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Name" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Correlation ID" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Event ID" })] }), isRefetching || searchLoading ? jsxRuntimeExports.jsx(RowsSkeleton, { showSeparateEventOccurrenceTimestamps }) : sortedEvents.length === 0 ? jsxRuntimeExports.jsx("div", { className: "flex flex-1 items-center justify-center px-6 text-center text-copy-14", style: { color: "var(--ds-gray-700)" }, children: searchNotFound && searchQuery.trim() ? `No events found for ${searchQuery.trim()}` : searchError ? searchError : parsedSearchId && searchQuery.trim() && !onExactIdSearch ? "Exact ID search is unavailable in this view." : "No events found" }) : jsxRuntimeExports.jsx(es, { ref: virtuosoRef, totalCount: sortedEvents.length, overscan: 20, defaultItemHeight: 40, endReached: () => {
|
|
1485
|
-
if (isExactSearchActive || !hasMoreEvents || isLoadingMoreEvents) {
|
|
1599
|
+
onReset == null ? void 0 : onReset();
|
|
1600
|
+
};
|
|
1601
|
+
const handleKeyDown = (e) => {
|
|
1602
|
+
const el = element.current;
|
|
1603
|
+
if (!el)
|
|
1486
1604
|
return;
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
return jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap break-words text-gray-1000", children: part.text });
|
|
1521
|
-
}
|
|
1522
|
-
if (part.type === "tool-call") {
|
|
1523
|
-
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-purple-300 bg-purple-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "🔧" }), jsxRuntimeExports.jsx("span", { className: "text-purple-900", children: part.toolName })] }), part.input != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 overflow-x-auto rounded bg-gray-100 p-1.5", children: typeof part.input === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.input }) : jsxRuntimeExports.jsx(DataInspector, { data: part.input }) })] });
|
|
1524
|
-
}
|
|
1525
|
-
if (part.type === "tool-result") {
|
|
1526
|
-
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-green-300 bg-green-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "✓" }), jsxRuntimeExports.jsxs("span", { className: "text-green-900", children: [part.toolName, " result"] })] }), part.output != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 max-h-[200px] overflow-x-auto overflow-y-auto rounded bg-gray-100 p-1.5", children: typeof part.output === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.output }) : jsxRuntimeExports.jsx(DataInspector, { data: part.output, expandLevel: 1 }) })] });
|
|
1527
|
-
}
|
|
1528
|
-
return null;
|
|
1529
|
-
}
|
|
1530
|
-
function getRoleClasses(role) {
|
|
1531
|
-
switch (role) {
|
|
1532
|
-
case "user":
|
|
1533
|
-
return {
|
|
1534
|
-
bubble: "border-blue-300 bg-blue-100",
|
|
1535
|
-
label: "border-blue-300 text-blue-700"
|
|
1536
|
-
};
|
|
1537
|
-
case "assistant":
|
|
1538
|
-
return {
|
|
1539
|
-
bubble: "border-gray-300 bg-gray-100",
|
|
1540
|
-
label: "border-gray-300 text-gray-700"
|
|
1541
|
-
};
|
|
1542
|
-
case "system":
|
|
1543
|
-
return {
|
|
1544
|
-
bubble: "border-amber-300 bg-amber-100",
|
|
1545
|
-
label: "border-amber-300 text-amber-700"
|
|
1546
|
-
};
|
|
1547
|
-
case "tool":
|
|
1548
|
-
return {
|
|
1549
|
-
bubble: "border-green-300 bg-green-100",
|
|
1550
|
-
label: "border-green-300 text-green-700"
|
|
1551
|
-
};
|
|
1552
|
-
default:
|
|
1553
|
-
return {
|
|
1554
|
-
bubble: "border-gray-300 bg-gray-100",
|
|
1555
|
-
label: "border-gray-300 text-gray-700"
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
function parseContent(content) {
|
|
1560
|
-
if (typeof content === "string") {
|
|
1561
|
-
return [{ type: "text", text: content }];
|
|
1562
|
-
}
|
|
1563
|
-
if (Array.isArray(content)) {
|
|
1564
|
-
return content.map((part) => {
|
|
1565
|
-
if (typeof part === "string") {
|
|
1566
|
-
return { type: "text", text: part };
|
|
1567
|
-
}
|
|
1568
|
-
if ((part == null ? void 0 : part.type) === "text") {
|
|
1569
|
-
return { type: "text", text: String(part.text ?? "") };
|
|
1570
|
-
}
|
|
1571
|
-
if ((part == null ? void 0 : part.type) === "tool-call") {
|
|
1572
|
-
return {
|
|
1573
|
-
type: "tool-call",
|
|
1574
|
-
toolName: part.toolName,
|
|
1575
|
-
input: part.input
|
|
1576
|
-
};
|
|
1577
|
-
}
|
|
1578
|
-
if ((part == null ? void 0 : part.type) === "tool-result") {
|
|
1579
|
-
return {
|
|
1580
|
-
type: "tool-result",
|
|
1581
|
-
toolName: part.toolName,
|
|
1582
|
-
output: part.output
|
|
1583
|
-
};
|
|
1605
|
+
const step = e.shiftKey ? 64 : 16;
|
|
1606
|
+
const grow = position === "left" ? 1 : -1;
|
|
1607
|
+
let next = null;
|
|
1608
|
+
if (e.key === "ArrowLeft") {
|
|
1609
|
+
next = el.offsetWidth + grow * step;
|
|
1610
|
+
} else if (e.key === "ArrowRight") {
|
|
1611
|
+
next = el.offsetWidth - grow * step;
|
|
1612
|
+
} else if (e.key === "Home" && ariaValueMin !== void 0) {
|
|
1613
|
+
next = ariaValueMin;
|
|
1614
|
+
} else if (e.key === "End" && ariaValueMax !== void 0) {
|
|
1615
|
+
next = ariaValueMax;
|
|
1616
|
+
}
|
|
1617
|
+
if (next === null)
|
|
1618
|
+
return;
|
|
1619
|
+
e.preventDefault();
|
|
1620
|
+
onWidthChange(next);
|
|
1621
|
+
};
|
|
1622
|
+
return jsxRuntimeExports.jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, tabIndex: 0, className: cn("group absolute inset-y-0 z-10 w-[17px] cursor-col-resize touch-none outline-none", position === "left" ? "-left-2" : "-right-2"), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerEnd, onPointerCancel: handlePointerEnd, onLostPointerCapture: handleLostPointerCapture, onDoubleClick: handleDoubleClick, onKeyDown: handleKeyDown, children: jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: cn("pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors delay-75 duration-100", "group-hover:bg-gray-500 group-focus-visible:bg-[var(--ds-focus-color)]", isDragging && "bg-gray-500") }) });
|
|
1623
|
+
}
|
|
1624
|
+
function isAltModifierKey(key) {
|
|
1625
|
+
return key === "Alt" || key === "AltGraph";
|
|
1626
|
+
}
|
|
1627
|
+
function isTypingTarget(target) {
|
|
1628
|
+
return target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
1629
|
+
}
|
|
1630
|
+
function useAltHeld() {
|
|
1631
|
+
const [altHeld, setAltHeld] = reactExports.useState(false);
|
|
1632
|
+
reactExports.useEffect(() => {
|
|
1633
|
+
const onKeyDown = (e) => {
|
|
1634
|
+
if (!isAltModifierKey(e.key))
|
|
1635
|
+
return;
|
|
1636
|
+
if (!isTypingTarget(e.target)) {
|
|
1637
|
+
e.preventDefault();
|
|
1584
1638
|
}
|
|
1585
|
-
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1639
|
+
setAltHeld(true);
|
|
1640
|
+
};
|
|
1641
|
+
const onKeyUp = (e) => {
|
|
1642
|
+
if (isAltModifierKey(e.key))
|
|
1643
|
+
setAltHeld(false);
|
|
1644
|
+
};
|
|
1645
|
+
const onBlur = () => setAltHeld(false);
|
|
1646
|
+
const onPointerMove = (e) => setAltHeld(e.altKey);
|
|
1647
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
1648
|
+
window.addEventListener("keyup", onKeyUp, true);
|
|
1649
|
+
window.addEventListener("blur", onBlur);
|
|
1650
|
+
window.addEventListener("pointermove", onPointerMove, true);
|
|
1651
|
+
return () => {
|
|
1652
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
1653
|
+
window.removeEventListener("keyup", onKeyUp, true);
|
|
1654
|
+
window.removeEventListener("blur", onBlur);
|
|
1655
|
+
window.removeEventListener("pointermove", onPointerMove, true);
|
|
1656
|
+
};
|
|
1657
|
+
}, []);
|
|
1658
|
+
return { altHeld };
|
|
1589
1659
|
}
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1660
|
+
function DetailPanelShell({ id, width, title, itemLabel, actions, onPrev, onNext, onClose, children }) {
|
|
1661
|
+
const asideRef = reactExports.useRef(null);
|
|
1662
|
+
const handlersRef = reactExports.useRef({ onPrev, onNext, onClose });
|
|
1663
|
+
handlersRef.current = { onPrev, onNext, onClose };
|
|
1664
|
+
reactExports.useEffect(() => {
|
|
1665
|
+
const onKeyDown = (e) => {
|
|
1666
|
+
if (e.defaultPrevented || isTypingTarget(e.target))
|
|
1667
|
+
return;
|
|
1668
|
+
const handlers = handlersRef.current;
|
|
1669
|
+
let handler;
|
|
1670
|
+
if (e.key === "k" || e.key === "ArrowUp")
|
|
1671
|
+
handler = handlers.onPrev;
|
|
1672
|
+
else if (e.key === "j" || e.key === "ArrowDown")
|
|
1673
|
+
handler = handlers.onNext;
|
|
1674
|
+
else if (e.key === "Escape")
|
|
1675
|
+
handler = handlers.onClose;
|
|
1676
|
+
if (!handler)
|
|
1677
|
+
return;
|
|
1678
|
+
e.preventDefault();
|
|
1679
|
+
handler();
|
|
1680
|
+
};
|
|
1681
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1682
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1683
|
+
}, []);
|
|
1684
|
+
return jsxRuntimeExports.jsxs("aside", { ref: asideRef, id, className: "relative flex flex-col h-full max-h-full shrink-0 bg-background-100 border-l border-gray-alpha-400", style: { width: width.width }, children: [jsxRuntimeExports.jsx(DraggableBorder, { element: asideRef, position: "left", onWidthChange: width.resize, onReset: () => width.resize(PANEL_DEFAULT_WIDTH), "aria-label": `Resize ${itemLabel} details panel`, "aria-controls": id, "aria-valuemin": PANEL_MIN_WIDTH, "aria-valuemax": width.maxWidth, "aria-valuenow": Math.min(Math.max(Math.round(width.width), PANEL_MIN_WIDTH), width.maxWidth) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 shrink-0 px-4 py-[7.5px]", children: [jsxRuntimeExports.jsx("div", { className: "flex min-w-0 items-center gap-2 text-label-14 font-medium text-gray-1000", children: title }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5 shrink-0", children: [actions, jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate up", "aria-keyshortcuts": "K", onClick: onPrev, disabled: !onPrev, children: jsxRuntimeExports.jsx(ChevronUp, { className: "w-4 h-4" }) }) }), onPrev ? jsxRuntimeExports.jsxs(TooltipContent, { children: ["Navigate up", jsxRuntimeExports.jsx(Kbd, { children: "K" })] }) : null] }), jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate down", "aria-keyshortcuts": "J", onClick: onNext, disabled: !onNext, children: jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4" }) }) }), onNext ? jsxRuntimeExports.jsxs(TooltipContent, { children: ["Navigate down", jsxRuntimeExports.jsx(Kbd, { children: "J" })] }) : null] }), jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "w-px h-4 bg-gray-alpha-400 mx-1" }), jsxRuntimeExports.jsx(IconButton, { "aria-label": `Close ${itemLabel} details`, "aria-keyshortcuts": "Escape", onClick: onClose, children: jsxRuntimeExports.jsx(X, { className: "w-4 h-4" }) })] })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children })] });
|
|
1595
1685
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1600
|
-
if (!date || !(date instanceof Date)) {
|
|
1601
|
-
return [0, 0];
|
|
1602
|
-
}
|
|
1603
|
-
const ms = date.getTime();
|
|
1604
|
-
const seconds = Math.floor(ms / 1e3);
|
|
1605
|
-
const nanoseconds = ms % 1e3 * 1e6;
|
|
1606
|
-
return [seconds, nanoseconds];
|
|
1686
|
+
const STYLES$1 = `.wf-decrypt-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 10px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-decrypt-idle{color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400)}.wf-decrypt-idle:hover{background:var(--ds-gray-alpha-200)}.wf-decrypt-btn:disabled{cursor:not-allowed;opacity:.5}.wf-decrypt-done{color:var(--ds-green-900);background:var(--ds-green-100);box-shadow:0 0 0 1px var(--ds-green-400);cursor:default}`;
|
|
1687
|
+
function DecryptButton({ decrypted = false, loading = false, disabled = false, disabledReason, onClick }) {
|
|
1688
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES$1 } }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: decrypted ? void 0 : onClick, disabled: decrypted || loading || disabled, title: disabled ? disabledReason : void 0, className: `wf-decrypt-btn ${decrypted ? "wf-decrypt-done" : "wf-decrypt-idle"}`, children: [loading ? jsxRuntimeExports.jsx(Spinner, { size: 14 }) : decrypted ? jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })] }) : jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] }), loading ? "Decrypting…" : decrypted ? "Decrypted" : "Decrypt"] })] });
|
|
1607
1689
|
}
|
|
1608
|
-
function
|
|
1609
|
-
|
|
1610
|
-
const nanosecondsToMs = time[1] / 1e6;
|
|
1611
|
-
return secondsToMs + nanosecondsToMs;
|
|
1690
|
+
function isStructuredError(value) {
|
|
1691
|
+
return value != null && typeof value === "object" && (typeof value.message === "string" || typeof value.stack === "string");
|
|
1612
1692
|
}
|
|
1613
|
-
function
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
}
|
|
1617
|
-
if (typeof end === "string") {
|
|
1618
|
-
end = new Date(end);
|
|
1619
|
-
}
|
|
1620
|
-
if (!start || !(start instanceof Date)) {
|
|
1621
|
-
return [0, 0];
|
|
1622
|
-
}
|
|
1623
|
-
const endTime = end && end instanceof Date ? end : /* @__PURE__ */ new Date();
|
|
1624
|
-
const durationMs = endTime.getTime() - start.getTime();
|
|
1625
|
-
const seconds = Math.floor(durationMs / 1e3);
|
|
1626
|
-
const nanoseconds = durationMs % 1e3 * 1e6;
|
|
1627
|
-
return [seconds, nanoseconds];
|
|
1693
|
+
function deriveTitle(message) {
|
|
1694
|
+
const firstLine = message.split("\n").find((line) => line.trim().length > 0) ?? message;
|
|
1695
|
+
return firstLine.trim();
|
|
1628
1696
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
"
|
|
1638
|
-
|
|
1697
|
+
function ErrorStackBlock({ value }) {
|
|
1698
|
+
const stack = typeof value.stack === "string" ? value.stack : void 0;
|
|
1699
|
+
const message = typeof value.message === "string" ? value.message : void 0;
|
|
1700
|
+
const body = stack ?? message ?? "";
|
|
1701
|
+
const title = message ? deriveTitle(message) : deriveTitle(body);
|
|
1702
|
+
const copyText = message && stack && !stack.includes(message) ? `${message}
|
|
1703
|
+
|
|
1704
|
+
${stack}` : body;
|
|
1705
|
+
return jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden rounded-md border", style: {
|
|
1706
|
+
borderColor: "var(--ds-red-400)",
|
|
1707
|
+
background: "var(--ds-red-100)"
|
|
1708
|
+
}, children: [jsxRuntimeExports.jsx(CopyButton, { copyText, ariaLabel: "Copy error", className: "absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-md border border-red-400 bg-red-100 p-0 text-red-900 transition-transform transition-colors duration-100 hover:bg-red-200 active:scale-95" }), title && jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-3 py-2.5 pr-10", style: {
|
|
1709
|
+
color: "var(--ds-red-900)",
|
|
1710
|
+
borderBottom: "1px solid var(--ds-red-400)"
|
|
1711
|
+
}, children: [jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4 shrink-0" }), jsxRuntimeExports.jsx("p", {
|
|
1712
|
+
className: "text-label-12 font-semibold m-0 truncate",
|
|
1713
|
+
// The full message or stack is in the body below; the header
|
|
1714
|
+
// shows the first line, single-line, with overflow
|
|
1715
|
+
// ellipsised so a long title doesn't push the copy button or
|
|
1716
|
+
// wrap into the framed hint/docs lines.
|
|
1717
|
+
title: message,
|
|
1718
|
+
children: title
|
|
1719
|
+
})] }), body && jsxRuntimeExports.jsx("pre", { className: "px-3 py-2.5 text-label-12-mono whitespace-pre-wrap break-words overflow-auto m-0", style: {
|
|
1720
|
+
color: "var(--ds-red-900)",
|
|
1721
|
+
background: "var(--ds-red-200)"
|
|
1722
|
+
}, children: body })] });
|
|
1723
|
+
}
|
|
1724
|
+
const ERROR_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
1639
1725
|
"step_failed",
|
|
1640
|
-
"
|
|
1641
|
-
"
|
|
1642
|
-
"wait_completed",
|
|
1643
|
-
"attr_set"
|
|
1726
|
+
"step_retrying",
|
|
1727
|
+
"run_failed"
|
|
1644
1728
|
]);
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
name: event.eventType,
|
|
1655
|
-
timestamp: dateToOtelTime(options.preferOccurredAt ? getEventTimestamp(event) ?? event.createdAt : event.createdAt),
|
|
1656
|
-
attributes: {
|
|
1657
|
-
eventId: event.eventId,
|
|
1658
|
-
correlationId: event.correlationId,
|
|
1659
|
-
eventData: "eventData" in event ? event.eventData : void 0
|
|
1660
|
-
},
|
|
1661
|
-
// Control whether to show vertical line in timeline
|
|
1662
|
-
showVerticalLine: shouldShowVerticalLine(event.eventType)
|
|
1663
|
-
}));
|
|
1664
|
-
}
|
|
1665
|
-
const waitEventsToWaitEntity = (events) => {
|
|
1666
|
-
var _a;
|
|
1667
|
-
const startEvent = events.find((event) => event.eventType === "wait_created");
|
|
1668
|
-
if (!startEvent) {
|
|
1669
|
-
return null;
|
|
1670
|
-
}
|
|
1671
|
-
const completedEvent = events.find((event) => event.eventType === "wait_completed");
|
|
1672
|
-
return {
|
|
1673
|
-
waitId: startEvent.correlationId,
|
|
1674
|
-
runId: startEvent.runId,
|
|
1675
|
-
createdAt: getEventTimestamp(startEvent) ?? startEvent.createdAt,
|
|
1676
|
-
resumeAt: ((_a = startEvent.eventData) == null ? void 0 : _a.resumeAt) ? new Date(startEvent.eventData.resumeAt) : void 0,
|
|
1677
|
-
completedAt: getEventTimestamp(completedEvent)
|
|
1678
|
-
};
|
|
1679
|
-
};
|
|
1680
|
-
function waitToSpan(events, maxEndTime, fallbackEndTime = maxEndTime) {
|
|
1681
|
-
const wait = waitEventsToWaitEntity(events);
|
|
1682
|
-
if (!wait) {
|
|
1683
|
-
return null;
|
|
1684
|
-
}
|
|
1685
|
-
const startTime = wait.createdAt;
|
|
1686
|
-
const startMs = startTime.getTime();
|
|
1687
|
-
let endTime = wait.completedAt;
|
|
1688
|
-
if (!endTime) {
|
|
1689
|
-
const fallbackCap = wait.resumeAt && wait.resumeAt.getTime() < fallbackEndTime.getTime() ? wait.resumeAt : fallbackEndTime;
|
|
1690
|
-
endTime = maxEndTime.getTime() > startMs && maxEndTime.getTime() < fallbackCap.getTime() ? maxEndTime : fallbackCap;
|
|
1691
|
-
}
|
|
1692
|
-
const start = dateToOtelTime(startTime);
|
|
1693
|
-
const end = dateToOtelTime(endTime);
|
|
1694
|
-
const duration = calculateDuration(startTime, endTime);
|
|
1695
|
-
const spanEvents = convertEventsToSpanEvents(events, false);
|
|
1696
|
-
return {
|
|
1697
|
-
spanId: wait.waitId,
|
|
1698
|
-
name: "sleep",
|
|
1699
|
-
kind: 1,
|
|
1700
|
-
// INTERNAL span kind
|
|
1701
|
-
resource: "sleep",
|
|
1702
|
-
library: WORKFLOW_LIBRARY,
|
|
1703
|
-
status: { code: 0 },
|
|
1704
|
-
traceFlags: 1,
|
|
1705
|
-
attributes: {
|
|
1706
|
-
resource: "sleep",
|
|
1707
|
-
data: wait
|
|
1708
|
-
// wait is a plain object built from events, no non-cloneable types
|
|
1709
|
-
},
|
|
1710
|
-
links: [],
|
|
1711
|
-
events: spanEvents,
|
|
1712
|
-
duration,
|
|
1713
|
-
startTime: start,
|
|
1714
|
-
endTime: end
|
|
1715
|
-
};
|
|
1716
|
-
}
|
|
1717
|
-
const stepEventsToStepEntity = (events) => {
|
|
1718
|
-
var _a, _b;
|
|
1719
|
-
const createdEvent = events.find((event) => event.eventType === "step_created");
|
|
1720
|
-
const anchorEvent = createdEvent ?? events[0];
|
|
1721
|
-
const firstStartedEvent = events.find((event) => event.eventType === "step_started");
|
|
1722
|
-
if (!anchorEvent) {
|
|
1723
|
-
return null;
|
|
1724
|
-
}
|
|
1725
|
-
let status = "pending";
|
|
1726
|
-
let attempt = 0;
|
|
1727
|
-
let startedAt;
|
|
1728
|
-
let completedAt;
|
|
1729
|
-
for (const e of events) {
|
|
1730
|
-
switch (e.eventType) {
|
|
1731
|
-
case "step_started":
|
|
1732
|
-
status = "running";
|
|
1733
|
-
attempt += 1;
|
|
1734
|
-
if (!startedAt)
|
|
1735
|
-
startedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
1736
|
-
completedAt = void 0;
|
|
1737
|
-
break;
|
|
1738
|
-
case "step_completed":
|
|
1739
|
-
status = "completed";
|
|
1740
|
-
completedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
1741
|
-
break;
|
|
1742
|
-
case "step_failed":
|
|
1743
|
-
status = "failed";
|
|
1744
|
-
completedAt = getEventTimestamp(e) ?? e.createdAt;
|
|
1745
|
-
break;
|
|
1746
|
-
case "step_retrying":
|
|
1747
|
-
status = "pending";
|
|
1748
|
-
completedAt = void 0;
|
|
1749
|
-
break;
|
|
1729
|
+
function deepParseJson(value) {
|
|
1730
|
+
if (typeof value === "string") {
|
|
1731
|
+
const trimmed = value.trim();
|
|
1732
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]") || trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
1733
|
+
try {
|
|
1734
|
+
return deepParseJson(JSON.parse(trimmed));
|
|
1735
|
+
} catch {
|
|
1736
|
+
return value;
|
|
1737
|
+
}
|
|
1750
1738
|
}
|
|
1739
|
+
return value;
|
|
1751
1740
|
}
|
|
1752
|
-
if (
|
|
1753
|
-
|
|
1754
|
-
const lastEvent = events[events.length - 1];
|
|
1755
|
-
return {
|
|
1756
|
-
stepId: anchorEvent.correlationId ?? "",
|
|
1757
|
-
runId: anchorEvent.runId,
|
|
1758
|
-
stepName: ((_a = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a.stepName) ?? ((_b = firstStartedEvent == null ? void 0 : firstStartedEvent.eventData) == null ? void 0 : _b.stepName) ?? "",
|
|
1759
|
-
status,
|
|
1760
|
-
attempt,
|
|
1761
|
-
createdAt: getEventTimestamp(anchorEvent) ?? anchorEvent.createdAt,
|
|
1762
|
-
updatedAt: getEventTimestamp(lastEvent) ?? (lastEvent == null ? void 0 : lastEvent.createdAt) ?? anchorEvent.createdAt,
|
|
1763
|
-
startedAt,
|
|
1764
|
-
completedAt,
|
|
1765
|
-
specVersion: anchorEvent.specVersion
|
|
1766
|
-
};
|
|
1767
|
-
};
|
|
1768
|
-
function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
|
|
1769
|
-
const step = stepEventsToStepEntity(stepEvents);
|
|
1770
|
-
if (!step) {
|
|
1771
|
-
return null;
|
|
1741
|
+
if (Array.isArray(value)) {
|
|
1742
|
+
return value.map(deepParseJson);
|
|
1772
1743
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
data: {
|
|
1777
|
-
...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
|
|
1778
|
-
// Canonical event-derived fields cannot be overridden by extensions.
|
|
1779
|
-
...step
|
|
1744
|
+
if (value !== null && typeof value === "object") {
|
|
1745
|
+
if (value.constructor !== Object) {
|
|
1746
|
+
return value;
|
|
1780
1747
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
const spanStartEvent = stepEvents.find((event) => event.eventType === "step_created") ?? stepEvents[0];
|
|
1787
|
-
const spanStartTime = getEventTimestamp(spanStartEvent) ?? new Date(step.createdAt);
|
|
1788
|
-
let activeStartTime = step.startedAt ? new Date(step.startedAt) : void 0;
|
|
1789
|
-
const firstStartEvent = stepEvents.find((event) => event.eventType === "step_started");
|
|
1790
|
-
if (firstStartEvent) {
|
|
1791
|
-
activeStartTime = getEventTimestamp(firstStartEvent) ?? new Date(firstStartEvent.createdAt);
|
|
1792
|
-
}
|
|
1793
|
-
let endTime = new Date(maxEndTime);
|
|
1794
|
-
if (step.completedAt) {
|
|
1795
|
-
const completedEvent = stepEvents.slice().reverse().find((event) => isTerminalStepEventType(event.eventType));
|
|
1796
|
-
endTime = getEventTimestamp(completedEvent) ?? new Date(step.completedAt);
|
|
1748
|
+
const result = {};
|
|
1749
|
+
for (const [k, v] of Object.entries(value)) {
|
|
1750
|
+
result[k] = deepParseJson(v);
|
|
1751
|
+
}
|
|
1752
|
+
return result;
|
|
1797
1753
|
}
|
|
1798
|
-
return
|
|
1799
|
-
spanId: String(step.stepId),
|
|
1800
|
-
name: (parsedName == null ? void 0 : parsedName.shortName) ?? String(step.stepName),
|
|
1801
|
-
kind: 1,
|
|
1802
|
-
// INTERNAL span kind
|
|
1803
|
-
resource,
|
|
1804
|
-
library: WORKFLOW_LIBRARY,
|
|
1805
|
-
status: { code: 0 },
|
|
1806
|
-
traceFlags: 1,
|
|
1807
|
-
attributes,
|
|
1808
|
-
links: [],
|
|
1809
|
-
events,
|
|
1810
|
-
startTime: dateToOtelTime(spanStartTime),
|
|
1811
|
-
endTime: dateToOtelTime(endTime),
|
|
1812
|
-
duration: calculateDuration(spanStartTime, endTime),
|
|
1813
|
-
// Only set activeStartTime if it differs from startTime (i.e., there was a queued period)
|
|
1814
|
-
activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
|
|
1815
|
-
};
|
|
1754
|
+
return value;
|
|
1816
1755
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
const createdEvent = events.find((event) => event.eventType === "hook_created");
|
|
1820
|
-
const creation = createdEvent ? {
|
|
1821
|
-
hookId: createdEvent.correlationId,
|
|
1822
|
-
runId: createdEvent.runId,
|
|
1823
|
-
token: (_a = createdEvent.eventData) == null ? void 0 : _a.token,
|
|
1824
|
-
createdAt: getEventTimestamp(createdEvent) ?? createdEvent.createdAt
|
|
1825
|
-
} : startHook && events.every((event) => event.correlationId === startHook.hookId) ? startHook : void 0;
|
|
1826
|
-
if (!creation) {
|
|
1756
|
+
function extractStructuredError(data, eventType) {
|
|
1757
|
+
if (!eventType || !ERROR_EVENT_TYPES.has(eventType))
|
|
1827
1758
|
return null;
|
|
1759
|
+
if (data == null || typeof data !== "object")
|
|
1760
|
+
return null;
|
|
1761
|
+
const record = data;
|
|
1762
|
+
if (isStructuredError(record.error))
|
|
1763
|
+
return record.error;
|
|
1764
|
+
if (isStructuredError(record))
|
|
1765
|
+
return record;
|
|
1766
|
+
return null;
|
|
1767
|
+
}
|
|
1768
|
+
const SEGMENT_COLOR = {
|
|
1769
|
+
queued: "bg-gray-400",
|
|
1770
|
+
failed: "bg-amber-700",
|
|
1771
|
+
backoff: "bg-amber-300",
|
|
1772
|
+
ok: "bg-green-700"
|
|
1773
|
+
};
|
|
1774
|
+
function PayloadView({ data, eventType, encrypted }) {
|
|
1775
|
+
const decrypt2 = reactExports.useContext(DecryptClickContext);
|
|
1776
|
+
const cleaned = reactExports.useMemo(() => deepParseJson(data), [data]);
|
|
1777
|
+
if (encrypted && decrypt2) {
|
|
1778
|
+
return jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Payload", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 rounded-md border border-gray-alpha-400 bg-gray-100 py-1.5 pl-3 pr-1.5", children: [jsxRuntimeExports.jsx(Lock, { className: "h-4 w-4 shrink-0 text-gray-900" }), jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 text-copy-13 text-gray-900", children: "Encrypted with this run’s key." }), jsxRuntimeExports.jsx(DecryptButton, { loading: decrypt2.isDecrypting, disabled: decrypt2.isDecryptDisabled, disabledReason: decrypt2.decryptDisabledReason, onClick: decrypt2.onDecrypt })] }) });
|
|
1828
1779
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1780
|
+
return jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Payload", actions: jsxRuntimeExports.jsx(CopyButton, { copyText: serializeForClipboard(cleaned), ariaLabel: "Copy payload", className: "flex h-6 w-6 items-center justify-center rounded-md p-0 hover:bg-gray-alpha-200" }), children: eventType === "attr_set" ? jsxRuntimeExports.jsx(AttrSetEventBlock, { data: cleaned }) : jsxRuntimeExports.jsx("div", { className: "overflow-x-auto", children: jsxRuntimeExports.jsx(DataInspector, { data: cleaned }) }) });
|
|
1781
|
+
}
|
|
1782
|
+
function TimingBreakdown({ segments }) {
|
|
1783
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "flex h-2 gap-0.5 overflow-hidden rounded-full", children: segments.map((segment, i) => jsxRuntimeExports.jsx("span", { className: cn("h-full min-w-1 basis-0", SEGMENT_COLOR[segment.kind]), style: { flexGrow: segment.ms } }, i)) }), jsxRuntimeExports.jsx("ul", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: segments.map((segment, i) => jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-1.5 text-label-14", children: [jsxRuntimeExports.jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: cn("block size-2.5 rounded-full", SEGMENT_COLOR[segment.kind]) }) }), jsxRuntimeExports.jsx("span", { className: "text-gray-900", children: segment.label }), jsxRuntimeExports.jsx("span", { className: "tabular-nums text-gray-1000", children: formatDurationPrecise(segment.ms) })] }, i)) })] });
|
|
1784
|
+
}
|
|
1785
|
+
function EventDetailsBody({ row, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey }) {
|
|
1786
|
+
const { event } = row;
|
|
1787
|
+
const inlineIsComplete = event.eventData != null && (!onLoadEventData || getEventDataRefFields(event.eventType).length === 0);
|
|
1788
|
+
const [data, setData] = reactExports.useState(cachedEventData ?? (inlineIsComplete ? event.eventData : null));
|
|
1789
|
+
const [loading, setLoading] = reactExports.useState(data === null && !!onLoadEventData);
|
|
1790
|
+
const [loadError, setLoadError] = reactExports.useState(null);
|
|
1791
|
+
reactExports.useEffect(() => {
|
|
1792
|
+
if (!onLoadEventData || inlineIsComplete && !encryptionKey)
|
|
1793
|
+
return;
|
|
1794
|
+
if (data !== null && !encryptionKey)
|
|
1795
|
+
return;
|
|
1796
|
+
let cancelled = false;
|
|
1797
|
+
setLoadError(null);
|
|
1798
|
+
if (data === null)
|
|
1799
|
+
setLoading(true);
|
|
1800
|
+
onLoadEventData(event).then((loaded) => {
|
|
1801
|
+
if (cancelled || loaded == null)
|
|
1802
|
+
return;
|
|
1803
|
+
setData(loaded);
|
|
1804
|
+
onCacheEventData(event.eventId, loaded);
|
|
1805
|
+
}).catch((err) => {
|
|
1806
|
+
if (cancelled)
|
|
1807
|
+
return;
|
|
1808
|
+
setLoadError(err instanceof Error ? err.message : "Failed to load event details");
|
|
1809
|
+
}).finally(() => {
|
|
1810
|
+
if (!cancelled)
|
|
1811
|
+
setLoading(false);
|
|
1812
|
+
});
|
|
1813
|
+
return () => {
|
|
1814
|
+
cancelled = true;
|
|
1815
|
+
};
|
|
1816
|
+
}, [event.eventId, encryptionKey]);
|
|
1817
|
+
const timingTotal = row.segments.reduce((sum, s) => sum + s.ms, 0);
|
|
1818
|
+
const occurredAt = parseEventDate(event.occurredAt);
|
|
1819
|
+
const createdAt = new Date(event.createdAt);
|
|
1820
|
+
const structuredError = extractStructuredError(data, event.eventType);
|
|
1821
|
+
return jsxRuntimeExports.jsxs("div", { className: "@container px-4 pb-8", children: [timingTotal > 0 ? jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Timing", actions: jsxRuntimeExports.jsxs("span", { className: "text-label-13 tabular-nums text-gray-900", children: [formatDurationPrecise(timingTotal), " total"] }), children: jsxRuntimeExports.jsx(TimingBreakdown, { segments: row.segments }) }) : row.durationMs !== void 0 ? jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Timing", children: jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label: "Duration", value: formatDurationPrecise(row.durationMs) }) }) : null, structuredError ? jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Error", children: jsxRuntimeExports.jsx(ErrorStackBlock, { value: structuredError }) }) : null, data != null ? jsxRuntimeExports.jsx(PayloadView, { data, eventType: event.eventType, encrypted: !encryptionKey && hasEncryptedValues(data) }) : loading || loadError ? jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Payload", children: loadError ? jsxRuntimeExports.jsx("div", { className: "rounded-md border border-red-400 bg-red-100 px-2 py-1.5 text-copy-13-mono text-red-1000", children: loadError }) : jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 py-1", children: [jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "70%" } }), jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: { width: "45%" } })] }) }) : null, jsxRuntimeExports.jsx(Collapsible, { defaultOpen: true, label: "Identifiers", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label: "Event ID", value: event.eventId, copyText: event.eventId }), event.correlationId ? jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label: "Correlation ID", value: event.correlationId, copyText: event.correlationId }) : null, jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label: "Created", value: createdAt.toLocaleString() }), occurredAt ? jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label: "Occurred", value: occurredAt.toLocaleString() }) : null] }) })] });
|
|
1822
|
+
}
|
|
1823
|
+
const EVENT_DETAIL_PANEL_ID = "event-detail-panel";
|
|
1824
|
+
function EventDetailsPanel({ width, onPrev, onNext, onClose, onViewInTrace, ...body }) {
|
|
1825
|
+
const { row } = body;
|
|
1826
|
+
const { event } = row;
|
|
1827
|
+
return jsxRuntimeExports.jsx(DetailPanelShell, { id: EVENT_DETAIL_PANEL_ID, width, itemLabel: "event", title: jsxRuntimeExports.jsx("span", { className: "truncate block", children: row.name || event.eventType }), actions: onViewInTrace ? jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "View in Trace", onClick: () => onViewInTrace(getEventSpanId(event)), children: jsxRuntimeExports.jsx(ChartGantt, { className: "w-4 h-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { children: "View in Trace" })] }) : null, onPrev, onNext, onClose, children: jsxRuntimeExports.jsx(EventDetailsBody, { ...body }, event.eventId) });
|
|
1828
|
+
}
|
|
1829
|
+
function EventListToolbar({ query, onQueryChange }) {
|
|
1830
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-gray-alpha-400 bg-background-100 pl-[34px] pr-2", children: [jsxRuntimeExports.jsx(Search, { className: "h-3.5 w-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { type: "text", name: "event-list-search", "aria-label": "Search events", placeholder: "Search by step ID, wait ID, hook ID, or event ID…", value: query, onChange: (e) => onQueryChange(e.target.value), onKeyDown: (e) => {
|
|
1831
|
+
if (e.key === "Escape" && query) {
|
|
1832
|
+
e.preventDefault();
|
|
1833
|
+
e.stopPropagation();
|
|
1834
|
+
onQueryChange("");
|
|
1835
|
+
}
|
|
1836
|
+
}, className: "min-w-0 flex-1 bg-transparent text-label-14 text-gray-1000 outline-none placeholder:text-gray-800" }), query ? jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => onQueryChange(""), className: "flex h-full shrink-0 cursor-pointer items-center border-0 bg-transparent px-1 text-gray-900 hover:text-gray-1000", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) }) : null] });
|
|
1837
|
+
}
|
|
1838
|
+
const WorkflowIcon = () => {
|
|
1839
|
+
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" }) });
|
|
1840
|
+
};
|
|
1841
|
+
const WebhookIcon = () => {
|
|
1842
|
+
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" }) });
|
|
1843
|
+
};
|
|
1844
|
+
const SleepIcon = () => {
|
|
1845
|
+
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" }) });
|
|
1846
|
+
};
|
|
1847
|
+
const StepForwardIcon = () => {
|
|
1848
|
+
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" }) });
|
|
1849
|
+
};
|
|
1850
|
+
const eventStyles = {
|
|
1851
|
+
run: { icon: WorkflowIcon, className: "text-blue-900", label: "Workflow" },
|
|
1852
|
+
step: { icon: StepForwardIcon, className: "text-green-900", label: "Step" },
|
|
1853
|
+
hook: { icon: WebhookIcon, className: "text-gray-900", label: "Hook" },
|
|
1854
|
+
sleep: { icon: SleepIcon, className: "text-gray-900", label: "Sleep" }
|
|
1855
|
+
};
|
|
1856
|
+
const defaultStyle = {
|
|
1857
|
+
icon: Circle,
|
|
1858
|
+
className: "text-gray-900",
|
|
1859
|
+
label: "Event"
|
|
1860
|
+
};
|
|
1861
|
+
const ROW_HEIGHT_CLASS = "h-10";
|
|
1862
|
+
function getEventStyle(resource, isErrored, isCancelled) {
|
|
1863
|
+
const style = eventStyles[resource] ?? defaultStyle;
|
|
1832
1864
|
return {
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
createdAt: creation.createdAt,
|
|
1837
|
-
receivedCount: receivedEvents.length,
|
|
1838
|
-
lastReceivedAt: getEventTimestamp(lastReceivedEvent),
|
|
1839
|
-
disposedAt: getEventTimestamp(disposedEvents.at(-1))
|
|
1865
|
+
icon: style.icon,
|
|
1866
|
+
className: cn(isErrored ? "text-red-900" : isCancelled ? "text-gray-900" : style.className),
|
|
1867
|
+
label: style.label
|
|
1840
1868
|
};
|
|
1869
|
+
}
|
|
1870
|
+
function ResourceIcon({ resource, isErrored = false, isCancelled = false }) {
|
|
1871
|
+
const { icon: Icon, className, label } = getEventStyle(resource, isErrored, isCancelled);
|
|
1872
|
+
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 })] });
|
|
1873
|
+
}
|
|
1874
|
+
const EventRow$1 = ({ span, isSelected, isDimmed, onSelectSpan }) => {
|
|
1875
|
+
const durationMs = getSpanDurationMs(span);
|
|
1876
|
+
const isErrored = isSpanErrored(span);
|
|
1877
|
+
const isCancelled = isSpanCancelled(span);
|
|
1878
|
+
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) }) })] }) });
|
|
1841
1879
|
};
|
|
1842
|
-
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1880
|
+
const EventList = ({ spans, activeSpanId, searchResult, onSelectSpan }) => {
|
|
1881
|
+
const listRef = reactExports.useRef(null);
|
|
1882
|
+
const { start, end } = useRowWindow(listRef, spans.length, ROW_HEIGHT_PX);
|
|
1883
|
+
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: {
|
|
1884
|
+
paddingTop: start * ROW_HEIGHT_PX,
|
|
1885
|
+
paddingBottom: (spans.length - end) * ROW_HEIGHT_PX
|
|
1886
|
+
}, children: spans.slice(start, end).map((span) => jsxRuntimeExports.jsx(EventRow$1, { span, isSelected: span.spanId === activeSpanId, isDimmed: isSpanDimmedBySearch(span.spanId, searchResult), onSelectSpan }, span.spanId)) });
|
|
1887
|
+
};
|
|
1888
|
+
function EventNoticeTooltip({ notice, children }) {
|
|
1889
|
+
if (!notice)
|
|
1890
|
+
return children;
|
|
1891
|
+
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsxs(Tooltip, { children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children }), jsxRuntimeExports.jsx(TooltipContent, { className: "max-w-[264px] leading-snug", collisionPadding: 8, side: "top", children: notice })] }) });
|
|
1892
|
+
}
|
|
1893
|
+
const COL = {
|
|
1894
|
+
level: "w-6 justify-center",
|
|
1895
|
+
time: "w-[172px]",
|
|
1896
|
+
since: "w-[100px]",
|
|
1897
|
+
event: "w-[136px]",
|
|
1898
|
+
name: "w-[200px]",
|
|
1899
|
+
duration: "w-[96px] justify-end"
|
|
1900
|
+
};
|
|
1901
|
+
const CELL = "flex h-full shrink-0 items-center overflow-hidden px-1.5";
|
|
1902
|
+
const LEVEL_ROW_CLASS = {
|
|
1903
|
+
default: "text-gray-1000 hover:bg-gray-alpha-200",
|
|
1904
|
+
muted: "text-gray-700 hover:bg-gray-alpha-200",
|
|
1905
|
+
warning: "bg-amber-100 text-amber-900 hover:bg-amber-200",
|
|
1906
|
+
error: "bg-red-100 text-red-900 hover:bg-red-200"
|
|
1907
|
+
};
|
|
1908
|
+
const LEVEL_SEPARATOR_CLASS = {
|
|
1909
|
+
default: "border-gray-400",
|
|
1910
|
+
muted: "border-gray-400",
|
|
1911
|
+
warning: "border-amber-400",
|
|
1912
|
+
error: "border-red-400"
|
|
1913
|
+
};
|
|
1914
|
+
const LEVEL_SELECTED_CLASS = {
|
|
1915
|
+
default: "bg-gray-200 hover:bg-gray-200",
|
|
1916
|
+
muted: "bg-gray-200 hover:bg-gray-200",
|
|
1917
|
+
warning: "bg-amber-300 hover:bg-amber-300",
|
|
1918
|
+
error: "bg-red-300 hover:bg-red-300"
|
|
1919
|
+
};
|
|
1920
|
+
function TimestampCell({ date, secondaryClass }) {
|
|
1921
|
+
const parts = formatTimestampParts(date);
|
|
1922
|
+
return jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.time, "tabular-nums"), children: jsxRuntimeExports.jsx(TimestampTooltip, { date, children: jsxRuntimeExports.jsxs("span", { className: "whitespace-pre", children: [jsxRuntimeExports.jsx("span", { className: secondaryClass, children: `${parts.day} ` }), parts.clock, jsxRuntimeExports.jsx("span", { className: secondaryClass, children: parts.ms })] }) }) });
|
|
1923
|
+
}
|
|
1924
|
+
function LevelIcon({ level }) {
|
|
1925
|
+
if (level === "warning") {
|
|
1926
|
+
return jsxRuntimeExports.jsx(TriangleAlert, { "aria-label": "Warning", className: "h-3.5 w-3.5" });
|
|
1927
|
+
}
|
|
1928
|
+
if (level === "error") {
|
|
1929
|
+
return jsxRuntimeExports.jsx(CircleX, { "aria-label": "Error", className: "h-3.5 w-3.5" });
|
|
1930
|
+
}
|
|
1931
|
+
return null;
|
|
1932
|
+
}
|
|
1933
|
+
function SortIndicator({ order }) {
|
|
1934
|
+
return jsxRuntimeExports.jsxs("span", { "aria-hidden": true, className: "flex flex-col gap-px", children: [jsxRuntimeExports.jsx("span", { className: cn("-my-0.5 flex size-3 items-center justify-center rounded-full transition-all duration-[280ms] ease-in-out", order === "asc" ? "translate-y-1 bg-gray-300 text-gray-900" : "-translate-y-1 opacity-0"), children: jsxRuntimeExports.jsx(ChevronUp, { className: "size-2", strokeWidth: 3 }) }), jsxRuntimeExports.jsx("span", { className: cn("-my-0.5 flex size-3 items-center justify-center rounded-full transition-all duration-[280ms] ease-in-out", order === "desc" ? "-translate-y-1 bg-gray-300 text-gray-900" : "opacity-0"), children: jsxRuntimeExports.jsx(ChevronDown, { className: "size-2 translate-y-[0.5px]", strokeWidth: 3 }) })] });
|
|
1935
|
+
}
|
|
1936
|
+
function EventListHeader({ showOccurred, sortOrder, onSortOrderChange }) {
|
|
1937
|
+
const sortButton = (label) => jsxRuntimeExports.jsxs("button", { type: "button", "aria-label": `${label}, ${sortOrder === "asc" ? "oldest" : "newest"} first`, onClick: () => onSortOrderChange(sortOrder === "asc" ? "desc" : "asc"), className: cn(CELL, COL.time, "cursor-pointer gap-1.5 border-0 bg-transparent text-left font-sans text-label-14 text-gray-900 hover:text-gray-1000"), children: [label, jsxRuntimeExports.jsx(SortIndicator, { order: sortOrder })] });
|
|
1938
|
+
return jsxRuntimeExports.jsxs("div", { role: "row", className: "mx-1 flex h-10 shrink-0 items-center border-b border-gray-alpha-200 font-sans text-label-14 text-gray-900", children: [jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.level) }), showOccurred ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [sortButton("Occurred"), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.time), children: "Created" })] }) : sortButton("Time"), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.since) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.event), children: "Event" }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.name), children: "Name" }), jsxRuntimeExports.jsx("div", { className: cn(CELL, "min-w-0 flex-1 h-3.5 border-l border-gray-400"), children: "Message" }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.duration), children: "Duration" })] });
|
|
1939
|
+
}
|
|
1940
|
+
function IdleGapRow({ ms, reason }) {
|
|
1941
|
+
return jsxRuntimeExports.jsxs("div", { className: "mx-1 mt-px flex h-6 items-center gap-2.5 pl-[30px] pr-2 font-mono text-label-12-mono text-gray-700", children: [jsxRuntimeExports.jsx("span", { className: "h-px w-3 shrink-0 bg-gray-400" }), jsxRuntimeExports.jsxs("span", { className: "shrink-0", children: [formatDurationPrecise(ms), " idle", reason ? ` · ${reason}` : ""] }), jsxRuntimeExports.jsx("span", { className: "h-px flex-1 bg-gray-400" })] });
|
|
1942
|
+
}
|
|
1943
|
+
function EventRow({ row, index, isSelected, isTabStop, isRelated, onSelect, showSeparateEventOccurrenceTimestamps = false }) {
|
|
1944
|
+
const { event, level, name, message, notice } = row;
|
|
1945
|
+
const occurredAt = parseEventDate(event.occurredAt);
|
|
1946
|
+
const displayedAt = showSeparateEventOccurrenceTimestamps ? new Date(event.createdAt) : getEffectiveEventDate$1(event);
|
|
1947
|
+
const zebra = (level === "default" || level === "muted") && index % 2 === 1;
|
|
1948
|
+
const secondaryClass = level === "warning" || level === "error" ? void 0 : "text-gray-900";
|
|
1949
|
+
return jsxRuntimeExports.jsxs("div", { "data-event-id": event.eventId, role: "button", tabIndex: isTabStop ? 0 : -1, "aria-pressed": isSelected, onClick: () => onSelect(event), onKeyDown: (e) => {
|
|
1950
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1951
|
+
e.preventDefault();
|
|
1952
|
+
onSelect(event);
|
|
1953
|
+
}
|
|
1954
|
+
}, className: cn("mx-1 mt-px flex h-6 cursor-pointer items-center rounded-md font-mono text-[13px] leading-5 outline-none focus-visible:relative focus-visible:z-10 focus-visible:shadow-[0_0_0_2px_var(--ds-focus-color)]", LEVEL_ROW_CLASS[level], zebra && "bg-gray-alpha-100", isSelected && LEVEL_SELECTED_CLASS[level]), children: [jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.level), children: jsxRuntimeExports.jsx(LevelIcon, { level }) }), showSeparateEventOccurrenceTimestamps && (occurredAt ? jsxRuntimeExports.jsx(TimestampCell, { date: occurredAt, secondaryClass }) : jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.time, secondaryClass), children: "—" })), jsxRuntimeExports.jsx(TimestampCell, { date: displayedAt, secondaryClass }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.since, "tabular-nums", secondaryClass), children: row.sinceStartMs !== void 0 ? formatSinceStart(row.sinceStartMs) : "" }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.event), children: jsxRuntimeExports.jsx(EventNoticeTooltip, { notice, children: jsxRuntimeExports.jsx("span", { className: cn("truncate", notice && "line-through"), title: event.eventType, children: event.eventType }) }) }), jsxRuntimeExports.jsxs("div", { className: cn(CELL, COL.name, "gap-2"), title: name || void 0, children: [jsxRuntimeExports.jsx(ResourceIcon, { resource: row.resource, isErrored: level === "error", isCancelled: event.eventType === "run_cancelled" }), name ? jsxRuntimeExports.jsx("span", { className: cn("-mx-1 truncate rounded px-1", isRelated && "bg-blue-100 text-blue-900"), children: name }) : null] }), jsxRuntimeExports.jsx("div", { className: cn(CELL, "min-w-0 flex-1 h-3.5 border-l", LEVEL_SEPARATOR_CLASS[level]), title: message || void 0, children: jsxRuntimeExports.jsx("span", { className: "truncate", children: message }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.duration, "tabular-nums"), children: row.durationMs !== void 0 ? formatDurationPrecise(row.durationMs) : "" })] });
|
|
1955
|
+
}
|
|
1956
|
+
const SKELETON_MESSAGE_WIDTHS = ["40%", "0%", "25%", "55%", "0%", "30%"];
|
|
1957
|
+
function EventRowsSkeleton() {
|
|
1958
|
+
return jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden pt-px", children: Array.from({ length: 18 }, (_, i) => jsxRuntimeExports.jsxs("div", { className: cn("mx-1 mt-px flex h-6 items-center rounded-md", i % 2 === 1 && "bg-gray-alpha-100"), children: [jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.level) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.time), children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-[136px]" }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.since), children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-12" }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.event), children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-[104px]" }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.name), children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-24" }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, "min-w-0 flex-1"), children: jsxRuntimeExports.jsx(Skeleton, { className: "h-3", style: {
|
|
1959
|
+
width: SKELETON_MESSAGE_WIDTHS[i % SKELETON_MESSAGE_WIDTHS.length]
|
|
1960
|
+
} }) }), jsxRuntimeExports.jsx("div", { className: cn(CELL, COL.duration) })] }, i)) });
|
|
1961
|
+
}
|
|
1962
|
+
const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
|
|
1963
|
+
const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
1964
|
+
const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
1965
|
+
const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
1966
|
+
const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
1967
|
+
function matchPrefixedId(pattern, prefix, kind, query) {
|
|
1968
|
+
const match = query.match(pattern);
|
|
1969
|
+
if (!match) {
|
|
1845
1970
|
return null;
|
|
1846
1971
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1972
|
+
return { kind, id: `${prefix}_${match[1].toUpperCase()}` };
|
|
1973
|
+
}
|
|
1974
|
+
function parseExactWorkflowSearchId(query) {
|
|
1975
|
+
const trimmed = query.trim();
|
|
1976
|
+
if (!trimmed) {
|
|
1977
|
+
return null;
|
|
1978
|
+
}
|
|
1979
|
+
return matchPrefixedId(STEP_ID_PATTERN, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN, "evnt", "event", trimmed);
|
|
1980
|
+
}
|
|
1981
|
+
const EXACT_SEARCH_DEBOUNCE_MS = 300;
|
|
1982
|
+
function useEventSearch(onExactIdSearch) {
|
|
1983
|
+
const [query, setQuery] = reactExports.useState("");
|
|
1984
|
+
const [outcome, setOutcome] = reactExports.useState(null);
|
|
1985
|
+
const trimmed = query.trim();
|
|
1986
|
+
const parsed = reactExports.useMemo(() => parseExactWorkflowSearchId(trimmed), [trimmed]);
|
|
1987
|
+
reactExports.useEffect(() => {
|
|
1988
|
+
if (!parsed || !onExactIdSearch)
|
|
1989
|
+
return;
|
|
1990
|
+
const abortController = new AbortController();
|
|
1991
|
+
const timer = setTimeout(async () => {
|
|
1992
|
+
let next;
|
|
1993
|
+
try {
|
|
1994
|
+
const result = await onExactIdSearch(parsed.id, parsed.kind, abortController.signal);
|
|
1995
|
+
if (result.status === "error") {
|
|
1996
|
+
next = { query: trimmed, status: "error", message: result.message };
|
|
1997
|
+
} else if (result.status === "not_found" || result.events.length === 0) {
|
|
1998
|
+
next = { query: trimmed, status: "not_found" };
|
|
1999
|
+
} else {
|
|
2000
|
+
next = {
|
|
2001
|
+
query: trimmed,
|
|
2002
|
+
status: "ok",
|
|
2003
|
+
events: result.events,
|
|
2004
|
+
truncated: Boolean(result.truncated)
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
} catch {
|
|
2008
|
+
next = {
|
|
2009
|
+
query: trimmed,
|
|
2010
|
+
status: "error",
|
|
2011
|
+
message: "Failed to search events. Try again."
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
if (!abortController.signal.aborted)
|
|
2015
|
+
setOutcome(next);
|
|
2016
|
+
}, EXACT_SEARCH_DEBOUNCE_MS);
|
|
2017
|
+
return () => {
|
|
2018
|
+
clearTimeout(timer);
|
|
2019
|
+
abortController.abort();
|
|
2020
|
+
setOutcome(null);
|
|
2021
|
+
};
|
|
2022
|
+
}, [trimmed, parsed, onExactIdSearch]);
|
|
2023
|
+
const search = reactExports.useMemo(() => {
|
|
2024
|
+
if (!trimmed)
|
|
2025
|
+
return { status: "idle" };
|
|
2026
|
+
if (!parsed) {
|
|
2027
|
+
return { status: "incomplete", query: trimmed };
|
|
2028
|
+
}
|
|
2029
|
+
if (!onExactIdSearch)
|
|
2030
|
+
return { status: "unavailable", query: trimmed };
|
|
2031
|
+
if ((outcome == null ? void 0 : outcome.query) !== trimmed) {
|
|
2032
|
+
return { status: "loading", query: trimmed, id: parsed };
|
|
2033
|
+
}
|
|
2034
|
+
return { ...outcome, id: parsed };
|
|
2035
|
+
}, [trimmed, parsed, onExactIdSearch, outcome]);
|
|
2036
|
+
return { query, setQuery, search };
|
|
2037
|
+
}
|
|
2038
|
+
function useElementWidth(ref, enabled = true) {
|
|
2039
|
+
const [width, setWidth] = reactExports.useState(0);
|
|
2040
|
+
reactExports.useLayoutEffect(() => {
|
|
2041
|
+
if (!enabled)
|
|
2042
|
+
return;
|
|
2043
|
+
const el = ref.current;
|
|
2044
|
+
if (!el)
|
|
2045
|
+
return;
|
|
2046
|
+
setWidth(Math.round(el.getBoundingClientRect().width));
|
|
2047
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
2048
|
+
setWidth(Math.round((entry == null ? void 0 : entry.contentRect.width) ?? 0));
|
|
2049
|
+
});
|
|
2050
|
+
observer.observe(el);
|
|
2051
|
+
return () => observer.disconnect();
|
|
2052
|
+
}, [ref, enabled]);
|
|
2053
|
+
return width;
|
|
1868
2054
|
}
|
|
1869
|
-
function
|
|
1870
|
-
|
|
1871
|
-
const
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
const completedAt = getEventTimestamp(terminalEvent) ?? run.completedAt ?? void 0;
|
|
1878
|
-
const endTime = completedAt ?? now;
|
|
1879
|
-
const wasCancelled = run.status === "cancelled" || (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled";
|
|
1880
|
-
const cancelReason = (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled" && typeof ((_a = terminalEvent.eventData) == null ? void 0 : _a.cancelReason) === "string" ? terminalEvent.eventData.cancelReason : null;
|
|
1881
|
-
const { input: _i, output: _o, error: _e, ...runIdentity } = run;
|
|
1882
|
-
const attributes = {
|
|
1883
|
-
resource: "run",
|
|
1884
|
-
data: {
|
|
1885
|
-
...runIdentity,
|
|
1886
|
-
createdAt: spanStartTime,
|
|
1887
|
-
startedAt: activeStartTime,
|
|
1888
|
-
completedAt,
|
|
1889
|
-
...wasCancelled ? { cancelReason } : {}
|
|
1890
|
-
}
|
|
1891
|
-
};
|
|
1892
|
-
const events = convertEventsToSpanEvents(runEvents, false, {
|
|
1893
|
-
preferOccurredAt: true
|
|
1894
|
-
});
|
|
2055
|
+
function useDetailPanelWidth(containerRef, open) {
|
|
2056
|
+
const [storedWidth, setStoredWidth] = reactExports.useState(() => readStoredPanelWidth());
|
|
2057
|
+
const containerWidth = useElementWidth(containerRef, open);
|
|
2058
|
+
const resize = reactExports.useCallback((next) => {
|
|
2059
|
+
const clamped = clampPanelWidth(next, containerWidth);
|
|
2060
|
+
setStoredWidth(clamped);
|
|
2061
|
+
writeStoredPanelWidth(clamped);
|
|
2062
|
+
}, [containerWidth]);
|
|
1895
2063
|
return {
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
// INTERNAL span kind
|
|
1900
|
-
resource: "run",
|
|
1901
|
-
library: WORKFLOW_LIBRARY,
|
|
1902
|
-
status: { code: 0 },
|
|
1903
|
-
traceFlags: 1,
|
|
1904
|
-
attributes,
|
|
1905
|
-
links: [],
|
|
1906
|
-
events,
|
|
1907
|
-
startTime: dateToOtelTime(spanStartTime),
|
|
1908
|
-
endTime: dateToOtelTime(endTime),
|
|
1909
|
-
duration: calculateDuration(spanStartTime, endTime),
|
|
1910
|
-
// Only set activeStartTime if it differs from startTime (i.e., there was a queued period)
|
|
1911
|
-
activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
|
|
2064
|
+
width: clampPanelWidth(storedWidth, containerWidth),
|
|
2065
|
+
maxWidth: Math.max(PANEL_MIN_WIDTH, computeMaxPanelWidth(containerWidth)),
|
|
2066
|
+
resize
|
|
1912
2067
|
};
|
|
1913
2068
|
}
|
|
1914
|
-
const
|
|
1915
|
-
function
|
|
1916
|
-
|
|
1917
|
-
return events.filter(isRunLevelEvent);
|
|
1918
|
-
}
|
|
1919
|
-
if (!spanId)
|
|
1920
|
-
return [];
|
|
1921
|
-
return events.filter((e) => e.correlationId === spanId);
|
|
2069
|
+
const STYLES = `.wf-load-more{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;border-radius:6px;font-size:13px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-load-more:hover{background:var(--ds-gray-alpha-200)}.wf-load-more:disabled{opacity:.6;cursor:default}.wf-load-more:disabled:hover{background:var(--ds-background-100)}`;
|
|
2070
|
+
function LoadMoreButton({ loading = false, onClick, label = "Load more", loadingLabel = "Loading..." }) {
|
|
2071
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES } }), jsxRuntimeExports.jsxs("button", { type: "button", onClick, disabled: loading, className: "wf-load-more", children: [loading && jsxRuntimeExports.jsx(Spinner, { size: 14 }), loading ? loadingLabel : label] })] });
|
|
1922
2072
|
}
|
|
1923
|
-
function
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
2073
|
+
function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey, isLoading = false, sortOrder: sortOrderProp, onSortOrderChange, onDecrypt, isDecrypting = false, isDecryptDisabled = false, decryptDisabledReason, onExactIdSearch, showSeparateEventOccurrenceTimestamps = false, onViewInTrace }) {
|
|
2074
|
+
const [internalSortOrder, setInternalSortOrder] = reactExports.useState("asc");
|
|
2075
|
+
const sortOrder = sortOrderProp ?? internalSortOrder;
|
|
2076
|
+
const handleSortOrderChange = onSortOrderChange ?? setInternalSortOrder;
|
|
2077
|
+
const virtuosoRef = reactExports.useRef(null);
|
|
2078
|
+
const bodyRef = reactExports.useRef(null);
|
|
2079
|
+
const [selectedEventId, setSelectedEventId] = reactExports.useState();
|
|
2080
|
+
const { query, setQuery, search } = useEventSearch(onExactIdSearch);
|
|
2081
|
+
const list = getListSource(search, { events, hasMore: hasMoreEvents });
|
|
2082
|
+
const sortedEvents = reactExports.useMemo(() => sortEventsByTime(list.events, sortOrder), [list.events, sortOrder]);
|
|
2083
|
+
const knownEvents = reactExports.useMemo(() => mergeEventsById(events ?? [], list.events), [events, list.events]);
|
|
2084
|
+
const isCompleteHistory = list.isLog && !list.hasMore;
|
|
2085
|
+
const duplicateEventIds = reactExports.useMemo(() => findDuplicateEventIds(events ?? [], { isCompleteHistory }), [events, isCompleteHistory]);
|
|
2086
|
+
const lookups = reactExports.useMemo(() => buildEventLookups(knownEvents, run ?? null, duplicateEventIds), [knownEvents, run, duplicateEventIds]);
|
|
2087
|
+
const rows = reactExports.useMemo(() => sortedEvents.map((event) => buildEventRow(event, lookups)), [sortedEvents, lookups]);
|
|
2088
|
+
const listItems = reactExports.useMemo(() => buildListItems(rows, {
|
|
2089
|
+
showGaps: list.isLog,
|
|
2090
|
+
hookNameMap: lookups.names.hookNameMap
|
|
2091
|
+
}), [rows, list.isLog, lookups]);
|
|
2092
|
+
const toggleSelectedEvent = reactExports.useCallback((event) => {
|
|
2093
|
+
setSelectedEventId((id) => id === event.eventId ? void 0 : event.eventId);
|
|
2094
|
+
}, []);
|
|
2095
|
+
const selectedRow = reactExports.useMemo(() => {
|
|
2096
|
+
if (!selectedEventId)
|
|
2097
|
+
return void 0;
|
|
2098
|
+
const event = knownEvents.find((e) => e.eventId === selectedEventId);
|
|
2099
|
+
return event ? buildEventRow(event, lookups) : void 0;
|
|
2100
|
+
}, [selectedEventId, knownEvents, lookups]);
|
|
2101
|
+
const relatedKey = search.status === "ok" ? search.id.kind === "event" ? getEventEntity(search.events[0]).key : search.id.id : (selectedRow == null ? void 0 : selectedRow.entity.key) ?? null;
|
|
2102
|
+
const eventDataCacheRef = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
2103
|
+
const cacheEventData = reactExports.useCallback((eventId, data) => {
|
|
2104
|
+
eventDataCacheRef.current.set(eventId, data);
|
|
2105
|
+
}, []);
|
|
2106
|
+
const hasHadEventsRef = reactExports.useRef(false);
|
|
2107
|
+
if (sortedEvents.length > 0) {
|
|
2108
|
+
hasHadEventsRef.current = true;
|
|
1928
2109
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
const
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2110
|
+
const isInitialLoad = isLoading && !hasHadEventsRef.current;
|
|
2111
|
+
const isRefetching = isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
|
|
2112
|
+
const selectedIndex = selectedEventId ? rows.findIndex((row) => row.event.eventId === selectedEventId) : -1;
|
|
2113
|
+
const moveSelection = reactExports.useCallback((delta) => {
|
|
2114
|
+
var _a;
|
|
2115
|
+
if (rows.length === 0)
|
|
2116
|
+
return;
|
|
2117
|
+
const nextIndex = selectedIndex === -1 ? 0 : Math.min(Math.max(selectedIndex + delta, 0), rows.length - 1);
|
|
2118
|
+
const next = rows[nextIndex].event;
|
|
2119
|
+
setSelectedEventId(next.eventId);
|
|
2120
|
+
const itemIndex = listItems.findIndex((item) => item.kind === "event" && item.row.event.eventId === next.eventId);
|
|
2121
|
+
if (itemIndex >= 0) {
|
|
2122
|
+
(_a = virtuosoRef.current) == null ? void 0 : _a.scrollIntoView({ index: itemIndex });
|
|
2123
|
+
}
|
|
2124
|
+
requestAnimationFrame(() => {
|
|
2125
|
+
var _a2, _b;
|
|
2126
|
+
(_b = (_a2 = bodyRef.current) == null ? void 0 : _a2.querySelector(`[data-event-id="${CSS.escape(next.eventId)}"]`)) == null ? void 0 : _b.focus();
|
|
2127
|
+
});
|
|
2128
|
+
}, [selectedIndex, rows, listItems]);
|
|
2129
|
+
const handleListKeyDown = reactExports.useCallback((e) => {
|
|
2130
|
+
if (selectedIndex !== -1)
|
|
2131
|
+
return;
|
|
2132
|
+
if (e.key === "ArrowDown" || e.key === "j" || e.key === "ArrowUp" || e.key === "k") {
|
|
2133
|
+
e.preventDefault();
|
|
2134
|
+
moveSelection(1);
|
|
1953
2135
|
}
|
|
1954
|
-
|
|
2136
|
+
}, [selectedIndex, moveSelection]);
|
|
2137
|
+
const panelWidth = useDetailPanelWidth(bodyRef, selectedRow !== void 0);
|
|
2138
|
+
const toolbar = jsxRuntimeExports.jsx(EventListToolbar, { query, onQueryChange: setQuery });
|
|
2139
|
+
if (isInitialLoad) {
|
|
2140
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col overflow-hidden bg-background-100", children: [toolbar, jsxRuntimeExports.jsx(EventListHeader, { showOccurred: showSeparateEventOccurrenceTimestamps, sortOrder, onSortOrderChange: handleSortOrderChange }), jsxRuntimeExports.jsx(EventRowsSkeleton, {})] });
|
|
1955
2141
|
}
|
|
1956
|
-
return {
|
|
2142
|
+
return jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: onDecrypt ? {
|
|
2143
|
+
onDecrypt,
|
|
2144
|
+
isDecrypting,
|
|
2145
|
+
isDecryptDisabled,
|
|
2146
|
+
decryptDisabledReason
|
|
2147
|
+
} : void 0, children: jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col overflow-hidden bg-background-100", children: [toolbar, jsxRuntimeExports.jsxs("div", { ref: bodyRef, className: "flex min-h-0 flex-1", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-w-0 flex-1 flex-col", onKeyDown: handleListKeyDown, children: [jsxRuntimeExports.jsx(EventListHeader, { showOccurred: showSeparateEventOccurrenceTimestamps, sortOrder, onSortOrderChange: handleSortOrderChange }), isRefetching || search.status === "loading" ? jsxRuntimeExports.jsx(EventRowsSkeleton, {}) : rows.length === 0 ? jsxRuntimeExports.jsx("div", { className: "flex flex-1 items-center justify-center px-6 text-center text-copy-14 text-gray-900", children: getEmptyMessage(search) }) : jsxRuntimeExports.jsx(es, { ref: virtuosoRef, totalCount: listItems.length, overscan: 20, defaultItemHeight: 25, computeItemKey: (i) => {
|
|
2148
|
+
const item = listItems[i];
|
|
2149
|
+
return item.kind === "gap" ? item.key : item.row.event.eventId;
|
|
2150
|
+
}, endReached: () => {
|
|
2151
|
+
if (list.hasMore && !isLoadingMoreEvents) {
|
|
2152
|
+
void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
|
|
2153
|
+
}
|
|
2154
|
+
}, components: { Footer: () => jsxRuntimeExports.jsx("div", { className: "h-2" }) }, itemContent: (i) => {
|
|
2155
|
+
const item = listItems[i];
|
|
2156
|
+
if (item.kind === "gap") {
|
|
2157
|
+
return jsxRuntimeExports.jsx(IdleGapRow, { ms: item.ms, reason: item.reason });
|
|
2158
|
+
}
|
|
2159
|
+
const { row } = item;
|
|
2160
|
+
const isSelected = selectedEventId === row.event.eventId;
|
|
2161
|
+
return jsxRuntimeExports.jsx(EventRow, { row, index: item.index, isSelected, isTabStop: selectedIndex === -1 ? item.index === 0 : isSelected, isRelated: relatedKey !== null && row.entity.key === relatedKey, onSelect: toggleSelectedEvent, showSeparateEventOccurrenceTimestamps });
|
|
2162
|
+
}, style: { flex: 1, minHeight: 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, {
|
|
2163
|
+
total: sortedEvents.length,
|
|
2164
|
+
hasMoreEvents
|
|
2165
|
+
}) }), 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(LoadMoreButton, { loading: isLoadingMoreEvents, onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()) }) }) })] })] }), 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] })] }) });
|
|
1957
2166
|
}
|
|
1958
|
-
function
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2167
|
+
function EventListView(props) {
|
|
2168
|
+
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(EventListViewInner, { ...props }) }) });
|
|
2169
|
+
}
|
|
2170
|
+
function ConversationView({ messages }) {
|
|
2171
|
+
if (messages.length === 0) {
|
|
2172
|
+
return jsxRuntimeExports.jsx("div", { className: "py-8 text-center text-[11px] text-gray-600", children: "No messages" });
|
|
1964
2173
|
}
|
|
1965
|
-
return
|
|
2174
|
+
return jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3 p-3", children: messages.map((message, index) => jsxRuntimeExports.jsx(MessageBubble, { message }, index)) });
|
|
1966
2175
|
}
|
|
1967
|
-
function
|
|
1968
|
-
const
|
|
1969
|
-
const
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
2176
|
+
function MessageBubble({ message }) {
|
|
2177
|
+
const role = message.role;
|
|
2178
|
+
const parts = parseContent(message.content);
|
|
2179
|
+
const roleClasses = getRoleClasses(role);
|
|
2180
|
+
return jsxRuntimeExports.jsxs("div", { className: `rounded-md border text-[11px] ${roleClasses.bubble}`, children: [jsxRuntimeExports.jsx("div", { className: `border-b px-2.5 py-1 font-medium text-[10px] uppercase tracking-wide ${roleClasses.label}`, children: role }), jsxRuntimeExports.jsx("div", { className: "px-2.5 py-2 space-y-2", children: parts.map((part, i) => jsxRuntimeExports.jsx(ContentPart, { part, role }, i)) })] });
|
|
2181
|
+
}
|
|
2182
|
+
function ContentPart({ part, role }) {
|
|
2183
|
+
if (part.type === "text") {
|
|
2184
|
+
if (!part.text)
|
|
2185
|
+
return null;
|
|
2186
|
+
if (role === "assistant") {
|
|
2187
|
+
return jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none text-[11px] text-gray-1000 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children: jsxRuntimeExports.jsx(Ui, { children: part.text }) });
|
|
2188
|
+
}
|
|
2189
|
+
return jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap break-words text-gray-1000", children: part.text });
|
|
1974
2190
|
}
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
}
|
|
2191
|
+
if (part.type === "tool-call") {
|
|
2192
|
+
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-purple-300 bg-purple-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "🔧" }), jsxRuntimeExports.jsx("span", { className: "text-purple-900", children: part.toolName })] }), part.input != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 overflow-x-auto rounded bg-gray-100 p-1.5", children: typeof part.input === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.input }) : jsxRuntimeExports.jsx(DataInspector, { data: part.input }) })] });
|
|
2193
|
+
}
|
|
2194
|
+
if (part.type === "tool-result") {
|
|
2195
|
+
return jsxRuntimeExports.jsxs("div", { className: "rounded border border-green-300 bg-green-100 px-2 py-1.5", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-medium", children: [jsxRuntimeExports.jsx("span", { children: "✓" }), jsxRuntimeExports.jsxs("span", { className: "text-green-900", children: [part.toolName, " result"] })] }), part.output != null && jsxRuntimeExports.jsx("div", { className: "mt-1.5 max-h-[200px] overflow-x-auto overflow-y-auto rounded bg-gray-100 p-1.5", children: typeof part.output === "string" ? jsxRuntimeExports.jsx("pre", { className: "text-[10px] text-gray-800", children: part.output }) : jsxRuntimeExports.jsx(DataInspector, { data: part.output, expandLevel: 1 }) })] });
|
|
2196
|
+
}
|
|
2197
|
+
return null;
|
|
1981
2198
|
}
|
|
1982
|
-
function
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2199
|
+
function getRoleClasses(role) {
|
|
2200
|
+
switch (role) {
|
|
2201
|
+
case "user":
|
|
2202
|
+
return {
|
|
2203
|
+
bubble: "border-blue-300 bg-blue-100",
|
|
2204
|
+
label: "border-blue-300 text-blue-700"
|
|
2205
|
+
};
|
|
2206
|
+
case "assistant":
|
|
2207
|
+
return {
|
|
2208
|
+
bubble: "border-gray-300 bg-gray-100",
|
|
2209
|
+
label: "border-gray-300 text-gray-700"
|
|
2210
|
+
};
|
|
2211
|
+
case "system":
|
|
2212
|
+
return {
|
|
2213
|
+
bubble: "border-amber-300 bg-amber-100",
|
|
2214
|
+
label: "border-amber-300 text-amber-700"
|
|
2215
|
+
};
|
|
2216
|
+
case "tool":
|
|
2217
|
+
return {
|
|
2218
|
+
bubble: "border-green-300 bg-green-100",
|
|
2219
|
+
label: "border-green-300 text-green-700"
|
|
2220
|
+
};
|
|
2221
|
+
default:
|
|
2222
|
+
return {
|
|
2223
|
+
bubble: "border-gray-300 bg-gray-100",
|
|
2224
|
+
label: "border-gray-300 text-gray-700"
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
1998
2227
|
}
|
|
1999
|
-
function
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2228
|
+
function parseContent(content) {
|
|
2229
|
+
if (typeof content === "string") {
|
|
2230
|
+
return [{ type: "text", text: content }];
|
|
2231
|
+
}
|
|
2232
|
+
if (Array.isArray(content)) {
|
|
2233
|
+
return content.map((part) => {
|
|
2234
|
+
if (typeof part === "string") {
|
|
2235
|
+
return { type: "text", text: part };
|
|
2236
|
+
}
|
|
2237
|
+
if ((part == null ? void 0 : part.type) === "text") {
|
|
2238
|
+
return { type: "text", text: String(part.text ?? "") };
|
|
2239
|
+
}
|
|
2240
|
+
if ((part == null ? void 0 : part.type) === "tool-call") {
|
|
2241
|
+
return {
|
|
2242
|
+
type: "tool-call",
|
|
2243
|
+
toolName: part.toolName,
|
|
2244
|
+
input: part.input
|
|
2245
|
+
};
|
|
2246
|
+
}
|
|
2247
|
+
if ((part == null ? void 0 : part.type) === "tool-result") {
|
|
2248
|
+
return {
|
|
2249
|
+
type: "tool-result",
|
|
2250
|
+
toolName: part.toolName,
|
|
2251
|
+
output: part.output
|
|
2252
|
+
};
|
|
2020
2253
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2254
|
+
return { type: "text", text: "" };
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
return [];
|
|
2025
2258
|
}
|
|
2026
2259
|
const ROWS = [
|
|
2027
2260
|
{
|
|
@@ -2121,26 +2354,6 @@ function useLoadMoreOnScroll(loadMore, { hasMore, isLoadingMore, rootRef, rootMa
|
|
|
2121
2354
|
}, [entry == null ? void 0 : entry.isIntersecting, hasMore, isLoadingMore]);
|
|
2122
2355
|
return sentinelRef;
|
|
2123
2356
|
}
|
|
2124
|
-
const kbdVariants = cva("inline-flex items-center justify-center rounded px-1 text-center font-sans", {
|
|
2125
|
-
variants: {
|
|
2126
|
-
variant: {
|
|
2127
|
-
subtle: "bg-background-100/20",
|
|
2128
|
-
outline: "border border-gray-alpha-400 bg-background-100 font-medium text-gray-900"
|
|
2129
|
-
},
|
|
2130
|
-
size: {
|
|
2131
|
-
default: "h-5 min-w-5 text-label-12 leading-none",
|
|
2132
|
-
compact: "h-4 min-h-4 min-w-4 text-[11px] leading-none",
|
|
2133
|
-
search: "h-5 min-h-5 min-w-5 text-label-13 leading-[1.7em]"
|
|
2134
|
-
}
|
|
2135
|
-
},
|
|
2136
|
-
defaultVariants: {
|
|
2137
|
-
variant: "subtle",
|
|
2138
|
-
size: "default"
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
function Kbd({ children, className, variant, size, ...props }) {
|
|
2142
|
-
return jsxRuntimeExports.jsx("kbd", { className: cn(kbdVariants({ variant, size, className })), ...props, children });
|
|
2143
|
-
}
|
|
2144
2357
|
function TabButton({ active, onClick, children }) {
|
|
2145
2358
|
return jsxRuntimeExports.jsx("button", { type: "button", role: "tab", "aria-selected": active, tabIndex: active ? 0 : -1, onClick, className: "px-3 py-1.5 text-[11px] font-medium transition-colors -mb-px", style: {
|
|
2146
2359
|
// Explicit styles to prevent app-level button overrides when web-shared
|
|
@@ -3088,168 +3301,6 @@ function EntityDetailPanel({ run, onStreamClick, onRunClick, fetchSpanDetail, on
|
|
|
3088
3301
|
hasEncryptedData
|
|
3089
3302
|
} : 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.jsxs(Button, { variant: "secondary", size: "small", className: "w-full", onClick: handleWakeUp, disabled: stoppingSleep, "aria-busy": stoppingSleep, children: [stoppingSleep ? jsxRuntimeExports.jsx(Spinner, { size: 16 }) : null, "Wake Up Sleep"] }), resource === "hook" && canResolveHook && jsxRuntimeExports.jsxs(Button, { variant: "secondary", size: "small", className: "w-full", onClick: () => setShowResolveHookModal(true), disabled: resolvingHook, "aria-busy": resolvingHook, children: [resolvingHook ? jsxRuntimeExports.jsx(Spinner, { size: 16 }) : null, "Resolve Hook"] })] }), jsxRuntimeExports.jsx(AttributePanel, { data: displayData, moduleSpecifier, moduleSourceUrl, expiredAt: run.expiredAt, isLoading: loading, error: error ?? void 0, onStreamClick, onRunClick, onDecrypt, isDecrypting, isDecryptDisabled, decryptDisabledReason, resource }), rawEvents && jsxRuntimeExports.jsx(EventsList, { events: rawEvents, onLoadEventData, onStreamClick, onRunClick, encryptionKey, showSeparateEventOccurrenceTimestamps, duplicateEventIds: selectedSpan == null ? void 0 : selectedSpan.duplicateEventIds })] }) }), jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: showResolveHookModal, onClose: () => setShowResolveHookModal(false), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
3090
3303
|
}
|
|
3091
|
-
const PANEL_MIN_WIDTH = 280;
|
|
3092
|
-
const PANEL_HARD_MAX_WIDTH = 1300;
|
|
3093
|
-
const PANEL_DEFAULT_WIDTH = 360;
|
|
3094
|
-
const MAIN_MIN_WIDTH = 400;
|
|
3095
|
-
const PANEL_WIDTH_STORAGE_KEY = "workflow-trace-detail-panel-width";
|
|
3096
|
-
function clamp(value, min, max) {
|
|
3097
|
-
return Math.min(Math.max(value, min), max);
|
|
3098
|
-
}
|
|
3099
|
-
function computeMaxPanelWidth(availableWidth) {
|
|
3100
|
-
if (availableWidth <= 0)
|
|
3101
|
-
return PANEL_HARD_MAX_WIDTH;
|
|
3102
|
-
return Math.min(Math.max(availableWidth - MAIN_MIN_WIDTH, 0), PANEL_HARD_MAX_WIDTH);
|
|
3103
|
-
}
|
|
3104
|
-
function clampPanelWidth(width, availableWidth) {
|
|
3105
|
-
return clamp(width, PANEL_MIN_WIDTH, computeMaxPanelWidth(availableWidth));
|
|
3106
|
-
}
|
|
3107
|
-
function readStoredPanelWidth() {
|
|
3108
|
-
if (typeof window === "undefined")
|
|
3109
|
-
return PANEL_DEFAULT_WIDTH;
|
|
3110
|
-
try {
|
|
3111
|
-
const raw = window.localStorage.getItem(PANEL_WIDTH_STORAGE_KEY);
|
|
3112
|
-
const value = raw ? Number(raw) : Number.NaN;
|
|
3113
|
-
if (!Number.isFinite(value))
|
|
3114
|
-
return PANEL_DEFAULT_WIDTH;
|
|
3115
|
-
return clamp(value, PANEL_MIN_WIDTH, PANEL_HARD_MAX_WIDTH);
|
|
3116
|
-
} catch {
|
|
3117
|
-
return PANEL_DEFAULT_WIDTH;
|
|
3118
|
-
}
|
|
3119
|
-
}
|
|
3120
|
-
function writeStoredPanelWidth(width) {
|
|
3121
|
-
if (typeof window === "undefined")
|
|
3122
|
-
return;
|
|
3123
|
-
try {
|
|
3124
|
-
window.localStorage.setItem(PANEL_WIDTH_STORAGE_KEY, String(Math.round(width)));
|
|
3125
|
-
} catch {
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
function DraggableBorder({ element, position, onWidthChange, onReset, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow }) {
|
|
3129
|
-
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
3130
|
-
const pointerIdRef = reactExports.useRef(null);
|
|
3131
|
-
const startXRef = reactExports.useRef(0);
|
|
3132
|
-
const startWidthRef = reactExports.useRef(0);
|
|
3133
|
-
const pendingWidthRef = reactExports.useRef(0);
|
|
3134
|
-
const rafRef = reactExports.useRef(null);
|
|
3135
|
-
const movedRef = reactExports.useRef(false);
|
|
3136
|
-
const lastDragEndAtRef = reactExports.useRef(0);
|
|
3137
|
-
reactExports.useEffect(() => {
|
|
3138
|
-
return () => {
|
|
3139
|
-
if (rafRef.current)
|
|
3140
|
-
cancelAnimationFrame(rafRef.current);
|
|
3141
|
-
};
|
|
3142
|
-
}, []);
|
|
3143
|
-
reactExports.useEffect(() => {
|
|
3144
|
-
if (!isDragging)
|
|
3145
|
-
return;
|
|
3146
|
-
const previous = document.body.style.userSelect;
|
|
3147
|
-
document.body.style.userSelect = "none";
|
|
3148
|
-
return () => {
|
|
3149
|
-
document.body.style.userSelect = previous;
|
|
3150
|
-
};
|
|
3151
|
-
}, [isDragging]);
|
|
3152
|
-
const stopDrag = () => {
|
|
3153
|
-
pointerIdRef.current = null;
|
|
3154
|
-
setIsDragging(false);
|
|
3155
|
-
if (rafRef.current) {
|
|
3156
|
-
cancelAnimationFrame(rafRef.current);
|
|
3157
|
-
rafRef.current = null;
|
|
3158
|
-
if (movedRef.current)
|
|
3159
|
-
onWidthChange(pendingWidthRef.current);
|
|
3160
|
-
}
|
|
3161
|
-
if (movedRef.current) {
|
|
3162
|
-
movedRef.current = false;
|
|
3163
|
-
lastDragEndAtRef.current = performance.now();
|
|
3164
|
-
}
|
|
3165
|
-
};
|
|
3166
|
-
const handlePointerDown = (e) => {
|
|
3167
|
-
if (pointerIdRef.current !== null)
|
|
3168
|
-
return;
|
|
3169
|
-
const el = element.current;
|
|
3170
|
-
if (!el)
|
|
3171
|
-
return;
|
|
3172
|
-
if (e.pointerType === "mouse" && e.button !== 0)
|
|
3173
|
-
return;
|
|
3174
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
3175
|
-
pointerIdRef.current = e.pointerId;
|
|
3176
|
-
startXRef.current = e.clientX;
|
|
3177
|
-
startWidthRef.current = el.offsetWidth;
|
|
3178
|
-
movedRef.current = false;
|
|
3179
|
-
setIsDragging(true);
|
|
3180
|
-
};
|
|
3181
|
-
const handlePointerMove = (e) => {
|
|
3182
|
-
if (pointerIdRef.current !== e.pointerId)
|
|
3183
|
-
return;
|
|
3184
|
-
if (Math.abs(e.clientX - startXRef.current) > 4) {
|
|
3185
|
-
movedRef.current = true;
|
|
3186
|
-
}
|
|
3187
|
-
const delta = position === "left" ? startXRef.current - e.clientX : e.clientX - startXRef.current;
|
|
3188
|
-
pendingWidthRef.current = startWidthRef.current + delta;
|
|
3189
|
-
if (!rafRef.current) {
|
|
3190
|
-
rafRef.current = requestAnimationFrame(() => {
|
|
3191
|
-
rafRef.current = null;
|
|
3192
|
-
onWidthChange(pendingWidthRef.current);
|
|
3193
|
-
});
|
|
3194
|
-
}
|
|
3195
|
-
};
|
|
3196
|
-
const handlePointerEnd = (e) => {
|
|
3197
|
-
if (pointerIdRef.current !== e.pointerId)
|
|
3198
|
-
return;
|
|
3199
|
-
stopDrag();
|
|
3200
|
-
};
|
|
3201
|
-
const handleLostPointerCapture = (e) => {
|
|
3202
|
-
if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current) {
|
|
3203
|
-
return;
|
|
3204
|
-
}
|
|
3205
|
-
stopDrag();
|
|
3206
|
-
};
|
|
3207
|
-
const handleDoubleClick = () => {
|
|
3208
|
-
if (movedRef.current || performance.now() - lastDragEndAtRef.current < 500) {
|
|
3209
|
-
return;
|
|
3210
|
-
}
|
|
3211
|
-
onReset == null ? void 0 : onReset();
|
|
3212
|
-
};
|
|
3213
|
-
const handleKeyDown = (e) => {
|
|
3214
|
-
const el = element.current;
|
|
3215
|
-
if (!el)
|
|
3216
|
-
return;
|
|
3217
|
-
const step = e.shiftKey ? 64 : 16;
|
|
3218
|
-
const grow = position === "left" ? 1 : -1;
|
|
3219
|
-
let next = null;
|
|
3220
|
-
if (e.key === "ArrowLeft") {
|
|
3221
|
-
next = el.offsetWidth + grow * step;
|
|
3222
|
-
} else if (e.key === "ArrowRight") {
|
|
3223
|
-
next = el.offsetWidth - grow * step;
|
|
3224
|
-
} else if (e.key === "Home" && ariaValueMin !== void 0) {
|
|
3225
|
-
next = ariaValueMin;
|
|
3226
|
-
} else if (e.key === "End" && ariaValueMax !== void 0) {
|
|
3227
|
-
next = ariaValueMax;
|
|
3228
|
-
}
|
|
3229
|
-
if (next === null)
|
|
3230
|
-
return;
|
|
3231
|
-
e.preventDefault();
|
|
3232
|
-
onWidthChange(next);
|
|
3233
|
-
};
|
|
3234
|
-
return jsxRuntimeExports.jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, tabIndex: 0, className: cn("group absolute inset-y-0 z-10 w-[17px] cursor-col-resize touch-none outline-none", position === "left" ? "-left-2" : "-right-2"), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerEnd, onPointerCancel: handlePointerEnd, onLostPointerCapture: handleLostPointerCapture, onDoubleClick: handleDoubleClick, onKeyDown: handleKeyDown, children: jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: cn("pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors delay-75 duration-100", "group-hover:bg-gray-500 group-focus-visible:bg-[var(--ds-focus-color)]", isDragging && "bg-gray-500") }) });
|
|
3235
|
-
}
|
|
3236
|
-
function useElementWidth(ref, enabled = true) {
|
|
3237
|
-
const [width, setWidth] = reactExports.useState(0);
|
|
3238
|
-
reactExports.useLayoutEffect(() => {
|
|
3239
|
-
if (!enabled)
|
|
3240
|
-
return;
|
|
3241
|
-
const el = ref.current;
|
|
3242
|
-
if (!el)
|
|
3243
|
-
return;
|
|
3244
|
-
setWidth(Math.round(el.getBoundingClientRect().width));
|
|
3245
|
-
const observer = new ResizeObserver(([entry]) => {
|
|
3246
|
-
setWidth(Math.round((entry == null ? void 0 : entry.contentRect.width) ?? 0));
|
|
3247
|
-
});
|
|
3248
|
-
observer.observe(el);
|
|
3249
|
-
return () => observer.disconnect();
|
|
3250
|
-
}, [ref, enabled]);
|
|
3251
|
-
return width;
|
|
3252
|
-
}
|
|
3253
3304
|
const DETAIL_PANEL_ID = "trace-detail-panel";
|
|
3254
3305
|
function useSelectedSpanInfo() {
|
|
3255
3306
|
const { activeSpan } = useActiveSpan();
|
|
@@ -3273,17 +3324,7 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3273
3324
|
const { activeSpan, activeSpanId, spans } = useActiveSpan();
|
|
3274
3325
|
const sidebar = useSidebarData();
|
|
3275
3326
|
const selectedSpan = useSelectedSpanInfo();
|
|
3276
|
-
const
|
|
3277
|
-
const [storedWidth, setStoredWidth] = reactExports.useState(() => readStoredPanelWidth());
|
|
3278
|
-
const containerWidth = useElementWidth(containerRef, isOpen);
|
|
3279
|
-
const asideRef = reactExports.useRef(null);
|
|
3280
|
-
const handleResize = reactExports.useCallback((next) => {
|
|
3281
|
-
const clamped = clampPanelWidth(next, containerWidth);
|
|
3282
|
-
setStoredWidth(clamped);
|
|
3283
|
-
writeStoredPanelWidth(clamped);
|
|
3284
|
-
}, [containerWidth]);
|
|
3285
|
-
const panelWidth = clampPanelWidth(storedWidth, containerWidth);
|
|
3286
|
-
const panelMaxWidth = Math.max(PANEL_MIN_WIDTH, computeMaxPanelWidth(containerWidth));
|
|
3327
|
+
const panelWidth = useDetailPanelWidth(containerRef, Boolean(activeSpan));
|
|
3287
3328
|
const { prevSpanId, nextSpanId } = reactExports.useMemo(() => {
|
|
3288
3329
|
var _a, _b;
|
|
3289
3330
|
if (!activeSpanId)
|
|
@@ -3304,26 +3345,6 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3304
3345
|
if (nextSpanId)
|
|
3305
3346
|
onNavigateToSpan(nextSpanId);
|
|
3306
3347
|
}, [nextSpanId, onNavigateToSpan]);
|
|
3307
|
-
reactExports.useEffect(() => {
|
|
3308
|
-
if (!isOpen)
|
|
3309
|
-
return;
|
|
3310
|
-
const onKeyDown = (e) => {
|
|
3311
|
-
if (e.key !== "j" && e.key !== "k" && e.key !== "ArrowDown" && e.key !== "ArrowUp") {
|
|
3312
|
-
return;
|
|
3313
|
-
}
|
|
3314
|
-
const target = e.target;
|
|
3315
|
-
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || (target == null ? void 0 : target.isContentEditable)) {
|
|
3316
|
-
return;
|
|
3317
|
-
}
|
|
3318
|
-
const targetId = e.key === "k" || e.key === "ArrowUp" ? prevSpanId : nextSpanId;
|
|
3319
|
-
if (targetId) {
|
|
3320
|
-
e.preventDefault();
|
|
3321
|
-
onNavigateToSpan(targetId);
|
|
3322
|
-
}
|
|
3323
|
-
};
|
|
3324
|
-
window.addEventListener("keydown", onKeyDown);
|
|
3325
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
3326
|
-
}, [isOpen, prevSpanId, nextSpanId, onNavigateToSpan]);
|
|
3327
3348
|
const selectedSpanName = reactExports.useMemo(() => {
|
|
3328
3349
|
var _a, _b;
|
|
3329
3350
|
if (!(selectedSpan == null ? void 0 : selectedSpan.data))
|
|
@@ -3338,55 +3359,8 @@ function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
|
3338
3359
|
}, [selectedSpan == null ? void 0 : selectedSpan.data, selectedSpan == null ? void 0 : selectedSpan.resource]);
|
|
3339
3360
|
if (!activeSpan)
|
|
3340
3361
|
return null;
|
|
3341
|
-
return jsxRuntimeExports.
|
|
3342
|
-
}
|
|
3343
|
-
const WorkflowIcon = () => {
|
|
3344
|
-
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" }) });
|
|
3345
|
-
};
|
|
3346
|
-
const WebhookIcon = () => {
|
|
3347
|
-
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" }) });
|
|
3348
|
-
};
|
|
3349
|
-
const SleepIcon = () => {
|
|
3350
|
-
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" }) });
|
|
3351
|
-
};
|
|
3352
|
-
const StepForwardIcon = () => {
|
|
3353
|
-
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" }) });
|
|
3354
|
-
};
|
|
3355
|
-
const eventStyles = {
|
|
3356
|
-
run: { icon: WorkflowIcon, className: "text-blue-900", label: "Workflow" },
|
|
3357
|
-
step: { icon: StepForwardIcon, className: "text-green-900", label: "Step" },
|
|
3358
|
-
hook: { icon: WebhookIcon, className: "text-gray-900", label: "Hook" },
|
|
3359
|
-
sleep: { icon: SleepIcon, className: "text-gray-900", label: "Sleep" }
|
|
3360
|
-
};
|
|
3361
|
-
const defaultStyle = {
|
|
3362
|
-
icon: Circle,
|
|
3363
|
-
className: "text-gray-900",
|
|
3364
|
-
label: "Event"
|
|
3365
|
-
};
|
|
3366
|
-
const ROW_HEIGHT_CLASS = "h-10";
|
|
3367
|
-
function getEventStyle(resource, isErrored, isCancelled) {
|
|
3368
|
-
const style = eventStyles[resource] ?? defaultStyle;
|
|
3369
|
-
return {
|
|
3370
|
-
icon: style.icon,
|
|
3371
|
-
className: cn(isErrored ? "text-red-900" : isCancelled ? "text-gray-900" : style.className),
|
|
3372
|
-
label: style.label
|
|
3373
|
-
};
|
|
3374
|
-
}
|
|
3375
|
-
const EventRow = ({ span, isSelected, isDimmed, onSelectSpan }) => {
|
|
3376
|
-
const durationMs = getSpanDurationMs(span);
|
|
3377
|
-
const isErrored = isSpanErrored(span);
|
|
3378
|
-
const isCancelled = isSpanCancelled(span);
|
|
3379
|
-
const { icon: Icon, className: tagClassName, label: iconLabel } = getEventStyle(span.resource, isErrored, isCancelled);
|
|
3380
|
-
return jsxRuntimeExports.jsx("li", { className: cn("relative overflow-clip group transition-opacity", ROW_HEIGHT_CLASS, isDimmed && "opacity-35"), role: "treeitem", "aria-selected": isSelected, "aria-expanded": isSelected, "aria-level": 1, onClick: () => onSelectSpan(span.spanId), children: jsxRuntimeExports.jsx("div", { className: "h-full hover:bg-gray-100 group-aria-selected:bg-gray-100 group-aria-selected:hover:bg-gray-200", 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.jsxs(Tooltip, { delayDuration: 500, children: [jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: jsxRuntimeExports.jsx("span", { className: cn("shrink-0", tagClassName), children: jsxRuntimeExports.jsx(Icon, { className: "w-4 h-4" }) }) }), jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: iconLabel })] }), 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) }) })] }) }) });
|
|
3381
|
-
};
|
|
3382
|
-
const EventList = ({ spans, activeSpanId, searchResult, onSelectSpan }) => {
|
|
3383
|
-
const listRef = reactExports.useRef(null);
|
|
3384
|
-
const { start, end } = useRowWindow(listRef, spans.length, ROW_HEIGHT_PX);
|
|
3385
|
-
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: {
|
|
3386
|
-
paddingTop: start * ROW_HEIGHT_PX,
|
|
3387
|
-
paddingBottom: (spans.length - end) * ROW_HEIGHT_PX
|
|
3388
|
-
}, children: spans.slice(start, end).map((span) => jsxRuntimeExports.jsx(EventRow, { span, isSelected: span.spanId === activeSpanId, isDimmed: isSpanDimmedBySearch(span.spanId, searchResult), onSelectSpan }, span.spanId)) });
|
|
3389
|
-
};
|
|
3362
|
+
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 }) }) });
|
|
3363
|
+
}
|
|
3390
3364
|
const GUTTER_PX = 1;
|
|
3391
3365
|
const MIN_PX = 50;
|
|
3392
3366
|
const DEFAULT_START_PX = 340;
|
|
@@ -3475,42 +3449,6 @@ function TraceShortcutHelper({ hasMultipleSpans, reducedMotion }) {
|
|
|
3475
3449
|
};
|
|
3476
3450
|
return jsxRuntimeExports.jsxs("div", { className: "group pointer-events-auto hidden h-8 w-fit items-center gap-1 text-label-12 leading-none text-gray-900 @min-[480px]:flex", children: [jsxRuntimeExports.jsx("span", { "aria-live": "polite", "aria-atomic": "true", className: "inline-flex items-center whitespace-nowrap", children: reducedMotion ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx("span", { className: `inline-flex items-center ${styles.hint}`, children: index === 0 ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx(NavHint, {}) }, index) }), jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none", onClick: dismiss, "aria-label": "Dismiss trace shortcuts helper", children: jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })] });
|
|
3477
3451
|
}
|
|
3478
|
-
function isAltModifierKey(key) {
|
|
3479
|
-
return key === "Alt" || key === "AltGraph";
|
|
3480
|
-
}
|
|
3481
|
-
function isTypingTarget(target) {
|
|
3482
|
-
return target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
3483
|
-
}
|
|
3484
|
-
function useAltHeld() {
|
|
3485
|
-
const [altHeld, setAltHeld] = reactExports.useState(false);
|
|
3486
|
-
reactExports.useEffect(() => {
|
|
3487
|
-
const onKeyDown = (e) => {
|
|
3488
|
-
if (!isAltModifierKey(e.key))
|
|
3489
|
-
return;
|
|
3490
|
-
if (!isTypingTarget(e.target)) {
|
|
3491
|
-
e.preventDefault();
|
|
3492
|
-
}
|
|
3493
|
-
setAltHeld(true);
|
|
3494
|
-
};
|
|
3495
|
-
const onKeyUp = (e) => {
|
|
3496
|
-
if (isAltModifierKey(e.key))
|
|
3497
|
-
setAltHeld(false);
|
|
3498
|
-
};
|
|
3499
|
-
const onBlur = () => setAltHeld(false);
|
|
3500
|
-
const onPointerMove = (e) => setAltHeld(e.altKey);
|
|
3501
|
-
window.addEventListener("keydown", onKeyDown, true);
|
|
3502
|
-
window.addEventListener("keyup", onKeyUp, true);
|
|
3503
|
-
window.addEventListener("blur", onBlur);
|
|
3504
|
-
window.addEventListener("pointermove", onPointerMove, true);
|
|
3505
|
-
return () => {
|
|
3506
|
-
window.removeEventListener("keydown", onKeyDown, true);
|
|
3507
|
-
window.removeEventListener("keyup", onKeyUp, true);
|
|
3508
|
-
window.removeEventListener("blur", onBlur);
|
|
3509
|
-
window.removeEventListener("pointermove", onPointerMove, true);
|
|
3510
|
-
};
|
|
3511
|
-
}, []);
|
|
3512
|
-
return { altHeld };
|
|
3513
|
-
}
|
|
3514
3452
|
const MIN_VIEWPORT_MS = 1e-3;
|
|
3515
3453
|
const ZOOM_DEBOUNCE_MS = 150;
|
|
3516
3454
|
function useAnimatedViewport(initial) {
|
|
@@ -3565,12 +3503,17 @@ function useAnimatedViewport(initial) {
|
|
|
3565
3503
|
reactExports.useEffect(() => cancel, [cancel]);
|
|
3566
3504
|
return { viewport, setViewport, animateTo };
|
|
3567
3505
|
}
|
|
3568
|
-
function TraceViewer$1({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
3569
|
-
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsx(ActiveSpanProvider, { spans: trace.spans, children: jsxRuntimeExports.jsx(TraceViewerContent, { trace, onLoadMore, hasMore, isLoadingMore }) }) });
|
|
3506
|
+
function TraceViewer$1({ trace, onLoadMore, hasMore, isLoadingMore, initialSelectedSpanId }) {
|
|
3507
|
+
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsx(ActiveSpanProvider, { spans: trace.spans, initialSelectedSpanId, children: jsxRuntimeExports.jsx(TraceViewerContent, { trace, onLoadMore, hasMore, isLoadingMore }) }) });
|
|
3570
3508
|
}
|
|
3571
3509
|
function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
3572
3510
|
const { activeSpanId, setActiveSpan, clearActiveSpan } = useActiveSpan();
|
|
3573
3511
|
const reducedMotion = useReducedMotion();
|
|
3512
|
+
const [isLanding, setIsLanding] = reactExports.useState(activeSpanId !== null);
|
|
3513
|
+
reactExports.useEffect(() => {
|
|
3514
|
+
const timer = setTimeout(() => setIsLanding(false), 1e3);
|
|
3515
|
+
return () => clearTimeout(timer);
|
|
3516
|
+
}, []);
|
|
3574
3517
|
const [searchQuery, setSearchQuery] = reactExports.useState("");
|
|
3575
3518
|
const deferredSearchQuery = reactExports.useDeferredValue(searchQuery);
|
|
3576
3519
|
const paneRootRef = reactExports.useRef(null);
|
|
@@ -3711,15 +3654,6 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3711
3654
|
}, ZOOM_DEBOUNCE_MS);
|
|
3712
3655
|
}, [setActiveSpan, scrollSpanIntoView, cancelPendingZoom, focusViewportOnSpan]);
|
|
3713
3656
|
const { altHeld } = useAltHeld();
|
|
3714
|
-
reactExports.useEffect(() => {
|
|
3715
|
-
const onKeyDown = (e) => {
|
|
3716
|
-
if (e.key === "Escape") {
|
|
3717
|
-
handleClearActiveSpan();
|
|
3718
|
-
}
|
|
3719
|
-
};
|
|
3720
|
-
window.addEventListener("keydown", onKeyDown);
|
|
3721
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
3722
|
-
}, [handleClearActiveSpan]);
|
|
3723
3657
|
const timelineRef = reactExports.useRef(null);
|
|
3724
3658
|
const [hover, setHover] = reactExports.useState(null);
|
|
3725
3659
|
const hoverInfo = reactExports.useMemo(() => {
|
|
@@ -3786,7 +3720,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3786
3720
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
3787
3721
|
return () => el.removeEventListener("wheel", onWheel);
|
|
3788
3722
|
}, [root.duration, setViewport, clampToRoot]);
|
|
3789
|
-
return jsxRuntimeExports.jsxs("div", { ref: paneRootRef, "data-pane": "pane-root", className: "relative flex w-full h-full max-h-full", children: [jsxRuntimeExports.jsxs("div", { id: "trace-parent", className: "@container flex-1 min-w-0 grid grid-rows-[auto_1fr] h-full min-h-0 overflow-hidden relative bg-background-100", children: [jsxRuntimeExports.jsx(Minimap, { spans: trace.spans, root, viewport, minViewportMs: MIN_VIEWPORT_MS, onViewportChange: setViewport, onAnimateTo: animateTo }), jsxRuntimeExports.jsxs(SplitPane, { scrollContainerRef, startHeader: jsxRuntimeExports.jsxs("div", { className: "bg-background-100 border-b border-gray-alpha-400 h-10 min-h-10 flex items-center pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Search, { className: "w-3.5 h-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { id: "trace-viewer-search", name: "trace-viewer-search", type: "text", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: (e) => {
|
|
3723
|
+
return jsxRuntimeExports.jsxs("div", { ref: paneRootRef, "data-pane": "pane-root", className: "relative flex w-full h-full max-h-full", children: [jsxRuntimeExports.jsxs("div", { id: "trace-parent", "data-span-landing": isLanding || void 0, className: "@container flex-1 min-w-0 grid grid-rows-[auto_1fr] h-full min-h-0 overflow-hidden relative bg-background-100", children: [jsxRuntimeExports.jsx(Minimap, { spans: trace.spans, root, viewport, minViewportMs: MIN_VIEWPORT_MS, onViewportChange: setViewport, onAnimateTo: animateTo }), jsxRuntimeExports.jsxs(SplitPane, { scrollContainerRef, startHeader: jsxRuntimeExports.jsxs("div", { className: "bg-background-100 border-b border-gray-alpha-400 h-10 min-h-10 flex items-center pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Search, { className: "w-3.5 h-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { id: "trace-viewer-search", name: "trace-viewer-search", type: "text", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: (e) => {
|
|
3790
3724
|
if (e.key === "Escape" && searchQuery) {
|
|
3791
3725
|
e.preventDefault();
|
|
3792
3726
|
e.stopPropagation();
|
|
@@ -3794,7 +3728,7 @@ function TraceViewerContent({ trace, onLoadMore, hasMore, isLoadingMore }) {
|
|
|
3794
3728
|
}
|
|
3795
3729
|
}, placeholder: "Search spans...", "aria-label": "Search spans", className: "flex-1 min-w-0 bg-transparent text-label-14 text-gray-1000 placeholder:text-gray-800 outline-none" }), searchQuery && jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => setSearchQuery(""), className: "-mr-2 hidden h-full max-w-full shrink-0 cursor-pointer items-center rounded-r-md border-0 bg-transparent px-2.5 font-inherit text-label-16 text-gray-900 no-underline transition-colors duration-150 ease-in hover:text-gray-1000 focus-visible:-outline-offset-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ds-focus-color)] min-[961px]:flex", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) })] }), endHeader: jsxRuntimeExports.jsx(TimelineHeader, { markers: timeMarkers, hoverInfo }), children: [jsxRuntimeExports.jsxs("div", { className: "block overflow-visible", children: [jsxRuntimeExports.jsx(EventList, { spans: trace.spans, activeSpanId, searchResult, onSelectSpan: handleSelectSpan }), jsxRuntimeExports.jsx("div", { ref: loadMoreSentinelRef, className: "flex justify-center", children: isLoadingMore ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-label-14 text-gray-800", children: [jsxRuntimeExports.jsx(Spinner, { size: 14 }), jsxRuntimeExports.jsx("span", { children: "Loading spans…" })] }) : null })] }), jsxRuntimeExports.jsx("div", { ref: timelineRef, id: "trace-timeline", className: "@container block min-h-0 overflow-visible relative", onDoubleClick: resetZoom, onMouseMove: handleTimelineMouseMove, onMouseLeave: handleTimelineMouseLeave, children: jsxRuntimeExports.jsx(Timeline, { spans: trace.spans, viewStart: viewport.start, viewEnd: viewport.end, markers: timeMarkers, selectedId: activeSpanId, searchResult, onSelect: handleSelectSpan, onRevealTime: handleRevealTime, hover, altHeld }) }), jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TraceShortcutHelper, { hasMultipleSpans: trace.spans.length > 1, reducedMotion }), jsxRuntimeExports.jsxs("div", { className: "pointer-events-auto flex items-center border border-gray-alpha-400 rounded-md bg-background-100 shadow-sm overflow-hidden divide-x divide-gray-alpha-400", children: [jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomOut, disabled: isAtMinZoom, "aria-label": "Zoom out", children: jsxRuntimeExports.jsx(ZoomOut, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: resetZoom, "aria-label": "Reset zoom", children: jsxRuntimeExports.jsx(RotateCcw, { className: "w-3.5 h-3.5" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomIn, disabled: isAtMaxZoom, "aria-label": "Zoom in", children: jsxRuntimeExports.jsx(ZoomIn, { className: "w-4 h-4" }) })] })] })] })] }), jsxRuntimeExports.jsx(TraceDetailPanel, { containerRef: paneRootRef, onNavigateToSpan: navigateToSpan, onClose: handleClearActiveSpan })] });
|
|
3796
3730
|
}
|
|
3797
|
-
const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes }) => {
|
|
3731
|
+
const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes, initialSelectedSpanId }) => {
|
|
3798
3732
|
const trace = reactExports.useMemo(() => {
|
|
3799
3733
|
if (!(run == null ? void 0 : run.runId)) {
|
|
3800
3734
|
return void 0;
|
|
@@ -3808,7 +3742,7 @@ const TraceViewer = ({ run, events, sidebarData, onLoadMore, hasMore, isLoadingM
|
|
|
3808
3742
|
if (!trace || loading && events.length === 0) {
|
|
3809
3743
|
return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
|
|
3810
3744
|
}
|
|
3811
|
-
return jsxRuntimeExports.jsx(SidebarDataProvider, { value: sidebarValue, children: jsxRuntimeExports.jsx("div", { className: "relative w-full h-full flex", children: jsxRuntimeExports.jsx(TraceViewer$1, { trace, onLoadMore, hasMore, isLoadingMore }) }) });
|
|
3745
|
+
return jsxRuntimeExports.jsx(SidebarDataProvider, { value: sidebarValue, children: jsxRuntimeExports.jsx("div", { className: "relative w-full h-full flex", children: jsxRuntimeExports.jsx(TraceViewer$1, { trace, onLoadMore, hasMore, isLoadingMore, initialSelectedSpanId }) }) });
|
|
3812
3746
|
};
|
|
3813
3747
|
const MAX_EVENTS_EXCEEDED = "MAX_EVENTS_EXCEEDED";
|
|
3814
3748
|
const REPLAY_TIMEOUT = "REPLAY_TIMEOUT";
|
|
@@ -4071,8 +4005,8 @@ async function pollResource(opts) {
|
|
|
4071
4005
|
return false;
|
|
4072
4006
|
}
|
|
4073
4007
|
const LIVE_POLL_LIMIT = 100;
|
|
4074
|
-
const INITIAL_PAGE_SIZE
|
|
4075
|
-
const LOAD_MORE_PAGE_SIZE
|
|
4008
|
+
const INITIAL_PAGE_SIZE = 500;
|
|
4009
|
+
const LOAD_MORE_PAGE_SIZE = 100;
|
|
4076
4010
|
const LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
4077
4011
|
const AUTO_LOAD_MAX_EVENTS = 500;
|
|
4078
4012
|
function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
@@ -4100,7 +4034,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4100
4034
|
unwrapServerActionResult(
|
|
4101
4035
|
fetchEvents(env, runId, {
|
|
4102
4036
|
sortOrder: "asc",
|
|
4103
|
-
limit: INITIAL_PAGE_SIZE
|
|
4037
|
+
limit: INITIAL_PAGE_SIZE,
|
|
4104
4038
|
withData: false
|
|
4105
4039
|
})
|
|
4106
4040
|
)
|
|
@@ -4156,7 +4090,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
|
|
|
4156
4090
|
fetchEvents(env, runId, {
|
|
4157
4091
|
cursor: eventsCursor,
|
|
4158
4092
|
sortOrder: "asc",
|
|
4159
|
-
limit: LOAD_MORE_PAGE_SIZE
|
|
4093
|
+
limit: LOAD_MORE_PAGE_SIZE,
|
|
4160
4094
|
withData: false
|
|
4161
4095
|
})
|
|
4162
4096
|
);
|
|
@@ -4358,6 +4292,118 @@ function useWorkflowStreams(env, runId, refreshInterval = STREAMS_REFRESH_INTERV
|
|
|
4358
4292
|
refresh: fetchData
|
|
4359
4293
|
};
|
|
4360
4294
|
}
|
|
4295
|
+
const PAGE_SIZE = 100;
|
|
4296
|
+
const MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
4297
|
+
const getEventId = (event) => event.eventId;
|
|
4298
|
+
function useEventsListData(env, runId, options = {}) {
|
|
4299
|
+
const { sortOrder = "asc", encryptionKey } = options;
|
|
4300
|
+
const encryptionKeyRef = reactExports.useRef(encryptionKey);
|
|
4301
|
+
encryptionKeyRef.current = encryptionKey;
|
|
4302
|
+
const hydrateEvents = reactExports.useCallback(async (rawEvents) => {
|
|
4303
|
+
const key = encryptionKeyRef.current;
|
|
4304
|
+
return Promise.all(rawEvents.map((ev) => hydrateResourceIOAsync(ev, key)));
|
|
4305
|
+
}, []);
|
|
4306
|
+
const fetchPage = reactExports.useCallback(
|
|
4307
|
+
(cursor) => unwrapOrThrow(
|
|
4308
|
+
fetchEvents(env, runId, {
|
|
4309
|
+
cursor,
|
|
4310
|
+
sortOrder,
|
|
4311
|
+
limit: PAGE_SIZE,
|
|
4312
|
+
withData: false
|
|
4313
|
+
})
|
|
4314
|
+
),
|
|
4315
|
+
[env, runId, sortOrder]
|
|
4316
|
+
);
|
|
4317
|
+
const list = useInfiniteList(
|
|
4318
|
+
`run-events:${runId}:${sortOrder}`,
|
|
4319
|
+
fetchPage,
|
|
4320
|
+
getEventId,
|
|
4321
|
+
{ keepPreviousData: false, revalidateCached: true }
|
|
4322
|
+
);
|
|
4323
|
+
const searchByExactId = reactExports.useCallback(
|
|
4324
|
+
async (id, kind, signal) => {
|
|
4325
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
4326
|
+
throw new DOMException("Aborted", "AbortError");
|
|
4327
|
+
}
|
|
4328
|
+
if (kind === "event") {
|
|
4329
|
+
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4330
|
+
fetchEvent(env, runId, id, "none")
|
|
4331
|
+
);
|
|
4332
|
+
if (fetchError || (signal == null ? void 0 : signal.aborted)) {
|
|
4333
|
+
return fetchError ? { status: "error", message: fetchError.message } : (() => {
|
|
4334
|
+
throw new DOMException("Aborted", "AbortError");
|
|
4335
|
+
})();
|
|
4336
|
+
}
|
|
4337
|
+
const [event] = await hydrateEvents([result]);
|
|
4338
|
+
return (event == null ? void 0 : event.runId) === runId ? { status: "ok", events: [event] } : { status: "not_found" };
|
|
4339
|
+
}
|
|
4340
|
+
const matched = [];
|
|
4341
|
+
let nextCursor;
|
|
4342
|
+
let pagesFetched = 0;
|
|
4343
|
+
let truncated = false;
|
|
4344
|
+
do {
|
|
4345
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
4346
|
+
throw new DOMException("Aborted", "AbortError");
|
|
4347
|
+
}
|
|
4348
|
+
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4349
|
+
fetchEventsByCorrelationId(env, id, {
|
|
4350
|
+
cursor: nextCursor,
|
|
4351
|
+
sortOrder,
|
|
4352
|
+
limit: 100,
|
|
4353
|
+
withData: false,
|
|
4354
|
+
runId
|
|
4355
|
+
})
|
|
4356
|
+
);
|
|
4357
|
+
if (fetchError) {
|
|
4358
|
+
return { status: "error", message: fetchError.message };
|
|
4359
|
+
}
|
|
4360
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
4361
|
+
throw new DOMException("Aborted", "AbortError");
|
|
4362
|
+
}
|
|
4363
|
+
pagesFetched += 1;
|
|
4364
|
+
const hydrated = await hydrateEvents(result.data);
|
|
4365
|
+
matched.push(...hydrated.filter((event) => event.runId === runId));
|
|
4366
|
+
const hitPageCap = pagesFetched >= MAX_CORRELATION_SEARCH_PAGES;
|
|
4367
|
+
truncated = truncated || hitPageCap && Boolean(result.hasMore && result.cursor);
|
|
4368
|
+
nextCursor = !hitPageCap && result.hasMore && result.cursor ? result.cursor : void 0;
|
|
4369
|
+
} while (nextCursor);
|
|
4370
|
+
return matched.length > 0 ? { status: "ok", events: matched, truncated: truncated || void 0 } : { status: "not_found" };
|
|
4371
|
+
},
|
|
4372
|
+
[env, runId, sortOrder, hydrateEvents]
|
|
4373
|
+
);
|
|
4374
|
+
return {
|
|
4375
|
+
events: list.items,
|
|
4376
|
+
loading: list.isLoading,
|
|
4377
|
+
error: list.error,
|
|
4378
|
+
hasMore: list.hasMore,
|
|
4379
|
+
loadingMore: list.isLoadingMore,
|
|
4380
|
+
loadMore: list.loadMore,
|
|
4381
|
+
searchByExactId
|
|
4382
|
+
};
|
|
4383
|
+
}
|
|
4384
|
+
function RunEventsTab({
|
|
4385
|
+
env,
|
|
4386
|
+
runId,
|
|
4387
|
+
sortOrder,
|
|
4388
|
+
encryptionKey,
|
|
4389
|
+
...listProps
|
|
4390
|
+
}) {
|
|
4391
|
+
const { events, loading, hasMore, loadingMore, loadMore, searchByExactId } = useEventsListData(env, runId, { sortOrder, encryptionKey });
|
|
4392
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4393
|
+
EventListView,
|
|
4394
|
+
{
|
|
4395
|
+
...listProps,
|
|
4396
|
+
events,
|
|
4397
|
+
isLoading: loading,
|
|
4398
|
+
hasMoreEvents: hasMore,
|
|
4399
|
+
isLoadingMoreEvents: loadingMore,
|
|
4400
|
+
onLoadMoreEvents: loadMore,
|
|
4401
|
+
encryptionKey,
|
|
4402
|
+
sortOrder,
|
|
4403
|
+
onExactIdSearch: searchByExactId
|
|
4404
|
+
}
|
|
4405
|
+
);
|
|
4406
|
+
}
|
|
4361
4407
|
function RunLimitGuidanceAlert({
|
|
4362
4408
|
run
|
|
4363
4409
|
}) {
|
|
@@ -4716,157 +4762,6 @@ function useCancellationReason(env, runId, status, events) {
|
|
|
4716
4762
|
}, [env, runId, status, loadedReason]);
|
|
4717
4763
|
return loadedReason ?? terminalReason;
|
|
4718
4764
|
}
|
|
4719
|
-
const INITIAL_PAGE_SIZE = 100;
|
|
4720
|
-
const LOAD_MORE_PAGE_SIZE = 100;
|
|
4721
|
-
const MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
4722
|
-
function useEventsListData(env, runId, options = {}) {
|
|
4723
|
-
const { sortOrder = "asc", encryptionKey, enabled = true } = options;
|
|
4724
|
-
const [events, setEvents] = reactExports.useState([]);
|
|
4725
|
-
const [loading, setLoading] = reactExports.useState(true);
|
|
4726
|
-
const [error, setError] = reactExports.useState(null);
|
|
4727
|
-
const [cursor, setCursor] = reactExports.useState();
|
|
4728
|
-
const [hasMore, setHasMore] = reactExports.useState(false);
|
|
4729
|
-
const [loadingMore, setLoadingMore] = reactExports.useState(false);
|
|
4730
|
-
const isFetchingRef = reactExports.useRef(false);
|
|
4731
|
-
const encryptionKeyRef = reactExports.useRef(encryptionKey);
|
|
4732
|
-
encryptionKeyRef.current = encryptionKey;
|
|
4733
|
-
const hydrateEvents = reactExports.useCallback(async (rawEvents) => {
|
|
4734
|
-
const key = encryptionKeyRef.current;
|
|
4735
|
-
return Promise.all(rawEvents.map((ev) => hydrateResourceIOAsync(ev, key)));
|
|
4736
|
-
}, []);
|
|
4737
|
-
const fetchInitial = reactExports.useCallback(async () => {
|
|
4738
|
-
if (isFetchingRef.current) return;
|
|
4739
|
-
isFetchingRef.current = true;
|
|
4740
|
-
setLoading(true);
|
|
4741
|
-
setError(null);
|
|
4742
|
-
setEvents([]);
|
|
4743
|
-
setCursor(void 0);
|
|
4744
|
-
setHasMore(false);
|
|
4745
|
-
try {
|
|
4746
|
-
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4747
|
-
fetchEvents(env, runId, {
|
|
4748
|
-
sortOrder,
|
|
4749
|
-
limit: INITIAL_PAGE_SIZE,
|
|
4750
|
-
withData: false
|
|
4751
|
-
})
|
|
4752
|
-
);
|
|
4753
|
-
if (fetchError) {
|
|
4754
|
-
setError(fetchError);
|
|
4755
|
-
} else {
|
|
4756
|
-
setEvents(await hydrateEvents(result.data));
|
|
4757
|
-
setCursor(result.hasMore ? result.cursor : void 0);
|
|
4758
|
-
setHasMore(Boolean(result.hasMore));
|
|
4759
|
-
}
|
|
4760
|
-
} catch (err) {
|
|
4761
|
-
setError(err);
|
|
4762
|
-
} finally {
|
|
4763
|
-
setLoading(false);
|
|
4764
|
-
isFetchingRef.current = false;
|
|
4765
|
-
}
|
|
4766
|
-
}, [env, runId, sortOrder, hydrateEvents]);
|
|
4767
|
-
reactExports.useEffect(() => {
|
|
4768
|
-
if (enabled) fetchInitial();
|
|
4769
|
-
}, [fetchInitial, enabled]);
|
|
4770
|
-
reactExports.useEffect(() => {
|
|
4771
|
-
if (!encryptionKey || events.length === 0) return;
|
|
4772
|
-
let cancelled = false;
|
|
4773
|
-
Promise.all(events.map((ev) => hydrateResourceIOAsync(ev, encryptionKey))).then((decrypted) => {
|
|
4774
|
-
if (!cancelled) setEvents(decrypted);
|
|
4775
|
-
}).catch(() => {
|
|
4776
|
-
});
|
|
4777
|
-
return () => {
|
|
4778
|
-
cancelled = true;
|
|
4779
|
-
};
|
|
4780
|
-
}, [encryptionKey]);
|
|
4781
|
-
const loadMore = reactExports.useCallback(async () => {
|
|
4782
|
-
if (loadingMore || !cursor) return;
|
|
4783
|
-
setLoadingMore(true);
|
|
4784
|
-
try {
|
|
4785
|
-
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4786
|
-
fetchEvents(env, runId, {
|
|
4787
|
-
cursor,
|
|
4788
|
-
sortOrder,
|
|
4789
|
-
limit: LOAD_MORE_PAGE_SIZE,
|
|
4790
|
-
withData: false
|
|
4791
|
-
})
|
|
4792
|
-
);
|
|
4793
|
-
if (fetchError) {
|
|
4794
|
-
setError(fetchError);
|
|
4795
|
-
} else {
|
|
4796
|
-
if (result.data.length > 0) {
|
|
4797
|
-
const hydrated = await hydrateEvents(result.data);
|
|
4798
|
-
setEvents((prev) => [...prev, ...hydrated]);
|
|
4799
|
-
}
|
|
4800
|
-
setCursor(result.hasMore ? result.cursor : void 0);
|
|
4801
|
-
setHasMore(Boolean(result.hasMore));
|
|
4802
|
-
}
|
|
4803
|
-
} catch (err) {
|
|
4804
|
-
setError(err);
|
|
4805
|
-
} finally {
|
|
4806
|
-
setLoadingMore(false);
|
|
4807
|
-
}
|
|
4808
|
-
}, [env, runId, sortOrder, cursor, loadingMore, hydrateEvents]);
|
|
4809
|
-
const searchByExactId = reactExports.useCallback(
|
|
4810
|
-
async (id, kind, signal) => {
|
|
4811
|
-
if (signal == null ? void 0 : signal.aborted) {
|
|
4812
|
-
throw new DOMException("Aborted", "AbortError");
|
|
4813
|
-
}
|
|
4814
|
-
if (kind === "event") {
|
|
4815
|
-
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4816
|
-
fetchEvent(env, runId, id, "none")
|
|
4817
|
-
);
|
|
4818
|
-
if (fetchError || (signal == null ? void 0 : signal.aborted)) {
|
|
4819
|
-
return fetchError ? { status: "error", message: fetchError.message } : (() => {
|
|
4820
|
-
throw new DOMException("Aborted", "AbortError");
|
|
4821
|
-
})();
|
|
4822
|
-
}
|
|
4823
|
-
const [event] = await hydrateEvents([result]);
|
|
4824
|
-
return (event == null ? void 0 : event.runId) === runId ? { status: "ok", events: [event] } : { status: "not_found" };
|
|
4825
|
-
}
|
|
4826
|
-
const matched = [];
|
|
4827
|
-
let nextCursor;
|
|
4828
|
-
let pagesFetched = 0;
|
|
4829
|
-
let truncated = false;
|
|
4830
|
-
do {
|
|
4831
|
-
if (signal == null ? void 0 : signal.aborted) {
|
|
4832
|
-
throw new DOMException("Aborted", "AbortError");
|
|
4833
|
-
}
|
|
4834
|
-
const { error: fetchError, result } = await unwrapServerActionResult(
|
|
4835
|
-
fetchEventsByCorrelationId(env, id, {
|
|
4836
|
-
cursor: nextCursor,
|
|
4837
|
-
sortOrder,
|
|
4838
|
-
limit: 100,
|
|
4839
|
-
withData: false,
|
|
4840
|
-
runId
|
|
4841
|
-
})
|
|
4842
|
-
);
|
|
4843
|
-
if (fetchError) {
|
|
4844
|
-
return { status: "error", message: fetchError.message };
|
|
4845
|
-
}
|
|
4846
|
-
if (signal == null ? void 0 : signal.aborted) {
|
|
4847
|
-
throw new DOMException("Aborted", "AbortError");
|
|
4848
|
-
}
|
|
4849
|
-
pagesFetched += 1;
|
|
4850
|
-
const hydrated = await hydrateEvents(result.data);
|
|
4851
|
-
matched.push(...hydrated.filter((event) => event.runId === runId));
|
|
4852
|
-
const hitPageCap = pagesFetched >= MAX_CORRELATION_SEARCH_PAGES;
|
|
4853
|
-
truncated = truncated || hitPageCap && Boolean(result.hasMore && result.cursor);
|
|
4854
|
-
nextCursor = !hitPageCap && result.hasMore && result.cursor ? result.cursor : void 0;
|
|
4855
|
-
} while (nextCursor);
|
|
4856
|
-
return matched.length > 0 ? { status: "ok", events: matched, truncated: truncated || void 0 } : { status: "not_found" };
|
|
4857
|
-
},
|
|
4858
|
-
[env, runId, sortOrder, hydrateEvents]
|
|
4859
|
-
);
|
|
4860
|
-
return {
|
|
4861
|
-
events,
|
|
4862
|
-
loading,
|
|
4863
|
-
error,
|
|
4864
|
-
hasMore,
|
|
4865
|
-
loadingMore,
|
|
4866
|
-
loadMore,
|
|
4867
|
-
searchByExactId
|
|
4868
|
-
};
|
|
4869
|
-
}
|
|
4870
4765
|
const FRAME_HEADER_SIZE = 4;
|
|
4871
4766
|
const ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
4872
4767
|
const POLL_INTERVAL_MS = 3e3;
|
|
@@ -4876,7 +4771,8 @@ function isRunActive(status) {
|
|
|
4876
4771
|
const yieldToMain = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
4877
4772
|
const YIELD_EVERY_N_FRAMES = 64;
|
|
4878
4773
|
function detectEncoding(data, streamId) {
|
|
4879
|
-
if (data
|
|
4774
|
+
if (getStreamImageType(data)) return "image";
|
|
4775
|
+
if (data.length < FRAME_HEADER_SIZE) return "legacy";
|
|
4880
4776
|
const prefix = new TextDecoder().decode(data.subarray(0, FRAME_HEADER_SIZE));
|
|
4881
4777
|
if (streamId.endsWith("_system_abort") && Object.values(SerializationFormat).some((format2) => format2 === prefix)) {
|
|
4882
4778
|
return "unframed";
|
|
@@ -4886,6 +4782,24 @@ function detectEncoding(data, streamId) {
|
|
|
4886
4782
|
if (len > 0 && len <= 10 * 1024 * 1024) return "framed";
|
|
4887
4783
|
return "legacy";
|
|
4888
4784
|
}
|
|
4785
|
+
function concatBytes(parts) {
|
|
4786
|
+
if (parts.length === 1) return parts[0];
|
|
4787
|
+
const joined = new Uint8Array(
|
|
4788
|
+
parts.reduce((length, part) => length + part.length, 0)
|
|
4789
|
+
);
|
|
4790
|
+
let offset = 0;
|
|
4791
|
+
for (const part of parts) {
|
|
4792
|
+
joined.set(part, offset);
|
|
4793
|
+
offset += part.length;
|
|
4794
|
+
}
|
|
4795
|
+
return joined;
|
|
4796
|
+
}
|
|
4797
|
+
function hasSameImageBytes(previous, next) {
|
|
4798
|
+
var _a, _b;
|
|
4799
|
+
const before = (_a = previous[0]) == null ? void 0 : _a.value;
|
|
4800
|
+
const after = (_b = next[0]) == null ? void 0 : _b.value;
|
|
4801
|
+
return previous.length === 1 && next.length === 1 && before instanceof Uint8Array && after instanceof Uint8Array && before.length === after.length && before.every((byte, index) => byte === after[index]);
|
|
4802
|
+
}
|
|
4889
4803
|
function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
4890
4804
|
const [chunks, setChunks] = reactExports.useState([]);
|
|
4891
4805
|
const [isLive, setIsLive] = reactExports.useState(false);
|
|
@@ -4952,6 +4866,8 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
4952
4866
|
return;
|
|
4953
4867
|
}
|
|
4954
4868
|
let mounted = true;
|
|
4869
|
+
let isImageStream = false;
|
|
4870
|
+
let imageChunkId;
|
|
4955
4871
|
const abortController = new AbortController();
|
|
4956
4872
|
abortControllerRef.current = abortController;
|
|
4957
4873
|
const revivers = getWebRevivers();
|
|
@@ -4971,14 +4887,15 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
4971
4887
|
streamId,
|
|
4972
4888
|
runId,
|
|
4973
4889
|
abortController.signal,
|
|
4974
|
-
options == null ? void 0 : options.cursor
|
|
4890
|
+
isImageStream ? void 0 : (options == null ? void 0 : options.cursor) ?? void 0
|
|
4975
4891
|
);
|
|
4976
|
-
const skipFrames = (options == null ? void 0 : options.skipFrames) ?? 0;
|
|
4892
|
+
const skipFrames = isImageStream ? 0 : (options == null ? void 0 : options.skipFrames) ?? 0;
|
|
4977
4893
|
const reader = streamResponse.body.getReader();
|
|
4978
4894
|
const decoder = new TextDecoder();
|
|
4979
4895
|
let buffer = new Uint8Array(0);
|
|
4980
4896
|
let encoding = null;
|
|
4981
4897
|
let textRemainder = "";
|
|
4898
|
+
const imageParts = [];
|
|
4982
4899
|
let frameIndex = 0;
|
|
4983
4900
|
const appendToBuffer = (data) => {
|
|
4984
4901
|
const newBuffer = new Uint8Array(buffer.length + data.length);
|
|
@@ -4990,17 +4907,34 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
4990
4907
|
if (abortController.signal.aborted) break;
|
|
4991
4908
|
const { value, done } = await reader.read();
|
|
4992
4909
|
if (done) {
|
|
4993
|
-
if (encoding ===
|
|
4910
|
+
if (encoding === null && buffer.length > 0) {
|
|
4911
|
+
if (!streamResponse.done && buffer.length < 12) break;
|
|
4912
|
+
encoding = detectEncoding(buffer, streamId);
|
|
4913
|
+
if (encoding === "legacy") textRemainder = decoder.decode(buffer);
|
|
4914
|
+
}
|
|
4915
|
+
if (encoding === "image") {
|
|
4916
|
+
imageChunkId ?? (imageChunkId = chunkIdRef.current++);
|
|
4917
|
+
frameIndex++;
|
|
4918
|
+
targetBuffer.push({
|
|
4919
|
+
id: imageChunkId,
|
|
4920
|
+
value: concatBytes([buffer, ...imageParts])
|
|
4921
|
+
});
|
|
4922
|
+
} else if (encoding === "unframed" && buffer.length > 0) {
|
|
4994
4923
|
frameIndex++;
|
|
4995
4924
|
if (frameIndex > skipFrames) {
|
|
4996
4925
|
const result = await processFrame(buffer, cryptoKey, revivers);
|
|
4997
4926
|
if (result.encrypted) return { encrypted: true };
|
|
4998
4927
|
targetBuffer.push(result.chunk);
|
|
4999
4928
|
}
|
|
5000
|
-
} else if (encoding === "legacy"
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
4929
|
+
} else if (encoding === "legacy") {
|
|
4930
|
+
textRemainder += decoder.decode();
|
|
4931
|
+
for (const line of textRemainder.split("\n")) {
|
|
4932
|
+
const trimmed = line.trim();
|
|
4933
|
+
if (!trimmed) continue;
|
|
4934
|
+
frameIndex++;
|
|
4935
|
+
if (frameIndex > skipFrames) {
|
|
4936
|
+
targetBuffer.push(parseLegacyLine(trimmed));
|
|
4937
|
+
}
|
|
5004
4938
|
}
|
|
5005
4939
|
textRemainder = "";
|
|
5006
4940
|
}
|
|
@@ -5009,7 +4943,9 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5009
4943
|
if (encoding === null) {
|
|
5010
4944
|
appendToBuffer(value);
|
|
5011
4945
|
if (buffer.length >= FRAME_HEADER_SIZE) {
|
|
5012
|
-
|
|
4946
|
+
const detected = detectEncoding(buffer, streamId);
|
|
4947
|
+
if (detected === "framed" || detected === "unframed" || buffer.length >= 12)
|
|
4948
|
+
encoding = detected;
|
|
5013
4949
|
}
|
|
5014
4950
|
if (encoding === "legacy") {
|
|
5015
4951
|
textRemainder = decoder.decode(buffer, { stream: true });
|
|
@@ -5017,6 +4953,8 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5017
4953
|
}
|
|
5018
4954
|
} else if (encoding === "legacy") {
|
|
5019
4955
|
textRemainder += decoder.decode(value, { stream: true });
|
|
4956
|
+
} else if (encoding === "image") {
|
|
4957
|
+
imageParts.push(value);
|
|
5020
4958
|
} else {
|
|
5021
4959
|
appendToBuffer(value);
|
|
5022
4960
|
}
|
|
@@ -5034,7 +4972,8 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5034
4972
|
}
|
|
5035
4973
|
continue;
|
|
5036
4974
|
}
|
|
5037
|
-
if (encoding === "unframed")
|
|
4975
|
+
if (encoding === null || encoding === "unframed" || encoding === "image")
|
|
4976
|
+
continue;
|
|
5038
4977
|
let offset = 0;
|
|
5039
4978
|
let framesInBatch = 0;
|
|
5040
4979
|
while (offset + FRAME_HEADER_SIZE <= buffer.length) {
|
|
@@ -5074,10 +5013,12 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5074
5013
|
}
|
|
5075
5014
|
buffer = buffer.slice(offset);
|
|
5076
5015
|
}
|
|
5016
|
+
isImageStream || (isImageStream = encoding === "image");
|
|
5077
5017
|
return {
|
|
5078
5018
|
encrypted: false,
|
|
5019
|
+
image: isImageStream,
|
|
5079
5020
|
frameCount: frameIndex,
|
|
5080
|
-
cursor: streamResponse.cursor,
|
|
5021
|
+
cursor: encoding === null ? null : streamResponse.cursor,
|
|
5081
5022
|
done: streamResponse.done
|
|
5082
5023
|
};
|
|
5083
5024
|
};
|
|
@@ -5119,7 +5060,10 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
|
5119
5060
|
serverCursorRef.current = pollResult.cursor;
|
|
5120
5061
|
}
|
|
5121
5062
|
if (newChunks.length > 0 && mounted) {
|
|
5122
|
-
setChunks((prev) =>
|
|
5063
|
+
setChunks((prev) => {
|
|
5064
|
+
if (!pollResult.image) return [...prev, ...newChunks];
|
|
5065
|
+
return hasSameImageBytes(prev, newChunks) ? prev : newChunks;
|
|
5066
|
+
});
|
|
5123
5067
|
}
|
|
5124
5068
|
if (pollResult.done) {
|
|
5125
5069
|
setIsLive(false);
|
|
@@ -5197,7 +5141,7 @@ function RunDetailView({
|
|
|
5197
5141
|
}) {
|
|
5198
5142
|
var _a, _b;
|
|
5199
5143
|
const navigate = useNavigate();
|
|
5200
|
-
const [searchParams] =
|
|
5144
|
+
const [searchParams, updateSearchParams] = useOptimisticSearchParams();
|
|
5201
5145
|
const { serverConfig } = useServerConfig();
|
|
5202
5146
|
const [cancelling, setCancelling] = reactExports.useState(false);
|
|
5203
5147
|
const [rerunning, setRerunning] = reactExports.useState(false);
|
|
@@ -5207,26 +5151,13 @@ function RunDetailView({
|
|
|
5207
5151
|
const rawTab = searchParams.get("tab") || "trace";
|
|
5208
5152
|
const activeTab = rawTab === "graph" ? "trace" : rawTab;
|
|
5209
5153
|
const selectedStreamId = searchParams.get("streamId");
|
|
5210
|
-
const
|
|
5211
|
-
(updates) => {
|
|
5212
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
5213
|
-
for (const [key, value] of Object.entries(updates)) {
|
|
5214
|
-
if (value === null) {
|
|
5215
|
-
params.delete(key);
|
|
5216
|
-
} else {
|
|
5217
|
-
params.set(key, value);
|
|
5218
|
-
}
|
|
5219
|
-
}
|
|
5220
|
-
navigate(`?${params.toString()}`, { preventScrollReset: true });
|
|
5221
|
-
},
|
|
5222
|
-
[navigate, searchParams]
|
|
5223
|
-
);
|
|
5154
|
+
const initialSelectedSpanId = searchParams.get("spanId") ?? void 0;
|
|
5224
5155
|
const setActiveTab = reactExports.useCallback(
|
|
5225
5156
|
(tab) => {
|
|
5226
5157
|
if (tab !== "streams") {
|
|
5227
|
-
updateSearchParams({ tab, streamId: null });
|
|
5158
|
+
updateSearchParams({ tab, streamId: null, spanId: null });
|
|
5228
5159
|
} else {
|
|
5229
|
-
updateSearchParams({ tab });
|
|
5160
|
+
updateSearchParams({ tab, spanId: null });
|
|
5230
5161
|
}
|
|
5231
5162
|
},
|
|
5232
5163
|
[updateSearchParams]
|
|
@@ -5239,7 +5170,7 @@ function RunDetailView({
|
|
|
5239
5170
|
);
|
|
5240
5171
|
const handleStreamClick = reactExports.useCallback(
|
|
5241
5172
|
(streamId) => {
|
|
5242
|
-
updateSearchParams({ tab: "streams", streamId });
|
|
5173
|
+
updateSearchParams({ tab: "streams", streamId, spanId: null });
|
|
5243
5174
|
},
|
|
5244
5175
|
[updateSearchParams]
|
|
5245
5176
|
);
|
|
@@ -5302,18 +5233,6 @@ function RunDetailView({
|
|
|
5302
5233
|
const [encryptionKey, setEncryptionKey] = reactExports.useState(null);
|
|
5303
5234
|
encryptionKeyRef.current = encryptionKey;
|
|
5304
5235
|
const [eventsSortOrder, setEventsSortOrder] = reactExports.useState("asc");
|
|
5305
|
-
const {
|
|
5306
|
-
events: eventsListData,
|
|
5307
|
-
loading: eventsListLoading,
|
|
5308
|
-
hasMore: hasMoreEventsTab,
|
|
5309
|
-
loadingMore: loadingMoreEventsTab,
|
|
5310
|
-
loadMore: loadMoreEventsTab,
|
|
5311
|
-
searchByExactId
|
|
5312
|
-
} = useEventsListData(env, runId, {
|
|
5313
|
-
sortOrder: eventsSortOrder,
|
|
5314
|
-
encryptionKey: encryptionKey ?? void 0,
|
|
5315
|
-
enabled: activeTab === "events"
|
|
5316
|
-
});
|
|
5317
5236
|
const fetchSpanDetail = reactExports.useCallback(
|
|
5318
5237
|
(selection) => fetchSpanDetailResource(env, selection, {
|
|
5319
5238
|
encryptionKey: encryptionKey ?? void 0,
|
|
@@ -5583,26 +5502,23 @@ function RunDetailView({
|
|
|
5583
5502
|
sidebarData,
|
|
5584
5503
|
onLoadMore: loadMoreTraceData,
|
|
5585
5504
|
hasMore: hasMoreTraceData,
|
|
5586
|
-
isLoadingMore: isLoadingMoreTraceData
|
|
5505
|
+
isLoadingMore: isLoadingMoreTraceData,
|
|
5506
|
+
initialSelectedSpanId
|
|
5587
5507
|
}
|
|
5588
5508
|
) }) }) }),
|
|
5589
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5590
|
-
|
|
5509
|
+
/* @__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(
|
|
5510
|
+
RunEventsTab,
|
|
5591
5511
|
{
|
|
5592
|
-
|
|
5512
|
+
env,
|
|
5513
|
+
runId,
|
|
5593
5514
|
run,
|
|
5594
5515
|
onLoadEventData: handleLoadEventData,
|
|
5595
|
-
hasMoreEvents: hasMoreEventsTab,
|
|
5596
|
-
isLoadingMoreEvents: loadingMoreEventsTab,
|
|
5597
|
-
onLoadMoreEvents: loadMoreEventsTab,
|
|
5598
5516
|
encryptionKey: encryptionKey ?? void 0,
|
|
5599
|
-
isLoading: eventsListLoading,
|
|
5600
5517
|
sortOrder: eventsSortOrder,
|
|
5601
5518
|
onSortOrderChange: setEventsSortOrder,
|
|
5602
5519
|
onDecrypt: handleDecrypt,
|
|
5603
5520
|
isDecrypting,
|
|
5604
|
-
|
|
5605
|
-
onExactIdSearch: searchByExactId
|
|
5521
|
+
onViewInTrace: (spanId) => updateSearchParams({ tab: "trace", spanId })
|
|
5606
5522
|
}
|
|
5607
5523
|
) }) }) }),
|
|
5608
5524
|
/* @__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: [
|