@lvce-editor/chat-debug-view 10.3.0 → 10.5.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 +125 -20
- package/package.json +1 -1
|
@@ -1176,8 +1176,8 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1176
1176
|
number(y);
|
|
1177
1177
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1178
1178
|
};
|
|
1179
|
-
const sendMessagePortToChatStorageWorker$1 = async port => {
|
|
1180
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
1179
|
+
const sendMessagePortToChatStorageWorker$1 = async (port, rpcId) => {
|
|
1180
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort', rpcId);
|
|
1181
1181
|
};
|
|
1182
1182
|
const writeClipBoardText = async text => {
|
|
1183
1183
|
await invoke('ClipBoard.writeText', /* text */text);
|
|
@@ -3947,6 +3947,31 @@ const getReadFilePreviewText = (event, name) => {
|
|
|
3947
3947
|
return result;
|
|
3948
3948
|
};
|
|
3949
3949
|
|
|
3950
|
+
const getSseResponseCompletedPreviewEvent = event => {
|
|
3951
|
+
if (event.type !== 'sse-response-completed') {
|
|
3952
|
+
return undefined;
|
|
3953
|
+
}
|
|
3954
|
+
const {
|
|
3955
|
+
value
|
|
3956
|
+
} = event;
|
|
3957
|
+
if (!value || typeof value !== 'object') {
|
|
3958
|
+
return undefined;
|
|
3959
|
+
}
|
|
3960
|
+
const {
|
|
3961
|
+
response
|
|
3962
|
+
} = value;
|
|
3963
|
+
if (!response || typeof response !== 'object') {
|
|
3964
|
+
return undefined;
|
|
3965
|
+
}
|
|
3966
|
+
const {
|
|
3967
|
+
output
|
|
3968
|
+
} = response;
|
|
3969
|
+
if (!Array.isArray(output)) {
|
|
3970
|
+
return undefined;
|
|
3971
|
+
}
|
|
3972
|
+
return output;
|
|
3973
|
+
};
|
|
3974
|
+
|
|
3950
3975
|
const getWriteFilePreviewText = (event, name) => {
|
|
3951
3976
|
if (name !== 'write_file') {
|
|
3952
3977
|
return undefined;
|
|
@@ -3975,6 +4000,10 @@ const getPreviewEvent = event => {
|
|
|
3975
4000
|
if (previewMessageText !== undefined) {
|
|
3976
4001
|
return previewMessageText;
|
|
3977
4002
|
}
|
|
4003
|
+
const sseResponseCompletedPreviewEvent = getSseResponseCompletedPreviewEvent(event);
|
|
4004
|
+
if (sseResponseCompletedPreviewEvent !== undefined) {
|
|
4005
|
+
return sseResponseCompletedPreviewEvent;
|
|
4006
|
+
}
|
|
3978
4007
|
const name = getPreviewName(event);
|
|
3979
4008
|
const writeFilePreviewText = getWriteFilePreviewText(event, name);
|
|
3980
4009
|
if (writeFilePreviewText !== undefined) {
|
|
@@ -4476,6 +4505,87 @@ const loadContent = async (state, savedState) => {
|
|
|
4476
4505
|
});
|
|
4477
4506
|
};
|
|
4478
4507
|
|
|
4508
|
+
const isAttachmentImagePreview = value => {
|
|
4509
|
+
return typeof value === 'object' && value !== null && value.previewType === 'image';
|
|
4510
|
+
};
|
|
4511
|
+
|
|
4512
|
+
const getResponseEvent = event => {
|
|
4513
|
+
const {
|
|
4514
|
+
responseEvent
|
|
4515
|
+
} = event;
|
|
4516
|
+
if (responseEvent && typeof responseEvent === 'object' && typeof responseEvent.type === 'string') {
|
|
4517
|
+
const mergedResponseEvent = responseEvent;
|
|
4518
|
+
if (mergedResponseEvent.value !== undefined) {
|
|
4519
|
+
return mergedResponseEvent.value;
|
|
4520
|
+
}
|
|
4521
|
+
return responseEvent;
|
|
4522
|
+
}
|
|
4523
|
+
return event;
|
|
4524
|
+
};
|
|
4525
|
+
|
|
4526
|
+
const getStringLineCount = value => {
|
|
4527
|
+
return value.split('\n').length;
|
|
4528
|
+
};
|
|
4529
|
+
const isChatViewEvent$1 = value => {
|
|
4530
|
+
return typeof value === 'object' && value !== null && typeof value.type === 'string';
|
|
4531
|
+
};
|
|
4532
|
+
const getJsonLineCount = value => {
|
|
4533
|
+
const renderedValue = isChatViewEvent$1(value) ? {
|
|
4534
|
+
...value,
|
|
4535
|
+
type: getEventTypeLabel(value)
|
|
4536
|
+
} : value;
|
|
4537
|
+
const json = JSON.stringify(renderedValue, null, 2);
|
|
4538
|
+
if (!json) {
|
|
4539
|
+
return 1;
|
|
4540
|
+
}
|
|
4541
|
+
let lineCount = 1;
|
|
4542
|
+
for (let i = 0; i < json.length; i++) {
|
|
4543
|
+
if (json[i] === '\n') {
|
|
4544
|
+
lineCount++;
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
return lineCount;
|
|
4548
|
+
};
|
|
4549
|
+
const getPreviewLineCount = selectedEvent => {
|
|
4550
|
+
const previewEvent = getPreviewEvent(selectedEvent);
|
|
4551
|
+
if (previewEvent === undefined || isAttachmentImagePreview(previewEvent)) {
|
|
4552
|
+
return 0;
|
|
4553
|
+
}
|
|
4554
|
+
if (typeof previewEvent === 'string') {
|
|
4555
|
+
if (previewEvent === ImageCouldNotBeLoaded || isChatMessageUpdatedEvent(selectedEvent)) {
|
|
4556
|
+
return 0;
|
|
4557
|
+
}
|
|
4558
|
+
return getStringLineCount(previewEvent);
|
|
4559
|
+
}
|
|
4560
|
+
return getJsonLineCount(previewEvent);
|
|
4561
|
+
};
|
|
4562
|
+
const getLineCount = state => {
|
|
4563
|
+
const {
|
|
4564
|
+
selectedEvent
|
|
4565
|
+
} = state;
|
|
4566
|
+
if (!selectedEvent) {
|
|
4567
|
+
return 0;
|
|
4568
|
+
}
|
|
4569
|
+
const selectedDetailTab = getSelectedDetailTab(state.detailTabs);
|
|
4570
|
+
if (selectedDetailTab === Timing) {
|
|
4571
|
+
return 0;
|
|
4572
|
+
}
|
|
4573
|
+
if (selectedDetailTab === Preview) {
|
|
4574
|
+
return getPreviewLineCount(selectedEvent);
|
|
4575
|
+
}
|
|
4576
|
+
if (selectedDetailTab === Payload) {
|
|
4577
|
+
return getJsonLineCount(getPayloadEvent(selectedEvent));
|
|
4578
|
+
}
|
|
4579
|
+
return getJsonLineCount(getResponseEvent(selectedEvent));
|
|
4580
|
+
};
|
|
4581
|
+
const getDetailsLineNumberWidth = state => {
|
|
4582
|
+
const lineCount = getLineCount(state);
|
|
4583
|
+
if (lineCount === 0) {
|
|
4584
|
+
return 0;
|
|
4585
|
+
}
|
|
4586
|
+
return String(lineCount).length * defaultPreviewTextColumnWidth;
|
|
4587
|
+
};
|
|
4588
|
+
|
|
4479
4589
|
// cspell:ignore liga calt
|
|
4480
4590
|
|
|
4481
4591
|
const getCss = state => {
|
|
@@ -4489,6 +4599,7 @@ const getCss = state => {
|
|
|
4489
4599
|
const scrollBarOffset = getScrollBarOffset(state.tableDeltaY, maxDeltaY, tableBodyHeight, scrollBarHeight);
|
|
4490
4600
|
const tableContentWidth = Math.max(0, tableWidth - (showScrollBar ? devtoolsTableScrollBarWidth : 0));
|
|
4491
4601
|
const detailsWidth = hasSelectedEvent ? getDetailsWidth(state.width, state.tableWidth) : 0;
|
|
4602
|
+
const detailsLineNumberWidth = getDetailsLineNumberWidth(state);
|
|
4492
4603
|
const topSize = state.width >= state.largeBreakpoint ? 30 : state.width >= state.mediumBreakpoint ? 60 : 60;
|
|
4493
4604
|
const tableColumnLayout = getTableColumnLayout(tableContentWidth, getVisibleTableColumns(state.tableColumns), state.tableColumnWidths);
|
|
4494
4605
|
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
@@ -4505,6 +4616,7 @@ const getCss = state => {
|
|
|
4505
4616
|
--ChatDebugViewTableColZeroWidth: ${tableColZeroWidth}px;
|
|
4506
4617
|
--ChatDebugViewTableColOneWidth: ${tableColOneWidth}px;
|
|
4507
4618
|
--ChatDebugViewTableColTwoWidth: ${tableColTwoWidth}px;
|
|
4619
|
+
--ChatDebugViewDetailsLineNumberWidth: ${detailsLineNumberWidth}px;
|
|
4508
4620
|
--ChatDebugViewDetailsWidth: ${detailsWidth}px;
|
|
4509
4621
|
--ChatDebugViewDurationColumnWidth: ${state.tableColumnWidths.duration}px;
|
|
4510
4622
|
--ChatDebugViewTableRowHeight: ${devtoolsTableRowHeight}px;
|
|
@@ -4549,6 +4661,17 @@ const getCss = state => {
|
|
|
4549
4661
|
position: relative;
|
|
4550
4662
|
}
|
|
4551
4663
|
|
|
4664
|
+
.ChatDebugViewDetailsBottom .Gutter {
|
|
4665
|
+
flex: 0 0 var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4666
|
+
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
.ChatDebugViewDetailsBottom .ChatDebugViewEventLineNumber {
|
|
4670
|
+
display: inline-block;
|
|
4671
|
+
min-width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4672
|
+
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4552
4675
|
.TableScrollBar {
|
|
4553
4676
|
background: rgba(255, 255, 255, 0.06);
|
|
4554
4677
|
border-radius: 999px;
|
|
@@ -5369,10 +5492,6 @@ const getPanelId = detailTab => {
|
|
|
5369
5492
|
return `ChatDebugViewDetailsPanel-${detailTab}`;
|
|
5370
5493
|
};
|
|
5371
5494
|
|
|
5372
|
-
const isAttachmentImagePreview = value => {
|
|
5373
|
-
return typeof value === 'object' && value !== null && value.previewType === 'image';
|
|
5374
|
-
};
|
|
5375
|
-
|
|
5376
5495
|
const getImagePreviewLabelDom = preview => {
|
|
5377
5496
|
if (preview.stats === undefined) {
|
|
5378
5497
|
return [{
|
|
@@ -5733,20 +5852,6 @@ const getEventsClassName = hasSelectedEvent => {
|
|
|
5733
5852
|
return widthClassName;
|
|
5734
5853
|
};
|
|
5735
5854
|
|
|
5736
|
-
const getResponseEvent = event => {
|
|
5737
|
-
const {
|
|
5738
|
-
responseEvent
|
|
5739
|
-
} = event;
|
|
5740
|
-
if (responseEvent && typeof responseEvent === 'object' && typeof responseEvent.type === 'string') {
|
|
5741
|
-
const mergedResponseEvent = responseEvent;
|
|
5742
|
-
if (mergedResponseEvent.value !== undefined) {
|
|
5743
|
-
return mergedResponseEvent.value;
|
|
5744
|
-
}
|
|
5745
|
-
return responseEvent;
|
|
5746
|
-
}
|
|
5747
|
-
return event;
|
|
5748
|
-
};
|
|
5749
|
-
|
|
5750
5855
|
const sashNodesDom = [{
|
|
5751
5856
|
childCount: 0,
|
|
5752
5857
|
className: Sash,
|