@workflow/web-shared 5.1.1 → 5.3.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/dist/components/event-list/event-details-panel.d.ts.map +1 -1
- package/dist/components/event-list/event-details-panel.js +7 -6
- package/dist/components/event-list/event-list-toolbar.d.ts +2 -1
- package/dist/components/event-list/event-list-toolbar.d.ts.map +1 -1
- package/dist/components/event-list/event-list-toolbar.js +20 -11
- package/dist/components/event-list/event-row.d.ts +3 -3
- package/dist/components/event-list/event-row.d.ts.map +1 -1
- package/dist/components/event-list/event-row.js +15 -13
- package/dist/components/event-list/use-event-search.d.ts +3 -1
- package/dist/components/event-list/use-event-search.d.ts.map +1 -1
- package/dist/components/event-list/use-event-search.js +19 -20
- package/dist/components/event-list-view.d.ts.map +1 -1
- package/dist/components/event-list-view.js +53 -24
- package/dist/components/hook-actions.d.ts +0 -1
- package/dist/components/hook-actions.d.ts.map +1 -1
- package/dist/components/hook-actions.js +1 -3
- package/dist/components/index.d.ts +5 -9
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -9
- package/dist/components/sidebar/attribute-panel.d.ts +0 -13
- package/dist/components/sidebar/attribute-panel.d.ts.map +1 -1
- package/dist/components/sidebar/attribute-panel.js +5 -5
- package/dist/components/sidebar/attributes-block.d.ts +0 -7
- package/dist/components/sidebar/attributes-block.d.ts.map +1 -1
- package/dist/components/sidebar/attributes-block.js +5 -5
- package/dist/components/sidebar/conversation-view.d.ts.map +1 -1
- package/dist/components/sidebar/conversation-view.js +4 -3
- package/dist/components/sidebar/copyable-data-block.d.ts.map +1 -1
- package/dist/components/sidebar/copyable-data-block.js +8 -6
- package/dist/components/sidebar/entity-detail-panel.d.ts.map +1 -1
- package/dist/components/sidebar/entity-detail-panel.js +2 -3
- package/dist/components/stream-image-preview.js +2 -2
- package/dist/components/stream-viewer.js +3 -3
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts +2 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.js +3 -3
- package/dist/components/trace-viewer/components/event-list.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/event-list.js +2 -2
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts +1 -4
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/middle-truncate/truncate.js +2 -2
- package/dist/components/trace-viewer/components/minimap.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/minimap.js +6 -4
- package/dist/components/trace-viewer/components/timeline.d.ts +0 -11
- package/dist/components/trace-viewer/components/timeline.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/timeline.js +1 -2
- package/dist/components/trace-viewer/trace-viewer.js +9 -10
- package/dist/components/ui/button.d.ts +28 -17
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +47 -43
- package/dist/components/ui/context-card.js +3 -3
- package/dist/components/ui/copy-button.d.ts +15 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +41 -0
- package/dist/components/ui/data-inspector.d.ts.map +1 -1
- package/dist/components/ui/data-inspector.js +8 -38
- package/dist/components/ui/decrypt-button.d.ts +3 -2
- package/dist/components/ui/decrypt-button.d.ts.map +1 -1
- package/dist/components/ui/decrypt-button.js +13 -7
- package/dist/components/ui/duplicate-event-tooltip.d.ts +1 -9
- package/dist/components/ui/duplicate-event-tooltip.d.ts.map +1 -1
- package/dist/components/ui/duplicate-event-tooltip.js +2 -10
- package/dist/components/ui/error-stack-block.js +3 -3
- package/dist/components/ui/icon-button.d.ts +2 -2
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +2 -3
- package/dist/components/ui/kbd.d.ts +1 -1
- package/dist/components/ui/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd.js +1 -2
- package/dist/components/ui/search-input.d.ts +19 -0
- package/dist/components/ui/search-input.d.ts.map +1 -0
- package/dist/components/ui/search-input.js +61 -0
- package/dist/components/ui/spinner.d.ts +54 -6
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +84 -46
- package/dist/components/workflow-traces/trace-span-construction.d.ts +1 -22
- package/dist/components/workflow-traces/trace-span-construction.d.ts.map +1 -1
- package/dist/components/workflow-traces/trace-span-construction.js +3 -3
- package/dist/index.d.ts +9 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -11
- package/dist/lib/event-analysis.d.ts +1 -25
- package/dist/lib/event-analysis.d.ts.map +1 -1
- package/dist/lib/event-analysis.js +2 -75
- package/dist/lib/event-list-model.d.ts +4 -2
- package/dist/lib/event-list-model.d.ts.map +1 -1
- package/dist/lib/event-list-model.js +13 -11
- package/dist/lib/exact-event-search-id.d.ts +0 -2
- package/dist/lib/exact-event-search-id.d.ts.map +1 -1
- package/dist/lib/exact-event-search-id.js +1 -12
- package/dist/lib/hydration.d.ts +1 -12
- package/dist/lib/hydration.d.ts.map +1 -1
- package/dist/lib/hydration.js +8 -20
- package/dist/lib/stream-display.d.ts +0 -1
- package/dist/lib/stream-display.d.ts.map +1 -1
- package/dist/lib/stream-display.js +2 -2
- package/dist/lib/trace-builder.d.ts +0 -8
- package/dist/lib/trace-builder.d.ts.map +1 -1
- package/dist/lib/trace-builder.js +2 -2
- package/dist/lib/utils.d.ts +0 -22
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -31
- package/dist/styles.css +286 -117
- package/package.json +5 -17
- package/src/components/event-list/event-details-panel.tsx +22 -26
- package/src/components/event-list/event-list-toolbar.tsx +35 -28
- package/src/components/event-list/event-row.tsx +33 -29
- package/src/components/event-list/use-event-search.ts +29 -22
- package/src/components/event-list-view.tsx +180 -52
- package/src/components/hook-actions.tsx +0 -1
- package/src/components/index.ts +4 -20
- package/src/components/sidebar/attribute-panel.tsx +4 -7
- package/src/components/sidebar/attributes-block.tsx +7 -6
- package/src/components/sidebar/conversation-view.tsx +3 -2
- package/src/components/sidebar/copyable-data-block.tsx +17 -14
- package/src/components/sidebar/entity-detail-panel.tsx +2 -7
- package/src/components/stream-image-preview.tsx +1 -1
- package/src/components/stream-viewer.tsx +4 -4
- package/src/components/trace-viewer/components/detail-panel-shell.tsx +3 -0
- package/src/components/trace-viewer/components/event-list.tsx +16 -18
- package/src/components/trace-viewer/components/middle-truncate/truncate.ts +1 -2
- package/src/components/trace-viewer/components/minimap.tsx +4 -3
- package/src/components/trace-viewer/components/timeline.tsx +0 -2
- package/src/components/trace-viewer/trace-viewer.tsx +19 -38
- package/src/components/ui/button.tsx +144 -46
- package/src/components/ui/context-card.tsx +2 -2
- package/src/components/ui/copy-button.tsx +86 -0
- package/src/components/ui/data-inspector.tsx +23 -67
- package/src/components/ui/decrypt-button.tsx +23 -48
- package/src/components/ui/duplicate-event-tooltip.tsx +1 -22
- package/src/components/ui/error-stack-block.tsx +4 -4
- package/src/components/ui/icon-button.tsx +1 -3
- package/src/components/ui/kbd.tsx +0 -2
- package/src/components/ui/search-input.tsx +143 -0
- package/src/components/ui/spinner.tsx +105 -55
- package/src/components/workflow-traces/trace-span-construction.ts +2 -2
- package/src/index.ts +7 -55
- package/src/lib/event-analysis.ts +1 -104
- package/src/lib/event-list-model.ts +15 -12
- package/src/lib/exact-event-search-id.ts +0 -13
- package/src/lib/hydration.ts +6 -31
- package/src/lib/stream-display.ts +1 -1
- package/src/lib/trace-builder.ts +1 -1
- package/src/lib/utils.ts +0 -48
- package/src/styles.css +286 -117
- package/dist/components/trace-viewer/components/copy-button.d.ts +0 -9
- package/dist/components/trace-viewer/components/copy-button.d.ts.map +0 -1
- package/dist/components/trace-viewer/components/copy-button.js +0 -27
- package/dist/components/ui/alert.d.ts +0 -9
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -23
- package/dist/components/ui/card.d.ts +0 -9
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -18
- package/dist/components/ui/load-more-button.d.ts +0 -13
- package/dist/components/ui/load-more-button.d.ts.map +0 -1
- package/dist/components/ui/load-more-button.js +0 -12
- package/dist/components/ui/menu-dropdown.d.ts +0 -16
- package/dist/components/ui/menu-dropdown.d.ts.map +0 -1
- package/dist/components/ui/menu-dropdown.js +0 -30
- package/dist/hooks/use-dark-mode.d.ts +0 -9
- package/dist/hooks/use-dark-mode.d.ts.map +0 -1
- package/dist/hooks/use-dark-mode.js +0 -30
- package/dist/lib/event-materialization.d.ts +0 -91
- package/dist/lib/event-materialization.d.ts.map +0 -1
- package/dist/lib/event-materialization.js +0 -219
- package/src/components/index.d.ts +0 -1
- package/src/components/trace-viewer/components/copy-button.tsx +0 -68
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/card.tsx +0 -79
- package/src/components/ui/load-more-button.tsx +0 -38
- package/src/components/ui/menu-dropdown.tsx +0 -97
- package/src/hooks/use-dark-mode.ts +0 -34
- package/src/index.d.ts +0 -1
- package/src/lib/event-materialization.ts +0 -304
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { Event, WorkflowRun } from '@workflow/world';
|
|
4
|
+
import { AlertCircle } from 'lucide-react';
|
|
4
5
|
import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
5
6
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
6
7
|
import { Virtuoso, type VirtuosoHandle } from 'react-virtuoso';
|
|
8
|
+
import { cn } from '../lib/cn';
|
|
7
9
|
import { findDuplicateEventIds } from '../lib/duplicate-events';
|
|
8
10
|
import {
|
|
9
11
|
buildEventLookups,
|
|
10
12
|
buildEventRow,
|
|
11
13
|
buildListItems,
|
|
14
|
+
type EventSearchState,
|
|
12
15
|
getEmptyMessage,
|
|
13
16
|
getEventEntity,
|
|
14
17
|
getFooterLabel,
|
|
15
18
|
getListSource,
|
|
19
|
+
getSearchHint,
|
|
16
20
|
mergeEventsById,
|
|
17
21
|
sortEventsByTime,
|
|
18
22
|
} from '../lib/event-list-model';
|
|
@@ -30,9 +34,9 @@ import {
|
|
|
30
34
|
useEventSearch,
|
|
31
35
|
} from './event-list/use-event-search';
|
|
32
36
|
import { useDetailPanelWidth } from './trace-viewer/components/use-detail-panel-width';
|
|
37
|
+
import { Button } from './ui/button';
|
|
33
38
|
import { ContextCardProvider } from './ui/context-card';
|
|
34
39
|
import { DecryptClickContext } from './ui/data-inspector';
|
|
35
|
-
import { LoadMoreButton } from './ui/load-more-button';
|
|
36
40
|
import { TooltipProvider } from './ui/tooltip';
|
|
37
41
|
|
|
38
42
|
interface EventsListProps {
|
|
@@ -65,6 +69,38 @@ interface EventsListProps {
|
|
|
65
69
|
onViewInTrace?: (spanId: string) => void;
|
|
66
70
|
}
|
|
67
71
|
|
|
72
|
+
function EmptyState({
|
|
73
|
+
search,
|
|
74
|
+
onRetry,
|
|
75
|
+
}: {
|
|
76
|
+
search: EventSearchState;
|
|
77
|
+
onRetry: () => void;
|
|
78
|
+
}) {
|
|
79
|
+
if (search.status === 'error') {
|
|
80
|
+
return (
|
|
81
|
+
<div className="flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center">
|
|
82
|
+
<div className="flex flex-col items-center gap-1">
|
|
83
|
+
<div className="flex items-center gap-2 text-label-14 font-medium text-gray-1000">
|
|
84
|
+
<AlertCircle className="h-4 w-4 shrink-0 text-red-800" />
|
|
85
|
+
Failed to search events
|
|
86
|
+
</div>
|
|
87
|
+
{search.message ? (
|
|
88
|
+
<p className="m-0 text-copy-13 text-gray-900">{search.message}</p>
|
|
89
|
+
) : null}
|
|
90
|
+
</div>
|
|
91
|
+
<Button variant="secondary" size="small" onClick={onRetry}>
|
|
92
|
+
Try again
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return (
|
|
98
|
+
<div className="flex flex-1 items-center justify-center px-6 text-center text-copy-14 text-gray-900">
|
|
99
|
+
{getEmptyMessage(search)}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
68
104
|
function EventListViewInner({
|
|
69
105
|
events,
|
|
70
106
|
run,
|
|
@@ -92,7 +128,7 @@ function EventListViewInner({
|
|
|
92
128
|
const bodyRef = useRef<HTMLDivElement>(null);
|
|
93
129
|
|
|
94
130
|
const [selectedEventId, setSelectedEventId] = useState<string | undefined>();
|
|
95
|
-
const { query, setQuery, search } = useEventSearch(onExactIdSearch);
|
|
131
|
+
const { query, setQuery, search, retry } = useEventSearch(onExactIdSearch);
|
|
96
132
|
const list = getListSource(search, { events, hasMore: hasMoreEvents });
|
|
97
133
|
|
|
98
134
|
// Rows come from the list's source; names and timings from every event on
|
|
@@ -152,6 +188,28 @@ function EventListViewInner({
|
|
|
152
188
|
: search.id.id
|
|
153
189
|
: (selectedRow?.entity.key ?? null);
|
|
154
190
|
|
|
191
|
+
const [visibleRange, setVisibleRange] = useState({
|
|
192
|
+
startIndex: 0,
|
|
193
|
+
endIndex: 0,
|
|
194
|
+
});
|
|
195
|
+
const relatedIndexes = useMemo(
|
|
196
|
+
() =>
|
|
197
|
+
listItems.flatMap((item, i) =>
|
|
198
|
+
item.kind === 'event' && item.row.entity.key === relatedKey ? [i] : []
|
|
199
|
+
),
|
|
200
|
+
[listItems, relatedKey]
|
|
201
|
+
);
|
|
202
|
+
const relatedAbove = relatedIndexes.filter(
|
|
203
|
+
(i) => i < visibleRange.startIndex
|
|
204
|
+
);
|
|
205
|
+
const relatedBelow = relatedIndexes.filter((i) => i > visibleRange.endIndex);
|
|
206
|
+
const scrollToItem = (index: number) =>
|
|
207
|
+
virtuosoRef.current?.scrollToIndex({
|
|
208
|
+
index,
|
|
209
|
+
align: 'center',
|
|
210
|
+
behavior: 'smooth',
|
|
211
|
+
});
|
|
212
|
+
|
|
155
213
|
// Event data cache: ref avoids re-renders when cache updates
|
|
156
214
|
const eventDataCacheRef = useRef<Map<string, unknown>>(new Map());
|
|
157
215
|
const cacheEventData = useCallback((eventId: string, data: unknown) => {
|
|
@@ -220,7 +278,13 @@ function EventListViewInner({
|
|
|
220
278
|
|
|
221
279
|
const panelWidth = useDetailPanelWidth(bodyRef, selectedRow !== undefined);
|
|
222
280
|
|
|
223
|
-
const toolbar =
|
|
281
|
+
const toolbar = (
|
|
282
|
+
<EventListToolbar
|
|
283
|
+
query={query}
|
|
284
|
+
hint={getSearchHint(search)}
|
|
285
|
+
onQueryChange={setQuery}
|
|
286
|
+
/>
|
|
287
|
+
);
|
|
224
288
|
|
|
225
289
|
if (isInitialLoad) {
|
|
226
290
|
return (
|
|
@@ -266,54 +330,73 @@ function EventListViewInner({
|
|
|
266
330
|
{isRefetching || search.status === 'loading' ? (
|
|
267
331
|
<EventRowsSkeleton />
|
|
268
332
|
) : rows.length === 0 ? (
|
|
269
|
-
<
|
|
270
|
-
{getEmptyMessage(search)}
|
|
271
|
-
</div>
|
|
333
|
+
<EmptyState search={search} onRetry={retry} />
|
|
272
334
|
) : (
|
|
273
|
-
<
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
335
|
+
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
336
|
+
<Virtuoso
|
|
337
|
+
ref={virtuosoRef}
|
|
338
|
+
rangeChanged={setVisibleRange}
|
|
339
|
+
totalCount={listItems.length}
|
|
340
|
+
overscan={20}
|
|
341
|
+
defaultItemHeight={25}
|
|
342
|
+
computeItemKey={(i) => {
|
|
343
|
+
const item = listItems[i];
|
|
344
|
+
return item.kind === 'gap'
|
|
345
|
+
? item.key
|
|
346
|
+
: item.row.event.eventId;
|
|
347
|
+
}}
|
|
348
|
+
endReached={() => {
|
|
349
|
+
if (list.hasMore && !isLoadingMoreEvents) {
|
|
350
|
+
void onLoadMoreEvents?.();
|
|
351
|
+
}
|
|
352
|
+
}}
|
|
353
|
+
components={{ Footer: () => <div className="h-2" /> }}
|
|
354
|
+
itemContent={(i: number) => {
|
|
355
|
+
const item = listItems[i];
|
|
356
|
+
if (item.kind === 'gap') {
|
|
357
|
+
return <IdleGapRow ms={item.ms} reason={item.reason} />;
|
|
358
|
+
}
|
|
359
|
+
const { row } = item;
|
|
360
|
+
const isSelected = selectedEventId === row.event.eventId;
|
|
361
|
+
return (
|
|
362
|
+
<EventRow
|
|
363
|
+
row={row}
|
|
364
|
+
index={item.index}
|
|
365
|
+
isSelected={isSelected}
|
|
366
|
+
isTabStop={
|
|
367
|
+
selectedIndex === -1 ? item.index === 0 : isSelected
|
|
368
|
+
}
|
|
369
|
+
relation={
|
|
370
|
+
relatedKey === null
|
|
371
|
+
? undefined
|
|
372
|
+
: row.entity.key === relatedKey
|
|
373
|
+
? 'related'
|
|
374
|
+
: 'unrelated'
|
|
375
|
+
}
|
|
376
|
+
onSelect={toggleSelectedEvent}
|
|
377
|
+
showSeparateEventOccurrenceTimestamps={
|
|
378
|
+
showSeparateEventOccurrenceTimestamps
|
|
379
|
+
}
|
|
380
|
+
/>
|
|
381
|
+
);
|
|
382
|
+
}}
|
|
383
|
+
style={{ flex: 1, minHeight: 0 }}
|
|
384
|
+
/>
|
|
385
|
+
{relatedAbove.length > 0 && (
|
|
386
|
+
<RelatedHint
|
|
387
|
+
direction="above"
|
|
388
|
+
count={relatedAbove.length}
|
|
389
|
+
onClick={() => scrollToItem(relatedAbove.at(-1) ?? 0)}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
{relatedBelow.length > 0 && (
|
|
393
|
+
<RelatedHint
|
|
394
|
+
direction="below"
|
|
395
|
+
count={relatedBelow.length}
|
|
396
|
+
onClick={() => scrollToItem(relatedBelow[0])}
|
|
397
|
+
/>
|
|
398
|
+
)}
|
|
399
|
+
</div>
|
|
317
400
|
)}
|
|
318
401
|
|
|
319
402
|
<div className="relative flex h-10 shrink-0 items-center border-t border-gray-alpha-400 px-4 text-label-13 text-gray-900">
|
|
@@ -326,10 +409,13 @@ function EventListViewInner({
|
|
|
326
409
|
{list.hasMore && (
|
|
327
410
|
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
328
411
|
<div className="pointer-events-auto">
|
|
329
|
-
<
|
|
412
|
+
<Button
|
|
413
|
+
variant="secondary"
|
|
330
414
|
loading={isLoadingMoreEvents}
|
|
331
415
|
onClick={() => void onLoadMoreEvents?.()}
|
|
332
|
-
|
|
416
|
+
>
|
|
417
|
+
Load more
|
|
418
|
+
</Button>
|
|
333
419
|
</div>
|
|
334
420
|
</div>
|
|
335
421
|
)}
|
|
@@ -362,6 +448,48 @@ function EventListViewInner({
|
|
|
362
448
|
);
|
|
363
449
|
}
|
|
364
450
|
|
|
451
|
+
function RelatedHint({
|
|
452
|
+
direction,
|
|
453
|
+
count,
|
|
454
|
+
onClick,
|
|
455
|
+
}: {
|
|
456
|
+
direction: 'above' | 'below';
|
|
457
|
+
count: number;
|
|
458
|
+
onClick: () => void;
|
|
459
|
+
}) {
|
|
460
|
+
const label = `${count} related ${count === 1 ? 'event' : 'events'}`;
|
|
461
|
+
const layer = cn('absolute inset-0', direction === 'above' && '-scale-y-100');
|
|
462
|
+
return (
|
|
463
|
+
<button
|
|
464
|
+
type="button"
|
|
465
|
+
aria-label={`${label} ${direction}`}
|
|
466
|
+
onClick={onClick}
|
|
467
|
+
className={cn(
|
|
468
|
+
'group absolute inset-x-0 z-10 flex h-10 cursor-pointer justify-end px-3 py-2 outline-none transition-opacity duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] focus-visible:shadow-[inset_0_0_0_2px_var(--ds-focus-color)] starting:opacity-0',
|
|
469
|
+
direction === 'above' ? 'top-0 items-start' : 'bottom-0 items-end'
|
|
470
|
+
)}
|
|
471
|
+
>
|
|
472
|
+
<span
|
|
473
|
+
aria-hidden
|
|
474
|
+
className={cn(
|
|
475
|
+
layer,
|
|
476
|
+
'bg-[linear-gradient(to_top,color-mix(in_oklab,var(--ds-background-100)_70%,transparent),30%,transparent)]'
|
|
477
|
+
)}
|
|
478
|
+
/>
|
|
479
|
+
<span
|
|
480
|
+
aria-hidden
|
|
481
|
+
className={cn(
|
|
482
|
+
layer,
|
|
483
|
+
'bg-[linear-gradient(to_top,color-mix(in_oklab,var(--ds-blue-500)_60%,transparent),30%,transparent)] opacity-45 transition-opacity duration-300 ease-[ease] group-hover:opacity-100 group-hover:duration-150 group-focus-visible:opacity-100 group-active:opacity-75 group-active:duration-75'
|
|
484
|
+
)}
|
|
485
|
+
/>
|
|
486
|
+
<span className="relative font-medium text-label-12 text-blue-900">
|
|
487
|
+
{label}
|
|
488
|
+
</span>
|
|
489
|
+
</button>
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
365
493
|
export function EventListView(props: EventsListProps) {
|
|
366
494
|
return (
|
|
367
495
|
<TooltipProvider delayDuration={300}>
|
package/src/components/index.ts
CHANGED
|
@@ -11,18 +11,10 @@ export type {
|
|
|
11
11
|
export {
|
|
12
12
|
HookResolveModalWrapper,
|
|
13
13
|
ResolveHookDropdownItem,
|
|
14
|
-
ResolveHookModal,
|
|
15
14
|
useHookActions,
|
|
16
15
|
} from './hook-actions';
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
SelectedSpanInfo,
|
|
20
|
-
SpanSelectionInfo,
|
|
21
|
-
} from './sidebar/entity-detail-panel';
|
|
22
|
-
export {
|
|
23
|
-
type SidebarDataContextValue,
|
|
24
|
-
SidebarDataProvider,
|
|
25
|
-
} from './sidebar/sidebar-data-context';
|
|
16
|
+
export type { SpanSelectionInfo } from './sidebar/entity-detail-panel';
|
|
17
|
+
export type { SidebarDataContextValue } from './sidebar/sidebar-data-context';
|
|
26
18
|
export type {
|
|
27
19
|
DetailResource,
|
|
28
20
|
FetchSpanDetail,
|
|
@@ -32,17 +24,9 @@ export { StreamViewerSkeleton } from './stream-viewer-skeleton';
|
|
|
32
24
|
export { TraceViewer } from './trace-viewer';
|
|
33
25
|
export { TraceViewerSkeleton } from './trace-viewer/components/trace-viewer-skeleton';
|
|
34
26
|
export { Button, type ButtonProps, buttonVariants } from './ui/button';
|
|
35
|
-
export {
|
|
36
|
-
|
|
37
|
-
type DataInspectorProps,
|
|
38
|
-
DecryptClickContext,
|
|
39
|
-
type DecryptClickContextValue,
|
|
40
|
-
} from './ui/data-inspector';
|
|
27
|
+
export { CopyButton, type CopyButtonProps } from './ui/copy-button';
|
|
28
|
+
export { DataInspector, type DataInspectorProps } from './ui/data-inspector';
|
|
41
29
|
export { DecryptButton } from './ui/decrypt-button';
|
|
42
|
-
export { IconButton } from './ui/icon-button';
|
|
43
|
-
export { Kbd } from './ui/kbd';
|
|
44
|
-
export { LoadMoreButton } from './ui/load-more-button';
|
|
45
|
-
export { MenuDropdown, type MenuDropdownOption } from './ui/menu-dropdown';
|
|
46
30
|
export { Spinner } from './ui/spinner';
|
|
47
31
|
export {
|
|
48
32
|
Tooltip,
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import { ErrorCard } from '../ui/error-card';
|
|
24
24
|
import { ErrorStackBlock, isStructuredError } from '../ui/error-stack-block';
|
|
25
25
|
import { Skeleton } from '../ui/skeleton';
|
|
26
|
+
import { Spinner } from '../ui/spinner';
|
|
26
27
|
import { TimestampTooltip } from '../ui/timestamp-tooltip';
|
|
27
28
|
import {
|
|
28
29
|
DetailMonoKeyValueRow,
|
|
@@ -191,8 +192,7 @@ function ConversationWithTabs({
|
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
/**
|
|
194
|
-
*
|
|
195
|
-
* custom theming, nodeRenderer for StreamRef/ClassInstanceRef, etc.)
|
|
195
|
+
* Placeholder for a field whose data is still encrypted.
|
|
196
196
|
*/
|
|
197
197
|
function EncryptedFieldBlock() {
|
|
198
198
|
return <EncryptedDataBlock />;
|
|
@@ -789,7 +789,7 @@ const loadingSectionLabels: Partial<Record<AttributeKey, string>> = {
|
|
|
789
789
|
dynamicWorkflowCode: 'Workflow Code',
|
|
790
790
|
};
|
|
791
791
|
|
|
792
|
-
|
|
792
|
+
const AttributeBlock = ({
|
|
793
793
|
attribute,
|
|
794
794
|
value,
|
|
795
795
|
isLoading,
|
|
@@ -861,10 +861,7 @@ export const AttributeBlock = ({
|
|
|
861
861
|
<div className="relative">
|
|
862
862
|
{typeof isLoading === 'boolean' && isLoading && (
|
|
863
863
|
<div className="absolute top-9 right-4">
|
|
864
|
-
<
|
|
865
|
-
className="animate-spin rounded-full h-4 w-4 border-b-2"
|
|
866
|
-
style={{ borderColor: 'var(--ds-gray-900)' }}
|
|
867
|
-
/>
|
|
864
|
+
<Spinner size="md" />
|
|
868
865
|
</div>
|
|
869
866
|
)}
|
|
870
867
|
<div key={attribute} className="my-2 flex flex-col gap-0">
|
|
@@ -8,13 +8,13 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
8
8
|
import { ArrowUpRight } from 'lucide-react';
|
|
9
9
|
import type { ReactNode } from 'react';
|
|
10
10
|
import { cn } from '../../lib/cn';
|
|
11
|
-
import { CopyButton } from '../trace-viewer/components/copy-button';
|
|
12
11
|
import { MiddleTruncate } from '../trace-viewer/components/middle-truncate/middle-truncate';
|
|
13
12
|
import {
|
|
14
13
|
CollapsibleContent,
|
|
15
14
|
CollapsibleRoot,
|
|
16
15
|
CollapsibleTrigger,
|
|
17
16
|
} from '../ui/collapsible';
|
|
17
|
+
import { CopyButton } from '../ui/copy-button';
|
|
18
18
|
import { CopyableDataBlock } from './copyable-data-block';
|
|
19
19
|
|
|
20
20
|
function isReservedAttributeKey(key: string): boolean {
|
|
@@ -106,9 +106,10 @@ function DetailKeyValueRowBase({
|
|
|
106
106
|
/>
|
|
107
107
|
)}
|
|
108
108
|
<CopyButton
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
textToCopy={copyText}
|
|
110
|
+
aria-label={`Copy ${label}`}
|
|
111
|
+
size="small"
|
|
112
|
+
className="-my-0.5 -mr-1"
|
|
112
113
|
/>
|
|
113
114
|
</div>
|
|
114
115
|
) : (
|
|
@@ -131,7 +132,7 @@ function DetailKeyValueRowBase({
|
|
|
131
132
|
);
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
function DetailKeyValueRow(props: DetailKeyValueRowProps) {
|
|
135
136
|
return <DetailKeyValueRowBase {...props} />;
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -158,7 +159,7 @@ function AttributeRow({
|
|
|
158
159
|
* reserved `$`-prefixed keys (alphabetical), so framework metadata doesn't
|
|
159
160
|
* crowd out user-set attributes.
|
|
160
161
|
*/
|
|
161
|
-
|
|
162
|
+
function sortAttributeKeys(keys: string[]): string[] {
|
|
162
163
|
return [...keys].sort((a, b) => {
|
|
163
164
|
const aReserved = isReservedAttributeKey(a);
|
|
164
165
|
const bReserved = isReservedAttributeKey(b);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage } from 'ai';
|
|
2
|
+
import { Check, Wrench } from 'lucide-react';
|
|
2
3
|
import { Streamdown } from 'streamdown';
|
|
3
4
|
import { DataInspector } from '../ui/data-inspector';
|
|
4
5
|
|
|
@@ -80,7 +81,7 @@ function ContentPart({ part, role }: { part: ParsedPart; role: string }) {
|
|
|
80
81
|
return (
|
|
81
82
|
<div className="rounded border border-purple-300 bg-purple-100 px-2 py-1.5">
|
|
82
83
|
<div className="flex items-center gap-1.5 text-[10px] font-medium">
|
|
83
|
-
<
|
|
84
|
+
<Wrench className="size-3 shrink-0 text-purple-900" aria-hidden />
|
|
84
85
|
<span className="text-purple-900">{part.toolName}</span>
|
|
85
86
|
</div>
|
|
86
87
|
{part.input != null && (
|
|
@@ -100,7 +101,7 @@ function ContentPart({ part, role }: { part: ParsedPart; role: string }) {
|
|
|
100
101
|
return (
|
|
101
102
|
<div className="rounded border border-green-300 bg-green-100 px-2 py-1.5">
|
|
102
103
|
<div className="flex items-center gap-1.5 text-[10px] font-medium">
|
|
103
|
-
<
|
|
104
|
+
<Check className="size-3 shrink-0 text-green-900" aria-hidden />
|
|
104
105
|
<span className="text-green-900">{part.toolName} result</span>
|
|
105
106
|
</div>
|
|
106
107
|
{part.output != null && (
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { Lock } from 'lucide-react';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import { CopyButton } from '../trace-viewer/components/copy-button';
|
|
6
5
|
import { Button } from '../ui/button';
|
|
6
|
+
import { CopyButton } from '../ui/copy-button';
|
|
7
7
|
import { DataInspector, DecryptClickContext } from '../ui/data-inspector';
|
|
8
|
-
import { Spinner } from '../ui/spinner';
|
|
9
8
|
|
|
10
9
|
const encryptedPlaceholderPreview = `{
|
|
11
10
|
"input": "[encrypted]",
|
|
@@ -27,18 +26,15 @@ export function EncryptedDataBlock() {
|
|
|
27
26
|
{ctx ? (
|
|
28
27
|
<Button
|
|
29
28
|
onClick={ctx.onDecrypt}
|
|
30
|
-
|
|
29
|
+
loading={ctx.isDecrypting}
|
|
30
|
+
disabled={ctx.isDecryptDisabled}
|
|
31
31
|
title={
|
|
32
32
|
ctx.isDecryptDisabled ? ctx.decryptDisabledReason : undefined
|
|
33
33
|
}
|
|
34
|
-
size="
|
|
34
|
+
size="small"
|
|
35
|
+
prefix={<Lock />}
|
|
35
36
|
>
|
|
36
|
-
|
|
37
|
-
<Spinner size={10} />
|
|
38
|
-
) : (
|
|
39
|
-
<Lock className="h-3 w-3" />
|
|
40
|
-
)}
|
|
41
|
-
<span>Decrypt</span>
|
|
37
|
+
Decrypt
|
|
42
38
|
</Button>
|
|
43
39
|
) : (
|
|
44
40
|
<span className="inline-flex items-center gap-1 rounded border border-gray-alpha-400 bg-gray-100 px-1.5 py-0.5 text-button-12 font-medium text-gray-700">
|
|
@@ -56,12 +52,19 @@ export const serializeForClipboard = (value: unknown): string => {
|
|
|
56
52
|
if (
|
|
57
53
|
typeof value === 'number' ||
|
|
58
54
|
typeof value === 'boolean' ||
|
|
55
|
+
typeof value === 'bigint' ||
|
|
59
56
|
value === null
|
|
60
57
|
) {
|
|
61
58
|
return String(value);
|
|
62
59
|
}
|
|
63
60
|
try {
|
|
64
|
-
|
|
61
|
+
// Hydrated payloads can contain BigInt values, which JSON.stringify rejects.
|
|
62
|
+
// Write them as decimal strings, matching the CLI's `stringifyJSON`.
|
|
63
|
+
return JSON.stringify(
|
|
64
|
+
value,
|
|
65
|
+
(_key, v) => (typeof v === 'bigint' ? v.toString() : v),
|
|
66
|
+
2
|
|
67
|
+
);
|
|
65
68
|
} catch {
|
|
66
69
|
return String(value);
|
|
67
70
|
}
|
|
@@ -71,9 +74,9 @@ export function CopyableDataBlock({ data }: { data: unknown }) {
|
|
|
71
74
|
return (
|
|
72
75
|
<div className="relative overflow-x-auto rounded-md border border-gray-alpha-400 p-3">
|
|
73
76
|
<CopyButton
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
className="absolute right-2 top-2 z-10
|
|
77
|
+
textToCopy={serializeForClipboard(data)}
|
|
78
|
+
aria-label="Copy data"
|
|
79
|
+
className="absolute right-2 top-2 z-10 border border-gray-alpha-400 bg-background-100 enabled:hover:bg-gray-200"
|
|
77
80
|
/>
|
|
78
81
|
<DataInspector data={data} />
|
|
79
82
|
</div>
|
|
@@ -11,7 +11,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
11
11
|
import { useToast } from '../../lib/toast';
|
|
12
12
|
import { Button } from '../ui/button';
|
|
13
13
|
import { DecryptClickContext } from '../ui/data-inspector';
|
|
14
|
-
import { Spinner } from '../ui/spinner';
|
|
15
14
|
import { AttributePanel } from './attribute-panel';
|
|
16
15
|
import { EventsList } from './events-list';
|
|
17
16
|
import { ResolveHookModal } from './resolve-hook-modal';
|
|
@@ -342,10 +341,8 @@ export function EntityDetailPanel({
|
|
|
342
341
|
size="small"
|
|
343
342
|
className="w-full"
|
|
344
343
|
onClick={handleWakeUp}
|
|
345
|
-
|
|
346
|
-
aria-busy={stoppingSleep}
|
|
344
|
+
loading={stoppingSleep}
|
|
347
345
|
>
|
|
348
|
-
{stoppingSleep ? <Spinner size={16} /> : null}
|
|
349
346
|
Wake Up Sleep
|
|
350
347
|
</Button>
|
|
351
348
|
)}
|
|
@@ -357,10 +354,8 @@ export function EntityDetailPanel({
|
|
|
357
354
|
size="small"
|
|
358
355
|
className="w-full"
|
|
359
356
|
onClick={() => setShowResolveHookModal(true)}
|
|
360
|
-
|
|
361
|
-
aria-busy={resolvingHook}
|
|
357
|
+
loading={resolvingHook}
|
|
362
358
|
>
|
|
363
|
-
{resolvingHook ? <Spinner size={16} /> : null}
|
|
364
359
|
Resolve Hook
|
|
365
360
|
</Button>
|
|
366
361
|
)}
|
|
@@ -26,7 +26,7 @@ export function StreamImagePreview({ data }: { data: Uint8Array }) {
|
|
|
26
26
|
<div className="mb-2 flex items-center justify-between gap-2">
|
|
27
27
|
<span className="text-label-12 text-gray-900">Image Preview</span>
|
|
28
28
|
{url ? (
|
|
29
|
-
<Button asChild size="
|
|
29
|
+
<Button asChild size="small" variant="secondary">
|
|
30
30
|
<a href={url} download={`workflow-stream.${type?.split('/')[1]}`}>
|
|
31
31
|
Download Image
|
|
32
32
|
</a>
|
|
@@ -6,7 +6,7 @@ import { getStreamImageType } from '../lib/stream-image';
|
|
|
6
6
|
import { serializeForClipboard } from './sidebar/copyable-data-block';
|
|
7
7
|
import { StreamImagePreview } from './stream-image-preview';
|
|
8
8
|
import { StreamViewerSkeleton } from './stream-viewer-skeleton';
|
|
9
|
-
import { CopyButton } from './
|
|
9
|
+
import { CopyButton } from './ui/copy-button';
|
|
10
10
|
import { DataInspector } from './ui/data-inspector';
|
|
11
11
|
|
|
12
12
|
// ──────────────────────────────────────────────────────────────────────────
|
|
@@ -55,9 +55,9 @@ const ChunkRow = React.memo(function ChunkRow({ chunk }: { chunk: Chunk }) {
|
|
|
55
55
|
</div>
|
|
56
56
|
{!image && (
|
|
57
57
|
<CopyButton
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
className="
|
|
58
|
+
textToCopy={serializeForClipboard(chunk.value)}
|
|
59
|
+
aria-label="Copy chunk"
|
|
60
|
+
className="-mr-1"
|
|
61
61
|
/>
|
|
62
62
|
)}
|
|
63
63
|
</div>
|
|
@@ -23,6 +23,7 @@ export function DetailPanelShell({
|
|
|
23
23
|
width,
|
|
24
24
|
title,
|
|
25
25
|
itemLabel,
|
|
26
|
+
actions,
|
|
26
27
|
onPrev,
|
|
27
28
|
onNext,
|
|
28
29
|
onClose,
|
|
@@ -33,6 +34,7 @@ export function DetailPanelShell({
|
|
|
33
34
|
title: ReactNode;
|
|
34
35
|
/** What one item is called in labels, e.g. "span" or "event". */
|
|
35
36
|
itemLabel: string;
|
|
37
|
+
actions?: ReactNode;
|
|
36
38
|
onPrev?: () => void;
|
|
37
39
|
onNext?: () => void;
|
|
38
40
|
onClose: () => void;
|
|
@@ -90,6 +92,7 @@ export function DetailPanelShell({
|
|
|
90
92
|
{title}
|
|
91
93
|
</div>
|
|
92
94
|
<div className="flex items-center gap-0.5 shrink-0">
|
|
95
|
+
{actions}
|
|
93
96
|
<Tooltip>
|
|
94
97
|
<TooltipTrigger asChild>
|
|
95
98
|
<IconButton
|