@lvce-editor/chat-debug-view 10.18.0 → 10.20.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 +472 -241
- package/package.json +1 -1
|
@@ -1137,6 +1137,8 @@ const Tr = 15;
|
|
|
1137
1137
|
const Img = 17;
|
|
1138
1138
|
const Section = 41;
|
|
1139
1139
|
const Search = 42;
|
|
1140
|
+
const Li = 48;
|
|
1141
|
+
const Ul = 60;
|
|
1140
1142
|
const TextArea = 62;
|
|
1141
1143
|
const Reference = 100;
|
|
1142
1144
|
|
|
@@ -1375,14 +1377,6 @@ const appendStoredImageAttachmentForTest = async (state, sessionId, eventId, mim
|
|
|
1375
1377
|
return state;
|
|
1376
1378
|
};
|
|
1377
1379
|
|
|
1378
|
-
const decodeBase64 = value => {
|
|
1379
|
-
const decoded = atob(value);
|
|
1380
|
-
const bytes = new Uint8Array(decoded.length);
|
|
1381
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
1382
|
-
bytes[i] = decoded.codePointAt(i) || 0;
|
|
1383
|
-
}
|
|
1384
|
-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
1385
|
-
};
|
|
1386
1380
|
const createCanvasBlob = async mimeType => {
|
|
1387
1381
|
const canvas = new OffscreenCanvas(2, 2);
|
|
1388
1382
|
const context = canvas.getContext('2d');
|
|
@@ -1395,6 +1389,16 @@ const createCanvasBlob = async mimeType => {
|
|
|
1395
1389
|
type: mimeType
|
|
1396
1390
|
});
|
|
1397
1391
|
};
|
|
1392
|
+
|
|
1393
|
+
const decodeBase64 = value => {
|
|
1394
|
+
const decoded = atob(value);
|
|
1395
|
+
const bytes = new Uint8Array(decoded.length);
|
|
1396
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
1397
|
+
bytes[i] = decoded.codePointAt(i) || 0;
|
|
1398
|
+
}
|
|
1399
|
+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1398
1402
|
const createBlob = async (mimeType, contentKind, content) => {
|
|
1399
1403
|
if (contentKind === 'canvas') {
|
|
1400
1404
|
return createCanvasBlob(mimeType);
|
|
@@ -1408,6 +1412,7 @@ const createBlob = async (mimeType, contentKind, content) => {
|
|
|
1408
1412
|
type: mimeType
|
|
1409
1413
|
});
|
|
1410
1414
|
};
|
|
1415
|
+
|
|
1411
1416
|
const appendStoredRemovedImageAttachmentForTest = async (state, sessionId, eventId, mimeType, name, contentKind, content, timestamp) => {
|
|
1412
1417
|
const blob = await createBlob(mimeType, contentKind, content);
|
|
1413
1418
|
await appendEvent({
|
|
@@ -1480,7 +1485,6 @@ const InvalidUriEncoding = 'Invalid URI encoding';
|
|
|
1480
1485
|
const InvalidUriFormat = 'Invalid URI format';
|
|
1481
1486
|
const Method$1 = 'Method';
|
|
1482
1487
|
const MissingUri = 'Missing URI';
|
|
1483
|
-
const Name = 'Name';
|
|
1484
1488
|
const Network = 'Network';
|
|
1485
1489
|
const NoChatSessionFound = 'No chat session found for sessionId "{PH1}".';
|
|
1486
1490
|
const NoEventsFound = 'No events have been found';
|
|
@@ -1499,6 +1503,7 @@ const RequestUrl = 'Request URL';
|
|
|
1499
1503
|
const Response = 'Response';
|
|
1500
1504
|
const ResponseHeaders = 'Response Headers';
|
|
1501
1505
|
const SecondsRange = '{PH1}s-{PH2}s';
|
|
1506
|
+
const Size$1 = 'Size';
|
|
1502
1507
|
const Started = 'Started';
|
|
1503
1508
|
const Status$2 = 'Status';
|
|
1504
1509
|
const StatusCode = 'Status Code';
|
|
@@ -1513,7 +1518,6 @@ const Type$1 = 'Type';
|
|
|
1513
1518
|
const Ui = 'UI';
|
|
1514
1519
|
const UnableToLoadDebugSessionInvalidUri = 'Unable to load debug session: invalid URI "{PH1}". Expected format: chat-debug://<sessionId>.';
|
|
1515
1520
|
const UnableToLoadDebugSessionMissingUri = 'Unable to load debug session: missing URI. Expected format: chat-debug://<sessionId>.';
|
|
1516
|
-
const Value = 'Value';
|
|
1517
1521
|
const WindowSummary = 'Window {PH1}-{PH2} of {PH3}';
|
|
1518
1522
|
|
|
1519
1523
|
const copy = () => {
|
|
@@ -1589,9 +1593,6 @@ const missingUri = () => {
|
|
|
1589
1593
|
const method = () => {
|
|
1590
1594
|
return i18nString(Method$1);
|
|
1591
1595
|
};
|
|
1592
|
-
const name = () => {
|
|
1593
|
-
return i18nString(Name);
|
|
1594
|
-
};
|
|
1595
1596
|
const network = () => {
|
|
1596
1597
|
return i18nString(Network);
|
|
1597
1598
|
};
|
|
@@ -1644,6 +1645,9 @@ const resetColumns = () => {
|
|
|
1644
1645
|
const response = () => {
|
|
1645
1646
|
return i18nString(Response);
|
|
1646
1647
|
};
|
|
1648
|
+
const size = () => {
|
|
1649
|
+
return i18nString(Size$1);
|
|
1650
|
+
};
|
|
1647
1651
|
const secondsRange = (start, end) => {
|
|
1648
1652
|
return i18nString(SecondsRange, {
|
|
1649
1653
|
PH1: start,
|
|
@@ -1682,9 +1686,6 @@ const tools = () => {
|
|
|
1682
1686
|
const type = () => {
|
|
1683
1687
|
return i18nString(Type$1);
|
|
1684
1688
|
};
|
|
1685
|
-
const value = () => {
|
|
1686
|
-
return i18nString(Value);
|
|
1687
|
-
};
|
|
1688
1689
|
const ui = () => {
|
|
1689
1690
|
return i18nString(Ui);
|
|
1690
1691
|
};
|
|
@@ -1848,7 +1849,8 @@ const Type = 'type';
|
|
|
1848
1849
|
const Method = 'method';
|
|
1849
1850
|
const Duration = 'duration';
|
|
1850
1851
|
const Status$1 = 'status';
|
|
1851
|
-
const
|
|
1852
|
+
const Size = 'size';
|
|
1853
|
+
const tableColumnNames = [Type, Method, Status$1, Size, Duration];
|
|
1852
1854
|
const createTableColumns = () => {
|
|
1853
1855
|
return [{
|
|
1854
1856
|
isVisible: true,
|
|
@@ -1862,6 +1864,10 @@ const createTableColumns = () => {
|
|
|
1862
1864
|
isVisible: true,
|
|
1863
1865
|
label: status(),
|
|
1864
1866
|
name: Status$1
|
|
1867
|
+
}, {
|
|
1868
|
+
isVisible: true,
|
|
1869
|
+
label: size(),
|
|
1870
|
+
name: Size
|
|
1865
1871
|
}, {
|
|
1866
1872
|
isVisible: true,
|
|
1867
1873
|
label: duration(),
|
|
@@ -1899,6 +1905,8 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1899
1905
|
return duration();
|
|
1900
1906
|
case Method:
|
|
1901
1907
|
return method();
|
|
1908
|
+
case Size:
|
|
1909
|
+
return size();
|
|
1902
1910
|
case Status$1:
|
|
1903
1911
|
return status();
|
|
1904
1912
|
case Type:
|
|
@@ -1911,6 +1919,7 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1911
1919
|
const defaultTableColumnWidths = {
|
|
1912
1920
|
duration: 110,
|
|
1913
1921
|
method: 90,
|
|
1922
|
+
size: 100,
|
|
1914
1923
|
status: 110,
|
|
1915
1924
|
type: 260
|
|
1916
1925
|
};
|
|
@@ -1937,6 +1946,7 @@ const getTableWidthFromClientX = (state, clientX) => {
|
|
|
1937
1946
|
const minimumTableColumnWidths = {
|
|
1938
1947
|
[Duration]: 80,
|
|
1939
1948
|
[Method]: 56,
|
|
1949
|
+
[Size]: 80,
|
|
1940
1950
|
[Status$1]: 56,
|
|
1941
1951
|
[Type]: 80
|
|
1942
1952
|
};
|
|
@@ -2005,7 +2015,7 @@ const getResizedTableColumnWidths = (state, visibleTableColumns, tableColumnWidt
|
|
|
2005
2015
|
};
|
|
2006
2016
|
|
|
2007
2017
|
const isSameTableColumnWidths = (first, second) => {
|
|
2008
|
-
return first.type === second.type && first.method === second.method && first.duration === second.duration && first.status === second.status;
|
|
2018
|
+
return first.type === second.type && first.method === second.method && first.duration === second.duration && first.size === second.size && first.status === second.status;
|
|
2009
2019
|
};
|
|
2010
2020
|
|
|
2011
2021
|
const isFiniteNumber = value => {
|
|
@@ -2017,13 +2027,20 @@ const isTableColumnWidths = value => {
|
|
|
2017
2027
|
return false;
|
|
2018
2028
|
}
|
|
2019
2029
|
const record = value;
|
|
2020
|
-
return isFiniteNumber(record.type) && isFiniteNumber(record.method) && isFiniteNumber(record.duration) && isFiniteNumber(record.status);
|
|
2030
|
+
return isFiniteNumber(record.type) && isFiniteNumber(record.method) && isFiniteNumber(record.duration) && isFiniteNumber(record.size) && isFiniteNumber(record.status);
|
|
2021
2031
|
};
|
|
2022
2032
|
|
|
2023
2033
|
const validEventCategoryFilters = new Set([All$1, Network$1, Stream$1, Tools$1, Ui$1]);
|
|
2024
2034
|
const isSavedState = value => {
|
|
2025
2035
|
return typeof value === 'object' && value !== null;
|
|
2026
2036
|
};
|
|
2037
|
+
const isLegacyTableColumnWidths = value => {
|
|
2038
|
+
if (typeof value !== 'object' || value === null) {
|
|
2039
|
+
return false;
|
|
2040
|
+
}
|
|
2041
|
+
const record = value;
|
|
2042
|
+
return typeof record.duration === 'number' && Number.isFinite(record.duration) && typeof record.method === 'number' && Number.isFinite(record.method) && typeof record.status === 'number' && Number.isFinite(record.status) && typeof record.type === 'number' && Number.isFinite(record.type) && !('size' in record);
|
|
2043
|
+
};
|
|
2027
2044
|
const restoreCategoryFilters = (savedState, currentCategoryFilters) => {
|
|
2028
2045
|
if (Array.isArray(savedState.eventCategoryFilters)) {
|
|
2029
2046
|
return selectCategoryFilters(currentCategoryFilters, savedState.eventCategoryFilters.filter(value => typeof value === 'string'));
|
|
@@ -2056,10 +2073,31 @@ const restoreVisibleTableColumns = (savedState, currentTableColumns) => {
|
|
|
2056
2073
|
return currentTableColumns;
|
|
2057
2074
|
}
|
|
2058
2075
|
const visibleTableColumns = savedState.visibleTableColumns.filter(value => typeof value === 'string');
|
|
2076
|
+
if (isLegacyTableColumnWidths(savedState.tableColumnWidths)) {
|
|
2077
|
+
const savedVisibleColumns = new Set(visibleTableColumns);
|
|
2078
|
+
const visibleColumnsWithDefaults = currentTableColumns.filter(column => savedVisibleColumns.has(column.name) || column.name === 'size').map(column => column.name);
|
|
2079
|
+
return getTableColumnsWithVisibility(currentTableColumns, visibleColumnsWithDefaults);
|
|
2080
|
+
}
|
|
2059
2081
|
return getTableColumnsWithVisibility(currentTableColumns, visibleTableColumns);
|
|
2060
2082
|
};
|
|
2061
2083
|
const restoreTableColumnWidths = (savedState, currentTableColumnWidths) => {
|
|
2062
|
-
|
|
2084
|
+
const {
|
|
2085
|
+
tableColumnWidths: savedTableColumnWidths
|
|
2086
|
+
} = savedState;
|
|
2087
|
+
if (isTableColumnWidths(savedTableColumnWidths)) {
|
|
2088
|
+
return savedTableColumnWidths;
|
|
2089
|
+
}
|
|
2090
|
+
if (isLegacyTableColumnWidths(savedTableColumnWidths)) {
|
|
2091
|
+
const legacyTableColumnWidths = savedTableColumnWidths;
|
|
2092
|
+
return {
|
|
2093
|
+
duration: legacyTableColumnWidths.duration,
|
|
2094
|
+
method: legacyTableColumnWidths.method,
|
|
2095
|
+
size: currentTableColumnWidths.size,
|
|
2096
|
+
status: legacyTableColumnWidths.status,
|
|
2097
|
+
type: legacyTableColumnWidths.type
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
return currentTableColumnWidths;
|
|
2063
2101
|
};
|
|
2064
2102
|
const restoreSavedState = (state, savedState) => {
|
|
2065
2103
|
if (!isSavedState(savedState)) {
|
|
@@ -2111,21 +2149,37 @@ const hasTimingDetails = event => {
|
|
|
2111
2149
|
return hasDuration || hasStart && hasEnd;
|
|
2112
2150
|
};
|
|
2113
2151
|
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2116
|
-
if (
|
|
2117
|
-
|
|
2118
|
-
return event.endValue.value;
|
|
2152
|
+
const getEndValueResponseData = event => {
|
|
2153
|
+
const endValue = event.endValue;
|
|
2154
|
+
if (!endValue || endValue.value === undefined) {
|
|
2155
|
+
return undefined;
|
|
2119
2156
|
}
|
|
2157
|
+
return endValue.value;
|
|
2158
|
+
};
|
|
2159
|
+
const getMergedResponseData = event => {
|
|
2120
2160
|
const {
|
|
2121
2161
|
responseEvent
|
|
2122
2162
|
} = event;
|
|
2123
|
-
if (responseEvent
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2163
|
+
if (!responseEvent || typeof responseEvent !== 'object' || typeof responseEvent.type !== 'string') {
|
|
2164
|
+
return undefined;
|
|
2165
|
+
}
|
|
2166
|
+
const mergedResponseEvent = responseEvent;
|
|
2167
|
+
if (mergedResponseEvent.value !== undefined) {
|
|
2168
|
+
return mergedResponseEvent.value;
|
|
2169
|
+
}
|
|
2170
|
+
return responseEvent;
|
|
2171
|
+
};
|
|
2172
|
+
const getResponseData = event => {
|
|
2173
|
+
const endValueResponseData = getEndValueResponseData(event);
|
|
2174
|
+
if (endValueResponseData !== undefined) {
|
|
2175
|
+
return endValueResponseData;
|
|
2176
|
+
}
|
|
2177
|
+
return getMergedResponseData(event);
|
|
2178
|
+
};
|
|
2179
|
+
const getResponseEvent = event => {
|
|
2180
|
+
const responseData = getResponseData(event);
|
|
2181
|
+
if (responseData !== undefined) {
|
|
2182
|
+
return responseData;
|
|
2129
2183
|
}
|
|
2130
2184
|
return event;
|
|
2131
2185
|
};
|
|
@@ -2470,7 +2524,6 @@ const create = (uid, uri, x, y, width, height, platform, assetDir, sessionId = '
|
|
|
2470
2524
|
platform,
|
|
2471
2525
|
sessionId,
|
|
2472
2526
|
sessionIdIndexName,
|
|
2473
|
-
tableColumns: [],
|
|
2474
2527
|
uid,
|
|
2475
2528
|
uri,
|
|
2476
2529
|
width,
|
|
@@ -2864,10 +2917,19 @@ const getStatusText = event => {
|
|
|
2864
2917
|
return hasErrorStatus(event) ? '400' : '200';
|
|
2865
2918
|
};
|
|
2866
2919
|
|
|
2920
|
+
const getSizeSortValue = event => {
|
|
2921
|
+
const rawSize = event.size;
|
|
2922
|
+
if (typeof rawSize !== 'number' || !Number.isFinite(rawSize)) {
|
|
2923
|
+
return '0000000000000000';
|
|
2924
|
+
}
|
|
2925
|
+
return String(Math.max(0, Math.trunc(rawSize))).padStart(16, '0');
|
|
2926
|
+
};
|
|
2867
2927
|
const getEventTableColumnValue = (event, column) => {
|
|
2868
2928
|
switch (column) {
|
|
2869
2929
|
case Duration:
|
|
2870
2930
|
return getEventTableDurationText(event);
|
|
2931
|
+
case Size:
|
|
2932
|
+
return getSizeSortValue(event);
|
|
2871
2933
|
case Status$1:
|
|
2872
2934
|
return getStatusText(event);
|
|
2873
2935
|
case Type:
|
|
@@ -3089,11 +3151,26 @@ const getAttachmentImagePreviewMimeType = event => {
|
|
|
3089
3151
|
return typeof event.mimeType === 'string' ? event.mimeType : undefined;
|
|
3090
3152
|
};
|
|
3091
3153
|
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3094
|
-
|
|
3154
|
+
const units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'];
|
|
3155
|
+
const formatBytes = size => {
|
|
3156
|
+
if (!Number.isFinite(size) || size <= 0) {
|
|
3157
|
+
return '0 B';
|
|
3158
|
+
}
|
|
3159
|
+
let value = size;
|
|
3160
|
+
let unitIndex = 0;
|
|
3161
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
3162
|
+
value /= 1024;
|
|
3163
|
+
unitIndex++;
|
|
3095
3164
|
}
|
|
3096
|
-
|
|
3165
|
+
if (unitIndex === 0) {
|
|
3166
|
+
return `${Math.trunc(value)} ${units[unitIndex]}`;
|
|
3167
|
+
}
|
|
3168
|
+
const formatted = value >= 10 ? value.toFixed(0) : value.toFixed(1);
|
|
3169
|
+
return `${formatted} ${units[unitIndex]}`;
|
|
3170
|
+
};
|
|
3171
|
+
|
|
3172
|
+
const formatImageSize = size => {
|
|
3173
|
+
return formatBytes(size);
|
|
3097
3174
|
};
|
|
3098
3175
|
|
|
3099
3176
|
const formatImageStats = (width, height, size) => {
|
|
@@ -3319,6 +3396,12 @@ const getMenuEntriesTableHeader = state => {
|
|
|
3319
3396
|
flags: getColumnVisibilityFlags(state.tableColumns, Status$1),
|
|
3320
3397
|
id: 'status',
|
|
3321
3398
|
label: status()
|
|
3399
|
+
}, {
|
|
3400
|
+
args: [Size],
|
|
3401
|
+
command: 'ChatDebug.toggleTableColumnVisibility',
|
|
3402
|
+
flags: getColumnVisibilityFlags(state.tableColumns, Size),
|
|
3403
|
+
id: 'size',
|
|
3404
|
+
label: size()
|
|
3322
3405
|
}, {
|
|
3323
3406
|
args: [Duration],
|
|
3324
3407
|
command: 'ChatDebug.toggleTableColumnVisibility',
|
|
@@ -3404,102 +3487,6 @@ const getMenuIds = () => {
|
|
|
3404
3487
|
return [MenuChatDebugTableHeader, MenuChatDebugTableBody, 556, 557];
|
|
3405
3488
|
};
|
|
3406
3489
|
|
|
3407
|
-
const getResponseMap = events => {
|
|
3408
|
-
const seen = Object.create(null);
|
|
3409
|
-
for (const event of events) {
|
|
3410
|
-
if (event.type === 'ai-response' && 'requestId' in event && typeof event.requestId === 'string') {
|
|
3411
|
-
seen[event.requestId] = event;
|
|
3412
|
-
}
|
|
3413
|
-
}
|
|
3414
|
-
return seen;
|
|
3415
|
-
};
|
|
3416
|
-
|
|
3417
|
-
const getMergedRequestResponseEvent = (item, response) => {
|
|
3418
|
-
const parsedStart = new Date(item.timestamp || '');
|
|
3419
|
-
const parsedEnd = new Date(response.timestamp || '');
|
|
3420
|
-
const durationMs = parsedEnd.getTime() - parsedStart.getTime();
|
|
3421
|
-
const started = getStartedTimestamp(item);
|
|
3422
|
-
const ended = getEndedTimestamp(response);
|
|
3423
|
-
const timestamp = item.timestamp ?? started;
|
|
3424
|
-
if (Number.isFinite(durationMs) && durationMs >= 0) {
|
|
3425
|
-
return {
|
|
3426
|
-
durationMs,
|
|
3427
|
-
...(ended === undefined ? {} : {
|
|
3428
|
-
ended
|
|
3429
|
-
}),
|
|
3430
|
-
eventEndId: response.eventId,
|
|
3431
|
-
eventId: item.eventId,
|
|
3432
|
-
method: 'POST',
|
|
3433
|
-
...(started === undefined ? {} : {
|
|
3434
|
-
started
|
|
3435
|
-
}),
|
|
3436
|
-
...(timestamp === undefined ? {} : {
|
|
3437
|
-
timestamp
|
|
3438
|
-
}),
|
|
3439
|
-
type: 'ai-request-response'
|
|
3440
|
-
};
|
|
3441
|
-
}
|
|
3442
|
-
return {
|
|
3443
|
-
...(ended === undefined ? {} : {
|
|
3444
|
-
ended
|
|
3445
|
-
}),
|
|
3446
|
-
eventEndId: response.eventId,
|
|
3447
|
-
eventId: item.eventId,
|
|
3448
|
-
method: 'POST',
|
|
3449
|
-
...(started === undefined ? {} : {
|
|
3450
|
-
started
|
|
3451
|
-
}),
|
|
3452
|
-
...(timestamp === undefined ? {} : {
|
|
3453
|
-
timestamp
|
|
3454
|
-
}),
|
|
3455
|
-
type: 'ai-request-response'
|
|
3456
|
-
};
|
|
3457
|
-
};
|
|
3458
|
-
const toPrettyEvents = rawEvents => {
|
|
3459
|
-
if (rawEvents.type === 'error') {
|
|
3460
|
-
return [];
|
|
3461
|
-
}
|
|
3462
|
-
const pretty = [];
|
|
3463
|
-
const map = getResponseMap(rawEvents.events);
|
|
3464
|
-
for (const item of rawEvents.events) {
|
|
3465
|
-
if (item.type === 'ai-request' && 'requestId' in item && typeof item.requestId === 'string') {
|
|
3466
|
-
const response = map[item.requestId];
|
|
3467
|
-
if (response) {
|
|
3468
|
-
pretty.push(getMergedRequestResponseEvent(item, response));
|
|
3469
|
-
} else {
|
|
3470
|
-
pretty.push(item);
|
|
3471
|
-
}
|
|
3472
|
-
} else if (item.type === 'ai-response' && 'requestId' in item && typeof item.requestId === 'string') ; else {
|
|
3473
|
-
pretty.push(item);
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
return pretty;
|
|
3477
|
-
};
|
|
3478
|
-
|
|
3479
|
-
const listChatViewEvents = async (sessionId, _databaseName, _dataBaseVersion, _eventStoreName, _sessionIdIndexName) => {
|
|
3480
|
-
try {
|
|
3481
|
-
const rawEvents = await listChatViewEvents$1(sessionId);
|
|
3482
|
-
if (rawEvents.type === 'error') {
|
|
3483
|
-
return rawEvents;
|
|
3484
|
-
}
|
|
3485
|
-
const prettyEvents = toPrettyEvents(rawEvents);
|
|
3486
|
-
return {
|
|
3487
|
-
events: prettyEvents,
|
|
3488
|
-
type: 'success'
|
|
3489
|
-
};
|
|
3490
|
-
} catch (error) {
|
|
3491
|
-
return {
|
|
3492
|
-
error,
|
|
3493
|
-
type: 'error'
|
|
3494
|
-
};
|
|
3495
|
-
}
|
|
3496
|
-
};
|
|
3497
|
-
|
|
3498
|
-
const loadEventsDependencies = {
|
|
3499
|
-
listChatViewEvents: listChatViewEvents,
|
|
3500
|
-
loadSelectedEvent: loadSelectedEvent
|
|
3501
|
-
};
|
|
3502
|
-
|
|
3503
3490
|
const ParseChatDebugUriErrorCode = {
|
|
3504
3491
|
InvalidSessionId: 1,
|
|
3505
3492
|
InvalidUriEncoding: 2,
|
|
@@ -3663,6 +3650,99 @@ const getSessionNotFoundMessage = sessionId => {
|
|
|
3663
3650
|
return noChatSessionFound(sessionId);
|
|
3664
3651
|
};
|
|
3665
3652
|
|
|
3653
|
+
const getResponseMap = events => {
|
|
3654
|
+
const seen = Object.create(null);
|
|
3655
|
+
for (const event of events) {
|
|
3656
|
+
if (event.type === 'ai-response' && 'requestId' in event && typeof event.requestId === 'string') {
|
|
3657
|
+
seen[event.requestId] = event;
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
return seen;
|
|
3661
|
+
};
|
|
3662
|
+
|
|
3663
|
+
const getMergedRequestResponseEvent = (item, response) => {
|
|
3664
|
+
const parsedStart = new Date(item.timestamp || '');
|
|
3665
|
+
const parsedEnd = new Date(response.timestamp || '');
|
|
3666
|
+
const durationMs = parsedEnd.getTime() - parsedStart.getTime();
|
|
3667
|
+
const started = getStartedTimestamp(item);
|
|
3668
|
+
const ended = getEndedTimestamp(response);
|
|
3669
|
+
const timestamp = item.timestamp ?? started;
|
|
3670
|
+
if (Number.isFinite(durationMs) && durationMs >= 0) {
|
|
3671
|
+
return {
|
|
3672
|
+
durationMs,
|
|
3673
|
+
...(ended === undefined ? {} : {
|
|
3674
|
+
ended
|
|
3675
|
+
}),
|
|
3676
|
+
eventEndId: response.eventId,
|
|
3677
|
+
eventId: item.eventId,
|
|
3678
|
+
method: 'POST',
|
|
3679
|
+
size: 0,
|
|
3680
|
+
...(started === undefined ? {} : {
|
|
3681
|
+
started
|
|
3682
|
+
}),
|
|
3683
|
+
...(timestamp === undefined ? {} : {
|
|
3684
|
+
timestamp
|
|
3685
|
+
}),
|
|
3686
|
+
type: 'ai-request-response'
|
|
3687
|
+
};
|
|
3688
|
+
}
|
|
3689
|
+
return {
|
|
3690
|
+
...(ended === undefined ? {} : {
|
|
3691
|
+
ended
|
|
3692
|
+
}),
|
|
3693
|
+
eventEndId: response.eventId,
|
|
3694
|
+
eventId: item.eventId,
|
|
3695
|
+
method: 'POST',
|
|
3696
|
+
size: 0,
|
|
3697
|
+
...(started === undefined ? {} : {
|
|
3698
|
+
started
|
|
3699
|
+
}),
|
|
3700
|
+
...(timestamp === undefined ? {} : {
|
|
3701
|
+
timestamp
|
|
3702
|
+
}),
|
|
3703
|
+
type: 'ai-request-response'
|
|
3704
|
+
};
|
|
3705
|
+
};
|
|
3706
|
+
const toPrettyEvents = rawEvents => {
|
|
3707
|
+
if (rawEvents.type === 'error') {
|
|
3708
|
+
return [];
|
|
3709
|
+
}
|
|
3710
|
+
const pretty = [];
|
|
3711
|
+
const map = getResponseMap(rawEvents.events);
|
|
3712
|
+
for (const item of rawEvents.events) {
|
|
3713
|
+
if (item.type === 'ai-request' && 'requestId' in item && typeof item.requestId === 'string') {
|
|
3714
|
+
const response = map[item.requestId];
|
|
3715
|
+
if (response) {
|
|
3716
|
+
pretty.push(getMergedRequestResponseEvent(item, response));
|
|
3717
|
+
} else {
|
|
3718
|
+
pretty.push(item);
|
|
3719
|
+
}
|
|
3720
|
+
} else if (item.type === 'ai-response' && 'requestId' in item && typeof item.requestId === 'string') ; else {
|
|
3721
|
+
pretty.push(item);
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3724
|
+
return pretty;
|
|
3725
|
+
};
|
|
3726
|
+
|
|
3727
|
+
const listChatViewEvents = async (sessionId, _databaseName, _dataBaseVersion, _eventStoreName, _sessionIdIndexName) => {
|
|
3728
|
+
try {
|
|
3729
|
+
const rawEvents = await listChatViewEvents$1(sessionId);
|
|
3730
|
+
if (rawEvents.type === 'error') {
|
|
3731
|
+
return rawEvents;
|
|
3732
|
+
}
|
|
3733
|
+
const prettyEvents = toPrettyEvents(rawEvents);
|
|
3734
|
+
return {
|
|
3735
|
+
events: prettyEvents,
|
|
3736
|
+
type: 'success'
|
|
3737
|
+
};
|
|
3738
|
+
} catch (error) {
|
|
3739
|
+
return {
|
|
3740
|
+
error,
|
|
3741
|
+
type: 'error'
|
|
3742
|
+
};
|
|
3743
|
+
}
|
|
3744
|
+
};
|
|
3745
|
+
|
|
3666
3746
|
const restoreSelectedEvent = async state => {
|
|
3667
3747
|
if (state.selectedEventId === null) {
|
|
3668
3748
|
return {
|
|
@@ -3705,7 +3785,7 @@ const restoreSelectedEvent = async state => {
|
|
|
3705
3785
|
selectedEventIndex: null
|
|
3706
3786
|
};
|
|
3707
3787
|
}
|
|
3708
|
-
const selectedEventDetails = await
|
|
3788
|
+
const selectedEventDetails = await loadSelectedEvent({
|
|
3709
3789
|
eventId: selectedEvent.eventId,
|
|
3710
3790
|
sessionId: state.sessionId,
|
|
3711
3791
|
type: selectedEvent.type
|
|
@@ -3725,13 +3805,7 @@ const restoreSelectedEvent = async state => {
|
|
|
3725
3805
|
};
|
|
3726
3806
|
|
|
3727
3807
|
const loadEventsForSessionId = async (state, sessionId) => {
|
|
3728
|
-
const
|
|
3729
|
-
databaseName,
|
|
3730
|
-
dataBaseVersion,
|
|
3731
|
-
eventStoreName,
|
|
3732
|
-
sessionIdIndexName
|
|
3733
|
-
} = state;
|
|
3734
|
-
const result = await loadEventsDependencies.listChatViewEvents(sessionId, databaseName, dataBaseVersion, eventStoreName, sessionIdIndexName);
|
|
3808
|
+
const result = await listChatViewEvents(sessionId);
|
|
3735
3809
|
if (result.type === 'error') {
|
|
3736
3810
|
return applyVirtualTableState(getStateWithTimelineInfo({
|
|
3737
3811
|
...state,
|
|
@@ -3770,14 +3844,6 @@ const loadEventsForSessionId = async (state, sessionId) => {
|
|
|
3770
3844
|
return withSelectedEventVisible(restoredState);
|
|
3771
3845
|
};
|
|
3772
3846
|
|
|
3773
|
-
const loadEventsFromUri = async state => {
|
|
3774
|
-
const sessionId = getSessionIdFromUri(state);
|
|
3775
|
-
if (!sessionId) {
|
|
3776
|
-
return getStateWithInvalidUri(state);
|
|
3777
|
-
}
|
|
3778
|
-
return loadEventsForSessionId(state, sessionId);
|
|
3779
|
-
};
|
|
3780
|
-
|
|
3781
3847
|
const refreshEvents = async state => {
|
|
3782
3848
|
const sessionId = state.sessionId || getSessionIdFromUri(state);
|
|
3783
3849
|
if (!sessionId) {
|
|
@@ -3790,11 +3856,8 @@ const refresh = async state => {
|
|
|
3790
3856
|
return refreshEvents(state);
|
|
3791
3857
|
};
|
|
3792
3858
|
|
|
3793
|
-
const handleClickRefreshDependencies = {
|
|
3794
|
-
refresh: refresh
|
|
3795
|
-
};
|
|
3796
3859
|
const handleClickRefresh = async state => {
|
|
3797
|
-
return
|
|
3860
|
+
return refresh(state);
|
|
3798
3861
|
};
|
|
3799
3862
|
|
|
3800
3863
|
const handleCloseDetails$1 = state => {
|
|
@@ -4166,28 +4229,43 @@ const shouldIncludeArguments = (event, name) => {
|
|
|
4166
4229
|
return true;
|
|
4167
4230
|
};
|
|
4168
4231
|
|
|
4169
|
-
const
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
const mergedRequestEvent = requestEvent;
|
|
4175
|
-
if (mergedRequestEvent.body !== undefined) {
|
|
4176
|
-
return mergedRequestEvent.body;
|
|
4177
|
-
}
|
|
4178
|
-
if (mergedRequestEvent.value !== undefined) {
|
|
4179
|
-
return mergedRequestEvent.value;
|
|
4180
|
-
}
|
|
4181
|
-
if (hasOwn(mergedRequestEvent, 'arguments')) {
|
|
4182
|
-
return mergedRequestEvent.arguments;
|
|
4183
|
-
}
|
|
4184
|
-
return requestEvent;
|
|
4232
|
+
const getMergedRequestPayloadEvent = requestEvent => {
|
|
4233
|
+
if (!requestEvent || typeof requestEvent !== 'object') {
|
|
4234
|
+
return {
|
|
4235
|
+
found: false
|
|
4236
|
+
};
|
|
4185
4237
|
}
|
|
4186
|
-
const
|
|
4187
|
-
if (
|
|
4188
|
-
return
|
|
4238
|
+
const mergedRequestEvent = requestEvent;
|
|
4239
|
+
if (typeof mergedRequestEvent.type !== 'string') {
|
|
4240
|
+
return {
|
|
4241
|
+
found: false
|
|
4242
|
+
};
|
|
4189
4243
|
}
|
|
4190
|
-
|
|
4244
|
+
if (mergedRequestEvent.body !== undefined) {
|
|
4245
|
+
return {
|
|
4246
|
+
found: true,
|
|
4247
|
+
value: mergedRequestEvent.body
|
|
4248
|
+
};
|
|
4249
|
+
}
|
|
4250
|
+
if (mergedRequestEvent.value !== undefined) {
|
|
4251
|
+
return {
|
|
4252
|
+
found: true,
|
|
4253
|
+
value: mergedRequestEvent.value
|
|
4254
|
+
};
|
|
4255
|
+
}
|
|
4256
|
+
if (hasOwn(mergedRequestEvent, 'arguments')) {
|
|
4257
|
+
return {
|
|
4258
|
+
found: true,
|
|
4259
|
+
value: mergedRequestEvent.arguments
|
|
4260
|
+
};
|
|
4261
|
+
}
|
|
4262
|
+
return {
|
|
4263
|
+
found: true,
|
|
4264
|
+
value: requestEvent
|
|
4265
|
+
};
|
|
4266
|
+
};
|
|
4267
|
+
const getPayloadObject = (event, name) => {
|
|
4268
|
+
return {
|
|
4191
4269
|
...(name === undefined ? {} : {
|
|
4192
4270
|
name
|
|
4193
4271
|
}),
|
|
@@ -4198,6 +4276,23 @@ const getPayloadEvent = event => {
|
|
|
4198
4276
|
result: event.result
|
|
4199
4277
|
} : {})
|
|
4200
4278
|
};
|
|
4279
|
+
};
|
|
4280
|
+
const getPayloadEvent = event => {
|
|
4281
|
+
if (event && event.type === 'ai-request') {
|
|
4282
|
+
return event.body;
|
|
4283
|
+
}
|
|
4284
|
+
const {
|
|
4285
|
+
requestEvent
|
|
4286
|
+
} = event;
|
|
4287
|
+
const mergedRequestPayloadEvent = getMergedRequestPayloadEvent(requestEvent);
|
|
4288
|
+
if (mergedRequestPayloadEvent.found) {
|
|
4289
|
+
return mergedRequestPayloadEvent.value;
|
|
4290
|
+
}
|
|
4291
|
+
const name = getPreviewName(event);
|
|
4292
|
+
if (name === 'list_files' && hasOwn(event, 'arguments')) {
|
|
4293
|
+
return event.arguments;
|
|
4294
|
+
}
|
|
4295
|
+
const payloadEvent = getPayloadObject(event, name);
|
|
4201
4296
|
if (Object.keys(payloadEvent).length > 0) {
|
|
4202
4297
|
return payloadEvent;
|
|
4203
4298
|
}
|
|
@@ -4684,6 +4779,8 @@ const handleTableHeaderClick = (state, value) => {
|
|
|
4684
4779
|
|
|
4685
4780
|
const getTableResizerId = name => {
|
|
4686
4781
|
switch (name) {
|
|
4782
|
+
case 'ResizerFour':
|
|
4783
|
+
return 4;
|
|
4687
4784
|
case 'ResizerOne':
|
|
4688
4785
|
return 1;
|
|
4689
4786
|
case 'ResizerThree':
|
|
@@ -4732,6 +4829,30 @@ const handleTableRowCopy = async (state, eventIndex) => {
|
|
|
4732
4829
|
return state;
|
|
4733
4830
|
};
|
|
4734
4831
|
|
|
4832
|
+
const toDataUri$1 = text => {
|
|
4833
|
+
return `data:application/json,${encodeURIComponent(text)}`;
|
|
4834
|
+
};
|
|
4835
|
+
const handleTableRowDoubleClick = async (state, eventX, eventY) => {
|
|
4836
|
+
const eventIndex = getTableBodyEventIndex(state, eventX, eventY);
|
|
4837
|
+
if (eventIndex === -1) {
|
|
4838
|
+
return state;
|
|
4839
|
+
}
|
|
4840
|
+
const event = getCurrentEvents$1(state)[eventIndex];
|
|
4841
|
+
if (!event) {
|
|
4842
|
+
return state;
|
|
4843
|
+
}
|
|
4844
|
+
const responseData = getResponseData(event);
|
|
4845
|
+
if (responseData === undefined) {
|
|
4846
|
+
return state;
|
|
4847
|
+
}
|
|
4848
|
+
const text = JSON.stringify(responseData, null, 2);
|
|
4849
|
+
if (!text) {
|
|
4850
|
+
return state;
|
|
4851
|
+
}
|
|
4852
|
+
await openUri(toDataUri$1(text));
|
|
4853
|
+
return state;
|
|
4854
|
+
};
|
|
4855
|
+
|
|
4735
4856
|
const toDataUri = text => {
|
|
4736
4857
|
return `data:application/json,${encodeURIComponent(text)}`;
|
|
4737
4858
|
};
|
|
@@ -5063,14 +5184,20 @@ const handleStorageWorkerUpdate = async uid => {
|
|
|
5063
5184
|
await invoke('Viewlet.executeViewletCommand', uid, 'ChatDebug.handleClickRefresh');
|
|
5064
5185
|
};
|
|
5065
5186
|
|
|
5066
|
-
const
|
|
5067
|
-
|
|
5187
|
+
const loadEventsFromUri = async state => {
|
|
5188
|
+
const sessionId = getSessionIdFromUri(state);
|
|
5189
|
+
if (!sessionId) {
|
|
5190
|
+
return getStateWithInvalidUri(state);
|
|
5191
|
+
}
|
|
5192
|
+
return loadEventsForSessionId(state, sessionId);
|
|
5193
|
+
};
|
|
5194
|
+
|
|
5068
5195
|
const loadContent = async (state, savedState) => {
|
|
5069
5196
|
await getPreference('chatDebug.autoRefresh');
|
|
5070
5197
|
const nextState = await loadEventsFromUri(restoreSavedState(state, savedState));
|
|
5071
5198
|
if (nextState.sessionId) {
|
|
5072
5199
|
try {
|
|
5073
|
-
await
|
|
5200
|
+
await registerUpdateListener(nextState.sessionId, rpcId, nextState.uid);
|
|
5074
5201
|
} catch {
|
|
5075
5202
|
// ignore
|
|
5076
5203
|
}
|
|
@@ -5078,8 +5205,7 @@ const loadContent = async (state, savedState) => {
|
|
|
5078
5205
|
return applyVirtualTableState({
|
|
5079
5206
|
...nextState,
|
|
5080
5207
|
categoryFilters: createCategoryFilters(getSelectedEventCategoryFilters(nextState.categoryFilters)),
|
|
5081
|
-
detailTabs: createDetailTabs(getSelectedDetailTab(nextState.detailTabs), nextState.selectedEvent)
|
|
5082
|
-
tableColumns: createTableColumns()
|
|
5208
|
+
detailTabs: createDetailTabs(getSelectedDetailTab(nextState.detailTabs), nextState.selectedEvent)
|
|
5083
5209
|
});
|
|
5084
5210
|
};
|
|
5085
5211
|
|
|
@@ -5174,10 +5300,11 @@ const getCss = state => {
|
|
|
5174
5300
|
topSize = 30;
|
|
5175
5301
|
}
|
|
5176
5302
|
const tableColumnLayout = getTableColumnLayout(tableContentWidth, getVisibleTableColumns(state.tableColumns), state.tableColumnWidths);
|
|
5177
|
-
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0, tableColThreeWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
5303
|
+
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0, tableColThreeWidth = 0, tableColFourWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
5178
5304
|
const resizerOneLeft = tableColumnLayout.resizerLefts[0] ?? 0;
|
|
5179
5305
|
const resizerTwoLeft = tableColumnLayout.resizerLefts[1] ?? 0;
|
|
5180
5306
|
const resizerThreeLeft = tableColumnLayout.resizerLefts[2] ?? 0;
|
|
5307
|
+
const resizerFourLeft = tableColumnLayout.resizerLefts[3] ?? 0;
|
|
5181
5308
|
const {
|
|
5182
5309
|
selectionEndPercent,
|
|
5183
5310
|
selectionStartPercent
|
|
@@ -5190,6 +5317,7 @@ const getCss = state => {
|
|
|
5190
5317
|
--ChatDebugViewTableColOneWidth: ${tableColOneWidth}px;
|
|
5191
5318
|
--ChatDebugViewTableColTwoWidth: ${tableColTwoWidth}px;
|
|
5192
5319
|
--ChatDebugViewTableColThreeWidth: ${tableColThreeWidth}px;
|
|
5320
|
+
--ChatDebugViewTableColFourWidth: ${tableColFourWidth}px;
|
|
5193
5321
|
--ChatDebugViewDetailsLineNumberWidth: ${detailsLineNumberWidth}px;
|
|
5194
5322
|
--ChatDebugViewPreviewScrollBarHeight: ${previewVirtualization.scrollBarHeight}px;
|
|
5195
5323
|
--ChatDebugViewPreviewScrollBarOffset: ${previewVirtualization.scrollBarOffset}px;
|
|
@@ -5204,6 +5332,7 @@ const getCss = state => {
|
|
|
5204
5332
|
--ResizerOneLeft: ${resizerOneLeft}px;
|
|
5205
5333
|
--ResizerTwoLeft: ${resizerTwoLeft}px;
|
|
5206
5334
|
--ResizerThreeLeft: ${resizerThreeLeft}px;
|
|
5335
|
+
--ResizerFourLeft: ${resizerFourLeft}px;
|
|
5207
5336
|
--ChatDebugViewSashWidth: ${state.sashWidth}px;
|
|
5208
5337
|
--ChatDebugViewTableWidth: ${tableWidth}px;
|
|
5209
5338
|
--ChatDebugViewTimelineHeight: ${state.timelineHeight}px;
|
|
@@ -5226,6 +5355,26 @@ const getCss = state => {
|
|
|
5226
5355
|
width: calc(100% - var(--ChatDebugViewTableScrollBarWidth));
|
|
5227
5356
|
}
|
|
5228
5357
|
|
|
5358
|
+
.TableColZero {
|
|
5359
|
+
width: var(--ChatDebugViewTableColZeroWidth);
|
|
5360
|
+
}
|
|
5361
|
+
|
|
5362
|
+
.TableColOne {
|
|
5363
|
+
width: var(--ChatDebugViewTableColOneWidth);
|
|
5364
|
+
}
|
|
5365
|
+
|
|
5366
|
+
.TableColTwo {
|
|
5367
|
+
width: var(--ChatDebugViewTableColTwoWidth);
|
|
5368
|
+
}
|
|
5369
|
+
|
|
5370
|
+
.TableColThree {
|
|
5371
|
+
width: var(--ChatDebugViewTableColThreeWidth);
|
|
5372
|
+
}
|
|
5373
|
+
|
|
5374
|
+
.TableColFour {
|
|
5375
|
+
width: var(--ChatDebugViewTableColFourWidth);
|
|
5376
|
+
}
|
|
5377
|
+
|
|
5229
5378
|
.Resizers {
|
|
5230
5379
|
bottom: 0;
|
|
5231
5380
|
left: 0;
|
|
@@ -5261,6 +5410,10 @@ const getCss = state => {
|
|
|
5261
5410
|
left: var(--ResizerThreeLeft);
|
|
5262
5411
|
}
|
|
5263
5412
|
|
|
5413
|
+
.ResizerFour {
|
|
5414
|
+
left: var(--ResizerFourLeft);
|
|
5415
|
+
}
|
|
5416
|
+
|
|
5264
5417
|
.ResizerInner {
|
|
5265
5418
|
background: var(--vscode-panel-border, rgba(255, 255, 255, 0.12));
|
|
5266
5419
|
bottom: 0;
|
|
@@ -5291,8 +5444,9 @@ const getCss = state => {
|
|
|
5291
5444
|
}
|
|
5292
5445
|
|
|
5293
5446
|
.ChatDebugViewHeadersTable {
|
|
5294
|
-
|
|
5295
|
-
|
|
5447
|
+
list-style: none;
|
|
5448
|
+
margin: 0;
|
|
5449
|
+
padding: 0;
|
|
5296
5450
|
width: 100%;
|
|
5297
5451
|
}
|
|
5298
5452
|
|
|
@@ -5314,22 +5468,20 @@ const getCss = state => {
|
|
|
5314
5468
|
text-transform: uppercase;
|
|
5315
5469
|
}
|
|
5316
5470
|
|
|
5471
|
+
.ChatDebugViewHeadersRow {
|
|
5472
|
+
display: grid;
|
|
5473
|
+
grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5317
5476
|
.ChatDebugViewHeadersCell {
|
|
5318
5477
|
border-bottom: 1px solid var(--vscode-panel-border, rgba(255, 255, 255, 0.12));
|
|
5478
|
+
min-width: 0;
|
|
5319
5479
|
color: var(--vscode-editor-foreground);
|
|
5320
5480
|
padding: 6px 10px;
|
|
5321
5481
|
text-align: left;
|
|
5322
|
-
vertical-align: top;
|
|
5323
5482
|
word-break: break-word;
|
|
5324
5483
|
}
|
|
5325
5484
|
|
|
5326
|
-
.ChatDebugViewHeadersHead .ChatDebugViewHeadersCell {
|
|
5327
|
-
color: var(--vscode-descriptionForeground, rgba(255, 255, 255, 0.7));
|
|
5328
|
-
font-size: 11px;
|
|
5329
|
-
font-weight: 600;
|
|
5330
|
-
text-transform: uppercase;
|
|
5331
|
-
}
|
|
5332
|
-
|
|
5333
5485
|
.ChatDebugViewHeadersRowOdd {
|
|
5334
5486
|
background: rgba(255, 255, 255, 0.02);
|
|
5335
5487
|
}
|
|
@@ -5340,7 +5492,6 @@ const getCss = state => {
|
|
|
5340
5492
|
|
|
5341
5493
|
.ChatDebugViewHeadersCellName {
|
|
5342
5494
|
font-weight: 500;
|
|
5343
|
-
width: 38%;
|
|
5344
5495
|
}
|
|
5345
5496
|
.PreviewVirtualizedEditor {
|
|
5346
5497
|
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
@@ -5741,11 +5892,9 @@ const PanelTab = 'PanelTab';
|
|
|
5741
5892
|
const PanelTabSelected = 'PanelTabSelected';
|
|
5742
5893
|
const ChatDebugViewDetailsTabs = 'ChatDebugViewDetailsTabs';
|
|
5743
5894
|
const ChatDebugViewDetailsTop = 'ChatDebugViewDetailsTop';
|
|
5744
|
-
const ChatDebugViewHeadersBody = 'ChatDebugViewHeadersBody';
|
|
5745
5895
|
const ChatDebugViewHeadersCell = 'ChatDebugViewHeadersCell';
|
|
5746
5896
|
const ChatDebugViewHeadersCellName = 'ChatDebugViewHeadersCellName';
|
|
5747
5897
|
const ChatDebugViewHeadersCellValue = 'ChatDebugViewHeadersCellValue';
|
|
5748
|
-
const ChatDebugViewHeadersHead = 'ChatDebugViewHeadersHead';
|
|
5749
5898
|
const ChatDebugViewHeadersRow = 'ChatDebugViewHeadersRow';
|
|
5750
5899
|
const ChatDebugViewHeadersRowEven = 'ChatDebugViewHeadersRowEven';
|
|
5751
5900
|
const ChatDebugViewHeadersRowOdd = 'ChatDebugViewHeadersRowOdd';
|
|
@@ -5796,6 +5945,7 @@ const ResizerInner = 'ResizerInner';
|
|
|
5796
5945
|
const ResizerOne = 'ResizerOne';
|
|
5797
5946
|
const ResizerTwo = 'ResizerTwo';
|
|
5798
5947
|
const ResizerThree = 'ResizerThree';
|
|
5948
|
+
const ResizerFour = 'ResizerFour';
|
|
5799
5949
|
const TableHead = 'TableHead';
|
|
5800
5950
|
const Resizers = 'Resizers';
|
|
5801
5951
|
const TableCol = 'TableCol';
|
|
@@ -5839,6 +5989,7 @@ const ChatDebugViewTop = 'ChatDebugViewTop';
|
|
|
5839
5989
|
const ChatDebugViewTopDevtools = 'ChatDebugViewTop--devtools';
|
|
5840
5990
|
const TableCell = 'TableCell';
|
|
5841
5991
|
const ChatDebugViewCellDuration = 'ChatDebugViewCellDuration';
|
|
5992
|
+
const ChatDebugViewCellSize = 'ChatDebugViewCellSize';
|
|
5842
5993
|
const ChatDebugViewCellStatusError = 'ChatDebugViewCellStatusError';
|
|
5843
5994
|
const InputBox = 'InputBox';
|
|
5844
5995
|
const TokenBoolean = 'Token TokenBoolean';
|
|
@@ -5890,6 +6041,7 @@ const HandlePreviewTextScrollBarPointerDown = 37;
|
|
|
5890
6041
|
const HandlePreviewTextScrollBarPointerMove = 38;
|
|
5891
6042
|
const HandlePreviewTextScrollBarPointerUp = 39;
|
|
5892
6043
|
const HandleRootContextMenu = 40;
|
|
6044
|
+
const HandleTableRowDoubleClick = 41;
|
|
5893
6045
|
|
|
5894
6046
|
const debugErrorRootNode = {
|
|
5895
6047
|
childCount: 1,
|
|
@@ -6091,6 +6243,96 @@ const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
|
6091
6243
|
return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
|
|
6092
6244
|
};
|
|
6093
6245
|
|
|
6246
|
+
const httpStatusLabels = {
|
|
6247
|
+
100: 'Continue',
|
|
6248
|
+
101: 'Switching Protocols',
|
|
6249
|
+
102: 'Processing',
|
|
6250
|
+
103: 'Early Hints',
|
|
6251
|
+
200: 'OK',
|
|
6252
|
+
201: 'Created',
|
|
6253
|
+
202: 'Accepted',
|
|
6254
|
+
203: 'Non-Authoritative Information',
|
|
6255
|
+
204: 'No Content',
|
|
6256
|
+
205: 'Reset Content',
|
|
6257
|
+
206: 'Partial Content',
|
|
6258
|
+
207: 'Multi-Status',
|
|
6259
|
+
208: 'Already Reported',
|
|
6260
|
+
226: 'IM Used',
|
|
6261
|
+
300: 'Multiple Choices',
|
|
6262
|
+
301: 'Moved Permanently',
|
|
6263
|
+
302: 'Found',
|
|
6264
|
+
303: 'See Other',
|
|
6265
|
+
304: 'Not Modified',
|
|
6266
|
+
305: 'Use Proxy',
|
|
6267
|
+
307: 'Temporary Redirect',
|
|
6268
|
+
308: 'Permanent Redirect',
|
|
6269
|
+
400: 'Bad Request',
|
|
6270
|
+
401: 'Unauthorized',
|
|
6271
|
+
402: 'Payment Required',
|
|
6272
|
+
403: 'Forbidden',
|
|
6273
|
+
404: 'Not Found',
|
|
6274
|
+
405: 'Method Not Allowed',
|
|
6275
|
+
406: 'Not Acceptable',
|
|
6276
|
+
407: 'Proxy Authentication Required',
|
|
6277
|
+
408: 'Request Timeout',
|
|
6278
|
+
409: 'Conflict',
|
|
6279
|
+
410: 'Gone',
|
|
6280
|
+
411: 'Length Required',
|
|
6281
|
+
412: 'Precondition Failed',
|
|
6282
|
+
413: 'Content Too Large',
|
|
6283
|
+
414: 'URI Too Long',
|
|
6284
|
+
415: 'Unsupported Media Type',
|
|
6285
|
+
416: 'Range Not Satisfiable',
|
|
6286
|
+
417: 'Expectation Failed',
|
|
6287
|
+
418: "I'm a Teapot",
|
|
6288
|
+
421: 'Misdirected Request',
|
|
6289
|
+
422: 'Unprocessable Content',
|
|
6290
|
+
423: 'Locked',
|
|
6291
|
+
424: 'Failed Dependency',
|
|
6292
|
+
425: 'Too Early',
|
|
6293
|
+
426: 'Upgrade Required',
|
|
6294
|
+
428: 'Precondition Required',
|
|
6295
|
+
429: 'Too Many Requests',
|
|
6296
|
+
431: 'Request Header Fields Too Large',
|
|
6297
|
+
451: 'Unavailable For Legal Reasons',
|
|
6298
|
+
500: 'Internal Server Error',
|
|
6299
|
+
501: 'Not Implemented',
|
|
6300
|
+
502: 'Bad Gateway',
|
|
6301
|
+
503: 'Service Unavailable',
|
|
6302
|
+
504: 'Gateway Timeout',
|
|
6303
|
+
505: 'HTTP Version Not Supported',
|
|
6304
|
+
506: 'Variant Also Negotiates',
|
|
6305
|
+
507: 'Insufficient Storage',
|
|
6306
|
+
508: 'Loop Detected',
|
|
6307
|
+
510: 'Not Extended',
|
|
6308
|
+
511: 'Network Authentication Required'
|
|
6309
|
+
};
|
|
6310
|
+
const threeDigitStatusCodeRegex = /^\d{3}$/;
|
|
6311
|
+
const parseStatusCode = value => {
|
|
6312
|
+
if (typeof value === 'number' && Number.isInteger(value)) {
|
|
6313
|
+
return value;
|
|
6314
|
+
}
|
|
6315
|
+
if (typeof value !== 'string') {
|
|
6316
|
+
return undefined;
|
|
6317
|
+
}
|
|
6318
|
+
const trimmedValue = value.trim();
|
|
6319
|
+
if (!threeDigitStatusCodeRegex.test(trimmedValue)) {
|
|
6320
|
+
return undefined;
|
|
6321
|
+
}
|
|
6322
|
+
return Number(trimmedValue);
|
|
6323
|
+
};
|
|
6324
|
+
const formatHttpStatusCode = value => {
|
|
6325
|
+
const numericStatusCode = parseStatusCode(value);
|
|
6326
|
+
if (numericStatusCode === undefined) {
|
|
6327
|
+
return String(value);
|
|
6328
|
+
}
|
|
6329
|
+
const label = httpStatusLabels[numericStatusCode];
|
|
6330
|
+
if (!label) {
|
|
6331
|
+
return String(numericStatusCode);
|
|
6332
|
+
}
|
|
6333
|
+
return `${numericStatusCode} ${label}`;
|
|
6334
|
+
};
|
|
6335
|
+
|
|
6094
6336
|
const isHeadersRecord = value => {
|
|
6095
6337
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6096
6338
|
};
|
|
@@ -6165,7 +6407,7 @@ const getGeneralEntries = selectedEvent => {
|
|
|
6165
6407
|
}
|
|
6166
6408
|
const statusCode$1 = getStatusCodeValue(selectedEvent);
|
|
6167
6409
|
if (statusCode$1 !== undefined && statusCode$1 !== '') {
|
|
6168
|
-
entries.push([statusCode(), statusCode$1]);
|
|
6410
|
+
entries.push([statusCode(), formatHttpStatusCode(statusCode$1)]);
|
|
6169
6411
|
}
|
|
6170
6412
|
return entries;
|
|
6171
6413
|
};
|
|
@@ -6173,15 +6415,15 @@ const getHeaderRowNodes = (headerName, headerValue, index) => {
|
|
|
6173
6415
|
return [{
|
|
6174
6416
|
childCount: 2,
|
|
6175
6417
|
className: mergeClassNames(ChatDebugViewHeadersRow, index % 2 === 0 ? ChatDebugViewHeadersRowOdd : ChatDebugViewHeadersRowEven),
|
|
6176
|
-
type:
|
|
6418
|
+
type: Li
|
|
6177
6419
|
}, {
|
|
6178
6420
|
childCount: 1,
|
|
6179
6421
|
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellName),
|
|
6180
|
-
type:
|
|
6422
|
+
type: Div
|
|
6181
6423
|
}, text(headerName), {
|
|
6182
6424
|
childCount: 1,
|
|
6183
6425
|
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellValue),
|
|
6184
|
-
type:
|
|
6426
|
+
type: Div
|
|
6185
6427
|
}, text(getHeaderValueText(headerValue))];
|
|
6186
6428
|
};
|
|
6187
6429
|
const getHeadersTableNodes = headers => {
|
|
@@ -6190,29 +6432,9 @@ const getHeadersTableNodes = headers => {
|
|
|
6190
6432
|
headerRows.push(...getHeaderRowNodes(headerName, headerValue, index));
|
|
6191
6433
|
}
|
|
6192
6434
|
return [{
|
|
6193
|
-
childCount: 2,
|
|
6194
|
-
className: ChatDebugViewHeadersTable,
|
|
6195
|
-
type: Table$1
|
|
6196
|
-
}, {
|
|
6197
|
-
childCount: 1,
|
|
6198
|
-
className: ChatDebugViewHeadersHead,
|
|
6199
|
-
type: THead
|
|
6200
|
-
}, {
|
|
6201
|
-
childCount: 2,
|
|
6202
|
-
className: ChatDebugViewHeadersRow,
|
|
6203
|
-
type: Tr
|
|
6204
|
-
}, {
|
|
6205
|
-
childCount: 1,
|
|
6206
|
-
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellName),
|
|
6207
|
-
type: Th
|
|
6208
|
-
}, text(name()), {
|
|
6209
|
-
childCount: 1,
|
|
6210
|
-
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellValue),
|
|
6211
|
-
type: Th
|
|
6212
|
-
}, text(value()), {
|
|
6213
6435
|
childCount: headers.length,
|
|
6214
|
-
className:
|
|
6215
|
-
type:
|
|
6436
|
+
className: ChatDebugViewHeadersTable,
|
|
6437
|
+
type: Ul
|
|
6216
6438
|
}, ...headerRows];
|
|
6217
6439
|
};
|
|
6218
6440
|
const getHeaderSectionNodes = (label, headers) => {
|
|
@@ -7369,13 +7591,13 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
7369
7591
|
}, ...getDetailsTopVirtualDom(normalizedDetailTabs), ...getDetailContentDom(selectedDetailTab, safeSelectedDetailTab, contentNodes)];
|
|
7370
7592
|
};
|
|
7371
7593
|
|
|
7372
|
-
const td$
|
|
7594
|
+
const td$2 = {
|
|
7373
7595
|
childCount: 1,
|
|
7374
7596
|
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
7375
7597
|
type: Td
|
|
7376
7598
|
};
|
|
7377
7599
|
const getCellDurationDom = event => {
|
|
7378
|
-
return [td$
|
|
7600
|
+
return [td$2, text(getEventTableDurationText(event))];
|
|
7379
7601
|
};
|
|
7380
7602
|
|
|
7381
7603
|
const getMethods = new Set(['list_dir', 'list_files', 'read_file']);
|
|
@@ -7401,13 +7623,22 @@ const getEventTableMethodLabel = event => {
|
|
|
7401
7623
|
return '';
|
|
7402
7624
|
};
|
|
7403
7625
|
|
|
7404
|
-
const td = {
|
|
7626
|
+
const td$1 = {
|
|
7405
7627
|
childCount: 1,
|
|
7406
7628
|
className: TableCell,
|
|
7407
7629
|
type: Td
|
|
7408
7630
|
};
|
|
7409
7631
|
const getCellMethodDom = event => {
|
|
7410
|
-
return [td, text(getEventTableMethodLabel(event))];
|
|
7632
|
+
return [td$1, text(getEventTableMethodLabel(event))];
|
|
7633
|
+
};
|
|
7634
|
+
|
|
7635
|
+
const td = {
|
|
7636
|
+
childCount: 1,
|
|
7637
|
+
className: mergeClassNames(TableCell, ChatDebugViewCellSize),
|
|
7638
|
+
type: Td
|
|
7639
|
+
};
|
|
7640
|
+
const getCellSizeDom = event => {
|
|
7641
|
+
return [td, text(formatBytes(event.size ?? 0))];
|
|
7411
7642
|
};
|
|
7412
7643
|
|
|
7413
7644
|
const getCellStatusDom = (event, isErrorStatus) => {
|
|
@@ -7432,6 +7663,8 @@ const getTableCellDom = (column, event, isErrorStatus) => {
|
|
|
7432
7663
|
return getCellDurationDom(event);
|
|
7433
7664
|
case Method:
|
|
7434
7665
|
return getCellMethodDom(event);
|
|
7666
|
+
case Size:
|
|
7667
|
+
return getCellSizeDom(event);
|
|
7435
7668
|
case Status$1:
|
|
7436
7669
|
return getCellStatusDom(event, isErrorStatus);
|
|
7437
7670
|
case Type:
|
|
@@ -7591,23 +7824,27 @@ const getTableBodyDom = (rowNodes, eventCount) => {
|
|
|
7591
7824
|
childCount: eventCount === 0 ? 1 : eventCount,
|
|
7592
7825
|
className: TableBody,
|
|
7593
7826
|
onContextMenu: HandleTableBodyContextMenu,
|
|
7827
|
+
onDblClick: HandleTableRowDoubleClick,
|
|
7594
7828
|
onPointerDown: HandleEventRowClickAt,
|
|
7595
7829
|
type: TBody
|
|
7596
7830
|
}, ...rowNodes];
|
|
7597
7831
|
};
|
|
7598
7832
|
|
|
7599
|
-
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo', 'TableColThree'];
|
|
7833
|
+
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo', 'TableColThree', 'TableColFour'];
|
|
7600
7834
|
const getTableColumnGroupDom = visibleTableColumns => {
|
|
7601
7835
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
7602
7836
|
return [{
|
|
7603
7837
|
childCount: orderedVisibleTableColumns.length,
|
|
7604
7838
|
className: 'ColGroup',
|
|
7605
7839
|
type: ColGroup
|
|
7606
|
-
}, ...orderedVisibleTableColumns.map((_, index) =>
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7840
|
+
}, ...orderedVisibleTableColumns.map((_, index) => {
|
|
7841
|
+
const columnClassName = tableColClassNames[index] ?? `TableCol${index}`;
|
|
7842
|
+
return {
|
|
7843
|
+
childCount: 0,
|
|
7844
|
+
className: `${TableCol} ${columnClassName}`,
|
|
7845
|
+
type: Col
|
|
7846
|
+
};
|
|
7847
|
+
})];
|
|
7611
7848
|
};
|
|
7612
7849
|
|
|
7613
7850
|
const getHeaderCellNode = (column, tableColumns) => {
|
|
@@ -7648,8 +7885,8 @@ const getTableDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleT
|
|
|
7648
7885
|
}, ...getTableColumnGroupDom(visibleTableColumns), ...getTableHeaderDom(visibleTableColumns, tableColumns), ...getTableBodyDom(rowNodes, eventCount)];
|
|
7649
7886
|
};
|
|
7650
7887
|
|
|
7651
|
-
const resizerNames = ['ResizerOne', 'ResizerTwo', 'ResizerThree'];
|
|
7652
|
-
const resizerClassNames = [ResizerOne, ResizerTwo, ResizerThree];
|
|
7888
|
+
const resizerNames = ['ResizerOne', 'ResizerTwo', 'ResizerThree', 'ResizerFour'];
|
|
7889
|
+
const resizerClassNames = [ResizerOne, ResizerTwo, ResizerThree, ResizerFour];
|
|
7653
7890
|
const getTableResizersDom = visibleTableColumns => {
|
|
7654
7891
|
const visibleColumnCount = getOrderedVisibleTableColumns(visibleTableColumns).length;
|
|
7655
7892
|
const resizerCount = Math.max(0, visibleColumnCount - 1);
|
|
@@ -8112,6 +8349,9 @@ const renderEventListeners = () => {
|
|
|
8112
8349
|
}, {
|
|
8113
8350
|
name: HandleEventRowClickAt,
|
|
8114
8351
|
params: ['handleEventRowClickAt', ClientX, ClientY, Button]
|
|
8352
|
+
}, {
|
|
8353
|
+
name: HandleTableRowDoubleClick,
|
|
8354
|
+
params: ['handleTableRowDoubleClick', ClientX, ClientY]
|
|
8115
8355
|
}, {
|
|
8116
8356
|
name: HandleTableBodyContextMenu,
|
|
8117
8357
|
params: ['handleTableBodyContextMenu', ClientX, ClientY],
|
|
@@ -8315,19 +8555,9 @@ const setEvents = (state, events) => {
|
|
|
8315
8555
|
}));
|
|
8316
8556
|
};
|
|
8317
8557
|
|
|
8318
|
-
const setSessionIdDependencies = {
|
|
8319
|
-
listChatViewEvents: listChatViewEvents,
|
|
8320
|
-
registerUpdateListener: registerUpdateListener
|
|
8321
|
-
};
|
|
8322
8558
|
const setSessionId = async (state, sessionId) => {
|
|
8323
|
-
const
|
|
8324
|
-
|
|
8325
|
-
dataBaseVersion,
|
|
8326
|
-
eventStoreName,
|
|
8327
|
-
sessionIdIndexName
|
|
8328
|
-
} = state;
|
|
8329
|
-
const result = await setSessionIdDependencies.listChatViewEvents(sessionId, databaseName, dataBaseVersion, eventStoreName, sessionIdIndexName);
|
|
8330
|
-
await setSessionIdDependencies.registerUpdateListener(sessionId, rpcId, state.uid);
|
|
8559
|
+
const result = await listChatViewEvents(sessionId);
|
|
8560
|
+
await registerUpdateListener(sessionId, rpcId, state.uid);
|
|
8331
8561
|
if (result.type === 'error') {
|
|
8332
8562
|
return {
|
|
8333
8563
|
...state,
|
|
@@ -8426,6 +8656,7 @@ const commandMap = {
|
|
|
8426
8656
|
'ChatDebug.handleTableResizerPointerMove': wrapCommand(handleTableResizerPointerMove),
|
|
8427
8657
|
'ChatDebug.handleTableResizerPointerUp': wrapCommand(handleTableResizerPointerUp),
|
|
8428
8658
|
'ChatDebug.handleTableRowCopy': wrapCommand(handleTableRowCopy),
|
|
8659
|
+
'ChatDebug.handleTableRowDoubleClick': wrapCommand(handleTableRowDoubleClick),
|
|
8429
8660
|
'ChatDebug.handleTableRowOpenInNewTab': wrapCommand(handleTableRowOpenInNewTab),
|
|
8430
8661
|
'ChatDebug.handleTableScrollBarPointerDown': wrapCommand(handleTableScrollBarPointerDown),
|
|
8431
8662
|
'ChatDebug.handleTableScrollBarPointerMove': wrapCommand(handleTableScrollBarPointerMove),
|