@lvce-editor/chat-debug-view 10.17.0 → 10.19.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 +360 -112
- 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
|
|
|
@@ -1471,6 +1473,7 @@ const FailedToLoadChatDebugSession = 'Failed to load chat debug session "{PH1}".
|
|
|
1471
1473
|
const FailedToLoadChatDebugSessionWithError = 'Failed to load chat debug session "{PH1}": {PH2}';
|
|
1472
1474
|
const FilterEvents = 'Filter events';
|
|
1473
1475
|
const FromSeconds = 'from {PH1}s';
|
|
1476
|
+
const General = 'General';
|
|
1474
1477
|
const Headers = 'Headers';
|
|
1475
1478
|
const ImageCouldNotBeLoaded = 'image could not be loaded';
|
|
1476
1479
|
const InputTokens = 'Input Tokens';
|
|
@@ -1479,7 +1482,6 @@ const InvalidUriEncoding = 'Invalid URI encoding';
|
|
|
1479
1482
|
const InvalidUriFormat = 'Invalid URI format';
|
|
1480
1483
|
const Method$1 = 'Method';
|
|
1481
1484
|
const MissingUri = 'Missing URI';
|
|
1482
|
-
const Name = 'Name';
|
|
1483
1485
|
const Network = 'Network';
|
|
1484
1486
|
const NoChatSessionFound = 'No chat session found for sessionId "{PH1}".';
|
|
1485
1487
|
const NoEventsFound = 'No events have been found';
|
|
@@ -1492,10 +1494,15 @@ const Preview = 'Preview';
|
|
|
1492
1494
|
const Refresh = 'Refresh';
|
|
1493
1495
|
const RefreshEvents = 'Refresh events';
|
|
1494
1496
|
const ResetColumns = 'Reset columns';
|
|
1497
|
+
const RequestHeaders = 'Request Headers';
|
|
1498
|
+
const RequestMethod = 'Request Method';
|
|
1499
|
+
const RequestUrl = 'Request URL';
|
|
1495
1500
|
const Response = 'Response';
|
|
1501
|
+
const ResponseHeaders = 'Response Headers';
|
|
1496
1502
|
const SecondsRange = '{PH1}s-{PH2}s';
|
|
1497
1503
|
const Started = 'Started';
|
|
1498
1504
|
const Status$2 = 'Status';
|
|
1505
|
+
const StatusCode = 'Status Code';
|
|
1499
1506
|
const Stream = 'Stream';
|
|
1500
1507
|
const TableSummaryPlural = '{PH1} events, {PH2} from start to finish';
|
|
1501
1508
|
const TableSummarySingular = '{PH1} event, {PH2} from start to finish';
|
|
@@ -1507,7 +1514,6 @@ const Type$1 = 'Type';
|
|
|
1507
1514
|
const Ui = 'UI';
|
|
1508
1515
|
const UnableToLoadDebugSessionInvalidUri = 'Unable to load debug session: invalid URI "{PH1}". Expected format: chat-debug://<sessionId>.';
|
|
1509
1516
|
const UnableToLoadDebugSessionMissingUri = 'Unable to load debug session: missing URI. Expected format: chat-debug://<sessionId>.';
|
|
1510
|
-
const Value = 'Value';
|
|
1511
1517
|
const WindowSummary = 'Window {PH1}-{PH2} of {PH3}';
|
|
1512
1518
|
|
|
1513
1519
|
const copy = () => {
|
|
@@ -1556,6 +1562,9 @@ const fromSeconds = seconds => {
|
|
|
1556
1562
|
PH1: seconds
|
|
1557
1563
|
});
|
|
1558
1564
|
};
|
|
1565
|
+
const general = () => {
|
|
1566
|
+
return i18nString(General);
|
|
1567
|
+
};
|
|
1559
1568
|
const headers = () => {
|
|
1560
1569
|
return i18nString(Headers);
|
|
1561
1570
|
};
|
|
@@ -1580,9 +1589,6 @@ const missingUri = () => {
|
|
|
1580
1589
|
const method = () => {
|
|
1581
1590
|
return i18nString(Method$1);
|
|
1582
1591
|
};
|
|
1583
|
-
const name = () => {
|
|
1584
|
-
return i18nString(Name);
|
|
1585
|
-
};
|
|
1586
1592
|
const network = () => {
|
|
1587
1593
|
return i18nString(Network);
|
|
1588
1594
|
};
|
|
@@ -1617,6 +1623,18 @@ const refresh$1 = () => {
|
|
|
1617
1623
|
const refreshEvents$1 = () => {
|
|
1618
1624
|
return i18nString(RefreshEvents);
|
|
1619
1625
|
};
|
|
1626
|
+
const requestHeaders = () => {
|
|
1627
|
+
return i18nString(RequestHeaders);
|
|
1628
|
+
};
|
|
1629
|
+
const requestMethod = () => {
|
|
1630
|
+
return i18nString(RequestMethod);
|
|
1631
|
+
};
|
|
1632
|
+
const requestUrl = () => {
|
|
1633
|
+
return i18nString(RequestUrl);
|
|
1634
|
+
};
|
|
1635
|
+
const responseHeaders = () => {
|
|
1636
|
+
return i18nString(ResponseHeaders);
|
|
1637
|
+
};
|
|
1620
1638
|
const resetColumns = () => {
|
|
1621
1639
|
return i18nString(ResetColumns);
|
|
1622
1640
|
};
|
|
@@ -1635,6 +1653,9 @@ const started = () => {
|
|
|
1635
1653
|
const stream = () => {
|
|
1636
1654
|
return i18nString(Stream);
|
|
1637
1655
|
};
|
|
1656
|
+
const statusCode = () => {
|
|
1657
|
+
return i18nString(StatusCode);
|
|
1658
|
+
};
|
|
1638
1659
|
const timing = () => {
|
|
1639
1660
|
return i18nString(Timing);
|
|
1640
1661
|
};
|
|
@@ -1658,9 +1679,6 @@ const tools = () => {
|
|
|
1658
1679
|
const type = () => {
|
|
1659
1680
|
return i18nString(Type$1);
|
|
1660
1681
|
};
|
|
1661
|
-
const value = () => {
|
|
1662
|
-
return i18nString(Value);
|
|
1663
|
-
};
|
|
1664
1682
|
const ui = () => {
|
|
1665
1683
|
return i18nString(Ui);
|
|
1666
1684
|
};
|
|
@@ -2071,7 +2089,13 @@ const isHeadersRecord$1 = value => {
|
|
|
2071
2089
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
2072
2090
|
};
|
|
2073
2091
|
const hasHeadersDetails = event => {
|
|
2074
|
-
|
|
2092
|
+
if (event.type !== 'ai-request') {
|
|
2093
|
+
return false;
|
|
2094
|
+
}
|
|
2095
|
+
if (isHeadersRecord$1(event.headers)) {
|
|
2096
|
+
return true;
|
|
2097
|
+
}
|
|
2098
|
+
return isHeadersRecord$1(event.endValue) && isHeadersRecord$1(event.endValue.headers);
|
|
2075
2099
|
};
|
|
2076
2100
|
|
|
2077
2101
|
const hasTimingDetails = event => {
|
|
@@ -2082,6 +2106,11 @@ const hasTimingDetails = event => {
|
|
|
2082
2106
|
};
|
|
2083
2107
|
|
|
2084
2108
|
const getResponseEvent = event => {
|
|
2109
|
+
// @ts-ignore
|
|
2110
|
+
if (event && event.endValue && event.endValue.value) {
|
|
2111
|
+
// @ts-ignore
|
|
2112
|
+
return event.endValue.value;
|
|
2113
|
+
}
|
|
2085
2114
|
const {
|
|
2086
2115
|
responseEvent
|
|
2087
2116
|
} = event;
|
|
@@ -2891,7 +2920,12 @@ const getSelectedDetailTab = detailTabs => {
|
|
|
2891
2920
|
return detailTabs[0]?.name ?? Response$1;
|
|
2892
2921
|
};
|
|
2893
2922
|
|
|
2894
|
-
const loadSelectedEvent = async (
|
|
2923
|
+
const loadSelectedEvent = async ({
|
|
2924
|
+
endEventId,
|
|
2925
|
+
eventId,
|
|
2926
|
+
sessionId,
|
|
2927
|
+
type
|
|
2928
|
+
}) => {
|
|
2895
2929
|
const raw = await loadSelectedEvent$1(sessionId, eventId, type);
|
|
2896
2930
|
if (endEventId && endEventId !== -1) {
|
|
2897
2931
|
const end = await loadSelectedEvent$1(sessionId, endEventId, type);
|
|
@@ -3161,12 +3195,8 @@ const withPreparedSelectedEventPreview = async event => {
|
|
|
3161
3195
|
|
|
3162
3196
|
const selectEventAtIndex = async (state, selectedEventIndex) => {
|
|
3163
3197
|
const {
|
|
3164
|
-
databaseName,
|
|
3165
|
-
dataBaseVersion,
|
|
3166
3198
|
detailTabs,
|
|
3167
|
-
|
|
3168
|
-
sessionId,
|
|
3169
|
-
sessionIdIndexName
|
|
3199
|
+
sessionId
|
|
3170
3200
|
} = state;
|
|
3171
3201
|
const selectedDetailTab = getSelectedDetailTab(detailTabs);
|
|
3172
3202
|
const currentEvents = getCurrentEvents$1(state);
|
|
@@ -3187,9 +3217,13 @@ const selectEventAtIndex = async (state, selectedEventIndex) => {
|
|
|
3187
3217
|
selectedEventIndex
|
|
3188
3218
|
};
|
|
3189
3219
|
}
|
|
3190
|
-
const selectedEventDetails = await loadSelectedEvent(
|
|
3191
|
-
|
|
3192
|
-
|
|
3220
|
+
const selectedEventDetails = await loadSelectedEvent({
|
|
3221
|
+
// @ts-ignore
|
|
3222
|
+
endEventId: selectedEvent['eventEndId'] || 0,
|
|
3223
|
+
eventId: selectedEvent.eventId,
|
|
3224
|
+
sessionId,
|
|
3225
|
+
type: selectedEvent.type
|
|
3226
|
+
});
|
|
3193
3227
|
const resolvedSelectedEvent = await withPreparedSelectedEventPreview(mergeSelectedEventDetails(selectedEvent, selectedEventDetails));
|
|
3194
3228
|
return withSelectedEventVisible({
|
|
3195
3229
|
...state,
|
|
@@ -3378,19 +3412,40 @@ const getMergedRequestResponseEvent = (item, response) => {
|
|
|
3378
3412
|
const parsedStart = new Date(item.timestamp || '');
|
|
3379
3413
|
const parsedEnd = new Date(response.timestamp || '');
|
|
3380
3414
|
const durationMs = parsedEnd.getTime() - parsedStart.getTime();
|
|
3415
|
+
const started = getStartedTimestamp(item);
|
|
3416
|
+
const ended = getEndedTimestamp(response);
|
|
3417
|
+
const timestamp = item.timestamp ?? started;
|
|
3381
3418
|
if (Number.isFinite(durationMs) && durationMs >= 0) {
|
|
3382
3419
|
return {
|
|
3383
3420
|
durationMs,
|
|
3421
|
+
...(ended === undefined ? {} : {
|
|
3422
|
+
ended
|
|
3423
|
+
}),
|
|
3384
3424
|
eventEndId: response.eventId,
|
|
3385
3425
|
eventId: item.eventId,
|
|
3386
3426
|
method: 'POST',
|
|
3427
|
+
...(started === undefined ? {} : {
|
|
3428
|
+
started
|
|
3429
|
+
}),
|
|
3430
|
+
...(timestamp === undefined ? {} : {
|
|
3431
|
+
timestamp
|
|
3432
|
+
}),
|
|
3387
3433
|
type: 'ai-request-response'
|
|
3388
3434
|
};
|
|
3389
3435
|
}
|
|
3390
3436
|
return {
|
|
3437
|
+
...(ended === undefined ? {} : {
|
|
3438
|
+
ended
|
|
3439
|
+
}),
|
|
3391
3440
|
eventEndId: response.eventId,
|
|
3392
3441
|
eventId: item.eventId,
|
|
3393
3442
|
method: 'POST',
|
|
3443
|
+
...(started === undefined ? {} : {
|
|
3444
|
+
started
|
|
3445
|
+
}),
|
|
3446
|
+
...(timestamp === undefined ? {} : {
|
|
3447
|
+
timestamp
|
|
3448
|
+
}),
|
|
3394
3449
|
type: 'ai-request-response'
|
|
3395
3450
|
};
|
|
3396
3451
|
};
|
|
@@ -3644,7 +3699,11 @@ const restoreSelectedEvent = async state => {
|
|
|
3644
3699
|
selectedEventIndex: null
|
|
3645
3700
|
};
|
|
3646
3701
|
}
|
|
3647
|
-
const selectedEventDetails = await loadEventsDependencies.loadSelectedEvent(
|
|
3702
|
+
const selectedEventDetails = await loadEventsDependencies.loadSelectedEvent({
|
|
3703
|
+
eventId: selectedEvent.eventId,
|
|
3704
|
+
sessionId: state.sessionId,
|
|
3705
|
+
type: selectedEvent.type
|
|
3706
|
+
});
|
|
3648
3707
|
const resolvedSelectedEvent = await withPreparedSelectedEventPreview(mergeSelectedEventDetails(selectedEvent, selectedEventDetails));
|
|
3649
3708
|
return {
|
|
3650
3709
|
...state,
|
|
@@ -4101,28 +4160,43 @@ const shouldIncludeArguments = (event, name) => {
|
|
|
4101
4160
|
return true;
|
|
4102
4161
|
};
|
|
4103
4162
|
|
|
4104
|
-
const
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
const mergedRequestEvent = requestEvent;
|
|
4110
|
-
if (mergedRequestEvent.body !== undefined) {
|
|
4111
|
-
return mergedRequestEvent.body;
|
|
4112
|
-
}
|
|
4113
|
-
if (mergedRequestEvent.value !== undefined) {
|
|
4114
|
-
return mergedRequestEvent.value;
|
|
4115
|
-
}
|
|
4116
|
-
if (hasOwn(mergedRequestEvent, 'arguments')) {
|
|
4117
|
-
return mergedRequestEvent.arguments;
|
|
4118
|
-
}
|
|
4119
|
-
return requestEvent;
|
|
4163
|
+
const getMergedRequestPayloadEvent = requestEvent => {
|
|
4164
|
+
if (!requestEvent || typeof requestEvent !== 'object') {
|
|
4165
|
+
return {
|
|
4166
|
+
found: false
|
|
4167
|
+
};
|
|
4120
4168
|
}
|
|
4121
|
-
const
|
|
4122
|
-
if (
|
|
4123
|
-
return
|
|
4169
|
+
const mergedRequestEvent = requestEvent;
|
|
4170
|
+
if (typeof mergedRequestEvent.type !== 'string') {
|
|
4171
|
+
return {
|
|
4172
|
+
found: false
|
|
4173
|
+
};
|
|
4174
|
+
}
|
|
4175
|
+
if (mergedRequestEvent.body !== undefined) {
|
|
4176
|
+
return {
|
|
4177
|
+
found: true,
|
|
4178
|
+
value: mergedRequestEvent.body
|
|
4179
|
+
};
|
|
4180
|
+
}
|
|
4181
|
+
if (mergedRequestEvent.value !== undefined) {
|
|
4182
|
+
return {
|
|
4183
|
+
found: true,
|
|
4184
|
+
value: mergedRequestEvent.value
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
if (hasOwn(mergedRequestEvent, 'arguments')) {
|
|
4188
|
+
return {
|
|
4189
|
+
found: true,
|
|
4190
|
+
value: mergedRequestEvent.arguments
|
|
4191
|
+
};
|
|
4124
4192
|
}
|
|
4125
|
-
|
|
4193
|
+
return {
|
|
4194
|
+
found: true,
|
|
4195
|
+
value: requestEvent
|
|
4196
|
+
};
|
|
4197
|
+
};
|
|
4198
|
+
const getPayloadObject = (event, name) => {
|
|
4199
|
+
return {
|
|
4126
4200
|
...(name === undefined ? {} : {
|
|
4127
4201
|
name
|
|
4128
4202
|
}),
|
|
@@ -4133,6 +4207,23 @@ const getPayloadEvent = event => {
|
|
|
4133
4207
|
result: event.result
|
|
4134
4208
|
} : {})
|
|
4135
4209
|
};
|
|
4210
|
+
};
|
|
4211
|
+
const getPayloadEvent = event => {
|
|
4212
|
+
if (event && event.type === 'ai-request') {
|
|
4213
|
+
return event.body;
|
|
4214
|
+
}
|
|
4215
|
+
const {
|
|
4216
|
+
requestEvent
|
|
4217
|
+
} = event;
|
|
4218
|
+
const mergedRequestPayloadEvent = getMergedRequestPayloadEvent(requestEvent);
|
|
4219
|
+
if (mergedRequestPayloadEvent.found) {
|
|
4220
|
+
return mergedRequestPayloadEvent.value;
|
|
4221
|
+
}
|
|
4222
|
+
const name = getPreviewName(event);
|
|
4223
|
+
if (name === 'list_files' && hasOwn(event, 'arguments')) {
|
|
4224
|
+
return event.arguments;
|
|
4225
|
+
}
|
|
4226
|
+
const payloadEvent = getPayloadObject(event, name);
|
|
4136
4227
|
if (Object.keys(payloadEvent).length > 0) {
|
|
4137
4228
|
return payloadEvent;
|
|
4138
4229
|
}
|
|
@@ -5226,27 +5317,44 @@ const getCss = state => {
|
|
|
5226
5317
|
}
|
|
5227
5318
|
|
|
5228
5319
|
.ChatDebugViewHeadersTable {
|
|
5229
|
-
|
|
5230
|
-
|
|
5320
|
+
list-style: none;
|
|
5321
|
+
margin: 0;
|
|
5322
|
+
padding: 0;
|
|
5231
5323
|
width: 100%;
|
|
5232
5324
|
}
|
|
5233
5325
|
|
|
5234
|
-
.
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5326
|
+
.ChatDebugViewHeadersSection {
|
|
5327
|
+
display: flex;
|
|
5328
|
+
flex-direction: column;
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
.ChatDebugViewHeadersSection + .ChatDebugViewHeadersSection {
|
|
5332
|
+
margin-top: 16px;
|
|
5241
5333
|
}
|
|
5242
5334
|
|
|
5243
|
-
.
|
|
5335
|
+
.ChatDebugViewHeadersSectionHeading {
|
|
5244
5336
|
color: var(--vscode-descriptionForeground, rgba(255, 255, 255, 0.7));
|
|
5245
5337
|
font-size: 11px;
|
|
5246
5338
|
font-weight: 600;
|
|
5339
|
+
letter-spacing: 0.08em;
|
|
5340
|
+
margin-bottom: 6px;
|
|
5247
5341
|
text-transform: uppercase;
|
|
5248
5342
|
}
|
|
5249
5343
|
|
|
5344
|
+
.ChatDebugViewHeadersRow {
|
|
5345
|
+
display: grid;
|
|
5346
|
+
grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
.ChatDebugViewHeadersCell {
|
|
5350
|
+
border-bottom: 1px solid var(--vscode-panel-border, rgba(255, 255, 255, 0.12));
|
|
5351
|
+
min-width: 0;
|
|
5352
|
+
color: var(--vscode-editor-foreground);
|
|
5353
|
+
padding: 6px 10px;
|
|
5354
|
+
text-align: left;
|
|
5355
|
+
word-break: break-word;
|
|
5356
|
+
}
|
|
5357
|
+
|
|
5250
5358
|
.ChatDebugViewHeadersRowOdd {
|
|
5251
5359
|
background: rgba(255, 255, 255, 0.02);
|
|
5252
5360
|
}
|
|
@@ -5257,7 +5365,6 @@ const getCss = state => {
|
|
|
5257
5365
|
|
|
5258
5366
|
.ChatDebugViewHeadersCellName {
|
|
5259
5367
|
font-weight: 500;
|
|
5260
|
-
width: 38%;
|
|
5261
5368
|
}
|
|
5262
5369
|
.PreviewVirtualizedEditor {
|
|
5263
5370
|
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
@@ -5658,14 +5765,14 @@ const PanelTab = 'PanelTab';
|
|
|
5658
5765
|
const PanelTabSelected = 'PanelTabSelected';
|
|
5659
5766
|
const ChatDebugViewDetailsTabs = 'ChatDebugViewDetailsTabs';
|
|
5660
5767
|
const ChatDebugViewDetailsTop = 'ChatDebugViewDetailsTop';
|
|
5661
|
-
const ChatDebugViewHeadersBody = 'ChatDebugViewHeadersBody';
|
|
5662
5768
|
const ChatDebugViewHeadersCell = 'ChatDebugViewHeadersCell';
|
|
5663
5769
|
const ChatDebugViewHeadersCellName = 'ChatDebugViewHeadersCellName';
|
|
5664
5770
|
const ChatDebugViewHeadersCellValue = 'ChatDebugViewHeadersCellValue';
|
|
5665
|
-
const ChatDebugViewHeadersHead = 'ChatDebugViewHeadersHead';
|
|
5666
5771
|
const ChatDebugViewHeadersRow = 'ChatDebugViewHeadersRow';
|
|
5667
5772
|
const ChatDebugViewHeadersRowEven = 'ChatDebugViewHeadersRowEven';
|
|
5668
5773
|
const ChatDebugViewHeadersRowOdd = 'ChatDebugViewHeadersRowOdd';
|
|
5774
|
+
const ChatDebugViewHeadersSection = 'ChatDebugViewHeadersSection';
|
|
5775
|
+
const ChatDebugViewHeadersSectionHeading = 'ChatDebugViewHeadersSectionHeading';
|
|
5669
5776
|
const ChatDebugViewHeadersTable = 'ChatDebugViewHeadersTable';
|
|
5670
5777
|
const ChatDebugViewDevtoolsSplit = 'ChatDebugViewDevtoolsSplit';
|
|
5671
5778
|
const ChatDebugViewEmpty = 'ChatDebugViewEmpty';
|
|
@@ -5942,22 +6049,22 @@ const getDetailContentDom = (selectedDetailTab, safeSelectedDetailTab, contentNo
|
|
|
5942
6049
|
}, ...contentNodes];
|
|
5943
6050
|
};
|
|
5944
6051
|
|
|
5945
|
-
const
|
|
5946
|
-
'aria-label': closeDetails(),
|
|
5947
|
-
childCount: 1,
|
|
5948
|
-
className: ChatDebugViewDetailsClose,
|
|
5949
|
-
name: CloseDetails$1,
|
|
5950
|
-
onChange: HandleCloseDetails,
|
|
5951
|
-
onClick: HandleCloseDetails,
|
|
5952
|
-
type: Button$1,
|
|
5953
|
-
value: 'close'
|
|
5954
|
-
}, {
|
|
6052
|
+
const icon = {
|
|
5955
6053
|
childCount: 0,
|
|
5956
6054
|
className: 'MaskIcon MaskIconClose',
|
|
5957
6055
|
type: Div
|
|
5958
|
-
}
|
|
6056
|
+
};
|
|
5959
6057
|
const getDetailsCloseButtonDom = () => {
|
|
5960
|
-
return
|
|
6058
|
+
return [{
|
|
6059
|
+
'aria-label': closeDetails(),
|
|
6060
|
+
childCount: 1,
|
|
6061
|
+
className: ChatDebugViewDetailsClose,
|
|
6062
|
+
name: CloseDetails$1,
|
|
6063
|
+
onChange: HandleCloseDetails,
|
|
6064
|
+
onClick: HandleCloseDetails,
|
|
6065
|
+
type: Button$1,
|
|
6066
|
+
value: 'close'
|
|
6067
|
+
}, icon];
|
|
5961
6068
|
};
|
|
5962
6069
|
|
|
5963
6070
|
const getDetailTabDom = detailTab => {
|
|
@@ -5989,13 +6096,14 @@ const getTabNodes = detailTabs => {
|
|
|
5989
6096
|
}, ...detailTabs.flatMap(getDetailTabDom)];
|
|
5990
6097
|
};
|
|
5991
6098
|
|
|
6099
|
+
const parentNode = {
|
|
6100
|
+
childCount: 2,
|
|
6101
|
+
className: ChatDebugViewDetailsTop,
|
|
6102
|
+
onContextMenu: HandleDetailsTopContextMenu,
|
|
6103
|
+
type: Div
|
|
6104
|
+
};
|
|
5992
6105
|
const getDetailsTopVirtualDom = detailTabs => {
|
|
5993
|
-
return [
|
|
5994
|
-
childCount: 2,
|
|
5995
|
-
className: ChatDebugViewDetailsTop,
|
|
5996
|
-
onContextMenu: HandleDetailsTopContextMenu,
|
|
5997
|
-
type: Div
|
|
5998
|
-
}, ...getDetailsCloseButtonDom(), ...getTabNodes(detailTabs)];
|
|
6106
|
+
return [parentNode, ...getDetailsCloseButtonDom(), ...getTabNodes(detailTabs)];
|
|
5999
6107
|
};
|
|
6000
6108
|
|
|
6001
6109
|
const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
@@ -6005,9 +6113,118 @@ const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
|
6005
6113
|
return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
|
|
6006
6114
|
};
|
|
6007
6115
|
|
|
6116
|
+
const httpStatusLabels = {
|
|
6117
|
+
100: 'Continue',
|
|
6118
|
+
101: 'Switching Protocols',
|
|
6119
|
+
102: 'Processing',
|
|
6120
|
+
103: 'Early Hints',
|
|
6121
|
+
200: 'OK',
|
|
6122
|
+
201: 'Created',
|
|
6123
|
+
202: 'Accepted',
|
|
6124
|
+
203: 'Non-Authoritative Information',
|
|
6125
|
+
204: 'No Content',
|
|
6126
|
+
205: 'Reset Content',
|
|
6127
|
+
206: 'Partial Content',
|
|
6128
|
+
207: 'Multi-Status',
|
|
6129
|
+
208: 'Already Reported',
|
|
6130
|
+
226: 'IM Used',
|
|
6131
|
+
300: 'Multiple Choices',
|
|
6132
|
+
301: 'Moved Permanently',
|
|
6133
|
+
302: 'Found',
|
|
6134
|
+
303: 'See Other',
|
|
6135
|
+
304: 'Not Modified',
|
|
6136
|
+
305: 'Use Proxy',
|
|
6137
|
+
307: 'Temporary Redirect',
|
|
6138
|
+
308: 'Permanent Redirect',
|
|
6139
|
+
400: 'Bad Request',
|
|
6140
|
+
401: 'Unauthorized',
|
|
6141
|
+
402: 'Payment Required',
|
|
6142
|
+
403: 'Forbidden',
|
|
6143
|
+
404: 'Not Found',
|
|
6144
|
+
405: 'Method Not Allowed',
|
|
6145
|
+
406: 'Not Acceptable',
|
|
6146
|
+
407: 'Proxy Authentication Required',
|
|
6147
|
+
408: 'Request Timeout',
|
|
6148
|
+
409: 'Conflict',
|
|
6149
|
+
410: 'Gone',
|
|
6150
|
+
411: 'Length Required',
|
|
6151
|
+
412: 'Precondition Failed',
|
|
6152
|
+
413: 'Content Too Large',
|
|
6153
|
+
414: 'URI Too Long',
|
|
6154
|
+
415: 'Unsupported Media Type',
|
|
6155
|
+
416: 'Range Not Satisfiable',
|
|
6156
|
+
417: 'Expectation Failed',
|
|
6157
|
+
418: "I'm a Teapot",
|
|
6158
|
+
421: 'Misdirected Request',
|
|
6159
|
+
422: 'Unprocessable Content',
|
|
6160
|
+
423: 'Locked',
|
|
6161
|
+
424: 'Failed Dependency',
|
|
6162
|
+
425: 'Too Early',
|
|
6163
|
+
426: 'Upgrade Required',
|
|
6164
|
+
428: 'Precondition Required',
|
|
6165
|
+
429: 'Too Many Requests',
|
|
6166
|
+
431: 'Request Header Fields Too Large',
|
|
6167
|
+
451: 'Unavailable For Legal Reasons',
|
|
6168
|
+
500: 'Internal Server Error',
|
|
6169
|
+
501: 'Not Implemented',
|
|
6170
|
+
502: 'Bad Gateway',
|
|
6171
|
+
503: 'Service Unavailable',
|
|
6172
|
+
504: 'Gateway Timeout',
|
|
6173
|
+
505: 'HTTP Version Not Supported',
|
|
6174
|
+
506: 'Variant Also Negotiates',
|
|
6175
|
+
507: 'Insufficient Storage',
|
|
6176
|
+
508: 'Loop Detected',
|
|
6177
|
+
510: 'Not Extended',
|
|
6178
|
+
511: 'Network Authentication Required'
|
|
6179
|
+
};
|
|
6180
|
+
const threeDigitStatusCodeRegex = /^\d{3}$/;
|
|
6181
|
+
const parseStatusCode = value => {
|
|
6182
|
+
if (typeof value === 'number' && Number.isInteger(value)) {
|
|
6183
|
+
return value;
|
|
6184
|
+
}
|
|
6185
|
+
if (typeof value !== 'string') {
|
|
6186
|
+
return undefined;
|
|
6187
|
+
}
|
|
6188
|
+
const trimmedValue = value.trim();
|
|
6189
|
+
if (!threeDigitStatusCodeRegex.test(trimmedValue)) {
|
|
6190
|
+
return undefined;
|
|
6191
|
+
}
|
|
6192
|
+
return Number(trimmedValue);
|
|
6193
|
+
};
|
|
6194
|
+
const formatHttpStatusCode = value => {
|
|
6195
|
+
const numericStatusCode = parseStatusCode(value);
|
|
6196
|
+
if (numericStatusCode === undefined) {
|
|
6197
|
+
return String(value);
|
|
6198
|
+
}
|
|
6199
|
+
const label = httpStatusLabels[numericStatusCode];
|
|
6200
|
+
if (!label) {
|
|
6201
|
+
return String(numericStatusCode);
|
|
6202
|
+
}
|
|
6203
|
+
return `${numericStatusCode} ${label}`;
|
|
6204
|
+
};
|
|
6205
|
+
|
|
6008
6206
|
const isHeadersRecord = value => {
|
|
6009
6207
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6010
6208
|
};
|
|
6209
|
+
const isNonEmptyString = value => {
|
|
6210
|
+
return typeof value === 'string' && value.length > 0;
|
|
6211
|
+
};
|
|
6212
|
+
const getStatusCodeValue = selectedEvent => {
|
|
6213
|
+
if (!selectedEvent) {
|
|
6214
|
+
return undefined;
|
|
6215
|
+
}
|
|
6216
|
+
const endValue = isHeadersRecord(selectedEvent.endValue) ? selectedEvent.endValue : undefined;
|
|
6217
|
+
if (endValue?.statusCode !== undefined) {
|
|
6218
|
+
return endValue.statusCode;
|
|
6219
|
+
}
|
|
6220
|
+
if (selectedEvent.statusCode !== undefined) {
|
|
6221
|
+
return selectedEvent.statusCode;
|
|
6222
|
+
}
|
|
6223
|
+
if (selectedEvent.type === 'ai-request' || selectedEvent.type === 'ai-response') {
|
|
6224
|
+
return getStatusText(selectedEvent);
|
|
6225
|
+
}
|
|
6226
|
+
return undefined;
|
|
6227
|
+
};
|
|
6011
6228
|
const stringifyHeaderValue = value => {
|
|
6012
6229
|
try {
|
|
6013
6230
|
return JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -6041,61 +6258,84 @@ const getHeaderValueText = value => {
|
|
|
6041
6258
|
}
|
|
6042
6259
|
return stringifyHeaderValue(value);
|
|
6043
6260
|
};
|
|
6044
|
-
const getHeaders =
|
|
6045
|
-
if (
|
|
6261
|
+
const getHeaders = value => {
|
|
6262
|
+
if (!isHeadersRecord(value)) {
|
|
6046
6263
|
return [];
|
|
6047
6264
|
}
|
|
6048
|
-
return Object.entries(
|
|
6265
|
+
return Object.entries(value);
|
|
6266
|
+
};
|
|
6267
|
+
const getGeneralEntries = selectedEvent => {
|
|
6268
|
+
if (!selectedEvent) {
|
|
6269
|
+
return [];
|
|
6270
|
+
}
|
|
6271
|
+
const entries = [];
|
|
6272
|
+
if (isNonEmptyString(selectedEvent.url)) {
|
|
6273
|
+
entries.push([requestUrl(), selectedEvent.url]);
|
|
6274
|
+
}
|
|
6275
|
+
if (isNonEmptyString(selectedEvent.method)) {
|
|
6276
|
+
entries.push([requestMethod(), selectedEvent.method]);
|
|
6277
|
+
}
|
|
6278
|
+
const statusCode$1 = getStatusCodeValue(selectedEvent);
|
|
6279
|
+
if (statusCode$1 !== undefined && statusCode$1 !== '') {
|
|
6280
|
+
entries.push([statusCode(), formatHttpStatusCode(statusCode$1)]);
|
|
6281
|
+
}
|
|
6282
|
+
return entries;
|
|
6049
6283
|
};
|
|
6050
6284
|
const getHeaderRowNodes = (headerName, headerValue, index) => {
|
|
6051
6285
|
return [{
|
|
6052
6286
|
childCount: 2,
|
|
6053
6287
|
className: mergeClassNames(ChatDebugViewHeadersRow, index % 2 === 0 ? ChatDebugViewHeadersRowOdd : ChatDebugViewHeadersRowEven),
|
|
6054
|
-
type:
|
|
6288
|
+
type: Li
|
|
6055
6289
|
}, {
|
|
6056
6290
|
childCount: 1,
|
|
6057
6291
|
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellName),
|
|
6058
|
-
type:
|
|
6292
|
+
type: Div
|
|
6059
6293
|
}, text(headerName), {
|
|
6060
6294
|
childCount: 1,
|
|
6061
6295
|
className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellValue),
|
|
6062
|
-
type:
|
|
6296
|
+
type: Div
|
|
6063
6297
|
}, text(getHeaderValueText(headerValue))];
|
|
6064
6298
|
};
|
|
6065
|
-
const
|
|
6066
|
-
const headers = getHeaders(selectedEvent);
|
|
6067
|
-
if (headers.length === 0) {
|
|
6068
|
-
return responseEventNodes;
|
|
6069
|
-
}
|
|
6299
|
+
const getHeadersTableNodes = headers => {
|
|
6070
6300
|
const headerRows = [];
|
|
6071
6301
|
for (const [index, [headerName, headerValue]] of headers.entries()) {
|
|
6072
6302
|
headerRows.push(...getHeaderRowNodes(headerName, headerValue, index));
|
|
6073
6303
|
}
|
|
6074
6304
|
return [{
|
|
6075
|
-
childCount:
|
|
6305
|
+
childCount: headers.length,
|
|
6076
6306
|
className: ChatDebugViewHeadersTable,
|
|
6077
|
-
type:
|
|
6078
|
-
},
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
}, {
|
|
6307
|
+
type: Ul
|
|
6308
|
+
}, ...headerRows];
|
|
6309
|
+
};
|
|
6310
|
+
const getHeaderSectionNodes = (label, headers) => {
|
|
6311
|
+
return [{
|
|
6083
6312
|
childCount: 2,
|
|
6084
|
-
className:
|
|
6085
|
-
type:
|
|
6313
|
+
className: ChatDebugViewHeadersSection,
|
|
6314
|
+
type: Div
|
|
6086
6315
|
}, {
|
|
6087
6316
|
childCount: 1,
|
|
6088
|
-
className:
|
|
6089
|
-
type:
|
|
6090
|
-
}, text(
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
}
|
|
6317
|
+
className: ChatDebugViewHeadersSectionHeading,
|
|
6318
|
+
type: Div
|
|
6319
|
+
}, text(label), ...getHeadersTableNodes(headers)];
|
|
6320
|
+
};
|
|
6321
|
+
const getHeadersContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6322
|
+
const generalEntries = getGeneralEntries(selectedEvent);
|
|
6323
|
+
const requestHeaders$1 = getHeaders(selectedEvent?.headers);
|
|
6324
|
+
const responseHeaders$1 = getHeaders(isHeadersRecord(selectedEvent?.endValue) ? selectedEvent.endValue.headers : undefined);
|
|
6325
|
+
if (generalEntries.length === 0 && requestHeaders$1.length === 0 && responseHeaders$1.length === 0) {
|
|
6326
|
+
return responseEventNodes;
|
|
6327
|
+
}
|
|
6328
|
+
const nodes = [];
|
|
6329
|
+
if (generalEntries.length > 0) {
|
|
6330
|
+
nodes.push(...getHeaderSectionNodes(general(), generalEntries));
|
|
6331
|
+
}
|
|
6332
|
+
if (requestHeaders$1.length > 0) {
|
|
6333
|
+
nodes.push(...getHeaderSectionNodes(requestHeaders(), requestHeaders$1));
|
|
6334
|
+
}
|
|
6335
|
+
if (responseHeaders$1.length > 0) {
|
|
6336
|
+
nodes.push(...getHeaderSectionNodes(responseHeaders(), responseHeaders$1));
|
|
6337
|
+
}
|
|
6338
|
+
return nodes;
|
|
6099
6339
|
};
|
|
6100
6340
|
|
|
6101
6341
|
const getEditorRowDom = line => {
|
|
@@ -6982,7 +7222,13 @@ const getTextEvent = (previewEvent, selectedEvent, previewTextCursor, virtualiza
|
|
|
6982
7222
|
const showLineNumbers = !isInvalidImageMessage && !isChatMessageUpdatedPreview;
|
|
6983
7223
|
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null, undefined, virtualization);
|
|
6984
7224
|
};
|
|
7225
|
+
const isOpenAiRequestPreviewEvent = previewEvent => {
|
|
7226
|
+
return isRecord(previewEvent) && previewEvent.type === 'ai-request' && isRecord(previewEvent.endValue) && isRecord(previewEvent.endValue.value) && typeof previewEvent.endValue.value.output_text === 'string';
|
|
7227
|
+
};
|
|
6985
7228
|
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor, virtualization) => {
|
|
7229
|
+
if (isOpenAiRequestPreviewEvent(previewEvent)) {
|
|
7230
|
+
return getTextEvent(previewEvent.endValue.value.output_text);
|
|
7231
|
+
}
|
|
6986
7232
|
if (typeof previewEvent === 'string') {
|
|
6987
7233
|
return getTextEvent(previewEvent, selectedEvent, previewTextCursor, virtualization);
|
|
6988
7234
|
}
|
|
@@ -7215,12 +7461,13 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
7215
7461
|
}, ...getDetailsTopVirtualDom(normalizedDetailTabs), ...getDetailContentDom(selectedDetailTab, safeSelectedDetailTab, contentNodes)];
|
|
7216
7462
|
};
|
|
7217
7463
|
|
|
7464
|
+
const td$1 = {
|
|
7465
|
+
childCount: 1,
|
|
7466
|
+
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
7467
|
+
type: Td
|
|
7468
|
+
};
|
|
7218
7469
|
const getCellDurationDom = event => {
|
|
7219
|
-
return [
|
|
7220
|
-
childCount: 1,
|
|
7221
|
-
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
7222
|
-
type: Td
|
|
7223
|
-
}, text(getEventTableDurationText(event))];
|
|
7470
|
+
return [td$1, text(getEventTableDurationText(event))];
|
|
7224
7471
|
};
|
|
7225
7472
|
|
|
7226
7473
|
const getMethods = new Set(['list_dir', 'list_files', 'read_file']);
|
|
@@ -7246,12 +7493,13 @@ const getEventTableMethodLabel = event => {
|
|
|
7246
7493
|
return '';
|
|
7247
7494
|
};
|
|
7248
7495
|
|
|
7496
|
+
const td = {
|
|
7497
|
+
childCount: 1,
|
|
7498
|
+
className: TableCell,
|
|
7499
|
+
type: Td
|
|
7500
|
+
};
|
|
7249
7501
|
const getCellMethodDom = event => {
|
|
7250
|
-
return [
|
|
7251
|
-
childCount: 1,
|
|
7252
|
-
className: TableCell,
|
|
7253
|
-
type: Td
|
|
7254
|
-
}, text(getEventTableMethodLabel(event))];
|
|
7502
|
+
return [td, text(getEventTableMethodLabel(event))];
|
|
7255
7503
|
};
|
|
7256
7504
|
|
|
7257
7505
|
const getCellStatusDom = (event, isErrorStatus) => {
|
|
@@ -8065,7 +8313,7 @@ const renderEventListeners = () => {
|
|
|
8065
8313
|
params: ['handleTimelineDoubleClick']
|
|
8066
8314
|
}, {
|
|
8067
8315
|
name: HandlePreviewTextPointerDown,
|
|
8068
|
-
params: ['handlePreviewTextPointerDown'
|
|
8316
|
+
params: ['handlePreviewTextPointerDown']
|
|
8069
8317
|
}];
|
|
8070
8318
|
};
|
|
8071
8319
|
|