@lvce-editor/chat-debug-view 10.6.0 → 10.8.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/chatDebugViewWorkerMain.js +1248 -285
- package/package.json +1 -1
|
@@ -1446,6 +1446,7 @@ const ImageCouldNotBeLoaded = 'image could not be loaded';
|
|
|
1446
1446
|
const InvalidSessionId = 'Invalid session id';
|
|
1447
1447
|
const InvalidUriEncoding = 'Invalid URI encoding';
|
|
1448
1448
|
const InvalidUriFormat = 'Invalid URI format';
|
|
1449
|
+
const Method$1 = 'Method';
|
|
1449
1450
|
const MissingUri = 'Missing URI';
|
|
1450
1451
|
const Network$1 = 'Network';
|
|
1451
1452
|
const NoChatSessionFound = 'No chat session found for sessionId "{PH1}".';
|
|
@@ -1528,6 +1529,9 @@ const invalidUriFormat = () => {
|
|
|
1528
1529
|
const missingUri = () => {
|
|
1529
1530
|
return i18nString(MissingUri);
|
|
1530
1531
|
};
|
|
1532
|
+
const method = () => {
|
|
1533
|
+
return i18nString(Method$1);
|
|
1534
|
+
};
|
|
1531
1535
|
const network = () => {
|
|
1532
1536
|
return i18nString(Network$1);
|
|
1533
1537
|
};
|
|
@@ -1830,14 +1834,19 @@ const parseFilterValue = filterValue => {
|
|
|
1830
1834
|
};
|
|
1831
1835
|
|
|
1832
1836
|
const Type = 'type';
|
|
1837
|
+
const Method = 'method';
|
|
1833
1838
|
const Duration = 'duration';
|
|
1834
1839
|
const Status$1 = 'status';
|
|
1835
|
-
const tableColumnNames = [Type, Status$1, Duration];
|
|
1840
|
+
const tableColumnNames = [Type, Method, Status$1, Duration];
|
|
1836
1841
|
const createTableColumns = () => {
|
|
1837
1842
|
return [{
|
|
1838
1843
|
isVisible: true,
|
|
1839
1844
|
label: type(),
|
|
1840
1845
|
name: Type
|
|
1846
|
+
}, {
|
|
1847
|
+
isVisible: true,
|
|
1848
|
+
label: method(),
|
|
1849
|
+
name: Method
|
|
1841
1850
|
}, {
|
|
1842
1851
|
isVisible: true,
|
|
1843
1852
|
label: status(),
|
|
@@ -1877,6 +1886,8 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1877
1886
|
switch (name) {
|
|
1878
1887
|
case Duration:
|
|
1879
1888
|
return duration();
|
|
1889
|
+
case Method:
|
|
1890
|
+
return method();
|
|
1880
1891
|
case Status$1:
|
|
1881
1892
|
return status();
|
|
1882
1893
|
case Type:
|
|
@@ -1888,6 +1899,7 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1888
1899
|
|
|
1889
1900
|
const defaultTableColumnWidths = {
|
|
1890
1901
|
duration: 110,
|
|
1902
|
+
method: 90,
|
|
1891
1903
|
status: 110,
|
|
1892
1904
|
type: 260
|
|
1893
1905
|
};
|
|
@@ -1921,6 +1933,7 @@ const getTableWidthFromClientX = (viewX, width, clientX) => {
|
|
|
1921
1933
|
|
|
1922
1934
|
const minimumTableColumnWidths = {
|
|
1923
1935
|
[Duration]: 80,
|
|
1936
|
+
[Method]: 56,
|
|
1924
1937
|
[Status$1]: 56,
|
|
1925
1938
|
[Type]: 80
|
|
1926
1939
|
};
|
|
@@ -1989,7 +2002,7 @@ const getResizedTableColumnWidths = (width, tableWidth, visibleTableColumns, tab
|
|
|
1989
2002
|
};
|
|
1990
2003
|
|
|
1991
2004
|
const isSameTableColumnWidths = (first, second) => {
|
|
1992
|
-
return first.type === second.type && first.duration === second.duration && first.status === second.status;
|
|
2005
|
+
return first.type === second.type && first.method === second.method && first.duration === second.duration && first.status === second.status;
|
|
1993
2006
|
};
|
|
1994
2007
|
|
|
1995
2008
|
const isFiniteNumber = value => {
|
|
@@ -2001,7 +2014,7 @@ const isTableColumnWidths = value => {
|
|
|
2001
2014
|
return false;
|
|
2002
2015
|
}
|
|
2003
2016
|
const record = value;
|
|
2004
|
-
return isFiniteNumber(record.type) && isFiniteNumber(record.duration) && isFiniteNumber(record.status);
|
|
2017
|
+
return isFiniteNumber(record.type) && isFiniteNumber(record.method) && isFiniteNumber(record.duration) && isFiniteNumber(record.status);
|
|
2005
2018
|
};
|
|
2006
2019
|
|
|
2007
2020
|
const validEventCategoryFilters = new Set([All, Network, Stream, Tools, Ui]);
|
|
@@ -2210,6 +2223,9 @@ const createDefaultState = () => {
|
|
|
2210
2223
|
databaseName: 'lvce-chat-view-sessions',
|
|
2211
2224
|
dataBaseVersion: 2,
|
|
2212
2225
|
detailTabs: createDetailTabs(),
|
|
2226
|
+
devtoolsRootGap: 4,
|
|
2227
|
+
devtoolsTimelineHeight: 88,
|
|
2228
|
+
devtoolsTopHeight: 28,
|
|
2213
2229
|
errorMessage: '',
|
|
2214
2230
|
events: [],
|
|
2215
2231
|
eventStoreName: 'chat-view-events',
|
|
@@ -2222,6 +2238,9 @@ const createDefaultState = () => {
|
|
|
2222
2238
|
platform: 0,
|
|
2223
2239
|
previewTextCursorColumnIndex: null,
|
|
2224
2240
|
previewTextCursorRowIndex: null,
|
|
2241
|
+
previewTextDeltaY: 0,
|
|
2242
|
+
previewTextScrollBarHandleOffset: 0,
|
|
2243
|
+
previewTextScrollBarPointerActive: false,
|
|
2225
2244
|
sashPointerActive: false,
|
|
2226
2245
|
selectedEvent: null,
|
|
2227
2246
|
selectedEventId: null,
|
|
@@ -2293,7 +2312,7 @@ const RenderFocusContext = 4;
|
|
|
2293
2312
|
const RenderFocus = 5;
|
|
2294
2313
|
|
|
2295
2314
|
const diff = (oldState, newState) => {
|
|
2296
|
-
if (oldState.categoryFilters !== newState.categoryFilters || oldState.detailTabs !== newState.detailTabs || oldState.errorMessage !== newState.errorMessage || oldState.events !== newState.events || oldState.filterValue !== newState.filterValue || oldState.previewTextCursorColumnIndex !== newState.previewTextCursorColumnIndex || oldState.previewTextCursorRowIndex !== newState.previewTextCursorRowIndex || oldState.sessionId !== newState.sessionId || oldState.showEventStreamFinishedEvents !== newState.showEventStreamFinishedEvents || oldState.showInputEvents !== newState.showInputEvents || oldState.showResponsePartEvents !== newState.showResponsePartEvents || oldState.sortColumn !== newState.sortColumn || oldState.sortDescending !== newState.sortDescending || oldState.tableColumnWidths !== newState.tableColumnWidths || oldState.tableDeltaY !== newState.tableDeltaY || oldState.tableMaxLineY !== newState.tableMaxLineY || oldState.tableMinLineY !== newState.tableMinLineY || oldState.tableWidth !== newState.tableWidth || oldState.timelineEndSeconds !== newState.timelineEndSeconds || oldState.timelineHeight !== newState.timelineHeight || oldState.timelineHoverPercent !== newState.timelineHoverPercent || oldState.timelineHoverSeconds !== newState.timelineHoverSeconds || oldState.timelineSelectionActive !== newState.timelineSelectionActive || oldState.timelineSelectionAnchorSeconds !== newState.timelineSelectionAnchorSeconds || oldState.timelineSelectionFocusSeconds !== newState.timelineSelectionFocusSeconds || oldState.timelineStartSeconds !== newState.timelineStartSeconds || oldState.useDevtoolsLayout !== newState.useDevtoolsLayout || oldState.tableColumns !== newState.tableColumns || oldState.selectedEvent !== newState.selectedEvent || oldState.selectedEventIndex !== newState.selectedEventIndex || oldState.focus !== newState.focus || oldState.width !== newState.width || oldState.uid !== newState.uid) {
|
|
2315
|
+
if (oldState.categoryFilters !== newState.categoryFilters || oldState.detailTabs !== newState.detailTabs || oldState.errorMessage !== newState.errorMessage || oldState.events !== newState.events || oldState.filterValue !== newState.filterValue || oldState.previewTextCursorColumnIndex !== newState.previewTextCursorColumnIndex || oldState.previewTextCursorRowIndex !== newState.previewTextCursorRowIndex || oldState.previewTextDeltaY !== newState.previewTextDeltaY || oldState.sessionId !== newState.sessionId || oldState.showEventStreamFinishedEvents !== newState.showEventStreamFinishedEvents || oldState.showInputEvents !== newState.showInputEvents || oldState.showResponsePartEvents !== newState.showResponsePartEvents || oldState.sortColumn !== newState.sortColumn || oldState.sortDescending !== newState.sortDescending || oldState.tableColumnWidths !== newState.tableColumnWidths || oldState.tableDeltaY !== newState.tableDeltaY || oldState.tableMaxLineY !== newState.tableMaxLineY || oldState.tableMinLineY !== newState.tableMinLineY || oldState.tableWidth !== newState.tableWidth || oldState.timelineEndSeconds !== newState.timelineEndSeconds || oldState.timelineHeight !== newState.timelineHeight || oldState.timelineHoverPercent !== newState.timelineHoverPercent || oldState.timelineHoverSeconds !== newState.timelineHoverSeconds || oldState.timelineSelectionActive !== newState.timelineSelectionActive || oldState.timelineSelectionAnchorSeconds !== newState.timelineSelectionAnchorSeconds || oldState.timelineSelectionFocusSeconds !== newState.timelineSelectionFocusSeconds || oldState.timelineStartSeconds !== newState.timelineStartSeconds || oldState.useDevtoolsLayout !== newState.useDevtoolsLayout || oldState.tableColumns !== newState.tableColumns || oldState.selectedEvent !== newState.selectedEvent || oldState.selectedEventIndex !== newState.selectedEventIndex || oldState.focus !== newState.focus || oldState.width !== newState.width || oldState.uid !== newState.uid) {
|
|
2297
2316
|
return [RenderIncremental, RenderCss];
|
|
2298
2317
|
}
|
|
2299
2318
|
return [];
|
|
@@ -2373,9 +2392,7 @@ const mergeToolExecutionEvents = (startedEvent, finishedEvent, type = mergedEven
|
|
|
2373
2392
|
...(ended === undefined ? {} : {
|
|
2374
2393
|
ended
|
|
2375
2394
|
}),
|
|
2376
|
-
|
|
2377
|
-
eventId
|
|
2378
|
-
}),
|
|
2395
|
+
eventId,
|
|
2379
2396
|
...(started === undefined ? {} : {
|
|
2380
2397
|
started
|
|
2381
2398
|
}),
|
|
@@ -2503,7 +2520,7 @@ const getVisibleEvents = (events, showInputEvents, showResponsePartEvents, showE
|
|
|
2503
2520
|
|
|
2504
2521
|
const isNetworkEvent = event => {
|
|
2505
2522
|
const normalizedType = event.type.toLowerCase();
|
|
2506
|
-
return normalizedType === 'request' || normalizedType === 'response' || normalizedType === 'handle-response' || normalizedType.includes('fetch') || normalizedType.includes('xhr');
|
|
2523
|
+
return normalizedType === 'request' || normalizedType === 'ai-request' || normalizedType === 'response' || normalizedType === 'ai-response-success' || normalizedType === 'handle-response' || normalizedType.includes('fetch') || normalizedType.includes('xhr');
|
|
2507
2524
|
};
|
|
2508
2525
|
|
|
2509
2526
|
const isStreamEvent = event => {
|
|
@@ -2576,7 +2593,6 @@ const getEventTableDurationText = event => {
|
|
|
2576
2593
|
return `${durationText.slice(0, -2)} ms`;
|
|
2577
2594
|
};
|
|
2578
2595
|
|
|
2579
|
-
const toolExecutionTypePrefix = 'tool-execution';
|
|
2580
2596
|
const getToolName = event => {
|
|
2581
2597
|
if (typeof event.toolName === 'string' && event.toolName) {
|
|
2582
2598
|
return event.toolName;
|
|
@@ -2598,6 +2614,8 @@ const getToolName = event => {
|
|
|
2598
2614
|
}
|
|
2599
2615
|
return name;
|
|
2600
2616
|
};
|
|
2617
|
+
|
|
2618
|
+
const toolExecutionTypePrefix = 'tool-execution';
|
|
2601
2619
|
const getEventTypeLabel = event => {
|
|
2602
2620
|
if (!event.type.startsWith(toolExecutionTypePrefix)) {
|
|
2603
2621
|
return event.type;
|
|
@@ -2750,11 +2768,11 @@ const devtoolsTableScrollBarWidth = 12;
|
|
|
2750
2768
|
const devtoolsTableSummaryHeight = 24;
|
|
2751
2769
|
const minimumDevtoolsTableScrollBarHeight = 20;
|
|
2752
2770
|
|
|
2753
|
-
const devtoolsRootGap = 4;
|
|
2754
|
-
const devtoolsTopHeight = 28;
|
|
2755
|
-
const devtoolsTimelineHeight = 88;
|
|
2756
2771
|
const getTableBodyY = (state, hasTimeline) => {
|
|
2757
2772
|
const {
|
|
2773
|
+
devtoolsRootGap,
|
|
2774
|
+
devtoolsTimelineHeight,
|
|
2775
|
+
devtoolsTopHeight,
|
|
2758
2776
|
y
|
|
2759
2777
|
} = state;
|
|
2760
2778
|
return y + viewPadding + devtoolsTopHeight + devtoolsRootGap + (hasTimeline ? devtoolsTimelineHeight : 0) + devtoolsTableHeaderHeight;
|
|
@@ -2992,6 +3010,9 @@ const selectEventAtIndex = async (state, selectedEventIndex, dependencies = sele
|
|
|
2992
3010
|
detailTabs: createDetailTabs(selectedDetailTab, resolvedSelectedEvent),
|
|
2993
3011
|
previewTextCursorColumnIndex: null,
|
|
2994
3012
|
previewTextCursorRowIndex: null,
|
|
3013
|
+
previewTextDeltaY: 0,
|
|
3014
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3015
|
+
previewTextScrollBarPointerActive: false,
|
|
2995
3016
|
selectedEvent: resolvedSelectedEvent,
|
|
2996
3017
|
selectedEventId: selectedEvent.eventId,
|
|
2997
3018
|
selectedEventIndex
|
|
@@ -3334,6 +3355,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3334
3355
|
...state,
|
|
3335
3356
|
previewTextCursorColumnIndex: null,
|
|
3336
3357
|
previewTextCursorRowIndex: null,
|
|
3358
|
+
previewTextDeltaY: 0,
|
|
3359
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3360
|
+
previewTextScrollBarPointerActive: false,
|
|
3337
3361
|
selectedEvent: null,
|
|
3338
3362
|
selectedEventIndex: null
|
|
3339
3363
|
};
|
|
@@ -3345,6 +3369,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3345
3369
|
...state,
|
|
3346
3370
|
previewTextCursorColumnIndex: null,
|
|
3347
3371
|
previewTextCursorRowIndex: null,
|
|
3372
|
+
previewTextDeltaY: 0,
|
|
3373
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3374
|
+
previewTextScrollBarPointerActive: false,
|
|
3348
3375
|
selectedEvent: null,
|
|
3349
3376
|
selectedEventId: null,
|
|
3350
3377
|
selectedEventIndex: null
|
|
@@ -3356,6 +3383,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3356
3383
|
...state,
|
|
3357
3384
|
previewTextCursorColumnIndex: null,
|
|
3358
3385
|
previewTextCursorRowIndex: null,
|
|
3386
|
+
previewTextDeltaY: 0,
|
|
3387
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3388
|
+
previewTextScrollBarPointerActive: false,
|
|
3359
3389
|
selectedEvent: null,
|
|
3360
3390
|
selectedEventId: null,
|
|
3361
3391
|
selectedEventIndex: null
|
|
@@ -3367,6 +3397,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3367
3397
|
...state,
|
|
3368
3398
|
previewTextCursorColumnIndex: null,
|
|
3369
3399
|
previewTextCursorRowIndex: null,
|
|
3400
|
+
previewTextDeltaY: 0,
|
|
3401
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3402
|
+
previewTextScrollBarPointerActive: false,
|
|
3370
3403
|
selectedEvent: resolvedSelectedEvent,
|
|
3371
3404
|
selectedEventId: selectedEvent.eventId,
|
|
3372
3405
|
selectedEventIndex
|
|
@@ -3446,11 +3479,14 @@ const handleClickRefresh = async state => {
|
|
|
3446
3479
|
return handleClickRefreshDependencies.refresh(state);
|
|
3447
3480
|
};
|
|
3448
3481
|
|
|
3449
|
-
const handleCloseDetails = state => {
|
|
3482
|
+
const handleCloseDetails$1 = state => {
|
|
3450
3483
|
return {
|
|
3451
3484
|
...state,
|
|
3452
3485
|
previewTextCursorColumnIndex: null,
|
|
3453
3486
|
previewTextCursorRowIndex: null,
|
|
3487
|
+
previewTextDeltaY: 0,
|
|
3488
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3489
|
+
previewTextScrollBarPointerActive: false,
|
|
3454
3490
|
selectedEvent: null,
|
|
3455
3491
|
selectedEventId: null,
|
|
3456
3492
|
selectedEventIndex: null
|
|
@@ -3542,7 +3578,7 @@ const withPreservedSelection$1 = (state, nextState) => {
|
|
|
3542
3578
|
});
|
|
3543
3579
|
};
|
|
3544
3580
|
|
|
3545
|
-
const handleEventCategoryFilter = (state, value, ctrlKey = false, metaKey = false) => {
|
|
3581
|
+
const handleEventCategoryFilter$1 = (state, value, ctrlKey = false, metaKey = false) => {
|
|
3546
3582
|
const {
|
|
3547
3583
|
categoryFilters
|
|
3548
3584
|
} = state;
|
|
@@ -3655,115 +3691,123 @@ const withPreservedSelection = (state, nextState) => {
|
|
|
3655
3691
|
selectedEventIndex
|
|
3656
3692
|
});
|
|
3657
3693
|
};
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
categoryFilters
|
|
3674
|
-
};
|
|
3675
|
-
return withPreservedSelection(state, nextState);
|
|
3676
|
-
}
|
|
3677
|
-
if (name === ShowEventStreamFinishedEvents) {
|
|
3678
|
-
const nextState = {
|
|
3679
|
-
...state,
|
|
3680
|
-
showEventStreamFinishedEvents: getBoolean(checked)
|
|
3681
|
-
};
|
|
3682
|
-
return withPreservedSelection(state, nextState);
|
|
3683
|
-
}
|
|
3684
|
-
if (name === ShowInputEvents) {
|
|
3685
|
-
const nextState = {
|
|
3686
|
-
...state,
|
|
3687
|
-
showInputEvents: getBoolean(checked)
|
|
3688
|
-
};
|
|
3689
|
-
return withPreservedSelection(state, nextState);
|
|
3690
|
-
}
|
|
3691
|
-
if (name === ShowResponsePartEvents) {
|
|
3692
|
-
const nextState = {
|
|
3693
|
-
...state,
|
|
3694
|
-
showResponsePartEvents: getBoolean(checked)
|
|
3695
|
-
};
|
|
3696
|
-
return withPreservedSelection(state, nextState);
|
|
3697
|
-
}
|
|
3698
|
-
if (name === UseDevtoolsLayout) {
|
|
3699
|
-
const useDevtoolsLayout = getBoolean(checked);
|
|
3700
|
-
const selectedEventIndex = useDevtoolsLayout ? getSelectedEventIndex(state) : null;
|
|
3701
|
-
return applyVirtualTableState({
|
|
3702
|
-
...state,
|
|
3703
|
-
previewTextCursorColumnIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorColumnIndex : null,
|
|
3704
|
-
previewTextCursorRowIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorRowIndex : null,
|
|
3705
|
-
selectedEvent: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEvent : null,
|
|
3706
|
-
selectedEventId: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEventId : null,
|
|
3707
|
-
selectedEventIndex,
|
|
3708
|
-
useDevtoolsLayout
|
|
3709
|
-
});
|
|
3710
|
-
}
|
|
3711
|
-
if (name === SelectedEventIndex) {
|
|
3712
|
-
const selectedEventIndex = parseSelectedEventIndex(value);
|
|
3713
|
-
return withSelectedEventVisible({
|
|
3714
|
-
...state,
|
|
3715
|
-
previewTextCursorColumnIndex: selectedEventIndex === null ? null : state.previewTextCursorColumnIndex,
|
|
3716
|
-
previewTextCursorRowIndex: selectedEventIndex === null ? null : state.previewTextCursorRowIndex,
|
|
3717
|
-
selectedEvent: selectedEventIndex === null ? null : state.selectedEvent,
|
|
3718
|
-
selectedEventId: selectedEventIndex === null ? null : state.selectedEventId,
|
|
3719
|
-
selectedEventIndex
|
|
3720
|
-
});
|
|
3721
|
-
}
|
|
3722
|
-
if (name === TimelineStartSeconds) {
|
|
3723
|
-
const nextState = {
|
|
3724
|
-
...state,
|
|
3725
|
-
timelineStartSeconds: value
|
|
3726
|
-
};
|
|
3727
|
-
return withPreservedSelection(state, nextState);
|
|
3728
|
-
}
|
|
3729
|
-
if (name === TimelineEndSeconds) {
|
|
3730
|
-
const nextState = {
|
|
3731
|
-
...state,
|
|
3732
|
-
timelineEndSeconds: value
|
|
3733
|
-
};
|
|
3734
|
-
return withPreservedSelection(state, nextState);
|
|
3694
|
+
const updateWithPreservedSelection = (state, updates) => {
|
|
3695
|
+
return withPreservedSelection(state, {
|
|
3696
|
+
...state,
|
|
3697
|
+
...updates
|
|
3698
|
+
});
|
|
3699
|
+
};
|
|
3700
|
+
const handleFilter = (state, value) => {
|
|
3701
|
+
return updateWithPreservedSelection(state, {
|
|
3702
|
+
filterValue: value
|
|
3703
|
+
});
|
|
3704
|
+
};
|
|
3705
|
+
const handleEventCategoryFilter = (state, value) => {
|
|
3706
|
+
const categoryFilters = selectCategoryFilter(state.categoryFilters, value || All);
|
|
3707
|
+
if (categoryFilters === state.categoryFilters) {
|
|
3708
|
+
return state;
|
|
3735
3709
|
}
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3710
|
+
return updateWithPreservedSelection(state, {
|
|
3711
|
+
categoryFilters
|
|
3712
|
+
});
|
|
3713
|
+
};
|
|
3714
|
+
const handleShowEventStreamFinishedEvents$1 = (state, _value, checked) => {
|
|
3715
|
+
return updateWithPreservedSelection(state, {
|
|
3716
|
+
showEventStreamFinishedEvents: getBoolean(checked)
|
|
3717
|
+
});
|
|
3718
|
+
};
|
|
3719
|
+
const handleShowInputEvents$1 = (state, _value, checked) => {
|
|
3720
|
+
return updateWithPreservedSelection(state, {
|
|
3721
|
+
showInputEvents: getBoolean(checked)
|
|
3722
|
+
});
|
|
3723
|
+
};
|
|
3724
|
+
const handleShowResponsePartEvents$1 = (state, _value, checked) => {
|
|
3725
|
+
return updateWithPreservedSelection(state, {
|
|
3726
|
+
showResponsePartEvents: getBoolean(checked)
|
|
3727
|
+
});
|
|
3728
|
+
};
|
|
3729
|
+
const handleUseDevtoolsLayout = (state, _value, checked) => {
|
|
3730
|
+
const useDevtoolsLayout = getBoolean(checked);
|
|
3731
|
+
const selectedEventIndex = useDevtoolsLayout ? getSelectedEventIndex(state) : null;
|
|
3732
|
+
const hasSelectedEvent = useDevtoolsLayout && selectedEventIndex !== null;
|
|
3733
|
+
return applyVirtualTableState({
|
|
3734
|
+
...state,
|
|
3735
|
+
previewTextCursorColumnIndex: hasSelectedEvent ? state.previewTextCursorColumnIndex : null,
|
|
3736
|
+
previewTextCursorRowIndex: hasSelectedEvent ? state.previewTextCursorRowIndex : null,
|
|
3737
|
+
selectedEvent: hasSelectedEvent ? state.selectedEvent : null,
|
|
3738
|
+
selectedEventId: hasSelectedEvent ? state.selectedEventId : null,
|
|
3739
|
+
selectedEventIndex,
|
|
3740
|
+
useDevtoolsLayout
|
|
3741
|
+
});
|
|
3742
|
+
};
|
|
3743
|
+
const handleSelectedEventIndex = (state, value) => {
|
|
3744
|
+
const selectedEventIndex = parseSelectedEventIndex(value);
|
|
3745
|
+
const hasSelectedEvent = selectedEventIndex !== null;
|
|
3746
|
+
return withSelectedEventVisible({
|
|
3747
|
+
...state,
|
|
3748
|
+
previewTextCursorColumnIndex: hasSelectedEvent ? state.previewTextCursorColumnIndex : null,
|
|
3749
|
+
previewTextCursorRowIndex: hasSelectedEvent ? state.previewTextCursorRowIndex : null,
|
|
3750
|
+
selectedEvent: hasSelectedEvent ? state.selectedEvent : null,
|
|
3751
|
+
selectedEventId: hasSelectedEvent ? state.selectedEventId : null,
|
|
3752
|
+
selectedEventIndex
|
|
3753
|
+
});
|
|
3754
|
+
};
|
|
3755
|
+
const handleTimelineStartSeconds$1 = (state, value) => {
|
|
3756
|
+
return updateWithPreservedSelection(state, {
|
|
3757
|
+
timelineStartSeconds: value
|
|
3758
|
+
});
|
|
3759
|
+
};
|
|
3760
|
+
const handleTimelineEndSeconds$1 = (state, value) => {
|
|
3761
|
+
return updateWithPreservedSelection(state, {
|
|
3762
|
+
timelineEndSeconds: value
|
|
3763
|
+
});
|
|
3764
|
+
};
|
|
3765
|
+
const handleTimelineRangePreset$1 = (state, value) => {
|
|
3766
|
+
return updateWithPreservedSelection(state, parseTimelineRangePreset$1(value));
|
|
3767
|
+
};
|
|
3768
|
+
const handleCloseDetails = state => {
|
|
3769
|
+
return applyVirtualTableState({
|
|
3770
|
+
...state,
|
|
3771
|
+
previewTextCursorColumnIndex: null,
|
|
3772
|
+
previewTextCursorRowIndex: null,
|
|
3773
|
+
selectedEvent: null,
|
|
3774
|
+
selectedEventId: null,
|
|
3775
|
+
selectedEventIndex: null
|
|
3776
|
+
});
|
|
3777
|
+
};
|
|
3778
|
+
const handleDetailTab = (state, value) => {
|
|
3779
|
+
if (!isDetailTab(value)) {
|
|
3780
|
+
return state;
|
|
3742
3781
|
}
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
previewTextCursorColumnIndex: null,
|
|
3747
|
-
previewTextCursorRowIndex: null,
|
|
3748
|
-
selectedEvent: null,
|
|
3749
|
-
selectedEventId: null,
|
|
3750
|
-
selectedEventIndex: null
|
|
3751
|
-
});
|
|
3782
|
+
const detailTabs = selectDetailTab$1(state.detailTabs, value);
|
|
3783
|
+
if (detailTabs === state.detailTabs) {
|
|
3784
|
+
return state;
|
|
3752
3785
|
}
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3786
|
+
return {
|
|
3787
|
+
...state,
|
|
3788
|
+
detailTabs
|
|
3789
|
+
};
|
|
3790
|
+
};
|
|
3791
|
+
const inputHandlers = {
|
|
3792
|
+
[CloseDetails]: handleCloseDetails,
|
|
3793
|
+
[DetailTab]: handleDetailTab,
|
|
3794
|
+
[EventCategoryFilter]: handleEventCategoryFilter,
|
|
3795
|
+
[Filter]: handleFilter,
|
|
3796
|
+
[SelectedEventIndex]: handleSelectedEventIndex,
|
|
3797
|
+
[ShowEventStreamFinishedEvents]: handleShowEventStreamFinishedEvents$1,
|
|
3798
|
+
[ShowInputEvents]: handleShowInputEvents$1,
|
|
3799
|
+
[ShowResponsePartEvents]: handleShowResponsePartEvents$1,
|
|
3800
|
+
[TimelineEndSeconds]: handleTimelineEndSeconds$1,
|
|
3801
|
+
[TimelineRangePreset]: handleTimelineRangePreset$1,
|
|
3802
|
+
[TimelineStartSeconds]: handleTimelineStartSeconds$1,
|
|
3803
|
+
[UseDevtoolsLayout]: handleUseDevtoolsLayout
|
|
3804
|
+
};
|
|
3805
|
+
const handleInput = (state, name, value, checked) => {
|
|
3806
|
+
const handler = inputHandlers[name];
|
|
3807
|
+
if (!handler) {
|
|
3808
|
+
return state;
|
|
3765
3809
|
}
|
|
3766
|
-
return state;
|
|
3810
|
+
return handler(state, value, checked);
|
|
3767
3811
|
};
|
|
3768
3812
|
|
|
3769
3813
|
const getListFilesPreviewEvent = (event, name) => {
|
|
@@ -3874,26 +3918,42 @@ const getResponseContentText = content => {
|
|
|
3874
3918
|
} = content;
|
|
3875
3919
|
return typeof text === 'string' ? text : undefined;
|
|
3876
3920
|
};
|
|
3877
|
-
const
|
|
3878
|
-
if (event.type
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
value
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3921
|
+
const getResponseOutput = event => {
|
|
3922
|
+
if (event.type === 'sse-response-completed') {
|
|
3923
|
+
const {
|
|
3924
|
+
value
|
|
3925
|
+
} = event;
|
|
3926
|
+
if (!value || typeof value !== 'object') {
|
|
3927
|
+
return undefined;
|
|
3928
|
+
}
|
|
3929
|
+
const {
|
|
3930
|
+
response
|
|
3931
|
+
} = value;
|
|
3932
|
+
if (!response || typeof response !== 'object') {
|
|
3933
|
+
return undefined;
|
|
3934
|
+
}
|
|
3935
|
+
const {
|
|
3936
|
+
output
|
|
3937
|
+
} = response;
|
|
3938
|
+
return Array.isArray(output) ? output : undefined;
|
|
3886
3939
|
}
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3940
|
+
if (event.type === 'ai-response') {
|
|
3941
|
+
const {
|
|
3942
|
+
value
|
|
3943
|
+
} = event;
|
|
3944
|
+
if (!value || typeof value !== 'object') {
|
|
3945
|
+
return undefined;
|
|
3946
|
+
}
|
|
3947
|
+
const {
|
|
3948
|
+
output
|
|
3949
|
+
} = value;
|
|
3950
|
+
return Array.isArray(output) ? output : undefined;
|
|
3892
3951
|
}
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3952
|
+
return undefined;
|
|
3953
|
+
};
|
|
3954
|
+
const getResponsePreviewText = event => {
|
|
3955
|
+
const output = getResponseOutput(event);
|
|
3956
|
+
if (!output || output.length === 0) {
|
|
3897
3957
|
return undefined;
|
|
3898
3958
|
}
|
|
3899
3959
|
const [firstOutput] = output;
|
|
@@ -3909,9 +3969,9 @@ const getPreviewMessageText = event => {
|
|
|
3909
3969
|
if (isChatMessageUpdatedEvent(event) && typeof event.text === 'string') {
|
|
3910
3970
|
return event.text;
|
|
3911
3971
|
}
|
|
3912
|
-
const
|
|
3913
|
-
if (
|
|
3914
|
-
return
|
|
3972
|
+
const responsePreviewText = getResponsePreviewText(event);
|
|
3973
|
+
if (responsePreviewText !== undefined) {
|
|
3974
|
+
return responsePreviewText;
|
|
3915
3975
|
}
|
|
3916
3976
|
if (!isChatMessageAddedEvent(event)) {
|
|
3917
3977
|
return undefined;
|
|
@@ -3998,16 +4058,21 @@ const getWriteFilePreviewText = (event, name) => {
|
|
|
3998
4058
|
const {
|
|
3999
4059
|
arguments: toolArguments
|
|
4000
4060
|
} = event;
|
|
4001
|
-
if (typeof toolArguments !== 'object' || toolArguments === null || !Object.hasOwn(toolArguments, 'content')) {
|
|
4061
|
+
if (typeof toolArguments !== 'object' || toolArguments === null || !Object.hasOwn(toolArguments, 'content') || !Object.hasOwn(toolArguments, 'uri')) {
|
|
4002
4062
|
return undefined;
|
|
4003
4063
|
}
|
|
4004
4064
|
const {
|
|
4005
|
-
content
|
|
4065
|
+
content,
|
|
4066
|
+
uri
|
|
4006
4067
|
} = toolArguments;
|
|
4007
|
-
if (typeof content !== 'string') {
|
|
4068
|
+
if (typeof content !== 'string' || typeof uri !== 'string') {
|
|
4008
4069
|
return undefined;
|
|
4009
4070
|
}
|
|
4010
|
-
return
|
|
4071
|
+
return {
|
|
4072
|
+
content,
|
|
4073
|
+
previewType: 'write-file',
|
|
4074
|
+
uri
|
|
4075
|
+
};
|
|
4011
4076
|
};
|
|
4012
4077
|
|
|
4013
4078
|
const getPreviewEvent = event => {
|
|
@@ -4058,6 +4123,77 @@ const getPreviewTextCursorStyle = cursor => {
|
|
|
4058
4123
|
return `height: ${previewTextRowHeight}px; left: ${cursor.columnIndex * defaultPreviewTextColumnWidth}px; top: ${cursor.rowIndex * previewTextRowHeight}px; width: 0px;`;
|
|
4059
4124
|
};
|
|
4060
4125
|
|
|
4126
|
+
const isWriteFilePreview = value => {
|
|
4127
|
+
return typeof value === 'object' && value !== null && value.previewType === 'write-file' && typeof value.content === 'string' && typeof value.uri === 'string';
|
|
4128
|
+
};
|
|
4129
|
+
|
|
4130
|
+
const getPreviewTextValue = selectedEvent => {
|
|
4131
|
+
if (!selectedEvent) {
|
|
4132
|
+
return undefined;
|
|
4133
|
+
}
|
|
4134
|
+
const previewEvent = getPreviewEvent(selectedEvent);
|
|
4135
|
+
if (typeof previewEvent === 'string') {
|
|
4136
|
+
return previewEvent;
|
|
4137
|
+
}
|
|
4138
|
+
if (isWriteFilePreview(previewEvent)) {
|
|
4139
|
+
return previewEvent.content;
|
|
4140
|
+
}
|
|
4141
|
+
return undefined;
|
|
4142
|
+
};
|
|
4143
|
+
const getPreviewTextLineCount = selectedEvent => {
|
|
4144
|
+
const value = getPreviewTextValue(selectedEvent);
|
|
4145
|
+
if (value === undefined) {
|
|
4146
|
+
return 0;
|
|
4147
|
+
}
|
|
4148
|
+
return value.split('\n').length;
|
|
4149
|
+
};
|
|
4150
|
+
const getPreviewTextViewportHeight = state => {
|
|
4151
|
+
if (!state.selectedEvent) {
|
|
4152
|
+
return 0;
|
|
4153
|
+
}
|
|
4154
|
+
return getTableBodyHeight(state, 1);
|
|
4155
|
+
};
|
|
4156
|
+
const getPreviewTextMaxDeltaY = (lineCount, viewportHeight) => {
|
|
4157
|
+
return Math.max(lineCount * previewTextRowHeight - viewportHeight, 0);
|
|
4158
|
+
};
|
|
4159
|
+
const clampPreviewTextDeltaY = (deltaY, lineCount, viewportHeight) => {
|
|
4160
|
+
const maxDeltaY = getPreviewTextMaxDeltaY(lineCount, viewportHeight);
|
|
4161
|
+
if (deltaY < 0) {
|
|
4162
|
+
return 0;
|
|
4163
|
+
}
|
|
4164
|
+
if (deltaY > maxDeltaY) {
|
|
4165
|
+
return maxDeltaY;
|
|
4166
|
+
}
|
|
4167
|
+
return deltaY;
|
|
4168
|
+
};
|
|
4169
|
+
const getPreviewVirtualizationState = (selectedEvent, viewportHeight, deltaY) => {
|
|
4170
|
+
const totalLineCount = getPreviewTextLineCount(selectedEvent);
|
|
4171
|
+
const clampedDeltaY = clampPreviewTextDeltaY(deltaY, totalLineCount, viewportHeight);
|
|
4172
|
+
const startLineY = Math.floor(clampedDeltaY / previewTextRowHeight);
|
|
4173
|
+
const visibleLineCount = viewportHeight <= 0 ? 0 : Math.max(1, Math.ceil(viewportHeight / previewTextRowHeight));
|
|
4174
|
+
const endLineY = Math.min(totalLineCount, startLineY + visibleLineCount);
|
|
4175
|
+
const maxDeltaY = getPreviewTextMaxDeltaY(totalLineCount, viewportHeight);
|
|
4176
|
+
const scrollBarHeight = getScrollBarHeight(totalLineCount, viewportHeight);
|
|
4177
|
+
const scrollBarOffset = getScrollBarOffset(clampedDeltaY, maxDeltaY, viewportHeight, scrollBarHeight);
|
|
4178
|
+
return {
|
|
4179
|
+
deltaY: clampedDeltaY,
|
|
4180
|
+
endLineY,
|
|
4181
|
+
maxDeltaY,
|
|
4182
|
+
scrollBarHeight,
|
|
4183
|
+
scrollBarOffset,
|
|
4184
|
+
showScrollBar: scrollBarHeight > 0,
|
|
4185
|
+
startLineY,
|
|
4186
|
+
totalLineCount,
|
|
4187
|
+
viewportHeight
|
|
4188
|
+
};
|
|
4189
|
+
};
|
|
4190
|
+
const setPreviewTextDeltaY = (state, deltaY) => {
|
|
4191
|
+
return {
|
|
4192
|
+
...state,
|
|
4193
|
+
previewTextDeltaY: clampPreviewTextDeltaY(deltaY, getPreviewTextLineCount(state.selectedEvent), getPreviewTextViewportHeight(state))
|
|
4194
|
+
};
|
|
4195
|
+
};
|
|
4196
|
+
|
|
4061
4197
|
const hasNumberedTextPreview = (state, previewEvent) => {
|
|
4062
4198
|
if (typeof previewEvent !== 'string') {
|
|
4063
4199
|
return false;
|
|
@@ -4075,7 +4211,8 @@ const handlePreviewTextPointerDown = (state, x, y) => {
|
|
|
4075
4211
|
if (!hasNumberedTextPreview(state, previewEvent)) {
|
|
4076
4212
|
return state;
|
|
4077
4213
|
}
|
|
4078
|
-
const
|
|
4214
|
+
const deltaY = clampPreviewTextDeltaY(state.previewTextDeltaY, getPreviewTextLineCount(state.selectedEvent), getPreviewTextViewportHeight(state));
|
|
4215
|
+
const cursor = getPreviewTextCursorFromPoint(previewEvent, x, y + deltaY);
|
|
4079
4216
|
if (state.previewTextCursorColumnIndex === cursor.columnIndex && state.previewTextCursorRowIndex === cursor.rowIndex) {
|
|
4080
4217
|
return state;
|
|
4081
4218
|
}
|
|
@@ -4086,6 +4223,87 @@ const handlePreviewTextPointerDown = (state, x, y) => {
|
|
|
4086
4223
|
};
|
|
4087
4224
|
};
|
|
4088
4225
|
|
|
4226
|
+
const getPreviewTextBodyY = state => {
|
|
4227
|
+
return getTableBodyY(state, true);
|
|
4228
|
+
};
|
|
4229
|
+
|
|
4230
|
+
const getHandleOffsetAndPercent$1 = (viewportHeight, scrollBarHeight, relativeY) => {
|
|
4231
|
+
const halfScrollBarHeight = scrollBarHeight / 2;
|
|
4232
|
+
if (relativeY <= halfScrollBarHeight) {
|
|
4233
|
+
return {
|
|
4234
|
+
handleOffset: relativeY,
|
|
4235
|
+
percent: 0
|
|
4236
|
+
};
|
|
4237
|
+
}
|
|
4238
|
+
if (relativeY <= viewportHeight - halfScrollBarHeight) {
|
|
4239
|
+
return {
|
|
4240
|
+
handleOffset: halfScrollBarHeight,
|
|
4241
|
+
percent: (relativeY - halfScrollBarHeight) / Math.max(1, viewportHeight - scrollBarHeight)
|
|
4242
|
+
};
|
|
4243
|
+
}
|
|
4244
|
+
return {
|
|
4245
|
+
handleOffset: scrollBarHeight - viewportHeight + relativeY,
|
|
4246
|
+
percent: 1
|
|
4247
|
+
};
|
|
4248
|
+
};
|
|
4249
|
+
const handlePreviewTextScrollBarPointerDown = (state, eventY) => {
|
|
4250
|
+
const viewportHeight = getPreviewTextViewportHeight(state);
|
|
4251
|
+
const virtualization = getPreviewVirtualizationState(state.selectedEvent, viewportHeight, state.previewTextDeltaY);
|
|
4252
|
+
const bodyY = getPreviewTextBodyY(state);
|
|
4253
|
+
const relativeY = eventY - bodyY;
|
|
4254
|
+
if (virtualization.viewportHeight === 0 || virtualization.scrollBarHeight === 0) {
|
|
4255
|
+
return state;
|
|
4256
|
+
}
|
|
4257
|
+
const {
|
|
4258
|
+
handleOffset,
|
|
4259
|
+
percent
|
|
4260
|
+
} = getHandleOffsetAndPercent$1(virtualization.viewportHeight, virtualization.scrollBarHeight, relativeY);
|
|
4261
|
+
const nextState = setPreviewTextDeltaY(state, percent * virtualization.maxDeltaY);
|
|
4262
|
+
return {
|
|
4263
|
+
...nextState,
|
|
4264
|
+
previewTextScrollBarHandleOffset: handleOffset,
|
|
4265
|
+
previewTextScrollBarPointerActive: true
|
|
4266
|
+
};
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
const handlePreviewTextScrollBarPointerMove = (state, eventY) => {
|
|
4270
|
+
if (!state.previewTextScrollBarPointerActive) {
|
|
4271
|
+
return state;
|
|
4272
|
+
}
|
|
4273
|
+
const viewportHeight = getPreviewTextViewportHeight(state);
|
|
4274
|
+
const virtualization = getPreviewVirtualizationState(state.selectedEvent, viewportHeight, state.previewTextDeltaY);
|
|
4275
|
+
if (viewportHeight === 0 || virtualization.scrollBarHeight === 0) {
|
|
4276
|
+
return state;
|
|
4277
|
+
}
|
|
4278
|
+
const relativeY = eventY - getPreviewTextBodyY(state);
|
|
4279
|
+
const nextHandleTop = Math.max(0, Math.min(viewportHeight - virtualization.scrollBarHeight, relativeY - state.previewTextScrollBarHandleOffset));
|
|
4280
|
+
const percent = nextHandleTop / Math.max(1, viewportHeight - virtualization.scrollBarHeight);
|
|
4281
|
+
const nextState = setPreviewTextDeltaY(state, percent * virtualization.maxDeltaY);
|
|
4282
|
+
return {
|
|
4283
|
+
...nextState,
|
|
4284
|
+
previewTextScrollBarPointerActive: true
|
|
4285
|
+
};
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4288
|
+
const handlePreviewTextScrollBarPointerUp = state => {
|
|
4289
|
+
if (!state.previewTextScrollBarPointerActive && state.previewTextScrollBarHandleOffset === 0) {
|
|
4290
|
+
return state;
|
|
4291
|
+
}
|
|
4292
|
+
return {
|
|
4293
|
+
...state,
|
|
4294
|
+
previewTextScrollBarHandleOffset: 0,
|
|
4295
|
+
previewTextScrollBarPointerActive: false
|
|
4296
|
+
};
|
|
4297
|
+
};
|
|
4298
|
+
|
|
4299
|
+
const handlePreviewTextWheel = (state, deltaY) => {
|
|
4300
|
+
return setPreviewTextDeltaY(state, state.previewTextDeltaY + deltaY);
|
|
4301
|
+
};
|
|
4302
|
+
|
|
4303
|
+
const handleRootContextMenu = state => {
|
|
4304
|
+
return state;
|
|
4305
|
+
};
|
|
4306
|
+
|
|
4089
4307
|
const handleSashPointerDown = (state, eventX, eventY) => {
|
|
4090
4308
|
if (state.sashPointerActive) {
|
|
4091
4309
|
return state;
|
|
@@ -4146,6 +4364,8 @@ const getTableResizerId = name => {
|
|
|
4146
4364
|
switch (name) {
|
|
4147
4365
|
case 'ResizerOne':
|
|
4148
4366
|
return 1;
|
|
4367
|
+
case 'ResizerThree':
|
|
4368
|
+
return 3;
|
|
4149
4369
|
case 'ResizerTwo':
|
|
4150
4370
|
return 2;
|
|
4151
4371
|
default:
|
|
@@ -4470,6 +4690,9 @@ const setUseDevtoolsLayout = (state, checked) => {
|
|
|
4470
4690
|
...state,
|
|
4471
4691
|
previewTextCursorColumnIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorColumnIndex : null,
|
|
4472
4692
|
previewTextCursorRowIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorRowIndex : null,
|
|
4693
|
+
previewTextDeltaY: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextDeltaY : 0,
|
|
4694
|
+
previewTextScrollBarHandleOffset: 0,
|
|
4695
|
+
previewTextScrollBarPointerActive: false,
|
|
4473
4696
|
selectedEvent: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEvent : null,
|
|
4474
4697
|
selectedEventId: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEventId : null,
|
|
4475
4698
|
selectedEventIndex,
|
|
@@ -4619,11 +4842,17 @@ const getCss = state => {
|
|
|
4619
4842
|
const tableContentWidth = Math.max(0, tableWidth - (showScrollBar ? devtoolsTableScrollBarWidth : 0));
|
|
4620
4843
|
const detailsWidth = hasSelectedEvent ? getDetailsWidth(state.width, state.tableWidth) : 0;
|
|
4621
4844
|
const detailsLineNumberWidth = getDetailsLineNumberWidth(state);
|
|
4622
|
-
const
|
|
4845
|
+
const previewTextViewportHeight = getPreviewTextViewportHeight(state);
|
|
4846
|
+
const previewVirtualization = getPreviewVirtualizationState(state.selectedEvent, previewTextViewportHeight, state.previewTextDeltaY);
|
|
4847
|
+
let topSize = 60;
|
|
4848
|
+
if (state.width >= state.largeBreakpoint) {
|
|
4849
|
+
topSize = 30;
|
|
4850
|
+
}
|
|
4623
4851
|
const tableColumnLayout = getTableColumnLayout(tableContentWidth, getVisibleTableColumns(state.tableColumns), state.tableColumnWidths);
|
|
4624
|
-
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
4852
|
+
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0, tableColThreeWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
4625
4853
|
const resizerOneLeft = tableColumnLayout.resizerLefts[0] ?? 0;
|
|
4626
4854
|
const resizerTwoLeft = tableColumnLayout.resizerLefts[1] ?? 0;
|
|
4855
|
+
const resizerThreeLeft = tableColumnLayout.resizerLefts[2] ?? 0;
|
|
4627
4856
|
const {
|
|
4628
4857
|
selectionEndPercent,
|
|
4629
4858
|
selectionStartPercent
|
|
@@ -4635,7 +4864,12 @@ const getCss = state => {
|
|
|
4635
4864
|
--ChatDebugViewTableColZeroWidth: ${tableColZeroWidth}px;
|
|
4636
4865
|
--ChatDebugViewTableColOneWidth: ${tableColOneWidth}px;
|
|
4637
4866
|
--ChatDebugViewTableColTwoWidth: ${tableColTwoWidth}px;
|
|
4867
|
+
--ChatDebugViewTableColThreeWidth: ${tableColThreeWidth}px;
|
|
4638
4868
|
--ChatDebugViewDetailsLineNumberWidth: ${detailsLineNumberWidth}px;
|
|
4869
|
+
--ChatDebugViewPreviewScrollBarHeight: ${previewVirtualization.scrollBarHeight}px;
|
|
4870
|
+
--ChatDebugViewPreviewScrollBarOffset: ${previewVirtualization.scrollBarOffset}px;
|
|
4871
|
+
--ChatDebugViewPreviewScrollBarWidth: ${previewVirtualization.showScrollBar ? devtoolsTableScrollBarWidth : 0}px;
|
|
4872
|
+
--ChatDebugViewPreviewViewportHeight: ${previewVirtualization.viewportHeight}px;
|
|
4639
4873
|
--ChatDebugViewDetailsWidth: ${detailsWidth}px;
|
|
4640
4874
|
--ChatDebugViewDurationColumnWidth: ${state.tableColumnWidths.duration}px;
|
|
4641
4875
|
--ChatDebugViewTableRowHeight: ${devtoolsTableRowHeight}px;
|
|
@@ -4644,6 +4878,7 @@ const getCss = state => {
|
|
|
4644
4878
|
--ChatDebugViewTableScrollBarWidth: ${showScrollBar ? devtoolsTableScrollBarWidth : 0}px;
|
|
4645
4879
|
--ResizerOneLeft: ${resizerOneLeft}px;
|
|
4646
4880
|
--ResizerTwoLeft: ${resizerTwoLeft}px;
|
|
4881
|
+
--ResizerThreeLeft: ${resizerThreeLeft}px;
|
|
4647
4882
|
--ChatDebugViewSashWidth: ${sashWidth}px;
|
|
4648
4883
|
--ChatDebugViewTableWidth: ${tableWidth}px;
|
|
4649
4884
|
--ChatDebugViewTimelineHeight: ${state.timelineHeight}px;
|
|
@@ -4691,6 +4926,36 @@ const getCss = state => {
|
|
|
4691
4926
|
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4692
4927
|
}
|
|
4693
4928
|
|
|
4929
|
+
.PreviewVirtualizedEditor {
|
|
4930
|
+
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
4931
|
+
overflow: hidden;
|
|
4932
|
+
position: relative;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
.PreviewVirtualizedEditor .Editor {
|
|
4936
|
+
width: calc(100% - var(--ChatDebugViewPreviewScrollBarWidth));
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
.PreviewTextScrollBar {
|
|
4940
|
+
background: rgba(255, 255, 255, 0.06);
|
|
4941
|
+
border-radius: 999px;
|
|
4942
|
+
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
4943
|
+
position: absolute;
|
|
4944
|
+
right: 0;
|
|
4945
|
+
top: 0;
|
|
4946
|
+
width: var(--ChatDebugViewPreviewScrollBarWidth);
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
.PreviewTextScrollBarThumb {
|
|
4950
|
+
background: rgba(255, 255, 255, 0.22);
|
|
4951
|
+
border-radius: 999px;
|
|
4952
|
+
height: var(--ChatDebugViewPreviewScrollBarHeight);
|
|
4953
|
+
left: 2px;
|
|
4954
|
+
position: absolute;
|
|
4955
|
+
top: var(--ChatDebugViewPreviewScrollBarOffset);
|
|
4956
|
+
width: calc(100% - 4px);
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4694
4959
|
.TableScrollBar {
|
|
4695
4960
|
background: rgba(255, 255, 255, 0.06);
|
|
4696
4961
|
border-radius: 999px;
|
|
@@ -4711,11 +4976,43 @@ const getCss = state => {
|
|
|
4711
4976
|
width: calc(100% - 4px);
|
|
4712
4977
|
}
|
|
4713
4978
|
|
|
4714
|
-
|
|
4715
|
-
|
|
4979
|
+
.TokenText {
|
|
4980
|
+
color: var(--vscode-editor-foreground);
|
|
4981
|
+
}
|
|
4716
4982
|
|
|
4717
|
-
|
|
4718
|
-
|
|
4983
|
+
.TokenString {
|
|
4984
|
+
color: var(--vscode-debugTokenExpression-string, #ce9178);
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
.TokenNumeric {
|
|
4988
|
+
color: var(--vscode-debugTokenExpression-number, #b5cea8);
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
.TokenBoolean {
|
|
4992
|
+
color: var(--vscode-debugTokenExpression-boolean, #569cd6);
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
.TokenKey,
|
|
4996
|
+
.TokenAttributeName,
|
|
4997
|
+
.TokenPropertyName {
|
|
4998
|
+
color: var(--vscode-symbolIcon-propertyForeground, #9cdcfe);
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
.TokenKeyword,
|
|
5002
|
+
.TokenTag,
|
|
5003
|
+
.TokenSelector {
|
|
5004
|
+
color: var(--vscode-symbolIcon-keywordForeground, #569cd6);
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
.TokenComment {
|
|
5008
|
+
color: var(--vscode-editorLineNumber-foreground, #6a9955);
|
|
5009
|
+
}
|
|
5010
|
+
|
|
5011
|
+
`;
|
|
5012
|
+
};
|
|
5013
|
+
|
|
5014
|
+
const renderCss = (oldState, newState) => {
|
|
5015
|
+
const css = getCss(newState);
|
|
4719
5016
|
return [SetCss, newState.uid, css];
|
|
4720
5017
|
};
|
|
4721
5018
|
|
|
@@ -4953,7 +5250,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
|
|
|
4953
5250
|
patches.push({
|
|
4954
5251
|
type: NavigateParent
|
|
4955
5252
|
});
|
|
4956
|
-
currentChildIndex = -1;
|
|
4957
5253
|
}
|
|
4958
5254
|
// Add remove patches in reverse order (highest index first)
|
|
4959
5255
|
// This ensures indices remain valid as we remove
|
|
@@ -5040,6 +5336,9 @@ const EditorRows = 'EditorRows';
|
|
|
5040
5336
|
const EditorSelection = 'EditorSelection';
|
|
5041
5337
|
const EditorSelections = 'Selections';
|
|
5042
5338
|
const EditorViewlet = 'Viewlet Editor';
|
|
5339
|
+
const PreviewTextScrollBar = 'PreviewTextScrollBar';
|
|
5340
|
+
const PreviewTextScrollBarThumb = 'PreviewTextScrollBarThumb';
|
|
5341
|
+
const PreviewVirtualizedEditor = 'PreviewVirtualizedEditor';
|
|
5043
5342
|
const ChatDebugViewEventLineNumber = 'ChatDebugViewEventLineNumber';
|
|
5044
5343
|
const Gutter = 'Gutter';
|
|
5045
5344
|
const TableRowSelected = 'TableRowSelected';
|
|
@@ -5069,6 +5368,7 @@ const Resizer = 'Resizer';
|
|
|
5069
5368
|
const ResizerInner = 'ResizerInner';
|
|
5070
5369
|
const ResizerOne = 'ResizerOne';
|
|
5071
5370
|
const ResizerTwo = 'ResizerTwo';
|
|
5371
|
+
const ResizerThree = 'ResizerThree';
|
|
5072
5372
|
const TableHead = 'TableHead';
|
|
5073
5373
|
const Resizers = 'Resizers';
|
|
5074
5374
|
const TableCol = 'TableCol';
|
|
@@ -5115,25 +5415,17 @@ const ChatDebugViewCellDuration = 'ChatDebugViewCellDuration';
|
|
|
5115
5415
|
const ChatDebugViewCellStatusError = 'ChatDebugViewCellStatusError';
|
|
5116
5416
|
const InputBox = 'InputBox';
|
|
5117
5417
|
const TokenBoolean = 'Token TokenBoolean';
|
|
5418
|
+
const TokenComment = 'Token TokenComment';
|
|
5118
5419
|
const TokenKey = 'Token TokenKey';
|
|
5420
|
+
const TokenKeyword = 'Token TokenKeyword';
|
|
5119
5421
|
const TokenNumeric = 'Token TokenNumeric';
|
|
5422
|
+
const TokenAttributeName = 'Token TokenAttributeName';
|
|
5423
|
+
const TokenPropertyName = 'Token TokenPropertyName';
|
|
5424
|
+
const TokenSelector = 'Token TokenSelector';
|
|
5120
5425
|
const TokenString = 'Token TokenString';
|
|
5426
|
+
const TokenTag = 'Token TokenTag';
|
|
5121
5427
|
const TokenText = 'Token TokenText';
|
|
5122
5428
|
|
|
5123
|
-
const debugErrorRootNode = {
|
|
5124
|
-
childCount: 1,
|
|
5125
|
-
className: ChatDebugView,
|
|
5126
|
-
type: Div
|
|
5127
|
-
};
|
|
5128
|
-
const debugErrorMessageNode = {
|
|
5129
|
-
childCount: 1,
|
|
5130
|
-
className: ChatDebugViewError,
|
|
5131
|
-
type: Div
|
|
5132
|
-
};
|
|
5133
|
-
const getDebugErrorDom = errorMessage => {
|
|
5134
|
-
return [debugErrorRootNode, debugErrorMessageNode, text(errorMessage)];
|
|
5135
|
-
};
|
|
5136
|
-
|
|
5137
5429
|
const HandleEventCategoryFilter = 4;
|
|
5138
5430
|
const HandleFilterInput = 5;
|
|
5139
5431
|
const SelectDetailTab = 6;
|
|
@@ -5166,6 +5458,25 @@ const HandleTableScrollBarPointerDown = 32;
|
|
|
5166
5458
|
const HandleTableScrollBarPointerMove = 33;
|
|
5167
5459
|
const HandleTableScrollBarPointerUp = 34;
|
|
5168
5460
|
const HandleTableWheel = 35;
|
|
5461
|
+
const HandlePreviewTextWheel = 36;
|
|
5462
|
+
const HandlePreviewTextScrollBarPointerDown = 37;
|
|
5463
|
+
const HandlePreviewTextScrollBarPointerMove = 38;
|
|
5464
|
+
const HandlePreviewTextScrollBarPointerUp = 39;
|
|
5465
|
+
const HandleRootContextMenu = 40;
|
|
5466
|
+
|
|
5467
|
+
const debugErrorRootNode = {
|
|
5468
|
+
childCount: 1,
|
|
5469
|
+
className: ChatDebugView,
|
|
5470
|
+
type: Div
|
|
5471
|
+
};
|
|
5472
|
+
const debugErrorMessageNode = {
|
|
5473
|
+
childCount: 1,
|
|
5474
|
+
className: ChatDebugViewError,
|
|
5475
|
+
type: Div
|
|
5476
|
+
};
|
|
5477
|
+
const getDebugErrorDom = errorMessage => {
|
|
5478
|
+
return [debugErrorRootNode, debugErrorMessageNode, text(errorMessage)];
|
|
5479
|
+
};
|
|
5169
5480
|
|
|
5170
5481
|
const getFilterInputDom = (filterValue, useDevtoolsLayout) => {
|
|
5171
5482
|
return {
|
|
@@ -5277,13 +5588,13 @@ const getEditorSelectionDom = (cursor = defaultEditorCursor) => {
|
|
|
5277
5588
|
type: Div
|
|
5278
5589
|
}] : [])];
|
|
5279
5590
|
};
|
|
5280
|
-
const getGutterDom = (lineData, showLineNumbers) => {
|
|
5591
|
+
const getGutterDom = (lineData, showLineNumbers, lineNumberStart = 0) => {
|
|
5281
5592
|
const gutterNodes = showLineNumbers ? lineData.flatMap((_, index) => {
|
|
5282
5593
|
return [{
|
|
5283
5594
|
childCount: 1,
|
|
5284
5595
|
className: ChatDebugViewEventLineNumber,
|
|
5285
5596
|
type: Span
|
|
5286
|
-
}, text(String(index + 1))];
|
|
5597
|
+
}, text(String(lineNumberStart + index + 1))];
|
|
5287
5598
|
}) : [];
|
|
5288
5599
|
return [{
|
|
5289
5600
|
childCount: showLineNumbers ? lineData.length : 0,
|
|
@@ -5340,51 +5651,163 @@ const getEditorDom = (lineData, showLineNumbers = true, cursor = defaultEditorCu
|
|
|
5340
5651
|
type: Div
|
|
5341
5652
|
}, ...getEditorSelectionDom(cursor), ...getEditorRowsDom(lineData)];
|
|
5342
5653
|
};
|
|
5654
|
+
const getVirtualizedEditorDom = (lineData, showLineNumbers = true, cursor = null, onPointerDown, options) => {
|
|
5655
|
+
const editorChildren = [{
|
|
5656
|
+
childCount: 2,
|
|
5657
|
+
className: EditorViewlet,
|
|
5658
|
+
role: 'code',
|
|
5659
|
+
type: Div
|
|
5660
|
+
}, ...getGutterDom(lineData, showLineNumbers, options.lineNumberStart), {
|
|
5661
|
+
childCount: 2,
|
|
5662
|
+
className: EditorContent,
|
|
5663
|
+
onPointerDown,
|
|
5664
|
+
type: Div
|
|
5665
|
+
}, {
|
|
5666
|
+
'aria-autocomplete': 'list',
|
|
5667
|
+
'aria-multiline': true,
|
|
5668
|
+
'aria-roledescription': 'editor',
|
|
5669
|
+
autocapitalize: 'off',
|
|
5670
|
+
autocomplete: 'off',
|
|
5671
|
+
autocorrect: 'off',
|
|
5672
|
+
childCount: 0,
|
|
5673
|
+
className: EditorInput,
|
|
5674
|
+
name: 'editor',
|
|
5675
|
+
role: 'textbox',
|
|
5676
|
+
spellcheck: false,
|
|
5677
|
+
type: TextArea,
|
|
5678
|
+
wrap: 'off'
|
|
5679
|
+
}, {
|
|
5680
|
+
childCount: 2,
|
|
5681
|
+
className: EditorLayers,
|
|
5682
|
+
type: Div
|
|
5683
|
+
}, ...getEditorSelectionDom(cursor), ...getEditorRowsDom(lineData)];
|
|
5684
|
+
return [{
|
|
5685
|
+
childCount: options.showScrollBar ? 2 : 1,
|
|
5686
|
+
className: mergeClassNames(EditorContainer, PreviewVirtualizedEditor),
|
|
5687
|
+
onWheel: options.onWheel,
|
|
5688
|
+
type: Div
|
|
5689
|
+
}, ...editorChildren, ...(options.showScrollBar ? [{
|
|
5690
|
+
childCount: 1,
|
|
5691
|
+
className: PreviewTextScrollBar,
|
|
5692
|
+
onPointerDown: options.onScrollBarPointerDown,
|
|
5693
|
+
type: Div
|
|
5694
|
+
}, {
|
|
5695
|
+
childCount: 0,
|
|
5696
|
+
className: PreviewTextScrollBarThumb,
|
|
5697
|
+
type: Div
|
|
5698
|
+
}] : [])];
|
|
5699
|
+
};
|
|
5343
5700
|
|
|
5344
|
-
const isDigit = character => {
|
|
5701
|
+
const isDigit$1 = character => {
|
|
5345
5702
|
return character !== undefined && character >= '0' && character <= '9';
|
|
5346
5703
|
};
|
|
5347
5704
|
const isWhitespace = character => {
|
|
5348
5705
|
return character === ' ' || character === '\n' || character === '\r' || character === '\t';
|
|
5349
5706
|
};
|
|
5350
|
-
const
|
|
5707
|
+
const getIntegerEnd = (json, start) => {
|
|
5351
5708
|
let i = start;
|
|
5352
5709
|
if (json[i] === '-') {
|
|
5353
5710
|
i++;
|
|
5354
5711
|
}
|
|
5355
5712
|
if (json[i] === '0') {
|
|
5713
|
+
return i + 1;
|
|
5714
|
+
}
|
|
5715
|
+
if (!isDigit$1(json[i])) {
|
|
5716
|
+
return start;
|
|
5717
|
+
}
|
|
5718
|
+
while (isDigit$1(json[i])) {
|
|
5356
5719
|
i++;
|
|
5357
|
-
} else {
|
|
5358
|
-
if (!isDigit(json[i])) {
|
|
5359
|
-
return start;
|
|
5360
|
-
}
|
|
5361
|
-
while (isDigit(json[i])) {
|
|
5362
|
-
i++;
|
|
5363
|
-
}
|
|
5364
5720
|
}
|
|
5365
|
-
|
|
5366
|
-
|
|
5721
|
+
return i;
|
|
5722
|
+
};
|
|
5723
|
+
const getFractionEnd = (json, start) => {
|
|
5724
|
+
if (json[start] !== '.') {
|
|
5725
|
+
return start;
|
|
5726
|
+
}
|
|
5727
|
+
const decimalStart = start;
|
|
5728
|
+
let i = start + 1;
|
|
5729
|
+
if (!isDigit$1(json[i])) {
|
|
5730
|
+
return decimalStart;
|
|
5731
|
+
}
|
|
5732
|
+
while (isDigit$1(json[i])) {
|
|
5367
5733
|
i++;
|
|
5368
|
-
if (!isDigit(json[i])) {
|
|
5369
|
-
return decimalStart;
|
|
5370
|
-
}
|
|
5371
|
-
while (isDigit(json[i])) {
|
|
5372
|
-
i++;
|
|
5373
|
-
}
|
|
5374
5734
|
}
|
|
5375
|
-
|
|
5376
|
-
|
|
5735
|
+
return i;
|
|
5736
|
+
};
|
|
5737
|
+
const getExponentEnd = (json, start) => {
|
|
5738
|
+
if (json[start] !== 'e' && json[start] !== 'E') {
|
|
5739
|
+
return start;
|
|
5740
|
+
}
|
|
5741
|
+
const exponentStart = start;
|
|
5742
|
+
let i = start + 1;
|
|
5743
|
+
if (json[i] === '+' || json[i] === '-') {
|
|
5377
5744
|
i++;
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5745
|
+
}
|
|
5746
|
+
if (!isDigit$1(json[i])) {
|
|
5747
|
+
return exponentStart;
|
|
5748
|
+
}
|
|
5749
|
+
while (isDigit$1(json[i])) {
|
|
5750
|
+
i++;
|
|
5751
|
+
}
|
|
5752
|
+
return i;
|
|
5753
|
+
};
|
|
5754
|
+
const getWhitespaceEnd = (json, start) => {
|
|
5755
|
+
let i = start;
|
|
5756
|
+
while (i < json.length && isWhitespace(json[i])) {
|
|
5757
|
+
i++;
|
|
5758
|
+
}
|
|
5759
|
+
return i;
|
|
5760
|
+
};
|
|
5761
|
+
const getStringEnd$1 = (json, start) => {
|
|
5762
|
+
let i = start + 1;
|
|
5763
|
+
while (i < json.length) {
|
|
5764
|
+
const currentCharacter = json[i];
|
|
5765
|
+
if (currentCharacter === '\\') {
|
|
5766
|
+
i += 2;
|
|
5767
|
+
continue;
|
|
5383
5768
|
}
|
|
5384
|
-
|
|
5385
|
-
i
|
|
5769
|
+
if (currentCharacter === '"') {
|
|
5770
|
+
return i + 1;
|
|
5386
5771
|
}
|
|
5772
|
+
i++;
|
|
5773
|
+
}
|
|
5774
|
+
return i;
|
|
5775
|
+
};
|
|
5776
|
+
const emitStringToken = (json, start, onToken) => {
|
|
5777
|
+
const end = getStringEnd$1(json, start);
|
|
5778
|
+
const lookAheadIndex = getWhitespaceEnd(json, end);
|
|
5779
|
+
const className = json[lookAheadIndex] === ':' ? TokenKey : TokenString;
|
|
5780
|
+
onToken(className, json.slice(start, end));
|
|
5781
|
+
return end;
|
|
5782
|
+
};
|
|
5783
|
+
const getLiteralToken = (json, start) => {
|
|
5784
|
+
if (json.startsWith('true', start)) {
|
|
5785
|
+
return {
|
|
5786
|
+
className: TokenBoolean,
|
|
5787
|
+
value: 'true'
|
|
5788
|
+
};
|
|
5789
|
+
}
|
|
5790
|
+
if (json.startsWith('false', start)) {
|
|
5791
|
+
return {
|
|
5792
|
+
className: TokenBoolean,
|
|
5793
|
+
value: 'false'
|
|
5794
|
+
};
|
|
5795
|
+
}
|
|
5796
|
+
if (json.startsWith('null', start)) {
|
|
5797
|
+
return {
|
|
5798
|
+
className: TokenBoolean,
|
|
5799
|
+
value: 'null'
|
|
5800
|
+
};
|
|
5801
|
+
}
|
|
5802
|
+
return undefined;
|
|
5803
|
+
};
|
|
5804
|
+
const getNumberEnd$1 = (json, start) => {
|
|
5805
|
+
let i = getIntegerEnd(json, start);
|
|
5806
|
+
if (i === start) {
|
|
5807
|
+
return start;
|
|
5387
5808
|
}
|
|
5809
|
+
i = getFractionEnd(json, i);
|
|
5810
|
+
i = getExponentEnd(json, i);
|
|
5388
5811
|
return i;
|
|
5389
5812
|
};
|
|
5390
5813
|
const forEachTokenSegment = (json, onToken) => {
|
|
@@ -5392,53 +5815,43 @@ const forEachTokenSegment = (json, onToken) => {
|
|
|
5392
5815
|
while (i < json.length) {
|
|
5393
5816
|
const character = json[i];
|
|
5394
5817
|
if (character === '"') {
|
|
5395
|
-
|
|
5396
|
-
i++;
|
|
5397
|
-
while (i < json.length) {
|
|
5398
|
-
const currentCharacter = json[i];
|
|
5399
|
-
if (currentCharacter === '\\') {
|
|
5400
|
-
i += 2;
|
|
5401
|
-
continue;
|
|
5402
|
-
}
|
|
5403
|
-
if (currentCharacter === '"') {
|
|
5404
|
-
i++;
|
|
5405
|
-
break;
|
|
5406
|
-
}
|
|
5407
|
-
i++;
|
|
5408
|
-
}
|
|
5409
|
-
let lookAheadIndex = i;
|
|
5410
|
-
while (lookAheadIndex < json.length && isWhitespace(json[lookAheadIndex])) {
|
|
5411
|
-
lookAheadIndex++;
|
|
5412
|
-
}
|
|
5413
|
-
const className = json[lookAheadIndex] === ':' ? TokenKey : TokenString;
|
|
5414
|
-
onToken(className, json.slice(start, i));
|
|
5818
|
+
i = emitStringToken(json, i, onToken);
|
|
5415
5819
|
continue;
|
|
5416
5820
|
}
|
|
5417
|
-
const numberEnd = getNumberEnd(json, i);
|
|
5821
|
+
const numberEnd = getNumberEnd$1(json, i);
|
|
5418
5822
|
if (numberEnd > i) {
|
|
5419
5823
|
onToken(TokenNumeric, json.slice(i, numberEnd));
|
|
5420
5824
|
i = numberEnd;
|
|
5421
5825
|
continue;
|
|
5422
5826
|
}
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
}
|
|
5428
|
-
if (json.startsWith('false', i)) {
|
|
5429
|
-
onToken(TokenBoolean, 'false');
|
|
5430
|
-
i += 5;
|
|
5431
|
-
continue;
|
|
5432
|
-
}
|
|
5433
|
-
if (json.startsWith('null', i)) {
|
|
5434
|
-
onToken(TokenBoolean, 'null');
|
|
5435
|
-
i += 4;
|
|
5827
|
+
const literalToken = getLiteralToken(json, i);
|
|
5828
|
+
if (literalToken) {
|
|
5829
|
+
onToken(literalToken.className, literalToken.value);
|
|
5830
|
+
i += literalToken.value.length;
|
|
5436
5831
|
continue;
|
|
5437
5832
|
}
|
|
5438
5833
|
onToken(TokenText, character);
|
|
5439
5834
|
i++;
|
|
5440
5835
|
}
|
|
5441
5836
|
};
|
|
5837
|
+
const getTokenSegments = json => {
|
|
5838
|
+
const segments = [];
|
|
5839
|
+
forEachTokenSegment(json, (className, value) => {
|
|
5840
|
+
if (!value) {
|
|
5841
|
+
return;
|
|
5842
|
+
}
|
|
5843
|
+
const lastSegment = segments.at(-1);
|
|
5844
|
+
if (lastSegment && lastSegment.className === className) {
|
|
5845
|
+
lastSegment.value += value;
|
|
5846
|
+
return;
|
|
5847
|
+
}
|
|
5848
|
+
segments.push({
|
|
5849
|
+
className,
|
|
5850
|
+
value
|
|
5851
|
+
});
|
|
5852
|
+
});
|
|
5853
|
+
return segments;
|
|
5854
|
+
};
|
|
5442
5855
|
|
|
5443
5856
|
const getJsonLines = value => {
|
|
5444
5857
|
const json = JSON.stringify(value, null, 2);
|
|
@@ -5549,9 +5962,411 @@ const getImagePreviewDom = preview => {
|
|
|
5549
5962
|
}, ...getImagePreviewLabelDom(preview)];
|
|
5550
5963
|
};
|
|
5551
5964
|
|
|
5552
|
-
const
|
|
5965
|
+
const extensionToLanguage = {
|
|
5966
|
+
css: 'css',
|
|
5967
|
+
html: 'html',
|
|
5968
|
+
js: 'javascript',
|
|
5969
|
+
json: 'json',
|
|
5970
|
+
py: 'python',
|
|
5971
|
+
ts: 'typescript'
|
|
5972
|
+
};
|
|
5973
|
+
const getLanguageFromFileExtension = uri => {
|
|
5974
|
+
try {
|
|
5975
|
+
const url = new URL(uri);
|
|
5976
|
+
const path = url.pathname.toLowerCase();
|
|
5977
|
+
const lastDotIndex = path.lastIndexOf('.');
|
|
5978
|
+
if (lastDotIndex === -1) {
|
|
5979
|
+
return undefined;
|
|
5980
|
+
}
|
|
5981
|
+
const extension = path.slice(lastDotIndex + 1);
|
|
5982
|
+
return extensionToLanguage[extension];
|
|
5983
|
+
} catch {
|
|
5984
|
+
return undefined;
|
|
5985
|
+
}
|
|
5986
|
+
};
|
|
5987
|
+
|
|
5988
|
+
const pushToken = (segments, className, value) => {
|
|
5989
|
+
if (!value) {
|
|
5990
|
+
return segments;
|
|
5991
|
+
}
|
|
5992
|
+
const lastSegment = segments.at(-1);
|
|
5993
|
+
if (lastSegment && lastSegment.className === className) {
|
|
5994
|
+
const merged = {
|
|
5995
|
+
className,
|
|
5996
|
+
value: lastSegment.value + value
|
|
5997
|
+
};
|
|
5998
|
+
return [...segments.slice(0, -1), merged];
|
|
5999
|
+
}
|
|
6000
|
+
return [...segments, {
|
|
6001
|
+
className,
|
|
6002
|
+
value
|
|
6003
|
+
}];
|
|
6004
|
+
};
|
|
6005
|
+
|
|
6006
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
6007
|
+
|
|
6008
|
+
const jsIdentifierStartRegex = /[A-Za-z_$]/;
|
|
6009
|
+
const jsIdentifierPartRegex = /[\w$]/;
|
|
6010
|
+
const pythonIdentifierStartRegex = /[A-Za-z_]/;
|
|
6011
|
+
const pythonIdentifierPartRegex = /\w/;
|
|
6012
|
+
const cssIdentifierRegex = /[A-Za-z-]/;
|
|
6013
|
+
const htmlTagNameRegex = /[A-Za-z0-9:-]/;
|
|
6014
|
+
const htmlAttributeStartRegex = /[A-Za-z:_-]/;
|
|
6015
|
+
const htmlAttributePartRegex = /[\w:-]/;
|
|
6016
|
+
const leadingWhitespaceRegex = /^\s*/;
|
|
6017
|
+
const trailingWhitespaceRegex = /\s*$/;
|
|
6018
|
+
const jsKeywords = new Set(['async', 'await', 'class', 'const', 'else', 'export', 'extends', 'for', 'from', 'function', 'if', 'import', 'let', 'new', 'return', 'switch', 'try', 'while']);
|
|
6019
|
+
const tsKeywords = new Set([...jsKeywords, 'interface', 'implements', 'number', 'readonly', 'string', 'type']);
|
|
6020
|
+
const pythonKeywords = new Set(['as', 'class', 'def', 'elif', 'else', 'except', 'False', 'for', 'from', 'if', 'import', 'None', 'return', 'True', 'try', 'while', 'with']);
|
|
6021
|
+
const isIdentifierStart = character => {
|
|
6022
|
+
return !!character && jsIdentifierStartRegex.test(character);
|
|
6023
|
+
};
|
|
6024
|
+
const isIdentifierPart = character => {
|
|
6025
|
+
return !!character && jsIdentifierPartRegex.test(character);
|
|
6026
|
+
};
|
|
6027
|
+
const isPythonIdentifierStart = character => {
|
|
6028
|
+
return !!character && pythonIdentifierStartRegex.test(character);
|
|
6029
|
+
};
|
|
6030
|
+
const isPythonIdentifierPart = character => {
|
|
6031
|
+
return !!character && pythonIdentifierPartRegex.test(character);
|
|
6032
|
+
};
|
|
6033
|
+
const isDigit = character => {
|
|
6034
|
+
return !!character && character >= '0' && character <= '9';
|
|
6035
|
+
};
|
|
6036
|
+
const getStringEnd = (value, start, quote) => {
|
|
6037
|
+
let i = start + 1;
|
|
6038
|
+
while (i < value.length) {
|
|
6039
|
+
if (value[i] === '\\') {
|
|
6040
|
+
i += 2;
|
|
6041
|
+
continue;
|
|
6042
|
+
}
|
|
6043
|
+
if (value[i] === quote) {
|
|
6044
|
+
return i + 1;
|
|
6045
|
+
}
|
|
6046
|
+
i++;
|
|
6047
|
+
}
|
|
6048
|
+
return value.length;
|
|
6049
|
+
};
|
|
6050
|
+
const getBlockCommentEnd = (value, start, terminator) => {
|
|
6051
|
+
const endIndex = value.indexOf(terminator, start);
|
|
6052
|
+
if (endIndex === -1) {
|
|
6053
|
+
return value.length;
|
|
6054
|
+
}
|
|
6055
|
+
return endIndex + terminator.length;
|
|
6056
|
+
};
|
|
6057
|
+
const getLineCommentEnd = (value, start) => {
|
|
6058
|
+
const endIndex = value.indexOf('\n', start);
|
|
6059
|
+
if (endIndex === -1) {
|
|
6060
|
+
return value.length;
|
|
6061
|
+
}
|
|
6062
|
+
return endIndex;
|
|
6063
|
+
};
|
|
6064
|
+
const getNumberEnd = (value, start) => {
|
|
6065
|
+
let i = start;
|
|
6066
|
+
while (isDigit(value[i])) {
|
|
6067
|
+
i++;
|
|
6068
|
+
}
|
|
6069
|
+
if (value[i] === '.') {
|
|
6070
|
+
i++;
|
|
6071
|
+
while (isDigit(value[i])) {
|
|
6072
|
+
i++;
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
return i;
|
|
6076
|
+
};
|
|
6077
|
+
const appendLineComment = (value, state) => {
|
|
6078
|
+
if (!value.startsWith('//', state.i) && !value.startsWith('#', state.i)) {
|
|
6079
|
+
return false;
|
|
6080
|
+
}
|
|
6081
|
+
const end = getLineCommentEnd(value, state.i);
|
|
6082
|
+
state.segments = pushToken(state.segments, TokenComment, value.slice(state.i, end));
|
|
6083
|
+
state.i = end;
|
|
6084
|
+
return true;
|
|
6085
|
+
};
|
|
6086
|
+
const appendBlockComment = (value, state) => {
|
|
6087
|
+
if (!value.startsWith('/*', state.i)) {
|
|
6088
|
+
return false;
|
|
6089
|
+
}
|
|
6090
|
+
const end = getBlockCommentEnd(value, state.i, '*/');
|
|
6091
|
+
state.segments = pushToken(state.segments, TokenComment, value.slice(state.i, end));
|
|
6092
|
+
state.i = end;
|
|
6093
|
+
return true;
|
|
6094
|
+
};
|
|
6095
|
+
const appendStringToken = (value, state) => {
|
|
6096
|
+
const quote = value[state.i];
|
|
6097
|
+
if (quote !== '"' && quote !== "'" && quote !== '`') {
|
|
6098
|
+
return false;
|
|
6099
|
+
}
|
|
6100
|
+
const end = getStringEnd(value, state.i, quote);
|
|
6101
|
+
state.segments = pushToken(state.segments, TokenString, value.slice(state.i, end));
|
|
6102
|
+
state.i = end;
|
|
6103
|
+
return true;
|
|
6104
|
+
};
|
|
6105
|
+
const appendNumericToken = (value, state) => {
|
|
6106
|
+
if (!isDigit(value[state.i])) {
|
|
6107
|
+
return false;
|
|
6108
|
+
}
|
|
6109
|
+
const end = getNumberEnd(value, state.i);
|
|
6110
|
+
state.segments = pushToken(state.segments, TokenNumeric, value.slice(state.i, end));
|
|
6111
|
+
state.i = end;
|
|
6112
|
+
return true;
|
|
6113
|
+
};
|
|
6114
|
+
const appendIdentifierToken = (value, state, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter) => {
|
|
6115
|
+
if (!isIdentifierStartCharacter(value[state.i])) {
|
|
6116
|
+
return false;
|
|
6117
|
+
}
|
|
6118
|
+
let end = state.i + 1;
|
|
6119
|
+
while (isIdentifierPartCharacter(value[end])) {
|
|
6120
|
+
end++;
|
|
6121
|
+
}
|
|
6122
|
+
const identifier = value.slice(state.i, end);
|
|
6123
|
+
const className = keywords.has(identifier) ? TokenKeyword : TokenText;
|
|
6124
|
+
state.segments = pushToken(state.segments, className, identifier);
|
|
6125
|
+
state.i = end;
|
|
6126
|
+
return true;
|
|
6127
|
+
};
|
|
6128
|
+
const appendTextCharacter = (value, state) => {
|
|
6129
|
+
state.segments = pushToken(state.segments, TokenText, value[state.i]);
|
|
6130
|
+
state.i++;
|
|
6131
|
+
};
|
|
6132
|
+
const tokenizeCode = (value, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter, supportsBlockComments) => {
|
|
6133
|
+
const state = {
|
|
6134
|
+
i: 0,
|
|
6135
|
+
segments: []
|
|
6136
|
+
};
|
|
6137
|
+
while (state.i < value.length) {
|
|
6138
|
+
if (appendLineComment(value, state)) {
|
|
6139
|
+
continue;
|
|
6140
|
+
}
|
|
6141
|
+
if (supportsBlockComments && appendBlockComment(value, state)) {
|
|
6142
|
+
continue;
|
|
6143
|
+
}
|
|
6144
|
+
if (appendStringToken(value, state)) {
|
|
6145
|
+
continue;
|
|
6146
|
+
}
|
|
6147
|
+
if (appendNumericToken(value, state)) {
|
|
6148
|
+
continue;
|
|
6149
|
+
}
|
|
6150
|
+
if (appendIdentifierToken(value, state, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter)) {
|
|
6151
|
+
continue;
|
|
6152
|
+
}
|
|
6153
|
+
appendTextCharacter(value, state);
|
|
6154
|
+
}
|
|
6155
|
+
return state.segments;
|
|
6156
|
+
};
|
|
6157
|
+
const pushTrimmedSelector = (segments, value) => {
|
|
6158
|
+
const leadingWhitespace = value.match(leadingWhitespaceRegex)?.[0] ?? '';
|
|
6159
|
+
const trailingWhitespace = value.match(trailingWhitespaceRegex)?.[0] ?? '';
|
|
6160
|
+
const trimmed = value.slice(leadingWhitespace.length, value.length - trailingWhitespace.length);
|
|
6161
|
+
let result = segments;
|
|
6162
|
+
result = pushToken(result, TokenText, leadingWhitespace);
|
|
6163
|
+
result = pushToken(result, TokenSelector, trimmed);
|
|
6164
|
+
result = pushToken(result, TokenText, trailingWhitespace);
|
|
6165
|
+
return result;
|
|
6166
|
+
};
|
|
6167
|
+
const getCssIdentifierEnd = (value, start) => {
|
|
6168
|
+
let end = start + 1;
|
|
6169
|
+
while (cssIdentifierRegex.test(value[end] ?? '')) {
|
|
6170
|
+
end++;
|
|
6171
|
+
}
|
|
6172
|
+
return end;
|
|
6173
|
+
};
|
|
6174
|
+
const getCssIdentifierClassName = (value, end) => {
|
|
6175
|
+
let lookAhead = end;
|
|
6176
|
+
while (value[lookAhead] === ' ' || value[lookAhead] === '\t') {
|
|
6177
|
+
lookAhead++;
|
|
6178
|
+
}
|
|
6179
|
+
return value[lookAhead] === ':' ? TokenPropertyName : TokenText;
|
|
6180
|
+
};
|
|
6181
|
+
const appendCssIdentifier = (value, state) => {
|
|
6182
|
+
if (!cssIdentifierRegex.test(value[state.i] ?? '')) {
|
|
6183
|
+
return false;
|
|
6184
|
+
}
|
|
6185
|
+
const end = getCssIdentifierEnd(value, state.i);
|
|
6186
|
+
const identifier = value.slice(state.i, end);
|
|
6187
|
+
state.segments = pushToken(state.segments, getCssIdentifierClassName(value, end), identifier);
|
|
6188
|
+
state.i = end;
|
|
6189
|
+
return true;
|
|
6190
|
+
};
|
|
6191
|
+
const appendCssOutsideDeclaration = (value, state) => {
|
|
6192
|
+
const nextBrace = value.indexOf('{', state.i);
|
|
6193
|
+
if (nextBrace === -1) {
|
|
6194
|
+
state.segments = pushToken(state.segments, TokenText, value.slice(state.i));
|
|
6195
|
+
state.i = value.length;
|
|
6196
|
+
return true;
|
|
6197
|
+
}
|
|
6198
|
+
state.segments = pushTrimmedSelector(state.segments, value.slice(state.i, nextBrace));
|
|
6199
|
+
state.segments = pushToken(state.segments, TokenText, '{');
|
|
6200
|
+
state.i = nextBrace + 1;
|
|
6201
|
+
return false;
|
|
6202
|
+
};
|
|
6203
|
+
const handleCssDeclarationToken = (value, state) => {
|
|
6204
|
+
if (value[state.i] === '}') {
|
|
6205
|
+
state.segments = pushToken(state.segments, TokenText, '}');
|
|
6206
|
+
state.i++;
|
|
6207
|
+
return false;
|
|
6208
|
+
}
|
|
6209
|
+
if (appendNumericToken(value, state)) {
|
|
6210
|
+
return true;
|
|
6211
|
+
}
|
|
6212
|
+
if (appendCssIdentifier(value, state)) {
|
|
6213
|
+
return true;
|
|
6214
|
+
}
|
|
6215
|
+
appendTextCharacter(value, state);
|
|
6216
|
+
return true;
|
|
6217
|
+
};
|
|
6218
|
+
const tokenizeCss = value => {
|
|
6219
|
+
const state = {
|
|
6220
|
+
i: 0,
|
|
6221
|
+
segments: []
|
|
6222
|
+
};
|
|
6223
|
+
let inDeclarationBlock = false;
|
|
6224
|
+
while (state.i < value.length) {
|
|
6225
|
+
if (appendBlockComment(value, state)) {
|
|
6226
|
+
continue;
|
|
6227
|
+
}
|
|
6228
|
+
if (appendStringToken(value, state)) {
|
|
6229
|
+
continue;
|
|
6230
|
+
}
|
|
6231
|
+
if (!inDeclarationBlock) {
|
|
6232
|
+
if (appendCssOutsideDeclaration(value, state)) {
|
|
6233
|
+
break;
|
|
6234
|
+
}
|
|
6235
|
+
inDeclarationBlock = true;
|
|
6236
|
+
continue;
|
|
6237
|
+
}
|
|
6238
|
+
inDeclarationBlock = handleCssDeclarationToken(value, state);
|
|
6239
|
+
}
|
|
6240
|
+
return state.segments;
|
|
6241
|
+
};
|
|
6242
|
+
const getHtmlTagNameEnd = (value, start) => {
|
|
6243
|
+
let i = start + 1;
|
|
6244
|
+
while (htmlTagNameRegex.test(value[i] ?? '')) {
|
|
6245
|
+
i++;
|
|
6246
|
+
}
|
|
6247
|
+
return i;
|
|
6248
|
+
};
|
|
6249
|
+
const getHtmlAttributeEnd = (value, start) => {
|
|
6250
|
+
let end = start + 1;
|
|
6251
|
+
while (htmlAttributePartRegex.test(value[end] ?? '')) {
|
|
6252
|
+
end++;
|
|
6253
|
+
}
|
|
6254
|
+
return end;
|
|
6255
|
+
};
|
|
6256
|
+
const appendHtmlAttribute = (value, state) => {
|
|
6257
|
+
if (!htmlAttributeStartRegex.test(value[state.i] ?? '')) {
|
|
6258
|
+
return false;
|
|
6259
|
+
}
|
|
6260
|
+
const end = getHtmlAttributeEnd(value, state.i);
|
|
6261
|
+
state.segments = pushToken(state.segments, TokenAttributeName, value.slice(state.i, end));
|
|
6262
|
+
state.i = end;
|
|
6263
|
+
return true;
|
|
6264
|
+
};
|
|
6265
|
+
const appendHtmlString = (value, state) => {
|
|
6266
|
+
const quote = value[state.i];
|
|
6267
|
+
if (quote !== '"' && quote !== "'") {
|
|
6268
|
+
return false;
|
|
6269
|
+
}
|
|
6270
|
+
const end = getStringEnd(value, state.i, quote);
|
|
6271
|
+
state.segments = pushToken(state.segments, TokenString, value.slice(state.i, end));
|
|
6272
|
+
state.i = end;
|
|
6273
|
+
return true;
|
|
6274
|
+
};
|
|
6275
|
+
const tokenizeHtmlTag = (value, start) => {
|
|
6276
|
+
let segments = [];
|
|
6277
|
+
if (value.startsWith('</', start)) {
|
|
6278
|
+
const end = value.indexOf('>', start);
|
|
6279
|
+
const tagEnd = end === -1 ? value.length : end + 1;
|
|
6280
|
+
segments = pushToken(segments, TokenTag, value.slice(start, tagEnd));
|
|
6281
|
+
return {
|
|
6282
|
+
end: tagEnd,
|
|
6283
|
+
segments
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
let i = getHtmlTagNameEnd(value, start);
|
|
6287
|
+
segments = pushToken(segments, TokenTag, value.slice(start, i));
|
|
6288
|
+
while (i < value.length) {
|
|
6289
|
+
if (value[i] === '>') {
|
|
6290
|
+
segments = pushToken(segments, TokenText, '>');
|
|
6291
|
+
return {
|
|
6292
|
+
end: i + 1,
|
|
6293
|
+
segments
|
|
6294
|
+
};
|
|
6295
|
+
}
|
|
6296
|
+
const state = {
|
|
6297
|
+
i,
|
|
6298
|
+
segments
|
|
6299
|
+
};
|
|
6300
|
+
if (appendHtmlString(value, state)) {
|
|
6301
|
+
({
|
|
6302
|
+
i,
|
|
6303
|
+
segments
|
|
6304
|
+
} = state);
|
|
6305
|
+
continue;
|
|
6306
|
+
}
|
|
6307
|
+
if (appendHtmlAttribute(value, state)) {
|
|
6308
|
+
({
|
|
6309
|
+
i,
|
|
6310
|
+
segments
|
|
6311
|
+
} = state);
|
|
6312
|
+
continue;
|
|
6313
|
+
}
|
|
6314
|
+
segments = pushToken(segments, TokenText, value[i]);
|
|
6315
|
+
i++;
|
|
6316
|
+
}
|
|
6317
|
+
return {
|
|
6318
|
+
end: value.length,
|
|
6319
|
+
segments
|
|
6320
|
+
};
|
|
6321
|
+
};
|
|
6322
|
+
const tokenizeHtml = value => {
|
|
6323
|
+
let segments = [];
|
|
6324
|
+
let i = 0;
|
|
6325
|
+
while (i < value.length) {
|
|
6326
|
+
if (value.startsWith('<!--', i)) {
|
|
6327
|
+
const end = getBlockCommentEnd(value, i, '-->');
|
|
6328
|
+
segments = pushToken(segments, TokenComment, value.slice(i, end));
|
|
6329
|
+
i = end;
|
|
6330
|
+
continue;
|
|
6331
|
+
}
|
|
6332
|
+
if (value[i] === '<') {
|
|
6333
|
+
const {
|
|
6334
|
+
end,
|
|
6335
|
+
segments: tagSegments
|
|
6336
|
+
} = tokenizeHtmlTag(value, i);
|
|
6337
|
+
for (const segment of tagSegments) {
|
|
6338
|
+
segments = pushToken(segments, segment.className, segment.value);
|
|
6339
|
+
}
|
|
6340
|
+
i = end;
|
|
6341
|
+
continue;
|
|
6342
|
+
}
|
|
6343
|
+
const nextTag = value.indexOf('<', i);
|
|
6344
|
+
const end = nextTag === -1 ? value.length : nextTag;
|
|
6345
|
+
segments = pushToken(segments, TokenText, value.slice(i, end));
|
|
6346
|
+
i = end;
|
|
6347
|
+
}
|
|
6348
|
+
return segments;
|
|
6349
|
+
};
|
|
6350
|
+
const getSyntaxHighlightTokens = (value, language) => {
|
|
6351
|
+
switch (language) {
|
|
6352
|
+
case 'css':
|
|
6353
|
+
return tokenizeCss(value);
|
|
6354
|
+
case 'html':
|
|
6355
|
+
return tokenizeHtml(value);
|
|
6356
|
+
case 'javascript':
|
|
6357
|
+
return tokenizeCode(value, jsKeywords, isIdentifierStart, isIdentifierPart, true);
|
|
6358
|
+
case 'json':
|
|
6359
|
+
return getTokenSegments(value);
|
|
6360
|
+
case 'python':
|
|
6361
|
+
return tokenizeCode(value, pythonKeywords, isPythonIdentifierStart, isPythonIdentifierPart, false);
|
|
6362
|
+
case 'typescript':
|
|
6363
|
+
return tokenizeCode(value, tsKeywords, isIdentifierStart, isIdentifierPart, true);
|
|
6364
|
+
}
|
|
6365
|
+
};
|
|
6366
|
+
|
|
6367
|
+
const getTextLineData = value => {
|
|
5553
6368
|
const lines = value.split('\n');
|
|
5554
|
-
|
|
6369
|
+
return lines.map(line => {
|
|
5555
6370
|
return {
|
|
5556
6371
|
childCount: 1,
|
|
5557
6372
|
nodes: [{
|
|
@@ -5561,15 +6376,79 @@ const getTextNode = (value, showLineNumbers = true, cursor = null) => {
|
|
|
5561
6376
|
}, text(line)]
|
|
5562
6377
|
};
|
|
5563
6378
|
});
|
|
6379
|
+
};
|
|
6380
|
+
const getTokenLineData = tokenSegments => {
|
|
6381
|
+
const lineData = [];
|
|
6382
|
+
let currentNodes = [];
|
|
6383
|
+
let childCount = 0;
|
|
6384
|
+
const pushLine = () => {
|
|
6385
|
+
lineData.push({
|
|
6386
|
+
childCount,
|
|
6387
|
+
nodes: currentNodes
|
|
6388
|
+
});
|
|
6389
|
+
currentNodes = [];
|
|
6390
|
+
childCount = 0;
|
|
6391
|
+
};
|
|
6392
|
+
const pushSegment = (className, segmentValue) => {
|
|
6393
|
+
if (!segmentValue) {
|
|
6394
|
+
return;
|
|
6395
|
+
}
|
|
6396
|
+
currentNodes.push({
|
|
6397
|
+
childCount: 1,
|
|
6398
|
+
className,
|
|
6399
|
+
type: Span
|
|
6400
|
+
}, text(segmentValue));
|
|
6401
|
+
childCount++;
|
|
6402
|
+
};
|
|
6403
|
+
for (const segment of tokenSegments) {
|
|
6404
|
+
let start = 0;
|
|
6405
|
+
for (let i = 0; i < segment.value.length; i++) {
|
|
6406
|
+
if (segment.value[i] !== '\n') {
|
|
6407
|
+
continue;
|
|
6408
|
+
}
|
|
6409
|
+
pushSegment(segment.className, segment.value.slice(start, i));
|
|
6410
|
+
pushLine();
|
|
6411
|
+
start = i + 1;
|
|
6412
|
+
}
|
|
6413
|
+
pushSegment(segment.className, segment.value.slice(start));
|
|
6414
|
+
}
|
|
6415
|
+
if (lineData.length === 0 || currentNodes.length > 0) {
|
|
6416
|
+
pushLine();
|
|
6417
|
+
}
|
|
6418
|
+
return lineData;
|
|
6419
|
+
};
|
|
6420
|
+
const getLineData = (value, tokenSegments) => {
|
|
6421
|
+
return tokenSegments ? getTokenLineData(tokenSegments) : getTextLineData(value);
|
|
6422
|
+
};
|
|
6423
|
+
const getTextNode = (value, showLineNumbers = true, cursor = null, tokenSegments, virtualization) => {
|
|
6424
|
+
const lineData = getLineData(value, tokenSegments);
|
|
6425
|
+
if (virtualization) {
|
|
6426
|
+
const slicedLineData = lineData.slice(virtualization.startLineY, virtualization.endLineY);
|
|
6427
|
+
const visibleCursor = cursor && cursor.rowIndex >= virtualization.startLineY && cursor.rowIndex < virtualization.endLineY ? {
|
|
6428
|
+
...cursor,
|
|
6429
|
+
rowIndex: cursor.rowIndex - virtualization.startLineY
|
|
6430
|
+
} : null;
|
|
6431
|
+
return getVirtualizedEditorDom(slicedLineData, showLineNumbers, visibleCursor, showLineNumbers ? HandlePreviewTextPointerDown : undefined, {
|
|
6432
|
+
lineNumberStart: virtualization.startLineY,
|
|
6433
|
+
onScrollBarPointerDown: HandlePreviewTextScrollBarPointerDown,
|
|
6434
|
+
onWheel: HandlePreviewTextWheel,
|
|
6435
|
+
showScrollBar: virtualization.showScrollBar
|
|
6436
|
+
});
|
|
6437
|
+
}
|
|
5564
6438
|
return getEditorDom(lineData, showLineNumbers, cursor, showLineNumbers ? HandlePreviewTextPointerDown : undefined);
|
|
5565
6439
|
};
|
|
5566
6440
|
|
|
5567
|
-
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor) => {
|
|
6441
|
+
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor, virtualization) => {
|
|
5568
6442
|
if (typeof previewEvent === 'string') {
|
|
5569
6443
|
const isInvalidImageMessage = previewEvent === ImageCouldNotBeLoaded;
|
|
5570
6444
|
const isChatMessageUpdatedPreview = !!selectedEvent && isChatMessageUpdatedEvent(selectedEvent);
|
|
5571
6445
|
const showLineNumbers = !isInvalidImageMessage && !isChatMessageUpdatedPreview;
|
|
5572
|
-
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null);
|
|
6446
|
+
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null, undefined, virtualization);
|
|
6447
|
+
}
|
|
6448
|
+
if (isWriteFilePreview(previewEvent)) {
|
|
6449
|
+
const language = getLanguageFromFileExtension(previewEvent.uri);
|
|
6450
|
+
const tokenSegments = language ? getSyntaxHighlightTokens(previewEvent.content, language) : undefined;
|
|
6451
|
+
return getTextNode(previewEvent.content, true, previewTextCursor ?? null, tokenSegments, virtualization);
|
|
5573
6452
|
}
|
|
5574
6453
|
if (previewEvent === undefined) {
|
|
5575
6454
|
return [];
|
|
@@ -5745,7 +6624,55 @@ const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
|
5745
6624
|
}
|
|
5746
6625
|
return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
|
|
5747
6626
|
};
|
|
5748
|
-
const
|
|
6627
|
+
const getTimingContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6628
|
+
if (selectedEvent === null) {
|
|
6629
|
+
return responseEventNodes;
|
|
6630
|
+
}
|
|
6631
|
+
return getTimingDetailsDom(selectedEvent);
|
|
6632
|
+
};
|
|
6633
|
+
const getPreviewContentNodes = (previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, virtualization) => {
|
|
6634
|
+
if (previewEventNodes.length > 0) {
|
|
6635
|
+
return previewEventNodes;
|
|
6636
|
+
}
|
|
6637
|
+
if (selectedEvent === null) {
|
|
6638
|
+
return [];
|
|
6639
|
+
}
|
|
6640
|
+
return getPreviewEventNodes(getPreviewEvent(selectedEvent), selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
6641
|
+
columnIndex: previewTextCursorColumnIndex,
|
|
6642
|
+
rowIndex: previewTextCursorRowIndex
|
|
6643
|
+
}, virtualization);
|
|
6644
|
+
};
|
|
6645
|
+
const getPayloadContentNodes = (payloadEventNodes, selectedEvent) => {
|
|
6646
|
+
if (payloadEventNodes.length > 0) {
|
|
6647
|
+
return payloadEventNodes;
|
|
6648
|
+
}
|
|
6649
|
+
if (selectedEvent === null) {
|
|
6650
|
+
return [];
|
|
6651
|
+
}
|
|
6652
|
+
return getEventNode(getPayloadEvent(selectedEvent));
|
|
6653
|
+
};
|
|
6654
|
+
const getResponseContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6655
|
+
if (responseEventNodes.length > 0) {
|
|
6656
|
+
return responseEventNodes;
|
|
6657
|
+
}
|
|
6658
|
+
if (selectedEvent === null) {
|
|
6659
|
+
return [];
|
|
6660
|
+
}
|
|
6661
|
+
return getEventNode(selectedEvent);
|
|
6662
|
+
};
|
|
6663
|
+
const getSelectedContentNodes = (safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization) => {
|
|
6664
|
+
if (safeSelectedDetailTab === Timing) {
|
|
6665
|
+
return getTimingContentNodes(responseEventNodes, selectedEvent);
|
|
6666
|
+
}
|
|
6667
|
+
if (safeSelectedDetailTab === Preview) {
|
|
6668
|
+
return getPreviewContentNodes(previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
6669
|
+
}
|
|
6670
|
+
if (safeSelectedDetailTab === Payload) {
|
|
6671
|
+
return getPayloadContentNodes(payloadEventNodes, selectedEvent);
|
|
6672
|
+
}
|
|
6673
|
+
return getResponseContentNodes(responseEventNodes, selectedEvent);
|
|
6674
|
+
};
|
|
6675
|
+
const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes, responseEventNodes = payloadEventNodes, selectedEvent = null, detailTabs = createDetailTabs(), previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, previewVirtualization) => {
|
|
5749
6676
|
if (previewEventNodes.length === 0 && payloadEventNodes.length === 0 && responseEventNodes.length === 0) {
|
|
5750
6677
|
return [];
|
|
5751
6678
|
}
|
|
@@ -5753,43 +6680,7 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
5753
6680
|
const safeSelectedDetailTab = getSelectedDetailTab(normalizedDetailTabs);
|
|
5754
6681
|
const selectedDetailTab = normalizedDetailTabs.find(detailTab => detailTab.name === safeSelectedDetailTab) ?? normalizedDetailTabs[0];
|
|
5755
6682
|
const getDetailContentDom = () => {
|
|
5756
|
-
const
|
|
5757
|
-
if (selectedEvent === null) {
|
|
5758
|
-
return responseEventNodes;
|
|
5759
|
-
}
|
|
5760
|
-
return getTimingDetailsDom(selectedEvent);
|
|
5761
|
-
};
|
|
5762
|
-
const getDetailContentDomPreview = () => {
|
|
5763
|
-
if (previewEventNodes.length > 0) {
|
|
5764
|
-
return previewEventNodes;
|
|
5765
|
-
}
|
|
5766
|
-
if (selectedEvent === null) {
|
|
5767
|
-
return [];
|
|
5768
|
-
}
|
|
5769
|
-
return getPreviewEventNodes(getPreviewEvent(selectedEvent), selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
5770
|
-
columnIndex: previewTextCursorColumnIndex,
|
|
5771
|
-
rowIndex: previewTextCursorRowIndex
|
|
5772
|
-
});
|
|
5773
|
-
};
|
|
5774
|
-
const getDetailContentDomPayload = () => {
|
|
5775
|
-
if (payloadEventNodes.length > 0) {
|
|
5776
|
-
return payloadEventNodes;
|
|
5777
|
-
}
|
|
5778
|
-
if (selectedEvent === null) {
|
|
5779
|
-
return [];
|
|
5780
|
-
}
|
|
5781
|
-
return getEventNode(getPayloadEvent(selectedEvent));
|
|
5782
|
-
};
|
|
5783
|
-
const getDetailContentDomResponse = () => {
|
|
5784
|
-
if (responseEventNodes.length > 0) {
|
|
5785
|
-
return responseEventNodes;
|
|
5786
|
-
}
|
|
5787
|
-
if (selectedEvent === null) {
|
|
5788
|
-
return [];
|
|
5789
|
-
}
|
|
5790
|
-
return getEventNode(selectedEvent);
|
|
5791
|
-
};
|
|
5792
|
-
const contentNodes = safeSelectedDetailTab === Timing ? getDetailContentDomTiming() : safeSelectedDetailTab === Preview ? getDetailContentDomPreview() : safeSelectedDetailTab === Payload ? getDetailContentDomPayload() : getDetailContentDomResponse();
|
|
6683
|
+
const contentNodes = getSelectedContentNodes(safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
5793
6684
|
return [{
|
|
5794
6685
|
'aria-label': selectedDetailTab.label,
|
|
5795
6686
|
childCount: getDirectChildCount$1(contentNodes),
|
|
@@ -5812,6 +6703,26 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
5812
6703
|
}, ...getDetailsCloseButtonDom(), ...getTabNodes(normalizedDetailTabs), ...getDetailContentDom()];
|
|
5813
6704
|
};
|
|
5814
6705
|
|
|
6706
|
+
const getMethods = new Set(['list_dir', 'list_files', 'read_file']);
|
|
6707
|
+
const postMethods = new Set(['create_directory', 'create_file', 'mkdir', 'write_file']);
|
|
6708
|
+
const deleteMethods = new Set(['delete_directory', 'delete_file', 'delete_folder', 'remove_directory', 'remove_file', 'remove_folder']);
|
|
6709
|
+
const getEventTableMethodLabel = event => {
|
|
6710
|
+
const toolName = getToolName(event);
|
|
6711
|
+
if (!toolName) {
|
|
6712
|
+
return '';
|
|
6713
|
+
}
|
|
6714
|
+
if (getMethods.has(toolName)) {
|
|
6715
|
+
return 'GET';
|
|
6716
|
+
}
|
|
6717
|
+
if (postMethods.has(toolName)) {
|
|
6718
|
+
return 'POST';
|
|
6719
|
+
}
|
|
6720
|
+
if (deleteMethods.has(toolName)) {
|
|
6721
|
+
return 'DELETE';
|
|
6722
|
+
}
|
|
6723
|
+
return '';
|
|
6724
|
+
};
|
|
6725
|
+
|
|
5815
6726
|
const getRowCellNodes = (event, isErrorStatus, visibleTableColumns) => {
|
|
5816
6727
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
5817
6728
|
return orderedVisibleTableColumns.flatMap((column, index) => {
|
|
@@ -5822,6 +6733,12 @@ const getRowCellNodes = (event, isErrorStatus, visibleTableColumns) => {
|
|
|
5822
6733
|
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
5823
6734
|
type: Td
|
|
5824
6735
|
}, text(getEventTableDurationText(event))];
|
|
6736
|
+
case Method:
|
|
6737
|
+
return [{
|
|
6738
|
+
childCount: 1,
|
|
6739
|
+
className: TableCell,
|
|
6740
|
+
type: Td
|
|
6741
|
+
}, text(getEventTableMethodLabel(event))];
|
|
5825
6742
|
case Status$1:
|
|
5826
6743
|
return [{
|
|
5827
6744
|
childCount: 1,
|
|
@@ -5992,7 +6909,7 @@ const getTableBodyDom = (rowNodes, eventCount) => {
|
|
|
5992
6909
|
}, ...rowNodes];
|
|
5993
6910
|
};
|
|
5994
6911
|
|
|
5995
|
-
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo'];
|
|
6912
|
+
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo', 'TableColThree'];
|
|
5996
6913
|
const getTableColumnGroupDom = visibleTableColumns => {
|
|
5997
6914
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
5998
6915
|
return [{
|
|
@@ -6015,6 +6932,7 @@ const getHeaderCellNode = (column, tableColumns) => {
|
|
|
6015
6932
|
type: Th
|
|
6016
6933
|
}, text(getTableColumnLabel(tableColumns, column))];
|
|
6017
6934
|
};
|
|
6935
|
+
|
|
6018
6936
|
const getHeaderCellNodes = (visibleTableColumns, tableColumns = createTableColumns()) => {
|
|
6019
6937
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns, tableColumns);
|
|
6020
6938
|
return orderedVisibleTableColumns.flatMap(column => getHeaderCellNode(column, tableColumns));
|
|
@@ -6043,8 +6961,8 @@ const getTableDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleT
|
|
|
6043
6961
|
}, ...getTableColumnGroupDom(visibleTableColumns), ...getTableHeaderDom(visibleTableColumns, tableColumns), ...getTableBodyDom(rowNodes, eventCount)];
|
|
6044
6962
|
};
|
|
6045
6963
|
|
|
6046
|
-
const resizerNames = ['ResizerOne', 'ResizerTwo'];
|
|
6047
|
-
const resizerClassNames = [ResizerOne, ResizerTwo];
|
|
6964
|
+
const resizerNames = ['ResizerOne', 'ResizerTwo', 'ResizerThree'];
|
|
6965
|
+
const resizerClassNames = [ResizerOne, ResizerTwo, ResizerThree];
|
|
6048
6966
|
const getTableResizersDom = visibleTableColumns => {
|
|
6049
6967
|
const visibleColumnCount = getOrderedVisibleTableColumns(visibleTableColumns).length;
|
|
6050
6968
|
const resizerCount = Math.max(0, visibleColumnCount - 1);
|
|
@@ -6069,6 +6987,7 @@ const getTableResizersDom = visibleTableColumns => {
|
|
|
6069
6987
|
return [{
|
|
6070
6988
|
childCount: resizerCount,
|
|
6071
6989
|
className: Resizers,
|
|
6990
|
+
role: None,
|
|
6072
6991
|
type: Div
|
|
6073
6992
|
}, ...resizerNodes];
|
|
6074
6993
|
};
|
|
@@ -6089,7 +7008,7 @@ const getTableScrollBarDom = visible => {
|
|
|
6089
7008
|
}];
|
|
6090
7009
|
};
|
|
6091
7010
|
|
|
6092
|
-
const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = '', showScrollBar = false) => {
|
|
7011
|
+
const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = 'none', showScrollBar = false) => {
|
|
6093
7012
|
const tableWrapperClassName = mergeClassNames(TableWrapper, focus === FocusChatDebugTable ? FocusOutline : '', className);
|
|
6094
7013
|
const tableWrapperNode = {
|
|
6095
7014
|
childCount: showScrollBar ? 3 : 2,
|
|
@@ -6103,7 +7022,7 @@ const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultV
|
|
|
6103
7022
|
return [tableWrapperNode, ...getTableDom(rowNodes, eventCount, visibleTableColumns, tableColumns, summary, focus), ...getTableResizersDom(visibleTableColumns), ...getTableScrollBarDom(showScrollBar)];
|
|
6104
7023
|
};
|
|
6105
7024
|
|
|
6106
|
-
const getTableWrapperWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = '', showScrollBar = false) => {
|
|
7025
|
+
const getTableWrapperWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = 'none', showScrollBar = false) => {
|
|
6107
7026
|
const tableSummaryNodes = getTableSummaryDom(summary);
|
|
6108
7027
|
return [{
|
|
6109
7028
|
childCount: tableSummaryNodes.length === 0 ? 1 : 2,
|
|
@@ -6280,25 +7199,31 @@ const getTimelineDom = (timelineInfo, hoverPercent = null) => {
|
|
|
6280
7199
|
}, ...selectionNodes];
|
|
6281
7200
|
};
|
|
6282
7201
|
|
|
6283
|
-
const getDevtoolsDom = (events, selectedEvent, selectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage = noEventsFound(), timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', detailTabs = createDetailTabs(), visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, minLineY = 0, maxLineY = events.length) => {
|
|
7202
|
+
const getDevtoolsDom = (events, selectedEvent, selectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage = noEventsFound(), timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', detailTabs = createDetailTabs(), visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, previewTextDeltaY = 0, previewTextViewportHeight = 0, minLineY = 0, maxLineY = events.length) => {
|
|
6284
7203
|
const visibleEvents = events.slice(minLineY, maxLineY);
|
|
6285
7204
|
const rowNodes = getDevtoolsRows(visibleEvents, selectedEventIndex, visibleTableColumns, minLineY);
|
|
6286
7205
|
const effectiveRange = getEffectiveTimelineRange(timelineStartSeconds, timelineEndSeconds, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds);
|
|
6287
7206
|
const resolvedTimelineInfo = timelineInfo || getTimelineInfo(timelineEvents, effectiveRange.startSeconds, effectiveRange.endSeconds);
|
|
6288
7207
|
const timelineNodes = getTimelineDom(resolvedTimelineInfo, timelineHoverPercent);
|
|
6289
7208
|
const previewEvent = selectedEvent ? getPreviewEvent(selectedEvent) : undefined;
|
|
7209
|
+
const previewVirtualization = getPreviewVirtualizationState(selectedEvent, previewTextViewportHeight, previewTextDeltaY);
|
|
7210
|
+
const previewVirtualizationOptions = previewTextViewportHeight <= 0 || previewVirtualization.totalLineCount === 0 ? undefined : {
|
|
7211
|
+
endLineY: previewVirtualization.endLineY,
|
|
7212
|
+
showScrollBar: previewVirtualization.showScrollBar,
|
|
7213
|
+
startLineY: previewVirtualization.startLineY
|
|
7214
|
+
};
|
|
6290
7215
|
const previewEventNodes = getPreviewEventNodes(previewEvent, selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
6291
7216
|
columnIndex: previewTextCursorColumnIndex,
|
|
6292
7217
|
rowIndex: previewTextCursorRowIndex
|
|
6293
|
-
});
|
|
7218
|
+
}, previewVirtualizationOptions);
|
|
6294
7219
|
const payloadEventNodes = selectedEvent ? getEventNode(getPayloadEvent(selectedEvent)) : [];
|
|
6295
7220
|
const responseEventNodes = selectedEvent ? getEventNode(getResponseEvent(selectedEvent)) : [];
|
|
6296
|
-
const hasSelectedEvent =
|
|
7221
|
+
const hasSelectedEvent = !!selectedEvent;
|
|
6297
7222
|
const eventsClassName = getEventsClassName(hasSelectedEvent);
|
|
6298
7223
|
const summary = getTableSummary(events);
|
|
6299
7224
|
const showScrollBar = visibleEvents.length < events.length;
|
|
6300
7225
|
const tableNodes = events.length === 0 ? getEmptyStateDom(emptyMessage) : getTableWrapperWrapperDom(rowNodes, visibleEvents.length, visibleTableColumns, tableColumns, summary, focus, '', '', showScrollBar);
|
|
6301
|
-
const detailsNodes = getDetailsDom(previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, detailTabs, previewTextCursorRowIndex, previewTextCursorColumnIndex);
|
|
7226
|
+
const detailsNodes = getDetailsDom(previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, detailTabs, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualizationOptions);
|
|
6302
7227
|
const sashNodes = getSashNodesDom(hasSelectedEvent);
|
|
6303
7228
|
const splitChildCount = hasSelectedEvent ? 3 : 1;
|
|
6304
7229
|
const rootChildCount = 3;
|
|
@@ -6352,7 +7277,7 @@ const getEventCategoryFilterDescription = eventCategoryFilters => {
|
|
|
6352
7277
|
}
|
|
6353
7278
|
return eventCategoryFilters.map(eventCategoryFilter => getEventCategoryFilterLabel(eventCategoryFilter).toLowerCase()).join(', ');
|
|
6354
7279
|
};
|
|
6355
|
-
const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, categoryFilters, _showEventStreamFinishedEvents, _showInputEvents, _showResponsePartEvents, useDevtoolsLayout, selectedEvent, selectedEventIndex, timelineStartSeconds, timelineEndSeconds, timelineFilterDescription, timelineEvents, events, timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', visibleTableColumns = defaultVisibleTableColumns, detailTabs = createDetailTabs(), tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, minLineY = 0, maxLineY = events.length) => {
|
|
7280
|
+
const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, categoryFilters, _showEventStreamFinishedEvents, _showInputEvents, _showResponsePartEvents, useDevtoolsLayout, selectedEvent, selectedEventIndex, timelineStartSeconds, timelineEndSeconds, timelineFilterDescription, timelineEvents, events, timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', visibleTableColumns = defaultVisibleTableColumns, detailTabs = createDetailTabs(), tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, minLineY = 0, maxLineY = events.length, previewTextDeltaY = 0, previewTextViewportHeight = 0) => {
|
|
6356
7281
|
if (errorMessage) {
|
|
6357
7282
|
return getDebugErrorDom(errorMessage);
|
|
6358
7283
|
}
|
|
@@ -6376,13 +7301,14 @@ const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, ca
|
|
|
6376
7301
|
const emptyMessage = getEmptyMessage(events.length, hasFilterValue, useNoToolCallEventsMessage, noFilteredEventsMessage);
|
|
6377
7302
|
const safeSelectedEventIndex = selectedEventIndex === null || selectedEventIndex < 0 || selectedEventIndex >= events.length ? null : selectedEventIndex;
|
|
6378
7303
|
if (useDevtoolsLayout) {
|
|
6379
|
-
const devtoolsDom = getDevtoolsDom(events, selectedEvent, safeSelectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds, detailTabs, visibleTableColumns, tableColumns, timelineInfo, timelineHoverPercent, focus, previewTextCursorRowIndex, previewTextCursorColumnIndex, minLineY, maxLineY);
|
|
7304
|
+
const devtoolsDom = getDevtoolsDom(events, selectedEvent, safeSelectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds, detailTabs, visibleTableColumns, tableColumns, timelineInfo, timelineHoverPercent, focus, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewTextDeltaY, previewTextViewportHeight, minLineY, maxLineY);
|
|
6380
7305
|
const devtoolsContentNodes = devtoolsDom.slice(1);
|
|
6381
7306
|
const topLevelNodes = [...getDebugViewTopDom(filterValue, useDevtoolsLayout, categoryFilters), ...devtoolsContentNodes];
|
|
6382
7307
|
const rootChildCount = getTopLevelChildCount(topLevelNodes);
|
|
6383
7308
|
return [{
|
|
6384
7309
|
childCount: rootChildCount,
|
|
6385
7310
|
className: mergeClassNames(ChatDebugView, ChatDebugViewDevtools),
|
|
7311
|
+
onContextMenu: HandleRootContextMenu,
|
|
6386
7312
|
type: Div
|
|
6387
7313
|
}, ...topLevelNodes];
|
|
6388
7314
|
}
|
|
@@ -6392,6 +7318,7 @@ const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, ca
|
|
|
6392
7318
|
return [{
|
|
6393
7319
|
childCount: rootChildCount,
|
|
6394
7320
|
className: mergeClassNames(ChatDebugView, useDevtoolsLayout ? ChatDebugViewDevtools : ''),
|
|
7321
|
+
onContextMenu: HandleRootContextMenu,
|
|
6395
7322
|
type: Div
|
|
6396
7323
|
}, ...debugViewTopDom, ...contentNodes];
|
|
6397
7324
|
};
|
|
@@ -6409,7 +7336,8 @@ const renderItems = (oldState, newState) => {
|
|
|
6409
7336
|
return [SetDom2, newState.uid, []];
|
|
6410
7337
|
}
|
|
6411
7338
|
const filteredEvents = getCurrentEvents$2(newState);
|
|
6412
|
-
const
|
|
7339
|
+
const previewTextViewportHeight = getPreviewTextViewportHeight(newState);
|
|
7340
|
+
const dom = getChatDebugViewDom(newState.errorMessage, newState.filterValue, getSelectedEventCategoryFilters(newState.categoryFilters), newState.categoryFilters, newState.showEventStreamFinishedEvents, newState.showInputEvents, newState.showResponsePartEvents, newState.useDevtoolsLayout, newState.selectedEvent, newState.selectedEventIndex, newState.timelineStartSeconds, newState.timelineEndSeconds, newState.timelineFilterDescription, withSessionEventIds(newState.timelineEvents), withSessionEventIds(filteredEvents), newState.timelineSelectionActive, newState.timelineSelectionAnchorSeconds, newState.timelineSelectionFocusSeconds, getVisibleTableColumns(newState.tableColumns), newState.detailTabs, newState.tableColumns, newState.timelineInfo, newState.timelineHoverPercent, newState.focus, newState.previewTextCursorRowIndex, newState.previewTextCursorColumnIndex, newState.tableMinLineY, newState.tableMaxLineY, newState.previewTextDeltaY, previewTextViewportHeight);
|
|
6413
7341
|
return [SetDom2, newState.uid, dom];
|
|
6414
7342
|
};
|
|
6415
7343
|
|
|
@@ -6481,6 +7409,10 @@ const render2 = (uid, diffResult) => {
|
|
|
6481
7409
|
|
|
6482
7410
|
const renderEventListeners = () => {
|
|
6483
7411
|
return [{
|
|
7412
|
+
name: HandleRootContextMenu,
|
|
7413
|
+
params: ['handleRootContextMenu'],
|
|
7414
|
+
preventDefault: true
|
|
7415
|
+
}, {
|
|
6484
7416
|
name: HandleHeaderContextMenu,
|
|
6485
7417
|
params: ['handleHeaderContextMenu', ClientX, ClientY],
|
|
6486
7418
|
preventDefault: true
|
|
@@ -6568,6 +7500,21 @@ const renderEventListeners = () => {
|
|
|
6568
7500
|
params: ['handleTableWheel', 'event.deltaY'],
|
|
6569
7501
|
passive: true,
|
|
6570
7502
|
preventDefault: true
|
|
7503
|
+
}, {
|
|
7504
|
+
name: HandlePreviewTextWheel,
|
|
7505
|
+
params: ['handlePreviewTextWheel', 'event.deltaY'],
|
|
7506
|
+
passive: true,
|
|
7507
|
+
preventDefault: true
|
|
7508
|
+
}, {
|
|
7509
|
+
name: HandlePreviewTextScrollBarPointerDown,
|
|
7510
|
+
params: ['handlePreviewTextScrollBarPointerDown', ClientY],
|
|
7511
|
+
trackPointerEvents: [HandlePreviewTextScrollBarPointerMove, HandlePreviewTextScrollBarPointerUp]
|
|
7512
|
+
}, {
|
|
7513
|
+
name: HandlePreviewTextScrollBarPointerMove,
|
|
7514
|
+
params: ['handlePreviewTextScrollBarPointerMove', ClientY]
|
|
7515
|
+
}, {
|
|
7516
|
+
name: HandlePreviewTextScrollBarPointerUp,
|
|
7517
|
+
params: ['handlePreviewTextScrollBarPointerUp']
|
|
6571
7518
|
}, {
|
|
6572
7519
|
name: HandleTimelinePointerDown,
|
|
6573
7520
|
params: ['handleTimelinePointerDown', TargetName, ClientX],
|
|
@@ -6595,11 +7542,13 @@ const rerender = state => {
|
|
|
6595
7542
|
};
|
|
6596
7543
|
|
|
6597
7544
|
const resetTableColumns = state => {
|
|
6598
|
-
if (getVisibleTableColumns(state.tableColumns).join(',') === defaultVisibleTableColumns.join(',') && isSameTableColumnWidths(state.tableColumnWidths, defaultTableColumnWidths)) {
|
|
7545
|
+
if (getVisibleTableColumns(state.tableColumns).join(',') === defaultVisibleTableColumns.join(',') && isSameTableColumnWidths(state.tableColumnWidths, defaultTableColumnWidths) && state.sortColumn === '' && state.sortDescending === false) {
|
|
6599
7546
|
return state;
|
|
6600
7547
|
}
|
|
6601
7548
|
return {
|
|
6602
7549
|
...state,
|
|
7550
|
+
sortColumn: '',
|
|
7551
|
+
sortDescending: false,
|
|
6603
7552
|
tableColumns: createTableColumns(),
|
|
6604
7553
|
tableColumnWidths: defaultTableColumnWidths
|
|
6605
7554
|
};
|
|
@@ -6669,6 +7618,9 @@ const setEvents = (state, events) => {
|
|
|
6669
7618
|
initial: false,
|
|
6670
7619
|
previewTextCursorColumnIndex: null,
|
|
6671
7620
|
previewTextCursorRowIndex: null,
|
|
7621
|
+
previewTextDeltaY: 0,
|
|
7622
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7623
|
+
previewTextScrollBarPointerActive: false,
|
|
6672
7624
|
selectedEvent: null,
|
|
6673
7625
|
selectedEventId: null,
|
|
6674
7626
|
selectedEventIndex: null
|
|
@@ -6696,6 +7648,9 @@ const setSessionId = async (state, sessionId) => {
|
|
|
6696
7648
|
initial: false,
|
|
6697
7649
|
previewTextCursorColumnIndex: null,
|
|
6698
7650
|
previewTextCursorRowIndex: null,
|
|
7651
|
+
previewTextDeltaY: 0,
|
|
7652
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7653
|
+
previewTextScrollBarPointerActive: false,
|
|
6699
7654
|
selectedEvent: null,
|
|
6700
7655
|
selectedEventId: null,
|
|
6701
7656
|
selectedEventIndex: null,
|
|
@@ -6712,6 +7667,9 @@ const setSessionId = async (state, sessionId) => {
|
|
|
6712
7667
|
initial: false,
|
|
6713
7668
|
previewTextCursorColumnIndex: null,
|
|
6714
7669
|
previewTextCursorRowIndex: null,
|
|
7670
|
+
previewTextDeltaY: 0,
|
|
7671
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7672
|
+
previewTextScrollBarPointerActive: false,
|
|
6715
7673
|
selectedEvent: null,
|
|
6716
7674
|
selectedEventId: null,
|
|
6717
7675
|
selectedEventIndex: null,
|
|
@@ -6751,17 +7709,22 @@ const commandMap = {
|
|
|
6751
7709
|
'ChatDebug.getMenuEntries': wrapGetter(getMenuEntries2),
|
|
6752
7710
|
'ChatDebug.getMenuIds': getMenuIds,
|
|
6753
7711
|
'ChatDebug.handleClickRefresh': wrapCommand(handleClickRefresh),
|
|
6754
|
-
'ChatDebug.handleCloseDetails': wrapCommand(handleCloseDetails),
|
|
7712
|
+
'ChatDebug.handleCloseDetails': wrapCommand(handleCloseDetails$1),
|
|
6755
7713
|
'ChatDebug.handleDetailsContextMenu': wrapCommand(handleDetailsContextMenu),
|
|
6756
7714
|
'ChatDebug.handleDetailsTopContextMenu': wrapCommand(handleDetailsTopContextMenu),
|
|
6757
7715
|
'ChatDebug.handleDetailTabsFocus': wrapCommand(handleDetailTabsFocus),
|
|
6758
7716
|
'ChatDebug.handleEscape': wrapCommand(handleEscape),
|
|
6759
|
-
'ChatDebug.handleEventCategoryFilter': wrapCommand(handleEventCategoryFilter),
|
|
7717
|
+
'ChatDebug.handleEventCategoryFilter': wrapCommand(handleEventCategoryFilter$1),
|
|
6760
7718
|
'ChatDebug.handleEventRowClick': wrapCommand(handleEventRowClick),
|
|
6761
7719
|
'ChatDebug.handleEventRowClickAt': wrapCommand(handleEventRowClickAt),
|
|
6762
7720
|
'ChatDebug.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
|
|
6763
7721
|
'ChatDebug.handleInput': wrapCommand(handleInput),
|
|
6764
7722
|
'ChatDebug.handlePreviewTextPointerDown': wrapCommand(handlePreviewTextPointerDown),
|
|
7723
|
+
'ChatDebug.handlePreviewTextScrollBarPointerDown': wrapCommand(handlePreviewTextScrollBarPointerDown),
|
|
7724
|
+
'ChatDebug.handlePreviewTextScrollBarPointerMove': wrapCommand(handlePreviewTextScrollBarPointerMove),
|
|
7725
|
+
'ChatDebug.handlePreviewTextScrollBarPointerUp': wrapCommand(handlePreviewTextScrollBarPointerUp),
|
|
7726
|
+
'ChatDebug.handlePreviewTextWheel': wrapCommand(handlePreviewTextWheel),
|
|
7727
|
+
'ChatDebug.handleRootContextMenu': wrapCommand(handleRootContextMenu),
|
|
6765
7728
|
'ChatDebug.handleSashPointerDown': wrapCommand(handleSashPointerDown),
|
|
6766
7729
|
'ChatDebug.handleSashPointerMove': wrapCommand(handleSashPointerMove),
|
|
6767
7730
|
'ChatDebug.handleSashPointerUp': wrapCommand(handleSashPointerUp),
|