@lvce-editor/chat-debug-view 10.18.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.
@@ -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
 
@@ -1480,7 +1482,6 @@ const InvalidUriEncoding = 'Invalid URI encoding';
1480
1482
  const InvalidUriFormat = 'Invalid URI format';
1481
1483
  const Method$1 = 'Method';
1482
1484
  const MissingUri = 'Missing URI';
1483
- const Name = 'Name';
1484
1485
  const Network = 'Network';
1485
1486
  const NoChatSessionFound = 'No chat session found for sessionId "{PH1}".';
1486
1487
  const NoEventsFound = 'No events have been found';
@@ -1513,7 +1514,6 @@ const Type$1 = 'Type';
1513
1514
  const Ui = 'UI';
1514
1515
  const UnableToLoadDebugSessionInvalidUri = 'Unable to load debug session: invalid URI "{PH1}". Expected format: chat-debug://<sessionId>.';
1515
1516
  const UnableToLoadDebugSessionMissingUri = 'Unable to load debug session: missing URI. Expected format: chat-debug://<sessionId>.';
1516
- const Value = 'Value';
1517
1517
  const WindowSummary = 'Window {PH1}-{PH2} of {PH3}';
1518
1518
 
1519
1519
  const copy = () => {
@@ -1589,9 +1589,6 @@ const missingUri = () => {
1589
1589
  const method = () => {
1590
1590
  return i18nString(Method$1);
1591
1591
  };
1592
- const name = () => {
1593
- return i18nString(Name);
1594
- };
1595
1592
  const network = () => {
1596
1593
  return i18nString(Network);
1597
1594
  };
@@ -1682,9 +1679,6 @@ const tools = () => {
1682
1679
  const type = () => {
1683
1680
  return i18nString(Type$1);
1684
1681
  };
1685
- const value = () => {
1686
- return i18nString(Value);
1687
- };
1688
1682
  const ui = () => {
1689
1683
  return i18nString(Ui);
1690
1684
  };
@@ -4166,28 +4160,43 @@ const shouldIncludeArguments = (event, name) => {
4166
4160
  return true;
4167
4161
  };
4168
4162
 
4169
- const getPayloadEvent = event => {
4170
- const {
4171
- requestEvent
4172
- } = event;
4173
- if (requestEvent && typeof requestEvent === 'object' && typeof requestEvent.type === 'string') {
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;
4163
+ const getMergedRequestPayloadEvent = requestEvent => {
4164
+ if (!requestEvent || typeof requestEvent !== 'object') {
4165
+ return {
4166
+ found: false
4167
+ };
4185
4168
  }
4186
- const name = getPreviewName(event);
4187
- if (name === 'list_files' && hasOwn(event, 'arguments')) {
4188
- return event.arguments;
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
+ };
4189
4186
  }
4190
- const payloadEvent = {
4187
+ if (hasOwn(mergedRequestEvent, 'arguments')) {
4188
+ return {
4189
+ found: true,
4190
+ value: mergedRequestEvent.arguments
4191
+ };
4192
+ }
4193
+ return {
4194
+ found: true,
4195
+ value: requestEvent
4196
+ };
4197
+ };
4198
+ const getPayloadObject = (event, name) => {
4199
+ return {
4191
4200
  ...(name === undefined ? {} : {
4192
4201
  name
4193
4202
  }),
@@ -4198,6 +4207,23 @@ const getPayloadEvent = event => {
4198
4207
  result: event.result
4199
4208
  } : {})
4200
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);
4201
4227
  if (Object.keys(payloadEvent).length > 0) {
4202
4228
  return payloadEvent;
4203
4229
  }
@@ -5291,8 +5317,9 @@ const getCss = state => {
5291
5317
  }
5292
5318
 
5293
5319
  .ChatDebugViewHeadersTable {
5294
- border-collapse: collapse;
5295
- table-layout: fixed;
5320
+ list-style: none;
5321
+ margin: 0;
5322
+ padding: 0;
5296
5323
  width: 100%;
5297
5324
  }
5298
5325
 
@@ -5314,22 +5341,20 @@ const getCss = state => {
5314
5341
  text-transform: uppercase;
5315
5342
  }
5316
5343
 
5344
+ .ChatDebugViewHeadersRow {
5345
+ display: grid;
5346
+ grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
5347
+ }
5348
+
5317
5349
  .ChatDebugViewHeadersCell {
5318
5350
  border-bottom: 1px solid var(--vscode-panel-border, rgba(255, 255, 255, 0.12));
5351
+ min-width: 0;
5319
5352
  color: var(--vscode-editor-foreground);
5320
5353
  padding: 6px 10px;
5321
5354
  text-align: left;
5322
- vertical-align: top;
5323
5355
  word-break: break-word;
5324
5356
  }
5325
5357
 
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
5358
  .ChatDebugViewHeadersRowOdd {
5334
5359
  background: rgba(255, 255, 255, 0.02);
5335
5360
  }
@@ -5340,7 +5365,6 @@ const getCss = state => {
5340
5365
 
5341
5366
  .ChatDebugViewHeadersCellName {
5342
5367
  font-weight: 500;
5343
- width: 38%;
5344
5368
  }
5345
5369
  .PreviewVirtualizedEditor {
5346
5370
  height: var(--ChatDebugViewPreviewViewportHeight);
@@ -5741,11 +5765,9 @@ const PanelTab = 'PanelTab';
5741
5765
  const PanelTabSelected = 'PanelTabSelected';
5742
5766
  const ChatDebugViewDetailsTabs = 'ChatDebugViewDetailsTabs';
5743
5767
  const ChatDebugViewDetailsTop = 'ChatDebugViewDetailsTop';
5744
- const ChatDebugViewHeadersBody = 'ChatDebugViewHeadersBody';
5745
5768
  const ChatDebugViewHeadersCell = 'ChatDebugViewHeadersCell';
5746
5769
  const ChatDebugViewHeadersCellName = 'ChatDebugViewHeadersCellName';
5747
5770
  const ChatDebugViewHeadersCellValue = 'ChatDebugViewHeadersCellValue';
5748
- const ChatDebugViewHeadersHead = 'ChatDebugViewHeadersHead';
5749
5771
  const ChatDebugViewHeadersRow = 'ChatDebugViewHeadersRow';
5750
5772
  const ChatDebugViewHeadersRowEven = 'ChatDebugViewHeadersRowEven';
5751
5773
  const ChatDebugViewHeadersRowOdd = 'ChatDebugViewHeadersRowOdd';
@@ -6091,6 +6113,96 @@ const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
6091
6113
  return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
6092
6114
  };
6093
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
+
6094
6206
  const isHeadersRecord = value => {
6095
6207
  return typeof value === 'object' && value !== null && !Array.isArray(value);
6096
6208
  };
@@ -6165,7 +6277,7 @@ const getGeneralEntries = selectedEvent => {
6165
6277
  }
6166
6278
  const statusCode$1 = getStatusCodeValue(selectedEvent);
6167
6279
  if (statusCode$1 !== undefined && statusCode$1 !== '') {
6168
- entries.push([statusCode(), statusCode$1]);
6280
+ entries.push([statusCode(), formatHttpStatusCode(statusCode$1)]);
6169
6281
  }
6170
6282
  return entries;
6171
6283
  };
@@ -6173,15 +6285,15 @@ const getHeaderRowNodes = (headerName, headerValue, index) => {
6173
6285
  return [{
6174
6286
  childCount: 2,
6175
6287
  className: mergeClassNames(ChatDebugViewHeadersRow, index % 2 === 0 ? ChatDebugViewHeadersRowOdd : ChatDebugViewHeadersRowEven),
6176
- type: Tr
6288
+ type: Li
6177
6289
  }, {
6178
6290
  childCount: 1,
6179
6291
  className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellName),
6180
- type: Td
6292
+ type: Div
6181
6293
  }, text(headerName), {
6182
6294
  childCount: 1,
6183
6295
  className: mergeClassNames(ChatDebugViewHeadersCell, ChatDebugViewHeadersCellValue),
6184
- type: Td
6296
+ type: Div
6185
6297
  }, text(getHeaderValueText(headerValue))];
6186
6298
  };
6187
6299
  const getHeadersTableNodes = headers => {
@@ -6190,29 +6302,9 @@ const getHeadersTableNodes = headers => {
6190
6302
  headerRows.push(...getHeaderRowNodes(headerName, headerValue, index));
6191
6303
  }
6192
6304
  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
6305
  childCount: headers.length,
6214
- className: ChatDebugViewHeadersBody,
6215
- type: TBody
6306
+ className: ChatDebugViewHeadersTable,
6307
+ type: Ul
6216
6308
  }, ...headerRows];
6217
6309
  };
6218
6310
  const getHeaderSectionNodes = (label, headers) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-debug-view",
3
- "version": "10.18.0",
3
+ "version": "10.19.0",
4
4
  "description": "Chat Debug View Worker",
5
5
  "repository": {
6
6
  "type": "git",