@lvce-editor/chat-debug-view 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatDebugViewWorkerMain.js +122 -121
- package/package.json +1 -1
|
@@ -1524,30 +1524,6 @@ const diff2 = uid => {
|
|
|
1524
1524
|
return diff(oldState, newState);
|
|
1525
1525
|
};
|
|
1526
1526
|
|
|
1527
|
-
const getMenuIds = () => {
|
|
1528
|
-
return [555, 556, 557];
|
|
1529
|
-
};
|
|
1530
|
-
|
|
1531
|
-
const getErrorMessage = error => {
|
|
1532
|
-
if (error instanceof Error) {
|
|
1533
|
-
return error.message;
|
|
1534
|
-
}
|
|
1535
|
-
if (typeof error === 'string') {
|
|
1536
|
-
return error;
|
|
1537
|
-
}
|
|
1538
|
-
if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
|
|
1539
|
-
return error.message;
|
|
1540
|
-
}
|
|
1541
|
-
return undefined;
|
|
1542
|
-
};
|
|
1543
|
-
const getFailedToLoadMessage = (sessionId, error) => {
|
|
1544
|
-
const errorMessage = getErrorMessage(error);
|
|
1545
|
-
if (errorMessage) {
|
|
1546
|
-
return `Failed to load chat debug session "${sessionId}": ${errorMessage}`;
|
|
1547
|
-
}
|
|
1548
|
-
return `Failed to load chat debug session "${sessionId}". Please try again.`;
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1551
1527
|
const hasMatchingToolName = (startedEvent, finishedEvent) => {
|
|
1552
1528
|
if (typeof startedEvent.toolName === 'string' && typeof finishedEvent.toolName === 'string') {
|
|
1553
1529
|
return startedEvent.toolName === finishedEvent.toolName;
|
|
@@ -1690,24 +1666,6 @@ const getFilteredEvents = (events, filterValue, eventCategoryFilter, showInputEv
|
|
|
1690
1666
|
return filteredByCategory.filter(event => JSON.stringify(event).toLowerCase().includes(filterText));
|
|
1691
1667
|
};
|
|
1692
1668
|
|
|
1693
|
-
const ParseChatDebugUriErrorCode = {
|
|
1694
|
-
InvalidSessionId: 'invalid-session-id',
|
|
1695
|
-
InvalidUriEncoding: 'invalid-uri-encoding',
|
|
1696
|
-
InvalidUriFormat: 'invalid-uri-format',
|
|
1697
|
-
MissingUri: 'missing-uri'
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
const getInvalidUriMessage = (uri, code) => {
|
|
1701
|
-
if (code === ParseChatDebugUriErrorCode.MissingUri) {
|
|
1702
|
-
return 'Unable to load debug session: missing URI. Expected format: chat-debug://<sessionId>.';
|
|
1703
|
-
}
|
|
1704
|
-
return `Unable to load debug session: invalid URI "${uri}". Expected format: chat-debug://<sessionId>.`;
|
|
1705
|
-
};
|
|
1706
|
-
|
|
1707
|
-
const getSessionNotFoundMessage = sessionId => {
|
|
1708
|
-
return `No chat session found for sessionId "${sessionId}".`;
|
|
1709
|
-
};
|
|
1710
|
-
|
|
1711
1669
|
const toTimeNumber = value => {
|
|
1712
1670
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
1713
1671
|
return value;
|
|
@@ -1859,6 +1817,122 @@ const getTimelineInfo = (events, startValue, endValue) => {
|
|
|
1859
1817
|
};
|
|
1860
1818
|
};
|
|
1861
1819
|
|
|
1820
|
+
const getCurrentEvents$3 = state => {
|
|
1821
|
+
const filteredEvents = getFilteredEvents(state.events, state.filterValue, state.eventCategoryFilter, state.showInputEvents, state.showResponsePartEvents, state.showEventStreamFinishedEvents);
|
|
1822
|
+
return filterEventsByTimelineRange(filteredEvents, state.timelineStartSeconds, state.timelineEndSeconds);
|
|
1823
|
+
};
|
|
1824
|
+
const selectEventAtIndex = async (state, selectedEventIndex, dependencies) => {
|
|
1825
|
+
const currentEvents = getCurrentEvents$3(state);
|
|
1826
|
+
const selectedEvent = currentEvents[selectedEventIndex];
|
|
1827
|
+
if (!selectedEvent) {
|
|
1828
|
+
return {
|
|
1829
|
+
...state,
|
|
1830
|
+
selectedEvent: null,
|
|
1831
|
+
selectedEventId: null,
|
|
1832
|
+
selectedEventIndex
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
if (typeof selectedEvent.eventId !== 'number') {
|
|
1836
|
+
return {
|
|
1837
|
+
...state,
|
|
1838
|
+
selectedEvent,
|
|
1839
|
+
selectedEventId: null,
|
|
1840
|
+
selectedEventIndex
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
const selectedEventDetails = await dependencies.loadSelectedEvent(state.databaseName, state.dataBaseVersion, state.eventStoreName, state.sessionId, state.sessionIdIndexName, selectedEvent.eventId, selectedEvent.type);
|
|
1844
|
+
return {
|
|
1845
|
+
...state,
|
|
1846
|
+
selectedEvent: selectedEventDetails ?? selectedEvent,
|
|
1847
|
+
selectedEventId: selectedEvent.eventId,
|
|
1848
|
+
selectedEventIndex
|
|
1849
|
+
};
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
const devtoolsRootGap = 4;
|
|
1853
|
+
const devtoolsTopHeight = 28;
|
|
1854
|
+
const devtoolsTimelineHeight = 88;
|
|
1855
|
+
const devtoolsTableHeaderHeight = 24;
|
|
1856
|
+
const devtoolsTableRowHeight = 24;
|
|
1857
|
+
const getTableBodyY = (state, hasTimeline) => {
|
|
1858
|
+
return state.y + viewPadding + devtoolsTopHeight + devtoolsRootGap + (hasTimeline ? devtoolsTimelineHeight : 0) + devtoolsTableHeaderHeight;
|
|
1859
|
+
};
|
|
1860
|
+
const getTableBodyEventIndex = (state, eventX, eventY) => {
|
|
1861
|
+
if (!state.useDevtoolsLayout) {
|
|
1862
|
+
return -1;
|
|
1863
|
+
}
|
|
1864
|
+
const currentEvents = getCurrentEvents$3(state);
|
|
1865
|
+
if (currentEvents.length === 0) {
|
|
1866
|
+
return -1;
|
|
1867
|
+
}
|
|
1868
|
+
const tableX = state.x + leftPadding;
|
|
1869
|
+
const tableWidth = clampTableWidth(state.width, state.tableWidth);
|
|
1870
|
+
const hasTimeline = currentEvents.length > 0;
|
|
1871
|
+
const tableBodyY = getTableBodyY(state, hasTimeline);
|
|
1872
|
+
const relativeX = eventX - tableX;
|
|
1873
|
+
const relativeY = eventY - tableBodyY;
|
|
1874
|
+
if (relativeX < 0 || relativeX >= tableWidth || relativeY < 0) {
|
|
1875
|
+
return -1;
|
|
1876
|
+
}
|
|
1877
|
+
const eventIndex = Math.floor(relativeY / devtoolsTableRowHeight);
|
|
1878
|
+
if (eventIndex < 0 || eventIndex >= currentEvents.length) {
|
|
1879
|
+
return -1;
|
|
1880
|
+
}
|
|
1881
|
+
return eventIndex;
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
const MenuChatDebugTableBody = 2190;
|
|
1885
|
+
const handleTableBodyContextMenu = async (state, eventX, eventY) => {
|
|
1886
|
+
const eventIndex = getTableBodyEventIndex(state, eventX, eventY);
|
|
1887
|
+
await showContextMenu2(state.uid, MenuChatDebugTableBody, eventX, eventY, {
|
|
1888
|
+
eventIndex,
|
|
1889
|
+
menuId: MenuChatDebugTableBody
|
|
1890
|
+
});
|
|
1891
|
+
return state;
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1894
|
+
const getMenuIds = () => {
|
|
1895
|
+
return [MenuChatDebugTableBody, 556, 557];
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1898
|
+
const getErrorMessage = error => {
|
|
1899
|
+
if (error instanceof Error) {
|
|
1900
|
+
return error.message;
|
|
1901
|
+
}
|
|
1902
|
+
if (typeof error === 'string') {
|
|
1903
|
+
return error;
|
|
1904
|
+
}
|
|
1905
|
+
if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
|
|
1906
|
+
return error.message;
|
|
1907
|
+
}
|
|
1908
|
+
return undefined;
|
|
1909
|
+
};
|
|
1910
|
+
const getFailedToLoadMessage = (sessionId, error) => {
|
|
1911
|
+
const errorMessage = getErrorMessage(error);
|
|
1912
|
+
if (errorMessage) {
|
|
1913
|
+
return `Failed to load chat debug session "${sessionId}": ${errorMessage}`;
|
|
1914
|
+
}
|
|
1915
|
+
return `Failed to load chat debug session "${sessionId}". Please try again.`;
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
const ParseChatDebugUriErrorCode = {
|
|
1919
|
+
InvalidSessionId: 'invalid-session-id',
|
|
1920
|
+
InvalidUriEncoding: 'invalid-uri-encoding',
|
|
1921
|
+
InvalidUriFormat: 'invalid-uri-format',
|
|
1922
|
+
MissingUri: 'missing-uri'
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
const getInvalidUriMessage = (uri, code) => {
|
|
1926
|
+
if (code === ParseChatDebugUriErrorCode.MissingUri) {
|
|
1927
|
+
return 'Unable to load debug session: missing URI. Expected format: chat-debug://<sessionId>.';
|
|
1928
|
+
}
|
|
1929
|
+
return `Unable to load debug session: invalid URI "${uri}". Expected format: chat-debug://<sessionId>.`;
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
const getSessionNotFoundMessage = sessionId => {
|
|
1933
|
+
return `No chat session found for sessionId "${sessionId}".`;
|
|
1934
|
+
};
|
|
1935
|
+
|
|
1862
1936
|
const listChatViewEventsDependencies = {
|
|
1863
1937
|
listChatViewEventsFromWorker: listChatViewEvents$1
|
|
1864
1938
|
};
|
|
@@ -1926,7 +2000,7 @@ const loadEventsDependencies = {
|
|
|
1926
2000
|
listChatViewEvents: listChatViewEvents,
|
|
1927
2001
|
loadSelectedEvent: loadSelectedEvent
|
|
1928
2002
|
};
|
|
1929
|
-
const getCurrentEvents$
|
|
2003
|
+
const getCurrentEvents$2 = state => {
|
|
1930
2004
|
const filteredEvents = getFilteredEvents(state.events, state.filterValue, state.eventCategoryFilter, state.showInputEvents, state.showResponsePartEvents, state.showEventStreamFinishedEvents);
|
|
1931
2005
|
return filterEventsByTimelineRange(filteredEvents, state.timelineStartSeconds, state.timelineEndSeconds);
|
|
1932
2006
|
};
|
|
@@ -1938,7 +2012,7 @@ const restoreSelectedEvent = async state => {
|
|
|
1938
2012
|
selectedEventIndex: null
|
|
1939
2013
|
};
|
|
1940
2014
|
}
|
|
1941
|
-
const currentEvents = getCurrentEvents$
|
|
2015
|
+
const currentEvents = getCurrentEvents$2(state);
|
|
1942
2016
|
const selectedEventIndex = currentEvents.findIndex(event => event.eventId === state.selectedEventId);
|
|
1943
2017
|
if (selectedEventIndex === -1) {
|
|
1944
2018
|
return {
|
|
@@ -2081,7 +2155,7 @@ const handleDetailTab = (state, value) => {
|
|
|
2081
2155
|
};
|
|
2082
2156
|
};
|
|
2083
2157
|
|
|
2084
|
-
const getCurrentEvents$
|
|
2158
|
+
const getCurrentEvents$1 = state => {
|
|
2085
2159
|
const filteredEvents = getFilteredEvents(state.events, state.filterValue, state.eventCategoryFilter, state.showInputEvents, state.showResponsePartEvents, state.showEventStreamFinishedEvents);
|
|
2086
2160
|
return filterEventsByTimelineRange(filteredEvents, state.timelineStartSeconds, state.timelineEndSeconds);
|
|
2087
2161
|
};
|
|
@@ -2095,7 +2169,7 @@ const getSelectedEventIndex$1 = state => {
|
|
|
2095
2169
|
if (selectedEventIndex === null) {
|
|
2096
2170
|
return null;
|
|
2097
2171
|
}
|
|
2098
|
-
const filteredEvents = getCurrentEvents$
|
|
2172
|
+
const filteredEvents = getCurrentEvents$1(state);
|
|
2099
2173
|
const selectedEvent = filteredEvents[selectedEventIndex];
|
|
2100
2174
|
if (!selectedEvent) {
|
|
2101
2175
|
return null;
|
|
@@ -2113,12 +2187,12 @@ const getPreservedSelectedEventIndex$1 = (oldState, newState) => {
|
|
|
2113
2187
|
if (selectedEventIndex === null) {
|
|
2114
2188
|
return null;
|
|
2115
2189
|
}
|
|
2116
|
-
const oldFilteredEvents = getCurrentEvents$
|
|
2190
|
+
const oldFilteredEvents = getCurrentEvents$1(oldState);
|
|
2117
2191
|
const selectedEvent = oldFilteredEvents[selectedEventIndex];
|
|
2118
2192
|
if (!selectedEvent) {
|
|
2119
2193
|
return null;
|
|
2120
2194
|
}
|
|
2121
|
-
const newFilteredEvents = getCurrentEvents$
|
|
2195
|
+
const newFilteredEvents = getCurrentEvents$1(newState);
|
|
2122
2196
|
const newIndex = getEventIndexByStableId$1(newFilteredEvents, selectedEvent);
|
|
2123
2197
|
if (newIndex === -1) {
|
|
2124
2198
|
return null;
|
|
@@ -2143,38 +2217,6 @@ const handleEventCategoryFilter = (state, value) => {
|
|
|
2143
2217
|
return withPreservedSelection$1(state, nextState);
|
|
2144
2218
|
};
|
|
2145
2219
|
|
|
2146
|
-
const getCurrentEvents$1 = state => {
|
|
2147
|
-
const filteredEvents = getFilteredEvents(state.events, state.filterValue, state.eventCategoryFilter, state.showInputEvents, state.showResponsePartEvents, state.showEventStreamFinishedEvents);
|
|
2148
|
-
return filterEventsByTimelineRange(filteredEvents, state.timelineStartSeconds, state.timelineEndSeconds);
|
|
2149
|
-
};
|
|
2150
|
-
const selectEventAtIndex = async (state, selectedEventIndex, dependencies) => {
|
|
2151
|
-
const currentEvents = getCurrentEvents$1(state);
|
|
2152
|
-
const selectedEvent = currentEvents[selectedEventIndex];
|
|
2153
|
-
if (!selectedEvent) {
|
|
2154
|
-
return {
|
|
2155
|
-
...state,
|
|
2156
|
-
selectedEvent: null,
|
|
2157
|
-
selectedEventId: null,
|
|
2158
|
-
selectedEventIndex
|
|
2159
|
-
};
|
|
2160
|
-
}
|
|
2161
|
-
if (typeof selectedEvent.eventId !== 'number') {
|
|
2162
|
-
return {
|
|
2163
|
-
...state,
|
|
2164
|
-
selectedEvent,
|
|
2165
|
-
selectedEventId: null,
|
|
2166
|
-
selectedEventIndex
|
|
2167
|
-
};
|
|
2168
|
-
}
|
|
2169
|
-
const selectedEventDetails = await dependencies.loadSelectedEvent(state.databaseName, state.dataBaseVersion, state.eventStoreName, state.sessionId, state.sessionIdIndexName, selectedEvent.eventId, selectedEvent.type);
|
|
2170
|
-
return {
|
|
2171
|
-
...state,
|
|
2172
|
-
selectedEvent: selectedEventDetails ?? selectedEvent,
|
|
2173
|
-
selectedEventId: selectedEvent.eventId,
|
|
2174
|
-
selectedEventIndex
|
|
2175
|
-
};
|
|
2176
|
-
};
|
|
2177
|
-
|
|
2178
2220
|
const handleEventRowClickDependencies = {
|
|
2179
2221
|
loadSelectedEvent: loadSelectedEvent
|
|
2180
2222
|
};
|
|
@@ -2406,47 +2448,6 @@ const handleSashPointerUp = (state, eventX, eventY) => {
|
|
|
2406
2448
|
return state;
|
|
2407
2449
|
};
|
|
2408
2450
|
|
|
2409
|
-
const devtoolsRootGap = 4;
|
|
2410
|
-
const devtoolsTopHeight = 28;
|
|
2411
|
-
const devtoolsTimelineHeight = 88;
|
|
2412
|
-
const devtoolsTableHeaderHeight = 24;
|
|
2413
|
-
const devtoolsTableRowHeight = 24;
|
|
2414
|
-
const MenuChatDebugTableBody = 2190;
|
|
2415
|
-
const getTableBodyY = (state, hasTimeline) => {
|
|
2416
|
-
return state.y + viewPadding + devtoolsTopHeight + devtoolsRootGap + (hasTimeline ? devtoolsTimelineHeight : 0) + devtoolsTableHeaderHeight;
|
|
2417
|
-
};
|
|
2418
|
-
const getTableBodyEventIndex = (state, eventX, eventY) => {
|
|
2419
|
-
if (!state.useDevtoolsLayout) {
|
|
2420
|
-
return -1;
|
|
2421
|
-
}
|
|
2422
|
-
const currentEvents = getCurrentEvents$1(state);
|
|
2423
|
-
if (currentEvents.length === 0) {
|
|
2424
|
-
return -1;
|
|
2425
|
-
}
|
|
2426
|
-
const tableX = state.x + leftPadding;
|
|
2427
|
-
const tableWidth = clampTableWidth(state.width, state.tableWidth);
|
|
2428
|
-
const hasTimeline = currentEvents.length > 0;
|
|
2429
|
-
const tableBodyY = getTableBodyY(state, hasTimeline);
|
|
2430
|
-
const relativeX = eventX - tableX;
|
|
2431
|
-
const relativeY = eventY - tableBodyY;
|
|
2432
|
-
if (relativeX < 0 || relativeX >= tableWidth || relativeY < 0) {
|
|
2433
|
-
return -1;
|
|
2434
|
-
}
|
|
2435
|
-
const eventIndex = Math.floor(relativeY / devtoolsTableRowHeight);
|
|
2436
|
-
if (eventIndex < 0 || eventIndex >= currentEvents.length) {
|
|
2437
|
-
return -1;
|
|
2438
|
-
}
|
|
2439
|
-
return eventIndex;
|
|
2440
|
-
};
|
|
2441
|
-
const handleTableBodyContextMenu = async (state, eventX, eventY) => {
|
|
2442
|
-
const eventIndex = getTableBodyEventIndex(state, eventX, eventY);
|
|
2443
|
-
await showContextMenu2(state.uid, MenuChatDebugTableBody, eventX, eventY, {
|
|
2444
|
-
eventIndex,
|
|
2445
|
-
menuId: MenuChatDebugTableBody
|
|
2446
|
-
});
|
|
2447
|
-
return state;
|
|
2448
|
-
};
|
|
2449
|
-
|
|
2450
2451
|
const clearTimelineSelectionState = state => {
|
|
2451
2452
|
return {
|
|
2452
2453
|
...state,
|